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

#include "MapDB.h"

Inheritance diagram for MapDB:
Collaboration diagram for MapDB:

Static Public Member Functions

static PyObjectGetPseudoSecurities ()
 
static PyObjectGetStationExtraInfo ()
 
static PyObjectGetStationOpServices ()
 
static PyObjectGetStationServiceInfo ()
 
static PyObjectGetSolSystemVisits (uint32)
 
static void GetStationCount (DBQueryResult &res)
 
static void GetSystemJumps (DBQueryResult &res)
 
static void SystemStartup ()
 
static void LoadDynamicData (uint32 sysID, SystemKillData &data)
 
static PyRepGetDynamicData (uint8 type, uint8 time)
 
static void ManipulateTimeData ()
 
static void SetSystemActive (uint32 sysID, bool active=false)
 
static void AddJump (uint32 sysID)
 
static void AddKill (uint32 sysID)
 
static void AddPodKill (uint32 sysID)
 
static void AddFactionKill (uint32 sysID)
 
static void UpdateJumps (uint32 sysID, uint16 jumps)
 
static void UpdateKillData (uint32 sysID, SystemKillData &data)
 
static void UpdatePilotCount (uint32 sysID, uint16 docked=0, uint16 space=0)
 
- Static Public Member Functions inherited from ServiceDB
static bool GetAccountInformation (CryptoChallengePacket &ccp, AccountData &aData, std::string &failMsg)
 
static bool UpdateAccountHash (const char *username, std::string &hash)
 
static bool IncrementLoginCount (uint32 accountID)
 
static void UpdatePassword (uint32 accountID, const char *pass)
 
static void SaveKillOrLoss (CharKillData &data)
 
static bool GetConstant (const char *name, uint32 &into)
 
static void SetServerOnlineStatus (bool online=false)
 
static void SetCharacterOnlineStatus (uint32 char_id, bool online=false)
 
static void SetAccountOnlineStatus (uint32 accountID, bool online=false)
 
static void SetAccountBanStatus (uint32 accountID, bool banned=false)
 
static void SaveServerStats (double threads, float rss, float vm, float user, float kernel, uint32 items, uint32 bubbles)
 
static uint32 SetClientSeed ()
 
static PyRepLookupChars (const char *match, bool exact=false)
 
static PyRepLookupOwners (const char *match, bool exact=false)
 
static PyRepLookupCorporations (const std::string &)
 
static PyRepLookupFactions (const std::string &)
 
static PyRepLookupCorporationTickers (const std::string &)
 
static PyRepLookupStations (const std::string &)
 
static PyRepLookupKnownLocationsByGroup (const std::string &, uint32)
 
static PyRepPrimeOwners (std::vector< int32 > &itemIDs)
 
static bool ValidateAccountName (CryptoChallengePacket &ccp, std::string &failMsg)
 
static void GetCorpHangarNames (uint32 corpID, std::map< uint8, std::string > &hangarNames)
 

Additional Inherited Members

- Public Member Functions inherited from ServiceDB
uint32 GetStationOwner (uint32 stationID)
 
- Protected Member Functions inherited from ServiceDB
void ProcessStringChange (const char *key, const std::string &oldValue, std::string newValue, PyDict *notif, std::vector< std::string > &dbQ)
 
void ProcessRealChange (const char *key, double oldValue, double newValue, PyDict *notif, std::vector< std::string > &dbQ)
 
void ProcessIntChange (const char *key, uint32 oldValue, uint32 newValue, PyDict *notif, std::vector< std::string > &dbQ)
 
void ProcessLongChange (const char *key, int64 oldValue, int64 newValue, PyDict *notif, std::vector< std::string > &dbQ)
 
- Static Protected Member Functions inherited from ServiceDB
static uint32 CreateNewAccount (const char *login, const char *pass, const char *passHash, int64 role)
 

Detailed Description

Definition at line 35 of file MapDB.h.

Member Function Documentation

void MapDB::AddFactionKill ( uint32  sysID)
static

podKillsHour, podKills24Hour

Definition at line 256 of file MapDB.cpp.

References sDatabase.

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

256  {
257  DBerror err;
258  sDatabase.RunQuery(err,
259  "UPDATE mapDynamicData SET factionKills = factionKills + 1, factionKills24Hour = factionKills24Hour + 1 WHERE solarSystemID = %u", sysID);
260 }
#define sDatabase
Definition: dbcore.h:199
Definition: dbcore.h:39

Here is the caller graph for this function:

