mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 13:41:31 +00:00
Some clang-formatting
This commit is contained in:
parent
a18cb6f61e
commit
0f1b504ed6
@ -477,16 +477,20 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Overloaded: Retrieve character inventory based on character id
|
// Overloaded: Retrieve character inventory based on character id
|
||||||
bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) {
|
bool SharedDatabase::GetInventory(uint32 char_id, Inventory *inv)
|
||||||
|
{
|
||||||
// Retrieve character inventory
|
// Retrieve character inventory
|
||||||
std::string query = StringFormat("SELECT slotid, itemid, charges, color, augslot1, "
|
std::string query =
|
||||||
"augslot2, augslot3, augslot4, augslot5, augslot6, instnodrop, custom_data, ornamenticon, ornamentidfile, ornament_hero_model "
|
StringFormat("SELECT slotid, itemid, charges, color, augslot1, augslot2, augslot3, augslot4, augslot5, "
|
||||||
"FROM inventory WHERE charid = %i ORDER BY slotid", char_id);
|
"augslot6, instnodrop, custom_data, ornamenticon, ornamentidfile, ornament_hero_model FROM "
|
||||||
|
"inventory WHERE charid = %i ORDER BY slotid",
|
||||||
|
char_id);
|
||||||
auto results = QueryDatabase(query);
|
auto results = QueryDatabase(query);
|
||||||
if (!results.Success()) {
|
if (!results.Success()) {
|
||||||
Log.Out(Logs::General, Logs::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n");
|
Log.Out(Logs::General, Logs::Error, "If you got an error related to the 'instnodrop' field, run the "
|
||||||
|
"following SQL Queries:\nalter table inventory add instnodrop "
|
||||||
|
"tinyint(1) unsigned default 0 not null;\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -514,7 +518,9 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) {
|
|||||||
const Item_Struct *item = GetItem(item_id);
|
const Item_Struct *item = GetItem(item_id);
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
Log.Out(Logs::General, Logs::Error,"Warning: charid %i has an invalid item_id %i in inventory slot %i", char_id, item_id, slot_id);
|
Log.Out(Logs::General, Logs::Error,
|
||||||
|
"Warning: charid %i has an invalid item_id %i in inventory slot %i", char_id, item_id,
|
||||||
|
slot_id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -555,7 +561,10 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) {
|
|||||||
inst->SetOrnamentationIDFile(ornament_idfile);
|
inst->SetOrnamentationIDFile(ornament_idfile);
|
||||||
inst->SetOrnamentHeroModel(ornament_hero_model);
|
inst->SetOrnamentHeroModel(ornament_hero_model);
|
||||||
|
|
||||||
if (instnodrop || (((slot_id >= EmuConstants::EQUIPMENT_BEGIN && slot_id <= EmuConstants::EQUIPMENT_END) || slot_id == MainPowerSource) && inst->GetItem()->Attuneable))
|
if (instnodrop ||
|
||||||
|
(((slot_id >= EmuConstants::EQUIPMENT_BEGIN && slot_id <= EmuConstants::EQUIPMENT_END) ||
|
||||||
|
slot_id == MainPowerSource) &&
|
||||||
|
inst->GetItem()->Attuneable))
|
||||||
inst->SetAttuned(true);
|
inst->SetAttuned(true);
|
||||||
|
|
||||||
if (color > 0)
|
if (color > 0)
|
||||||
@ -563,7 +572,8 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) {
|
|||||||
|
|
||||||
if (charges == 0x7FFF)
|
if (charges == 0x7FFF)
|
||||||
inst->SetCharges(-1);
|
inst->SetCharges(-1);
|
||||||
else if (charges == 0 && inst->IsStackable()) // Stackable items need a minimum charge of 1 remain moveable.
|
else if (charges == 0 &&
|
||||||
|
inst->IsStackable()) // Stackable items need a minimum charge of 1 remain moveable.
|
||||||
inst->SetCharges(1);
|
inst->SetCharges(1);
|
||||||
else
|
else
|
||||||
inst->SetCharges(charges);
|
inst->SetCharges(charges);
|
||||||
@ -575,18 +585,15 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (slot_id >= 8000 && slot_id <= 8999)
|
if (slot_id >= 8000 && slot_id <= 8999) {
|
||||||
{
|
|
||||||
put_slot_id = inv->PushCursor(*inst);
|
put_slot_id = inv->PushCursor(*inst);
|
||||||
}
|
} else if (slot_id >= 3111 && slot_id <= 3179) {
|
||||||
else if (slot_id >= 3111 && slot_id <= 3179)
|
|
||||||
{
|
|
||||||
// Admins: please report any occurrences of this error
|
// Admins: please report any occurrences of this error
|
||||||
Log.Out(Logs::General, Logs::Error, "Warning: Defunct location for item in inventory: charid=%i, item_id=%i, slot_id=%i .. pushing to cursor...", char_id, item_id, slot_id);
|
Log.Out(Logs::General, Logs::Error, "Warning: Defunct location for item in inventory: "
|
||||||
|
"charid=%i, item_id=%i, slot_id=%i .. pushing to cursor...",
|
||||||
|
char_id, item_id, slot_id);
|
||||||
put_slot_id = inv->PushCursor(*inst);
|
put_slot_id = inv->PushCursor(*inst);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
put_slot_id = inv->PutItem(slot_id, *inst);
|
put_slot_id = inv->PutItem(slot_id, *inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -594,7 +601,9 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) {
|
|||||||
|
|
||||||
// Save ptr to item in inventory
|
// Save ptr to item in inventory
|
||||||
if (put_slot_id == INVALID_INDEX) {
|
if (put_slot_id == INVALID_INDEX) {
|
||||||
Log.Out(Logs::General, Logs::Error, "Warning: Invalid slot_id for item in inventory: charid=%i, item_id=%i, slot_id=%i",char_id, item_id, slot_id);
|
Log.Out(Logs::General, Logs::Error,
|
||||||
|
"Warning: Invalid slot_id for item in inventory: charid=%i, item_id=%i, slot_id=%i",
|
||||||
|
char_id, item_id, slot_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -603,20 +612,24 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Overloaded: Retrieve character inventory based on account_id and character name
|
// Overloaded: Retrieve character inventory based on account_id and character name
|
||||||
bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv) {
|
bool SharedDatabase::GetInventory(uint32 account_id, char *name, Inventory *inv)
|
||||||
|
{
|
||||||
// Retrieve character inventory
|
// Retrieve character inventory
|
||||||
std::string query = StringFormat("SELECT slotid, itemid, charges, color, augslot1, "
|
std::string query =
|
||||||
"augslot2, augslot3, augslot4, augslot5, augslot6, instnodrop, custom_data, ornamenticon, ornamentidfile, ornament_hero_model "
|
StringFormat("SELECT slotid, itemid, charges, color, augslot1, "
|
||||||
|
"augslot2, augslot3, augslot4, augslot5, augslot6, instnodrop, custom_data, ornamenticon, "
|
||||||
|
"ornamentidfile, ornament_hero_model "
|
||||||
"FROM inventory INNER JOIN character_data ch "
|
"FROM inventory INNER JOIN character_data ch "
|
||||||
"ON ch.id = charid WHERE ch.name = '%s' AND ch.account_id = %i ORDER BY slotid",
|
"ON ch.id = charid WHERE ch.name = '%s' AND ch.account_id = %i ORDER BY slotid",
|
||||||
name, account_id);
|
name, account_id);
|
||||||
auto results = QueryDatabase(query);
|
auto results = QueryDatabase(query);
|
||||||
if (!results.Success()) {
|
if (!results.Success()) {
|
||||||
Log.Out(Logs::General, Logs::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n");
|
Log.Out(Logs::General, Logs::Error, "If you got an error related to the 'instnodrop' field, run the "
|
||||||
|
"following SQL Queries:\nalter table inventory add instnodrop "
|
||||||
|
"tinyint(1) unsigned default 0 not null;\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
int16 slot_id = atoi(row[0]);
|
int16 slot_id = atoi(row[0]);
|
||||||
uint32 item_id = atoi(row[1]);
|
uint32 item_id = atoi(row[1]);
|
||||||
@ -671,7 +684,6 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv)
|
|||||||
idAsString.push_back(v);
|
idAsString.push_back(v);
|
||||||
else
|
else
|
||||||
value.push_back(v);
|
value.push_back(v);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -700,16 +712,17 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv)
|
|||||||
|
|
||||||
// Save ptr to item in inventory
|
// Save ptr to item in inventory
|
||||||
if (put_slot_id == INVALID_INDEX)
|
if (put_slot_id == INVALID_INDEX)
|
||||||
Log.Out(Logs::General, Logs::Error, "Warning: Invalid slot_id for item in inventory: name=%s, acctid=%i, item_id=%i, slot_id=%i", name, account_id, item_id, slot_id);
|
Log.Out(Logs::General, Logs::Error, "Warning: Invalid slot_id for item in inventory: name=%s, "
|
||||||
|
"acctid=%i, item_id=%i, slot_id=%i",
|
||||||
|
name, account_id, item_id, slot_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve shared inventory
|
// Retrieve shared inventory
|
||||||
return GetSharedBank(account_id, inv, false);
|
return GetSharedBank(account_id, inv, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SharedDatabase::GetItemsCount(int32 &item_count, uint32 &max_id)
|
||||||
void SharedDatabase::GetItemsCount(int32 &item_count, uint32 &max_id) {
|
{
|
||||||
item_count = -1;
|
item_count = -1;
|
||||||
max_id = 0;
|
max_id = 0;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user