[Patch] Hotbar fix for items and equipped slots
Posted: Sat Jun 05, 2010 10:57 pm
Bug: Hotkey an item in your inventory or an item that is equipped and then camp. When you come back, equipped item hotkeys show only the primary slot and inventory items show no item.
Fix: This is happening because the spell_id field in the character_skillbar table is being ignored for item/equipped item hotkeys. For inventory items the spell_id field holds the item_id. For equipped items it holds the slot_id.
Here's the code diffs.
player.h - I added defines for the hotkey types that I figured out. I couldn't figure out what type 5 is.
client.cpp - only change here was to use the constant instead of a number. Not a fix, but better to maintain.
WorldDatabase.cpp
Fix: This is happening because the spell_id field in the character_skillbar table is being ignored for item/equipped item hotkeys. For inventory items the spell_id field holds the item_id. For equipped items it holds the slot_id.
Here's the code diffs.
player.h - I added defines for the hotkey types that I figured out. I couldn't figure out what type 5 is.
Code: Select all
--- Player.h (rev 437)
+++ Player.h (working copy)
@@ -119,7 +119,10 @@
bool save_needed;
};
#define QUICKBAR_NORMAL 1
+#define QUICKBAR_INV_SLOT 2
+#define QUICKBAR_MACRO 3
#define QUICKBAR_TEXT_CMD 4
+#define QUICKBAR_ITEM 6
#define EXP_DISABLED_STATE 0
#define EXP_ENABLED_STATE 1
Code: Select all
--- client.cpp (rev 438)
+++ client.cpp (working copy)
@@ -1559,7 +1559,7 @@
if(type == 0xFFFFFFFF)
GetPlayer()->RemoveQuickbarItem(bar, slot);
else{
- if(type == 1)
+ if(type == QUICKBAR_NORMAL)
spell = master_spell_list.GetSpell(id, tier);
if(spell)
GetPlayer()->AddQuickbarItem(bar, slot, type, spell->GetSpellIcon(), spell->GetSpellIconType(), id, tier, 0, text.data.c_str());
Code: Select all
--- WorldDatabase.cpp (rev 441)
+++ WorldDatabase.cpp (working copy)
@@ -4024,10 +4024,10 @@
Spell* spell = master_spell_list.GetSpell(atoul(row[2]), tier);
if(spell)
client->GetPlayer()->AddQuickbarItem(atoul(row[5]), atoul(row[3]), atoul(row[1]), spell->GetSpellIcon(), spell->GetSpellIconType(), spell->GetSpellID(), spell->GetSpellTier(), atoul(row[0]), row[4], false);
- else if(atoul(row[1]) == 3)
+ else if(atoul(row[1]) == QUICKBAR_MACRO)
client->GetPlayer()->AddQuickbarItem(atoul(row[5]), atoul(row[3]), atoul(row[1]), client->GetPlayer()->macro_icons[atoul(row[2])], 0xFFFF, atoul(row[2]), 0, atoul(row[0]), row[4], false);
else
- client->GetPlayer()->AddQuickbarItem(atoul(row[5]), atoul(row[3]), atoul(row[1]), 0, 0, 0, 0, atoul(row[0]), row[4], false);
+ client->GetPlayer()->AddQuickbarItem(atoul(row[5]), atoul(row[3]), atoul(row[1]), 0, 0, atoul(row[2]), 0, atoul(row[0]), row[4], false);
}
if(query.GetErrorNumber())
LogFile->write(EQEMuLog::Error, "Error Loading Player Skillbar, Query: %s, Error: %s", query.GetQuery(), query.GetError());