mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 14:41:28 +00:00
Update worlddb.cpp
This commit is contained in:
parent
b56c805cd8
commit
003183a6af
@ -26,6 +26,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include "sof_char_create_data.h"
|
#include "sof_char_create_data.h"
|
||||||
#include "../common/repositories/character_instance_safereturns_repository.h"
|
#include "../common/repositories/character_instance_safereturns_repository.h"
|
||||||
|
#include "../common/repositories/inventory_repository.h"
|
||||||
#include "../common/repositories/criteria/content_filter_criteria.h"
|
#include "../common/repositories/criteria/content_filter_criteria.h"
|
||||||
#include "../common/zone_store.h"
|
#include "../common/zone_store.h"
|
||||||
|
|
||||||
@ -857,115 +858,90 @@ bool WorldDatabase::LoadCharacterCreateCombos()
|
|||||||
// this is a slightly modified version of SharedDatabase::GetInventory(...) for character select use-only
|
// this is a slightly modified version of SharedDatabase::GetInventory(...) for character select use-only
|
||||||
bool WorldDatabase::GetCharSelInventory(uint32 account_id, char *name, EQ::InventoryProfile *inv)
|
bool WorldDatabase::GetCharSelInventory(uint32 account_id, char *name, EQ::InventoryProfile *inv)
|
||||||
{
|
{
|
||||||
if (!account_id || !name || !inv)
|
if (!account_id || !name || !inv) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
std::string query = StringFormat(
|
const uint32 character_id = GetCharacterID(name);
|
||||||
"SELECT"
|
|
||||||
" slotid,"
|
if (!character_id) {
|
||||||
" itemid,"
|
return false;
|
||||||
" charges,"
|
}
|
||||||
" color,"
|
|
||||||
" augslot1,"
|
const auto& l = InventoryRepository::GetWhere(
|
||||||
" augslot2,"
|
*this,
|
||||||
" augslot3,"
|
fmt::format(
|
||||||
" augslot4,"
|
"`character_id` = {} AND `slot_id` BETWEEN {} AND {}",
|
||||||
" augslot5,"
|
character_id,
|
||||||
" augslot6,"
|
EQ::invslot::slotHead,
|
||||||
" instnodrop,"
|
EQ::invslot::slotFeet
|
||||||
" custom_data,"
|
)
|
||||||
" ornamenticon,"
|
|
||||||
" ornamentidfile,"
|
|
||||||
" ornament_hero_model "
|
|
||||||
"FROM"
|
|
||||||
" inventory "
|
|
||||||
"INNER JOIN"
|
|
||||||
" character_data ch "
|
|
||||||
"ON"
|
|
||||||
" ch.id = charid "
|
|
||||||
"WHERE"
|
|
||||||
" ch.name = '%s' "
|
|
||||||
"AND"
|
|
||||||
" ch.account_id = %i "
|
|
||||||
"AND"
|
|
||||||
" slotid >= %i "
|
|
||||||
"AND"
|
|
||||||
" slotid <= %i",
|
|
||||||
name,
|
|
||||||
account_id,
|
|
||||||
EQ::invslot::slotHead,
|
|
||||||
EQ::invslot::slotFeet
|
|
||||||
);
|
);
|
||||||
auto results = QueryDatabase(query);
|
|
||||||
if (!results.Success())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
if (l.empty()) {
|
||||||
int16 slot_id = Strings::ToInt(row[0]);
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
switch (slot_id) {
|
for (const auto& e : l) {
|
||||||
case EQ::invslot::slotFace:
|
switch (e.slot_id) {
|
||||||
case EQ::invslot::slotEar2:
|
case EQ::invslot::slotFace:
|
||||||
case EQ::invslot::slotNeck:
|
case EQ::invslot::slotEar2:
|
||||||
case EQ::invslot::slotShoulders:
|
case EQ::invslot::slotNeck:
|
||||||
case EQ::invslot::slotBack:
|
case EQ::invslot::slotShoulders:
|
||||||
case EQ::invslot::slotFinger1:
|
case EQ::invslot::slotBack:
|
||||||
case EQ::invslot::slotFinger2:
|
case EQ::invslot::slotFinger1:
|
||||||
continue;
|
case EQ::invslot::slotFinger2:
|
||||||
default:
|
continue;
|
||||||
break;
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 item_id = Strings::ToInt(row[1]);
|
|
||||||
int8 charges = Strings::ToInt(row[2]);
|
|
||||||
uint32 color = Strings::ToUnsignedInt(row[3]);
|
|
||||||
|
|
||||||
uint32 aug[EQ::invaug::SOCKET_COUNT];
|
uint32 augment_ids[EQ::invaug::SOCKET_COUNT] = {
|
||||||
aug[0] = (uint32)Strings::ToInt(row[4]);
|
e.augment_one,
|
||||||
aug[1] = (uint32)Strings::ToInt(row[5]);
|
e.augment_two,
|
||||||
aug[2] = (uint32)Strings::ToInt(row[6]);
|
e.augment_three,
|
||||||
aug[3] = (uint32)Strings::ToInt(row[7]);
|
e.augment_four,
|
||||||
aug[4] = (uint32)Strings::ToInt(row[8]);
|
e.augment_five,
|
||||||
aug[5] = (uint32)Strings::ToInt(row[9]);
|
e.augment_six
|
||||||
|
};
|
||||||
|
|
||||||
bool instnodrop = ((row[10] && (uint16)Strings::ToInt(row[10])) ? true : false);
|
const EQ::ItemData* item = content_db.GetItem(e.item_id);
|
||||||
uint32 ornament_icon = (uint32)Strings::ToUnsignedInt(row[12]);
|
if (!item) {
|
||||||
uint32 ornament_idfile = (uint32)Strings::ToUnsignedInt(row[13]);
|
|
||||||
uint32 ornament_hero_model = (uint32)Strings::ToUnsignedInt(row[14]);
|
|
||||||
|
|
||||||
const EQ::ItemData *item = content_db.GetItem(item_id);
|
|
||||||
if (!item)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
EQ::ItemInstance *inst = content_db.CreateBaseItem(item, charges);
|
|
||||||
|
|
||||||
if (inst == nullptr)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
inst->SetAttuned(instnodrop);
|
|
||||||
|
|
||||||
if (row[11]) {
|
|
||||||
std::string data_str(row[11]);
|
|
||||||
inst->SetCustomDataString(data_str);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inst->SetOrnamentIcon(ornament_icon);
|
EQ::ItemInstance *inst = content_db.CreateBaseItem(item, e.charges);
|
||||||
inst->SetOrnamentationIDFile(ornament_idfile);
|
|
||||||
inst->SetOrnamentHeroModel(item->HerosForgeModel);
|
|
||||||
|
|
||||||
if (color > 0)
|
if (!inst) {
|
||||||
inst->SetColor(color);
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
inst->SetCharges(charges);
|
inst->SetCharges(e.charges);
|
||||||
|
|
||||||
|
if (e.color > 0) {
|
||||||
|
inst->SetColor(e.color);
|
||||||
|
}
|
||||||
|
|
||||||
if (item->IsClassCommon()) {
|
if (item->IsClassCommon()) {
|
||||||
for (int i = EQ::invaug::SOCKET_BEGIN; i <= EQ::invaug::SOCKET_END; i++) {
|
for (int i = EQ::invaug::SOCKET_BEGIN; i <= EQ::invaug::SOCKET_END; i++) {
|
||||||
if (aug[i])
|
if (augment_ids[i]) {
|
||||||
inst->PutAugment(this, i, aug[i]);
|
inst->PutAugment(this, i, augment_ids[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inv->PutItem(slot_id, *inst);
|
inst->SetAttuned(e.instnodrop);
|
||||||
|
|
||||||
|
if (!e.custom_data.empty()) {
|
||||||
|
inst->SetCustomDataString(e.custom_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
inst->SetOrnamentIcon(e.ornament_icon);
|
||||||
|
inst->SetOrnamentationIDFile(e.ornament_idfile);
|
||||||
|
inst->SetOrnamentHeroModel(e.ornament_hero_model);
|
||||||
|
|
||||||
|
inv->PutItem(e.slot_id, *inst);
|
||||||
|
|
||||||
safe_delete(inst);
|
safe_delete(inst);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user