mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 10:31:29 +00:00
GetEquipmentColor converted to QueryDatabase
This commit is contained in:
parent
73c8d3d09d
commit
95dc0c5fc8
21
zone/bot.cpp
21
zone/bot.cpp
@ -16125,27 +16125,20 @@ uint32 Bot::GetEquipmentColor(uint8 material_slot) const
|
|||||||
{
|
{
|
||||||
//Bot tints
|
//Bot tints
|
||||||
uint32 slotid = 0;
|
uint32 slotid = 0;
|
||||||
uint32 returncolor = 0;
|
|
||||||
uint32 botid = this->GetBotID();
|
uint32 botid = this->GetBotID();
|
||||||
|
|
||||||
//Translate code slot # to DB slot #
|
//Translate code slot # to DB slot #
|
||||||
slotid = Inventory::CalcSlotFromMaterial(material_slot);
|
slotid = Inventory::CalcSlotFromMaterial(material_slot);
|
||||||
|
|
||||||
//read from db
|
//read from db
|
||||||
char* Query = 0;
|
std::string query = StringFormat("SELECT color FROM botinventory "
|
||||||
MYSQL_RES* DatasetResult;
|
"WHERE BotID = %u AND SlotID = %u", botid, slotid);
|
||||||
MYSQL_ROW DataRow;
|
auto results = database.QueryDatabase(query);
|
||||||
|
if (!results.Success() || results.RowCount() != 1)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if(database.RunQuery(Query, MakeAnyLenString(&Query, "SELECT color FROM botinventory WHERE BotID = %u AND SlotID = %u", botid, slotid), 0, &DatasetResult)) {
|
auto row = results.begin();
|
||||||
if(mysql_num_rows(DatasetResult) == 1) {
|
return atoul(row[0]);
|
||||||
DataRow = mysql_fetch_row(DatasetResult);
|
|
||||||
if(DataRow)
|
|
||||||
returncolor = atoul(DataRow[0]);
|
|
||||||
}
|
|
||||||
mysql_free_result(DatasetResult);
|
|
||||||
safe_delete_array(Query);
|
|
||||||
}
|
|
||||||
return returncolor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int Bot::GetRawACNoShield(int &shield_ac)
|
int Bot::GetRawACNoShield(int &shield_ac)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user