mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-17 03:08:26 +00:00
Implemented higher bandolier and potion belt counts
This commit is contained in:
+30
-17
@@ -1177,20 +1177,37 @@ bool ZoneDatabase::LoadCharacterMaterialColor(uint32 character_id, PlayerProfile
|
||||
|
||||
bool ZoneDatabase::LoadCharacterBandolier(uint32 character_id, PlayerProfile_Struct* pp)
|
||||
{
|
||||
std::string query = StringFormat("SELECT `bandolier_id`, `bandolier_slot`, `item_id`, `icon`, `bandolier_name` FROM `character_bandolier` WHERE `id` = %u LIMIT 16", character_id);
|
||||
std::string query = StringFormat("SELECT `bandolier_id`, `bandolier_slot`, `item_id`, `icon`, `bandolier_name` FROM `character_bandolier` WHERE `id` = %u LIMIT %u",
|
||||
character_id, EmuConstants::BANDOLIERS_SIZE);
|
||||
auto results = database.QueryDatabase(query); int i = 0; int r = 0; int si = 0;
|
||||
for (i = 0; i < EmuConstants::BANDOLIERS_SIZE; i++)
|
||||
for (int si = 0; si < EmuConstants::BANDOLIER_ITEM_COUNT; si++)
|
||||
for (i = 0; i < EmuConstants::BANDOLIERS_SIZE; i++) {
|
||||
pp->bandoliers[i].Name[0] = '\0';
|
||||
for (int si = 0; si < EmuConstants::BANDOLIER_ITEM_COUNT; si++) {
|
||||
pp->bandoliers[i].Items[si].ID = 0;
|
||||
pp->bandoliers[i].Items[si].Icon = 0;
|
||||
pp->bandoliers[i].Items[si].Name[0] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
r = 0;
|
||||
i = atoi(row[r]); /* Bandolier ID */ r++;
|
||||
si = atoi(row[r]); /* Bandolier Slot */ r++;
|
||||
pp->bandoliers[i].Items[si].ID = atoi(row[r]); r++;
|
||||
pp->bandoliers[i].Items[si].Icon = atoi(row[r]); r++;
|
||||
|
||||
const Item_Struct* item_data = database.GetItem(atoi(row[r]));
|
||||
if (item_data) {
|
||||
pp->bandoliers[i].Items[si].ID = item_data->ID; r++;
|
||||
pp->bandoliers[i].Items[si].Icon = atoi(row[r]); r++; // Must use db value in case an Ornamentation is assigned
|
||||
strncpy(pp->bandoliers[i].Items[si].Name, item_data->Name, 64);
|
||||
}
|
||||
else {
|
||||
pp->bandoliers[i].Items[si].ID = 0; r++;
|
||||
pp->bandoliers[i].Items[si].Icon = 0; r++;
|
||||
pp->bandoliers[i].Items[si].Name[0] = '\0';
|
||||
}
|
||||
strcpy(pp->bandoliers[i].Name, row[r]); r++;
|
||||
si++;
|
||||
|
||||
si++; // What is this for!?
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -1216,25 +1233,21 @@ bool ZoneDatabase::LoadCharacterTribute(uint32 character_id, PlayerProfile_Struc
|
||||
|
||||
bool ZoneDatabase::LoadCharacterPotions(uint32 character_id, PlayerProfile_Struct* pp)
|
||||
{
|
||||
std::string query = StringFormat("SELECT `potion_id`, `item_id`, `icon` FROM `character_potionbelt` WHERE `id` = %u LIMIT 4", character_id);
|
||||
std::string query = StringFormat("SELECT `potion_id`, `item_id`, `icon` FROM `character_potionbelt` WHERE `id` = %u LIMIT %u",
|
||||
character_id, EmuConstants::POTION_BELT_ITEM_COUNT);
|
||||
auto results = database.QueryDatabase(query); int i = 0;
|
||||
for (i = 0; i < EmuConstants::POTION_BELT_ITEM_COUNT; i++){
|
||||
pp->potionbelt.Items[i].Icon = 0;
|
||||
pp->potionbelt.Items[i].ID = 0;
|
||||
strncpy(pp->potionbelt.Items[i].Name, "\0", 1);
|
||||
pp->potionbelt.Items[i].Name[0] = '\0';
|
||||
}
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
i = atoi(row[0]); /* Potion belt slot number */
|
||||
uint32 item_id = atoi(row[1]);
|
||||
const Item_Struct *item = database.GetItem(item_id);
|
||||
|
||||
if(!item)
|
||||
continue;
|
||||
|
||||
pp->potionbelt.Items[i].ID = item_id;
|
||||
const Item_Struct *item_data = database.GetItem(atoi(row[1]));
|
||||
if (item_data == nullptr) { continue; }
|
||||
pp->potionbelt.Items[i].ID = item_data->ID;
|
||||
pp->potionbelt.Items[i].Icon = atoi(row[2]);
|
||||
strncpy(pp->potionbelt.Items[i].Name, item->Name, 64);
|
||||
strncpy(pp->potionbelt.Items[i].Name, item_data->Name, 64);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user