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

#include "SystemManager.h"

Collaboration diagram for SystemManager:

Public Types

typedef std::map< uint32,
SystemBubble * > 
SpawnBubbleMap
 

Public Member Functions

 SystemManager (uint32 systemID, PyServiceMgr &svc)
 
 ~SystemManager ()
 
bool ProcessTic ()
 
bool BootSystem ()
 
void UnloadSystem ()
 
void UpdateData ()
 
bool IsLoaded ()
 
SystemEntityGetSE (uint32 entityID) const
 
NPCGetNPCSE (uint32 entityID) const
 
ShipItemRef GetShipFromInventory (uint32 shipID)
 
StationItemRef GetStationFromInventory (uint32 stationID)
 
CargoContainerRef GetContainerFromInventory (uint32 contID)
 
uint32 GetID () const
 
uint32 GetRegionID ()
 
uint32 GetConstellationID ()
 
const std::string & GetNameStr () const
 
const char * GetName () const
 
const char * GetSystemSecurityClass ()
 
const float GetSystemSecurityRating ()
 
PyServiceMgrGetServiceMgr ()
 
InventoryGetSystemInv ()
 
SolarSystemRef GetSystemRef ()
 
void RemoveSpawnBubble (SystemBubble *pBubble)
 
void GetSpawnBubbles (SpawnBubbleMap *bubbleMap)
 
void IncRatSpawnCount ()
 
void DecRatSpawnCount ()
 
void IncGateSpawnCount ()
 
void DecGateSpawnCount ()
 
void IncRoidSpawnCount ()
 
void DecRoidSpawnCount ()
 
uint8 BeltCount ()
 
uint8 GetRatSpawnCount ()
 
uint16 GetRoidSpawnCount ()
 
uint32 PlayerCount ()
 
uint32 GetSysNPCCount ()
 
BeltMgrGetBeltMgr ()
 
SpawnMgrGetSpawnMgr ()
 
AnomalyMgrGetAnomMgr ()
 
DungeonMgrGetDungMgr ()
 
float GetSecValue ()
 
bool BuildDynamicEntity (const DBSystemDynamicEntity &entity, uint32 launcherID=0)
 
void AddNPC (NPC *pNPC)
 
void RemoveNPC (NPC *pNPC)
 
void AddEntity (SystemEntity *pSE, bool addSignal=true)
 
void RemoveEntity (SystemEntity *pSE)
 
void AddClient (Client *pClient, bool count=false, bool jump=false)
 
void AddMarker (SystemEntity *pSE, bool sendBall=false, bool addSignal=false)
 
void RemoveClient (Client *pClient, bool count=false, bool jump=false)
 
void SetDockCount (Client *pClient, bool docked=false)
 
void AddItemToInventory (InventoryItemRef item)
 
void RemoveItemFromInventory (InventoryItemRef item)
 
void DoSpawnForBubble (SystemBubble *pBubble)
 
void SendStaticBall (SystemEntity *pSE)
 
void MakeSetState (const SystemBubble *pBubble, SetState &into) const
 
uint32 GetRandBeltID ()
 
uint32 GetClosestPlanetID (const GPoint &myPos)
 
void AddBounty (uint32 charID, BountyData &data)
 
SystemEntityGetClosestMoonSE (const GPoint &myPos)
 
SystemEntityGetClosestPlanetSE (const GPoint &myPos)
 
SystemEntityGetClosestGateSE (const GPoint &myPos)
 
void DScan (int64 range, const GPoint &pos, std::vector< SystemEntity * > &vector)
 
PyRepGetCurrentEntities ()
 
void GetAllEntities (std::vector< CosmicSignature > &vector)
 
std::map< uint32, SystemEntity * > GetOperationalStatics ()
 
std::map< uint32, SystemEntity * > GetGates ()
 
void GetClientList (std::vector< Client * > &cVec)
 
std::map< uint32, SystemEntity * > GetEntities ()
 
SystemEntityGetPlanet (uint32 planetID)
 

Protected Member Functions

void PayBounties ()
 
void GetDockedCount ()
 
void GetPlayerCount ()
 
bool LoadCosmicMgrs ()
 
bool LoadSystemStatics ()
 
bool LoadSystemDynamics ()
 
bool LoadPlayerDynamics ()
 

Private Types

typedef std::map< uint16, uint8RatDataMap
 

Private Member Functions

void ManipulateTimeData ()
 
bool SystemActivity ()
 
bool SafeToUnload ()
 
bool IsNull (std::map< uint32, SystemEntity * >::iterator &i)
 

Private Attributes

AnomalyMgrm_anomMgr
 
BeltMgrm_beltMgr
 
DungeonMgrm_dungMgr
 
SpawnMgrm_spawnMgr
 
PyServiceMgrm_services
 
SolarSystemRef m_solarSystemRef
 
SystemGPoint mGP
 
SystemData m_data
 
float m_secValue
 
SystemKillData m_killData
 
uint16 m_docked
 
std::map< uint32, uint8m_jumpMap
 
uint8 m_beltCount
 
uint8 m_gateCount
 
uint8 m_activeRatSpawns
 
uint8 m_activeGateSpawns
 
uint16 m_activeRoidSpawns
 
std::vector< uint32m_beltVector
 
SpawnBubbleMap m_ratBubbles
 
SpawnBubbleMap m_roidBubbles
 
std::map< uint32, SystemEntity * > m_moonMap
 
std::map< uint32, SystemEntity * > m_planetMap
 
std::map< uint32, SystemEntity * > m_gateMap
 
bool m_loaded
 
uint16 m_players
 
uint32 m_activityTime
 
bool m_entityChanged:1
 
std::map< uint32, NPC * > m_npcs
 
std::map< uint32, Client * > m_clients
 
std::map< uint32, SystemEntity * > m_entities
 
std::map< uint32, SystemEntity * > m_ticEntities
 
std::map< uint32, SystemEntity * > m_staticEntities
 
std::map< uint32, SystemEntity * > m_opStaticEntities
 
Timer m_bountyTimer
 
std::map< uint32, BountyDatam_bountyMap
 
std::map< uint32, RatDataMapm_ratMap
 
Timer m_minutetimer
 
uint32 m_minutes
 

Detailed Description

Definition at line 60 of file SystemManager.h.

Member Typedef Documentation

typedef std::map<uint16, uint8> SystemManager::RatDataMap
private

Definition at line 232 of file SystemManager.h.

Definition at line 93 of file SystemManager.h.

Constructor & Destructor Documentation

SystemManager::SystemManager ( uint32  systemID,
PyServiceMgr svc 
)

Definition at line 64 of file SystemManager.cpp.

References _log, m_beltVector, m_clients, m_data, m_entities, m_gateMap, m_jumpMap, m_killData, m_minutes, m_moonMap, m_npcs, m_opStaticEntities, m_planetMap, m_ratBubbles, m_roidBubbles, m_secValue, m_staticEntities, m_ticEntities, SystemData::name, sDataMgr, SystemData::securityRating, and SystemData::systemID.

65 :m_services(svc),
66 m_bountyTimer(0),
67 m_minutetimer(0, true),
68 m_anomMgr(new AnomalyMgr(this, svc)),
69 m_beltMgr(new BeltMgr(this, svc)),
70 m_dungMgr(new DungeonMgr(this, svc)),
71 m_spawnMgr(new SpawnMgr(this, svc)),
72 m_loaded(false),
73 m_entityChanged(false),
74 m_docked(0),
75 m_players(0),
76 m_beltCount(0),
77 m_gateCount(0),
82 m_secValue(1.1f)
83 {
84  m_minutes = 0;
85 
86  m_npcs.clear();
87  m_clients.clear();
88  m_jumpMap.clear();
89  m_moonMap.clear();
90  m_entities.clear();
91  m_planetMap.clear();
92  m_gateMap.clear();
93  m_ratBubbles.clear();
94  m_beltVector.clear();
95  m_roidBubbles.clear();
96  m_ticEntities.clear();
97  m_staticEntities.clear();
98  m_opStaticEntities.clear();
99 
100  // zero-init our data containers
101  m_data = SystemData();
103 
104  sDataMgr.GetSystemData(systemID, m_data); // system data is now an internal memory (cached) object. db is hit once at system boot.
105  m_secValue -= m_data.securityRating; // range is 0.1 for 1.0 system to 2.0 for -0.9 system
106 
107  _log(COMMON__MESSAGE, "Created SystemManager %p for System %s(%u)", this, m_data.name.c_str(), m_data.systemID);
108 }
SpawnBubbleMap m_roidBubbles
#define _log(type, fmt,...)
Definition: logsys.h:124
std::string name
std::map< uint32, SystemEntity * > m_opStaticEntities
uint8 m_activeGateSpawns
DungeonMgr * m_dungMgr
std::map< uint32, SystemEntity * > m_gateMap
std::map< uint32, uint8 > m_jumpMap
SystemData m_data
std::map< uint32, SystemEntity * > m_ticEntities
std::map< uint32, Client * > m_clients
std::map< uint32, SystemEntity * > m_planetMap
SpawnBubbleMap m_ratBubbles
SpawnMgr * m_spawnMgr
std::vector< uint32 > m_beltVector
BeltMgr * m_beltMgr
uint32 systemID
float securityRating
uint8 m_activeRatSpawns
AnomalyMgr * m_anomMgr
SystemKillData m_killData
uint32 m_activityTime
std::map< uint32, SystemEntity * > m_entities
PyServiceMgr & m_services
std::map< uint32, NPC * > m_npcs
std::map< uint32, SystemEntity * > m_staticEntities
uint16 m_activeRoidSpawns
std::map< uint32, SystemEntity * > m_moonMap
#define sDataMgr
SystemManager::~SystemManager ( )

Definition at line 110 of file SystemManager.cpp.

References _log, m_anomMgr, m_beltMgr, m_clients, m_data, m_dungMgr, m_loaded, m_players, m_spawnMgr, SafeDelete(), sEntityList, SystemData::systemID, and UnloadSystem().

110  {
111  if (m_players or !m_clients.empty()) {
112  _log(COMMON__ERROR, "D'tor called for System %u with %u players and/or %u clients in mmaps", m_data.systemID, m_players, m_clients.size());
113  for (auto cur : m_clients)
114  sEntityList.Remove(cur.second);
115  }
116 
117  if (m_loaded)
118  UnloadSystem();
119 
124 }
#define _log(type, fmt,...)
Definition: logsys.h:124
DungeonMgr * m_dungMgr
#define sEntityList
Definition: EntityList.h:208
void SafeDelete(T *&p)
Deletes and nullifies a pointer.
Definition: SafeMem.h:83
SystemData m_data
std::map< uint32, Client * > m_clients
SpawnMgr * m_spawnMgr
BeltMgr * m_beltMgr
uint32 systemID
AnomalyMgr * m_anomMgr

Here is the call graph for this function:

Member Function Documentation

void SystemManager::AddBounty ( uint32  charID,
BountyData data 
)

Definition at line 1141 of file SystemManager.cpp.

References _log, BountyData::amount, BountyData::fromID, m_bountyMap, m_data, m_ratMap, SystemData::name, and SystemData::systemID.

Referenced by DynamicSystemEntity::AwardBounty().

1142 {
1143  /*
1144 struct BountyData { // this is comming from rat killed.
1145  uint32 fromID;
1146  uint32 toID;
1147  double amount;
1148  uint8 refTypeID;
1149  uint16 fromKey;
1150  uint16 toKey;
1151  std::string reason; this can stay blank for now. populate during PayBounties
1152 }; */
1153  _log(CLIENT__TEXT, "AddBounty called for charID %u in system %s(%u).", charID, m_data.name.c_str(), m_data.systemID);
1154  std::map<uint32, BountyData>::iterator itr = m_bountyMap.find(charID);
1155  if (itr != m_bountyMap.end()) {
1156  itr->second.amount += data.amount;
1157  std::map<uint32, RatDataMap>::iterator rItr = m_ratMap.find(charID);
1158  if (rItr != m_ratMap.end()) {
1159  RatDataMap::iterator it = rItr->second.begin();
1160  if (it == rItr->second.end()){
1161  RatDataMap vec;
1162  vec.emplace(data.fromID, 1);
1163  rItr->second = vec;
1164  } else {
1165  ++(it->second);
1166  }
1167  } else {
1168  RatDataMap vec;
1169  vec.emplace(data.fromID, 1);
1170  m_ratMap.emplace(charID, vec);
1171  }
1172  } else {
1173  m_bountyMap.emplace(charID, data);
1174  RatDataMap vec;
1175  vec.emplace(data.fromID, 1);
1176  m_ratMap.emplace(charID, vec);
1177  }
1178 }
#define _log(type, fmt,...)
Definition: logsys.h:124
std::string name
std::map< uint32, RatDataMap > m_ratMap
std::map< uint32, BountyData > m_bountyMap
std::map< uint16, uint8 > RatDataMap
SystemData m_data
uint32 systemID

Here is the caller graph for this function:

void SystemManager::AddClient ( Client pClient,
bool  count = false,
bool  jump = false 
)

Definition at line 911 of file SystemManager.cpp.

References _log, MapDB::AddJump(), Client::GetCharacterID(), Client::GetName(), m_activityTime, m_clients, m_data, m_jumpMap, m_players, SystemData::name, sEntityList, and SystemData::systemID.

Referenced by Client::MoveToLocation(), and Client::SelectCharacter().

911  {
912  //called from Client::MoveToLocation() on login and when changing systems
913  if (pClient == nullptr)
914  return;
915  if (m_clients.find(pClient->GetCharacterID()) == m_clients.end()) {
916  m_clients[pClient->GetCharacterID()] = pClient;
917  _log(PLAYER__TRACE, "%s(%u): Added to system manager for %s(%u) - %u clients now in system. count %s", \
918  pClient->GetName(), pClient->GetCharacterID(), m_data.name.c_str(), m_data.systemID, m_clients.size(), count?"true":"false");
919  } else {
920  // error for player already in client map
921  _log(PLAYER__ERROR, "%s(%u): Already in player map for %s(%u)", \
922  pClient->GetName(), pClient->GetCharacterID(), m_data.name.c_str(), m_data.systemID);
923  }
924 
925  m_activityTime = 0;
926 
927  if (count) {
928  ++m_players;
929  _log(PLAYER__INFO, "%s(%u): Added to player count for %s(%u) - new count: %u", \
930  pClient->GetName(), pClient->GetCharacterID(), m_data.name.c_str(), m_data.systemID, m_players);
931  }
932  if (jump) {
933  //add jump in this system
935 
936  _log(PLAYER__INFO, "%s(%u): Add Jump to %s(%u)", \
937  pClient->GetName(), pClient->GetCharacterID(), m_data.name.c_str(), m_data.systemID);
938 
939  uint16 stamp = sEntityList.GetStamp();
940  std::map<uint32, uint8>::iterator itr = m_jumpMap.find(stamp);
941  if (itr != m_jumpMap.end()) {
942  ++(itr->second);
943  } else {
944  m_jumpMap.emplace(stamp, 1);
945  }
946  }
947 }
#define _log(type, fmt,...)
Definition: logsys.h:124
std::string name
int32 GetCharacterID() const
Definition: Client.h:113
#define sEntityList
Definition: EntityList.h:208
std::map< uint32, uint8 > m_jumpMap
SystemData m_data
std::map< uint32, Client * > m_clients
const char * GetName() const
Definition: Client.h:94
uint32 systemID
static void AddJump(uint32 sysID)
Definition: MapDB.cpp:218
uint32 m_activityTime
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 SystemManager::AddEntity ( SystemEntity pSE,
bool  addSignal = true 
)

