diff --git a/Code/client/Games/Skyrim/Actor.cpp b/Code/client/Games/Skyrim/Actor.cpp index 432dedc9f..87470bce2 100644 --- a/Code/client/Games/Skyrim/Actor.cpp +++ b/Code/client/Games/Skyrim/Actor.cpp @@ -449,35 +449,7 @@ void Actor::SetPlayerTeammate(bool aSet) noexcept void Actor::UnEquipAll() noexcept { - // For each change - const auto pContainerChanges = GetContainerChanges()->entries; - for (auto pChange : *pContainerChanges) - { - if (pChange && pChange->form && pChange->dataList) - { - // Parse all extra data lists - const auto pDataLists = pChange->dataList; - for (auto* pDataList : *pDataLists) - { - if (pDataList) - { - BSScopedLock _(pDataList->lock); - - // Right slot - if (pDataList->Contains(ExtraDataType::Worn)) - { - EquipManager::Get()->UnEquip(this, pChange->form, pDataList, 1, DefaultObjectManager::Get().rightEquipSlot, false, true, false, false, nullptr); - } - - // Left slot - if (pDataList->Contains(ExtraDataType::WornLeft)) - { - EquipManager::Get()->UnEquip(this, pChange->form, pDataList, 1, DefaultObjectManager::Get().leftEquipSlot, false, true, false, false, nullptr); - } - } - } - } - } + EquipManager::Get()->UnequipAll(this); // Taken from skyrim's code shouts can be two form types apparently if (equippedShout && ((int)equippedShout->formType - 41) <= 1) diff --git a/Code/client/Games/Skyrim/EquipManager.cpp b/Code/client/Games/Skyrim/EquipManager.cpp index 7dd854760..34f10e023 100644 --- a/Code/client/Games/Skyrim/EquipManager.cpp +++ b/Code/client/Games/Skyrim/EquipManager.cpp @@ -131,6 +131,16 @@ void* EquipManager::UnEquipShout(Actor* apActor, TESForm* apShout) return TiltedPhoques::ThisCall(s_unequipFunc, this, apActor, apShout); } +void EquipManager::UnequipAll(Actor* apActor) +{ + TP_THIS_FUNCTION(TUnEquipAll, void, EquipManager, Actor*); + POINTER_SKYRIMSE(TUnEquipAll, s_unequipAll, 38899); + + ScopedEquipOverride equipOverride; + + TiltedPhoques::ThisCall(s_unequipAll, this, apActor); +} + void* TP_MAKE_THISCALL(EquipHook, EquipManager, Actor* apActor, TESForm* apItem, EquipData* apData) { if (!apActor) diff --git a/Code/client/Games/Skyrim/EquipManager.h b/Code/client/Games/Skyrim/EquipManager.h index 80b527b07..0e16f22a3 100644 --- a/Code/client/Games/Skyrim/EquipManager.h +++ b/Code/client/Games/Skyrim/EquipManager.h @@ -14,4 +14,5 @@ struct EquipManager void* UnEquipSpell(Actor* apActor, TESForm* apSpell, uint32_t aSlotId); void* EquipShout(Actor* apActor, TESForm* apShout); void* UnEquipShout(Actor* apActor, TESForm* apShout); + void UnequipAll(Actor* apActor); }; diff --git a/Code/client/Services/Debug/DebugService.cpp b/Code/client/Services/Debug/DebugService.cpp index ebcc62d8c..8f0d0e0af 100644 --- a/Code/client/Services/Debug/DebugService.cpp +++ b/Code/client/Services/Debug/DebugService.cpp @@ -212,6 +212,7 @@ void DebugService::OnUpdate(const UpdateEvent& acUpdateEvent) noexcept // m_world.GetOverlayService().Reload(); auto* pPlayer = PlayerCharacter::Get(); spdlog::info("{}", pPlayer->formID); + pPlayer->UnEquipAll(); } } else