EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
PlanetMgr Class Reference

#include "PlanetMgr.h"

Collaboration diagram for PlanetMgr:

Public Member Functions

virtual ~PlanetMgr ()
 

Private Attributes

PyServiceMgrm_svcMgr
 
Clientm_client
 
Colonym_colony
 
PlanetSEm_planet
 
PlanetDB m_db
 

PlanetMgr.cpp

Specific Class for managing planet resources this is based on preliminary work by Comet0 : Allan

Date
: 30 April 2016 : 4 November 2016 - began rewrite 16 November 2016 - basic system working 19 July 2019 - all systems working properly
 PlanetMgr (PyServiceMgr *mgr, Client *pClient, PlanetSE *pPlanet, Colony *pColony)
 
PyRepUpdateNetwork (UUNCommandList &uuncl)
 
bool CreatePin (UUNCommand &nc)
 
void RemovePin (UUNCommand &nc)
 
void CreateLink (UUNCommand &nc)
 
void RemoveLink (UUNCommand &nc)
 
void SetLinkLevel (UUNCommand &nc)
 
void CreateRoute (UUNCommand &nc)
 
void RemoveRoute (UUNCommand &nc)
 
void SetSchematic (UUNCommand &nc)
 
bool UpgradeCommandCenter (UUNCommand &nc)
 
void AddExtractorHead (UUNCommand &nc)
 
void KillExtractorHead (UUNCommand &nc)
 
void MoveExtractorHead (UUNCommand &nc)
 
void InstallProgram (UUNCommand &nc)
 
void PrioritizeRoute (UUNCommand &nc)
 

Detailed Description

Definition at line 23 of file PlanetMgr.h.

Constructor & Destructor Documentation

PlanetMgr::PlanetMgr ( PyServiceMgr mgr,
Client pClient,
PlanetSE pPlanet,
Colony pColony 
)

Definition at line 29 of file PlanetMgr.cpp.

30 :m_svcMgr(mgr),
31  m_client(pClient),
32  m_colony(pColony),
33 m_planet(pPlanet)
34 {
35 }
PlanetSE * m_planet
Definition: PlanetMgr.h:51
Client * m_client
Definition: PlanetMgr.h:49
Colony * m_colony
Definition: PlanetMgr.h:50
PyServiceMgr * m_svcMgr
Definition: PlanetMgr.h:48
virtual PlanetMgr::~PlanetMgr ( )
inlinevirtual

Definition at line 27 of file PlanetMgr.h.

27 { /* do nothing here */ }

Member Function Documentation

void PlanetMgr::AddExtractorHead ( UUNCommand &  nc)
protected

Definition at line 371 of file PlanetMgr.cpp.

References _log, Colony::AddExtractorHead(), args, m_client, m_colony, and Client::SendErrorMsg().

Referenced by UpdateNetwork().

372 {
373  Call_AddMoveExtractorHead args;
374  if (!args.Decode(nc.command_data)) {
375  _log(SERVICE__ERROR, "Failed to decode args for Call_AddMoveExtractorHead");
376  nc.command_data->Dump(PLANET__WARNING, " ");
377  m_client->SendErrorMsg("Internal Server Error. Ref: ServerError 04588.");
378  return;
379  }
380 
381  m_colony->AddExtractorHead(args.ecuID, (uint16)args.headID, args.latitude, args.longitude);
382 }
Client * m_client
Definition: PlanetMgr.h:49
void SendErrorMsg(const char *fmt,...)
Definition: Client.cpp:2719
#define _log(type, fmt,...)
Definition: logsys.h:124
void AddExtractorHead(uint32 ecuID, uint16 headID, double latitude, double longitude)
Definition: Colony.cpp:707
Colony * m_colony
Definition: PlanetMgr.h:50
* args
unsigned __int16 uint16
Definition: eve-compat.h:48

Here is the call graph for this function:

Here is the caller graph for this function:

void PlanetMgr::CreateLink ( UUNCommand &  nc)
protected

Definition at line 250 of file PlanetMgr.cpp.

References _log, Colony::CreateLink(), m_client, m_colony, and Client::SendErrorMsg().

Referenced by UpdateNetwork().

