mirror of
https://github.com/TES3MP/TES3MP.git
synced 2025-09-27 15:11:36 -04:00
[General] Add action types to WorldEvent's ContainerChanges
This commit is contained in:
parent
a07e616878
commit
9f8bed9be1
@ -66,7 +66,7 @@ namespace mwmp
|
|||||||
{
|
{
|
||||||
ESM::Cell cell;
|
ESM::Cell cell;
|
||||||
|
|
||||||
enum CELl_STATE_ACTION
|
enum CELL_STATE_ACTION
|
||||||
{
|
{
|
||||||
LOAD = 0,
|
LOAD = 0,
|
||||||
UNLOAD = 1
|
UNLOAD = 1
|
||||||
@ -91,7 +91,7 @@ namespace mwmp
|
|||||||
ADD,
|
ADD,
|
||||||
REMOVE
|
REMOVE
|
||||||
};
|
};
|
||||||
int action; //0 - Clear and set in entirety, 1 - Add item, 2 - Remove item
|
int action; // 0 - Clear and set in entirety, 1 - Add item, 2 - Remove item
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SpellbookChanges
|
struct SpellbookChanges
|
||||||
@ -104,7 +104,7 @@ namespace mwmp
|
|||||||
ADD,
|
ADD,
|
||||||
REMOVE
|
REMOVE
|
||||||
};
|
};
|
||||||
int action; //0 - Clear and set in entirety, 1 - Add spell, 2 - Remove spell
|
int action; // 0 - Clear and set in entirety, 1 - Add spell, 2 - Remove spell
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CellStateChanges
|
struct CellStateChanges
|
||||||
|
@ -36,12 +36,34 @@ namespace mwmp
|
|||||||
std::string refId;
|
std::string refId;
|
||||||
int count;
|
int count;
|
||||||
int health;
|
int health;
|
||||||
|
|
||||||
inline bool operator==(const ContainerItem& rhs)
|
inline bool operator==(const ContainerItem& rhs)
|
||||||
{
|
{
|
||||||
return refId == rhs.refId && count == rhs.count && health == rhs.health;
|
return refId == rhs.refId && count == rhs.count && health == rhs.health;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct ObjectChanges
|
||||||
|
{
|
||||||
|
std::vector<WorldObject> objects;
|
||||||
|
unsigned int count;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ContainerChanges
|
||||||
|
{
|
||||||
|
std::vector<ContainerItem> items;
|
||||||
|
unsigned int count;
|
||||||
|
|
||||||
|
enum CONTAINER_ACTION
|
||||||
|
{
|
||||||
|
SET = 0,
|
||||||
|
ADD = 1,
|
||||||
|
REMOVE = 2
|
||||||
|
};
|
||||||
|
|
||||||
|
int action; // 0 - Clear and set in entirety, 1 - Add item, 2 - Remove item
|
||||||
|
};
|
||||||
|
|
||||||
class WorldEvent
|
class WorldEvent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -56,18 +78,6 @@ namespace mwmp
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ObjectChanges
|
|
||||||
{
|
|
||||||
std::vector<WorldObject> objects;
|
|
||||||
unsigned int count;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ContainerChanges
|
|
||||||
{
|
|
||||||
std::vector<ContainerItem> items;
|
|
||||||
unsigned int count;
|
|
||||||
};
|
|
||||||
|
|
||||||
RakNet::RakNetGUID guid;
|
RakNet::RakNetGUID guid;
|
||||||
ObjectChanges objectChanges;
|
ObjectChanges objectChanges;
|
||||||
ContainerChanges containerChanges;
|
ContainerChanges containerChanges;
|
||||||
|
@ -12,8 +12,13 @@ void PacketContainer::Packet(RakNet::BitStream *bs, WorldEvent *event, bool send
|
|||||||
{
|
{
|
||||||
WorldPacket::Packet(bs, event, send);
|
WorldPacket::Packet(bs, event, send);
|
||||||
|
|
||||||
|
RW(event->containerChanges.action, send);
|
||||||
|
|
||||||
if (!send)
|
if (!send)
|
||||||
|
{
|
||||||
event->objectChanges.objects.clear();
|
event->objectChanges.objects.clear();
|
||||||
|
event->containerChanges.items.clear();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
event->objectChanges.count = (unsigned int)(event->objectChanges.objects.size());
|
event->objectChanges.count = (unsigned int)(event->objectChanges.objects.size());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user