mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 01:11:29 +00:00
Fix for bot inventory save failure involving items with unlimited charges
This commit is contained in:
parent
8615df0a03
commit
3d6fe8acba
@ -1,5 +1,8 @@
|
||||
EQEMu Changelog (Started on Sept 24, 2003 15:50)
|
||||
-------------------------------------------------------
|
||||
== 06/28/2016 ==
|
||||
Uleat: Fix for bot inventory save failure involving items with unlimited charges
|
||||
|
||||
== 06/13/2016 ==
|
||||
Noudess: Changes personal faction earned min/max to -2000/2000 from -3000/1200
|
||||
|
||||
|
||||
@ -595,8 +595,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory *inv)
|
||||
|
||||
if (charges == 0x7FFF)
|
||||
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);
|
||||
else
|
||||
inst->SetCharges(charges);
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
|
||||
#define CURRENT_BINARY_DATABASE_VERSION 9096
|
||||
#ifdef BOTS
|
||||
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9007
|
||||
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9008
|
||||
#else
|
||||
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 0 // must be 0
|
||||
#endif
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
9005|2016_04_08_bots_heal_rotations.sql|SHOW TABLES LIKE 'bot_heal_rotations'|empty|
|
||||
9006|2016_04_12_bots_inventory_window.sql|SELECT `bot_command` FROM `bot_command_settings` WHERE `bot_command` LIKE 'inventorywindow'|empty|
|
||||
9007|2016_06_23_bots_camel_case_name_rule.sql|SELECT * FROM `rule_values` WHERE `rule_name` LIKE 'Bots:AllowCamelCaseNames'|empty|
|
||||
9008|2016_06_28_bots_inventory_charges_update.sql|SELECT * FROM `information_schema`.`COLUMNS` isc WHERE isc.`TABLE_SCHEMA` = DATABASE() AND isc.`TABLE_NAME` = 'bot_inventories' AND isc.`COLUMN_NAME` = 'inst_charges' AND isc.`DATA_TYPE` = 'tinyint'|empty|
|
||||
|
||||
# Upgrade conditions:
|
||||
# This won't be needed after this system is implemented, but it is used database that are not
|
||||
|
||||
@ -0,0 +1 @@
|
||||
ALTER TABLE `bot_inventories` MODIFY COLUMN `inst_charges` SMALLINT(3) UNSIGNED NULL DEFAULT '0';
|
||||
@ -1079,8 +1079,10 @@ bool BotDatabase::LoadItems(const uint32 bot_id, Inventory& inventory_inst)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (item_charges == 255)
|
||||
if (item_charges == 0x7FFF)
|
||||
item_inst->SetCharges(-1);
|
||||
else if (item_charges == 0 && item_inst->IsStackable()) // Stackable items need a minimum charge of 1 remain moveable.
|
||||
item_inst->SetCharges(1);
|
||||
else
|
||||
item_inst->SetCharges(item_charges);
|
||||
|
||||
@ -1190,6 +1192,12 @@ bool BotDatabase::SaveItemBySlot(Bot* bot_inst, const uint32 slot_id, const Item
|
||||
for (int augment_iter = 0; augment_iter < EQEmu::legacy::ITEM_COMMON_SIZE; ++augment_iter)
|
||||
augment_id[augment_iter] = item_inst->GetAugmentItemID(augment_iter);
|
||||
|
||||
uint16 item_charges = 0;
|
||||
if (item_inst->GetCharges() >= 0)
|
||||
item_charges = item_inst->GetCharges();
|
||||
else
|
||||
item_charges = 0x7FFF;
|
||||
|
||||
query = StringFormat(
|
||||
"INSERT INTO `bot_inventories` ("
|
||||
"`bot_id`,"
|
||||
@ -1230,7 +1238,7 @@ bool BotDatabase::SaveItemBySlot(Bot* bot_inst, const uint32 slot_id, const Item
|
||||
(unsigned long)bot_inst->GetBotID(),
|
||||
(unsigned long)slot_id,
|
||||
(unsigned long)item_inst->GetID(),
|
||||
(unsigned long)item_inst->GetCharges(),
|
||||
(unsigned long)item_charges,
|
||||
(unsigned long)item_inst->GetColor(),
|
||||
(unsigned long)(item_inst->IsAttuned() ? 1 : 0),
|
||||
item_inst->GetCustomDataString().c_str(),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user