251 {
252  uint32 src = 0, dest = 0, level = 0;
253  if (nc.command_data->GetItem(0)->IsInt()) {
254  if (nc.command_data->GetItem(1)->IsInt()) {
255  UUNCLinkExist uuncle;
256  if (!uuncle.Decode(nc.command_data)) {
257  _log(SERVICE__ERROR, "Failed to decode args for UUNCLinkExist");
258  nc.command_data->Dump(PLANET__WARNING, " ");
259  m_client->SendErrorMsg("Internal Server Error. Ref: ServerError 04588.");
260  return;
261  }
262  src = uuncle.src;
263  dest = uuncle.dest;
264  level = uuncle.level;
265  } else {
266  UUNCLinkCommand uunclc;
267  if (!uunclc.Decode(nc.command_data)) {
268  _log(SERVICE__ERROR, "Failed to decode args for UUNCLinkCommand");
269  nc.command_data->Dump(PLANET__WARNING, " ");
270  m_client->SendErrorMsg("Internal Server Error. Ref: ServerError 04588.");
271  return;
272  }
273  src = uunclc.src;
274  dest = uunclc.dest2;
275  level = uunclc.level;
276  }
277  } else if (nc.command_data->GetItem(0)->IsTuple()) {
278  UUNCLinkStandard uuncls;
279  if (!uuncls.Decode(nc.command_data)) {
280  _log(SERVICE__ERROR, "Failed to decode args for UUNCLinkStandard");
281  nc.command_data->Dump(PLANET__WARNING, " ");
282  m_client->SendErrorMsg("Internal Server Error. Ref: ServerError 04588.");
283  return;
284  }
285  src = uuncls.src2;
286  dest = uuncls.dest2;
287  level = uuncls.level;
288  } else {
289  //Invalid...
290  _log(PLANET__ERROR, "PlanetMgr::UserUpdateNetwork::CreateLink() command_data type unrecognized: %s", nc.command_data->GetItem(0)->TypeString());
291  m_client->SendErrorMsg("Internal Server Error. Ref: ServerError 04508.");
292  return;
293  }
294  m_colony->CreateLink(src, dest, level);
295 }
Client * m_client
Definition: PlanetMgr.h:49
void SendErrorMsg(const char *fmt,...)
Definition: Client.cpp:2719
#define _log(type, fmt,...)
Definition: logsys.h:124
Colony * m_colony
Definition: PlanetMgr.h:50
void CreateLink(uint32 src, uint32 dest, uint16 level)
Definition: Colony.cpp:477
unsigned __int32 uint32
Definition: eve-compat.h:50

Here is the call graph for this function:

Here is the caller graph for this function:

bool PlanetMgr::CreatePin ( UUNCommand &  nc)
protected

Definition at line 115 of file PlanetMgr.cpp.

References _log, EVEDB::invGroups::Capsuleer_Bases, Account::KeyType::Cash, EVEDB::invGroups::Command_Centers, corpCONCORD, corpInterbus, Colony::CreateCommandPin(), PlanetSE::CreateCustomsOffice(), Colony::CreatePin(), EVEDB::invGroups::Extractor_Control_Units, EVEDB::invGroups::Extractors, Client::GetCharacterID(), PlanetSE::GetCustomsOffice(), SystemEntity::GetID(), SystemEntity::GetName(), SystemManager::GetSystemSecurityRating(), PyRep::IntegerValueU32(), m_client, m_colony, m_planet, EVEDB::invGroups::Mercenary_Bases, EVEDB::invGroups::Planetary_Links, Journal::EntryType::PlanetaryConstruction, EVEDB::invGroups::Processors, Client::SendErrorMsg(), sItemFactory, EVEDB::invGroups::Spaceports, EVEDB::invGroups::Storage_Facilities, SystemEntity::SystemMgr(), and AccountService::TranserFunds().

Referenced by UpdateNetwork().

