2016-01-12 03:41:44 +00:00
|
|
|
//
|
|
|
|
// Created by koncord on 07.01.16.
|
|
|
|
//
|
|
|
|
|
2016-09-28 08:36:29 +00:00
|
|
|
#include "PacketEquipment.hpp"
|
2016-01-12 03:41:44 +00:00
|
|
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
|
|
|
|
|
|
|
using namespace mwmp;
|
|
|
|
|
2016-10-17 12:54:36 +00:00
|
|
|
PacketEquipment::PacketEquipment(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
|
2016-01-12 03:41:44 +00:00
|
|
|
{
|
2016-09-28 08:36:29 +00:00
|
|
|
packetID = ID_GAME_EQUIPMENT;
|
2016-01-12 03:41:44 +00:00
|
|
|
}
|
|
|
|
|
2016-09-28 08:36:29 +00:00
|
|
|
void PacketEquipment::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
|
2016-01-12 03:41:44 +00:00
|
|
|
{
|
2016-10-17 12:54:36 +00:00
|
|
|
PlayerPacket::Packet(bs, player, send);
|
2016-01-12 03:41:44 +00:00
|
|
|
|
2016-08-17 15:20:36 +00:00
|
|
|
for (int i = 0; i < 19; i++)
|
2016-01-12 03:41:44 +00:00
|
|
|
{
|
|
|
|
RW(player->EquipedItem(i)->refid, send);
|
|
|
|
RW(player->EquipedItem(i)->count, send);
|
Implement inventory functions
AddItem, RemoveItem, GetItemName, GetItemCount, GetItemHealth, GetInventorySize SendInventory
Example:
```lua
tes3mp.AddItem(pid, "glass dagger", 1, 50)
tes3mp.AddItem(pid, "glass dagger", 1, -1)
tes3mp.SendInventory(pid)
tes3mp.RemoveItem(pid, "glass dagger", 1)
tes3mp.SendInventory(pid)
local invSize = tes3mp.GetInventorySize(pid) - 1
for i = 0, invSize do
print(("%s %d %d"):format(tes3mp.GetItemName(pid, i), tes3mp.GetItemCount(pid, i), tes3mp.GetItemHealth(pid, i)))
end
```
2016-10-22 18:57:37 +00:00
|
|
|
RW(player->EquipedItem(i)->health, send);
|
2016-01-12 03:41:44 +00:00
|
|
|
}
|
|
|
|
}
|