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

#include "AgentDB.h"

Static Public Member Functions

AgentDB.cpp

Agent DB operations original agent code by zhur, this was completely rewritten based on new data.

: Allan

Date
: 24 June 2018
static void LoadAgentData (uint32 agentID, AgentData &data)
 
static void LoadAgentSkills (uint32 agentID, std::map< uint16, uint8 > &data)
 

Detailed Description

Definition at line 22 of file AgentDB.h.

Member Function Documentation

void AgentDB::LoadAgentData ( uint32  agentID,
AgentData data 
)
static
Todo:
fix this....not all agents have an entry in chrNPCCharacters table.
Todo:
there may be some errors here with agents in space or NOT in stations....will have to test and fix as they come up.

Definition at line 20 of file AgentDB.cpp.

References _log, AgentData::bloodlineID, DBerror::c_str(), codelog, AgentData::corporationID, AgentData::divisionID, AgentData::enemyCorp, DBQueryResult::error, AgentData::factionID, AgentData::friendCorp, AgentData::gender, DBResultRow::GetBool(), DBResultRow::GetInt(), DBQueryResult::GetRow(), DBResultRow::GetText(), DBResultRow::GetUInt(), DBResultRow::IsNull(), AgentData::level, AgentData::locationID, AgentData::locationTypeID, AgentData::locator, AgentData::name, AgentData::quality, AgentData::raceID, AgentData::research, Agents::Type::Research, sDatabase, sDataMgr, AgentData::solarSystemID, AgentData::stationID, and AgentData::typeID.

Referenced by Agent::Load().

21 {
22  DBQueryResult res;
23  if(!sDatabase.RunQuery(res,
24  "SELECT"
25  " agt.agentTypeID,"
26  " agt.divisionID,"
27  " agt.level,"
28  " agt.quality,"
29  " agt.corporationID,"
30  " agt.locationID, " //5
31  " agt.isLocator,"
32  " chr.solarSystemID,"
33  " chr.stationID,"
34  " chr.gender,"
35  " bl.bloodlineID," //10
36  " itm.typeID, "
37  " crp.friendID, "
38  " crp.enemyID, "
39  " crp.factionID, "
40  " chr.characterName " //15
41  " FROM agtAgents AS agt"
42  " LEFT JOIN chrNPCCharacters AS chr ON chr.characterID = agt.agentID"
43  " LEFT JOIN crpNPCCorporations AS crp ON crp.corporationID = agt.corporationID"
44  " LEFT JOIN bloodlineTypes AS bl ON bl.typeID = chr.typeID"
45  " LEFT JOIN mapDenormalize AS itm ON itm.itemID = agt.locationID"
46  " WHERE agt.agentID = %u", agentID))
47  {
48  codelog(DATABASE__ERROR, "Error in GetAgents query: %s", res.error.c_str());
49  return;
50  }
51 
53  DBResultRow row;
54  if (res.GetRow(row)) {
55  if (row.GetUInt(10) == 0) {
56  _log(DATABASE__MESSAGE, "No charTypeID for Agent %u", agentID);
57  return;
58  }
59  data.typeID = row.GetUInt(0);
60  data.divisionID = row.GetUInt(1);
61  data.level = row.GetUInt(2);
62  data.quality = row.GetInt(3);
63  data.corporationID = row.GetUInt(4);
64  data.locationID = row.GetUInt(5);
65  data.locator = row.GetBool(6);
66  data.solarSystemID = row.GetUInt(7);
67  data.stationID = row.GetUInt(8);
68  data.gender = row.GetBool(9);
69  data.bloodlineID = row.GetUInt(10);
70  data.locationTypeID = row.GetUInt(11);
71  data.friendCorp = (row.IsNull(12) ? 0 : row.GetInt(12));
72  data.enemyCorp = (row.IsNull(13) ? 0 : row.GetInt(13));
73  data.factionID = row.GetInt(14);
74  data.raceID = sDataMgr.GetFactionRace(data.factionID);
75  data.name = row.GetText(15);
76  data.research = (data.typeID == Agents::Type::Research);
77  }
78 }
uint16 locationTypeID
Definition: EVE_Agent.h:21
uint32 friendCorp
Definition: EVE_Agent.h:26
#define sDatabase
Definition: dbcore.h:199
const char * GetText(uint32 index) const
Definition: dbcore.h:104
#define _log(type, fmt,...)
Definition: logsys.h:124
uint32 locationID
Definition: EVE_Agent.h:25
int32 GetInt(uint32 index) const
Definition: dbcore.cpp:635
std::string name
Definition: EVE_Agent.h:29
uint32 GetUInt(uint32 index) const
Definition: dbcore.cpp:658
bool gender
Definition: EVE_Agent.h:12
uint32 stationID
Definition: EVE_Agent.h:24
int8 quality
Definition: EVE_Agent.h:15
uint8 level
Definition: EVE_Agent.h:16
uint16 typeID
Definition: EVE_Agent.h:20
bool locator
Definition: EVE_Agent.h:13
bool GetRow(DBResultRow &into)
Definition: dbcore.cpp:552
bool GetBool(uint32 index) const
Definition: dbcore.cpp:647
const char * c_str() const
Definition: dbcore.h:48
bool research
Definition: EVE_Agent.h:14
#define codelog(type, fmt,...)
Definition: logsys.h:128
uint8 divisionID
Definition: EVE_Agent.h:18
uint32 factionID
Definition: EVE_Agent.h:28
bool IsNull(uint32 index) const
Definition: dbcore.h:102
uint32 corporationID
Definition: EVE_Agent.h:22
DBerror error
Definition: dbcore.h:69
uint8 raceID
Definition: EVE_Agent.h:17
uint32 solarSystemID
Definition: EVE_Agent.h:23
uint32 enemyCorp
Definition: EVE_Agent.h:27
uint8 bloodlineID
Definition: EVE_Agent.h:19
#define sDataMgr

Here is the call graph for this function:

Here is the caller graph for this function:

void AgentDB::LoadAgentSkills ( uint32  agentID,
std::map< uint16, uint8 > &  data 
)
static

Definition at line 80 of file AgentDB.cpp.

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

Referenced by Agent::Load().

81 {
82  // SELECT typeID, level FROM agtSkillLevel WHERE agentID = %u
83  DBQueryResult res;
84  if (!sDatabase.RunQuery(res, "SELECT typeID, level FROM agtSkillLevel WHERE agentID = %u", agentID))
85  codelog(DATABASE__ERROR, "Error in LoadAgentSkills query: %s", res.error.c_str());
86 
87  DBResultRow row;
88  while (res.GetRow(row))
89  data[row.GetInt(0)] = row.GetInt(1);
90 }
#define sDatabase
Definition: dbcore.h:199
int32 GetInt(uint32 index) const
Definition: dbcore.cpp:635
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:

Here is the caller graph for this function:


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