diff --git a/apps/openmw-mp/Script/Functions/Items.cpp b/apps/openmw-mp/Script/Functions/Items.cpp index 77d3b6466..812854201 100644 --- a/apps/openmw-mp/Script/Functions/Items.cpp +++ b/apps/openmw-mp/Script/Functions/Items.cpp @@ -24,9 +24,6 @@ void ItemFunctions::EquipItem(unsigned short pid, unsigned short slot, const cha player->EquipedItem(slot)->refid = itemName; player->EquipedItem(slot)->count = count; - - mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_EQUIPMENT)->Send(player, false); - mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_EQUIPMENT)->Send(player, true); } void ItemFunctions::UnequipItem(unsigned short pid, unsigned short slot) noexcept @@ -37,12 +34,10 @@ void ItemFunctions::UnequipItem(unsigned short pid, unsigned short slot) noexcep const char *ItemFunctions::GetItemSlot(unsigned short pid, unsigned short slot) noexcept { - /*Player *player; + Player *player; GET_PLAYER(pid, player, 0); - return player->EquipedItem(slot)->refid.c_str();*/ - LOG_MESSAGE(Log::LOG_WARN, "%s", "stub"); - return ""; + return player->EquipedItem(slot)->refid.c_str(); } bool ItemFunctions::HasItemEquipped(unsigned short pid, const char* itemName) @@ -63,4 +58,13 @@ void ItemFunctions::RemoveItem(unsigned short pid, const char* itemName, unsigne void ItemFunctions::GetItemCount(unsigned short pid, const char* itemName) noexcept { LOG_MESSAGE(Log::LOG_WARN, "%s", "stub"); -} \ No newline at end of file +} + +void ItemFunctions::SendEquipment(unsigned short pid) noexcept +{ + Player *player; + GET_PLAYER(pid, player, ); + + mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_EQUIPMENT)->Send(player, false); + mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_EQUIPMENT)->Send(player, true); +} diff --git a/apps/openmw-mp/Script/Functions/Items.hpp b/apps/openmw-mp/Script/Functions/Items.hpp index a0c0e1598..59fcd331f 100644 --- a/apps/openmw-mp/Script/Functions/Items.hpp +++ b/apps/openmw-mp/Script/Functions/Items.hpp @@ -6,13 +6,16 @@ #define OPENMW_ITEMS_HPP #define ITEMAPI \ - {"AddItem", ItemFunctions::AddItem},\ - {"RemoveItem", ItemFunctions::RemoveItem},\ - {"GetItemCount", ItemFunctions::GetItemCount},\ - {"EquipItem", ItemFunctions::EquipItem},\ - {"UnequipItem", ItemFunctions::UnequipItem},\ - {"GetItemSlot", ItemFunctions::GetItemSlot},\ - {"HasItemEquipped", ItemFunctions::HasItemEquipped}\ + {"AddItem", ItemFunctions::AddItem},\ + {"RemoveItem", ItemFunctions::RemoveItem},\ + {"GetItemCount", ItemFunctions::GetItemCount},\ + {"EquipItem", ItemFunctions::EquipItem},\ + {"UnequipItem", ItemFunctions::UnequipItem},\ + {"GetItemSlot", ItemFunctions::GetItemSlot},\ + {"HasItemEquipped", ItemFunctions::HasItemEquipped},\ + \ + {"SendEquipment", ItemFunctions::SendEquipment}\ + class ItemFunctions { @@ -24,6 +27,8 @@ public: static void UnequipItem(unsigned short pid, unsigned short slot) noexcept; static bool HasItemEquipped(unsigned short pid, const char* itemName); static const char *GetItemSlot(unsigned short pid, unsigned short slot) noexcept; + + static void SendEquipment(unsigned short pid) noexcept; }; #endif //OPENMW_ITEMS_HPP diff --git a/apps/openmw-mp/Script/Functions/Stats.hpp b/apps/openmw-mp/Script/Functions/Stats.hpp index 48cd4e4ad..64aaaab1b 100644 --- a/apps/openmw-mp/Script/Functions/Stats.hpp +++ b/apps/openmw-mp/Script/Functions/Stats.hpp @@ -70,7 +70,7 @@ {"Resurrect", StatsFunctions::Resurrect},\ {"SendBaseInfo", StatsFunctions::SendBaseInfo},\ \ - {"SendDynamicStats", StatsFunctions::SendDynamicStats}, \ + {"SendDynamicStats", StatsFunctions::SendDynamicStats},\ {"SendAttributes", StatsFunctions::SendAttributes},\ {"SendSkills", StatsFunctions::SendSkills},\ {"SendLevel", StatsFunctions::SendLevel}