Definition at line 1036 of file SystemManager.cpp.

References _log, SolarSystem::AddItemToInventory(), AnomalyMgr::AddSignal(), SystemEntity::GetID(), SystemEntity::GetName(), SystemEntity::GetProbeSE(), SystemEntity::GetSelf(), SystemEntity::IsCOSE(), SystemEntity::isGlobal(), SystemEntity::IsOperSE(), SystemEntity::IsProbeSE(), IsStaticItem, itemID(), m_anomMgr, m_data, m_entities, m_entityChanged, m_loaded, m_opStaticEntities, m_solarSystemRef, m_staticEntities, m_ticEntities, SystemData::name, sBubbleMgr, SendStaticBall(), sEntityList, and SystemData::systemID.

Referenced by AddNPC(), BuildDynamicEntity(), WormholeMgr::Create(), DungeonMgr::Create(), PlanetSE::CreateCustomsOffice(), CynoModule::CreateCyno(), TowerSE::CreateForceField(), Prospector::DropSalvage(), Client::Eject(), DroneSE::Launch(), ActiveModule::LaunchProbe(), BeltMgr::Load(), LoadPlayerDynamics(), LoadSystemDynamics(), DestinyManager::MakeMissile(), SystemBubble::MarkBubble(), DestinyManager::MoveObject(), Client::MoveToPosition(), Client::ResetAfterPopped(), Client::SetBallPark(), Client::SetDestiny(), and BeltMgr::SpawnAsteroid().

1036  {
1037  if (pSE == nullptr)
1038  return;
1039  uint32 itemID(pSE->GetID());
1040  if (m_entities.find(itemID) != m_entities.end()) {
1041  _log(ITEM__WARNING, "%s(%u): Called AddEntity(), but they're already in %s(%u). Check bubble.", pSE->GetName(), itemID, m_data.name.c_str(), m_data.systemID);
1042  return;
1043  } else {
1044  _log(ITEM__TRACE, "%s(%u): Added to system manager for %s(%u)", pSE->GetName(), itemID, m_data.name.c_str(), m_data.systemID);
1045  m_entities[itemID] = pSE;
1046 
1047  if ((pSE->IsCOSE())
1048  or (pSE->isGlobal())) {
1049  m_staticEntities[itemID] = pSE;
1050  if (pSE->IsOperSE()) //Entities which need to be acted upon while nobody is in the system
1051  m_opStaticEntities[itemID] = pSE;
1052  if (m_loaded) // only update when system is already loaded
1053  SendStaticBall(pSE);
1054  } else if (pSE->IsProbeSE()) {
1055  // probes are now running sub-hz tics, so dont add to proc list.
1056  addSignal = false; // redundant...called with AddSignal=false
1057  sEntityList.AddProbe(itemID, pSE->GetProbeSE());
1058  } else if (!IsStaticItem(itemID)) {
1059  // *most* dynamic items need proc tics. add to proc list
1060  m_entityChanged = true;
1061  m_ticEntities[itemID] = pSE;
1062  } else {
1063  addSignal = false;
1064  }
1065 
1066  // Add Entity's Item Ref to Solar System Dynamic Inventory:
1068  }
1069  sBubbleMgr.Add(pSE);
1070  // add item to our AnomalyMgr
1071  if (addSignal)
1072  m_anomMgr->AddSignal(pSE);
1073 }
#define IsStaticItem(itemID)
Definition: EVE_Defines.h:266
virtual ProbeSE * GetProbeSE()
Definition: SystemEntity.h:112
#define _log(type, fmt,...)
Definition: logsys.h:124
std::string name
std::map< uint32, SystemEntity * > m_opStaticEntities
virtual bool IsProbeSE()
Definition: SystemEntity.h:159
virtual bool IsOperSE()
Definition: SystemEntity.h:180
#define sEntityList
Definition: EntityList.h:208
virtual bool IsCOSE()
Definition: SystemEntity.h:164
SystemData m_data
InventoryItemRef GetSelf()
Definition: SystemEntity.h:202
std::map< uint32, SystemEntity * > m_ticEntities
uint32 GetID()
Definition: SystemEntity.h:207
const char * GetName() const
Definition: SystemEntity.h:210
unsigned __int32 uint32
Definition: eve-compat.h:50
uint32 systemID
virtual bool isGlobal()
Definition: SystemEntity.h:142
void SendStaticBall(SystemEntity *pSE)
void AddSignal(SystemEntity *pSE, uint32 id=0)
Definition: AnomalyMgr.cpp:422
typeID Spawn an NPC with the specified type text Search for items matching the specified query() type()() itemID() copy() materialLevel()() itemID(attributeID)-Retrieves attribute value." ) COMMAND( setattr
AnomalyMgr * m_anomMgr
SolarSystemRef m_solarSystemRef
std::map< uint32, SystemEntity * > m_entities
#define sBubbleMgr
std::map< uint32, SystemEntity * > m_staticEntities
void AddItemToInventory(InventoryItemRef iRef)

Here is the call graph for this function:

Here is the caller graph for this function:

void SystemManager::AddItemToInventory ( InventoryItemRef  item)

Definition at line 1434 of file SystemManager.cpp.

References SolarSystem::AddItemToInventory(), and m_solarSystemRef.

Referenced by LoadSystemStatics().

1435 {
1437 }
SolarSystemRef m_solarSystemRef
void AddItemToInventory(InventoryItemRef iRef)

Here is the call graph for this function:

Here is the caller graph for this function:

void SystemManager::AddMarker ( SystemEntity pSE,
bool  sendBall = false,
bool  addSignal = false 
)

Definition at line 1092 of file SystemManager.cpp.

References AnomalyMgr::AddSignal(), Buffer::Append(), SystemEntity::EncodeDestiny(), SystemEntity::GetID(), is_log_enabled, m_anomMgr, m_clients, m_entities, SystemEntity::MakeDamageState(), SystemEntity::MakeSlimItem(), Destiny::AddBall_header::packet_type, PyIncRef, SafeDelete(), sBubbleMgr, sEntityList, PyTuple::SetItem(), and Destiny::AddBall_header::stamp.

Referenced by DestinyManager::MoveObject().

1092  {
1093  if (pSE == nullptr)
1094  return;
1095 
1096  m_entities[pSE->GetID()] = pSE;
1097  // Add Entity's Item Ref to Solar System Dynamic Inventory:
1098  //m_solarSystemRef->AddItemToInventory(pSE->GetSelf());
1099 
1100  sBubbleMgr.Add(pSE);
1101  if (addSignal)
1102  m_anomMgr->AddSignal(pSE);
1103  if (sendBall) {
1104  // modified from SendStaticBall()
1105  if (m_clients.empty())
1106  return;
1107 
1108  Buffer* destinyBuffer = new Buffer();
1109  //create AddBalls header
1111  head.packet_type = 1; // 0 = full state 1 = balls
1112  head.stamp = sEntityList.GetStamp();
1113  destinyBuffer->Append( head );
1114 
1115  AddBalls2 addballs2;
1116  addballs2.stateStamp = sEntityList.GetStamp();
1117  addballs2.extraBallData = new PyList();
1118 
1119  PyTuple* balls = new PyTuple(2);
1120  balls->SetItem(0, pSE->MakeSlimItem());
1121  balls->SetItem(1, pSE->MakeDamageState());
1122  addballs2.extraBallData->AddItem(balls);
1123 
1124  pSE->EncodeDestiny(*destinyBuffer);
1125 
1126  addballs2.state = new PyBuffer(&destinyBuffer); //consumed
1127  SafeDelete( destinyBuffer );
1128 
1129  if (is_log_enabled(DESTINY__BALL_DUMP))
1130  addballs2.Dump( DESTINY__BALL_DUMP, " " );
1131  //send the update
1132  PyTuple* up = addballs2.Encode();
1133  for (auto cur : m_clients) {
1134  PyIncRef(up);
1135  cur.second->QueueDestinyUpdate(&up, true);
1136  }
1137  }
1138 }
void Append(const T &value)
Appends a single value to buffer.
Definition: Buffer.h:437
#define sEntityList
Definition: EntityList.h:208
Python tuple.
Definition: PyRep.h:567
void SafeDelete(T *&p)
Deletes and nullifies a pointer.
Definition: SafeMem.h:83
#define is_log_enabled(type)
Definition: logsys.h:78
virtual PyDict * MakeSlimItem()
Generic class for buffers.
Definition: Buffer.h:40
std::map< uint32, Client * > m_clients
PyTuple * MakeDamageState()
void SetItem(size_t index, PyRep *object)
Stores Python object.
Definition: PyRep.h:610
uint32 GetID()
Definition: SystemEntity.h:207
#define PyIncRef(op)
Definition: PyRep.h:56
virtual void EncodeDestiny(Buffer &into)
void AddSignal(SystemEntity *pSE, uint32 id=0)
Definition: AnomalyMgr.cpp:422
AnomalyMgr * m_anomMgr
std::map< uint32, SystemEntity * > m_entities
Python buffer.
Definition: PyRep.h:382
#define sBubbleMgr
Python list.
Definition: PyRep.h:639

Here is the call graph for this function:

Here is the caller graph for this function:

void SystemManager::AddNPC ( NPC pNPC)

Definition at line 1008 of file SystemManager.cpp.

References _log, AddEntity(), SystemEntity::GetID(), SystemEntity::GetName(), itemID(), m_data, m_npcs, SystemData::name, sEntityList, and SystemData::systemID.

Referenced by SpawnMgr::MakeSpawn(), and SpawnMgr::ReSpawn().

1008  {
1009  if ( pNPC == nullptr)
1010  return;
1011  uint32 itemID = pNPC->GetID();
1012  if (m_npcs.find(itemID) != m_npcs.end()) {
1013  _log(ITEM__WARNING, "%s(%u): Called AddNPC(), but they're already in %s(%u). Check bubble.", pNPC->GetName(), itemID, m_data.name.c_str(), m_data.systemID);
1014  } else {
1015  m_npcs[itemID] = pNPC;
1016  }
1017 
1018  _log(NPC__TRACE, "%s(%u): Added to system manager for %s(%u)", pNPC->GetName(), pNPC->GetID(), m_data.name.c_str(), m_data.systemID);
1019  AddEntity(pNPC, false);
1020  sEntityList.AddNPC();
1021 }
void AddEntity(SystemEntity *pSE, bool addSignal=true)
#define _log(type, fmt,...)
Definition: logsys.h:124
std::string name
#define sEntityList
Definition: EntityList.h:208
SystemData m_data
uint32 GetID()
Definition: SystemEntity.h:207
const char * GetName() const
Definition: SystemEntity.h:210
unsigned __int32 uint32
Definition: eve-compat.h:50
uint32 systemID
typeID Spawn an NPC with the specified type text Search for items matching the specified query() type()() itemID() copy() materialLevel()() itemID(attributeID)-Retrieves attribute value." ) COMMAND( setattr
std::map< uint32, NPC * > m_npcs

Here is the call graph for this function:

Here is the caller graph for this function:

uint8 SystemManager::BeltCount ( )
inline

Definition at line 102 of file SystemManager.h.

References m_beltCount.

Referenced by Command_list(), and SpawnMgr::Init().

102 { return m_beltCount; }

Here is the caller graph for this function:

bool SystemManager::BootSystem ( )

Definition at line 126 of file SystemManager.cpp.

References _log, SystemData::constellationID, LSCService::CreateSystemChannel(), RefPtr< X >::get(), LoadCosmicMgrs(), MapDB::LoadDynamicData(), LoadPlayerDynamics(), LoadSystemDynamics(), LoadSystemStatics(), PyServiceMgr::lsc_service, m_bountyTimer, m_data, m_killData, m_loaded, m_minutetimer, m_opStaticEntities, m_services, m_solarSystemRef, m_ticEntities, SystemData::regionID, sConfig, MapDB::SetSystemActive(), sItemFactory, Timer::Start(), and SystemData::systemID.

126  {
127  // dont fuck with this order...
128 
129  m_solarSystemRef = sItemFactory.GetSolarSystem(m_data.systemID);
130  assert(m_solarSystemRef.get() != nullptr);
131 
132  if (!LoadSystemStatics()) {
133  _log(SERVICE__ERROR, "Unable to load System Statics during boot of system %u.", m_data.systemID);
134  return false;
135  }
136 
137  if (!LoadCosmicMgrs()) {
138  _log(SERVICE__ERROR, "Unable to load Cosmic Managers during boot of system %u.", m_data.systemID);
139  return false;
140  }
141 
142  if (!LoadSystemDynamics()) {
143  _log(SERVICE__ERROR, "Unable to load System Dynamics during boot of system %u.", m_data.systemID);
144  return false;
145  }
146 
147  if (!LoadPlayerDynamics()) {
148  _log(SERVICE__ERROR, "Unable to load System Dynamics during boot of system %u.", m_data.systemID);
149  return false;
150  }
151 
152  // check for operational static entities which need to be initialized (such as sovereignty structures)
153  for (auto cur: m_opStaticEntities)
154  if (cur.second ->IsTCUSE())
155  cur.second->GetTCUSE()->Init();
156  else if (cur.second ->IsSBUSE())
157  cur.second->GetSBUSE()->Init();
158  else if (cur.second ->IsIHubSE())
159  cur.second->GetIHubSE()->Init();
160 
161  // system is loaded. check for items that need initialization
162  for (auto cur : m_ticEntities)
163  if (cur.second->IsPOSSE())
164  cur.second->GetPOSSE()->Init();
165 
166  // check planets for colony/customs office
167  /* does not work as intended
168  for (auto cur : m_planetMap)
169  if (cur.second->GetPlanetSE()->HasColony())
170  if (!cur.second->GetPlanetSE()->HasCOSE())
171  cur.second->GetPlanetSE()->CreateCustomsOffice();
172  */
173 
174  if (sConfig.server.BountyPayoutDelayed)
175  m_bountyTimer.Start(sConfig.server.BountyPayoutTimer * 60 * 1000);
176 
177  //create our chat channels
181 
182  // inform MarketBot of loaded system and stations in this system.
183  //sMktBotMgr.AddSystem();
184 
185  // set system active for system status page
187 
188  // load dynamic map data
190 
191  //start minute timer
192  m_minutetimer.Start(60000);
193 
194  return (m_loaded = true);
195 }
#define sConfig
A macro for easier access to the singleton.
bool LoadSystemDynamics()
#define _log(type, fmt,...)
Definition: logsys.h:124
static void SetSystemActive(uint32 sysID, bool active=false)
Definition: MapDB.cpp:212
std::map< uint32, SystemEntity * > m_opStaticEntities
static void LoadDynamicData(uint32 sysID, SystemKillData &data)
Definition: MapDB.cpp:117
bool LoadPlayerDynamics()
void CreateSystemChannel(int32 channelID)
Definition: LSCService.cpp:951
SystemData m_data
bool LoadSystemStatics()
std::map< uint32, SystemEntity * > m_ticEntities
X * get() const
Definition: RefPtr.h:213
LSCService * lsc_service
Definition: PyServiceMgr.h:77
uint32 systemID
uint32 regionID
SystemKillData m_killData
SolarSystemRef m_solarSystemRef
#define sItemFactory
Definition: ItemFactory.h:165
uint32 constellationID
PyServiceMgr & m_services
void Start(uint32 setTimerTime=0, bool changeResetTimer=true)
Definition: timer.cpp:81

