diff --git a/apps/openmw-mp/Script/Functions/Actors.cpp b/apps/openmw-mp/Script/Functions/Actors.cpp index 64e10a8a4..6827809fc 100644 --- a/apps/openmw-mp/Script/Functions/Actors.cpp +++ b/apps/openmw-mp/Script/Functions/Actors.cpp @@ -232,6 +232,18 @@ void ActorFunctions::SetActorFatigueCurrent(double value) noexcept tempActor.creatureStats.mDynamic[2].mCurrent = value; } +void ActorFunctions::EquipActorItem(unsigned short slot, const char *refId, unsigned int count, int charge) noexcept +{ + tempActor.equipedItems[slot].refId = refId; + tempActor.equipedItems[slot].count = count; + tempActor.equipedItems[slot].charge = charge; +} + +void ActorFunctions::UnequipActorItem(unsigned short slot) noexcept +{ + ActorFunctions::EquipActorItem(slot, "", 0, -1); +} + void ActorFunctions::AddActor() noexcept { writeActorList.baseActors.push_back(tempActor); @@ -274,6 +286,12 @@ void ActorFunctions::SendActorStatsDynamic() noexcept mwmp::Networking::get().getActorPacketController()->GetPacket(ID_ACTOR_STATS_DYNAMIC)->Send(writeActorList.guid); } +void ActorFunctions::SendActorEquipment() noexcept +{ + mwmp::Networking::get().getActorPacketController()->GetPacket(ID_ACTOR_EQUIPMENT)->setActorList(&writeActorList); + mwmp::Networking::get().getActorPacketController()->GetPacket(ID_ACTOR_EQUIPMENT)->Send(writeActorList.guid); +} + void ActorFunctions::SendActorCellChange() noexcept { mwmp::Networking::get().getActorPacketController()->GetPacket(ID_ACTOR_CELL_CHANGE)->setActorList(&writeActorList); diff --git a/apps/openmw-mp/Script/Functions/Actors.hpp b/apps/openmw-mp/Script/Functions/Actors.hpp index d5ce91cd3..9b8271fa5 100644 --- a/apps/openmw-mp/Script/Functions/Actors.hpp +++ b/apps/openmw-mp/Script/Functions/Actors.hpp @@ -53,12 +53,16 @@ {"SetActorFatigueBase", ActorFunctions::SetActorFatigueBase},\ {"SetActorFatigueCurrent", ActorFunctions::SetActorFatigueCurrent},\ \ + {"EquipActorItem", ActorFunctions::EquipActorItem},\ + {"UnequipActorItem", ActorFunctions::UnequipActorItem},\ + \ {"AddActor", ActorFunctions::AddActor},\ \ {"SendActorList", ActorFunctions::SendActorList},\ {"SendActorAuthority", ActorFunctions::SendActorAuthority},\ {"SendActorPosition", ActorFunctions::SendActorPosition},\ {"SendActorStatsDynamic", ActorFunctions::SendActorStatsDynamic},\ + {"SendActorEquipment", ActorFunctions::SendActorEquipment},\ {"SendActorCellChange", ActorFunctions::SendActorCellChange} class ActorFunctions @@ -116,12 +120,16 @@ public: static void SetActorFatigueBase(double value) noexcept; static void SetActorFatigueCurrent(double value) noexcept; + static void EquipActorItem(unsigned short slot, const char* refId, unsigned int count, int charge) noexcept; + static void UnequipActorItem(unsigned short slot) noexcept; + static void AddActor() noexcept; static void SendActorList() noexcept; static void SendActorAuthority() noexcept; static void SendActorPosition() noexcept; static void SendActorStatsDynamic() noexcept; + static void SendActorEquipment() noexcept; static void SendActorCellChange() noexcept; };