void MapDB::AddJump ( uint32  sysID)
static

Definition at line 218 of file MapDB.cpp.

References sDatabase.

Referenced by SystemManager::AddClient(), Client::CynoJump(), SystemManager::RemoveClient(), and Client::StargateJump().

219 {
220  DBerror err;
221  sDatabase.RunQuery(err, "UPDATE mapDynamicData SET jumpsHour = jumpsHour + 1 WHERE solarSystemID = %u", sysID );
222 }
#define sDatabase
Definition: dbcore.h:199
Definition: dbcore.h:39

Here is the caller graph for this function:

void MapDB::AddKill ( uint32  sysID)
static

Definition at line 250 of file MapDB.cpp.

References sDatabase.

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

250  {
251  DBerror err;
252  sDatabase.RunQuery(err,
253  "UPDATE mapDynamicData SET killsHour = killsHour + 1, kills24Hour = kills24Hour + 1 WHERE solarSystemID = %u", sysID);
254 }
#define sDatabase
Definition: dbcore.h:199
Definition: dbcore.h:39

Here is the caller graph for this function:

void MapDB::AddPodKill ( uint32  sysID)
static

killsHour, kills24Hours

Definition at line 262 of file MapDB.cpp.

References sDatabase.

Referenced by ShipSE::Killed().

262  {
263  DBerror err;
264  sDatabase.RunQuery(err,
265  "UPDATE mapDynamicData SET podKillsHour = podKillsHour + 1, podKills24Hour = podKills24Hour + 1 WHERE solarSystemID = %u", sysID);
266 }
#define sDatabase
Definition: dbcore.h:199
Definition: dbcore.h:39

Here is the caller graph for this function:

PyRep * MapDB::GetDynamicData ( uint8  type,
uint8  time 
)
static

added jumpsHour and numPilots data inserts. 16Mar14 added killsHour, factionKills, podKillsHour 24Mar14 NOTE: DB has fields for timing the *Hour and *24Hour parts. need to write checks for that once everything else is working. NOTE: use averages for *Hour based on current data and serverUpTime. may be able to do 24Hour same way.

Definition at line 153 of file MapDB.cpp.

References DBResultToRowset(), DBResultRow::GetInt(), DBQueryResult::GetRow(), sDatabase, PyTuple::SetItem(), and PyDict::SetItem().

153  {
154  DBQueryResult res;
155  switch (type) {
156  case 1: {
157  sDatabase.RunQuery(res, "SELECT solarSystemID, jumpsHour AS value1 FROM mapDynamicData" );
158  } break;
159  case 2: {
160  // cynos arent implemented yet, so this will always return 0
161  sDatabase.RunQuery(res, "SELECT solarSystemID, moduleCnt, structureCnt FROM mapDynamicData WHERE active=1" );
162  DBResultRow row;
163  PyDict* dict = new PyDict();
164  while (res.GetRow(row)) {
165  PyTuple* inner = new PyTuple(2);
166  inner->SetItem(0, new PyInt(row.GetInt(1))); // cyno modules on ships (fields)
167  inner->SetItem(1, new PyInt(row.GetInt(2))); // cyno generators (POS structures)
168  dict->SetItem(new PyInt(row.GetInt(0)), inner);
169  }
170  return dict;
171  };
172  case 3: {
173  if (time == 1) {
174  sDatabase.RunQuery(res, "SELECT solarSystemID, killsHour AS value1, factionKills AS value2, podKillsHour AS value3 FROM mapDynamicData" );
175  } else if (time == 24) {
176  sDatabase.RunQuery(res, "SELECT solarSystemID, kills24Hour AS value1, factionKills24Hour AS value2, podKills24Hour AS value3 FROM mapDynamicData" );
177  }
178  } break;
179  case 4: {
180  // not coded in client
181  } break;
182  case 5: { //FacWarSvc.GetMostDangerousSystems
183  sDatabase.RunQuery(res, "SELECT solarSystemID, killsHour AS value1, factionKills AS value2 FROM mapDynamicData" );
184  //, kills24Hour AS value3, factionKills24Hour AS value4, podKills24Hour AS value5
185  } break;
186  default:
187  return nullptr;
188  }
189 
190  return DBResultToRowset(res);
191 }
#define sDatabase
Definition: dbcore.h:199
int32 GetInt(uint32 index) const
Definition: dbcore.cpp:635
Python's dictionary.
Definition: PyRep.h:719
Python tuple.
Definition: PyRep.h:567
bool GetRow(DBResultRow &into)
Definition: dbcore.cpp:552
void SetItem(size_t index, PyRep *object)
Stores Python object.
Definition: PyRep.h:610
PyObject * DBResultToRowset(DBQueryResult &result)
Definition: EVEDBUtils.cpp:81
Python integer.
Definition: PyRep.h:231
void SetItem(PyRep *key, PyRep *value)
SetItem adds or sets a database entry.
Definition: PyRep.cpp:713

