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

#include "SystemDB.h"

Inheritance diagram for SystemDB:
Collaboration diagram for SystemDB:

Public Member Functions

PyObjectListFactions ()
 
void GetBelts (uint32 systemID, std::vector< DBGPointEntity > &beltIDs, uint8 &total)
 
void GetMoons (uint32 systemID, std::vector< DBGPointEntity > &moonIDs, uint8 &total)
 
void GetPlanets (uint32 systemID, std::vector< DBGPointEntity > &planetIDs, uint8 &total)
 
double GetItemTypeRadius (uint32 typeID)
 
double GetCelestialRadius (uint32 itemID)
 
- Public Member Functions inherited from ServiceDB
uint32 GetStationOwner (uint32 stationID)
 

Static Public Member Functions

static PyObjectListJumps (uint32)
 
static PyPackedRowGetSolarSystem (uint32 ssid)
 
static void GetGates (uint32 systemID, std::vector< DBGPointEntity > &gateIDs)
 
static bool GetWrecksToTypes (DBQueryResult &res)
 
static void GetLootGroups (DBQueryResult &res)
 
static void GetLootGroupTypes (DBQueryResult &res)
 
static uint32 GetObjectLocationID (uint32 itemID)
 
static GPoint GetSolarSystemPosition (uint32 systemID)
 
static bool LoadSystemStaticEntities (uint32 systemID, std::vector< DBSystemEntity > &into)
 
static bool LoadSystemDynamicEntities (uint32 systemID, std::vector< DBSystemDynamicEntity > &into)
 
static bool LoadPlayerDynamicEntities (uint32 systemID, std::vector< DBSystemDynamicEntity > &into)
 
- 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

- 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 32 of file SystemDB.h.

Member Function Documentation

void SystemDB::GetBelts ( uint32  systemID,
std::vector< DBGPointEntity > &  beltIDs,
uint8 total 
)

Definition at line 381 of file SystemDB.cpp.

References DBResultRow::GetDouble(), DBQueryResult::GetRow(), DBResultRow::GetUInt(), DBGPointEntity::idx, DBGPointEntity::itemID, DBGPointEntity::position, DBGPointEntity::radius, and sDatabase.

382 {
383  // groupID = 9
384  DBQueryResult res;
385  sDatabase.RunQuery(res, "SELECT itemID, x, y, z, radius FROM mapDenormalize WHERE solarSystemID = %u AND groupID = 9", systemID);
386 
387  DBResultRow row;
388  while(res.GetRow(row)) {
389  DBGPointEntity entry = DBGPointEntity();
390  entry.idx = total;
391  entry.itemID = row.GetUInt(0);
392  entry.position = GPoint (
393  row.GetDouble(1),
394  row.GetDouble(2),
395  row.GetDouble(3)
396  );
397  entry.radius = row.GetDouble(4);
398 
399  beltIDs.push_back(entry);
400  ++total;
401  }
402 }
#define sDatabase
Definition: dbcore.h:199
uint32 GetUInt(uint32 index) const
Definition: dbcore.cpp:658
double GetDouble(uint32 index) const
Definition: dbcore.cpp:693
bool GetRow(DBResultRow &into)
Definition: dbcore.cpp:552
Definition: gpoint.h:33

Here is the call graph for this function:

double SystemDB::GetCelestialRadius ( uint32  itemID)

Definition at line 301 of file SystemDB.cpp.

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

301  {
302  DBQueryResult res;
303  if(!sDatabase.RunQuery(res, "SELECT radius FROM mapDenormalize WHERE itemID=%u", itemID )) {
304  codelog(DATABASE__ERROR, "Error in GetItemTypeRadius query: %s", res.error.c_str());
305  return 10.1;
306  }
307 
308  DBResultRow row;
309  if (res.GetRow(row))
310  return (row.GetDouble(0));
311  return 12.3;
312 }
#define sDatabase
Definition: dbcore.h:199
double GetDouble(uint32 index) const
Definition: dbcore.cpp:693
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
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

Here is the call graph for this function:

void SystemDB::GetGates ( uint32  systemID,
std::vector< DBGPointEntity > &  gateIDs 
)
static

Definition at line 404 of file SystemDB.cpp.

References DBResultRow::GetDouble(), DBQueryResult::GetRow(), DBResultRow::GetUInt(), DBGPointEntity::idx, DBGPointEntity::itemID, DBGPointEntity::position, DBGPointEntity::radius, and sDatabase.

405 {
406  // groupID = 10
407  DBQueryResult res;
408  sDatabase.RunQuery(res, "SELECT itemID, x, y, z, radius FROM mapDenormalize WHERE solarSystemID = %u AND groupID = 10", systemID);
409 
410  uint8 total = 0;
411  DBResultRow row;
412  while(res.GetRow(row)) {
413  DBGPointEntity entry = DBGPointEntity();
414  entry.idx = total;
415  entry.itemID = row.GetUInt(0);
416  entry.position = GPoint (
417  row.GetDouble(1),
418  row.GetDouble(2),
419  row.GetDouble(3)
420  );
421  entry.radius = row.GetDouble(4);
422 
423  gateIDs.push_back(entry);
424  ++total;
425  }
426 }
unsigned __int8 uint8
Definition: eve-compat.h:46
#define sDatabase
Definition: dbcore.h:199
uint32 GetUInt(uint32 index) const
Definition: dbcore.cpp:658
double GetDouble(uint32 index) const
Definition: dbcore.cpp:693
bool GetRow(DBResultRow &into)
Definition: dbcore.cpp:552
Definition: gpoint.h:33

Here is the call graph for this function:

double SystemDB::GetItemTypeRadius ( uint32  typeID)

Definition at line 288 of file SystemDB.cpp.

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

288  {
289  DBQueryResult res;
290  if(!sDatabase.RunQuery(res, "SELECT radius FROM invTypes WHERE typeID=%u", typeID )) {
291  codelog(DATABASE__ERROR, "Error in GetItemTypeRadius query: %s", res.error.c_str());
292  return 0.0;
293  }
294 
295  DBResultRow row;
296  if (res.GetRow(row))
297  return (row.GetDouble(0));
298  return 0.0;
299 }
#define sDatabase
Definition: dbcore.h:199
double GetDouble(uint32 index) const
Definition: dbcore.cpp:693
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

Here is the call graph for this function:

void SystemDB::GetLootGroups ( DBQueryResult res)
static

Definition at line 322 of file SystemDB.cpp.

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

Referenced by StaticDataMgr::Populate().

322  {
323  //if(!sDatabase.RunQuery(res, "SELECT groupID, lootGroupID, dropChance FROM npcLootGroup")) {
324  if(!sDatabase.RunQuery(res, "SELECT npcGroupID, itemGroupID, groupDropChance FROM lootGroup")) {
325  codelog(DATABASE__ERROR, "Error in GetLootGroups query: %s", res.error.c_str());
326  return;
327  }
328 }
#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:

void SystemDB::GetLootGroupTypes ( DBQueryResult res)
static

Definition at line 330 of file SystemDB.cpp.

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

Referenced by StaticDataMgr::Populate().

330  {
331  //if(!sDatabase.RunQuery(res, "SELECT lootGroupID, typeID, chance, minQuantity, maxQuantity FROM npcLootGroupType")) {
332  if(!sDatabase.RunQuery(res, "SELECT itemGroupID, itemID, itemMetaLevel, minAmount, maxAmount FROM lootItemGroup")) {
333  codelog(DATABASE__ERROR, "Error in GetLootGroupTypes query: %s", res.error.c_str());
334  return;
335  }
336 }
#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:

void SystemDB::GetMoons ( uint32  systemID,
std::vector< DBGPointEntity > &  moonIDs,
uint8 total 
)

Definition at line 359 of file SystemDB.cpp.

References DBResultRow::GetDouble(), DBQueryResult::GetRow(), DBResultRow::GetUInt(), DBGPointEntity::idx, DBGPointEntity::itemID, DBGPointEntity::position, DBGPointEntity::radius, and sDatabase.