Here is the call graph for this function:

bool SystemManager::BuildDynamicEntity ( const DBSystemDynamicEntity entity,
uint32  launcherID = 0 
)

Definition at line 521 of file SystemManager.cpp.

References _log, AddEntity(), DynamicEntityFactory::BuildEntity(), Client::GetFleetID(), SystemEntity::GetWreckSE(), DBSystemDynamicEntity::groupID, Client::InFleet(), IsCharacterID, DBSystemDynamicEntity::itemID, m_data, SystemData::name, DBSystemDynamicEntity::ownerID, sEntityList, SystemEntity::SetFleetID(), WreckSE::SetLaunchedByID(), sLog, SystemData::systemID, and DBSystemDynamicEntity::typeID.

Referenced by Command_spawn(), Command_spawnn(), Sentry::Killed(), CustomsSE::Killed(), NPC::Killed(), DroneSE::Killed(), StructureSE::Killed(), and ShipSE::Killed().

521  {
522  SystemEntity* pSE = DynamicEntityFactory::BuildEntity(*this, entity);
523  if (pSE == nullptr) {
524  sLog.Error( "SystemManager::BuildDynamicEntity()", "Failed to create entity for item %u (grp: %u, type %u)", entity.itemID, entity.groupID, entity.typeID);
525  return false;
526  }
527 
528  _log(ITEM__TRACE, "SystemManager::BuildDynamicEntity() - Created dynamic entity %u of type %u for %s(%u)", \
529  entity.itemID, entity.typeID, m_data.name.c_str(),m_data.systemID );
530  AddEntity(pSE);
531 
532  // this is only used for wrecks...
533  if (launcherID) {
534  WreckSE* pWE = pSE->GetWreckSE();
535  pWE->SetLaunchedByID(launcherID);
536  if (IsCharacterID(entity.ownerID)) {
537  Client* pClient = sEntityList.FindClientByCharID(entity.ownerID);
538  if (pClient->InFleet())
539  pWE->SetFleetID(pClient->GetFleetID());
540  }
541  }
542  return true;
543 }
void AddEntity(SystemEntity *pSE, bool addSignal=true)
#define _log(type, fmt,...)
Definition: logsys.h:124
std::string name
#define sEntityList
Definition: EntityList.h:208
void SetFleetID(uint32 set)
Definition: SystemEntity.h:221
virtual WreckSE * GetWreckSE()
Definition: SystemEntity.h:108
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
SystemData m_data
bool InFleet()
Definition: Client.h:142
static SystemEntity * BuildEntity(SystemManager &pSysMgr, const DBSystemDynamicEntity &entity)
uint32 GetFleetID() const
Definition: Client.h:146
#define IsCharacterID(itemID)
Definition: EVE_Defines.h:206
Definition: Client.h:66
uint32 systemID
void SetLaunchedByID(uint32 launcherID)
Definition: Container.h:263

Here is the call graph for this function:

Here is the caller graph for this function:

void SystemManager::DecGateSpawnCount ( )
inline

Definition at line 99 of file SystemManager.h.

References m_activeGateSpawns.

99 { --m_activeGateSpawns; }
uint8 m_activeGateSpawns
void SystemManager::DecRatSpawnCount ( )
inline

Definition at line 97 of file SystemManager.h.

References m_activeRatSpawns.

97 { --m_activeRatSpawns; }
uint8 m_activeRatSpawns
void SystemManager::DecRoidSpawnCount ( )
inline

Definition at line 101 of file SystemManager.h.

References m_activeRoidSpawns.

101 { --m_activeRoidSpawns; }
uint16 m_activeRoidSpawns
void SystemManager::DoSpawnForBubble ( SystemBubble pBubble)

Definition at line 1234 of file SystemManager.cpp.

References _log, SpawnMgr::DoSpawnForBubble(), SystemBubble::GetID(), is_log_enabled, SystemBubble::IsGate(), SpawnMgr::IsInitialized(), m_activeRatSpawns, m_beltCount, m_data, m_ratBubbles, m_spawnMgr, SystemData::name, SystemData::regionID, sBubbleMgr, SystemData::securityRating, and SystemData::systemID.

Referenced by SystemBubble::Process().

1235 {
1236  if (!m_spawnMgr->IsInitialized())
1237  return;
1238 
1239  uint8 count = m_beltCount;
1240  if (count < 1)
1241  return;
1242 
1243  if (is_log_enabled(SPAWN__MESSAGE))
1244  _log(SPAWN__MESSAGE, "Spawn called for bubble %u(%u) in %s(%u)[%.4f], region %u.",
1245  pBubble->GetID(), sBubbleMgr.GetBeltID(pBubble->GetID()), m_data.name.c_str(), m_data.systemID, m_data.securityRating, m_data.regionID);
1246  if (count > 15)
1247  count = 15;
1248  if ((m_activeRatSpawns < count ) or (pBubble->IsGate())) {
1249  if (m_spawnMgr->DoSpawnForBubble(pBubble)) {
1250  m_ratBubbles.emplace(pBubble->GetID(), pBubble);
1251  if (is_log_enabled(SPAWN__TRACE))
1252  _log(SPAWN__TRACE, "SystemManager::DoSpawnForBubble() completed for %s(%u) in bubble %u. %u items in m_ratBubbles", \
1253  m_data.name.c_str(), m_data.systemID, pBubble->GetID(), m_ratBubbles.size());
1254  } else {
1255  if (is_log_enabled(SPAWN__TRACE))
1256  _log(SPAWN__TRACE, "SystemManager::DoSpawnForBubble() returned false for bubble %u.", pBubble->GetID());
1257  }
1258  }
1259 }
unsigned __int8 uint8
Definition: eve-compat.h:46
#define _log(type, fmt,...)
Definition: logsys.h:124
bool IsInitialized()
Definition: SpawnMgr.h:59
std::string name
#define is_log_enabled(type)
Definition: logsys.h:78
SystemData m_data
SpawnBubbleMap m_ratBubbles
uint16 GetID()
Definition: SystemBubble.h:91
SpawnMgr * m_spawnMgr
uint32 systemID
uint32 regionID
bool IsGate()
Definition: SystemBubble.h:65
float securityRating
uint8 m_activeRatSpawns
#define sBubbleMgr
bool DoSpawnForBubble(SystemBubble *pBubble)
Definition: SpawnMgr.cpp:344

Here is the call graph for this function:

Here is the caller graph for this function:

void SystemManager::DScan ( int64  range,
const GPoint pos,
std::vector< SystemEntity * > &  vector 
)
Todo:
finish this for correct dscan entity reporting all ships (not cloaked) all celestials all structures wrecks drones probes (core and combat only, i think) spheres and bubbles (ewar shit) some npcs ('normal' like rats dont show) clouds(groups 227 & 711) and asteroids are coded in client but not included here (yet) group 227 only shown if role_mod or role_gml

may not be in this version, but check for "scan inhibitor" POS module; ships in it are invis to dscan AttrDScanImmune is from rhea expansion. may be able to implement here.

Definition at line 1542 of file SystemManager.cpp.

References EVEDB::invGroups::CombatRecon, EVEDB::invGroups::CovertOps, Ga::GaVec3::distance(), IsAsteroidID, IsNPC, IsTempItem, m_entities, and sConfig.

Referenced by Scan::ConeScan().

1543 {
1559  for (auto cur : m_entities) {
1560  // these dont show on dscan
1561  if (IsTempItem(cur.first))
1562  continue;
1563  if (IsAsteroidID(cur.first))
1564  if (!sConfig.server.AsteroidsOnDScan)
1565  continue;
1566  if (IsNPC(cur.first))
1567  continue;
1568  if (cur.second->IsDeployableSE()) // not sure if this is right or not
1569  continue;
1570  if (cur.second->IsShipSE()) {
1571  if (cur.second->GetGroupID() == EVEDB::invGroups::CovertOps)
1572  continue;
1573  if (cur.second->GetGroupID() == EVEDB::invGroups::CombatRecon)
1574  continue;
1575  }
1576  if (cur.second->DestinyMgr() != nullptr)
1577  if (cur.second->DestinyMgr()->IsCloaked())
1578  continue;
1579  // made it this far. add item to scan list
1580  if (pos.distance(cur.second->GetPosition()) < range)
1581  vector.push_back(cur.second);
1582  }
1583 }
#define sConfig
A macro for easier access to the singleton.
#define IsAsteroidID(itemID)
Definition: EVE_Defines.h:259
#define IsTempItem(itemID)
Definition: EVE_Defines.h:333
std::map< uint32, SystemEntity * > m_entities
GaExpInl GaFloat distance(const GaVec3 &oth) const
Definition: GaTypes.h:158
#define IsNPC(itemID)
Definition: EVE_Defines.h:300

Here is the call graph for this function:

Here is the caller graph for this function:

void SystemManager::GetAllEntities ( std::vector< CosmicSignature > &  vector)
Todo:
this will need to put entity's sigID into anomaly map for Scan::WarpTo object
Todo:
this should be updated/current/correct in system's AnomalyMgr. try to get data from there for this list

Definition at line 1609 of file SystemManager.cpp.

References Dungeon::Type::Anomaly, Scanning::Group::Anomaly, EVEDB::invCategories::Asteroid, AttrScanAllStrength, AttrScanStrengthDronesProbes, AttrScanStrengthShips, AttrScanStrengthSignatures, AttrScanStrengthStructures, EVEDB::invCategories::Celestial, EVEDB::invCategories::Charge, EVEDB::invTypes::CosmicSignature, EVEDB::invCategories::Deployable, EVEDB::invCategories::Drone, Scanning::Group::DroneOrProbe, CosmicSignature::dungeonType, EVEDB::invCategories::Entity, m_data, m_ticEntities, EVEDB::invCategories::Orbitals, CosmicSignature::ownerID, CosmicSignature::position, CosmicSignature::scanAttributeID, CosmicSignature::scanGroupID, sEntityList, EVEDB::invCategories::Ship, Scanning::Group::Ship, CosmicSignature::sigGroupID, CosmicSignature::sigID, CosmicSignature::sigItemID, CosmicSignature::sigName, Scanning::Group::Signature, CosmicSignature::sigStrength, CosmicSignature::sigTypeID, EVEDB::invCategories::SovereigntyStructure, Scanning::Group::Structure, EVEDB::invCategories::Structure, EVEDB::invCategories::StructureUpgrade, CosmicSignature::systemID, and SystemData::systemID.

Referenced by Scan::ShipScanResult().

1610 {
1613  for (auto cur : m_ticEntities) {
1616  sig.ownerID = cur.second->GetOwnerID();
1617  sig.sigID = sEntityList.GetAnomalyID(); // result.id
1618  sig.sigItemID = cur.first;
1619  sig.sigStrength = 0.9f; // these arent warpable yet
1620  sig.systemID = m_data.systemID;
1621  sig.position = cur.second->GetPosition();
1622  sig.sigGroupID = cur.second->GetGroupID(); // result.groupID
1623  sig.sigTypeID = cur.second->GetTypeID(); // result.typeID
1624  // if scanGroupID is anom or sig, use scanAttributeID to determine site type (in client code)
1625  // scanGroupID must be one of the 5 groups coded in client (sig, anom, ship, drone, structure)
1626  // scanGroupID of sig and anom are cached on client side
1627  switch (cur.second->GetCategoryID()) {
1629  case EVEDB::invCategories::Charge: { // probes, missiles (at time of scan), and ??
1630  sig.scanAttributeID = AttrScanStrengthDronesProbes; // result.strengthAttributeID
1632  } break;
1637  sig.scanAttributeID = AttrScanStrengthStructures; // result.strengthAttributeID
1639  } break;
1641  sig.scanAttributeID = AttrScanStrengthShips; // result.strengthAttributeID
1643  } break;
1645  sig.scanAttributeID = AttrScanStrengthSignatures; // result.strengthAttributeID
1646  sig.scanGroupID = Scanning::Group::Signature; // Scrap(1) is for filter only
1647  sig.sigName = cur.second->GetName(); // result.DungeonName - only used when scanGroupID is sig or anom
1648  } break;
1651  case EVEDB::invCategories::Deployable: // mobile warp disruptor
1652  default: {
1653  sig.scanAttributeID = AttrScanAllStrength; // result.strengthAttributeID (Unknown)
1654  sig.scanGroupID = Scanning::Group::Anomaly; // Celestial(64) is only for filter
1655  sig.sigName = cur.second->GetName(); // result.DungeonName - only used when scanGroupID is sig or anom
1656  } break;
1657  }
1658  vector.push_back(sig);
1659  }
1660 }
std::string sigID
#define sEntityList
Definition: EntityList.h:208
std::string sigName
SystemData m_data
std::map< uint32, SystemEntity * > m_ticEntities
uint32 systemID

Here is the caller graph for this function:

AnomalyMgr* SystemManager::GetAnomMgr ( )
inline

Definition at line 111 of file SystemManager.h.

References m_anomMgr.

Referenced by Command_siglist(), Scan::GetProbeDataForSig(), Scan::ProbeScanResult(), and Scan::ShipScanResult().

111 { return m_anomMgr; }
AnomalyMgr * m_anomMgr

Here is the caller graph for this function:

BeltMgr* SystemManager::GetBeltMgr ( )
inline

Definition at line 109 of file SystemManager.h.

References m_beltMgr.

Referenced by SystemBubble::Add(), MiningLaser::CanActivate(), Command_beltlist(), DungeonMgr::Create(), ActiveModule::DeactivateCycle(), AsteroidSE::Process(), and SystemBubble::SetBelt().

109 { return m_beltMgr; }
BeltMgr * m_beltMgr

Here is the caller graph for this function:

void SystemManager::GetClientList ( std::vector< Client * > &  cVec)

Definition at line 1536 of file SystemManager.cpp.

References m_clients.

Referenced by EntityList::Multicast(), and DestinyManager::SendDestinyUpdate().

1537 {
1538  for (auto cur : m_clients)
1539  cVec.push_back(cur.second);
1540 }
std::map< uint32, Client * > m_clients

Here is the caller graph for this function:

SystemEntity * SystemManager::GetClosestGateSE ( const GPoint myPos)

Definition at line 1514 of file SystemManager.cpp.

References Ga::GaVec3::distance(), and m_gateMap.

Referenced by StructureSE::InitData().

1515 {
1516  std::map<double, SystemEntity*> sorted;
1517  for (auto cur : m_gateMap)
1518  sorted.insert(std::pair<double, SystemEntity*>(myPos.distance(cur.second->GetPosition()), cur.second));
1519 
1520  std::map<double, SystemEntity*>::iterator itr = sorted.begin();
1521 
1522  return itr->second;
1523 }
std::map< uint32, SystemEntity * > m_gateMap
GaExpInl GaFloat distance(const GaVec3 &oth) const
Definition: GaTypes.h:158