Here is the call graph for this function:

PyObject * MapDB::GetPseudoSecurities ( )
static

Definition at line 31 of file MapDB.cpp.

References DBerror::c_str(), codelog, DBResultToRowset(), DBQueryResult::error, and sDatabase.

Referenced by MapData::Populate().

31  {
32  DBQueryResult res;
33 
34  if (!sDatabase.RunQuery(res, "SELECT solarSystemID, security FROM mapSolarSystems")) {
35  codelog(DATABASE__ERROR, "Error in query: %s", res.error.c_str());
36  return nullptr;
37  }
38 
39  return DBResultToRowset(res);
40 }
#define sDatabase
Definition: dbcore.h:199
const char * c_str() const
Definition: dbcore.h:48
#define codelog(type, fmt,...)
Definition: logsys.h:128
PyObject * DBResultToRowset(DBQueryResult &result)
Definition: EVEDBUtils.cpp:81
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

Here is the caller graph for this function:

PyObject * MapDB::GetSolSystemVisits ( uint32  charID)
static

Definition at line 96 of file MapDB.cpp.

References DBerror::c_str(), codelog, DBResultToRowset(), DBQueryResult::error, and sDatabase.

97 {
98  DBQueryResult res;
99 
100  if (!sDatabase.RunQuery(res,
101  " SELECT"
102  " solarSystemID,"
103  " visits,"
104  " lastDateTime"
105  " FROM chrVisitedSystems"
106  " WHERE characterID = %u", charID ))
107  {
108  codelog(DATABASE__ERROR, "Error in query: %s", res.error.c_str());
109  return nullptr;
110  }
111 
112  return DBResultToRowset(res);
113 }
#define sDatabase
Definition: dbcore.h:199
const char * c_str() const
Definition: dbcore.h:48
#define codelog(type, fmt,...)
Definition: logsys.h:128
PyObject * DBResultToRowset(DBQueryResult &result)
Definition: EVEDBUtils.cpp:81
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

void MapDB::GetStationCount ( DBQueryResult res)
static

Definition at line 84 of file MapDB.cpp.

References DBerror::c_str(), codelog, DBQueryResult::error, and sDatabase.

Referenced by StaticDataMgr::Populate().

85 {
86  if (!sDatabase.RunQuery(res,
87  "SELECT map.solarSystemID, count(sta.stationID)"
88  " FROM mapSolarSystems AS map"
89  " LEFT JOIN staStations AS sta USING(solarSystemID)"
90  " GROUP BY map.solarSystemID"))
91  {
92  codelog(DATABASE__ERROR, "Error in query: %s", res.error.c_str());
93  }
94 }
#define sDatabase
Definition: dbcore.h:199
const char * c_str() const
Definition: dbcore.h:48
#define codelog(type, fmt,...)
Definition: logsys.h:128
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

Here is the caller graph for this function:

PyObject * MapDB::GetStationExtraInfo ( )
static

Definition at line 42 of file MapDB.cpp.

References DBerror::c_str(), codelog, DBResultToRowset(), DBQueryResult::error, and sDatabase.

Referenced by MapData::Populate().

42  {
43  DBQueryResult res;
44 
45  if (!sDatabase.RunQuery(res,
46  "SELECT"
47  " stationID,"
48  " solarSystemID,"
49  " operationID,"
50  " stationTypeID,"
51  " corporationID AS ownerID"
52  " FROM staStations" )) {
53  codelog(DATABASE__ERROR, "Error in query: %s", res.error.c_str());
54  return nullptr;
55  }
56 
57  return DBResultToRowset(res);
58 }
#define sDatabase
Definition: dbcore.h:199
const char * c_str() const
Definition: dbcore.h:48
#define codelog(type, fmt,...)
Definition: logsys.h:128
PyObject * DBResultToRowset(DBQueryResult &result)
Definition: EVEDBUtils.cpp:81
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

Here is the caller graph for this function:

PyObject * MapDB::GetStationOpServices ( )
static

Definition at line 60 of file MapDB.cpp.

References DBerror::c_str(), codelog, DBResultToRowset(), DBQueryResult::error, and sDatabase.

Referenced by MapData::Populate().

60  {
61  DBQueryResult res;
62 
63  if (!sDatabase.RunQuery(res,
64  "SELECT operationID, serviceID FROM staOperationServices")) {
65  codelog(DATABASE__ERROR, "Error in query: %s", res.error.c_str());
66  return nullptr;
67  }
68 
69  return DBResultToRowset(res);
70 }
#define sDatabase
Definition: dbcore.h:199
const char * c_str() const
Definition: dbcore.h:48
#define codelog(type, fmt,...)
Definition: logsys.h:128
PyObject * DBResultToRowset(DBQueryResult &result)
Definition: EVEDBUtils.cpp:81
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

Here is the caller graph for this function:

PyObject * MapDB::GetStationServiceInfo ( )
static

Definition at line 72 of file MapDB.cpp.

References DBerror::c_str(), codelog, DBResultToRowset(), DBQueryResult::error, and sDatabase.

Referenced by MapData::Populate().

72  {
73  DBQueryResult res;
74 
75  if (!sDatabase.RunQuery(res,
76  "SELECT serviceID, serviceName FROM staServices ")) {
77  codelog(DATABASE__ERROR, "Error in query: %s", res.error.c_str());
78  return nullptr;
79  }
80 
81  return DBResultToRowset(res);
82 }
#define sDatabase
Definition: dbcore.h:199
const char * c_str() const
Definition: dbcore.h:48
#define codelog(type, fmt,...)
Definition: logsys.h:128
PyObject * DBResultToRowset(DBQueryResult &result)
Definition: EVEDBUtils.cpp:81
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

Here is the caller graph for this function:

void MapDB::GetSystemJumps ( DBQueryResult res)
static

Definition at line 194 of file MapDB.cpp.

References sDatabase.

Referenced by MapData::Populate().

195 {
196  //sDatabase.RunQuery(res, "SELECT ctype, fromreg, fromcon, fromsol, tosol, tocon, toreg FROM mapConnections");
197  sDatabase.RunQuery(res, "SELECT ctype, fromsol, tosol FROM mapConnections");
198 }
#define sDatabase
Definition: dbcore.h:199

Here is the caller graph for this function:

void MapDB::LoadDynamicData ( uint32  sysID,
SystemKillData data 
)
static

Definition at line 117 of file MapDB.cpp.

References DBerror::c_str(), codelog, DBQueryResult::error, SystemKillData::faction24DateTime, SystemKillData::factionDateTime, SystemKillData::factionKills, SystemKillData::factionKills24Hour, DBResultRow::GetInt(), DBResultRow::GetInt64(), DBQueryResult::GetRow(), SystemKillData::kills24DateTime, SystemKillData::kills24Hour, SystemKillData::killsDateTime, SystemKillData::killsHour, SystemKillData::pod24DateTime, SystemKillData::podDateTime, SystemKillData::podKills24Hour, SystemKillData::podKillsHour, and sDatabase.

Referenced by SystemManager::BootSystem().

118 {
119  DBQueryResult res;
120  if (!sDatabase.RunQuery(res,
121  "SELECT killsHour, kills24Hour, factionKills, factionKills24Hour, podKillsHour, podKills24Hour,"
122  " killsDateTime, kills24DateTime, podDateTime, pod24DateTime, factionDateTime, faction24DateTime"
123  " FROM mapDynamicData"
124  " WHERE solarSystemID = %u", sysID))
125  {
126  codelog(DATABASE__ERROR, "Error in query: %s", res.error.c_str());
127  return;
128  }
129  DBResultRow row;
130  if (res.GetRow(row)) {
131  data.killsHour = row.GetInt(0);
132  data.kills24Hour = row.GetInt(1);
133  data.factionKills = row.GetInt(2);
134  data.factionKills24Hour = row.GetInt(3);
135  data.podKillsHour = row.GetInt(4);
136  data.podKills24Hour = row.GetInt(5);
137  data.killsDateTime = row.GetInt64(6);
138  data.kills24DateTime = row.GetInt64(7);
139  data.factionDateTime = row.GetInt64(8);
140  data.faction24DateTime = row.GetInt64(9);
141  data.podDateTime = row.GetInt64(10);
142  data.pod24DateTime = row.GetInt64(11);
143  } else {
144  data = SystemKillData();
145  }
146 }
#define sDatabase
Definition: dbcore.h:199
int32 GetInt(uint32 index) const
Definition: dbcore.cpp:635
uint16 factionKills24Hour
bool GetRow(DBResultRow &into)
Definition: dbcore.cpp:552
const char * c_str() const
Definition: dbcore.h:48
#define codelog(type, fmt,...)
Definition: logsys.h:128
DBerror error
Definition: dbcore.h:69
int64 GetInt64(uint32 index) const
Definition: dbcore.cpp:670