116 {
117  // the return here is used to break out of loop if needed. return false = continue
118  using namespace EVEDB::invGroups;
119  uint32 typeID = PyRep::IntegerValueU32(nc.command_data->GetItem(1));
120  uint32 groupID = sItemFactory.GetType(typeID)->groupID();
121  switch (groupID) {
122  case Command_Centers: {
123  //take the money, send wallet blink event record the transaction in their journal.
124  std::string reason = "DESC: Command Center construction on ";
125  reason += m_planet->GetName();
126  uint32 ownerID = corpCONCORD;
128  ownerID = corpInterbus;
131  ownerID, // concord in empire, interbus otherwise
132  90000,
133  reason.c_str(),
135  m_planet->GetID(),
137 
138  UUNCCommandCenter uunccc;
139  if (!uunccc.Decode(nc.command_data)) {
140  _log(SERVICE__ERROR, "Failed to decode args for UUNCCommandCenter");
141  nc.command_data->Dump(PLANET__WARNING, " ");
142  m_client->SendErrorMsg("Internal Server Error. Ref: ServerError 04508.");
143  return true;
144  }
145  m_colony->CreateCommandPin(uunccc.pinID, uunccc.typeID, uunccc.latitude, uunccc.longitude);
146  if (m_planet->GetCustomsOffice() == nullptr)
148  return false;
149  } break;
150  case Mercenary_Bases:
151  case Capsuleer_Bases:{
152  // Not Supported yet
153  _log(PLANET__ERROR, "PlanetMgr::UserUpdateNetwork::CreatePin() Planet Bases (type/group %u/%u) not supported.", typeID, groupID);
154  m_client->SendErrorMsg("Internal Server Error. Ref: ServerError 04109.");
155  return true;
156  } break;
157  }
158  uint32 cost = 0;
159  std::string pinString = "";
160  switch (groupID) {
161  case Storage_Facilities: {
162  cost = 250000;
163  pinString = "Silo";
164  } break;
165  case Processors: {
166  switch (typeID) {
167  case 2469: // Lava Basic Industry Facility
168  case 2471: // Plasma Basic Industry Facility
169  case 2473: // Barren Basic Industry Facility
170  case 2481: // Temperate Basic Industry Facility
171  case 2483: // Storm Basic Industry Facility
172  case 2490: // Oceanic Basic Industry Facility
173  case 2492: // Gas Basic Industry Facility
174  case 2493: { // Ice Basic Industry Facility
175  cost = 75000;
176  pinString = "Basic Plant";
177  } break;
178  case 2470: // Lava Advanced Industry Facility
179  case 2472: // Plasma Advanced Industry Facility
180  case 2474: // Barren Advanced Industry Facility
181  case 2480: // Temperate Advanced Industry Facility
182  case 2484: // Storm Advanced Industry Facility
183  case 2485: // Oceanic Advanced Industry Facility
184  case 2491: // Ice Advanced Industry Facility
185  case 2494: { // Gas Advanced Industry Facility
186  cost = 250000;
187  pinString = "Advanced Plant";
188  } break;
189  case 2475: // Barren High-Tech Production Plant
190  case 2482: { // Temperate High-Tech Production Plant
191  cost = 525000;
192  pinString = "High-Tech Plant";
193  } break;
194  }
195  } break;
197  cost = 45000;
198  pinString = "ECU";
199  } break;
200  case Spaceports: {
201  cost = 900000;
202  pinString = "LaunchPad";
203  } break;
204  case Planetary_Links: {
205  cost = 1000;
206  pinString = "Link";
207  } break;
208  case Extractors: {
209  cost = 100;
210  pinString = "Extractor Head";
211  } break;
212  }
213 
214  if (cost < 1) {
215  // error here....
216  m_client->SendErrorMsg("Internal Server Error. Ref: ServerError 02001.");
217  return true;
218  }
219 
220  UUNCStandardPin uuncsp;
221  if (!uuncsp.Decode(nc.command_data)) {
222  _log(SERVICE__ERROR, "Failed to decode args for UUNCStandardPin");
223  nc.command_data->Dump(PLANET__WARNING, " ");
224  m_client->SendErrorMsg("Internal Server Error. Ref: ServerError 04588.");
225  return true;
226  }
227 
228  m_colony->CreatePin(groupID, uuncsp.pinID2, uuncsp.typeID, uuncsp.latitude, uuncsp.longitude);
229 
230  //take the money, send wallet blink event record the transaction in their journal.
231  std::string reason = "DESC: ";
232  reason += pinString.c_str();
233  reason += " Construction on ";
234  reason += m_planet->GetName();
235  uint32 ownerID = corpCONCORD;
237  ownerID = corpInterbus;
240  ownerID, // concord in empire, interbus otherwise
241  cost,
242  reason.c_str(),
244  m_planet->GetID(),
246 
247  return false;
248 }
PlanetSE * m_planet
Definition: PlanetMgr.h:51
Client * m_client
Definition: PlanetMgr.h:49
void SendErrorMsg(const char *fmt,...)
Definition: Client.cpp:2719
#define _log(type, fmt,...)
Definition: logsys.h:124
void CreatePin(uint32 groupID, uint32 pinID, uint32 typeID, double latitude, double longitude)
Definition: Colony.cpp:373
CustomsSE * GetCustomsOffice()
Definition: Planet.h:68
int32 GetCharacterID() const
Definition: Client.h:113
const float GetSystemSecurityRating()
Definition: SystemManager.h:86
static uint32 IntegerValueU32(PyRep *pRep)
Definition: PyRep.cpp:134
Colony * m_colony
Definition: PlanetMgr.h:50
SystemManager * SystemMgr()
Definition: SystemEntity.h:196
static void TranserFunds(uint32 fromID, uint32 toID, double amount, std::string reason="", uint8 entryTypeID=Journal::EntryType::Undefined, uint32 referenceID=0, uint16 fromKey=Account::KeyType::Cash, uint16 toKey=Account::KeyType::Cash, Client *pClient=nullptr)
void CreateCommandPin(uint32 itemID, uint32 typeID, double latitude, double longitude)
Definition: Colony.cpp:362
uint32 GetID()
Definition: SystemEntity.h:207
const char * GetName() const
Definition: SystemEntity.h:210
unsigned __int32 uint32
Definition: eve-compat.h:50
void CreateCustomsOffice()
Definition: Planet.cpp:272
#define sItemFactory
Definition: ItemFactory.h:165

