Share skills and attributes correctly upon logging in, and fix grammar

coverity_scan^2
David Cernat 8 years ago
parent dd6ebdeb4f
commit a2dbeb6c95

@ -296,8 +296,9 @@ void Networking::NewPlayer(RakNet::RakNetGUID guid)
controller->GetPacket(ID_USER_MYID)->Send(Players::GetPlayer(guid), false);
controller->GetPacket(ID_GAME_BASE_INFO)->RequestData(guid);
//controller->GetPacket(ID_GAME_UPDATE_SKILLS)->RequestData(guid);
controller->GetPacket(ID_GAME_UPDATE_BASESTATS)->RequestData(guid);
controller->GetPacket(ID_GAME_ATTRIBUTE)->RequestData(guid);
controller->GetPacket(ID_GAME_SKILL)->RequestData(guid);
controller->GetPacket(ID_GAME_UPDATE_POS)->RequestData(guid);
controller->GetPacket(ID_GAME_CELL)->RequestData(guid);
controller->GetPacket(ID_GAME_UPDATE_EQUIPED)->RequestData(guid);
@ -307,8 +308,9 @@ void Networking::NewPlayer(RakNet::RakNetGUID guid)
if (pl->first == guid) continue;
controller->GetPacket(ID_GAME_BASE_INFO)->Send(pl->second, guid);
//controller->GetPacket(ID_GAME_UPDATE_SKILLS)->Send(pl->second, guid);
controller->GetPacket(ID_GAME_UPDATE_BASESTATS)->Send(pl->second, guid);
controller->GetPacket(ID_GAME_ATTRIBUTE)->Send(pl->second, guid);
controller->GetPacket(ID_GAME_SKILL)->Send(pl->second, guid);
controller->GetPacket(ID_GAME_UPDATE_POS)->Send(pl->second, guid);
controller->GetPacket(ID_GAME_CELL)->Send(pl->second, guid);
controller->GetPacket(ID_GAME_UPDATE_EQUIPED)->Send(pl->second, guid);
@ -316,6 +318,8 @@ void Networking::NewPlayer(RakNet::RakNetGUID guid)
}
void Networking::DisconnectPlayer(RakNet::RakNetGUID guid)
{
Script::Call<Script::CallbackIdentity("OnPlayerDisconnect")>(Players::GetPlayer(guid)->GetID());
@ -362,7 +366,7 @@ int Networking::MainLoop()
printf("Another client has disconnected.\n");
break;
case ID_REMOTE_CONNECTION_LOST:
printf("Another client has lost the connection.\n");
printf("Another client has lost connection.\n");
break;
case ID_REMOTE_NEW_INCOMING_CONNECTION:
printf("Another client has connected.\n");
@ -383,7 +387,7 @@ int Networking::MainLoop()
DisconnectPlayer(packet->guid);
break;
case ID_CONNECTION_LOST:
printf("A client lost the connection.\n");
printf("A client has lost connection.\n");
DisconnectPlayer(packet->guid);
break;
default:

@ -52,7 +52,7 @@ void Networking::Update()
printf("Another client has disconnected.\n");
break;
case ID_REMOTE_CONNECTION_LOST:
printf("Another client has lost the connection.\n");
printf("Another client has lost connection.\n");
break;
case ID_REMOTE_NEW_INCOMING_CONNECTION:
printf("Another client has connected.\n");
@ -119,7 +119,7 @@ void Networking::Connect(const std::string &ip, unsigned short port)
{
errmsg = "Connection failed.\n"
"The client or server is outdated.\n"
"Ask your server administrator for resolve this problem.";
"Ask your server administrator to resolve this problem.";
queue = false;
break;
}
@ -261,17 +261,24 @@ void Networking::ReceiveMessage(RakNet::Packet *packet)
}
case ID_GAME_UPDATE_SKILLS:
{
printf("Received ID_GAME_UPDATE_SKILLS from server\n");
if (id == myid)
{
printf("- Packet was about my id\n");
getLocalPlayer()->updateAttributesAndSkills(true);
myPacket->Send(getLocalPlayer(), serverAddr);
}
else if (pl != 0)
{
printf("- Packet was about %s\n", pl->Npc()->mName.c_str());
myPacket->Packet(&bsIn, pl, false);
MWMechanics::SkillValue skillValue;
MWMechanics::AttributeValue attributeValue;
for (int i = 0; i < PacketAttributesAndStats::StatsCount; ++i)
{
skillValue.readState(pl->NpcStats()->mSkills[i]);
@ -381,7 +388,7 @@ void Networking::ReceiveMessage(RakNet::Packet *packet)
}
else if (pl != 0)
{
printf("attempt to kill %s\n", pl->Npc()->mName.c_str());
printf("Attempt to kill %s\n", pl->Npc()->mName.c_str());
MWMechanics::DynamicStat<float> health;
pl->CreatureStats()->mDead = true;
health.readState(pl->CreatureStats()->mDynamic[0]);

@ -7,12 +7,12 @@ port = 25565
#name = Player
[Chat]
#use https://wiki.libsdl.org/SDL_Keycode for rebind keys
keySay = Y #key for switch chat mode enabled/hidden/disabled
keyChatMode = F2
# Use https://wiki.libsdl.org/SDL_Keycode for rebinding keys
keySay = Y # For chatting
keyChatMode = F2 # For enabling or disabling the chat window
x = 0
y = 0
w = 390
h = 250
delay = 5.0 #how long the message will be displayed in hidden mode
delay = 5.0 # How long the message will be displayed in hidden mode

Loading…
Cancel
Save