forked from teamnwah/openmw-tes3coop
Make GetItemSlot work and add SendEquipment in server item functions
This commit is contained in:
parent
728a09e423
commit
4b96080521
3 changed files with 25 additions and 16 deletions
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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}
|
||||
|
|
Loading…
Reference in a new issue