21 #include "packets/Planet.h"
41 for (
int i = 0; i < uuncl.commandList->size(); ++i) {
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,
" ");
51 _log(PLANET__TRACE,
"PlanetMgr::UserUpdateNetwork() - loop: %u, command: %s(%i)", i,
sPlanetDataMgr.GetCommandName(uunc.command), uunc.command);
52 switch (uunc.command) {
68 _log(PLANET__ERROR,
"PlanetMgr::UserUpdateNetwork() %s command %i",
sPlanetDataMgr.GetCommandName(uunc.command), uunc.command);
85 while (oldLevel != newLevel) {
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;
97 std::string reason =
"DESC: Command Center upgrade on ";
124 std::string reason =
"DESC: Command Center construction on ";
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,
" ");
153 _log(PLANET__ERROR,
"PlanetMgr::UserUpdateNetwork::CreatePin() Planet Bases (type/group %u/%u) not supported.", typeID, groupID);
159 std::string pinString =
"";
176 pinString =
"Basic Plant";
187 pinString =
"Advanced Plant";
192 pinString =
"High-Tech Plant";
202 pinString =
"LaunchPad";
210 pinString =
"Extractor Head";
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,
" ");
228 m_colony->
CreatePin(groupID, uuncsp.pinID2, uuncsp.typeID, uuncsp.latitude, uuncsp.longitude);
231 std::string reason =
"DESC: ";
232 reason += pinString.c_str();
233 reason +=
" Construction on ";
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,
" ");
264 level = uuncle.level;
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,
" ");
275 level = uunclc.level;
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,
" ");
287 level = uuncls.level;
290 _log(PLANET__ERROR,
"PlanetMgr::UserUpdateNetwork::CreateLink() command_data type unrecognized: %s", nc.command_data->GetItem(0)->TypeString());
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,
" ");
314 if (nc.command_data->GetItem(0)->IsInt()) {
316 }
else if (nc.command_data->GetItem(0)->IsTuple()) {
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,
" ");
330 _log(PLANET__TRACE,
"PlanetMgr::UserUpdateNetwork::RemoveLink()");
331 nc.Dump(PLANET__WARNING,
" ");
339 if (nc.command_data->GetItem(0)->IsInt()) {
341 }
else if (nc.command_data->GetItem(0)->IsTuple()) {
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,
" ");
363 if (nc.command_data->GetItem(0)->IsTuple()) {
365 }
else if (nc.command_data->GetItem(0)->IsInt()) {
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,
" ");
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,
" ");
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,
" ");
417 _log(PLANET__TRACE,
"PlanetMgr::UserUpdateNetwork::PrioritizeRoute()");
418 nc.Dump(COLONY__PKT_TRACE,
" ");
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,
" ");
void InstallProgram(UUNCommand &nc)
void SetSchematic(UUNCommand &nc)
void SendErrorMsg(const char *fmt,...)
#define _log(type, fmt,...)
bool CreatePin(UUNCommand &nc)
void KillExtractorHead(uint32 ecuID, uint16 headID)
void AddExtractorHead(UUNCommand &nc)
void CreatePin(uint32 groupID, uint32 pinID, uint32 typeID, double latitude, double longitude)
CustomsSE * GetCustomsOffice()
PyRep * UpdateNetwork(UUNCommandList &uuncl)
void KillExtractorHead(UUNCommand &nc)
int32 GetCharacterID() const
const float GetSystemSecurityRating()
void SetLinkLevel(UUNCommand &nc)
static uint32 IntegerValueU32(PyRep *pRep)
void RemoveRoute(uint16 routeID)
void CreateRoute(UUNCommand &nc)
void AddExtractorHead(uint32 ecuID, uint16 headID, double latitude, double longitude)
void CreateLink(UUNCommand &nc)
SystemManager * SystemMgr()
void PrioritizeRoute(UUNCommand &nc)
void RemoveLink(uint32 src, uint32 dest)
void CreateRoute(uint16 routeID, uint32 typeID, uint32 qty, PyList *path)
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 CreateLink(uint32 src, uint32 dest, uint16 level)
void InstallProgram(uint32 ecuID, uint16 typeID, float headRadius, PlanetMgr *pPMgr)
void CreateCommandPin(uint32 itemID, uint32 typeID, double latitude, double longitude)
const char * GetName() const
void RemoveLink(UUNCommand &nc)
void CreateCustomsOffice()
void RemovePin(UUNCommand &nc)
void RemoveRoute(UUNCommand &nc)
void MoveExtractorHead(uint32 ecuID, uint16 headID, double latitude, double longitude)
void UpgradeCommandCenter(uint32 pinID, int8 level)
void SetSchematic(uint32 pinID, uint8 schematicID=0)
static int64 IntegerValue(PyRep *pRep)
void PrioritizeRoute(uint16 routeID, uint8 priority)
PlanetMgr(PyServiceMgr *mgr, Client *pClient, PlanetSE *pPlanet, Colony *pColony)
void RemovePin(uint32 pinID)
bool UpgradeCommandCenter(UUNCommand &nc)
void UpgradeLink(uint32 src, uint32 dest, uint8 level)
void MoveExtractorHead(UUNCommand &nc)