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

#include "APICharacterDB.h"

Public Member Functions

 APICharacterDB ()
 
bool GetCharacterSkillsTrained (uint32 characterID, std::vector< std::string > &skillTypeIDList, std::vector< std::string > &skillPointsList, std::vector< std::string > &skillLevelList, std::vector< std::string > &skillPublishedList)
 ? More...
 
bool GetCharacterInfo (uint32 characterID, std::vector< std::string > &charInfoList)
 ? More...
 
bool GetCharacterAttributes (uint32 characterID, std::map< std::string, std::string > &attribList)
 ? More...
 
bool GetCharacterSkillQueue (uint32 characterID, std::vector< std::string > &orderList, std::vector< std::string > &typeIdList, std::vector< std::string > &levelList, std::vector< std::string > &rankList, std::vector< std::string > &skillIdList, std::vector< std::string > &primaryAttrList, std::vector< std::string > &secondaryAttrList, std::vector< std::string > &skillPointsTrainedList)
 ? More...
 
bool GetCharacterImplants (uint32 characterID, std::map< std::string, std::string > &implantList)
 NOT DEFINED YET. More...
 
bool GetCharacterCertificates (uint32 characterID, std::vector< std::string > &certList)
 NOT DEFINED YET. More...
 
bool GetCharacterCorporationRoles (uint32 characterID, std::string roleType, std::map< std::string, std::string > &roleList)
 NOT DEFINED YET. More...
 

Detailed Description

Definition at line 31 of file APICharacterDB.h.

Constructor & Destructor Documentation

APICharacterDB::APICharacterDB ( )

Definition at line 31 of file APICharacterDB.cpp.

32 {
33 }

Member Function Documentation

bool APICharacterDB::GetCharacterAttributes ( uint32  characterID,
std::map< std::string, std::string > &  attribList 
)

?

?

Parameters
[in]?
[in]?
Return values
?

Definition at line 170 of file APICharacterDB.cpp.

References AttrCharisma, AttrIntelligence, AttrMemory, AttrPerception, AttrWillpower, DBResultRow::GetFloat(), DBQueryResult::GetRow(), DBResultRow::GetText(), DBResultRow::GetUInt(), itoa(), sDatabase, and sLog.

Referenced by APICharacterManager::_CharacterSheet(), APICharacterManager::_SkillInTraining(), and APICharacterManager::_SkillQueue().