Here is the call graph for this function:

Here is the caller graph for this function:

void MapDB::ManipulateTimeData ( )
static

Definition at line 270 of file MapDB.cpp.

Referenced by EntityList::Process().

271 {
272 
273 }

Here is the caller graph for this function:

void MapDB::SetSystemActive ( uint32  sysID,
bool  active = false 
)
static

UPDATE: this is populated when db is created. we are not deleting from mapDynamicData, but setting active as needed notes concerning previous system configuration removed

Definition at line 212 of file MapDB.cpp.

References sDatabase.

Referenced by SystemManager::BootSystem(), and SystemManager::UnloadSystem().

213 {
214  DBerror err;
215  sDatabase.RunQuery(err, "UPDATE mapDynamicData SET active = %u WHERE solarSystemID = %u", active?1:0, sysID );
216 }
#define sDatabase
Definition: dbcore.h:199
Definition: dbcore.h:39

Here is the caller graph for this function:

void MapDB::SystemStartup ( )
static

Definition at line 201 of file MapDB.cpp.

References sDatabase.

Referenced by main().

202 {
203  DBerror err;
204  sDatabase.RunQuery(err, "UPDATE mapDynamicData SET active = 0, jumpsHour = 0, pilotsDocked = 0, pilotsInSpace = 0, moduleCnt = 0, structureCnt = 0 WHERE 1");
205 }
#define sDatabase
Definition: dbcore.h:199
Definition: dbcore.h:39

Here is the caller graph for this function:

void MapDB::UpdateJumps ( uint32  sysID,
uint16  jumps 
)
static

factionKills, factionKills24Hour

Definition at line 232 of file MapDB.cpp.

References sLog.

233 {
234  //DBerror err;
235  //sDatabase.RunQuery(err, "UPDATE mapDynamicData SET jumpsHour = %u WHERE solarSystemID = %u", jumps, sysID );
236  sLog.Warning("MapDB::UpdateJumps", "UPDATE mapDynamicData SET jumpsHour = %u WHERE solarSystemID = %u", jumps, sysID);
237 }
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
void MapDB::UpdateKillData ( uint32  sysID,
SystemKillData data 
)
static

Definition at line 239 of file MapDB.cpp.

References SystemKillData::faction24DateTime, SystemKillData::factionDateTime, SystemKillData::factionKills, SystemKillData::factionKills24Hour, SystemKillData::kills24DateTime, SystemKillData::kills24Hour, SystemKillData::killsDateTime, SystemKillData::killsHour, SystemKillData::pod24DateTime, SystemKillData::podDateTime, SystemKillData::podKills24Hour, SystemKillData::podKillsHour, and sDatabase.

Referenced by SystemManager::ManipulateTimeData().

240 {
241  DBerror err;
242  sDatabase.RunQuery(err, "UPDATE mapDynamicData SET killsHour = %u, kills24Hour = %u, factionKills = %u, factionKills24Hour = %u,"
243  " podKillsHour = %u, podKills24Hour = %u, killsDateTime = %li, kills24DateTime = %li, podDateTime = %li, pod24DateTime = %li,"
244  " factionDateTime = %li, faction24DateTime = %li",
247 }
#define sDatabase
Definition: dbcore.h:199
uint16 factionKills24Hour
Definition: dbcore.h:39

Here is the caller graph for this function:

void MapDB::UpdatePilotCount ( uint32  sysID,
uint16  docked = 0,
uint16  space = 0 
)
static

Definition at line 225 of file MapDB.cpp.

References sDatabase.

Referenced by SystemManager::SetDockCount(), and SystemManager::UpdateData().

226 {
227  DBerror err;
228  sDatabase.RunQuery(err, "UPDATE mapDynamicData SET pilotsDocked = %u, pilotsInSpace = %u WHERE solarSystemID = %u",
229  docked, space, sysID );
230 }
#define sDatabase
Definition: dbcore.h:199
Definition: dbcore.h:39

Here is the caller graph for this function:


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