Referenced by SystemGPoint::GetMoons(), SystemGPoint::GetRandMoon(), and SystemGPoint::GetRandPointOnMoon().

359  {
360 // groupID = 8
361  DBQueryResult res;
362  sDatabase.RunQuery(res, "SELECT itemID, x, y, z, radius FROM mapDenormalize WHERE solarSystemID = %u AND groupID = 8", systemID);
363 
364  DBResultRow row;
365  while(res.GetRow(row)) {
366  DBGPointEntity entry = DBGPointEntity();
367  entry.idx = total;
368  entry.itemID = row.GetUInt(0);
369  entry.position = GPoint (
370  row.GetDouble(1),
371  row.GetDouble(2),
372  row.GetDouble(3)
373  );
374  entry.radius = row.GetDouble(4);
375 
376  moonIDs.push_back(entry);
377  ++total;
378  }
379 }
#define sDatabase
Definition: dbcore.h:199
uint32 GetUInt(uint32 index) const
Definition: dbcore.cpp:658
double GetDouble(uint32 index) const
Definition: dbcore.cpp:693
bool GetRow(DBResultRow &into)
Definition: dbcore.cpp:552
Definition: gpoint.h:33

Here is the call graph for this function:

Here is the caller graph for this function:

uint32 SystemDB::GetObjectLocationID ( uint32  itemID)
static

Definition at line 275 of file SystemDB.cpp.

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

275  {
276  DBQueryResult res;
277  if(!sDatabase.RunQuery(res, "SELECT locationID FROM entity WHERE itemID=%u", itemID )) {
278  codelog(DATABASE__ERROR, "Error in GetObjectLocationID query: %s", res.error.c_str());
279  return 0;
280  }
281 
282  DBResultRow row;
283  if (res.GetRow(row))
284  return (row.GetUInt(0));
285  return 0;
286 }
#define sDatabase
Definition: dbcore.h:199
uint32 GetUInt(uint32 index) const
Definition: dbcore.cpp:658
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
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

Here is the call graph for this function:

void SystemDB::GetPlanets ( uint32  systemID,
std::vector< DBGPointEntity > &  planetIDs,
uint8 total 
)

Definition at line 338 of file SystemDB.cpp.

References DBResultRow::GetDouble(), DBQueryResult::GetRow(), DBResultRow::GetUInt(), DBGPointEntity::idx, DBGPointEntity::itemID, DBGPointEntity::position, DBGPointEntity::radius, and sDatabase.

Referenced by SystemGPoint::Get2RandPlanets(), SystemGPoint::Get3RandPlanets(), SystemGPoint::GetAnomalyPoint(), SystemGPoint::GetPlanets(), SystemGPoint::GetRandPlanet(), and SystemGPoint::GetRandPointOnPlanet().

338  {
339 // groupID = 7
340  DBQueryResult res;
341  sDatabase.RunQuery(res, "SELECT itemID, x, y, z, radius FROM mapDenormalize WHERE solarSystemID = %u AND groupID = 7", systemID);
342 
343  DBResultRow row;
344  while(res.GetRow(row)) {
345  DBGPointEntity entry = DBGPointEntity();
346  entry.idx = total;
347  entry.itemID = row.GetUInt(0);
348  entry.position = GPoint (
349  row.GetDouble(1),
350  row.GetDouble(2),
351  row.GetDouble(3)
352  );
353  entry.radius = row.GetDouble(4);
354  planetIDs.push_back(entry);
355  ++total;
356  }
357 }
#define sDatabase
Definition: dbcore.h:199
uint32 GetUInt(uint32 index) const
Definition: dbcore.cpp:658
double GetDouble(uint32 index) const
Definition: dbcore.cpp:693
bool GetRow(DBResultRow &into)
Definition: dbcore.cpp:552
Definition: gpoint.h:33

Here is the call graph for this function:

Here is the caller graph for this function:

PyPackedRow * SystemDB::GetSolarSystem ( uint32  ssid)
static

