refactor: update behavior slot determination to use equipLocation instead of itemType

This commit is contained in:
Aaron Kimbrell
2026-06-08 22:27:42 -05:00
parent a156a8fcba
commit 54dc3a0b80
2 changed files with 14 additions and 23 deletions

View File

@@ -1180,14 +1180,12 @@ LOT InventoryComponent::GetConsumable() const {
void InventoryComponent::AddItemSkills(const LOT lot) { void InventoryComponent::AddItemSkills(const LOT lot) {
const auto info = Inventory::FindItemComponent(lot); const auto info = Inventory::FindItemComponent(lot);
const auto slot = FindBehaviorSlot(static_cast<eItemType>(info.itemType)); const auto slot = FindBehaviorSlot(info.equipLocation);
if (slot == BehaviorSlot::Invalid) { if (slot == BehaviorSlot::Invalid) {
return; return;
} }
const auto index = m_Skills.find(slot);
const auto skill = FindSkill(lot); const auto skill = FindSkill(lot);
SetSkill(slot, skill); SetSkill(slot, skill);
@@ -1215,7 +1213,7 @@ void InventoryComponent::FixInvisibleItems() {
void InventoryComponent::RemoveItemSkills(const LOT lot) { void InventoryComponent::RemoveItemSkills(const LOT lot) {
const auto info = Inventory::FindItemComponent(lot); const auto info = Inventory::FindItemComponent(lot);
const auto slot = FindBehaviorSlot(static_cast<eItemType>(info.itemType)); const auto slot = FindBehaviorSlot(info.equipLocation);
if (slot == BehaviorSlot::Invalid) { if (slot == BehaviorSlot::Invalid) {
return; return;
@@ -1327,23 +1325,17 @@ void InventoryComponent::RemoveDatabasePet(LWOOBJID id) {
m_Pets.erase(id); m_Pets.erase(id);
} }
BehaviorSlot InventoryComponent::FindBehaviorSlot(const eItemType type) { BehaviorSlot InventoryComponent::FindBehaviorSlot(const std::string& equipLocation) {
switch (type) { // Skill slot is determined by equipLocation, not itemType.
case eItemType::HAT: // Mapping confirmed against live captures and client data (issue #1339).
return BehaviorSlot::Head; if (equipLocation == "special_r") return BehaviorSlot::Primary;
case eItemType::NECK: if (equipLocation == "hair") return BehaviorSlot::Head;
return BehaviorSlot::Neck; if (equipLocation == "special_l") return BehaviorSlot::Offhand;
case eItemType::LEFT_HAND: if (equipLocation == "clavicle") return BehaviorSlot::Neck;
return BehaviorSlot::Offhand; return BehaviorSlot::Invalid;
case eItemType::RIGHT_HAND:
return BehaviorSlot::Primary;
case eItemType::CONSUMABLE:
return BehaviorSlot::Consumable;
default:
return BehaviorSlot::Invalid;
}
} }
bool InventoryComponent::IsTransferInventory(eInventoryType type, bool includeVault) { bool InventoryComponent::IsTransferInventory(eInventoryType type, bool includeVault) {
return type == VENDOR_BUYBACK || (includeVault && (type == VAULT_ITEMS || type == VAULT_MODELS)) || type == TEMP_ITEMS || type == TEMP_MODELS || type == MODELS_IN_BBB; return type == VENDOR_BUYBACK || (includeVault && (type == VAULT_ITEMS || type == VAULT_MODELS)) || type == TEMP_ITEMS || type == TEMP_MODELS || type == MODELS_IN_BBB;
} }

View File

@@ -367,11 +367,10 @@ public:
void RemoveDatabasePet(LWOOBJID id); void RemoveDatabasePet(LWOOBJID id);
/** /**
* Returns the current behavior slot active for the passed item type * Returns the behavior slot for the given equipLocation string.
* @param type the item type to find the behavior slot for * This is the authoritative mapping used for skill slot assignment.
* @return the current behavior slot active for the passed item type
*/ */
static BehaviorSlot FindBehaviorSlot(eItemType type); static BehaviorSlot FindBehaviorSlot(const std::string& equipLocation);
/** /**
* Checks if the inventory type is a temp inventory * Checks if the inventory type is a temp inventory