2024-10-30 07:30:20 +00:00
|
|
|
#ifndef ECHOSYNCSKILL_H
|
|
|
|
#define ECHOSYNCSKILL_H
|
2023-01-07 05:17:05 +00:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include "BitStream.h"
|
2023-05-03 21:38:32 +00:00
|
|
|
#include "eGameMessageType.h"
|
2023-01-07 05:17:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* Message to synchronize a skill cast */
|
|
|
|
class EchoSyncSkill {
|
|
|
|
public:
|
|
|
|
EchoSyncSkill() {
|
|
|
|
bDone = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
EchoSyncSkill(std::string _sBitStream, uint32_t _uiBehaviorHandle, uint32_t _uiSkillHandle, bool _bDone = false) {
|
|
|
|
bDone = _bDone;
|
|
|
|
sBitStream = _sBitStream;
|
|
|
|
uiBehaviorHandle = _uiBehaviorHandle;
|
|
|
|
uiSkillHandle = _uiSkillHandle;
|
|
|
|
}
|
|
|
|
|
2024-02-26 14:08:56 +00:00
|
|
|
EchoSyncSkill(RakNet::BitStream& stream) : EchoSyncSkill() {
|
2023-01-07 05:17:05 +00:00
|
|
|
Deserialize(stream);
|
|
|
|
}
|
|
|
|
|
|
|
|
~EchoSyncSkill() {
|
|
|
|
}
|
|
|
|
|
2024-02-26 14:08:56 +00:00
|
|
|
void Serialize(RakNet::BitStream& stream) {
|
|
|
|
stream.Write(eGameMessageType::ECHO_SYNC_SKILL);
|
2023-01-07 05:17:05 +00:00
|
|
|
|
2024-02-26 14:08:56 +00:00
|
|
|
stream.Write(bDone);
|
2023-01-07 05:17:05 +00:00
|
|
|
uint32_t sBitStreamLength = sBitStream.length();
|
2024-02-26 14:08:56 +00:00
|
|
|
stream.Write(sBitStreamLength);
|
2023-01-07 05:17:05 +00:00
|
|
|
for (uint32_t k = 0; k < sBitStreamLength; k++) {
|
2024-02-26 14:08:56 +00:00
|
|
|
stream.Write(sBitStream[k]);
|
2023-01-07 05:17:05 +00:00
|
|
|
}
|
|
|
|
|
2024-02-26 14:08:56 +00:00
|
|
|
stream.Write(uiBehaviorHandle);
|
|
|
|
stream.Write(uiSkillHandle);
|
2023-01-07 05:17:05 +00:00
|
|
|
}
|
|
|
|
|
2024-02-26 14:08:56 +00:00
|
|
|
bool Deserialize(RakNet::BitStream& stream) {
|
|
|
|
stream.Read(bDone);
|
2023-01-07 05:17:05 +00:00
|
|
|
|
|
|
|
uint32_t sBitStreamLength{};
|
2024-02-26 14:08:56 +00:00
|
|
|
stream.Read(sBitStreamLength);
|
2023-01-07 05:17:05 +00:00
|
|
|
for (unsigned int k = 0; k < sBitStreamLength; k++) {
|
|
|
|
unsigned char character;
|
2024-02-26 14:08:56 +00:00
|
|
|
stream.Read(character);
|
2023-01-07 05:17:05 +00:00
|
|
|
sBitStream.push_back(character);
|
|
|
|
}
|
|
|
|
|
2024-02-26 14:08:56 +00:00
|
|
|
stream.Read(uiBehaviorHandle);
|
|
|
|
stream.Read(uiSkillHandle);
|
2023-01-07 05:17:05 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool bDone{};
|
|
|
|
std::string sBitStream{};
|
|
|
|
uint32_t uiBehaviorHandle{};
|
|
|
|
uint32_t uiSkillHandle{};
|
|
|
|
};
|
|
|
|
|
2024-10-30 07:30:20 +00:00
|
|
|
#endif //!ECHOSYNCSKILL_H
|