Here is the call graph for this function:

Here is the caller graph for this function:

SystemEntity * SystemManager::GetClosestMoonSE ( const GPoint myPos)

Definition at line 1525 of file SystemManager.cpp.

References Ga::GaVec3::distance(), and m_moonMap.

Referenced by Command_getposition(), and StructureSE::InitData().

1526 {
1527  std::map<double, SystemEntity*> sorted;
1528  for (auto cur : m_moonMap)
1529  sorted.insert(std::pair<double, SystemEntity*>(myPos.distance(cur.second->GetPosition()), cur.second));
1530 
1531  std::map<double, SystemEntity*>::iterator itr = sorted.begin();
1532 
1533  return itr->second;
1534 }
GaExpInl GaFloat distance(const GaVec3 &oth) const
Definition: GaTypes.h:158
std::map< uint32, SystemEntity * > m_moonMap

Here is the call graph for this function:

Here is the caller graph for this function:

uint32 SystemManager::GetClosestPlanetID ( const GPoint myPos)

Definition at line 1492 of file SystemManager.cpp.

References Ga::GaVec3::distance(), and m_planetMap.

1493 {
1494  std::map<double, SystemEntity*> sorted;
1495  for (auto cur : m_planetMap)
1496  sorted.insert(std::pair<double, SystemEntity*>(myPos.distance(cur.second->GetPosition()), cur.second));
1497 
1498  std::map<double, SystemEntity*>::iterator itr = sorted.begin();
1499 
1500  return itr->second->GetID();
1501 }
std::map< uint32, SystemEntity * > m_planetMap
GaExpInl GaFloat distance(const GaVec3 &oth) const
Definition: GaTypes.h:158

Here is the call graph for this function:

SystemEntity * SystemManager::GetClosestPlanetSE ( const GPoint myPos)

Definition at line 1503 of file SystemManager.cpp.

References Ga::GaVec3::distance(), and m_planetMap.

1504 {
1505  std::map<double, SystemEntity*> sorted;
1506  for (auto cur : m_planetMap)
1507  sorted.insert(std::pair<double, SystemEntity*>(myPos.distance(cur.second->GetPosition()), cur.second));
1508 
1509  std::map<double, SystemEntity*>::iterator itr = sorted.begin();
1510 
1511  return itr->second;
1512 }
std::map< uint32, SystemEntity * > m_planetMap
GaExpInl GaFloat distance(const GaVec3 &oth) const
Definition: GaTypes.h:158

Here is the call graph for this function:

uint32 SystemManager::GetConstellationID ( )
inline

Definition at line 82 of file SystemManager.h.

References m_data, and SystemData::regionID.

Referenced by TCUSE::SetOnline().

82 { return m_data.regionID; }
SystemData m_data
uint32 regionID

Here is the caller graph for this function:

CargoContainerRef SystemManager::GetContainerFromInventory ( uint32  contID)

Definition at line 1474 of file SystemManager.cpp.

References Inventory::GetByID(), InventoryItem::GetMyInventory(), m_solarSystemRef, and RefPtr< X >::StaticCast().

Referenced by TradeService::TransferContainerContents().

1475 {
1477 }
static RefPtr StaticCast(const RefPtr< Y > &oth)
Acts as static_cast from one RefPtr to another.
Definition: RefPtr.h:238
SolarSystemRef m_solarSystemRef
Inventory * GetMyInventory()
Definition: InventoryItem.h:91
InventoryItemRef GetByID(uint32 id) const
Definition: Inventory.cpp:415

Here is the call graph for this function:

Here is the caller graph for this function:

PyRep * SystemManager::GetCurrentEntities ( )

Definition at line 1585 of file SystemManager.cpp.

References PyList::AddItem(), m_ticEntities, sDataMgr, and PyDict::SetItemString().

1586 {
1587  /* return list of dict
1588  * itemID, typeID, catID, name, pos[x,y,z]
1589  *
1590  * already have statics, so add players, empty ships, pos', npcs, drones (anything that requires a tic)
1591  */
1592 
1593  PyList* list = new PyList();
1594  for (auto cur : m_ticEntities) {
1595  PyDict* dict = new PyDict();
1596  dict->SetItemString("itemID", new PyInt(cur.first));
1597  dict->SetItemString("ownerName", new PyString(sDataMgr.GetOwnerName(cur.second->GetOwnerID())));
1598  dict->SetItemString("typeID", new PyInt(cur.second->GetTypeID()));
1599  dict->SetItemString("catID", new PyInt(cur.second->GetCategoryID()));
1600  dict->SetItemString("name", new PyString(cur.second->GetName()));
1601  dict->SetItemString("x", new PyLong(cur.second->x()));
1602  dict->SetItemString("y", new PyLong(cur.second->y()));
1603  dict->SetItemString("z", new PyLong(cur.second->z()));
1604  list->AddItem(dict);
1605  }
1606  return list;
1607 }
Python string.
Definition: PyRep.h:430
Python's dictionary.
Definition: PyRep.h:719
void AddItem(PyRep *i)
Definition: PyRep.h:701
std::map< uint32, SystemEntity * > m_ticEntities
Python integer.
Definition: PyRep.h:231
Python list.
Definition: PyRep.h:639
void SetItemString(const char *key, PyRep *value)
SetItemString adds or sets a database entry.
Definition: PyRep.h:812
Python long integer.
Definition: PyRep.h:261
#define sDataMgr

Here is the call graph for this function:

void SystemManager::GetDockedCount ( )
protected

Definition at line 1721 of file SystemManager.cpp.

References m_clients, and m_docked.

Referenced by SetDockCount().

1722 {
1723  m_docked = 0;
1724  for (auto cur : m_clients)
1725  if (cur.second->IsDocked())
1726  ++m_docked;
1727 }
std::map< uint32, Client * > m_clients

Here is the caller graph for this function:

DungeonMgr* SystemManager::GetDungMgr ( )
inline

Definition at line 112 of file SystemManager.h.

References m_dungMgr.

112 { return m_dungMgr; }
DungeonMgr * m_dungMgr
std::map< uint32, SystemEntity* > SystemManager::GetEntities ( )
inline

Definition at line 158 of file SystemManager.h.

References m_entities.

Referenced by Command_list().

158 { return m_entities; }
std::map< uint32, SystemEntity * > m_entities

Here is the caller graph for this function:

std::map<uint32, SystemEntity*> SystemManager::GetGates ( )
inline

Definition at line 154 of file SystemManager.h.

References m_gateMap.

Referenced by SBUSE::GetGates().

154 { return m_gateMap; }
std::map< uint32, SystemEntity * > m_gateMap

Here is the caller graph for this function:

uint32 SystemManager::GetID ( ) const
inline

Definition at line 80 of file SystemManager.h.

References m_data, and SystemData::systemID.

Referenced by BubbleManager::Add(), AnomalyMgr::AddSignal(), Client::Board(), Client::BoardShip(), AnomalyMgr::Close(), Command_list(), Command_siglist(), DungeonMgr::Create(), AnomalyMgr::CreateAnomaly(), Colony::CreateCommandPin(), PlanetSE::CreateCustomsOffice(), CynoModule::CreateCyno(), WormholeMgr::CreateExit(), TowerSE::CreateForceField(), Client::DockToStation(), BubbleManager::FindBubble(), SystemGPoint::GetAnomalyPoint(), BubbleManager::GetBubble(), FleetService::GetFleetClientsInSystem(), FleetService::GetFleetMembersInSystem(), PlanetSE::GetPlanetInfo(), SpawnMgr::Init(), AnomalyMgr::Init(), BeltMgr::Init(), DungeonMgr::Init(), StructureSE::InitData(), CustomsSE::Killed(), DroneSE::Killed(), StructureSE::Killed(), ShipSE::Killed(), DungeonMgr::Load(), BubbleManager::MakeBubble(), WormholeSE::MakeSlimItem(), SpawnMgr::MakeSpawn(), Client::MoveToLocation(), SpawnMgr::Process(), SystemBubble::ProcessWander(), SpawnMgr::ReSpawn(), CynoModule::SendOnJumpBeaconChange(), Client::SetDestiny(), SBUSE::SetOffline(), TCUSE::SetOffline(), SBUSE::SetOnline(), TCUSE::SetOnline(), Scan::ShipScanResult(), SpawnMgr::StartRatGroupTimer(), SpawnMgr::StartRatTimer(), and SystemBubble::SystemBubble().

80 { return m_data.systemID; }
SystemData m_data
uint32 systemID

Here is the caller graph for this function:

const std::string& SystemManager::GetNameStr ( ) const
inline

Definition at line 83 of file SystemManager.h.

References m_data, and SystemData::name.

Referenced by SystemEntity::AwardSecurityStatus().

83 { return m_data.name; }
std::string name
SystemData m_data

Here is the caller graph for this function:

NPC * SystemManager::GetNPCSE ( uint32  entityID) const

Definition at line 1461 of file SystemManager.cpp.

References m_npcs.

Referenced by SpawnMgr::WarpOutSpawn().

1462 {
1463  std::map<uint32, NPC*>::const_iterator itr = m_npcs.find(entityID);
1464  if (itr == m_npcs.end())
1465  return nullptr;
1466  return itr->second;
1467 }
std::map< uint32, NPC * > m_npcs

Here is the caller graph for this function:

std::map<uint32, SystemEntity*> SystemManager::GetOperationalStatics ( )
inline

Definition at line 153 of file SystemManager.h.

References m_opStaticEntities.

Referenced by SBUSE::GetSBUs(), SafeToUnload(), SBUSE::SetOffline(), and SBUSE::SetOnline().

153 { return m_opStaticEntities; }
std::map< uint32, SystemEntity * > m_opStaticEntities

Here is the caller graph for this function:

SystemEntity * SystemManager::GetPlanet ( uint32  planetID)

Definition at line 1484 of file SystemManager.cpp.

References m_planetMap.

Referenced by CustomsSE::CustomsSE().

1485 {
1486  std::map<uint32, SystemEntity*>::iterator itr = m_planetMap.find(planetID);
1487  if (itr != m_planetMap.end())
1488  return itr->second;
1489  return nullptr;
1490 }
std::map< uint32, SystemEntity * > m_planetMap

Here is the caller graph for this function:

void SystemManager::GetPlayerCount ( )
protected

Definition at line 1729 of file SystemManager.cpp.

Referenced by SetDockCount().

1730 {
1731 
1732 }

Here is the caller graph for this function:

uint32 SystemManager::GetRandBeltID ( )

Definition at line 1283 of file SystemManager.cpp.

References m_beltCount, m_beltVector, and MakeRandomInt().

Referenced by NPCAIMgr::WarpOut().

1284 {
1285  return m_beltVector.at(MakeRandomInt(0, m_beltCount));
1286 }
std::vector< uint32 > m_beltVector
int64 MakeRandomInt(int64 low, int64 high)
Generates random integer from interval [low; high].
Definition: misc.cpp:109

Here is the call graph for this function:

Here is the caller graph for this function:

uint8 SystemManager::GetRatSpawnCount ( )
inline

Definition at line 103 of file SystemManager.h.

References m_activeRatSpawns.

Referenced by Command_list().

103 { return m_activeRatSpawns; }
uint8 m_activeRatSpawns

Here is the caller graph for this function:

uint32 SystemManager::GetRegionID ( )
inline

Definition at line 81 of file SystemManager.h.

References m_data, and SystemData::regionID.

Referenced by AnomalyMgr::CreateAnomaly(), DungeonMgr::GetFaction(), DungeonMgr::MakeDungeon(), SpawnMgr::PrepSpawn(), and TCUSE::SetOnline().

81 { return m_data.regionID; }
SystemData m_data
uint32 regionID

Here is the caller graph for this function:

uint16 SystemManager::GetRoidSpawnCount ( )
inline

Definition at line 104 of file SystemManager.h.

References m_activeRoidSpawns.

Referenced by Command_list().

104 { return m_activeRoidSpawns; }
uint16 m_activeRoidSpawns

Here is the caller graph for this function:

SystemEntity * SystemManager::GetSE ( uint32  entityID) const

Definition at line 1454 of file SystemManager.cpp.

References m_entities.

Referenced by ShipSE::AbandonDrones(), ActiveModule::Activate(), ModuleManager::Activate(), DestinyManager::AttemptDockOperation(), DynamicEntityFactory::BuildEntity(), Command_kill(), Command_unspawn(), BeltMgr::Create(), PlanetMgrService::CreateBoundObject(), DestinyManager::DockingAccepted(), SystemGPoint::GetAnomalyPoint(), StructureSE::Init(), DestinyManager::IsTargetInvalid(), ObjectSystemEntity::Killed(), NPCAIMgr::SetWander(), BeltMgr::SpawnBelt(), and NPCAIMgr::WarpOut().

1454  {
1455  std::map<uint32, SystemEntity*>::const_iterator itr = m_entities.find(entityID);
1456  if (itr == m_entities.end())
1457  return nullptr;
1458  return itr->second;
1459 }
std::map< uint32, SystemEntity * > m_entities

Here is the caller graph for this function:

float SystemManager::GetSecValue ( )
inline

Definition at line 115 of file SystemManager.h.

References m_secValue.

Referenced by DungeonMgr::AddDecoToVector(), CynoModule::CanActivate(), AnomalyMgr::Init(), SpawnMgr::PrepSpawn(), JumpBridgeSE::SetOnline(), BeltMgr::SpawnBelt(), and Agent::UpdateStandings().

115 { return m_secValue; }

Here is the caller graph for this function:

ShipItemRef SystemManager::GetShipFromInventory ( uint32  shipID)

Definition at line 1469 of file SystemManager.cpp.

References Inventory::GetByID(), InventoryItem::GetMyInventory(), m_solarSystemRef, and RefPtr< ShipItem >::StaticCast().

Referenced by TradeService::TransferContainerContents().

1470 {
1472 }
static RefPtr StaticCast(const RefPtr< Y > &oth)
Acts as static_cast from one RefPtr to another.
Definition: RefPtr.h:238
SolarSystemRef m_solarSystemRef
Inventory * GetMyInventory()
Definition: InventoryItem.h:91
InventoryItemRef GetByID(uint32 id) const
Definition: Inventory.cpp:415

Here is the call graph for this function:

Here is the caller graph for this function:

void SystemManager::GetSpawnBubbles ( SpawnBubbleMap bubbleMap)

Definition at line 1261 of file SystemManager.cpp.

References _log, is_log_enabled, m_data, m_ratBubbles, SystemData::name, and SystemData::systemID.

1262 {
1263  if (is_log_enabled(SPAWN__MESSAGE))
1264  _log(SPAWN__MESSAGE, "SystemManager::GetSpawnBubbles() - called for %s(%u)", m_data.name.c_str(), m_data.systemID);
1265  SpawnBubbleMap::iterator itr = m_ratBubbles.begin();
1266  while (itr != m_ratBubbles.end())
1267  bubbleMap->emplace(itr->first, itr->second);
1268 }
#define _log(type, fmt,...)
Definition: logsys.h:124
std::string name
#define is_log_enabled(type)
Definition: logsys.h:78
SystemData m_data
SpawnBubbleMap m_ratBubbles
uint32 systemID
SpawnMgr* SystemManager::GetSpawnMgr ( )
inline