Here is the call graph for this function:

Here is the caller graph for this function:

void PlanetMgr::CreateRoute ( UUNCommand &  nc)
protected

Definition at line 297 of file PlanetMgr.cpp.

References _log, args, Colony::CreateRoute(), m_client, m_colony, PyIncRef, and Client::SendErrorMsg().

Referenced by UpdateNetwork().

298 {
299  Call_CreateRoute args;
300  if (!args.Decode(nc.command_data)) {
301  _log(SERVICE__ERROR, "Failed to decode args for Call_CreateRoute");
302  nc.command_data->Dump(PLANET__WARNING, " ");
303  m_client->SendErrorMsg("Internal Server Error. Ref: ServerError 04588.");
304  return;
305  }
306 
307  PyIncRef(args.path);
308  m_colony->CreateRoute(args.routeID, args.typeID, args.qty, args.path);
309 }
Client * m_client
Definition: PlanetMgr.h:49
void SendErrorMsg(const char *fmt,...)
Definition: Client.cpp:2719
#define _log(type, fmt,...)
Definition: logsys.h:124
Colony * m_colony
Definition: PlanetMgr.h:50
* args
void CreateRoute(uint16 routeID, uint32 typeID, uint32 qty, PyList *path)
Definition: Colony.cpp:505
#define PyIncRef(op)
Definition: PyRep.h:56

Here is the call graph for this function:

Here is the caller graph for this function:

void PlanetMgr::InstallProgram ( UUNCommand &  nc)
protected

Definition at line 397 of file PlanetMgr.cpp.

References _log, args, Colony::InstallProgram(), m_client, m_colony, and Client::SendErrorMsg().

Referenced by UpdateNetwork().

398 {
399  Call_InstallProgram args;
400  if (!args.Decode(nc.command_data)) {
401  _log(SERVICE__ERROR, "Failed to decode args for Call_InstallProgram");
402  nc.command_data->Dump(PLANET__WARNING, " ");
403  m_client->SendErrorMsg("Internal Server Error. Ref: ServerError 04588.");
404  return;
405  }
406 
407  m_colony->InstallProgram(args.ecuID, (uint16)args.typeID, args.headRadius, this);
408 }
Client * m_client
Definition: PlanetMgr.h:49
void SendErrorMsg(const char *fmt,...)
Definition: Client.cpp:2719
#define _log(type, fmt,...)
Definition: logsys.h:124
Colony * m_colony
Definition: PlanetMgr.h:50
* args
void InstallProgram(uint32 ecuID, uint16 typeID, float headRadius, PlanetMgr *pPMgr)
Definition: Colony.cpp:794
unsigned __int16 uint16
Definition: eve-compat.h:48

Here is the call graph for this function:

Here is the caller graph for this function:

void PlanetMgr::KillExtractorHead ( UUNCommand &  nc)
protected

Definition at line 410 of file PlanetMgr.cpp.

References PyRep::IntegerValue(), Colony::KillExtractorHead(), and m_colony.

Referenced by UpdateNetwork().

411 {
412  m_colony->KillExtractorHead(PyRep::IntegerValue(nc.command_data->GetItem(0)), PyRep::IntegerValue(nc.command_data->GetItem(1)));
413 }
void KillExtractorHead(uint32 ecuID, uint16 headID)
Definition: Colony.cpp:743
Colony * m_colony
Definition: PlanetMgr.h:50
static int64 IntegerValue(PyRep *pRep)
Definition: PyRep.cpp:118

Here is the call graph for this function:

Here is the caller graph for this function:

void PlanetMgr::MoveExtractorHead ( UUNCommand &  nc)
protected

Definition at line 384 of file PlanetMgr.cpp.

References _log, args, m_client, m_colony, Colony::MoveExtractorHead(), and Client::SendErrorMsg().

Referenced by UpdateNetwork().

385 {
386  Call_AddMoveExtractorHead args;
387  if (!args.Decode(nc.command_data)) {
388  _log(SERVICE__ERROR, "Failed to decode args for Call_AddMoveExtractorHead");
389  nc.command_data->Dump(PLANET__WARNING, " ");
390  m_client->SendErrorMsg("Internal Server Error. Ref: ServerError 04588.");
391  return;
392  }
393 
394  m_colony->MoveExtractorHead(args.ecuID, (uint16)args.headID, args.latitude, args.longitude);
395 }
Client * m_client
Definition: PlanetMgr.h:49
void SendErrorMsg(const char *fmt,...)
Definition: Client.cpp:2719
#define _log(type, fmt,...)
Definition: logsys.h:124
Colony * m_colony
Definition: PlanetMgr.h:50
* args
void MoveExtractorHead(uint32 ecuID, uint16 headID, double latitude, double longitude)
Definition: Colony.cpp:724
unsigned __int16 uint16
Definition: eve-compat.h:48

Here is the call graph for this function:

Here is the caller graph for this function:

void PlanetMgr::PrioritizeRoute ( UUNCommand &  nc)
protected

Definition at line 415 of file PlanetMgr.cpp.

References _log, args, m_client, m_colony, Colony::PrioritizeRoute(), and Client::SendErrorMsg().

Referenced by UpdateNetwork().

416 {
417  _log(PLANET__TRACE, "PlanetMgr::UserUpdateNetwork::PrioritizeRoute()");
418  nc.Dump(COLONY__PKT_TRACE, " ");
419 
420  Call_PrioritizeRoute args;
421  if (!args.Decode(nc.command_data)) {
422  _log(SERVICE__ERROR, "Failed to decode args for Call_PrioritizeRoute");
423  nc.command_data->Dump(PLANET__WARNING, " ");
424  m_client->SendErrorMsg("Internal Server Error. Ref: ServerError 04588.");
425  return;
426  }
427 
428  m_colony->PrioritizeRoute(args.routeID, args.priority);
429 }
Client * m_client
Definition: PlanetMgr.h:49
void SendErrorMsg(const char *fmt,...)
Definition: Client.cpp:2719
#define _log(type, fmt,...)
Definition: logsys.h:124
Colony * m_colony
Definition: PlanetMgr.h:50
* args
void PrioritizeRoute(uint16 routeID, uint8 priority)
Definition: Colony.cpp:1195

Here is the call graph for this function:

Here is the caller graph for this function:

void PlanetMgr::RemoveLink ( UUNCommand &  nc)
protected

Definition at line 328 of file PlanetMgr.cpp.

References _log, PyRep::IntegerValue(), m_colony, and Colony::RemoveLink().

Referenced by UpdateNetwork().

329 {
330  _log(PLANET__TRACE, "PlanetMgr::UserUpdateNetwork::RemoveLink()");
331  nc.Dump(PLANET__WARNING, " ");
332 
333  m_colony->RemoveLink(PyRep::IntegerValue(nc.command_data->GetItem(0)), PyRep::IntegerValue(nc.command_data->GetItem(1)));
334 }
#define _log(type, fmt,...)
Definition: logsys.h:124
Colony * m_colony
Definition: PlanetMgr.h:50
void RemoveLink(uint32 src, uint32 dest)
Definition: Colony.cpp:684
static int64 IntegerValue(PyRep *pRep)
Definition: PyRep.cpp:118

Here is the call graph for this function:

Here is the caller graph for this function:

void PlanetMgr::RemovePin ( UUNCommand &  nc)
protected

Definition at line 311 of file PlanetMgr.cpp.

References _log, PyRep::IntegerValue(), m_client, m_colony, Colony::RemovePin(), and Client::SendErrorMsg().

Referenced by UpdateNetwork().

