mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-15 04:11:30 +00:00
Remove FindTraderItemSerialNumber and FIndTraderItemBySerialNumber as they are no longer used.
Updated sharedbank to store unique_item_id instead of guid.
This commit is contained in:
parent
4ded4d6b58
commit
345d452a7e
@ -7240,6 +7240,11 @@ ALTER TABLE `trader`
|
||||
ADD INDEX `idx_trader_char` (`character_id`, `char_zone_id`, `char_zone_instance_id`) USING BTREE,
|
||||
ADD UNIQUE INDEX `idx_item_unique_id` (`item_unique_id`);
|
||||
|
||||
ALTER TABLE `sharedbank`
|
||||
DROP COLUMN `guid`,
|
||||
ADD COLUMN `item_unique_id` VARCHAR(16) NULL DEFAULT NULL AFTER `ornament_hero_model`,
|
||||
ADD UNIQUE INDEX `idx_item_unique_id` (`item_unique_id`);
|
||||
|
||||
)",
|
||||
.content_schema_update = false
|
||||
},
|
||||
|
||||
@ -245,7 +245,6 @@ namespace EQ
|
||||
|
||||
int32 GetSerialNumber() const { return m_SerialNumber; }
|
||||
void SetSerialNumber(int32 id) { m_SerialNumber = id; }
|
||||
const std::string &GetSerialNumber2() const { return m_unique_id; }
|
||||
const std::string &GetUniqueID() const { return m_unique_id; }
|
||||
void SetUniqueID(std::string sn) { m_unique_id = std::move(sn); }
|
||||
void CreateUniqueID() const { m_unique_id = GenerateUniqueID(); }
|
||||
|
||||
@ -34,7 +34,7 @@ public:
|
||||
uint32_t ornament_icon;
|
||||
uint32_t ornament_idfile;
|
||||
int32_t ornament_hero_model;
|
||||
uint64_t guid;
|
||||
std::string item_unique_id;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
@ -60,7 +60,7 @@ public:
|
||||
"ornament_icon",
|
||||
"ornament_idfile",
|
||||
"ornament_hero_model",
|
||||
"guid",
|
||||
"item_unique_id",
|
||||
};
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ public:
|
||||
"ornament_icon",
|
||||
"ornament_idfile",
|
||||
"ornament_hero_model",
|
||||
"guid",
|
||||
"item_unique_id",
|
||||
};
|
||||
}
|
||||
|
||||
@ -138,7 +138,7 @@ public:
|
||||
e.ornament_icon = 0;
|
||||
e.ornament_idfile = 0;
|
||||
e.ornament_hero_model = 0;
|
||||
e.guid = 0;
|
||||
e.item_unique_id = "";
|
||||
|
||||
return e;
|
||||
}
|
||||
@ -190,7 +190,7 @@ public:
|
||||
e.ornament_icon = row[12] ? static_cast<uint32_t>(strtoul(row[12], nullptr, 10)) : 0;
|
||||
e.ornament_idfile = row[13] ? static_cast<uint32_t>(strtoul(row[13], nullptr, 10)) : 0;
|
||||
e.ornament_hero_model = row[14] ? static_cast<int32_t>(atoi(row[14])) : 0;
|
||||
e.guid = row[15] ? strtoull(row[15], nullptr, 10) : 0;
|
||||
e.item_unique_id = row[15] ? row[15] : "";
|
||||
|
||||
return e;
|
||||
}
|
||||
@ -239,7 +239,7 @@ public:
|
||||
v.push_back(columns[12] + " = " + std::to_string(e.ornament_icon));
|
||||
v.push_back(columns[13] + " = " + std::to_string(e.ornament_idfile));
|
||||
v.push_back(columns[14] + " = " + std::to_string(e.ornament_hero_model));
|
||||
v.push_back(columns[15] + " = " + std::to_string(e.guid));
|
||||
v.push_back(columns[15] + " = '" + Strings::Escape(e.item_unique_id) + "'");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@ -276,7 +276,7 @@ public:
|
||||
v.push_back(std::to_string(e.ornament_icon));
|
||||
v.push_back(std::to_string(e.ornament_idfile));
|
||||
v.push_back(std::to_string(e.ornament_hero_model));
|
||||
v.push_back(std::to_string(e.guid));
|
||||
v.push_back("'" + Strings::Escape(e.item_unique_id) + "'");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@ -321,7 +321,7 @@ public:
|
||||
v.push_back(std::to_string(e.ornament_icon));
|
||||
v.push_back(std::to_string(e.ornament_idfile));
|
||||
v.push_back(std::to_string(e.ornament_hero_model));
|
||||
v.push_back(std::to_string(e.guid));
|
||||
v.push_back("'" + Strings::Escape(e.item_unique_id) + "'");
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
@ -370,7 +370,7 @@ public:
|
||||
e.ornament_icon = row[12] ? static_cast<uint32_t>(strtoul(row[12], nullptr, 10)) : 0;
|
||||
e.ornament_idfile = row[13] ? static_cast<uint32_t>(strtoul(row[13], nullptr, 10)) : 0;
|
||||
e.ornament_hero_model = row[14] ? static_cast<int32_t>(atoi(row[14])) : 0;
|
||||
e.guid = row[15] ? strtoull(row[15], nullptr, 10) : 0;
|
||||
e.item_unique_id = row[15] ? row[15] : "";
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@ -410,7 +410,7 @@ public:
|
||||
e.ornament_icon = row[12] ? static_cast<uint32_t>(strtoul(row[12], nullptr, 10)) : 0;
|
||||
e.ornament_idfile = row[13] ? static_cast<uint32_t>(strtoul(row[13], nullptr, 10)) : 0;
|
||||
e.ornament_hero_model = row[14] ? static_cast<int32_t>(atoi(row[14])) : 0;
|
||||
e.guid = row[15] ? strtoull(row[15], nullptr, 10) : 0;
|
||||
e.item_unique_id = row[15] ? row[15] : "";
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@ -500,7 +500,7 @@ public:
|
||||
v.push_back(std::to_string(e.ornament_icon));
|
||||
v.push_back(std::to_string(e.ornament_idfile));
|
||||
v.push_back(std::to_string(e.ornament_hero_model));
|
||||
v.push_back(std::to_string(e.guid));
|
||||
v.push_back("'" + Strings::Escape(e.item_unique_id) + "'");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@ -538,7 +538,7 @@ public:
|
||||
v.push_back(std::to_string(e.ornament_icon));
|
||||
v.push_back(std::to_string(e.ornament_idfile));
|
||||
v.push_back(std::to_string(e.ornament_hero_model));
|
||||
v.push_back(std::to_string(e.guid));
|
||||
v.push_back("'" + Strings::Escape(e.item_unique_id) + "'");
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
|
||||
@ -335,7 +335,7 @@ bool SharedDatabase::UpdateSharedBankSlot(uint32 char_id, const EQ::ItemInstance
|
||||
e.ornament_icon = inst->GetOrnamentationIcon();
|
||||
e.ornament_idfile = inst->GetOrnamentationIDFile();
|
||||
e.ornament_hero_model = inst->GetOrnamentHeroModel();
|
||||
e.guid = inst->GetSerialNumber();
|
||||
e.item_unique_id = inst->GetUniqueID();
|
||||
|
||||
const int replaced = SharedbankRepository::ReplaceOne(*this, e);
|
||||
|
||||
|
||||
@ -372,8 +372,6 @@ public:
|
||||
void SendTraderItem(uint32 item_id,uint16 quantity, TraderRepository::Trader &trader);
|
||||
void DoBazaarSearch(BazaarSearchCriteria_Struct search_criteria);
|
||||
uint16 FindTraderItem(std::string &SerialNumber,uint16 Quantity);
|
||||
uint32 FindTraderItemSerialNumber(int32 ItemID);
|
||||
EQ::ItemInstance* FindTraderItemBySerialNumber(std::string &serial_number);
|
||||
EQ::ItemInstance* FindTraderItemByUniqueID(std::string &unique_id);
|
||||
EQ::ItemInstance* FindTraderItemByUniqueID(const char* unique_id);
|
||||
std::vector<EQ::ItemInstance *> FindTraderItemsByUniqueID(const char* unique_id);
|
||||
|
||||
@ -1024,55 +1024,6 @@ void Client::BulkSendTraderInventory(uint32 character_id)
|
||||
}
|
||||
}
|
||||
|
||||
uint32 Client::FindTraderItemSerialNumber(int32 ItemID) {
|
||||
|
||||
EQ::ItemInstance* item = nullptr;
|
||||
uint16 SlotID = 0;
|
||||
for (int i = EQ::invslot::GENERAL_BEGIN; i <= EQ::invslot::GENERAL_END; i++){
|
||||
item = GetInv().GetItem(i);
|
||||
if (item && item->GetItem()->BagType == EQ::item::BagTypeTradersSatchel){
|
||||
for (int x = EQ::invbag::SLOT_BEGIN; x <= EQ::invbag::SLOT_END; x++) {
|
||||
// we already have the parent bag and a contents iterator..why not just iterate the bag!??
|
||||
SlotID = EQ::InventoryProfile::CalcSlotId(i, x);
|
||||
item = GetInv().GetItem(SlotID);
|
||||
if (item) {
|
||||
if (item->GetID() == ItemID)
|
||||
return item->GetSerialNumber();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
LogTrading("Client::FindTraderItemSerialNumber Couldn't find item! Item ID [{}]", ItemID);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
EQ::ItemInstance *Client::FindTraderItemBySerialNumber(std::string &unique_id)
|
||||
{
|
||||
EQ::ItemInstance *item = nullptr;
|
||||
int16 slot_id = 0;
|
||||
|
||||
for (int16 i = EQ::invslot::GENERAL_BEGIN; i <= EQ::invslot::GENERAL_END; i++) {
|
||||
item = GetInv().GetItem(i);
|
||||
if (item && item->GetItem()->BagType == EQ::item::BagTypeTradersSatchel) {
|
||||
for (int16 x = EQ::invbag::SLOT_BEGIN; x <= EQ::invbag::SLOT_END; x++) {
|
||||
// we already have the parent bag and a contents iterator..why not just iterate the bag!??
|
||||
slot_id = EQ::InventoryProfile::CalcSlotId(i, x);
|
||||
item = GetInv().GetItem(slot_id);
|
||||
if (item) {
|
||||
if (item->GetUniqueID().compare(unique_id) == 0) {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LogTrading("Couldn't find item! Serial No. was [{}]", unique_id);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
EQ::ItemInstance *Client::FindTraderItemByUniqueID(std::string &unique_id)
|
||||
{
|
||||
EQ::ItemInstance *item = nullptr;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user