Definition at line 110 of file SystemManager.h.

References m_spawnMgr.

110 { return m_spawnMgr; }
SpawnMgr * m_spawnMgr
StationItemRef SystemManager::GetStationFromInventory ( uint32  stationID)

Definition at line 1479 of file SystemManager.cpp.

References Inventory::GetByID(), InventoryItem::GetMyInventory(), m_solarSystemRef, and RefPtr< StationItem >::StaticCast().

Referenced by Client::DockToStation(), Client::LoadStationHangar(), and Client::SelectCharacter().

1480 {
1482 }
static RefPtr StaticCast(const RefPtr< Y > &oth)
Acts as static_cast from one RefPtr to another.
Definition: RefPtr.h:238
SolarSystemRef m_solarSystemRef
Inventory * GetMyInventory()
Definition: InventoryItem.h:91
InventoryItemRef GetByID(uint32 id) const
Definition: Inventory.cpp:415

Here is the call graph for this function:

Here is the caller graph for this function:

uint32 SystemManager::GetSysNPCCount ( )
inline

Definition at line 106 of file SystemManager.h.

References m_npcs.

Referenced by Command_list().

106 { return m_npcs.size(); }
std::map< uint32, NPC * > m_npcs

Here is the caller graph for this function:

Inventory* SystemManager::GetSystemInv ( )
inline

Definition at line 89 of file SystemManager.h.

References InventoryItem::GetMyInventory(), and m_solarSystemRef.

89 { return m_solarSystemRef->GetMyInventory(); }
SolarSystemRef m_solarSystemRef
Inventory * GetMyInventory()
Definition: InventoryItem.h:91

Here is the call graph for this function:

SolarSystemRef SystemManager::GetSystemRef ( )
inline

Definition at line 90 of file SystemManager.h.

References m_solarSystemRef.

90 { return m_solarSystemRef; }
SolarSystemRef m_solarSystemRef
const char* SystemManager::GetSystemSecurityClass ( )
inline

Definition at line 85 of file SystemManager.h.

References m_data, and SystemData::securityClass.

Referenced by BeltMgr::SpawnBelt().

85 { return m_data.securityClass.c_str(); }
SystemData m_data
std::string securityClass

Here is the caller graph for this function:

void SystemManager::IncGateSpawnCount ( )
inline

Definition at line 98 of file SystemManager.h.

References m_activeGateSpawns.

Referenced by SpawnMgr::DoSpawnForBubble().

98 { ++m_activeGateSpawns; }
uint8 m_activeGateSpawns

Here is the caller graph for this function:

void SystemManager::IncRatSpawnCount ( )
inline

Definition at line 96 of file SystemManager.h.

References m_activeRatSpawns.

Referenced by SpawnMgr::DoSpawnForBubble().

96 { ++m_activeRatSpawns; }
uint8 m_activeRatSpawns

Here is the caller graph for this function:

void SystemManager::IncRoidSpawnCount ( )
inline

Definition at line 100 of file SystemManager.h.

References m_activeRoidSpawns.

100 { ++m_activeRoidSpawns; }
uint16 m_activeRoidSpawns
bool SystemManager::IsLoaded ( )
inline
bool SystemManager::IsNull ( std::map< uint32, SystemEntity * >::iterator &  i)
private

Definition at line 1751 of file SystemManager.cpp.

1752 {
1753  /* you have to change this parameter to the type of the container
1754  * you are using and the type of the element inside the container.
1755  * if this finds use again, it should be changed to a template.
1756  */
1757 
1758  uint8 buffer[sizeof(i)];
1759  memset(buffer, 0, sizeof(i));
1760  memcpy(buffer, &i, sizeof(i));
1761  return *buffer == 0;
1762  /* I found that the size of any iterator is 12 bytes long.
1763  * I also found that if the first byte of the iterator that
1764  * is copy to the buffer is zero, then the iterator is invalid.
1765  * Otherwise it is valid. I like to call invalid iterators also as "null iterators".
1766  */
1767 }
unsigned __int8 uint8
Definition: eve-compat.h:46
bool SystemManager::LoadCosmicMgrs ( )
protected

Definition at line 197 of file SystemManager.cpp.

References _log, SpawnMgr::Init(), AnomalyMgr::Init(), BeltMgr::Init(), DungeonMgr::Init(), m_anomMgr, m_beltCount, m_beltMgr, m_data, m_dungMgr, m_spawnMgr, SystemData::regionID, and SystemData::systemID.

Referenced by BootSystem().

198 {
199  if (!m_spawnMgr->Init()) {
200  _log(SERVICE__ERROR, "Unable to load Spawn Manager during boot of system %u.", m_data.systemID);
201  return false;
202  }
203 
205  _log(SERVICE__ERROR, "Unable to load Dungeon Manager during boot of system %u.", m_data.systemID);
206  return false;
207  }
208 
209  if (m_beltCount)
210  m_beltMgr->Init(m_data.regionID); //nothing to check for in this init.
211 
213  _log(SERVICE__ERROR, "Unable to load Anomaly Manager during boot of system %u.", m_data.systemID);
214  return false;
215  }
216 
217  return true;
218 }
bool Init(AnomalyMgr *anomMgr, SpawnMgr *spawnMgr)
Definition: DungeonMgr.cpp:182
bool Init(BeltMgr *beltMgr, DungeonMgr *dungMgr, SpawnMgr *spawnMgr)
Definition: AnomalyMgr.cpp:78
#define _log(type, fmt,...)
Definition: logsys.h:124
void Init(uint32 regionID)
Definition: BeltMgr.cpp:36
DungeonMgr * m_dungMgr
bool Init()
Definition: SpawnMgr.cpp:62
SystemData m_data
SpawnMgr * m_spawnMgr
BeltMgr * m_beltMgr
uint32 systemID
uint32 regionID
AnomalyMgr * m_anomMgr

Here is the call graph for this function:

Here is the caller graph for this function:

bool SystemManager::LoadPlayerDynamics ( )
protected

Definition at line 493 of file SystemManager.cpp.

References _log, AddEntity(), DynamicEntityFactory::BuildEntity(), SystemEntity::GetPosition(), SystemGPoint::GetRandPointOnMoon(), Ga::GaVec3::isZero(), SystemDB::LoadPlayerDynamicEntities(), m_data, mGP, SystemData::name, SystemEntity::SetPosition(), sLog, and SystemData::systemID.

Referenced by BootSystem().

493  {
494  std::vector<DBSystemDynamicEntity> entities;
495  entities.clear();
497  sLog.Error( "SystemManager::LoadPlayerDynamics()", "Unable to load player dynamic entities in %s(%u).", m_data.name.c_str(), m_data.systemID);
498  return false;
499  }
500 
501  SystemEntity* pSE(nullptr);
502  for (auto cur : entities) {
503  pSE = DynamicEntityFactory::BuildEntity(*this, cur);
504  if (pSE == nullptr) {
505  sLog.Error( "SystemManager::LoadPlayerDynamics()", "Failed to create entity for item %u (grp: %u, type %u)", cur.itemID, cur.groupID, cur.typeID);
506  continue;
507  }
508  _log(ITEM__TRACE, "SystemManager::LoadPlayerDynamics() - Loaded dynamic entity %u of type %u for %s(%u)", \
509  cur.itemID, cur.typeID, m_data.name.c_str(),m_data.systemID);
510  if (pSE->GetPosition().isZero())
511  pSE->SetPosition(mGP.GetRandPointOnMoon(m_data.systemID));
512  //pSE->SetPosition(mGP.GetRandPointOnPlanet(m_data.systemID));
513  AddEntity(pSE);
514  }
515  _log(SERVER__INIT, "SystemManager::LoadPlayerDynamics() - %u Dynamic Player entities loaded for %s(%u)", \
516  entities.size(), m_data.name.c_str(),m_data.systemID);
517 
518  return true;
519 }
void AddEntity(SystemEntity *pSE, bool addSignal=true)
#define _log(type, fmt,...)
Definition: logsys.h:124
const GPoint GetRandPointOnMoon(uint32 systemID)
std::string name
SystemGPoint mGP
static bool LoadPlayerDynamicEntities(uint32 systemID, std::vector< DBSystemDynamicEntity > &into)
Definition: SystemDB.cpp:208
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
SystemData m_data
static SystemEntity * BuildEntity(SystemManager &pSysMgr, const DBSystemDynamicEntity &entity)
uint32 systemID

Here is the call graph for this function:

Here is the caller graph for this function:

bool SystemManager::LoadSystemDynamics ( )
protected

Definition at line 465 of file SystemManager.cpp.

References _log, AddEntity(), DynamicEntityFactory::BuildEntity(), SystemEntity::GetPosition(), SystemGPoint::GetRandPointOnPlanet(), Ga::GaVec3::isZero(), SystemDB::LoadSystemDynamicEntities(), m_data, mGP, SystemData::name, SystemEntity::SetPosition(), sLog, and SystemData::systemID.

Referenced by BootSystem().

465  {
466  std::vector<DBSystemDynamicEntity> entities;
467  entities.clear();
469  sLog.Error( "SystemManager::LoadSystemDynamics()", "Unable to load dynamic entities during boot of %s(%u).", m_data.name.c_str(), m_data.systemID);
470  return false;
471  }
472 
473  SystemEntity* pSE(nullptr);
474  for (auto cur : entities) {
475  pSE = DynamicEntityFactory::BuildEntity(*this, cur);
476  if (pSE == nullptr) {
477  sLog.Error( "SystemManager::LoadSystemDynamics()", "Failed to create entity for item %u (grp: %u, type %u)",
478  cur.itemID, cur.groupID, cur.typeID);
479  continue;
480  }
481  _log(ITEM__TRACE, "SystemManager::LoadSystemDynamics() - Loaded dynamic entity %u of type %u for %s(%u)", \
482  cur.itemID, cur.typeID, m_data.name.c_str(), m_data.systemID);
483  if (pSE->GetPosition().isZero())
484  pSE->SetPosition(mGP.GetRandPointOnPlanet(m_data.systemID));
485  //pSE->SetPosition(mGP.GetRandPointOnMoon(m_data.systemID));
486  AddEntity(pSE);
487  }
488  _log(SERVER__INIT, "SystemManager::LoadSystemDynamics - %u Dynamic System entities loaded for %s(%u)", entities.size(), m_data.name.c_str(),m_data.systemID);
489 
490  return true;
491 }
void AddEntity(SystemEntity *pSE, bool addSignal=true)
static bool LoadSystemDynamicEntities(uint32 systemID, std::vector< DBSystemDynamicEntity > &into)
Definition: SystemDB.cpp:137
#define _log(type, fmt,...)
Definition: logsys.h:124
std::string name
SystemGPoint mGP
const GPoint GetRandPointOnPlanet(uint32 systemID)
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
SystemData m_data
static SystemEntity * BuildEntity(SystemManager &pSysMgr, const DBSystemDynamicEntity &entity)
uint32 systemID

Here is the call graph for this function:

Here is the caller graph for this function:

bool SystemManager::LoadSystemStatics ( )
protected
Todo:
(Allan) outposts are group::station - may need to hack this

Definition at line 380 of file SystemManager.cpp.

References _log, AddItemToInventory(), EVEDB::invGroups::Asteroid_Belt, AttrRadius, SystemEntity::GetSelf(), GetServiceMgr(), SystemEntity::IsBeltSE(), SystemEntity::IsGateSE(), SystemEntity::IsStationSE(), SystemEntity::LoadExtras(), SystemDB::LoadSystemStaticEntities(), m_beltCount, m_beltMgr, m_beltVector, m_data, m_entities, m_gateCount, m_gateMap, m_moonMap, m_planetMap, m_staticEntities, EVEDB::invGroups::Moon, SystemData::name, EVEDB::invGroups::Planet, sBubbleMgr, sEntityList, BeltSE::SetBeltMgr(), sItemFactory, sLog, EVEDB::invGroups::Stargate, EVEDB::invGroups::Station, EVEDB::invGroups::Sun, and SystemData::systemID.

Referenced by BootSystem().

380  {
381  std::vector<DBSystemEntity> entities;
382  entities.clear();
383  m_entities.clear();
384  m_staticEntities.clear();
386  sLog.Error( "SystemManager::LoadSystemStatics()", "Unable to load celestial entities during boot of %s(%u).", m_data.name.c_str(), m_data.systemID);
387  return false;
388  }
389 
390  SystemEntity* pSE(nullptr);
391  for (auto cur : entities) {
392  switch (cur.groupID) {
395  /* types 12242 - 22298 in group 15 are outposts */
396  /* types 29323 - 29390 in group 15 are wrecked stations */
397  StationItemRef itemRef = sItemFactory.GetStationItem(cur.itemID);
398  StationSE *pSSE = new StationSE(itemRef, *(GetServiceMgr()), this);
399  sEntityList.AddStation(cur.itemID, itemRef);
400  pSE = pSSE;
401  } break;
403  CelestialObjectRef itemRef = sItemFactory.GetCelestialObject(cur.itemID);
404  BeltSE *pBSE = new BeltSE(itemRef, *(GetServiceMgr()), this);
405  pBSE->SetBeltMgr(m_beltMgr);
406  ++m_beltCount;
407  pSE = pBSE;
408  } break;
410  CelestialObjectRef itemRef = sItemFactory.GetCelestialObject(cur.itemID);
411  itemRef->SetAttribute(AttrRadius, cur.radius, false);
412  StargateSE *pSSE = new StargateSE(itemRef, *(GetServiceMgr()), this);
413  m_gateMap.insert(std::pair<uint32, SystemEntity*>(cur.itemID, pSSE));
414  ++m_gateCount;
415  pSE = pSSE;
416  } break;
418  CelestialObjectRef itemRef = sItemFactory.GetCelestialObject(cur.itemID);
419  itemRef->SetAttribute(AttrRadius, cur.radius, false);
420  PlanetSE *pPSE = new PlanetSE(itemRef, *(GetServiceMgr()), this);
421  m_planetMap.insert(std::pair<uint32, SystemEntity*>(cur.itemID, pPSE));
422  pSE = pPSE;
423  } break;
424  case EVEDB::invGroups::Moon: {
425  CelestialObjectRef itemRef = sItemFactory.GetCelestialObject(cur.itemID);
426  itemRef->SetAttribute(AttrRadius, cur.radius, false);
427  MoonSE *pMSE = new MoonSE(itemRef, *(GetServiceMgr()), this);
428  m_moonMap.insert(std::pair<uint32, SystemEntity*>(cur.itemID, pMSE));
429  pSE = pMSE;
430  } break;
431  case EVEDB::invGroups::Sun: { // suns dont have anything special, so they are generic SSEs
432  CelestialObjectRef itemRef = sItemFactory.GetCelestialObject(cur.itemID);
433  itemRef->SetAttribute(AttrRadius, cur.radius, false);
434  StaticSystemEntity *pSSE = new StaticSystemEntity(itemRef, *(GetServiceMgr()), this);
435  pSE = pSSE;
436  } break;
437  default: {
438  sLog.Error( "SystemManager::LoadSystemStatics()", "create static entity called for unhandled item %u (grp: %u, type %u)", cur.itemID, cur.groupID, cur.typeID);
439  continue;
440  }
441  }
442  if (pSE == nullptr) {
443  sLog.Error( "SystemManager::LoadSystemStatics()", "Failed to create entity for item %u (grp: %u, type %u)", cur.itemID, cur.groupID, cur.typeID);
444  continue;
445  }
446  if (pSE->IsGateSE() or pSE->IsStationSE())
447  sBubbleMgr.Add(pSE);
448  if (pSE->IsBeltSE()) {
449  sBubbleMgr.Add(pSE);
450  m_beltVector.push_back(cur.itemID);
451  }
452  if (!pSE->LoadExtras())
453  _log(INV__WARNING, "SystemManager::LoadSystemStatics() - Failed to load additional data for entity %u. Continuing.", cur.itemID);
454 
455  m_entities[cur.itemID] = pSE;
456  m_staticEntities[cur.itemID] = pSE;
457  AddItemToInventory(pSE->GetSelf());
458  }
459 
460  _log(SERVER__INIT, "SystemManager::LoadSystemStatics() - %u Static System entities loaded for %s (%u)", entities.size(), m_data.name.c_str(), m_data.systemID);
461  entities.clear();
462  return true;
463 }
#define _log(type, fmt,...)
Definition: logsys.h:124
std::string name
std::map< uint32, SystemEntity * > m_gateMap
#define sEntityList
Definition: EntityList.h:208
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
SystemData m_data
std::map< uint32, SystemEntity * > m_planetMap
void SetBeltMgr(BeltMgr *beltMgr)
Definition: SystemEntity.h:333
std::vector< uint32 > m_beltVector
BeltMgr * m_beltMgr
uint32 systemID
PyServiceMgr * GetServiceMgr()
Definition: SystemManager.h:88
void AddItemToInventory(InventoryItemRef item)
static bool LoadSystemStaticEntities(uint32 systemID, std::vector< DBSystemEntity > &into)
Definition: SystemDB.cpp:110
Definition: Moon.h:28
#define sItemFactory
Definition: ItemFactory.h:165
std::map< uint32, SystemEntity * > m_entities
#define sBubbleMgr
std::map< uint32, SystemEntity * > m_staticEntities
std::map< uint32, SystemEntity * > m_moonMap

Here is the call graph for this function:

Here is the caller graph for this function:

void SystemManager::MakeSetState ( const SystemBubble pBubble,
SetState into 
) const
Todo:
(allan) this needs more work. should be done same as damageState. 28.2.16 ss.aggressors is for players undocking/jumping with aggression (uses GetCriminalTimeStamps) ** see notes in Client::GetAggressors() if (cur.second->HasPilot() and cur.second->HasAggression()) ss.aggressors[ cur.first ] = cur.second->GetAggressors());
Todo:
(allan) to be written -jumpbridges is a PyList

Definition at line 1288 of file SystemManager.cpp.

References _log, Buffer::Append(), SystemData::constellationID, Destiny::DumpUpdate(), SystemBubble::GetDroneState(), SystemBubble::GetEntities(), is_log_enabled, m_data, m_opStaticEntities, m_staticEntities, m_ticEntities, SystemData::name, Destiny::AddBall_header::packet_type, PyStatic, sDataMgr, PyPackedRow::SetField(), Destiny::AddBall_header::stamp, and SystemData::systemID.

Referenced by DestinyManager::SendSetState().

1288  {
1289  using namespace Destiny;
1290  Buffer* stateBuffer(new Buffer());
1291 
1292  AddBall_header head = AddBall_header();
1293  head.packet_type = 0; // 0 = full state 1 = balls
1294  head.stamp = into.stamp;
1295  stateBuffer->Append( head );
1296 
1297  std::map<uint32, SystemEntity*> visibleEntities;
1298 
1299  // get all static entities for this system
1300  for (auto cur : m_staticEntities)
1301  visibleEntities.emplace(cur.first, cur.second);
1302 
1303  // get all operational static entities and add to visibleEntities map
1304  for (auto cur : m_opStaticEntities)
1305  visibleEntities.emplace(cur.first, cur.second);
1306 
1307  // get our ship. bubble->GetEntities() does not include cloaked items
1308  std::map<uint32, SystemEntity*>::const_iterator itr = m_ticEntities.find(into.ego);
1309  if (itr != m_ticEntities.end())
1310  visibleEntities.emplace(itr->first, itr->second);
1311 
1312  // query bubble to get dynamic entities
1313  pBubble->GetEntities(visibleEntities);
1314 
1315  into.slims = new PyList();
1316  into.slims->clear();
1317  into.effectStates = new PyList();
1318  into.effectStates->clear();
1319  into.allianceBridges = new PyList();
1320  into.allianceBridges->clear(); //activeBeacon and activeBridge data found in fleetSvc.py
1321 
1322  //go through all visible entities and gather the info we need...
1323  for (auto cur : visibleEntities) {
1324  if (!cur.second->IsMissileSE() or !cur.second->IsFieldSE())
1325  into.damageState[ cur.first ] = cur.second->MakeDamageState();
1326 
1327  into.slims->AddItem( new PyObject( "foo.SlimItem", cur.second->MakeSlimItem()));
1328 
1329  //append the destiny binary data...
1330  cur.second->EncodeDestiny( *stateBuffer );
1331 
1332  // get tower effect state (if applicable)
1333  if (cur.second->IsTowerSE())
1334  cur.second->GetTowerSE()->GetEffectState(*(into.effectStates));
1335 
1343  // if (cur.second->IsJumpBridgeSE)
1344  //ss.allianceBridges -- jumpbridges et al.
1345  // [for shipID, toSolarsystemID, toBeaconID in bag.allianceBridges:]
1346  }
1347 
1348  into.destiny_state = new PyBuffer( &stateBuffer );
1349  into.droneState = pBubble->GetDroneState(); //SystemDB::GetSolDroneState( m_data.systemID );
1350 
1351  /* SolarSystem info. this avoids the old way of a DB hit for every call. */
1352  PyPackedRow* row = new PyPackedRow(sDataMgr.CreateHeader());
1353  row->SetField("itemID", new PyLong(m_data.systemID));
1354  row->SetField("typeID", new PyInt(5));
1355  row->SetField("ownerID", PyStatic.NewOne()); // should this be owning factionID? yes
1356  row->SetField("locationID", new PyInt(m_data.constellationID));
1357  row->SetField("flagID", PyStatic.NewZero());
1358  row->SetField("quantity", PyStatic.NewNegOne());
1359  row->SetField("groupID", new PyInt(5));
1360  row->SetField("categoryID", new PyInt(2));
1361  row->SetField("customInfo", new PyString(""));
1362  into.solItem = row;
1363 
1364  if (is_log_enabled(DESTINY__SETSTATE)) {
1365  _log( DESTINY__SETSTATE, "Current State of %s", m_data.name.c_str() );
1366  into.Dump( DESTINY__SETSTATE, " " );
1367  }
1368 
1369  if (is_log_enabled(DESTINY__SETSTATE_DECODE)) {
1370  _log( DESTINY__SETSTATE_DECODE, " Decoded:" );
1371  Destiny::DumpUpdate( DESTINY__SETSTATE_DECODE, &( into.destiny_state->content() )[0], (uint32)into.destiny_state->content().size() );
1372  }
1373 }
#define _log(type, fmt,...)
Definition: logsys.h:124
Python string.
Definition: PyRep.h:430
std::string name
std::map< uint32, SystemEntity * > m_opStaticEntities
void GetEntities(std::map< uint32, SystemEntity * > &into) const
PyObject * GetDroneState() const
#define is_log_enabled(type)
Definition: logsys.h:78
SystemData m_data
Generic class for buffers.
Definition: Buffer.h:40
std::map< uint32, SystemEntity * > m_ticEntities
Python object.
Definition: PyRep.h:826
Python integer.
Definition: PyRep.h:231
#define PyStatic
Definition: PyRep.h:1209
unsigned __int32 uint32
Definition: eve-compat.h:50
uint32 systemID
bool SetField(uint32 index, PyRep *value)
Definition: PyRep.cpp:1031
void DumpUpdate(LogType into, const uint8 *data, uint32 len)
Python buffer.
Definition: PyRep.h:382
Packed row.
Definition: PyRep.h:961
uint32 constellationID
std::map< uint32, SystemEntity * > m_staticEntities
Python list.
Definition: PyRep.h:639
Python long integer.
Definition: PyRep.h:261
#define sDataMgr

Here is the call graph for this function:

Here is the caller graph for this function:

void SystemManager::ManipulateTimeData ( )
private

Definition at line 1711 of file SystemManager.cpp.

References GetFileTimeNow(), EvE::Time::Hour, m_data, m_killData, SystemData::systemID, and MapDB::UpdateKillData().

Referenced by UpdateData().

1712 {
1713  int64 timeNow = GetFileTimeNow();
1714  timeNow += EvE::Time::Hour;
1715 
1716  //if (m_killData.killsDateTime < timeNow)
1717 
1719 }
SystemData m_data
uint32 systemID
double GetFileTimeNow()
Definition: utils_time.cpp:84
signed __int64 int64
Definition: eve-compat.h:51
SystemKillData m_killData
static void UpdateKillData(uint32 sysID, SystemKillData &data)
Definition: MapDB.cpp:239

Here is the call graph for this function:

Here is the caller graph for this function:

void SystemManager::PayBounties ( )
protected
Todo:
this needs more work
Todo:
this isnt right...which is why it's not working. see code in client/script/ui/shared/neocom/wallet.py for more info. (lots to look over. no time tonite.) more data....

["description" => <92: << jnlRef:CorpBountyTax?

  • 1630077495 << total bounties paid on this timer
  • 325275.0 << corp taxes taken? NBL: << see above 11030: 2 11935: 1 23323: 1 23332: 2 23340: 2 > [WStr]]

Definition at line 1180 of file SystemManager.cpp.

References _log, Journal::EntryType::BountyPrizes, corpCONCORD, m_bountyMap, m_data, m_ratMap, SystemData::name, SystemData::systemID, and AccountService::TranserFunds().

Referenced by ProcessTic(), and UnloadSystem().

1181 {
1182  _log(CLIENT__TEXT, "PayBounties called for system %s(%u).", m_data.name.c_str(), m_data.systemID);
1183  int8 count = 0;
1184  /* recDescNpcBountyList = 'NBL' <-- descrives a full list of [typeID: qty]
1185  * recDescNpcBountyListTruncated = 'NBLT' <-- describes a trunicated list
1186 recDescription = 'DESC'
1187 recDescNpcBountyList = 'NBL'
1188 recDescNpcBountyListTruncated = 'NBLT'
1189 recStoreItems = 'STOREITEMS'
1190  */
1191 
1210  for (auto cur : m_bountyMap) {
1211  std::string reason = "NBLT: "; //this needs to be populated as [NBL(T): type:amt, type:amt, ... ] to get proper shit in client
1212  std::map<uint32, RatDataMap>::iterator itr = m_ratMap.find(cur.first);
1213  if (itr != m_ratMap.end()) {
1214  count = itr->second.size();
1215  for (auto cur : itr->second) {
1216  reason += std::to_string(cur.first);
1217  reason += ":";
1218  reason += std::to_string(cur.second);
1219  if (count > 1)
1220  reason += ",";
1221  --count;
1222  }
1223  // will have to figure out how to *correctly* limit this data to count<20 or so...
1224  } //else {
1225  reason += ",..."; // this will show as "truncated" in client
1226  //}
1228  count = 0;
1229  }
1230  m_ratMap.clear();
1231  m_bountyMap.clear();
1232 }
#define _log(type, fmt,...)
Definition: logsys.h:124
std::string name
std::map< uint32, RatDataMap > m_ratMap
std::map< uint32, BountyData > m_bountyMap
signed __int8 int8
Definition: eve-compat.h:45
SystemData m_data
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 systemID

Here is the call graph for this function:

Here is the caller graph for this function:

uint32 SystemManager::PlayerCount ( )
inline

Definition at line 105 of file SystemManager.h.

References m_players.

Referenced by Command_list(), and NPCAIMgr::WarpOut().

105 { return m_players; }

Here is the caller graph for this function:

bool SystemManager::ProcessTic ( )

Definition at line 221 of file SystemManager.cpp.

References Timer::Check(), GetTimeUSeconds(), m_anomMgr, m_beltCount, m_beltMgr, m_bountyTimer, m_dungMgr, m_entityChanged, m_minutetimer, m_opStaticEntities, m_planetMap, m_spawnMgr, m_ticEntities, PayBounties(), SpawnMgr::Process(), AnomalyMgr::Process(), BeltMgr::Process(), DungeonMgr::Process(), sConfig, sProfiler, Profile::system, and SystemActivity().

221  {
222  double profileStartTime = GetTimeUSeconds();
223 
224  /* the idea here is entities map NEVER has invalid items in it, but our iterator may become invalid
225  * when SE->Process() returns because Process() will add/remove from the map as needed
226  * (new objects, destroyed objects, moved objects, etc)
227  * std::map internally orders items by key(itemID here), so use an int var to hold last-processed itemID (mLast).
228  * when iteration starts over, increment until cur > mLast and continue from there to end of list.
229  */
230  std::map<uint32, SystemEntity*>::iterator itr = m_ticEntities.begin();
231  uint32 mLast(0);
232  while (itr != m_ticEntities.end()) {
233  if (mLast >= itr->first) {
234  ++itr;
235  continue;
236  }
237 
238  /* main process call. */
239  mLast = itr->first; // not sure if this will slow this down or not. check profile
240  itr->second->Process();
241 
242  if (m_entityChanged) {
243  m_entityChanged = false;
244  itr = m_ticEntities.begin();
245  continue;
246  }
247  ++itr;
248  }
249 
250  // tic for sov structures (as they aren't in ticEntities)
251  for (auto cur : m_opStaticEntities)
252  if (cur.second->IsTCUSE())
253  cur.second->GetTCUSE()->Process();
254  else if (cur.second ->IsSBUSE())
255  cur.second->GetSBUSE()->Process();
256  else if (cur.second ->IsIHubSE())
257  cur.second->GetIHubSE()->Process();
258 
259  // check bounty timer
260  if (m_bountyTimer.Check(sConfig.server.BountyPayoutDelayed))
261  PayBounties();
262  /* the following are coded for single-tic calls */
263  m_anomMgr->Process();
264  if (m_beltCount)
265  m_beltMgr->Process();
266  m_dungMgr->Process();
267  m_spawnMgr->Process();
268 
269  // process planets for PI
270  if (m_minutetimer.Check()) {
271  //++m_minutes; // not used at this time
272  for (auto cur : m_planetMap)
273  cur.second->Process();
274  }
275 
276  if (sConfig.debug.UseProfiling)
277  sProfiler.AddTime(Profile::system, GetTimeUSeconds() - profileStartTime);
278 
279  return SystemActivity();
280 }
#define sConfig
A macro for easier access to the singleton.
std::map< uint32, SystemEntity * > m_opStaticEntities
void Process()
Definition: DungeonMgr.cpp:228
#define sProfiler
Definition: dbcore.cpp:39
DungeonMgr * m_dungMgr
void Process()
Definition: BeltMgr.cpp:125
void Process()
Definition: AnomalyMgr.cpp:156
double GetTimeUSeconds()
Definition: utils_time.cpp:116
std::map< uint32, SystemEntity * > m_ticEntities
std::map< uint32, SystemEntity * > m_planetMap
SpawnMgr * m_spawnMgr
BeltMgr * m_beltMgr
bool Check(bool reset=true)
Definition: timer.cpp:62
void Process()
Definition: SpawnMgr.cpp:85
unsigned __int32 uint32
Definition: eve-compat.h:50
AnomalyMgr * m_anomMgr