312 {
313  uint32 pinID = 0;
314  if (nc.command_data->GetItem(0)->IsInt()) {
315  pinID = PyRep::IntegerValue(nc.command_data->GetItem(0));
316  } else if (nc.command_data->GetItem(0)->IsTuple()) {
317  pinID = PyRep::IntegerValue(nc.command_data->GetItem(0)->AsTuple()->GetItem(1));
318  } else {
319  //Invalid...
320  _log(PLANET__ERROR, "PlanetMgr::UserUpdateNetwork::RemovePin() command_data type unrecognized: %s", nc.command_data->GetItem(0)->TypeString());
321  nc.command_data->Dump(PLANET__WARNING, " ");
322  m_client->SendErrorMsg("Internal Server Error. Ref: ServerError 04508.");
323  return;
324  }
325  m_colony->RemovePin(pinID);
326 }
Client * m_client
Definition: PlanetMgr.h:49
void SendErrorMsg(const char *fmt,...)
Definition: Client.cpp:2719
#define _log(type, fmt,...)
Definition: logsys.h:124
Colony * m_colony
Definition: PlanetMgr.h:50
unsigned __int32 uint32
Definition: eve-compat.h:50
static int64 IntegerValue(PyRep *pRep)
Definition: PyRep.cpp:118
void RemovePin(uint32 pinID)
Definition: Colony.cpp:615

Here is the call graph for this function:

Here is the caller graph for this function:

void PlanetMgr::RemoveRoute ( UUNCommand &  nc)
protected

Definition at line 336 of file PlanetMgr.cpp.

References _log, PyRep::IntegerValue(), m_client, m_colony, Colony::RemoveRoute(), and Client::SendErrorMsg().

Referenced by UpdateNetwork().

337 {
338  uint32 routeID = 0;
339  if (nc.command_data->GetItem(0)->IsInt()) {
340  routeID = PyRep::IntegerValue(nc.command_data->GetItem(0));
341  } else if (nc.command_data->GetItem(0)->IsTuple()) {
342  routeID = PyRep::IntegerValue(nc.command_data->GetItem(0)->AsTuple()->GetItem(1));
343  } else {
344  //Invalid...
345  _log(PLANET__ERROR, "PlanetMgr::UserUpdateNetwork::RemoveRoute() command_data type unrecognized: %s", nc.command_data->GetItem(0)->TypeString());
346  nc.command_data->Dump(PLANET__WARNING, " ");
347  m_client->SendErrorMsg("Internal Server Error. Ref: ServerError 04508.");
348  return;
349  }
350  m_colony->RemoveRoute(routeID);
351 }
Client * m_client
Definition: PlanetMgr.h:49
void SendErrorMsg(const char *fmt,...)
Definition: Client.cpp:2719
#define _log(type, fmt,...)
Definition: logsys.h:124
void RemoveRoute(uint16 routeID)
Definition: Colony.cpp:697
Colony * m_colony
Definition: PlanetMgr.h:50
unsigned __int32 uint32
Definition: eve-compat.h:50
static int64 IntegerValue(PyRep *pRep)
Definition: PyRep.cpp:118

Here is the call graph for this function:

Here is the caller graph for this function:

void PlanetMgr::SetLinkLevel ( UUNCommand &  nc)
protected

Definition at line 353 of file PlanetMgr.cpp.

References PyRep::IntegerValue(), m_colony, and Colony::UpgradeLink().

Referenced by UpdateNetwork().

354 {
355  m_colony->UpgradeLink(PyRep::IntegerValue(nc.command_data->GetItem(0)),
356  PyRep::IntegerValue(nc.command_data->GetItem(1)),
357  PyRep::IntegerValue(nc.command_data->GetItem(2)));
358 }
Colony * m_colony
Definition: PlanetMgr.h:50
static int64 IntegerValue(PyRep *pRep)
Definition: PyRep.cpp:118
void UpgradeLink(uint32 src, uint32 dest, uint8 level)
Definition: Colony.cpp:603

Here is the call graph for this function:

Here is the caller graph for this function:

void PlanetMgr::SetSchematic ( UUNCommand &  nc)
protected

Definition at line 360 of file PlanetMgr.cpp.

References PyRep::IntegerValue(), m_colony, and Colony::SetSchematic().

Referenced by UpdateNetwork().

361 {
362  uint32 pinID = 0;
363  if (nc.command_data->GetItem(0)->IsTuple()) {
364  pinID = PyRep::IntegerValue(nc.command_data->GetItem(0)->AsTuple()->GetItem(1));
365  } else if (nc.command_data->GetItem(0)->IsInt()) {
366  pinID = PyRep::IntegerValue(nc.command_data->GetItem(0));
367  }
368  m_colony->SetSchematic(pinID, PyRep::IntegerValue(nc.command_data->GetItem(1))); // 65 - 137
369 }
Colony * m_colony
Definition: PlanetMgr.h:50
unsigned __int32 uint32
Definition: eve-compat.h:50
void SetSchematic(uint32 pinID, uint8 schematicID=0)
Definition: Colony.cpp:753
static int64 IntegerValue(PyRep *pRep)
Definition: PyRep.cpp:118