Definition at line 58 of file SystemDB.cpp.

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

58  {
59  DBQueryResult res;
60  if (!sDatabase.RunQuery(res,
61  "SELECT "
62  " mss.solarSystemID,"
63  " mss.solarSystemName,"
64  " mss.x, mss.y, mss.z,"
65  " mss.radius,"
66  " mss.security,"
67  " mss.constellationID,"
68  " mss.factionID,"
69  " mss.sunTypeID,"
70  " mss.regionID,"
71  " mlwc.wormholeClassID"
72  " FROM mapSolarSystems AS mss"
73  " LEFT JOIN mapLocationWormholeClasses AS mlwc ON mlwc.locationID = mss.regionID"
74  " WHERE solarSystemID=%u", ssid ))
75  {
76  codelog(DATABASE__ERROR, "Error in GetSolarSystem query: %s", res.error.c_str());
77  return nullptr;
78  }
79 
80  DBResultRow row;
81  if(!res.GetRow(row)) {
82  codelog(DATABASE__ERROR, "Error in GetSolarSystem query: no solarsystem for id %u", ssid);
83  return nullptr;
84  }
85 
86  return DBRowToPackedRow(row);
87 }
#define sDatabase
Definition: dbcore.h:199
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
PyPackedRow * DBRowToPackedRow(DBResultRow &row)
Definition: EVEDBUtils.cpp:453

Here is the call graph for this function:

GPoint SystemDB::GetSolarSystemPosition ( uint32  systemID)
static

Definition at line 89 of file SystemDB.cpp.

References _log, DBerror::c_str(), codelog, DBQueryResult::error, DBQueryResult::GetRow(), DBQueryResult::GetRowCount(), NULL_ORIGIN(), and sDatabase.

