EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
PosMgr.cpp
Go to the documentation of this file.
1 
10 /*
11  * POS__ERROR
12  * POS__WARNING
13  * POS__MESSAGE
14  * POS__DUMP
15  * POS__DEBUG
16  * POS__DESTINY
17  * POS__SLIMITEM
18  * POS__TRACE
19  */
20 
21 
22 #include "eve-server.h"
23 
24 #include "PyBoundObject.h"
25 #include "PyServiceCD.h"
26 #include "planet/Moon.h"
27 #include "pos/PosMgr.h"
28 #include "pos/Array.h"
29 #include "pos/Battery.h"
30 #include "pos/Structure.h"
31 #include "pos/Tower.h"
32 #include "pos/Weapon.h"
33 #include "system/SystemManager.h"
34 
35 
37 : public PyBoundObject
38 {
39 public:
41 
43  : PyBoundObject(mgr),
44  m_dispatch(new Dispatcher(this))
45  {
47 
48  m_strBoundObjectName = "PosMgrBound";
49 
50  m_systemID = systemID;
51 
52  PyCallable_REG_CALL(PosMgrBound, GetMoonForTower);
53  PyCallable_REG_CALL(PosMgrBound, SetTowerPassword);
54  PyCallable_REG_CALL(PosMgrBound, SetShipPassword);
55  PyCallable_REG_CALL(PosMgrBound, GetSiloCapacityByItemID);
56  PyCallable_REG_CALL(PosMgrBound, AnchorOrbital);
57  PyCallable_REG_CALL(PosMgrBound, UnanchorOrbital);
58  PyCallable_REG_CALL(PosMgrBound, OnlineOrbital);
59  PyCallable_REG_CALL(PosMgrBound, GMUpgradeOrbital);
60  PyCallable_REG_CALL(PosMgrBound, AnchorStructure);
61  PyCallable_REG_CALL(PosMgrBound, UnanchorStructure);
62  PyCallable_REG_CALL(PosMgrBound, AssumeStructureControl);
63  PyCallable_REG_CALL(PosMgrBound, RelinquishStructureControl);
64  PyCallable_REG_CALL(PosMgrBound, ChangeStructureProvisionType);
65  PyCallable_REG_CALL(PosMgrBound, CompleteOrbitalStateChange);
66  PyCallable_REG_CALL(PosMgrBound, GetMoonProcessInfoForTower);
67  PyCallable_REG_CALL(PosMgrBound, LinkResourceForTower);
68  PyCallable_REG_CALL(PosMgrBound, RunMoonProcessCycleforTower);
69  PyCallable_REG_CALL(PosMgrBound, GetStarbasePermissions);
70  PyCallable_REG_CALL(PosMgrBound, SetStarbasePermissions);
71  PyCallable_REG_CALL(PosMgrBound, GetTowerNotificationSettings);
72  PyCallable_REG_CALL(PosMgrBound, SetTowerNotifications);
73  PyCallable_REG_CALL(PosMgrBound, GetTowerSentrySettings);
74  PyCallable_REG_CALL(PosMgrBound, SetTowerSentrySettings);
75  PyCallable_REG_CALL(PosMgrBound, InstallJumpBridgeLink);
76  PyCallable_REG_CALL(PosMgrBound, UninstallJumpBridgeLink);
77  }
78 
79  virtual ~PosMgrBound() {delete m_dispatch;}
80  virtual void Release() {
81  delete this;
82  }
83 
84  PyCallable_DECL_CALL(SetTowerPassword);
85  PyCallable_DECL_CALL(SetShipPassword);
86  PyCallable_DECL_CALL(GetMoonForTower);
87  PyCallable_DECL_CALL(GetSiloCapacityByItemID);
88  PyCallable_DECL_CALL(AnchorOrbital);
89  PyCallable_DECL_CALL(UnanchorOrbital);
90  PyCallable_DECL_CALL(OnlineOrbital);
91  PyCallable_DECL_CALL(GMUpgradeOrbital);
92  PyCallable_DECL_CALL(AnchorStructure);
93  PyCallable_DECL_CALL(UnanchorStructure);
94  PyCallable_DECL_CALL(AssumeStructureControl);
95  PyCallable_DECL_CALL(RelinquishStructureControl);
96  PyCallable_DECL_CALL(ChangeStructureProvisionType);
97  PyCallable_DECL_CALL(CompleteOrbitalStateChange);
98  PyCallable_DECL_CALL(GetMoonProcessInfoForTower);
99  PyCallable_DECL_CALL(LinkResourceForTower);
100  PyCallable_DECL_CALL(RunMoonProcessCycleforTower);
101  PyCallable_DECL_CALL(GetStarbasePermissions);
102  PyCallable_DECL_CALL(SetStarbasePermissions);
103  PyCallable_DECL_CALL(GetTowerNotificationSettings);
104  PyCallable_DECL_CALL(SetTowerNotifications);
105  PyCallable_DECL_CALL(GetTowerSentrySettings);
106  PyCallable_DECL_CALL(SetTowerSentrySettings);
107  PyCallable_DECL_CALL(InstallJumpBridgeLink);
108  PyCallable_DECL_CALL(UninstallJumpBridgeLink);
109 
110 protected:
111  Dispatcher* const m_dispatch;
114 };
115 
116 
118 
120 : PyService(mgr, "posMgr"),
121 m_dispatch(new Dispatcher(this))
122 {
123  _SetCallDispatcher(m_dispatch);
124 
125  PyCallable_REG_CALL(PosMgr, GetJumpArrays);
126  PyCallable_REG_CALL(PosMgr, GetControlTowers);
127  PyCallable_REG_CALL(PosMgr, GetControlTowerFuelRequirements);
128 }
129 
131  delete m_dispatch;
132 }
133 
134 PyBoundObject* PosMgr::CreateBoundObject( Client* pClient, const PyRep* bind_args ) {
135  _log( POS__DUMP, "PosMgr bind request for:" );
136  bind_args->Dump( POS__DUMP, " " );
137 
138  if (!bind_args->IsInt()){
139  sLog.Error( "PosMgr::CreateBoundObject", "%s: bind_args is not int: '%s'. ", pClient->GetName(), bind_args->TypeString() );
140  return nullptr;
141  }
142 
143  return new PosMgrBound(m_manager, bind_args->AsInt()->value());
144 }
145 
146 PyResult PosMgr::Handle_GetControlTowerFuelRequirements(PyCallArgs &call) {
148  DBQueryResult res;
150 
151  DBResultRow row;
152  PyList* list = new PyList();
153  while (res.GetRow(row)) {
154  //SELECT controlTowerTypeID, resourceTypeID, purpose, quantity, minSecurityLevel, factionID, wormholeClassID
155  PyDict* dict = new PyDict();
156  dict->SetItemString("controlTowerTypeID", new PyInt(row.GetInt(0)));
157  dict->SetItemString("resourceTypeID", new PyInt(row.GetInt(1)));
158  dict->SetItemString("purpose", new PyInt(row.GetInt(2)));
159  dict->SetItemString("quantity", new PyInt(row.GetInt(3)));
160  dict->SetItemString("minSecurityLevel", (row.IsNull(4) ? PyStatic.NewNone() : new PyFloat(row.GetDouble(4))));
161  dict->SetItemString("factionID", (row.IsNull(5) ? PyStatic.NewNone() : new PyInt(row.GetInt(5))));
162  dict->SetItemString("wormholeClassID", (row.IsNull(6) ? PyStatic.NewNone() : new PyInt(row.GetInt(6))));
163  list->AddItem(new PyObject("util.KeyVal", dict));
164  }
165 
166  return list;
167 }
168 
169 PyResult PosMgr::Handle_GetControlTowers(PyCallArgs &call) {
170  /* ct = sm.RemoteSvc('posMgr').GetControlTowers()
171  * for row in ct:
172  * typeID, structureID, solarSystemID = row[0:3]
173  *
174  * [CRowSet]
175  * [DBRowDescriptor]
176  * ["typeID" => [I4] ]
177  * ["itemID" => [I8] ]
178  * ["locationID" => [I8] ]
179  * Rows:
180  * [PyPackedRow 21 bytes]
181  * ["typeID" => [I4] <20062>]
182  * ["itemID" => [I8] <1013581844534>]
183  * ["locationID" => [I8] <30002206>]
184  * [PyPackedRow 21 bytes]
185  * ["typeID" => [I4] <27606>]
186  * ["itemID" => [I8] <1010759458081>]
187  * ["locationID" => [I8] <30002225>]
188  */
189 
190  _log(POS__TRACE, "PosMgr::Handle_GetControlTowers()");
191  call.Dump(POS__DUMP);
192 
194 }
195 
196 PyResult PosMgr::Handle_GetJumpArrays(PyCallArgs &call) {
197  /* jb = sm.RemoteSvc('posMgr').GetJumpArrays()
198  *
199  * for data in jb:
200  * solarSystemID, subData = data (fromSystem, solarSystemData) <-- tuple (to solarSystemID, StructureData)
201  * ssid = subData.keys()[0] <-- jb itemID (from)
202  * tsid = subData.values()[0][1] <-- jb itemID (to)
203  *
204  * fromStructure = solarSystemData.keys()[0] <-- indexed dict of tuple
205  * toSystem = cfg.evelocations.Get(solarSystemData.values()[0][0]) <-- to solarSystemID
206  * toStructure = solarSystemData.values()[0][1] <-- jb itemID (to)
207  * toStructureType = solarSystemData.values()[0][2] <-- jb typeID
208  */
209  DBQueryResult res;
211 
212  DBResultRow row;
213  PyList* list = new PyList();
214  while (res.GetRow(row)) {
215  //SELECT itemID, systemID, toItemID, toTypeID, toSystemID
216  PyTuple* rsp = new PyTuple(2);
217  rsp->SetItem(0, new PyInt(row.GetInt(1)));
218  if (row.GetInt(2) > 0) {
219  PyDict* dict = new PyDict();
220  PyTuple* tuple = new PyTuple(3);
221  tuple->SetItem(0, new PyInt(row.GetInt(4)));
222  tuple->SetItem(1, new PyInt(row.GetInt(2)));
223  tuple->SetItem(2, new PyInt(row.GetInt(3)));
224  dict->SetItem(new PyInt(row.GetInt(0)), tuple);
225  rsp->SetItem(1, dict);
226  } else {
227  rsp->SetItem(1, PyStatic.NewNone());
228  }
229 
230  list->AddItem(rsp);
231  }
232 
233  list->Dump(POS__RSP_DUMP, " ");
234  return list;
235 }
236 
237 PyResult PosMgrBound::Handle_InstallJumpBridgeLink(PyCallArgs &call) {
251  _log(POS__TRACE, "PosMgrBound::Handle_InstallJumpBridgeLink()");
252  call.Dump(POS__DUMP);
253 
254  InstallJumpBridgeLink args;
255  if (!args.Decode(&call.tuple)) {
256  codelog(SERVICE__ERROR, "%s: Failed to decode arguments.", GetName());
257  return nullptr;
258  }
259 
260  m_db.InstallBridgeLink(args.itemID, args.toSystemID, args.toItemID);
261 
262  return PyStatic.NewNone();
263 }
264 
265 PyResult PosMgrBound::Handle_UninstallJumpBridgeLink(PyCallArgs &call) {
272  _log(POS__TRACE, "PosMgrBound::Handle_UninstallJumpBridgeLink()");
273  call.Dump(POS__DUMP);
274 
275  Call_SingleIntegerArg arg;
276  if (!arg.Decode(&call.tuple)) {
277  codelog(SERVICE__ERROR, "%s: Failed to decode arguments.", GetName());
278  return PyStatic.NewNone();
279  }
280 
281  m_db.UninstallBridgeLink(arg.arg);
282 
283  return PyStatic.NewNone();
284 }
285 
286 PyResult PosMgrBound::Handle_GetSiloCapacityByItemID(PyCallArgs &call) {
287  _log(POS__TRACE, "PosMgrBound::Handle_GetSiloCapacityByItemID()");
288  call.Dump(POS__DUMP);
289 
290  uint16 typeID = 0;
293  return m_db.GetSiloCapacityForType(typeID);
294 }
295 
296 PyResult PosMgrBound::Handle_GetTowerNotificationSettings(PyCallArgs &call) {
297  /*
298  * notifySettings = self.posMgr.GetTowerNotificationSettings(self.slimItem.itemID)
299  * self.fuelNotifyCheckbox.SetChecked(notifySettings.sendFuelNotifications, 0)
300  * self.calendarCheckbox.SetChecked(notifySettings.showInCalendar, 0)
301  */
302  _log(POS__TRACE, "PosMgrBound::Handle_GetTowerNotificationSettings()");
303  call.Dump(POS__DUMP);
304 
305  PyList* header = new PyList(2);
306  header->SetItemString(0, "sendFuelNotifications");
307  header->SetItemString(1, "showInCalendar");
308  PyDict* dict = new PyDict();
309  dict->SetItemString("header", header);
310 
311  SystemManager* pSystem = call.client->SystemMgr();
312  if (pSystem == nullptr) {
313  codelog(CLIENT__ERROR, "%s: Client has no system manager!", call.client->GetName());
314  return new PyObject("util.Row", dict);
315  }
316 
317  Call_SingleIntegerArg arg;
318  if (!arg.Decode(&call.tuple)) {
319  codelog(SERVICE__ERROR, "%s: Failed to decode arguments.", GetName());
320  return new PyObject("util.Row", dict);
321  }
322 
323  TowerSE* pTSE = pSystem->GetSE(arg.arg)->GetTowerSE();
324  if (pTSE == nullptr)
325  return new PyObject("util.Row", dict);
326 
327  PyList* line = new PyList(2);
328  line->SetItem(0, new PyBool(pTSE->SendFuelNotifications()));
329  line->SetItem(1, new PyBool(pTSE->ShowInCalendar()));
330  dict->SetItemString("line", line);
331 
332  return new PyObject("util.Row", dict);
333 }
334 
335 PyResult PosMgrBound::Handle_SetTowerNotifications(PyCallArgs &call) {
336  //self.posMgr.SetTowerNotifications(self.slimItem.itemID, showInCalendar, sendFuelNotifications)
337 
338  SystemManager* pSystem = call.client->SystemMgr();
339  if (pSystem == nullptr) {
340  codelog(CLIENT__ERROR, "%s: Client has no system manager!", call.client->GetName());
341  return PyStatic.NewNone();
342  }
343 
344  SetTowerNotification args;
345  if (!args.Decode(&call.tuple)) {
346  codelog(SERVICE__ERROR, "%s: Failed to decode arguments.", GetName());
347  return PyStatic.NewNone();
348  }
349 
350  TowerSE* pTSE = pSystem->GetSE(args.structureID)->GetTowerSE();
351  if (pTSE == nullptr)
352  return PyStatic.NewNone();
353 
354  pTSE->SetSendFuelNotifications(args.sendFuelNotifications);
355  pTSE->SetShowInCalendar(args.showInCalendar);
356  pTSE->UpdateNotify();
357  return PyStatic.NewNone();
358 }
359 
360 PyResult PosMgrBound::Handle_GetTowerSentrySettings(PyCallArgs &call) {
361  // standing, status, statusDrop, war, standingOwnerID = self.sentrySettings = self.posMgr.GetTowerSentrySettings(self.slimItem.itemID)
362  PyDict* data = new PyDict();
363  PyList* header = new PyList(5);
364  header->SetItemString(0, "standing");
365  header->SetItemString(1, "status");
366  header->SetItemString(2, "statusDrop");
367  header->SetItemString(3, "corpWar");
368  header->SetItemString(4, "standingOwnerID");
369  data->SetItemString("header", header);
370 
371  SystemManager* pSystem = call.client->SystemMgr();
372  if (pSystem == nullptr) {
373  codelog(CLIENT__ERROR, "%s: Client has no system manager!", call.client->GetName());
374  return new PyObject("util.Row", data);
375  }
376 
377  Call_SingleIntegerArg arg;
378  if (!arg.Decode(&call.tuple)) {
379  codelog(SERVICE__ERROR, "%s: Failed to decode arguments.", GetName());
380  return new PyObject("util.Row", data);
381  }
382 
383  TowerSE* pTSE = pSystem->GetSE(arg.arg)->GetTowerSE();
384  if (pTSE == nullptr)
385  return new PyObject("util.Row", data);
386 
387  PyList* line = new PyList(5);
388  line->SetItem(0, new PyFloat(pTSE->GetStanding()));
389  line->SetItem(1, new PyFloat(pTSE->GetStatus()));
390  line->SetItem(2, new PyBool(pTSE->GetStatusDrop()));
391  line->SetItem(3, new PyBool(pTSE->GetCorpWar()));
392  line->SetItem(4, new PyInt(pTSE->GetStandingOwnerID()));
393  data->SetItemString("line", line);
394 
395  return new PyObject("util.Row", data);
396 }
397 
398 PyResult PosMgrBound::Handle_SetTowerSentrySettings(PyCallArgs &call) {
399  // self.posMgr.SetTowerSentrySettings(self.slimItem.itemID, standing, status, statusDrop, war, useAllianceStandings)
400  SystemManager* pSystem = call.client->SystemMgr();
401  if (pSystem == nullptr) {
402  codelog(CLIENT__ERROR, "%s: Client has no system manager!", call.client->GetName());
403  return PyStatic.NewNone();
404  }
405 
406  SetTowerSentrySettings args;
407  if (!args.Decode(&call.tuple)) {
408  codelog(SERVICE__ERROR, "%s: Failed to decode arguments.", GetName());
409  return PyStatic.NewNone();
410  }
411 
412  TowerSE* pTSE = pSystem->GetSE(args.structureID)->GetTowerSE();
413  if (pTSE == nullptr)
414  return PyStatic.NewNone();
415 
416  pTSE->SetStanding(args.standing);
417  pTSE->SetStatus(args.status);
418  pTSE->SetStatusDrop(args.statusDrop);
419  pTSE->SetCorpWar(args.corpWar);
420  pTSE->SetUseAllyStandings(args.useAllianceStandings);
421  pTSE->UpdateSentry();
422 
423  return PyStatic.NewNone();
424 }
425 
426 PyResult PosMgrBound::Handle_GetStarbasePermissions(PyCallArgs &call) {
427  // deployFlags, usageFlagsList = self.posMgr.GetStarbasePermissions(self.slimItem.itemID)
428  SystemManager* pSystem = call.client->SystemMgr();
429  if (pSystem == nullptr) {
430  codelog(CLIENT__ERROR, "%s: Client has no system manager!", call.client->GetName());
431  return PyStatic.NewNone();
432  }
433 
434  Call_SingleIntegerArg arg;
435  if (!arg.Decode(&call.tuple)) {
436  codelog(SERVICE__ERROR, "%s: Failed to decode arguments.", GetName());
437  return PyStatic.NewNone();
438  }
439 
440  TowerSE* pTSE = pSystem->GetSE(arg.arg)->GetTowerSE();
441  if (pTSE == nullptr)
442  return PyStatic.NewNone();
443 
444  PyTuple* tuple = new PyTuple(2);
445  tuple->SetItem(0, pTSE->GetDeployFlags()); // deployFlags
446  tuple->SetItem(1, pTSE->GetUsageFlagList()); // usageFlagsList
447  return tuple;
448 }
449 
450 PyResult PosMgrBound::Handle_SetStarbasePermissions(PyCallArgs &call) {
451  // self.posMgr.SetStarbasePermissions(self.slimItem.itemID, self.sr.deployFlags, self.sr.usageFlagsList)
452  /* values....
453  * 0 - corp role config equip.
454  * 1 - corp members
455  * 2 - ally members
456  * 3 - corp role fuel tech
457  */
458 
459  _log(POS__TRACE, "PosMgrBound::Handle_SetStarbasePermissions()");
460  call.Dump(POS__DUMP);
461 
462  SystemManager* pSystem = call.client->SystemMgr();
463  if (pSystem == nullptr) {
464  codelog(CLIENT__ERROR, "%s: Client has no system manager!", call.client->GetName());
465  return PyStatic.NewNone();
466  }
467 
468  SetStarbasePermissions args;
469  if (!args.Decode(&call.tuple)) {
470  codelog(SERVICE__ERROR, "%s: Failed to decode arguments.", GetName());
471  return PyStatic.NewNone();
472  }
473 
474  TowerSE* pTSE = pSystem->GetSE(args.towerID)->GetTowerSE();
475  if (pTSE == nullptr)
476  return PyStatic.NewNone();
477 
478  // decode deployFlags object
479  PyRep* rep = args.deployFlags->arguments()->AsDict()->GetItemString("line");
480  if (!rep->IsList()) {
481  codelog(POS__ERROR, "deployFlags 'line' item is not PyList: %s", rep->TypeString());
482  return nullptr;
483  }
484 
485  PyList* list = rep->AsList();
486  //list->Dump(POS__RSP_DUMP, " ");
487  pTSE->SetDeployFlags(list->GetItem(0)->AsInt()->value(),
488  list->GetItem(1)->AsInt()->value(),
489  list->GetItem(2)->AsInt()->value(),
490  list->GetItem(3)->AsInt()->value() );
491 
492 
493  // decode usageFlagsList object
494  PyRep* rep2 = args.usageFlagsList->arguments()->AsDict()->GetItemString("lines");
495  if (!rep2->IsList()) {
496  codelog(POS__ERROR, "usageFlagsList 'lines' item is not PyList: %s", rep2->TypeString());
497  return nullptr;
498  }
499 
500  PyList* list2 = rep2->AsList();
501  //list2->Dump(POS__RSP_DUMP, " ");
502  for (PyList::const_iterator itr = list2->begin(); itr != list2->end(); ++itr) {
503  if (!(*itr)->IsList()) {
504  codelog(POS__ERROR, "usageFlagsList - itr item is not PyList: %s", (*itr)->TypeString());
505  continue;
506  }
507  pTSE->SetUseFlags((*itr)->AsList()->GetItem(0)->AsInt()->value(),
508  (*itr)->AsList()->GetItem(1)->AsInt()->value(),
509  (*itr)->AsList()->GetItem(2)->AsInt()->value(),
510  (*itr)->AsList()->GetItem(3)->AsInt()->value());
511  }
512 
513  return PyStatic.NewNone();
514 }
515 
516 PyResult PosMgrBound::Handle_GetMoonForTower( PyCallArgs &call ) {
517  /*
518 13:13:06 L PosMgrBound::Handle_GetMoonForTower(): size= 1
519 13:13:06 [SvcCall] Call Arguments:
520 13:13:06 [SvcCall] Tuple: 1 elements
521 13:13:06 [SvcCall] [ 0] Integer field: 140001260
522 
523 self.moonID = self.moon[0]
524 if self.moon[1] is not None:
525  for typeID, quantity in self.moon[1]:
526 
527  returns
528  tuple
529  moonID
530  tuple
531  resource typeID
532  resource quantity
533 
534  _log(POS__TRACE, "PosMgrBound::Handle_GetMoonForTower()");
535  call.Dump(POS__DUMP);
536  */
537 
538  SystemManager* pSystem = call.client->SystemMgr();
539  if (pSystem == nullptr) {
540  codelog(CLIENT__ERROR, "%s: Client has no system manager!", call.client->GetName());
541  return PyStatic.NewNone();
542  }
543 
544  Call_SingleIntegerArg arg;
545  if (!arg.Decode(&call.tuple)) {
546  codelog(SERVICE__ERROR, "%s: Failed to decode arguments.", GetName());
547  return PyStatic.NewNone();
548  }
549 
550  TowerSE* pTSE = pSystem->GetSE(arg.arg)->GetTowerSE();
551  if (pTSE == nullptr)
552  return PyStatic.NewNone();
553  MoonSE* pMSE = pTSE->GetMoonSE();
554  if (pMSE == nullptr)
555  return PyStatic.NewNone();
556 
557  std::map<uint16, uint8>::iterator itr = pMSE->GooBegin(), end = pMSE->GooEnd();
558  PyList* list = new PyList();
559  while (itr != end) {
560  PyTuple* resource = new PyTuple(2);
561  resource->SetItem(0, new PyInt(itr->first));
562  resource->SetItem(1, new PyInt(itr->second));
563  list->AddItem(resource);
564  ++itr;
565  }
566 
567  PyTuple* item = new PyTuple(2);
568  item->SetItem(0, new PyInt(pMSE->GetID()));
569  item->SetItem(1, list);
570  return item;
571 }
572 
573 PyResult PosMgrBound::Handle_SetShipPassword( PyCallArgs &call ) {
574  /*
575  * 13:16:17 L PosMgrBound::Handle_SetShipPassword(): size= 1
576  * 13:16:17 [SvcCall] Call Arguments:
577  * 13:16:17 [SvcCall] Tuple: 1 elements
578  * 13:16:17 [SvcCall] [ 0] WString: 'test' << password
579  */
580 
582 
583  return PyStatic.NewNone();
584 }
585 
586 PyResult PosMgrBound::Handle_SetTowerPassword( PyCallArgs &call ) {
587  SystemManager* pSystem = call.client->SystemMgr();
588  if (pSystem == nullptr) {
589  codelog(CLIENT__ERROR, "%s: Client has no system manager!", call.client->GetName());
590  return PyStatic.NewNone();
591  }
592 
593  if (call.tuple->size() == 2) {
594  SetTowerPassword2 args;
595  if (!args.Decode(&call.tuple)) {
596  codelog(SERVICE__ERROR, "%s: Failed to decode arguments.", GetName());
597  return PyStatic.NewNone();
598  }
599 
600  TowerSE* pTSE = pSystem->GetSE(args.towerID)->GetTowerSE();
601  if (pTSE == nullptr)
602  return PyStatic.NewNone();
603 
604  if (args.password->IsString() or args.password->IsWString())
605  pTSE->SetPassword(PyRep::StringContent(args.password));
606  pTSE->UpdatePassword();
607  } else if (call.tuple->size() == 4) {
608  SetTowerPassword4 args;
609  if (!args.Decode(&call.tuple)) {
610  codelog(SERVICE__ERROR, "%s: Failed to decode arguments.", GetName());
611  return PyStatic.NewNone();
612  }
613 
614  TowerSE* pTSE = pSystem->GetSE(args.towerID)->GetTowerSE();
615  if (pTSE == nullptr)
616  return PyStatic.NewNone();
617 
618  if (args.password->IsString() or args.password->IsWString()) {
619  pTSE->SetPassword(PyRep::StringContent(args.password));
620  pTSE->UpdatePassword();
621  }
622 
623  pTSE->SetCorpAccess(args.allowCorp);
624  pTSE->SetAllyAccess(args.allowAlliance);
625  pTSE->UpdateAccess();
626  } else {
627  // make error here?
628  }
629 
630  // set harmonic for ship to 'offline' (0) -according to packet data
632 
633  // at this point, if ship password isnt updated, it should be kicked out of tower's ff.
634  // not sure how we're gonna do this yet. will have to wait till system matures
635 
636  return PyStatic.NewNone();
637 }
638 
639 PyResult PosMgrBound::Handle_UnanchorStructure(PyCallArgs &call) {
640  _log(POS__TRACE, "PosMgrBound::Handle_UnanchorStructure()");
641  call.Dump(POS__DUMP);
642 
643  StructureSE* pTSE(nullptr);
644 
645  //pTSE->PullAnchor();
646 
647  return PyStatic.NewNone();
648 }
649 
650 PyResult PosMgrBound::Handle_AnchorStructure(PyCallArgs &call) {
651  _log(POS__TRACE, "POS Mgr::Anchor()");
652  call.Dump(POS__DUMP);
653  SystemManager* pSystem = call.client->SystemMgr();
654  if (pSystem == nullptr) {
655  codelog(CLIENT__ERROR, "%s: Client has no system manager!", call.client->GetName());
656  return PyStatic.NewNone();
657  }
658 
659  AnchorStructure args;
660  if (!args.Decode(&call.tuple)) {
661  codelog(SERVICE__ERROR, "%s: Failed to decode arguments.", GetName());
662  return PyStatic.NewNone();
663  }
664 
665  StructureSE* pTSE = pSystem->GetSE(args.structureID)->GetPOSSE();
666  if (pTSE == nullptr)
667  return PyStatic.NewNone();
668 
669  GPoint pos(args.posX, args.posY, args.posZ);
670  pTSE->SetAnchor(call.client, pos);
671 
672  // auto warp to new POS position? config option?
673  if (pTSE->IsTowerSE()) {
674  uint32 dist = pTSE->GetSelf()->radius() + call.client->GetShip()->radius();
675  call.client->GetShipSE()->DestinyMgr()->WarpTo(pos, dist);
676  }
677  // returns nodeID and timestamp
678  PyTuple* tuple = new PyTuple(2);
679  tuple->SetItem(0, new PyString(GetBindStr())); // node info here
680  tuple->SetItem(1, new PyLong(GetFileTimeNow()));
681  return tuple;
682 }
683 
684 PyResult PosMgrBound::Handle_GetMoonProcessInfoForTower(PyCallArgs &call) {
685  SystemManager* pSystem = call.client->SystemMgr();
686  if (pSystem == nullptr) {
687  codelog(CLIENT__ERROR, "%s: Client has no system manager!", call.client->GetName());
688  return PyStatic.NewNone();
689  }
690 
691  Call_SingleIntegerArg arg;
692  if (!arg.Decode(&call.tuple)) {
693  codelog(SERVICE__ERROR, "%s: Failed to decode arguments.", GetName());
694  return PyStatic.NewNone();
695  }
696 
697  TowerSE* pTSE = pSystem->GetSE(arg.arg)->GetTowerSE();
698  if (pTSE == nullptr)
699  return PyStatic.NewNone();
700 
701  return pTSE->GetProcessInfo();
702 }
703 
704 PyResult PosMgrBound::Handle_AssumeStructureControl(PyCallArgs &call) {
705  // NOTE: this is for controlling pos defences
706  /*
707  posMgr = moniker.GetPOSMgr()
708  posMgr.AssumeStructureControl(item.itemID)
709 
710  02:02:07 W PosMgrBound::Handle_AssumeStructureControl(): size=1
711  02:02:07 [POS:Dump] Call Arguments:
712  02:02:07 [POS:Dump] Tuple: 1 elements
713  02:02:07 [POS:Dump] [ 0] Integer: 140000311
714 
715  'OnAssumeStructureControl',
716  'OnRelinquishStructureControl',
717 
718  */
719  _log(POS__TRACE, "PosMgrBound::Handle_AssumeStructureControl()");
720  call.Dump(POS__DUMP);
721 
722  return PyStatic.NewNone();
723 }
724 
725 PyResult PosMgrBound::Handle_RelinquishStructureControl(PyCallArgs &call) {
726  /*
727  posMgr = moniker.GetPOSMgr()
728  posMgr.RelinquishStructureControl(item.itemID)
729  */
730  _log(POS__TRACE, "PosMgrBound::Handle_RelinquishStructureControl()");
731  call.Dump(POS__DUMP);
732 
733  return PyStatic.NewNone();
734 }
735 
736 PyResult PosMgrBound::Handle_AnchorOrbital(PyCallArgs &call) {
737  /*
738  * def AnchorOrbital(self, itemID):
739  * posMgr = util.Moniker('posMgr', session.solarsystemid)
740  * posMgr.AnchorOrbital(itemID)
741  */
742 
743  _log(POS__TRACE, "PosMgrBound::Handle_()");
744  call.Dump(POS__DUMP);
745 
746  return PyStatic.NewNone();
747 }
748 
749 PyResult PosMgrBound::Handle_UnanchorOrbital(PyCallArgs &call) {
750  /*
751  * def UnanchorOrbital(self, itemID):
752  * posMgr = util.Moniker('posMgr', session.solarsystemid)
753  * posMgr.UnanchorOrbital(itemID)
754  */
755  _log(POS__TRACE, "PosMgrBound::Handle_UnanchorOrbital()");
756  call.Dump(POS__DUMP);
757 
758  return PyStatic.NewNone();
759 }
760 
761 PyResult PosMgrBound::Handle_OnlineOrbital(PyCallArgs &call) {
762  _log(POS__TRACE, "PosMgrBound::Handle_OnlineOrbital()");
763  call.Dump(POS__DUMP);
764 
765  return PyStatic.NewNone();
766 }
767 
768 PyResult PosMgrBound::Handle_ChangeStructureProvisionType(PyCallArgs &call) {
769  // this changes silo content or mining product
770  /*
771  * 03:11:32 W PosMgrBound::Handle_ChangeStructureProvisionType(): size=3
772  * 03:11:32 [POS:Dump] Call Arguments:
773  * 03:11:32 [POS:Dump] Tuple: 3 elements
774  * 03:11:32 [POS:Dump] [ 0] Integer: 140000061 <-- towerID
775  * 03:11:32 [POS:Dump] [ 1] Integer: 140000224 <-- itemID
776  * 03:11:32 [POS:Dump] [ 2] Integer: 16634 <-- typeID
777  */
778  _log(POS__TRACE, "PosMgrBound::Handle_ChangeStructureProvisionType()");
779  call.Dump(POS__DUMP);
780 
781  ChangeStructureProvisionType args;
782  if (!args.Decode(&call.tuple)) {
783  codelog(SERVICE__ERROR, "%s: Failed to decode arguments.", GetName());
784  return PyStatic.NewNone();
785  }
786 
789  return PyStatic.NewNone();
790 }
791 
792 PyResult PosMgrBound::Handle_LinkResourceForTower(PyCallArgs &call) {
793  _log(POS__TRACE, "PosMgrBound::Handle_LinkResourceForTower()");
794  call.Dump(POS__DUMP);
795 
796  return PyStatic.NewNone();
797 }
798 
799 PyResult PosMgrBound::Handle_RunMoonProcessCycleforTower(PyCallArgs &call) {
800  // this sets cycle 'on' for given towerID
801  /*
802  * 03:14:25 W PosMgrBound::Handle_RunMoonProcessCycleforTower(): size=1
803  * 03:14:25 [POS:Dump] Call Arguments:
804  * 03:14:25 [POS:Dump] Tuple: 1 elements
805  * 03:14:25 [POS:Dump] [ 0] Integer: 140000061 <-- towerID
806  */
807  _log(POS__TRACE, "PosMgrBound::Handle_RunMoonProcessCycleforTower()");
808  call.Dump(POS__DUMP);
809 
810  return PyStatic.NewNone();
811 }
812 
813 PyResult PosMgrBound::Handle_GMUpgradeOrbital(PyCallArgs &call) {
814  /*
815  * def GMUpgradeOrbital(self, itemID):
816  * posMgr = util.Moniker('posMgr', session.solarsystemid)
817  * posMgr.GMUpgradeOrbital(itemID)
818  */
819  _log(POS__TRACE, "PosMgrBound::Handle_GMUpgradeOrbital()");
820  call.Dump(POS__DUMP);
821 
822  return PyStatic.NewNone();
823 }
824 
825 PyResult PosMgrBound::Handle_CompleteOrbitalStateChange(PyCallArgs &call) {
826  /*
827  * def CompleteOrbitalStateChange(self, itemID):
828  * posMgr = util.Moniker('posMgr', session.solarsystemid)
829  * posMgr.CompleteOrbitalStateChange(itemID)
830  */
831  _log(POS__TRACE, "PosMgrBound::Handle_CompleteOrbitalStateChange()");
832  call.Dump(POS__DUMP);
833 
834  return PyStatic.NewNone();
835 }
836 
Base Python wire object.
Definition: PyRep.h:66
Dispatcher *const m_dispatch
void UpdateNotify()
Definition: Tower.h:98
SystemEntity * GetSE(uint32 entityID) const
double radius() const
static std::string StringContent(PyRep *pRep)
Definition: PyRep.cpp:103
#define _log(type, fmt,...)
Definition: logsys.h:124
void SetCorpAccess(bool set)
Definition: Tower.h:70
PyRep * GetItem(size_t index) const
Returns Python object.
Definition: PyRep.h:602
Python string.
Definition: PyRep.h:430
int32 value() const
Definition: PyRep.h:247
PyRep * GetItemString(const char *key) const
Obtains database entry based on given key string.
Definition: PyRep.cpp:702
int32 GetInt(uint32 index) const
Definition: dbcore.cpp:635
MoonSE * GetMoonSE()
Definition: Structure.h:173
Python's dictionary.
Definition: PyRep.h:719
PosMgrBound(PyServiceMgr *mgr, uint32 systemID)
Definition: PosMgr.cpp:42
PyCallable_Make_InnerDispatcher(PosMgr) PosMgr
Definition: PosMgr.cpp:117
size_t size() const
Definition: PyRep.h:591
bool GetCorpWar()
Definition: Tower.h:78
PyRep * GetSiloCapacityForType(uint16 typeID)
Definition: PosMgrDB.cpp:25
double GetDouble(uint32 index) const
Definition: dbcore.cpp:693
void SetItemString(size_t index, const char *str)
Stores Python string.
Definition: PyRep.h:699
static void GetCorpJumpArrays(uint32 corpID, DBQueryResult &res)
Definition: PosMgrDB.cpp:77
void UpdateAccess()
Definition: Tower.h:96
Python floating point number.
Definition: PyRep.h:292
const_iterator begin() const
Definition: PyRep.h:660
int32 GetCorporationID() const
Definition: Client.h:123
storage_type::const_iterator const_iterator
Definition: PyRep.h:644
uint32 m_systemID
Definition: PosMgr.cpp:113
std::string m_strBoundObjectName
Definition: PyBoundObject.h:54
PyRep * GetDeployFlags()
Definition: Tower.cpp:355
Python tuple.
Definition: PyRep.h:567
void Dump(FILE *into, const char *pfx) const
Dumps object to file.
Definition: PyRep.cpp:84
itemID[count] Create count or of the specified item(from Insider)" ) COMMAND( goto
bool IsList() const
Definition: PyRep.h:109
void UpdatePassword()
Definition: Tower.cpp:308
void AddItem(PyRep *i)
Definition: PyRep.h:701
std::map< uint16, uint8 >::iterator GooEnd()
Definition: Moon.h:49
void _SetCallDispatcher(CallDispatcher *d)
Definition: PyCallable.h:87
PyRep * GetItem(size_t index) const
Returns Python object.
Definition: PyRep.h:674
* args
bool GetRow(DBResultRow &into)
Definition: dbcore.cpp:552
Python boolean.
Definition: PyRep.h:323
PosMgrDB m_db
Definition: PosMgr.h:26
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
void SetStanding(float set)
Definition: Tower.h:66
Definition: gpoint.h:33
DestinyManager * DestinyMgr()
Definition: SystemEntity.h:198
InventoryItemRef GetSelf()
Definition: SystemEntity.h:202
virtual bool IsTowerSE()
Definition: Structure.h:128
Python object.
Definition: PyRep.h:826
#define codelog(type, fmt,...)
Definition: logsys.h:128
void SetItem(size_t index, PyRep *object)
Stores Python object.
Definition: PyRep.h:610
virtual PyBoundObject * CreateBoundObject(Client *pClient, const PyRep *bind_args)
Definition: PosMgr.cpp:134
SystemManager * SystemMgr() const
Definition: Client.h:92
void SetUseAllyStandings(bool set)
Definition: Tower.h:72
PyList * AsList()
Definition: PyRep.h:140
std::string GetBindStr() const
Python integer.
Definition: PyRep.h:231
void SetItem(size_t index, PyRep *object)
Stores Python object.
Definition: PyRep.h:682
Definition: PosMgr.h:16
PyDict * AsDict()
Definition: PyRep.h:142
Dispatcher *const m_dispatch
Definition: PosMgr.h:24
uint32 GetID()
Definition: SystemEntity.h:207
bool ShowInCalendar()
Definition: Tower.h:83
PyServiceMgr *const m_manager
Definition: PyService.h:91
#define PyStatic
Definition: PyRep.h:1209
float GetStanding()
Definition: Tower.h:79
bool IsNull(uint32 index) const
Definition: dbcore.h:102
ShipItemRef GetShip() const
Definition: Client.h:167
const char * GetName() const
Definition: Client.h:94
PyCallable_Make_Dispatcher(PosMgrBound)
Dispatcher *const m_dispatch
Definition: PosMgr.cpp:111
void SetPassword(std::string pass)
Definition: Tower.h:74
void SetStatus(float set)
Definition: Tower.h:67
Client *const client
Definition: PyCallable.h:49
float GetStatus()
Definition: Structure.h:172
#define PyCallable_REG_CALL(c, m)
Definition: PyServiceCD.h:78
Definition: Client.h:66
void SetAnchor(Client *pClient, GPoint &pos)
Definition: Structure.cpp:600
uint32 GetStandingOwnerID()
Definition: Tower.h:80
bool GetStatusDrop()
Definition: Tower.h:77
unsigned __int32 uint32
Definition: eve-compat.h:50
virtual ~PosMgr()
Definition: PosMgr.cpp:130
virtual StructureSE * GetPOSSE()
Definition: SystemEntity.h:116
void SetStatusDrop(bool set)
Definition: Tower.h:68
std::map< uint16, uint8 >::iterator GooBegin()
Definition: Moon.h:50
void SetShowInCalendar(bool set)
Definition: Tower.h:85
double GetFileTimeNow()
Definition: utils_time.cpp:84
void WarpTo(const GPoint &where, int32 distance=0, bool autoPilot=false, SystemEntity *pSE=nullptr)
virtual TowerSE * GetTowerSE()
Definition: SystemEntity.h:120
void UninstallBridgeLink(uint32 itemID)
Definition: PosMgrDB.cpp:256
ShipSE * GetShipSE()
Definition: Client.h:168
const_iterator end() const
Definition: PyRep.h:661
void SetPassword(std::string pass)
Definition: Ship.h:338
void SetSendFuelNotifications(bool set)
Definition: Tower.h:86
void SetCorpWar(bool set)
Definition: Tower.h:69
void Dump(LogType type) const
Definition: PyCallable.cpp:81
Definition: Moon.h:28
PyCallable_DECL_CALL(SetTowerPassword)
void SetDeployFlags(int8 anchor=0, int8 unanchor=0, int8 online=0, int8 offline=0)
Definition: Tower.cpp:345
void SetUseFlags(uint32 itemID, int8 view=0, int8 take=0, int8 use=0)
Definition: Tower.cpp:375
Definition: Tower.h:19
PyRep * GetUsageFlagList()
Definition: Tower.cpp:384
void InstallBridgeLink(uint32 itemID, uint32 toSystemID, uint32 toItemID)
Definition: PosMgrDB.cpp:246
bool IsInt() const
Definition: PyRep.h:100
virtual ~PosMgrBound()
Definition: PosMgr.cpp:79
void GetControlTowerFuelRequirements(DBQueryResult &res)
Definition: PosMgrDB.cpp:56
void SetAllyAccess(bool set)
Definition: Tower.h:71
PyInt * AsInt()
Definition: PyRep.h:122
void SetHarmonic(int8 set)
Definition: SystemEntity.h:224
unsigned __int16 uint16
Definition: eve-compat.h:48
PyRep * GetCorpControlTowers(uint32 corpID)
Definition: PosMgrDB.cpp:38
void SetItem(PyRep *key, PyRep *value)
SetItem adds or sets a database entry.
Definition: PyRep.cpp:713
const char * TypeString() const
Definition: PyRep.cpp:76
Python list.
Definition: PyRep.h:639
void UpdateSentry()
Definition: Tower.h:97
virtual void Release()
Definition: PosMgr.cpp:80
void SetItemString(const char *key, PyRep *value)
SetItemString adds or sets a database entry.
Definition: PyRep.h:812
PyRep * GetProcessInfo()
Definition: Tower.cpp:429
const char * GetName() const
Definition: PyBoundObject.h:44
Python long integer.
Definition: PyRep.h:261
PyTuple * tuple
Definition: PyCallable.h:50
bool SendFuelNotifications()
Definition: Tower.h:84
PosMgrDB m_db
Definition: PosMgr.cpp:112