Here is the call graph for this function:

Here is the caller graph for this function:

PyRep * PlanetMgr::UpdateNetwork ( UUNCommandList &  uuncl)

Definition at line 37 of file PlanetMgr.cpp.

References _log, PI::Command::AddExtractorHead, AddExtractorHead(), PI::Command::CreateLink, CreateLink(), PI::Command::CreatePin, CreatePin(), PI::Command::CreateRoute, CreateRoute(), Colony::GetColony(), PI::Command::InstallProgram, InstallProgram(), PI::Command::KillExtractorHead, KillExtractorHead(), m_client, m_colony, PI::Command::MoveExtractorHead, MoveExtractorHead(), PI::Command::PrioritizeRoute, PrioritizeRoute(), PI::Command::RemoveLink, RemoveLink(), PI::Command::RemovePin, RemovePin(), PI::Command::RemoveRoute, RemoveRoute(), Colony::Save(), Client::SendErrorMsg(), PI::Command::SetLinkLevel, SetLinkLevel(), PI::Command::SetSchematic, SetSchematic(), sPlanetDataMgr, PI::Command::UpgradeCommandCenter, and UpgradeCommandCenter().

38 {
39  using namespace PI;
40  bool cancel = false;
41  for (int i = 0; i < uuncl.commandList->size(); ++i) {
42  if (cancel)
43  return m_colony->GetColony();
44  UUNCommand uunc;
45  if (!uunc.Decode(uuncl.commandList->GetItem(i)->AsTuple())) {
46  _log(SERVICE__ERROR, "Failed to decode args for UUNCommand");
47  uuncl.commandList->Dump(PLANET__WARNING, " ");
48  m_client->SendErrorMsg("Internal Server Error. Ref: ServerError 04508.");
49  return nullptr;
50  }
51  _log(PLANET__TRACE, "PlanetMgr::UserUpdateNetwork() - loop: %u, command: %s(%i)", i, sPlanetDataMgr.GetCommandName(uunc.command), uunc.command);
52  switch (uunc.command) {
53  case Command::CreatePin: cancel = CreatePin(uunc); break;
54  case Command::RemovePin: RemovePin(uunc); break;
55  case Command::CreateLink: CreateLink(uunc); break;
56  case Command::RemoveLink: RemoveLink(uunc); break;
57  case Command::CreateRoute: CreateRoute(uunc); break;
58  case Command::SetLinkLevel: SetLinkLevel(uunc); break;
59  case Command::UpgradeCommandCenter: cancel = UpgradeCommandCenter(uunc); break;
60  case Command::SetSchematic: SetSchematic(uunc); break;
61  case Command::RemoveRoute: RemoveRoute(uunc); break;
64  case Command::InstallProgram: InstallProgram(uunc); break;
66  case Command::PrioritizeRoute: PrioritizeRoute(uunc); break;
67  default: {
68  _log(PLANET__ERROR, "PlanetMgr::UserUpdateNetwork() %s command %i", sPlanetDataMgr.GetCommandName(uunc.command), uunc.command);
69  } break;
70  }
71  }
72 
73  m_colony->Save();
74 
75  return m_colony->GetColony();
76 }
void InstallProgram(UUNCommand &nc)
Definition: PlanetMgr.cpp:397
Client * m_client
Definition: PlanetMgr.h:49
void SetSchematic(UUNCommand &nc)
Definition: PlanetMgr.cpp:360
void SendErrorMsg(const char *fmt,...)
Definition: Client.cpp:2719
#define _log(type, fmt,...)
Definition: logsys.h:124
void Save()
Definition: Colony.cpp:190
bool CreatePin(UUNCommand &nc)
Definition: PlanetMgr.cpp:115
void AddExtractorHead(UUNCommand &nc)
Definition: PlanetMgr.cpp:371
void KillExtractorHead(UUNCommand &nc)
Definition: PlanetMgr.cpp:410
void SetLinkLevel(UUNCommand &nc)
Definition: PlanetMgr.cpp:353
void CreateRoute(UUNCommand &nc)
Definition: PlanetMgr.cpp:297
void CreateLink(UUNCommand &nc)
Definition: PlanetMgr.cpp:250
Colony * m_colony
Definition: PlanetMgr.h:50
void PrioritizeRoute(UUNCommand &nc)
Definition: PlanetMgr.cpp:415
void RemoveLink(UUNCommand &nc)
Definition: PlanetMgr.cpp:328
void RemovePin(UUNCommand &nc)
Definition: PlanetMgr.cpp:311
Definition: EVE_Planet.h:16
void RemoveRoute(UUNCommand &nc)
Definition: PlanetMgr.cpp:336
PyRep * GetColony()
Definition: Colony.cpp:1313
bool UpgradeCommandCenter(UUNCommand &nc)
Definition: PlanetMgr.cpp:78
#define sPlanetDataMgr
Definition: PlanetDataMgr.h:41
void MoveExtractorHead(UUNCommand &nc)
Definition: PlanetMgr.cpp:384

Here is the call graph for this function:

bool PlanetMgr::UpgradeCommandCenter ( UUNCommand &  nc)
protected

Definition at line 78 of file PlanetMgr.cpp.

References Account::KeyType::Cash, corpCONCORD, corpInterbus, Client::GetCharacterID(), SystemEntity::GetID(), Colony::GetLevel(), SystemEntity::GetName(), SystemManager::GetSystemSecurityRating(), PyRep::IntegerValue(), PI::Pin::Level0, Agents::IskMult::Level1, Agents::IskMult::Level2, Agents::IskMult::Level3, Agents::IskMult::Level4, m_client, m_colony, m_planet, Journal::EntryType::PlanetaryConstruction, SystemEntity::SystemMgr(), AccountService::TranserFunds(), and Colony::UpgradeCommandCenter().

Referenced by UpdateNetwork().

79 {
80  // the return here is used to cancel loop in UpdateNetwork. return false = continue
81 
82  int8 oldLevel = m_colony->GetLevel(), newLevel = (int8)PyRep::IntegerValue(nc.command_data->GetItem(1));
83  int32 cost = 0;
84  using namespace PI::Pin;
85  while (oldLevel != newLevel) {
86  // calculate total upgrade cost in cases where upgrading multiple levels at once
87  switch (oldLevel) {
88  case Level0: cost += 580000; break;
89  case Level1: cost += 930000; break;
90  case Level2: cost += 1200000; break;
91  case Level3: cost += 1500000; break;
92  case Level4: cost += 2100000; break;
93  }
94  ++oldLevel;
95  }
96  //take the money, send wallet blink event record the transaction in their journal.
97  std::string reason = "DESC: Command Center upgrade on ";
98  reason += m_planet->GetName();
99  uint32 ownerID = corpCONCORD;
101  ownerID = corpInterbus;
104  ownerID, // concord in empire, interbus otherwise
105  cost,
106  reason.c_str(),
108  m_planet->GetID(),
110 
111  m_colony->UpgradeCommandCenter(PyRep::IntegerValue(nc.command_data->GetItem(0)), newLevel);
112  return false;
113 }
PlanetSE * m_planet
Definition: PlanetMgr.h:51
Client * m_client
Definition: PlanetMgr.h:49
int8 GetLevel()
Definition: Colony.h:91
int32 GetCharacterID() const
Definition: Client.h:113
const float GetSystemSecurityRating()
Definition: SystemManager.h:86
signed __int8 int8
Definition: eve-compat.h:45
signed __int32 int32
Definition: eve-compat.h:49
Colony * m_colony
Definition: PlanetMgr.h:50
SystemManager * SystemMgr()
Definition: SystemEntity.h:196
static void TranserFunds(uint32 fromID, uint32 toID, double amount, std::string reason="", uint8 entryTypeID=Journal::EntryType::Undefined, uint32 referenceID=0, uint16 fromKey=Account::KeyType::Cash, uint16 toKey=Account::KeyType::Cash, Client *pClient=nullptr)
uint32 GetID()
Definition: SystemEntity.h:207
const char * GetName() const
Definition: SystemEntity.h:210
unsigned __int32 uint32
Definition: eve-compat.h:50
void UpgradeCommandCenter(uint32 pinID, int8 level)
Definition: Colony.cpp:591
static int64 IntegerValue(PyRep *pRep)
Definition: PyRep.cpp:118

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

PlanetDB PlanetMgr::m_db
private

Definition at line 53 of file PlanetMgr.h.

PlanetSE* PlanetMgr::m_planet
private

Definition at line 51 of file PlanetMgr.h.

Referenced by CreatePin(), and UpgradeCommandCenter().

PyServiceMgr* PlanetMgr::m_svcMgr
private

Definition at line 48 of file PlanetMgr.h.


The documentation for this class was generated from the following files: