[Client] Update old packet-sending code in LocalPlayer and GUIChat

0.6.1
David Cernat 8 years ago
parent a2ef39c655
commit cf6de6c474

@ -134,9 +134,7 @@ namespace mwmp
localPlayer->chatMessage = str; localPlayer->chatMessage = str;
RakNet::BitStream bs; networking->getPlayerPacket(ID_CHAT_MESSAGE)->Send(localPlayer);
networking->getPlayerPacket(ID_CHAT_MESSAGE)->Packet(&bs, localPlayer, true);
networking->sendData(&bs);
} }
void GUIChat::clean() void GUIChat::clean()

@ -356,9 +356,7 @@ void LocalPlayer::updateCell(bool forceUpdate)
// cell change events in server scripts will have the wrong player position // cell change events in server scripts will have the wrong player position
updatePosition(true); updatePosition(true);
RakNet::BitStream bs; getNetworking()->getPlayerPacket(ID_PLAYER_CELL_CHANGE)->Send(this);
getNetworking()->getPlayerPacket(ID_PLAYER_CELL_CHANGE)->Packet(&bs, this, true);
getNetworking()->sendData(&bs);
// Also force an update to skills (to send all progress to skill increases) // Also force an update to skills (to send all progress to skill increases)
updateSkills(true); updateSkills(true);
@ -422,10 +420,7 @@ void LocalPlayer::updateEquipment(bool forceUpdate)
if (equipChanged) if (equipChanged)
{ {
RakNet::BitStream bs; getNetworking()->getPlayerPacket(ID_PLAYER_EQUIPMENT)->Send(this);
bs.ResetWritePointer();
getNetworking()->getPlayerPacket(ID_PLAYER_EQUIPMENT)->Packet(&bs, this, true);
getNetworking()->sendData(&bs);
equipChanged = false; equipChanged = false;
} }
} }
@ -523,10 +518,6 @@ void LocalPlayer::updateAttackState(bool forceUpdate)
attack.type = Attack::MAGIC; attack.type = Attack::MAGIC;
attack.pressed = true; attack.pressed = true;
attack.refid = spell; attack.refid = spell;
/*RakNet::BitStream bs;
getNetworking()->getPlayerPacket(ID_PLAYER_ATTACK)->Packet(&bs, this, true);
getNetworking()->SendData(&bs);*/
} }
else if (state == MWMechanics::DrawState_Weapon) else if (state == MWMechanics::DrawState_Weapon)
{ {
@ -556,8 +547,9 @@ void LocalPlayer::updateDeadState(bool forceUpdate)
{ {
creatureStats.mDead = true; creatureStats.mDead = true;
RakNet::BitStream bs; RakNet::BitStream bs;
getNetworking()->getPlayerPacket((RakNet::MessageID)ID_PLAYER_DEATH)->Packet(&bs, this, true);
getNetworking()->sendData(&bs); LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Sending ID_PLAYER_DEATH to server about myself");
getNetworking()->getPlayerPacket(ID_PLAYER_DEATH)->Send(this);
isDead = true; isDead = true;
} }
else if (ptrNpcStats->getHealth().getCurrent() > 0 && isDead) else if (ptrNpcStats->getHealth().getCurrent() > 0 && isDead)
@ -631,8 +623,7 @@ void LocalPlayer::updateDrawStateAndFlags(bool forceUpdate)
mwmp::Main::get().getLocalPlayer()->updatePosition(true); // fix position after jump; mwmp::Main::get().getLocalPlayer()->updatePosition(true); // fix position after jump;
RakNet::BitStream bs; RakNet::BitStream bs;
getNetworking()->getPlayerPacket(ID_PLAYER_DRAWSTATE)->Packet(&bs, this, true); getNetworking()->getPlayerPacket(ID_PLAYER_DRAWSTATE)->Send(this);
getNetworking()->sendData(&bs);
} }
} }
@ -1106,8 +1097,7 @@ void LocalPlayer::sendAttack(Attack::TYPE type)
attack.type = type; attack.type = type;
attack.pressed = false; attack.pressed = false;
RakNet::BitStream bs; RakNet::BitStream bs;
getNetworking()->getPlayerPacket(ID_PLAYER_ATTACK)->Packet(&bs, this, true); getNetworking()->getPlayerPacket(ID_PLAYER_ATTACK)->Send(this);
getNetworking()->sendData(&bs);
} }
void LocalPlayer::clearCellStates() void LocalPlayer::clearCellStates()
@ -1178,6 +1168,5 @@ void LocalPlayer::prepareAttack(Attack::TYPE type, bool state)
attack.attacker = guid; attack.attacker = guid;
RakNet::BitStream bs; RakNet::BitStream bs;
getNetworking()->getPlayerPacket(ID_PLAYER_ATTACK)->Packet(&bs, this, true); getNetworking()->getPlayerPacket(ID_PLAYER_ATTACK)->Send(this);
getNetworking()->sendData(&bs);
} }

Loading…
Cancel
Save