diff --git a/Code/client/Games/Skyrim/Actor.cpp b/Code/client/Games/Skyrim/Actor.cpp index 2bec95727..c1014df8f 100644 --- a/Code/client/Games/Skyrim/Actor.cpp +++ b/Code/client/Games/Skyrim/Actor.cpp @@ -303,6 +303,14 @@ MagicEquipment Actor::GetMagicEquipment() const noexcept return equipment; } +Inventory Actor::GetEquipment() const noexcept +{ + Inventory inventory = GetInventory(); + inventory.RemoveByFilter([](const auto& entry) { return !entry.IsWorn(); }); + inventory.CurrentMagicEquipment = GetMagicEquipment(); + return inventory; +} + int32_t Actor::GetGoldAmount() noexcept { TP_THIS_FUNCTION(TGetGoldAmount, int32_t, Actor); @@ -328,18 +336,21 @@ void Actor::SetMagicEquipment(const MagicEquipment& acEquipment) noexcept if (acEquipment.LeftHandSpell) { uint32_t mainHandWeaponId = modSystem.GetGameId(acEquipment.LeftHandSpell); + spdlog::debug("Setting left hand spell: {:X}", mainHandWeaponId); pEquipManager->EquipSpell(this, TESForm::GetById(mainHandWeaponId), 0); } if (acEquipment.RightHandSpell) { uint32_t secondaryHandWeaponId = modSystem.GetGameId(acEquipment.RightHandSpell); + spdlog::debug("Setting right hand spell: {:X}", secondaryHandWeaponId); pEquipManager->EquipSpell(this, TESForm::GetById(secondaryHandWeaponId), 1); } if (acEquipment.Shout) { uint32_t shoutId = modSystem.GetGameId(acEquipment.Shout); + spdlog::debug("Setting shout: {:X}", shoutId); pEquipManager->EquipShout(this, TESForm::GetById(shoutId)); } } diff --git a/Code/client/Games/Skyrim/Actor.h b/Code/client/Games/Skyrim/Actor.h index c7061b087..949a267a2 100644 --- a/Code/client/Games/Skyrim/Actor.h +++ b/Code/client/Games/Skyrim/Actor.h @@ -192,6 +192,7 @@ struct Actor : TESObjectREFR float GetActorPermanentValue(uint32_t aId) const noexcept; Inventory GetActorInventory() const noexcept; MagicEquipment GetMagicEquipment() const noexcept; + Inventory GetEquipment() const noexcept; int32_t GetGoldAmount() noexcept; Factions GetFactions() const noexcept; diff --git a/Code/client/Games/Skyrim/TESObjectREFR.cpp b/Code/client/Games/Skyrim/TESObjectREFR.cpp index 1f06ab626..142f07290 100644 --- a/Code/client/Games/Skyrim/TESObjectREFR.cpp +++ b/Code/client/Games/Skyrim/TESObjectREFR.cpp @@ -462,13 +462,6 @@ Inventory TESObjectREFR::GetWornArmor() const noexcept return wornArmor; } -Inventory TESObjectREFR::GetEquippedItems() const noexcept -{ - Inventory inventory = GetInventory(); - inventory.RemoveByFilter([](const auto& entry) { return !entry.IsWorn(); }); - return inventory; -} - bool TESObjectREFR::IsItemInInventory(uint32_t aFormID) const noexcept { Inventory inventory = GetInventory([aFormID](TESForm& aForm) { return aForm.formID == aFormID; }); diff --git a/Code/client/Games/Skyrim/TESObjectREFR.h b/Code/client/Games/Skyrim/TESObjectREFR.h index 38473ceba..dee42dd8a 100644 --- a/Code/client/Games/Skyrim/TESObjectREFR.h +++ b/Code/client/Games/Skyrim/TESObjectREFR.h @@ -195,7 +195,6 @@ struct TESObjectREFR : TESForm Inventory GetInventory(std::function aFilter) const noexcept; Inventory GetArmor() const noexcept; Inventory GetWornArmor() const noexcept; - Inventory GetEquippedItems() const noexcept; bool IsItemInInventory(uint32_t aFormID) const noexcept; diff --git a/Code/client/Services/Generic/InventoryService.cpp b/Code/client/Services/Generic/InventoryService.cpp index 908a77dfa..939614fae 100644 --- a/Code/client/Services/Generic/InventoryService.cpp +++ b/Code/client/Services/Generic/InventoryService.cpp @@ -116,7 +116,7 @@ void InventoryService::OnEquipmentChangeEvent(const EquipmentChangeEvent& acEven request.IsSpell = acEvent.IsSpell; request.IsShout = acEvent.IsShout; request.IsAmmo = acEvent.IsAmmo; - request.CurrentInventory = pActor->GetEquippedItems(); + request.CurrentInventory = pActor->GetEquipment(); m_transport.Send(request); }