diff --git a/apps/openmw-mp/Networking.cpp b/apps/openmw-mp/Networking.cpp index 131953b13..64abe7af2 100644 --- a/apps/openmw-mp/Networking.cpp +++ b/apps/openmw-mp/Networking.cpp @@ -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(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: diff --git a/apps/openmw/mwmp/Networking.cpp b/apps/openmw/mwmp/Networking.cpp index 0648a7383..04ba3f22e 100644 --- a/apps/openmw/mwmp/Networking.cpp +++ b/apps/openmw/mwmp/Networking.cpp @@ -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 health; pl->CreatureStats()->mDead = true; health.readState(pl->CreatureStats()->mDynamic[0]); diff --git a/files/tes3mp/tes3mp-client-default.cfg b/files/tes3mp/tes3mp-client-default.cfg index a49b18123..e17cac3d5 100644 --- a/files/tes3mp/tes3mp-client-default.cfg +++ b/files/tes3mp/tes3mp-client-default.cfg @@ -1,5 +1,5 @@ [General] -#0 - Verbose (spam), 1 - Info, 2 - Warnings, 3 - Errors, 4 - Only fatal errors +# 0 - Verbose (spam), 1 - Info, 2 - Warnings, 3 - Errors, 4 - Only fatal errors loglevel = 0 #master = master.tes3mp.com:8088 server = mp.tes3mp.com @@ -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