171 {
172  DBQueryResult res;
173 
174  // Get list of characters and their corporation info from the accountID:
175  if( !sDatabase.RunQuery(res,
176  " SELECT "
177  " itemID, "
178  " attributeID, "
179  " valueInt, "
180  " valueFloat "
181  " FROM entity_attributes "
182  " WHERE itemID = %u ", characterID ))
183  {
184  sLog.Error( "APIAccountDB::GetCharacterAttributes()", "Cannot find characterID %u", characterID );
185  return false;
186  }
187 
188  DBResultRow row;
189  bool row_found = false;
190  while( res.GetRow( row ) )
191  {
192  row_found = true;
193 
194  if( row.GetUInt(1) == AttrCharisma )
195  {
196  // Charisma
197  if( row.GetText(2) == NULL )
198  // Get value from 'entity_attributes' table 'valueFloat' column since 'valueInt' contains 'NULL'
199  attribList.insert( std::pair<std::string, std::string>(std::string(itoa(AttrCharisma)), std::string((row.GetText(3) == NULL ? "0.0" : itoa((uint32)(row.GetFloat(3))))) ));
200  else
201  // Get value from 'entity_attributes' table 'valueInt' column since it does not contain 'NULL'
202  attribList.insert( std::pair<std::string, std::string>(std::string(itoa(AttrCharisma)), std::string((row.GetText(2) == NULL ? "0" : row.GetText(2))) ));
203  }
204 
205  if( row.GetUInt(1) == AttrIntelligence )
206  {
207  // Intelligence
208  if( row.GetText(2) == NULL )
209  // Get value from 'entity_attributes' table 'valueFloat' column since 'valueInt' contains 'NULL'
210  attribList.insert( std::pair<std::string, std::string>(std::string(itoa(AttrIntelligence)), std::string((row.GetText(3) == NULL ? "0.0" : itoa((uint32)(row.GetFloat(3))))) ));
211  else
212  // Get value from 'entity_attributes' table 'valueInt' column since it does not contain 'NULL'
213  attribList.insert( std::pair<std::string, std::string>(std::string(itoa(AttrIntelligence)), std::string((row.GetText(2) == NULL ? "0" : row.GetText(2))) ));
214  }
215 
216  if( row.GetUInt(1) == AttrMemory )
217  {
218  // Memory
219  if( row.GetText(2) == NULL )
220  // Get value from 'entity_attributes' table 'valueFloat' column since 'valueInt' contains 'NULL'
221  attribList.insert( std::pair<std::string, std::string>(std::string(itoa(AttrMemory)), std::string((row.GetText(3) == NULL ? "0.0" : itoa((uint32)(row.GetFloat(3))))) ));
222  else
223  // Get value from 'entity_attributes' table 'valueInt' column since it does not contain 'NULL'
224  attribList.insert( std::pair<std::string, std::string>(std::string(itoa(AttrMemory)), std::string((row.GetText(2) == NULL ? "0" : row.GetText(2))) ));
225  }
226 
227  if( row.GetUInt(1) == AttrPerception )
228  {
229  // Perception
230  if( row.GetText(2) == NULL )
231  // Get value from 'entity_attributes' table 'valueFloat' column since 'valueInt' contains 'NULL'
232  attribList.insert( std::pair<std::string, std::string>(std::string(itoa(AttrPerception)), std::string((row.GetText(3) == NULL ? "0.0" : itoa((uint32)(row.GetFloat(3))))) ));
233  else
234  // Get value from 'entity_attributes' table 'valueInt' column since it does not contain 'NULL'
235  attribList.insert( std::pair<std::string, std::string>(std::string(itoa(AttrPerception)), std::string((row.GetText(2) == NULL ? "0" : row.GetText(2))) ));
236  }
237 
238  if( row.GetUInt(1) == AttrWillpower )
239  {
240  // Will Power
241  if( row.GetText(2) == NULL )
242  // Get value from 'entity_attributes' table 'valueFloat' column since 'valueInt' contains 'NULL'
243  attribList.insert( std::pair<std::string, std::string>(std::string(itoa(AttrWillpower)), std::string((row.GetText(3) == NULL ? "0.0" : itoa((uint32)(row.GetFloat(3))))) ));
244  else
245  // Get value from 'entity_attributes' table 'valueInt' column since it does not contain 'NULL'
246  attribList.insert( std::pair<std::string, std::string>(std::string(itoa(AttrWillpower)), std::string((row.GetText(2) == NULL ? "0" : row.GetText(2))) ));
247  }
248  }
249 
250  if( !row_found )
251  {
252  sLog.Error( "APIServiceDB::GetAccountIdFromUsername()", "res.GetRow(row) failed for unknown reason." );
253  return false;
254  }
255 
256  return true;
257 }
#define sDatabase
Definition: dbcore.h:199
const char * GetText(uint32 index) const
Definition: dbcore.h:104
float GetFloat(uint32 index) const
Definition: dbcore.cpp:682
uint32 GetUInt(uint32 index) const
Definition: dbcore.cpp:658
bool GetRow(DBResultRow &into)
Definition: dbcore.cpp:552
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
unsigned __int32 uint32
Definition: eve-compat.h:50
const char * itoa(int64 num)
Convers num to string.

Here is the call graph for this function:

Here is the caller graph for this function:

bool APICharacterDB::GetCharacterCertificates ( uint32  characterID,
std::vector< std::string > &  certList 
)

NOT DEFINED YET.

?

Parameters
[in]?
[in]?
Return values
?

Definition at line 353 of file APICharacterDB.cpp.

354 {
355  return false;
356 }
bool APICharacterDB::GetCharacterCorporationRoles ( uint32  characterID,
std::string  roleType,
std::map< std::string, std::string > &  roleList 
)

NOT DEFINED YET.

?

Parameters
[in]?
[in]?
Return values
?

Definition at line 358 of file APICharacterDB.cpp.

359 {
360  return false;
361 }
bool APICharacterDB::GetCharacterImplants ( uint32  characterID,
std::map< std::string, std::string > &  implantList 
)

NOT DEFINED YET.

?

Parameters
[in]?
[in]?
Return values
?

Definition at line 348 of file APICharacterDB.cpp.

349 {
350  return false;
351 }
bool APICharacterDB::GetCharacterInfo ( uint32  characterID,
std::vector< std::string > &  charInfoList 
)

?

?

Parameters
[in]?
[in]?
Return values
?

Definition at line 110 of file APICharacterDB.cpp.

References DBQueryResult::GetRow(), DBResultRow::GetText(), sDatabase, and sLog.

Referenced by APICharacterManager::_CharacterSheet().