89  {
90  DBQueryResult res;
91  if(!sDatabase.RunQuery(res,
92  "SELECT x,y,z"
93  " FROM mapSolarSystems WHERE solarSystemID=%u",
94  systemID))
95  {
96  codelog(DATABASE__ERROR, "Error in GetSolarSystemPosition query: %s", res.error.c_str());
97  return NULL_ORIGIN;
98  }
99 
100  _log(DATABASE__RESULTS, "GetSolarSystemPosition returned %u items", res.GetRowCount());
101 
102  DBResultRow row;
103  GPoint point(NULL_ORIGIN);
104  if (res.GetRow(row))
105  point = GPoint(row.GetDouble(0), row.GetDouble(1), row.GetDouble(2));
106 
107  return point;
108 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
bool GetRow(DBResultRow &into)
Definition: dbcore.cpp:552
Definition: gpoint.h:33
const char * c_str() const
Definition: dbcore.h:48
#define codelog(type, fmt,...)
Definition: logsys.h:128
static const GPoint NULL_ORIGIN(0, 0, 0)
DBerror error
Definition: dbcore.h:69
size_t GetRowCount()
Definition: dbcore.h:72

Here is the call graph for this function:

bool SystemDB::GetWrecksToTypes ( DBQueryResult res)
static

Definition at line 314 of file SystemDB.cpp.

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

Referenced by StaticDataMgr::Populate().

314  {
315  if(!sDatabase.RunQuery(res, "SELECT typeID, wreckTypeID FROM invTypesToWrecks")) {
316  codelog(DATABASE__ERROR, "Error in GetWrecksToTypes query: %s", res.error.c_str());
317  return false;
318  }
319  return true;
320 }
#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 * SystemDB::ListFactions ( )

Definition at line 31 of file SystemDB.cpp.

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

31  {
32  DBQueryResult res;
33  if(!sDatabase.RunQuery(res, "SELECT factionID FROM facFactions")) {
34  codelog(DATABASE__ERROR, "Error in ListFactions query: %s", res.error.c_str());
35  return nullptr;
36  }
37 
38  return DBResultToRowset(res);
39 }
#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:

PyObject * SystemDB::ListJumps ( uint32  stargateID)
static

Definition at line 41 of file SystemDB.cpp.

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

Referenced by StargateSE::LoadExtras().

41  {
42  DBQueryResult res;
43  if(!sDatabase.RunQuery(res,
44  "SELECT "
45  " celestialID AS toCelestialID,"
46  " solarSystemID AS locationID"
47  " FROM mapJumps "
48  " LEFT JOIN mapDenormalize ON celestialID=itemID"
49  " WHERE stargateID=%u", stargateID))
50  {
51  codelog(DATABASE__ERROR, "Error in ListJumps query: %s", res.error.c_str());
52  return nullptr;
53  }
54 
55  return DBResultToRowset(res);
56 }
#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:

bool SystemDB::LoadPlayerDynamicEntities ( uint32  systemID,
std::vector< DBSystemDynamicEntity > &  into 
)
static

Definition at line 208 of file SystemDB.cpp.

References _log, DBSystemDynamicEntity::allianceID, DBerror::c_str(), DBSystemDynamicEntity::categoryID, Scanning::Group::Celestial, EVEDB::invCategories::Charge, codelog, DBSystemDynamicEntity::corporationID, EVEDB::invCategories::Deployable, EVEDB::invCategories::Drone, EVEDB::invCategories::Entity, DBQueryResult::error, DBSystemDynamicEntity::factionID, DBQueryResult::GetRow(), DBQueryResult::GetRowCount(), DBSystemDynamicEntity::groupID, IsCharacterID, IsCorp, DBSystemDynamicEntity::itemID, DBSystemDynamicEntity::itemName, DBSystemDynamicEntity::ownerID, DBSystemDynamicEntity::position, sDatabase, EVEDB::invCategories::StructureUpgrade, and DBSystemDynamicEntity::typeID.

Referenced by SystemManager::LoadPlayerDynamics().

209 {
210  using namespace EVEDB::invCategories;
211  DBQueryResult res, res2;
212  if (!sDatabase.RunQuery(res,
213  "SELECT"
214  " e.itemID,"
215  " e.itemName,"
216  " e.typeID,"
217  " e.ownerID,"
218  " t.groupID,"
219  " g.categoryID," //5
220  " e.x, e.y, e.z" //8
221  " FROM entity AS e"
222  " LEFT JOIN invTypes AS t USING (typeID)"
223  " LEFT JOIN invGroups AS g USING (groupID)"
224  " WHERE e.locationID = %u"
225  " AND g.categoryID IN (%u,%u,%u,%u,%u,%u,%u)"
226  " AND e.ownerID != 1" // get dynamics not owned by the system
227  " ORDER BY e.itemID", // should we order by category? or group?
228  systemID, Celestial/*2*/, // Celestial is for containers (wrecks, jetcans, lsc)
229  Charge /*8*/, // this is for probes and spheres launched from ship (abandonded)
230  Deployable/*22*/, // include deployed items owned by players or corps
231  Drone/*18*/, Entity/*11*/, // Entity also contains NPCs, sentrys, LCOs, and other destructible objects
232  /*Structure*/23, StructureUpgrade/*39*/)) { // this is for POS and POCO
233  codelog(DATABASE__ERROR, "Error in LoadPlayerDynamicEntities query: %s", res.error.c_str());
234  return false;
235  }
236 
237  _log(DATABASE__RESULTS, "LoadPlayerDynamicEntities returned %u items", res.GetRowCount());
238  DBResultRow row, row2;
239  while(res.GetRow(row)) {
241  entry.itemID = row.GetUInt(0);
242  entry.itemName = row.GetText(1);
243  entry.typeID = row.GetUInt(2);
244  entry.ownerID = row.GetInt(3);
245  entry.groupID = row.GetUInt(4);
246  entry.categoryID = row.GetUInt(5);
247  GPoint pos(row.GetDouble(6), row.GetDouble(7), row.GetDouble(8));
248  entry.position = pos;
249 
250  if (IsCorp(entry.ownerID)) {
251  entry.corporationID = entry.ownerID;
252  if (sDatabase.RunQuery(res2, "SELECT allianceID, warFactionID FROM crpCorporation WHERE corporationID = %u", entry.corporationID))
253  if (res2.GetRow(row2)) {
254  entry.allianceID = row2.GetUInt(0);
255  entry.factionID = row2.GetUInt(1);
256  }
257  } else if (IsCharacterID(entry.ownerID)) {
258  if (sDatabase.RunQuery(res2,
259  "SELECT c.corporationID, co.allianceID, co.warFactionID FROM chrCharacters AS c"
260  " LEFT JOIN crpCorporation AS co USING (corporationID)"
261  " WHERE c.characterID = %u", entry.ownerID))
262  {
263  if (res2.GetRow(row2)) {
264  entry.corporationID = row2.GetUInt(0);
265  entry.allianceID = row2.GetUInt(1);
266  entry.factionID = row2.GetUInt(2);
267  }
268  }
269  }
270  into.push_back(entry);
271  }
272  return true;
273 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
bool GetRow(DBResultRow &into)
Definition: dbcore.cpp:552
Definition: gpoint.h:33
const char * c_str() const
Definition: dbcore.h:48
#define codelog(type, fmt,...)
Definition: logsys.h:128
#define IsCharacterID(itemID)
Definition: EVE_Defines.h:206
#define IsCorp(itemID)
Definition: EVE_Defines.h:234
DBerror error
Definition: dbcore.h:69
size_t GetRowCount()
Definition: dbcore.h:72

Here is the call graph for this function:

Here is the caller graph for this function:

bool SystemDB::LoadSystemDynamicEntities ( uint32  systemID,
std::vector< DBSystemDynamicEntity > &  into 
)
static

Definition at line 137 of file SystemDB.cpp.

References _log, EVEDB::invCategories::_System, DBSystemDynamicEntity::allianceID, EVEDB::invCategories::Asteroid, DBerror::c_str(), DBSystemDynamicEntity::categoryID, codelog, DBSystemDynamicEntity::corporationID, DBQueryResult::error, DBSystemDynamicEntity::factionID, DBQueryResult::GetRow(), DBQueryResult::GetRowCount(), DBSystemDynamicEntity::groupID, IsCharacterID, IsCorp, DBSystemDynamicEntity::itemID, DBSystemDynamicEntity::itemName, EVEDB::invCategories::Orbitals, DBSystemDynamicEntity::ownerID, DBSystemDynamicEntity::planetID, DBSystemDynamicEntity::position, sDatabase, EVEDB::invCategories::SovereigntyStructure, and DBSystemDynamicEntity::typeID.

Referenced by SystemManager::LoadSystemDynamics().

137  {
138  using namespace EVEDB::invCategories;
139  DBQueryResult res, res2;
140  if(!sDatabase.RunQuery(res,
141  "SELECT"
142  " e.itemID,"
143  " e.itemName,"
144  " e.ownerID,"
145  " e.typeID,"
146  " t.groupID,"
147  " g.categoryID,"
148  " e.x, e.y, e.z,"
149  " IFNULL(e.customInfo, '0')"
150  " FROM entity AS e"
151  " LEFT JOIN invTypes AS t USING (typeID)"
152  " LEFT JOIN invGroups AS g USING (groupID)"
153  " WHERE e.locationID = %u"
154  " AND g.categoryID NOT IN (%u,%u,%u,%u)" // not Characters, stations, or roids
155  " AND (e.ownerID = 1" // get dynamics owned by the system -include abandonded ships
156  " OR g.categoryID IN (%u,%u))" // or orbitals and SOV structs owned by pc corps
157  " ORDER BY e.itemID",
158  systemID,
159  //exclude categories not applicable for in-space system entities or owned by player/corp :
160  _System/*0*/, /*Character*/1, /*Station*/3, Asteroid/*25*/, //asteroids are owned/controlled by BeltMgr.
161  Orbitals/*46*/,SovereigntyStructure/*40*/ )) {
162  codelog(DATABASE__ERROR, "Error in LoadSystemDynamicEntities query: %s", res.error.c_str());
163  return false;
164  }
165 
166  _log(DATABASE__RESULTS, "LoadSystemDynamicEntities returned %u items", res.GetRowCount());
167 
168  DBResultRow row, row2;
169  while(res.GetRow(row)) {
171  entry.itemID = row.GetUInt(0);
172  entry.itemName = row.GetText(1);
173  entry.ownerID = row.GetInt(2);
174  entry.typeID = row.GetUInt(3);
175  entry.groupID = row.GetUInt(4);
176  entry.categoryID = row.GetUInt(5);
177  GPoint pos(row.GetDouble(6), row.GetDouble(7), row.GetDouble(8));
178  entry.position = pos;
179  entry.planetID = atoi(row.GetText(9));
180 
181  if (IsCorp(entry.ownerID)) {
182  entry.corporationID = entry.ownerID;
183  if (sDatabase.RunQuery(res2, "SELECT allianceID, warFactionID FROM crpCorporation WHERE corporationID = %u", entry.corporationID))
184  if (res2.GetRow(row2)) {
185  entry.allianceID = row2.GetUInt(0);
186  entry.factionID = row2.GetUInt(1);
187  }
188  } else if (IsCharacterID(entry.ownerID)) {
189  if (sDatabase.RunQuery(res2,
190  "SELECT c.corporationID, co.allianceID, co.warFactionID FROM chrCharacters AS c"
191  " LEFT JOIN crpCorporation AS co USING (corporationID)"
192  " WHERE c.characterID = %u", entry.ownerID))
193  {
194  if (res2.GetRow(row2)) {
195  entry.corporationID = row2.GetUInt(0);
196  entry.allianceID = row2.GetUInt(1);
197  entry.factionID = row2.GetUInt(2);
198  }
199  }
200  }
201  into.push_back(entry);
202  }
203 
204  return true;
205 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
bool GetRow(DBResultRow &into)
Definition: dbcore.cpp:552
Definition: gpoint.h:33
const char * c_str() const
Definition: dbcore.h:48
#define codelog(type, fmt,...)
Definition: logsys.h:128
#define IsCharacterID(itemID)
Definition: EVE_Defines.h:206
#define IsCorp(itemID)
Definition: EVE_Defines.h:234
DBerror error
Definition: dbcore.h:69
size_t GetRowCount()
Definition: dbcore.h:72

Here is the call graph for this function:

Here is the caller graph for this function:

bool SystemDB::LoadSystemStaticEntities ( uint32  systemID,
std::vector< DBSystemEntity > &  into 
)
static

Definition at line 110 of file SystemDB.cpp.

References _log, DBerror::c_str(), codelog, DBQueryResult::error, DBQueryResult::GetRow(), DBQueryResult::GetRowCount(), DBSystemEntity::groupID, DBSystemEntity::itemID, DBSystemEntity::radius, sDatabase, and DBSystemEntity::typeID.

Referenced by SystemManager::LoadSystemStatics().

110  {
111  DBQueryResult res;
112  if(!sDatabase.RunQuery(res,
113  "SELECT itemID,typeID,groupID,radius"
114  " FROM mapDenormalize WHERE solarSystemID=%u ORDER BY itemID",
115  systemID))
116  {
117  codelog(DATABASE__ERROR, "Error in LoadSystemStaticEntities query: %s", res.error.c_str());
118  return false;
119  }
120 
121  _log(DATABASE__RESULTS, "LoadSystemStaticEntities returned %u items", res.GetRowCount());
122 
123  DBResultRow row;
124  while(res.GetRow(row)) {
125  DBSystemEntity entry = DBSystemEntity();
126  entry.itemID = row.GetUInt(0);
127  entry.typeID = row.GetInt(1);
128  entry.groupID = row.GetInt(2);
129  entry.radius = row.GetDouble(3);
130  into.push_back(entry);
131  }
132 
133  return true;
134 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
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
size_t GetRowCount()
Definition: dbcore.h:72

Here is the call graph for this function:

Here is the caller graph for this function:


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