Here is the call graph for this function:

void SystemManager::RemoveClient ( Client pClient,
bool  count = false,
bool  jump = false 
)

Definition at line 949 of file SystemManager.cpp.

References _log, MapDB::AddJump(), Client::GetCharacterID(), Client::GetName(), m_clients, m_data, m_jumpMap, m_players, SystemData::name, sEntityList, and SystemData::systemID.

Referenced by Client::MoveToLocation(), and Client::~Client().

949  {
950  //called from Client::~Client() and Client::MoveToLocation() when changing systems
951  if (pClient == nullptr)
952  return;
953  m_clients.erase(pClient->GetCharacterID());
954  _log(PLAYER__TRACE, "%s(%u): Removed from system manager for %s(%u) - %u clients still in system.", \
955  pClient->GetName(), pClient->GetCharacterID(), m_data.name.c_str(), m_data.systemID, m_clients.size());
956 
957  if (count) {
958  --m_players;
959  if (m_players < 0) {
960  m_players = 0;
961  m_clients.clear(); // redundant but safe
962  _log(PLAYER__ERROR, "player count for %s(%u) is < 0", m_data.name.c_str(), m_data.systemID);
963  }
964 
965  _log(PLAYER__INFO, "%s(%u): Removed from player count for %s(%u) - new count: %u", \
966  pClient->GetName(), pClient->GetCharacterID(), m_data.name.c_str(), m_data.systemID, m_players);
967  }
968  if (jump) {
969  //add jump in this system
971 
972  _log(PLAYER__INFO, "%s(%u): Add Jump to %s(%u)", \
973  pClient->GetName(), pClient->GetCharacterID(), m_data.name.c_str(), m_data.systemID);
974 
975  uint16 stamp = sEntityList.GetStamp();
976  std::map<uint32, uint8>::iterator itr = m_jumpMap.find(stamp);
977  if (itr != m_jumpMap.end()) {
978  ++(itr->second);
979  } else {
980  m_jumpMap.emplace(stamp, 1);
981  }
982  }
983 }
#define _log(type, fmt,...)
Definition: logsys.h:124
std::string name
int32 GetCharacterID() const
Definition: Client.h:113
#define sEntityList
Definition: EntityList.h:208
std::map< uint32, uint8 > m_jumpMap
SystemData m_data
std::map< uint32, Client * > m_clients
const char * GetName() const
Definition: Client.h:94
uint32 systemID
static void AddJump(uint32 sysID)
Definition: MapDB.cpp:218
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 SystemManager::RemoveEntity ( SystemEntity pSE)
Note
this does not remove static balls (bubble center markers) and no clue why

Definition at line 1075 of file SystemManager.cpp.

References SystemEntity::GetID(), SystemEntity::GetSelf(), itemID(), m_anomMgr, m_entityChanged, m_staticEntities, m_ticEntities, RemoveItemFromInventory(), AnomalyMgr::RemoveSignal(), and sBubbleMgr.

Referenced by Client::Board(), BeltMgr::ClearAll(), Command_kill(), Command_unspawn(), SystemEntity::Delete(), Client::DestroyShipSE(), StructureSE::Init(), Client::MoveToLocation(), SystemBubble::RemoveMarkers(), RemoveNPC(), and ProbeSE::RemoveProbe().

1075  {
1077  if (pSE == nullptr)
1078  return;
1079  sBubbleMgr.Remove(pSE);
1080  // Remove Entity's Item Ref from Solar System Dynamic Inventory:
1082  // remove entity from our maps
1083  uint32 itemID(pSE->GetID());
1084  m_entityChanged = true;
1085  m_ticEntities.erase(itemID);
1086  m_staticEntities.erase(itemID);
1087 
1088  // remove from anomaly map, if exists
1090 }
InventoryItemRef GetSelf()
Definition: SystemEntity.h:202
std::map< uint32, SystemEntity * > m_ticEntities
void RemoveItemFromInventory(InventoryItemRef item)
uint32 GetID()
Definition: SystemEntity.h:207
unsigned __int32 uint32
Definition: eve-compat.h:50
typeID Spawn an NPC with the specified type text Search for items matching the specified query() type()() itemID() copy() materialLevel()() itemID(attributeID)-Retrieves attribute value." ) COMMAND( setattr
AnomalyMgr * m_anomMgr
void RemoveSignal(uint32 itemID)
Definition: AnomalyMgr.cpp:518
#define sBubbleMgr
std::map< uint32, SystemEntity * > m_staticEntities

Here is the call graph for this function:

Here is the caller graph for this function:

void SystemManager::RemoveItemFromInventory ( InventoryItemRef  item)

Definition at line 1439 of file SystemManager.cpp.

References _log, InventoryItem::itemID(), m_data, m_entities, m_solarSystemRef, InventoryItem::name(), SystemData::name, SolarSystem::RemoveItemFromInventory(), and SystemData::systemID.

Referenced by RemoveEntity().

1440 {
1441  // just in case this is called from elsewhere (which it may be), make sure we remove entity from our map.
1442  auto itr = m_entities.find(iRef->itemID());
1443  if (itr != m_entities.end()) {
1444  _log(ITEM__TRACE, "%s(%u): Removed from system manager for %s(%u)", iRef->name(), iRef->itemID(), m_data.name.c_str(), m_data.systemID);
1445  m_entities.erase(itr);
1446  } else {
1447  _log(ITEM__WARNING, "%s(%u): Called RemoveEntity(), but they weren\'t found in system manager for %s(%u)", \
1448  iRef->name(), iRef->itemID(), m_data.name.c_str(), m_data.systemID);
1449  }
1450 
1452 }
#define _log(type, fmt,...)
Definition: logsys.h:124
std::string name
SystemData m_data
void RemoveItemFromInventory(InventoryItemRef iRef)
uint32 systemID
SolarSystemRef m_solarSystemRef
std::map< uint32, SystemEntity * > m_entities

Here is the call graph for this function:

Here is the caller graph for this function:

void SystemManager::RemoveNPC ( NPC pNPC)

Definition at line 1023 of file SystemManager.cpp.

References _log, SystemEntity::GetID(), SystemEntity::GetName(), m_data, m_npcs, SystemData::name, RemoveEntity(), NPC::RemoveNPC(), sEntityList, and SystemData::systemID.

1023  {
1024  if ( pNPC == nullptr)
1025  return;
1026  auto itr = m_npcs.find(pNPC->GetID());
1027  if (itr != m_npcs.end())
1028  m_npcs.erase(itr);
1029 
1030  _log(NPC__TRACE, "%s(%u): Removed from system manager for %s(%u)", pNPC->GetName(), pNPC->GetID(), m_data.name.c_str(), m_data.systemID);
1031  RemoveEntity(pNPC);
1032  sEntityList.RemoveNPC(); // this is for loaded npc count.
1033  pNPC->RemoveNPC(); // this deletes NPC from DB. NPC's dont jump, so no reason to remove from system unless killed
1034 }
#define _log(type, fmt,...)
Definition: logsys.h:124
std::string name
#define sEntityList
Definition: EntityList.h:208
SystemData m_data
void RemoveNPC()
Definition: NPC.cpp:279
void RemoveEntity(SystemEntity *pSE)
uint32 GetID()
Definition: SystemEntity.h:207
const char * GetName() const
Definition: SystemEntity.h:210
uint32 systemID
std::map< uint32, NPC * > m_npcs

Here is the call graph for this function:

void SystemManager::RemoveSpawnBubble ( SystemBubble pBubble)

Definition at line 1270 of file SystemManager.cpp.

References _log, SystemBubble::GetID(), is_log_enabled, SystemBubble::IsBelt(), SystemBubble::IsGate(), m_activeGateSpawns, m_activeRatSpawns, m_data, m_ratBubbles, SystemData::name, and SystemData::systemID.

Referenced by SpawnMgr::SpawnKilled().

1271 {
1272  if (pBubble->IsBelt()) {
1273  m_ratBubbles.erase(pBubble->GetID());
1275  } else if (pBubble->IsGate()) {
1276  m_ratBubbles.erase(pBubble->GetID());
1278  }
1279  if (is_log_enabled(SPAWN__MESSAGE))
1280  _log(SPAWN__MESSAGE, "SystemManager::RemoveSpawnBubble() - called for bubbleID %u in %s(%u).", pBubble->GetID(), m_data.name.c_str(), m_data.systemID);
1281 }
bool IsBelt()
Definition: SystemBubble.h:64
#define _log(type, fmt,...)
Definition: logsys.h:124
std::string name
uint8 m_activeGateSpawns
#define is_log_enabled(type)
Definition: logsys.h:78
SystemData m_data
SpawnBubbleMap m_ratBubbles
uint16 GetID()
Definition: SystemBubble.h:91
uint32 systemID
bool IsGate()
Definition: SystemBubble.h:65
uint8 m_activeRatSpawns

Here is the call graph for this function:

Here is the caller graph for this function:

bool SystemManager::SafeToUnload ( )
private

Definition at line 1694 of file SystemManager.cpp.

References EVEPOS::ProcState::Anchoring, GetOperationalStatics(), EVEPOS::ProcState::Offlining, EVEPOS::ProcState::Onlining, and EVEPOS::ProcState::Unanchoring.

Referenced by UpdateData().

1695 {
1696  for (auto cur: GetOperationalStatics()) {
1697  //If there are any ongoing operations by operational static structures, we don't want to unload the system until this is complete
1698  if (cur.second->IsPOSSE()) {
1699  if ((cur.second->GetPOSSE()->GetProcState() == EVEPOS::ProcState::Unanchoring) or
1700  (cur.second->GetPOSSE()->GetProcState() == EVEPOS::ProcState::Anchoring) or
1701  (cur.second->GetPOSSE()->GetProcState() == EVEPOS::ProcState::Offlining) or
1702  (cur.second->GetPOSSE()->GetProcState() == EVEPOS::ProcState::Onlining)) {
1703  return false;
1704  }
1705  }
1706  }
1707  return true; //by default, its always safe to unload
1708 }
std::map< uint32, SystemEntity * > GetOperationalStatics()

Here is the call graph for this function:

Here is the caller graph for this function:

void SystemManager::SendStaticBall ( SystemEntity pSE)

Definition at line 1375 of file SystemManager.cpp.

References _log, Buffer::Append(), Destiny::DumpUpdate(), SystemEntity::EncodeDestiny(), SystemBubble::GetCenter(), SystemBubble::GetID(), SystemEntity::GetID(), SystemEntity::GetName(), SystemEntity::GetPosition(), is_log_enabled, SystemEntity::IsContainerSE(), m_clients, SystemEntity::MakeDamageState(), SystemEntity::MakeSlimItem(), Destiny::AddBall_header::packet_type, PyIncRef, SafeDelete(), sEntityList, PyTuple::SetItem(), Destiny::AddBall_header::stamp, and SystemEntity::SysBubble().

Referenced by AddEntity().

1376 {
1377  if (m_clients.empty())
1378  return;
1379 
1380  if (is_log_enabled(DESTINY__MESSAGE)) {
1381  if (pSE->SysBubble() != nullptr) { //Don't attempt to log if bubble is null (ie, on static structure initial launch)
1382  GPoint bCenter(pSE->SysBubble()->GetCenter());
1383  _log(DESTINY__MESSAGE, "SystemManager::SendStaticBall() - Adding static entity %s(%u) to bubble %u. Dist to center: %.2f", \
1384  pSE->GetName(), pSE->GetID(), pSE->SysBubble()->GetID(), bCenter.distance(pSE->GetPosition()));
1385  }
1386  }
1387 
1388  Buffer* destinyBuffer = new Buffer();
1389  //create AddBalls header
1391  head.packet_type = 1; // 0 = full state 1 = balls
1392  head.stamp = sEntityList.GetStamp();
1393  destinyBuffer->Append( head );
1394 
1395  AddBalls2 addballs2;
1396  addballs2.stateStamp = sEntityList.GetStamp();
1397  addballs2.extraBallData = new PyList();
1398 
1399  if (pSE->IsContainerSE()) {
1400  addballs2.extraBallData->AddItem(pSE->MakeSlimItem());
1401  } else {
1402  PyTuple* balls = new PyTuple(2);
1403  balls->SetItem(0, pSE->MakeSlimItem());
1404  balls->SetItem(1, pSE->MakeDamageState());
1405  addballs2.extraBallData->AddItem(balls);
1406  }
1407 
1408  if (addballs2.extraBallData->size() < 1) {
1409  SafeDelete( destinyBuffer );
1410  return;
1411  }
1412 
1413  pSE->EncodeDestiny(*destinyBuffer);
1414  addballs2.state = new PyBuffer(&destinyBuffer); //consumed
1415 
1416  if (is_log_enabled(DESTINY__BALL_DUMP))
1417  addballs2.Dump( DESTINY__BALL_DUMP, " " );
1418  _log( DESTINY__BALL_DECODE, " Ball Decoded:" );
1419  if (is_log_enabled(DESTINY__BALL_DECODE))
1420  Destiny::DumpUpdate( DESTINY__BALL_DECODE, &( addballs2.state->content() )[0], (uint32)addballs2.state->content().size() );
1421 
1422  //send the update
1423  PyTuple* rsp = addballs2.Encode();
1424  // does this need to be incremented? the others do...
1425  for (auto cur : m_clients) {
1426  PyIncRef(rsp);
1427  cur.second->QueueDestinyUpdate(&rsp, true);
1428  }
1429 
1430  //cleanup
1431  SafeDelete(destinyBuffer);
1432 }
void Append(const T &value)
Appends a single value to buffer.
Definition: Buffer.h:437
#define _log(type, fmt,...)
Definition: logsys.h:124
SystemBubble * SysBubble()
Definition: SystemEntity.h:195
#define sEntityList
Definition: EntityList.h:208
Python tuple.
Definition: PyRep.h:567
const GPoint & GetPosition() const
Definition: SystemEntity.h:211
void SafeDelete(T *&p)
Deletes and nullifies a pointer.
Definition: SafeMem.h:83
#define is_log_enabled(type)
Definition: logsys.h:78
virtual PyDict * MakeSlimItem()
Definition: gpoint.h:33
Generic class for buffers.
Definition: Buffer.h:40
std::map< uint32, Client * > m_clients
PyTuple * MakeDamageState()
void SetItem(size_t index, PyRep *object)
Stores Python object.
Definition: PyRep.h:610
virtual bool IsContainerSE()
Definition: SystemEntity.h:157
uint16 GetID()
Definition: SystemBubble.h:91
uint32 GetID()
Definition: SystemEntity.h:207
const char * GetName() const
Definition: SystemEntity.h:210
unsigned __int32 uint32
Definition: eve-compat.h:50
#define PyIncRef(op)
Definition: PyRep.h:56
virtual void EncodeDestiny(Buffer &into)
void DumpUpdate(LogType into, const uint8 *data, uint32 len)
Python buffer.
Definition: PyRep.h:382
entityID heal the character with the entityID note giving you detailed ship status information gives a list of all dynamic entities and players and their destinyState in this bubble shows some current destiny variables save all kick all and halt server immediate command list all items in current location s gives list of cargo contents and volumes in all holds list current session values show current ship DNA show current objects in their destiny state
GPoint GetCenter()
Definition: SystemBubble.h:93
Python list.
Definition: PyRep.h:639

Here is the call graph for this function:

Here is the caller graph for this function:

void SystemManager::SetDockCount ( Client pClient,
bool  docked = false 
)

Definition at line 985 of file SystemManager.cpp.

References _log, Client::GetCharacterID(), GetDockedCount(), Client::GetName(), GetPlayerCount(), m_data, m_docked, m_players, SystemData::name, sEntityList, SystemData::systemID, and MapDB::UpdatePilotCount().

Referenced by Client::CharNoLongerInStation(), and Client::CharNowInStation().

986 {
987  if (docked) {
988  ++m_docked;
989  } else {
990  --m_docked;
991  if (m_docked < 0) {
992  m_docked = 0;
993  _log(PLAYER__ERROR, "docked count for %s(%u) is <0. Setting to 0.", m_data.name.c_str(), m_data.systemID);
994  }
995  }
996 
997  if (m_players > sEntityList.GetPlayerCount())
998  GetPlayerCount();
999  if (m_docked > m_players)
1000  GetDockedCount();
1001 
1003 
1004  _log(PLAYER__INFO, "%s(%u): %s docked count for %s(%u) - new count: %u", \
1005  pClient->GetName(), pClient->GetCharacterID(), docked ? "Added to" : "Removed from", m_data.name.c_str(), m_data.systemID, m_docked);
1006 }
#define _log(type, fmt,...)
Definition: logsys.h:124
std::string name
int32 GetCharacterID() const
Definition: Client.h:113
#define sEntityList
Definition: EntityList.h:208
SystemData m_data
static void UpdatePilotCount(uint32 sysID, uint16 docked=0, uint16 space=0)
Definition: MapDB.cpp:225
const char * GetName() const
Definition: Client.h:94
uint32 systemID

Here is the call graph for this function:

Here is the caller graph for this function:

bool SystemManager::SystemActivity ( )
private

Definition at line 282 of file SystemManager.cpp.

References m_activityTime, and sEntityList.

Referenced by ProcessTic().

282  {
283  if (m_activityTime == 0)
284  return true;
285  if ((sEntityList.GetStamp() - m_activityTime) > 60)
286  return false;
287 
288  return true;
289 }
#define sEntityList
Definition: EntityList.h:208
uint32 m_activityTime

Here is the caller graph for this function:

void SystemManager::UnloadSystem ( )
Todo:
finish this for lsc

Definition at line 292 of file SystemManager.cpp.

References _log, BeltMgr::ClearAll(), ManagerDB::ClearDungeons(), AnomalyMgr::Close(), SystemData::constellationID, InventoryItem::Delete(), InventoryItem::GetMyInventory(), SystemEntity::GetSelf(), ShipSE::GetShipItemRef(), SystemEntity::GetShipSE(), SystemEntity::GetStationSE(), SystemEntity::isGlobal(), SystemEntity::IsNPCSE(), SystemEntity::IsOperSE(), SystemEntity::IsProbeSE(), SystemEntity::IsShipSE(), SystemEntity::IsStaticEntity(), SystemEntity::IsStationSE(), ShipItem::LogOut(), PyServiceMgr::lsc_service, m_anomMgr, m_beltMgr, m_data, m_entities, m_loaded, m_npcs, m_opStaticEntities, m_services, m_solarSystemRef, m_staticEntities, m_ticEntities, SystemData::name, PayBounties(), SystemData::regionID, SafeDelete(), sBubbleMgr, sEntityList, MapDB::SetSystemActive(), sItemFactory, sLog, SystemData::systemID, LSCService::SystemUnload(), SystemEntity::TargetMgr(), Inventory::Unload(), TargetManager::Unload(), and StationSE::UnloadStation().

Referenced by ~SystemManager().

292  {
293  if (!m_loaded)
294  return;
295 
296  sLog.Magenta(" SystemManager", "UnloadSystem() called for %s(%u).", m_data.name.c_str(), m_data.systemID);
297 
298  // inform MarketBot of system unloading to remove system stations from proc loop.
299  //sMktBotMgr.RemoveSystem();
300 
301  // system is being unloaded. pay bounties now
302  PayBounties();
303  // unload belts, which saves and removes roids from system
304  m_beltMgr->ClearAll();
305  // close anomaly mgr, which saves and removes sigs from system
306  m_anomMgr->Close();
307 
308  // remove static and dynamic entities
309  std::map<uint32, SystemEntity*>::iterator itr = m_entities.begin();
310  SystemEntity* pSE(nullptr);
311  while (itr != m_entities.end()) {
312  if ((itr->first == 0) or (itr->second == nullptr)) {
313  itr = m_entities.erase(itr);
314  continue;
315  }
316  pSE = itr->second;
317 
318  if (pSE->TargetMgr() != nullptr)
319  pSE->TargetMgr()->Unload();
320 
321  if (pSE->IsStaticEntity() or pSE->isGlobal()) {
322  if (pSE->IsStationSE()) {
323  pSE->GetStationSE()->UnloadStation();
324  sEntityList.RemoveStation(itr->first);
325  }
326  m_staticEntities.erase(m_staticEntities.find(itr->first));
327  } else if (pSE->IsShipSE()) {
328  pSE->GetShipSE()->GetShipItemRef()->LogOut();
329  } else if (pSE->IsNPCSE()) {
330  sEntityList.RemoveNPC(); // this is for loaded npc count.
331  pSE->GetSelf()->Delete();
332  } else if (pSE->IsProbeSE()) {
333  sEntityList.RemoveProbe(itr->first);
334  }
335 
336  if (pSE->IsOperSE()) { //Remove operational statics from list
337  m_opStaticEntities.erase(m_opStaticEntities.find(itr->first));
338  }
339 
340  sItemFactory.RemoveItem(itr->first);
341  itr = m_entities.erase(itr);
342  sBubbleMgr.Remove(pSE);
343  SafeDelete(pSE);
344  }
345 
346  // save items, then remove from system inventory, item factory and decrement item count
348  _log(PHYSICS__MESSAGE, "SystemManager::UnloadSystem() - map count after unload: %u npcs, %u entities, %u statics.", \
349  m_npcs.size(), m_entities.size(), m_staticEntities.size());
350 
351  // this is dupe container. contents unloaded in another call
352  m_npcs.clear();
353  // at this point, system entity list should be clear...but just in case, hit it again
354  m_entities.clear();
355  // this is dupe container. contents unloaded in another call
356  m_ticEntities.clear();
357  // at this point, system static entity list should be clear...but just in case, hit it again
358  m_staticEntities.clear();
359  // clear operational static entity list too
360  m_opStaticEntities.clear();
361 
362  // this still needs some work... seems ok to me. 26Dec18
363  sBubbleMgr.ClearSystemBubbles(m_data.systemID);
364 
365  // remove dungeon shit for this system?
366  // are we saving it for later or is it make-on-boot?
368 
369  // set system inactive for system status page
371 
374 
375  // remove solar system item from ItemFactory
376  sItemFactory.RemoveItem(m_data.systemID);
377  m_loaded = false;
378 }
#define _log(type, fmt,...)
Definition: logsys.h:124
static void SetSystemActive(uint32 sysID, bool active=false)
Definition: MapDB.cpp:212
std::string name
std::map< uint32, SystemEntity * > m_opStaticEntities
void ClearAll()
Definition: BeltMgr.cpp:71
#define sEntityList
Definition: EntityList.h:208
void SafeDelete(T *&p)
Deletes and nullifies a pointer.
Definition: SafeMem.h:83
void Unload()
Definition: Inventory.cpp:62
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
SystemData m_data
std::map< uint32, SystemEntity * > m_ticEntities
BeltMgr * m_beltMgr
void Close()
Definition: AnomalyMgr.cpp:171
LSCService * lsc_service
Definition: PyServiceMgr.h:77
uint32 systemID
uint32 regionID
static void ClearDungeons()
Definition: ManagerDB.cpp:690
AnomalyMgr * m_anomMgr
SolarSystemRef m_solarSystemRef
#define sItemFactory
Definition: ItemFactory.h:165
std::map< uint32, SystemEntity * > m_entities
uint32 constellationID
void SystemUnload(uint32 systemID, uint32 constID, uint32 regionID)
Definition: LSCService.cpp:913
PyServiceMgr & m_services
std::map< uint32, NPC * > m_npcs
#define sBubbleMgr
Inventory * GetMyInventory()
Definition: InventoryItem.h:91
std::map< uint32, SystemEntity * > m_staticEntities

Here is the call graph for this function:

Here is the caller graph for this function:

void SystemManager::UpdateData ( )

Definition at line 1664 of file SystemManager.cpp.

References m_activityTime, m_clients, m_data, m_docked, m_jumpMap, m_players, ManipulateTimeData(), SafeToUnload(), sEntityList, SystemData::systemID, and MapDB::UpdatePilotCount().

1665 {
1667 
1668  uint16 jumps = 0;
1669  uint16 stamp = sEntityList.GetStamp() -60;
1670  std::map<uint32, uint8>::iterator itr = m_jumpMap.begin();
1671  while (itr != m_jumpMap.end()) {
1672  if (itr->first < stamp) {
1673  itr = m_jumpMap.erase(itr);
1674  continue;
1675  } else {
1676  jumps += itr->second;
1677  ++itr;
1678  }
1679  }
1680 
1681  // this is jumps/hour data
1682  //MapDB::UpdateJumps(m_data.systemID, jumps);
1683 
1684  // if system and jumpmap are both empty, set activity time for unload timer
1685  if (SafeToUnload())
1686  if (m_activityTime == 0)
1687  if (m_clients.empty())
1688  if (m_jumpMap.empty())
1689  m_activityTime = sEntityList.GetStamp() -50;
1691 }
#define sEntityList
Definition: EntityList.h:208
std::map< uint32, uint8 > m_jumpMap
SystemData m_data
std::map< uint32, Client * > m_clients
static void UpdatePilotCount(uint32 sysID, uint16 docked=0, uint16 space=0)
Definition: MapDB.cpp:225
uint32 systemID
void ManipulateTimeData()
uint32 m_activityTime
unsigned __int16 uint16
Definition: eve-compat.h:48

Here is the call graph for this function:

Member Data Documentation

uint8 SystemManager::m_activeGateSpawns
private

Definition at line 203 of file SystemManager.h.

Referenced by DecGateSpawnCount(), IncGateSpawnCount(), and RemoveSpawnBubble().

uint8 SystemManager::m_activeRatSpawns
private
uint16 SystemManager::m_activeRoidSpawns
private

Definition at line 204 of file SystemManager.h.

Referenced by DecRoidSpawnCount(), GetRoidSpawnCount(), and IncRoidSpawnCount().

uint32 SystemManager::m_activityTime
private

Definition at line 219 of file SystemManager.h.

Referenced by AddClient(), SystemActivity(), and UpdateData().

AnomalyMgr* SystemManager::m_anomMgr
private
uint8 SystemManager::m_beltCount
private
BeltMgr* SystemManager::m_beltMgr
private
std::vector<uint32> SystemManager::m_beltVector
private

Definition at line 205 of file SystemManager.h.

Referenced by GetRandBeltID(), LoadSystemStatics(), and SystemManager().

std::map<uint32, BountyData> SystemManager::m_bountyMap
private

Definition at line 233 of file SystemManager.h.

Referenced by AddBounty(), and PayBounties().

Timer SystemManager::m_bountyTimer
private

Definition at line 231 of file SystemManager.h.

Referenced by BootSystem(), and ProcessTic().

std::map<uint32, Client*> SystemManager::m_clients
private
uint16 SystemManager::m_docked
private

Definition at line 194 of file SystemManager.h.

Referenced by GetDockedCount(), SetDockCount(), and UpdateData().

DungeonMgr* SystemManager::m_dungMgr
private

Definition at line 179 of file SystemManager.h.

Referenced by GetDungMgr(), LoadCosmicMgrs(), ProcessTic(), and ~SystemManager().

std::map<uint32, SystemEntity*> SystemManager::m_entities
private
bool SystemManager::m_entityChanged
private

Definition at line 222 of file SystemManager.h.

Referenced by AddEntity(), ProcessTic(), and RemoveEntity().

uint8 SystemManager::m_gateCount
private

Definition at line 201 of file SystemManager.h.

Referenced by LoadSystemStatics().

std::map<uint32, SystemEntity*> SystemManager::m_gateMap
private

Definition at line 212 of file SystemManager.h.

Referenced by GetClosestGateSE(), GetGates(), LoadSystemStatics(), and SystemManager().

std::map<uint32, uint8> SystemManager::m_jumpMap
private

Definition at line 196 of file SystemManager.h.

Referenced by AddClient(), RemoveClient(), SystemManager(), and UpdateData().

SystemKillData SystemManager::m_killData
private

Definition at line 193 of file SystemManager.h.

Referenced by BootSystem(), ManipulateTimeData(), and SystemManager().

bool SystemManager::m_loaded
private

Definition at line 215 of file SystemManager.h.

Referenced by AddEntity(), BootSystem(), IsLoaded(), UnloadSystem(), and ~SystemManager().

uint32 SystemManager::m_minutes
private

Definition at line 238 of file SystemManager.h.

Referenced by SystemManager().

Timer SystemManager::m_minutetimer
private

Definition at line 237 of file SystemManager.h.

Referenced by BootSystem(), and ProcessTic().

std::map<uint32, SystemEntity*> SystemManager::m_moonMap
private

Definition at line 210 of file SystemManager.h.

Referenced by GetClosestMoonSE(), LoadSystemStatics(), and SystemManager().

std::map<uint32, NPC*> SystemManager::m_npcs
private
std::map<uint32, SystemEntity*> SystemManager::m_opStaticEntities
private
std::map<uint32, SystemEntity*> SystemManager::m_planetMap
private
uint16 SystemManager::m_players
private
SpawnBubbleMap SystemManager::m_ratBubbles
private
std::map<uint32, RatDataMap> SystemManager::m_ratMap
private

Definition at line 234 of file SystemManager.h.

Referenced by AddBounty(), and PayBounties().

SpawnBubbleMap SystemManager::m_roidBubbles
private

Definition at line 207 of file SystemManager.h.

Referenced by SystemManager().

float SystemManager::m_secValue
private

Definition at line 190 of file SystemManager.h.

Referenced by GetSecValue(), and SystemManager().

PyServiceMgr& SystemManager::m_services
private

Definition at line 182 of file SystemManager.h.

Referenced by BootSystem(), GetServiceMgr(), and UnloadSystem().

SpawnMgr* SystemManager::m_spawnMgr
private
std::map<uint32, SystemEntity*> SystemManager::m_staticEntities
private
std::map<uint32, SystemEntity*> SystemManager::m_ticEntities
private
SystemGPoint SystemManager::mGP
private

Definition at line 185 of file SystemManager.h.

Referenced by LoadPlayerDynamics(), and LoadSystemDynamics().


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