111 {
112  DBQueryResult res;
113 
114  // Get list of characters and their corporation info from the accountID:
115  if( !sDatabase.RunQuery(res,
116  " SELECT "
117  " character_.balance, "
118  " character_.skillPoints, "
119  " character_.corporationID, "
120  " character_.corpRole, "
121  " character_.rolesAtAll, "
122  " character_.rolesAtBase, "
123  " character_.rolesAtHQ, "
124  " character_.rolesAtOther, "
125  " character_.startDateTime, "
126  " character_.gender, "
127  " chrAncestries.ancestryName, "
128  " chrBloodlines.bloodlineName, "
129  " chrRaces.raceName, "
130  " entity.itemName, "
131  " corporation.corporationName "
132  " FROM character_ "
133  " LEFT JOIN chrAncestries ON character_.ancestryID = chrAncestries.ancestryID "
134  " LEFT JOIN chrBloodlines ON chrAncestries.bloodlineID = chrBloodlines.bloodlineID "
135  " LEFT JOIN chrRaces ON chrBloodlines.raceID = chrRaces.raceID "
136  " LEFT JOIN entity ON entity.itemID = character_.characterID "
137  " LEFT JOIN corporation ON corporation.corporationID = character_.corporationID "
138  " WHERE character_.characterID = %u ", characterID ))
139  {
140  sLog.Error( "APIAccountDB::GetCharacterSkillsTrained()", "Cannot find characterID %u", characterID );
141  return false;
142  }
143 
144  DBResultRow row;
145  if( !res.GetRow(row) )
146  {
147  sLog.Error( "APIServiceDB::GetAccountIdFromUsername()", "res.GetRow(row) failed for unknown reason." );
148  return false;
149  }
150 
151  charInfoList.push_back( std::string(row.GetText(0)) ); // 0. Balance
152  charInfoList.push_back( std::string(row.GetText(1)) ); // 1. Skill Points
153  charInfoList.push_back( std::string(row.GetText(2)) ); // 2. corporationID
154  charInfoList.push_back( std::string(row.GetText(3)) ); // 3. corp Role
155  charInfoList.push_back( std::string(row.GetText(4)) ); // 4. roles At All
156  charInfoList.push_back( std::string(row.GetText(5)) ); // 5. roles At Base
157  charInfoList.push_back( std::string(row.GetText(6)) ); // 6. roles At HQ
158  charInfoList.push_back( std::string(row.GetText(7)) ); // 7. roles At Other
159  charInfoList.push_back( std::string(row.GetText(8)) ); // 8. birthday
160  charInfoList.push_back( std::string(row.GetText(10)) ); // 9. ancestry Name
161  charInfoList.push_back( std::string(row.GetText(11)) ); // 10. bloodline Name
162  charInfoList.push_back( std::string(row.GetText(12)) ); // 11. race Name
163  charInfoList.push_back( std::string(row.GetText(13)) ); // 12. char Name
164  charInfoList.push_back( std::string(row.GetText(14)) ); // 13. corp Name
165  charInfoList.push_back( std::string(row.GetText(9)) ); // 14. gender (0 = female, 1 = male)
166 
167  return true;
168 }
#define sDatabase
Definition: dbcore.h:199
const char * GetText(uint32 index) const
Definition: dbcore.h:104
bool GetRow(DBResultRow &into)
Definition: dbcore.cpp:552
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250

Here is the call graph for this function:

Here is the caller graph for this function:

bool APICharacterDB::GetCharacterSkillQueue ( uint32  characterID,
std::vector< std::string > &  orderList,
std::vector< std::string > &  typeIdList,
std::vector< std::string > &  levelList,
std::vector< std::string > &  rankList,
std::vector< std::string > &  skillIdList,
std::vector< std::string > &  primaryAttrList,
std::vector< std::string > &  secondaryAttrList,
std::vector< std::string > &  skillPointsTrainedList 
)

?

?

Parameters
[in]?
[in]?
Return values
?

Definition at line 259 of file APICharacterDB.cpp.

References AttrPrimaryAttribute, AttrSecondaryAttribute, AttrSkillPoints, AttrSkillTimeConstant, DBResultRow::GetFloat(), DBQueryResult::GetRow(), DBResultRow::GetText(), DBResultRow::GetUInt(), itoa(), sDatabase, and sLog.

Referenced by APICharacterManager::_SkillInTraining(), and APICharacterManager::_SkillQueue().

