mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-22 13:37:22 +00:00
chore: Change EchoStartSkill to use BitStream reference (#1472)
This commit is contained in:
parent
ab937055e7
commit
c3743877df
@ -305,7 +305,7 @@ SkillExecutionResult SkillComponent::CalculateBehavior(const uint32_t skillId, c
|
|||||||
|
|
||||||
BitStreamUtils::WriteHeader(message, eConnectionType::CLIENT, eClientMessageType::GAME_MSG);
|
BitStreamUtils::WriteHeader(message, eConnectionType::CLIENT, eClientMessageType::GAME_MSG);
|
||||||
message.Write(this->m_Parent->GetObjectID());
|
message.Write(this->m_Parent->GetObjectID());
|
||||||
start.Serialize(&message);
|
start.Serialize(message);
|
||||||
|
|
||||||
Game::server->Send(&message, UNASSIGNED_SYSTEM_ADDRESS, true);
|
Game::server->Send(&message, UNASSIGNED_SYSTEM_ADDRESS, true);
|
||||||
}
|
}
|
||||||
|
@ -32,85 +32,85 @@ public:
|
|||||||
uiSkillHandle = _uiSkillHandle;
|
uiSkillHandle = _uiSkillHandle;
|
||||||
}
|
}
|
||||||
|
|
||||||
EchoStartSkill(RakNet::BitStream* stream) : EchoStartSkill() {
|
EchoStartSkill(RakNet::BitStream& stream) : EchoStartSkill() {
|
||||||
Deserialize(stream);
|
Deserialize(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
~EchoStartSkill() {
|
~EchoStartSkill() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Serialize(RakNet::BitStream* stream) {
|
void Serialize(RakNet::BitStream& stream) {
|
||||||
stream->Write(eGameMessageType::ECHO_START_SKILL);
|
stream.Write(eGameMessageType::ECHO_START_SKILL);
|
||||||
|
|
||||||
stream->Write(bUsedMouse);
|
stream.Write(bUsedMouse);
|
||||||
|
|
||||||
stream->Write(fCasterLatency != 0.0f);
|
stream.Write(fCasterLatency != 0.0f);
|
||||||
if (fCasterLatency != 0.0f) stream->Write(fCasterLatency);
|
if (fCasterLatency != 0.0f) stream.Write(fCasterLatency);
|
||||||
|
|
||||||
stream->Write(iCastType != 0);
|
stream.Write(iCastType != 0);
|
||||||
if (iCastType != 0) stream->Write(iCastType);
|
if (iCastType != 0) stream.Write(iCastType);
|
||||||
|
|
||||||
stream->Write(lastClickedPosit != NiPoint3Constant::ZERO);
|
stream.Write(lastClickedPosit != NiPoint3Constant::ZERO);
|
||||||
if (lastClickedPosit != NiPoint3Constant::ZERO) stream->Write(lastClickedPosit);
|
if (lastClickedPosit != NiPoint3Constant::ZERO) stream.Write(lastClickedPosit);
|
||||||
|
|
||||||
stream->Write(optionalOriginatorID);
|
stream.Write(optionalOriginatorID);
|
||||||
|
|
||||||
stream->Write(optionalTargetID != LWOOBJID_EMPTY);
|
stream.Write(optionalTargetID != LWOOBJID_EMPTY);
|
||||||
if (optionalTargetID != LWOOBJID_EMPTY) stream->Write(optionalTargetID);
|
if (optionalTargetID != LWOOBJID_EMPTY) stream.Write(optionalTargetID);
|
||||||
|
|
||||||
stream->Write(originatorRot != NiQuaternionConstant::IDENTITY);
|
stream.Write(originatorRot != NiQuaternionConstant::IDENTITY);
|
||||||
if (originatorRot != NiQuaternionConstant::IDENTITY) stream->Write(originatorRot);
|
if (originatorRot != NiQuaternionConstant::IDENTITY) stream.Write(originatorRot);
|
||||||
|
|
||||||
uint32_t sBitStreamLength = sBitStream.length();
|
uint32_t sBitStreamLength = sBitStream.length();
|
||||||
stream->Write(sBitStreamLength);
|
stream.Write(sBitStreamLength);
|
||||||
for (uint32_t k = 0; k < sBitStreamLength; k++) {
|
for (uint32_t k = 0; k < sBitStreamLength; k++) {
|
||||||
stream->Write(sBitStream[k]);
|
stream.Write(sBitStream[k]);
|
||||||
}
|
}
|
||||||
|
|
||||||
stream->Write(skillID);
|
stream.Write(skillID);
|
||||||
|
|
||||||
stream->Write(uiSkillHandle != 0);
|
stream.Write(uiSkillHandle != 0);
|
||||||
if (uiSkillHandle != 0) stream->Write(uiSkillHandle);
|
if (uiSkillHandle != 0) stream.Write(uiSkillHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Deserialize(RakNet::BitStream* stream) {
|
bool Deserialize(RakNet::BitStream& stream) {
|
||||||
stream->Read(bUsedMouse);
|
stream.Read(bUsedMouse);
|
||||||
|
|
||||||
bool fCasterLatencyIsDefault{};
|
bool fCasterLatencyIsDefault{};
|
||||||
stream->Read(fCasterLatencyIsDefault);
|
stream.Read(fCasterLatencyIsDefault);
|
||||||
if (fCasterLatencyIsDefault != 0) stream->Read(fCasterLatency);
|
if (fCasterLatencyIsDefault != 0) stream.Read(fCasterLatency);
|
||||||
|
|
||||||
bool iCastTypeIsDefault{};
|
bool iCastTypeIsDefault{};
|
||||||
stream->Read(iCastTypeIsDefault);
|
stream.Read(iCastTypeIsDefault);
|
||||||
if (iCastTypeIsDefault != 0) stream->Read(iCastType);
|
if (iCastTypeIsDefault != 0) stream.Read(iCastType);
|
||||||
|
|
||||||
bool lastClickedPositIsDefault{};
|
bool lastClickedPositIsDefault{};
|
||||||
stream->Read(lastClickedPositIsDefault);
|
stream.Read(lastClickedPositIsDefault);
|
||||||
if (lastClickedPositIsDefault != 0) stream->Read(lastClickedPosit);
|
if (lastClickedPositIsDefault != 0) stream.Read(lastClickedPosit);
|
||||||
|
|
||||||
stream->Read(optionalOriginatorID);
|
stream.Read(optionalOriginatorID);
|
||||||
|
|
||||||
bool optionalTargetIDIsDefault{};
|
bool optionalTargetIDIsDefault{};
|
||||||
stream->Read(optionalTargetIDIsDefault);
|
stream.Read(optionalTargetIDIsDefault);
|
||||||
if (optionalTargetIDIsDefault != 0) stream->Read(optionalTargetID);
|
if (optionalTargetIDIsDefault != 0) stream.Read(optionalTargetID);
|
||||||
|
|
||||||
bool originatorRotIsDefault{};
|
bool originatorRotIsDefault{};
|
||||||
stream->Read(originatorRotIsDefault);
|
stream.Read(originatorRotIsDefault);
|
||||||
if (originatorRotIsDefault != 0) stream->Read(originatorRot);
|
if (originatorRotIsDefault != 0) stream.Read(originatorRot);
|
||||||
|
|
||||||
uint32_t sBitStreamLength{};
|
uint32_t sBitStreamLength{};
|
||||||
stream->Read(sBitStreamLength);
|
stream.Read(sBitStreamLength);
|
||||||
for (uint32_t k = 0; k < sBitStreamLength; k++) {
|
for (uint32_t k = 0; k < sBitStreamLength; k++) {
|
||||||
unsigned char character;
|
unsigned char character;
|
||||||
stream->Read(character);
|
stream.Read(character);
|
||||||
sBitStream.push_back(character);
|
sBitStream.push_back(character);
|
||||||
}
|
}
|
||||||
|
|
||||||
stream->Read(skillID);
|
stream.Read(skillID);
|
||||||
|
|
||||||
bool uiSkillHandleIsDefault{};
|
bool uiSkillHandleIsDefault{};
|
||||||
stream->Read(uiSkillHandleIsDefault);
|
stream.Read(uiSkillHandleIsDefault);
|
||||||
if (uiSkillHandleIsDefault != 0) stream->Read(uiSkillHandle);
|
if (uiSkillHandleIsDefault != 0) stream.Read(uiSkillHandle);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -327,7 +327,7 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System
|
|||||||
echoStartSkill.sBitStream = startSkill.sBitStream;
|
echoStartSkill.sBitStream = startSkill.sBitStream;
|
||||||
echoStartSkill.skillID = startSkill.skillID;
|
echoStartSkill.skillID = startSkill.skillID;
|
||||||
echoStartSkill.uiSkillHandle = startSkill.uiSkillHandle;
|
echoStartSkill.uiSkillHandle = startSkill.uiSkillHandle;
|
||||||
echoStartSkill.Serialize(&bitStreamLocal);
|
echoStartSkill.Serialize(bitStreamLocal);
|
||||||
|
|
||||||
Game::server->Send(&bitStreamLocal, entity->GetSystemAddress(), true);
|
Game::server->Send(&bitStreamLocal, entity->GetSystemAddress(), true);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user