EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
MapService.cpp
Go to the documentation of this file.
1 /*
2  ------------------------------------------------------------------------------------
3  LICENSE:
4  ------------------------------------------------------------------------------------
5  This file is part of EVEmu: EVE Online Server Emulator
6  Copyright 2006 - 2021 The EVEmu Team
7  For the latest information visit https://evemu.dev
8  ------------------------------------------------------------------------------------
9  This program is free software; you can redistribute it and/or modify it under
10  the terms of the GNU Lesser General Public License as published by the Free Software
11  Foundation; either version 2 of the License, or (at your option) any later
12  version.
13 
14  This program is distributed in the hope that it will be useful, but WITHOUT
15  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public License along with
19  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
20  Place - Suite 330, Boston, MA 02111-1307, USA, or go to
21  http://www.gnu.org/copyleft/lesser.txt.
22  ------------------------------------------------------------------------------------
23  Author: Zhur
24  Rewrite: Allan
25 */
26 
27 #include "eve-server.h"
28 
29 #include "PyServiceCD.h"
30 #include "StaticDataMgr.h"
31 #include "map/MapData.h"
32 #include "map/MapService.h"
33 #include "system/SystemManager.h"
35 
37 
39 : PyService(mgr, "map"),
40  m_dispatch(new Dispatcher(this))
41 {
42  _SetCallDispatcher(m_dispatch);
43 
44  PyCallable_REG_CALL(MapService, GetHistory);
45  PyCallable_REG_CALL(MapService, GetBeaconCount); //ColorStarsByCynosuralFields
46  PyCallable_REG_CALL(MapService, GetStationCount); //ColorStarsByStationCount
47  PyCallable_REG_CALL(MapService, GetMyExtraMapInfo); //ColorStarsByCorpMates
48  PyCallable_REG_CALL(MapService, GetStationExtraInfo);
49  PyCallable_REG_CALL(MapService, GetSolarSystemVisits);
50  PyCallable_REG_CALL(MapService, GetLinkableJumpArrays);
51  PyCallable_REG_CALL(MapService, GetMyExtraMapInfoAgents); //ColorStarsByMyAgents
52  PyCallable_REG_CALL(MapService, GetSolarSystemPseudoSecurities);
53 
55  PyCallable_REG_CALL(MapService, GetStuckSystems);
56  PyCallable_REG_CALL(MapService, GetRecentSovActivity);
57  PyCallable_REG_CALL(MapService, GetDeadspaceAgentsMap);
58  PyCallable_REG_CALL(MapService, GetDeadspaceComplexMap);
59  PyCallable_REG_CALL(MapService, GetIncursionGlobalReport);
60  PyCallable_REG_CALL(MapService, GetSystemsInIncursions); //ColorStarsByIncursions
61  PyCallable_REG_CALL(MapService, GetSystemsInIncursionsGM); //ColorStarsByIncursions
62  PyCallable_REG_CALL(MapService, GetVictoryPoints);
63  PyCallable_REG_CALL(MapService, GetAllianceJumpBridges);
64  PyCallable_REG_CALL(MapService, GetAllianceBeacons);
65  PyCallable_REG_CALL(MapService, GetCurrentSovData);
66  // custom call for displaying all items in system
67  PyCallable_REG_CALL(MapService, GetCurrentEntities);
68 
69 }
70 
72 {
73  delete m_dispatch;
74 }
75 
76 PyResult MapService::Handle_GetCurrentEntities(PyCallArgs &call)
77 {
78  return call.client->SystemMgr()->GetCurrentEntities();
79 }
80 
81 PyResult MapService::Handle_GetSolarSystemVisits(PyCallArgs &call)
82 {
84 }
85 
86 PyResult MapService::Handle_GetMyExtraMapInfoAgents(PyCallArgs &call)
87 {
89 }
90 
91 PyResult MapService::Handle_GetMyExtraMapInfo(PyCallArgs &call)
92 {
94 }
95 
96 PyResult MapService::Handle_GetBeaconCount(PyCallArgs &call)
97 {
98  return MapDB::GetDynamicData(2, 24);
99 }
100 
101 PyResult MapService::Handle_GetStationExtraInfo(PyCallArgs &call)
102 {
103  return sMapData.GetStationExtraInfo();
104 }
105 
106 PyResult MapService::Handle_GetSolarSystemPseudoSecurities(PyCallArgs &call)
107 {
108  // cant find a call to this in client (possible old call)
109  return sMapData.GetPseudoSecurities();
110 }
111 
112 PyResult MapService::Handle_GetStationCount(PyCallArgs &call)
113 {
114  // cached on client side. if cache is empty, this call is made.
115  return sDataMgr.GetStationCount();
116 }
117 
118 PyResult MapService::Handle_GetHistory(PyCallArgs &call) {
119  uint8 int1 = PyRep::IntegerValueU32(call.tuple->GetItem(0));
120  uint8 int2 = PyRep::IntegerValueU32(call.tuple->GetItem(1));
121  if (is_log_enabled(SERVICE__CALLS))
122  sLog.Cyan( "MapService::Handle_GetHistory()", "type: %i, timeframe: %i", int1, int2 );
123 
124  return MapDB::GetDynamicData(int1, int2);
125 }
126 
127 PyResult MapService::Handle_GetLinkableJumpArrays(PyCallArgs &call)
128 { // working
129  DBQueryResult res;
131  PyList* list = new PyList();
132  DBResultRow row;
133  while (res.GetRow(row)) {
134  // SELECT systemID, itemID
135  PyTuple* tuple = new PyTuple(2);
136  tuple->SetItem(0, new PyInt(row.GetInt(0)));
137  tuple->SetItem(1, new PyInt(row.GetInt(1)));
138  list->AddItem(tuple);
139  }
140 
141  return list;
142 }
143 
146 PyResult MapService::Handle_GetAllianceJumpBridges(PyCallArgs &call)
147 {
151  sLog.Warning( "MapService::Handle_GetAllianceJumpBridges()", "size= %u", call.tuple->size() );
152  call.Dump(SERVICE__CALL_DUMP);
153 
154  DBQueryResult res;
156  PyList* list = new PyList();
157  DBResultRow row;
158  while (res.GetRow(row)) {
159  // SELECT systemID, itemID
160  PyTuple* tuple = new PyTuple(2);
161  tuple->SetItem(0, new PyInt(row.GetInt(0)));
162  tuple->SetItem(1, new PyInt(row.GetInt(1)));
163  list->AddItem(tuple);
164  }
165 
166  return list;
167 }
168 
169 PyResult MapService::Handle_GetAllianceBeacons(PyCallArgs &call)
170 {
171  sLog.Warning( "MapService::Handle_GetAllianceBeacons()", "size= %u", call.tuple->size() );
172  call.Dump(SERVICE__CALL_DUMP);
173 
174  // Get data directly from sovereignty manager, avoiding db hits
175  return svDataMgr.GetAllianceBeacons(call.client->GetAllianceID());
176 }
177 
178 PyResult MapService::Handle_GetCurrentSovData(PyCallArgs &call)
179 {
184  sLog.Warning( "MapService::Handle_GetCurrentSovData()", "size= %u", call.tuple->size() );
185  call.Dump(SERVICE__CALL_DUMP);
186 
187  Call_SingleIntegerArg args;
188  if (!args.Decode(&call.tuple)) {
189  codelog(SERVICE__ERROR, "%s: Failed to decode arguments.", GetName());
190  return nullptr;
191  }
192 
193  return svDataMgr.GetCurrentSovData(args.arg);
194 }
195 PyResult MapService::Handle_GetRecentSovActivity(PyCallArgs &call)
196 {
198  /*
199  * data = sm.RemoteSvc('map').GetRecentSovActivity()
200  * changes = []
201  * resultMap = {}
202  * toPrime = set()
203  * for item in data:
204  * if item.stationID is None:
205  * if bool(changeMode & mapcommon.SOV_CHANGES_SOV_GAIN) and item.oldOwnerID is None:
206  * changes.append((item.solarSystemID, 'UI/Map/StarModeHandler/sovereigntySovGained', (None, item.ownerID)))
207  * toPrime.add(item.ownerID)
208  * elif bool(changeMode & mapcommon.SOV_CHANGES_SOV_LOST) and item.ownerID is None:
209  * changes.append((item.solarSystemID, 'UI/Map/StarModeHandler/sovereigntySovLost', (item.oldOwnerID, None)))
210  * toPrime.add(item.oldOwnerID)
211  * elif bool(changeMode & mapcommon.SOV_CHANGES_SOV_GAIN) and item.oldOwnerID is None:
212  * changes.append((item.solarSystemID, 'UI/Map/StarModeHandler/sovereigntyNewOutpost', (None, item.ownerID)))
213  * toPrime.add(item.ownerID)
214  * elif bool(changeMode & mapcommon.SOV_CHANGES_SOV_GAIN) and item.ownerID is not None:
215  * changes.append((item.solarSystemID, 'UI/Map/StarModeHandler/sovereigntyConqueredOutpost', (item.ownerID, item.oldOwnerID)))
216  * toPrime.add(item.ownerID)
217  * toPrime.add(item.oldOwnerID)
218  *
219  */
220 
221  PyDict* result = new PyDict();
222 
223  return result;
224 }
225 
226 // DED Agent Site Report
227 PyResult MapService::Handle_GetDeadspaceAgentsMap(PyCallArgs &call)
228 {/* no packet data
229  dungeons = sm.RemoteSvc('map').GetDeadspaceAgentsMap(eve.session.languageID)
230  solarSystemID, dungeonID, difficulty, dungeonName = dungeons
231 */
232  PyRep *result = new PyDict();
233 
234  return result;
235 }
236 
237 // DED Deadspace Report
238 //22:37:54 L MapService::Handle_GetDeadspaceComplexMap(): size= 1
239 PyResult MapService::Handle_GetDeadspaceComplexMap(PyCallArgs &call)
240 {/* no packet data
241  dungeons = sm.RemoteSvc('map').GetDeadspaceComplexMap(eve.session.languageID)
242  solarSystemID, dungeonID, difficulty, dungeonName = dungeons
243 
244  get this data from managerDB.GetAnomalyList(DBQueryResult& res)
245  res = sysSignatures (sigID,sigItemID,dungeonType,sigName,systemID,sigTypeID,sigGroupID,scanGroupID,scanAttributeID,x,y,z)
246 */
247  sLog.Warning( "MapService::Handle_GetDeadspaceComplexMap()", "size= %u", call.tuple->size() );
248  call.Dump(SERVICE__CALL_DUMP);
249  PyRep *result = new PyDict();
250 
251  return result;
252 }
253 
254 PyResult MapService::Handle_GetSystemsInIncursions(PyCallArgs &call) {
261  // copy format from GetLinkableJumpArrays()
262  DBQueryResult res;
263  //PosMgrDB::GetAllianceBeacons(call.client->GetCorporationID(), res);
264  PyList* list = new PyList();
265  DBResultRow row;
266  while (res.GetRow(row)) {
267  // SELECT systemID, sceneType
268  PyTuple* tuple = new PyTuple(2);
269  tuple->SetItem(0, new PyInt(row.GetInt(0))); //solarSystemID
270  tuple->SetItem(1, new PyInt(row.GetInt(1))); //sceneType
271  list->AddItem(tuple);
272  }
273 
274  return list;
275 }
276 
277 PyResult MapService::Handle_GetSystemsInIncursionsGM(PyCallArgs &call) {
284  // copy format from GetLinkableJumpArrays()
285  DBQueryResult res;
286  //PosMgrDB::GetAllianceBeacons(call.client->GetCorporationID(), res);
287  PyList* list = new PyList();
288  DBResultRow row;
289  while (res.GetRow(row)) {
290  // SELECT systemID, sceneType
291  PyTuple* tuple = new PyTuple(2);
292  tuple->SetItem(0, new PyInt(row.GetInt(0))); //solarSystemID
293  tuple->SetItem(1, new PyInt(row.GetInt(1))); //sceneType
294  list->AddItem(tuple);
295  }
296 
297  return list;
298 }
299 
300 //05:52:07 L MapService::Handle_GetIncursionGlobalReport(): size= 0
301 PyResult MapService::Handle_GetIncursionGlobalReport(PyCallArgs &call) {
322  /*
323  [PySubStream 1128 bytes]
324  [PyObjectData Name: objectCaching.CachedMethodCallResult]
325  [PyTuple 3 items]
326  [PyDict 1 kvp]
327  [PyString "versionCheck"]
328  [PyTuple 3 items]
329  [PyNone]
330  [PyNone]
331  [PyString "15 minutes"]
332  [PySubStream 1027 bytes]
333  [PyList 7 items]
334  [PyObjectData Name: util.KeyVal]
335  [PyDict 9 kvp]
336  [PyString "graceTime"]
337  [PyFloat 30]
338  [PyString "decayRate"]
339  [PyFloat 0.00999999977648258]
340  [PyString "influence"]
341  [PyFloat 0.0145000005140901]
342  [PyString "lastUpdated"]
343  [PyIntegerVar 129492976800000000]
344  [PyString "state"]
345  [PyInt 1]
346  [PyString "hasBoss"]
347  [PyInt 0]
348  [PyString "stagingSolarSystemID"]
349  [PyInt 30004323]
350  [PyString "rewardGroupID"]
351  [PyInt 192]
352  [PyString "taleID"]
353  [PyInt 192]
354  [PyList 2 items]
355  [PyIntegerVar 129493861959830226]
356  [PyInt -950263469]
357  */
358  sLog.Warning( "MapService::Handle_GetIncursionGlobalReport()", "size= %u", call.tuple->size() );
359  call.Dump(SERVICE__CALL_DUMP);
360 
361  return PyStatic.NewNone();
362 }
363 
364 // factional warfare shit
365 //https://wiki.eveonline.com/en/wiki/Victory_Points_and_Command_Bunker
366 PyResult MapService::Handle_GetVictoryPoints(PyCallArgs &call)
367 {
369  sLog.Warning( "MapService::Handle_GetVictoryPoints()", "size= %u", call.tuple->size() );
370  call.Dump(SERVICE__CALL_DUMP);
371 
372  return PyStatic.NewNone();
373 }
374 
375 
376 PyResult MapService::Handle_GetStuckSystems(PyCallArgs &call)
377 {
378  // cant find a call to this in client (possible old call)
379  sLog.Warning( "MapService::Handle_GetStuckSystems()", "size= %u", call.tuple->size() );
380  call.Dump(SERVICE__CALL_DUMP);
381 
382  uint8 none = 0;
383 
384  PyTuple* res = NULL;
385  PyTuple* tuple0 = new PyTuple( 1 );
386 
387  tuple0->items[ 0 ] = new PyInt( none );
388 
389  res = tuple0;
390 
391  return res;
392 }
393 
Base Python wire object.
Definition: PyRep.h:66
Dispatcher *const m_dispatch
unsigned __int8 uint8
Definition: eve-compat.h:46
static PyObject * GetSolSystemVisits(uint32)
Definition: MapDB.cpp:96
PyRep * GetItem(size_t index) const
Returns Python object.
Definition: PyRep.h:602
int32 GetInt(uint32 index) const
Definition: dbcore.cpp:635
static PyRep * GetDynamicData(uint8 type, uint8 time)
Definition: MapDB.cpp:153
Python's dictionary.
Definition: PyRep.h:719
size_t size() const
Definition: PyRep.h:591
PyCallable_Make_InnerDispatcher(MapService) MapService
Definition: MapService.cpp:36
static PyRep * GetMyCorpMates(uint32 corpID)
int32 GetCharacterID() const
Definition: Client.h:113
int32 GetCorporationID() const
Definition: Client.h:123
static uint32 IntegerValueU32(PyRep *pRep)
Definition: PyRep.cpp:134
Python tuple.
Definition: PyRep.h:567
const char * GetName() const
Definition: PyService.h:54
int32 GetAllianceID() const
Definition: Client.h:125
void AddItem(PyRep *i)
Definition: PyRep.h:701
PyRep * GetCurrentEntities()
* args
bool GetRow(DBResultRow &into)
Definition: dbcore.cpp:552
static void GetLinkableJumpArrays(uint32 corpID, DBQueryResult &res)
Definition: PosMgrDB.cpp:67
#define is_log_enabled(type)
Definition: logsys.h:78
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
static PyRep * GetMyStandings(uint32 charID)
Definition: StandingDB.cpp:64
#define codelog(type, fmt,...)
Definition: logsys.h:128
void SetItem(size_t index, PyRep *object)
Stores Python object.
Definition: PyRep.h:610
SystemManager * SystemMgr() const
Definition: Client.h:92
Python integer.
Definition: PyRep.h:231
#define PyStatic
Definition: PyRep.h:1209
static void GetAllianceJumpArrays(uint32 allyID, DBQueryResult &res)
Definition: PosMgrDB.cpp:87
Client *const client
Definition: PyCallable.h:49
#define PyCallable_REG_CALL(c, m)
Definition: PyServiceCD.h:78
Dispatcher *const m_dispatch
Definition: MapService.h:41
void Dump(LogType type) const
Definition: PyCallable.cpp:81
storage_type items
Definition: PyRep.h:628
virtual ~MapService()
Definition: MapService.cpp:71
#define svDataMgr
Python list.
Definition: PyRep.h:639
PyTuple * tuple
Definition: PyCallable.h:50
#define sDataMgr
#define sMapData
Definition: MapData.h:54