262 {
263  DBQueryResult res;
264 
265  // Get list of characters and their corporation info from the accountID:
266  if( !sDatabase.RunQuery(res,
267  " SELECT "
268  " chrSkillQueue.*, "
269  " dgmTypeAttributes.attributeID, "
270  " dgmTypeAttributes.valueInt, "
271  " dgmTypeAttributes.valueFloat, "
272  " entity.itemID, "
273  " entity_attributes.valueInt, "
274  " entity_attributes.valueFloat "
275  " FROM chrSkillQueue "
276  " LEFT JOIN dgmTypeAttributes ON dgmTypeAttributes.typeID = chrSkillQueue.typeID "
277  " LEFT JOIN entity ON entity.typeID = chrSkillQueue.typeID "
278  " LEFT JOIN entity_attributes ON entity_attributes.itemID = entity.itemID "
279  " WHERE chrSkillQueue.characterID = %u AND dgmTypeAttributes.typeID = chrSkillQueue.typeID AND "
280  " dgmTypeAttributes.attributeID IN (%u,%u,%u) AND entity.ownerID = %u AND entity_attributes.attributeID = %u ",
282  {
283  sLog.Error( "APIAccountDB::GetCharacterSkillQueue()", "Cannot find characterID %u", characterID );
284  return false;
285  }
286 
287  DBResultRow row;
288  bool row_found = false;
289  uint32 prev_orderIndex = 4294967295UL;
290  while( res.GetRow( row ) )
291  {
292  row_found = true;
293 
294  if( prev_orderIndex != row.GetUInt(1) )
295  {
296  prev_orderIndex = row.GetUInt(1);
297  orderList.push_back( std::string(row.GetText(1)) );
298  typeIdList.push_back( std::string(row.GetText(2)) );
299  levelList.push_back( std::string(row.GetText(3)) );
300  skillIdList.push_back( std::string(row.GetText(7)) );
301 
302  if( row.GetText(8) == NULL )
303  // Get value from the query's 'valueFloat' column since 'valueInt' contains 'NULL'
304  skillPointsTrainedList.push_back( std::string((row.GetText(9) == NULL ? "0.0" : itoa((uint32)(row.GetFloat(9))))) );
305  else
306  // Get value from the query's 'valueInt' column since it does not contain 'NULL'
307  skillPointsTrainedList.push_back( std::string((row.GetText(8) == NULL ? "0" : row.GetText(8))) );
308  }
309 
310  if( row.GetUInt(4) == AttrPrimaryAttribute )
311  {
312  if( row.GetText(5) == NULL )
313  // Get value from the query's 'valueFloat' column since 'valueInt' contains 'NULL'
314  primaryAttrList.push_back( std::string((row.GetText(6) == NULL ? "0.0" : itoa((uint32)(row.GetFloat(6))))) );
315  else
316  // Get value from the query's 'valueInt' column since it does not contain 'NULL'
317  primaryAttrList.push_back( std::string((row.GetText(5) == NULL ? "0" : row.GetText(5))) );
318  }
319  else if( row.GetUInt(4) == AttrSecondaryAttribute )
320  {
321  if( row.GetText(5) == NULL )
322  // Get value from the query's 'valueFloat' column since 'valueInt' contains 'NULL'
323  secondaryAttrList.push_back( std::string((row.GetText(6) == NULL ? "0.0" : itoa((uint32)(row.GetFloat(6))))) );
324  else
325  // Get value from the query's 'valueInt' column since it does not contain 'NULL'
326  secondaryAttrList.push_back( std::string((row.GetText(5) == NULL ? "0" : row.GetText(5))) );
327  }
328  else if( row.GetUInt(4) == AttrSkillTimeConstant )
329  {
330  if( row.GetText(5) == NULL )
331  // Get value from the query's 'valueFloat' column since 'valueInt' contains 'NULL'
332  rankList.push_back( std::string((row.GetText(6) == NULL ? "0.0" : itoa((uint32)(row.GetFloat(6))))) );
333  else
334  // Get value from the query's 'valueInt' column since it does not contain 'NULL'
335  rankList.push_back( std::string((row.GetText(5) == NULL ? "0" : row.GetText(5))) );
336  }
337  }
338 
339  if( !row_found )
340  {
341  sLog.Error( "APIServiceDB::GetCharacterSkillQueue()", "res.GetRow(row) failed for unknown reason." );
342  return false;
343  }
344 
345  return true;
346 }
#define sDatabase
Definition: dbcore.h:199
const char * GetText(uint32 index) const
Definition: dbcore.h:104
float GetFloat(uint32 index) const
Definition: dbcore.cpp:682
uint32 GetUInt(uint32 index) const
Definition: dbcore.cpp:658
bool GetRow(DBResultRow &into)
Definition: dbcore.cpp:552
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
unsigned __int32 uint32
Definition: eve-compat.h:50
const char * itoa(int64 num)
Convers num to string.

Here is the call graph for this function:

Here is the caller graph for this function:

bool APICharacterDB::GetCharacterSkillsTrained ( uint32  characterID,
std::vector< std::string > &  skillTypeIDList,
std::vector< std::string > &  skillPointsList,
std::vector< std::string > &  skillLevelList,
std::vector< std::string > &  skillPublishedList 
)

?

?

Parameters
[in]?
[in]?
Return values
?

Definition at line 35 of file APICharacterDB.cpp.

References AttrSkillLevel, AttrSkillPoints, DBResultRow::GetBool(), DBResultRow::GetFloat(), DBQueryResult::GetRow(), DBResultRow::GetText(), DBResultRow::GetUInt(), itoa(), sDatabase, and sLog.

Referenced by APICharacterManager::_CharacterSheet().

37 {
38  DBQueryResult res;
39 
40  // Get list of characters and their corporation info from the accountID:
41  if( !sDatabase.RunQuery(res,
42  " SELECT "
43  " entity.itemID, "
44  " entity.typeID, "
45  " entity_attributes.attributeID, "
46  " entity_attributes.valueInt, "
47  " entity_attributes.valueFloat, "
48  " invTypes.groupID, "
49  " invTypes.published, "
50  " invGroups.categoryID "
51  " FROM `entity` "
52  " LEFT JOIN entity_attributes ON entity_attributes.itemID = entity.itemID "
53  " LEFT JOIN invTypes ON invTypes.typeID = entity.typeID "
54  " LEFT JOIN invGroups ON invGroups.groupID = invTypes.groupID "
55  " WHERE `ownerID` = %u AND invGroups.categoryID = 16 ", characterID ))
56  {
57  sLog.Error( "APIAccountDB::GetCharacterSkillsTrained()", "Cannot find characterID %u", characterID );
58  return false;
59  }
60 
61  uint32 prevTypeID = 0;
62  bool gotSkillPoints = false;
63  bool gotSkillLevel = false;
64  DBResultRow row;
65  std::map<std::string, std::string> charInfo;
66  while( res.GetRow( row ) )
67  {
68  if( prevTypeID != row.GetUInt(1) )
69  {
70  if( (!gotSkillPoints) && (prevTypeID != 0) )
71  skillPointsList.push_back( std::string("0") );
72 
73  if( (!gotSkillLevel) && (prevTypeID != 0) )
74  skillLevelList.push_back( std::string("0") );
75 
76  gotSkillPoints = false;
77  gotSkillLevel = false;
78  skillTypeIDList.push_back( std::string(row.GetText(1)) );
79  skillPublishedList.push_back( std::string(itoa(row.GetBool(6) ? 1 : 0)) );
80  }
81 
82  prevTypeID = row.GetUInt(1);
83 
84  if( row.GetUInt(2) == AttrSkillPoints )
85  {
86  gotSkillPoints = true;
87  if( row.GetText(3) == NULL )
88  // Get value from 'entity_attributes' table 'valueFloat' column since 'valueInt' contains 'NULL'
89  skillPointsList.push_back( std::string((row.GetText(4) == NULL ? "0.0" : itoa((uint32)(row.GetFloat(4))))) );
90  else
91  // Get value from 'entity_attributes' table 'valueInt' column since it does not contain 'NULL'
92  skillPointsList.push_back( std::string((row.GetText(3) == NULL ? "0" : row.GetText(3))) );
93  }
94 
95  if( row.GetUInt(2) == AttrSkillLevel )
96  {
97  gotSkillLevel = true;
98  if( row.GetText(3) == NULL )
99  // Get value from 'entity_attributes' table 'valueFloat' column since 'valueInt' contains 'NULL'
100  skillLevelList.push_back( std::string((row.GetText(4) == NULL ? "0.0" : itoa((uint32)(row.GetFloat(4))))) );
101  else
102  // Get value from 'entity_attributes' table 'valueInt' column since it does not contain 'NULL'
103  skillLevelList.push_back( std::string((row.GetText(3) == NULL ? "0" : row.GetText(3))) );
104  }
105  }
106 
107  return true;
108 }
#define sDatabase
Definition: dbcore.h:199
const char * GetText(uint32 index) const
Definition: dbcore.h:104
float GetFloat(uint32 index) const
Definition: dbcore.cpp:682
uint32 GetUInt(uint32 index) const
Definition: dbcore.cpp:658
bool GetRow(DBResultRow &into)
Definition: dbcore.cpp:552
bool GetBool(uint32 index) const
Definition: dbcore.cpp:647
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
unsigned __int32 uint32
Definition: eve-compat.h:50
const char * itoa(int64 num)
Convers num to string.

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: