diff --git a/Source/Server.DarkSouls2/Server/GameService/GameManagers/BloodMessage/DS2_BloodMessageManager.cpp b/Source/Server.DarkSouls2/Server/GameService/GameManagers/BloodMessage/DS2_BloodMessageManager.cpp index c7f04109..e12383ef 100644 --- a/Source/Server.DarkSouls2/Server/GameService/GameManagers/BloodMessage/DS2_BloodMessageManager.cpp +++ b/Source/Server.DarkSouls2/Server/GameService/GameManagers/BloodMessage/DS2_BloodMessageManager.cpp @@ -200,8 +200,7 @@ MessageHandleResult DS2_BloodMessageManager::Handle_RequestCreateBloodMessage(Ga } else { - WarningS(Client->GetName().c_str(), "Disconnecting client as failed to create blood message."); - return MessageHandleResult::Error; + WarningS(Client->GetName().c_str(), "Failed to create blood message."); } std::string TypeStatisticKey = StringFormat("BloodMessage/TotalCreated"); @@ -365,8 +364,7 @@ MessageHandleResult DS2_BloodMessageManager::Handle_RequestEvaluateBloodMessage( // If we can't find it, just return 0 evaluation, this shouldn't happen in practice. else { - WarningS(Client->GetName().c_str(), "Disconnecting client as attempted to evaluate unknown unknown message id '%u'.", Request->message_id()); - return MessageHandleResult::Error; + WarningS(Client->GetName().c_str(), "Client as attempted to evaluate unknown unknown message id '%u'.", Request->message_id()); } if (ActiveMessage != nullptr) diff --git a/Source/Server.DarkSouls2/Server/GameService/GameManagers/Bloodstain/DS2_BloodstainManager.cpp b/Source/Server.DarkSouls2/Server/GameService/GameManagers/Bloodstain/DS2_BloodstainManager.cpp index 8778d4e4..48c72a55 100644 --- a/Source/Server.DarkSouls2/Server/GameService/GameManagers/Bloodstain/DS2_BloodstainManager.cpp +++ b/Source/Server.DarkSouls2/Server/GameService/GameManagers/Bloodstain/DS2_BloodstainManager.cpp @@ -130,8 +130,7 @@ MessageHandleResult DS2_BloodstainManager::Handle_RequestCreateBloodstain(GameCl } else { - WarningS(Client->GetName().c_str(), "Disconnecting client as failed to create blood stain."); - return MessageHandleResult::Error; + WarningS(Client->GetName().c_str(), "Failed to create blood stain."); } std::string TypeStatisticKey = StringFormat("Bloodstain/TotalCreated"); @@ -250,15 +249,22 @@ MessageHandleResult DS2_BloodstainManager::Handle_RequestGetDeadingGhost(GameCli // Doesn't exist, no go. else { - WarningS(Client->GetName().c_str(), "Disconnecting client as failed to retrieve bloodstain '%i'", Request->bloodstain_id()); - return MessageHandleResult::Error; + WarningS(Client->GetName().c_str(), "Failed to retrieve bloodstain '%i'", Request->bloodstain_id()); } DS2_Frpg2RequestMessage::RequestGetDeadingGhostResponse Response; Response.set_online_area_id(Request->online_area_id()); Response.set_cell_id(Request->cell_id()); Response.set_bloodstain_id(Request->bloodstain_id()); - Response.set_data(ActiveStain->GhostData.data(), ActiveStain->GhostData.size()); + + if (ActiveStain == nullptr) + { + Response.mutable_data(); + } + else + { + Response.set_data(ActiveStain->GhostData.data(), ActiveStain->GhostData.size()); + } if (!Client->MessageStream->Send(&Response, &Message)) { diff --git a/Source/Server.DarkSouls2/Server/GameService/GameManagers/Ghosts/DS2_GhostManager.cpp b/Source/Server.DarkSouls2/Server/GameService/GameManagers/Ghosts/DS2_GhostManager.cpp index 44321b1a..7ca6df6e 100644 --- a/Source/Server.DarkSouls2/Server/GameService/GameManagers/Ghosts/DS2_GhostManager.cpp +++ b/Source/Server.DarkSouls2/Server/GameService/GameManagers/Ghosts/DS2_GhostManager.cpp @@ -117,8 +117,7 @@ MessageHandleResult DS2_GhostManager::Handle_RequestCreateGhostData(GameClient* } else { - WarningS(Client->GetName().c_str(), "Disconnecting client as failed to create ghost."); - return MessageHandleResult::Error; + WarningS(Client->GetName().c_str(), "Failed to create ghost."); } std::string TypeStatisticKey = StringFormat("Ghosts/TotalGhostsCreated"); diff --git a/Source/Server.DarkSouls2/Server/GameService/GameManagers/Ranking/DS2_RankingManager.cpp b/Source/Server.DarkSouls2/Server/GameService/GameManagers/Ranking/DS2_RankingManager.cpp index af9cb5a8..3ba64f5a 100644 --- a/Source/Server.DarkSouls2/Server/GameService/GameManagers/Ranking/DS2_RankingManager.cpp +++ b/Source/Server.DarkSouls2/Server/GameService/GameManagers/Ranking/DS2_RankingManager.cpp @@ -67,7 +67,6 @@ MessageHandleResult DS2_RankingManager::Handle_RequestRegisterPowerStoneData(Gam if (!Database.RegisterScore(0, Player.GetPlayerId(), Request->character_id(), score, Data)) { WarningS(Client->GetName().c_str(), "Failed to register score in database."); - return MessageHandleResult::Error; } std::string TypeStatisticKey = StringFormat("Ranking/TotalRegistrations"); diff --git a/Source/Server.DarkSouls2/Server/GameService/GameManagers/Signs/DS2_SignManager.cpp b/Source/Server.DarkSouls2/Server/GameService/GameManagers/Signs/DS2_SignManager.cpp index dcbf3133..2d764dfd 100644 --- a/Source/Server.DarkSouls2/Server/GameService/GameManagers/Signs/DS2_SignManager.cpp +++ b/Source/Server.DarkSouls2/Server/GameService/GameManagers/Signs/DS2_SignManager.cpp @@ -300,16 +300,15 @@ MessageHandleResult DS2_SignManager::Handle_RequestRemoveSign(GameClient* Client if (auto Iter = std::find(Client->ActiveSummonSigns.begin(), Client->ActiveSummonSigns.end(), Sign); Iter != Client->ActiveSummonSigns.end()) { Client->ActiveSummonSigns.erase(Iter); + + // Tell anyone who is aware of this sign that its been removed. + RemoveSignAndNotifyAware(Sign); } else { - WarningS(Client->GetName().c_str(), "Disconnecting client as attempted to remove summon sign that didn't belong to them, %i.", Request->sign_id()); - return MessageHandleResult::Error; + WarningS(Client->GetName().c_str(), "Client attempted to remove summon sign that didn't belong to them, %i.", Request->sign_id()); } - // Tell anyone who is aware of this sign that its been removed. - RemoveSignAndNotifyAware(Sign); - // Empty response, not sure what purpose this serves really other than saying message-recieved. Client // doesn't work without it though. DS2_Frpg2RequestMessage::RequestRemoveSignResponse Response; diff --git a/Source/Server.DarkSouls3/Server/GameService/GameManagers/BloodMessage/DS3_BloodMessageManager.cpp b/Source/Server.DarkSouls3/Server/GameService/GameManagers/BloodMessage/DS3_BloodMessageManager.cpp index 33f9226a..aaebf1bb 100644 --- a/Source/Server.DarkSouls3/Server/GameService/GameManagers/BloodMessage/DS3_BloodMessageManager.cpp +++ b/Source/Server.DarkSouls3/Server/GameService/GameManagers/BloodMessage/DS3_BloodMessageManager.cpp @@ -270,8 +270,7 @@ MessageHandleResult DS3_BloodMessageManager::Handle_RequestCreateBloodMessage(Ga } else { - WarningS(Client->GetName().c_str(), "Disconnecting client as failed to create blood message."); - return MessageHandleResult::Error; + WarningS(Client->GetName().c_str(), "Failed to create blood message."); } std::string TypeStatisticKey = StringFormat("BloodMessage/TotalCreated"); @@ -389,8 +388,7 @@ MessageHandleResult DS3_BloodMessageManager::Handle_RequestEvaluateBloodMessage( // If we can't find it, just return 0 evaluation, this shouldn't happen in practice. else { - WarningS(Client->GetName().c_str(), "Disconnecting client as attempted to evaluate unknown unknown message id '%u'.", Request->message_id()); - return MessageHandleResult::Error; + WarningS(Client->GetName().c_str(), "Client attempted to evaluate unknown unknown message id '%u'.", Request->message_id()); } if (ActiveMessage != nullptr) diff --git a/Source/Server.DarkSouls3/Server/GameService/GameManagers/Bloodstain/DS3_BloodstainManager.cpp b/Source/Server.DarkSouls3/Server/GameService/GameManagers/Bloodstain/DS3_BloodstainManager.cpp index dd50e038..db72853b 100644 --- a/Source/Server.DarkSouls3/Server/GameService/GameManagers/Bloodstain/DS3_BloodstainManager.cpp +++ b/Source/Server.DarkSouls3/Server/GameService/GameManagers/Bloodstain/DS3_BloodstainManager.cpp @@ -127,8 +127,7 @@ MessageHandleResult DS3_BloodstainManager::Handle_RequestCreateBloodstain(GameCl } else { - WarningS(Client->GetName().c_str(), "Disconnecting client as failed to create blood stain."); - return MessageHandleResult::Error; + WarningS(Client->GetName().c_str(), "Failed to create bloodstain for client."); } std::string TypeStatisticKey = StringFormat("Bloodstain/TotalCreated"); @@ -205,14 +204,21 @@ MessageHandleResult DS3_BloodstainManager::Handle_RequestGetDeadingGhost(GameCli // Doesn't exist, no go. else { - WarningS(Client->GetName().c_str(), "Disconnecting client as failed to retrieve bloodstain '%i'", Request->bloodstain_id()); - return MessageHandleResult::Error; + WarningS(Client->GetName().c_str(), "Failed to retrieve bloodstain '%i', returning empty ghost data.", Request->bloodstain_id()); } DS3_Frpg2RequestMessage::RequestGetDeadingGhostResponse Response; Response.set_online_area_id(Request->online_area_id()); Response.set_bloodstain_id(Request->bloodstain_id()); - Response.set_data(ActiveStain->GhostData.data(), ActiveStain->GhostData.size()); + + if (ActiveStain == nullptr) + { + Response.mutable_data(); + } + else + { + Response.set_data(ActiveStain->GhostData.data(), ActiveStain->GhostData.size()); + } if (!Client->MessageStream->Send(&Response, &Message)) { diff --git a/Source/Server.DarkSouls3/Server/GameService/GameManagers/Ghosts/DS3_GhostManager.cpp b/Source/Server.DarkSouls3/Server/GameService/GameManagers/Ghosts/DS3_GhostManager.cpp index d6e77480..132bf5cb 100644 --- a/Source/Server.DarkSouls3/Server/GameService/GameManagers/Ghosts/DS3_GhostManager.cpp +++ b/Source/Server.DarkSouls3/Server/GameService/GameManagers/Ghosts/DS3_GhostManager.cpp @@ -118,8 +118,7 @@ MessageHandleResult DS3_GhostManager::Handle_RequestCreateGhostData(GameClient* } else { - WarningS(Client->GetName().c_str(), "Disconnecting client as failed to create ghost."); - return MessageHandleResult::Error; + WarningS(Client->GetName().c_str(), "Failed to create ghost."); } std::string TypeStatisticKey = StringFormat("Ghosts/TotalGhostsCreated"); diff --git a/Source/Server.DarkSouls3/Server/GameService/GameManagers/QuickMatch/DS3_QuickMatchManager.cpp b/Source/Server.DarkSouls3/Server/GameService/GameManagers/QuickMatch/DS3_QuickMatchManager.cpp index d9662795..c703b35b 100644 --- a/Source/Server.DarkSouls3/Server/GameService/GameManagers/QuickMatch/DS3_QuickMatchManager.cpp +++ b/Source/Server.DarkSouls3/Server/GameService/GameManagers/QuickMatch/DS3_QuickMatchManager.cpp @@ -499,67 +499,68 @@ MessageHandleResult DS3_QuickMatchManager::Handle_RequestSendQuickMatchResult(Ga std::shared_ptr Character = Database.FindCharacter(State.GetPlayerId(), State.GetCharacterId()); if (!Character) { - WarningS(Client->GetName().c_str(), "Disconnecting client as failed to find current character during QuickMatchResult."); - return MessageHandleResult::Error; + WarningS(Client->GetName().c_str(), "Failed to find current character during QuickMatchResult."); } + else + { + // Increase and return rank. + bool IsDuel = (Request->mode() == DS3_Frpg2RequestMessage::QuickMatchGameMode::Duel); - // Increase and return rank. - bool IsDuel = (Request->mode() == DS3_Frpg2RequestMessage::QuickMatchGameMode::Duel); - - uint32_t OriginalRank = IsDuel ? Character->QuickMatchDuelRank : Character->QuickMatchBrawlRank; - uint32_t OriginalXP = IsDuel ? Character->QuickMatchDuelXp : Character->QuickMatchBrawlXp; + uint32_t OriginalRank = IsDuel ? Character->QuickMatchDuelRank : Character->QuickMatchBrawlRank; + uint32_t OriginalXP = IsDuel ? Character->QuickMatchDuelXp : Character->QuickMatchBrawlXp; - uint32_t& Rank = IsDuel ? Character->QuickMatchDuelRank : Character->QuickMatchBrawlRank; - uint32_t& XP = IsDuel ? Character->QuickMatchDuelXp : Character->QuickMatchBrawlXp; + uint32_t& Rank = IsDuel ? Character->QuickMatchDuelRank : Character->QuickMatchBrawlRank; + uint32_t& XP = IsDuel ? Character->QuickMatchDuelXp : Character->QuickMatchBrawlXp; - switch (Request->result()) - { - case DS3_Frpg2RequestMessage::QuickMatchResult::QuickMatchResult_Win: - { - XP += Config.QuickMatchWinXp; - break; - } - case DS3_Frpg2RequestMessage::QuickMatchResult::QuickMatchResult_Draw: - { - XP += Config.QuickMatchDrawXp; - break; - } - case DS3_Frpg2RequestMessage::QuickMatchResult::QuickMatchResult_Lose: + switch (Request->result()) { - XP += Config.QuickMatchLoseXp; - break; - } - case DS3_Frpg2RequestMessage::QuickMatchResult::QuickMatchResult_Disconnect: - { - // No XP gained. - break; + case DS3_Frpg2RequestMessage::QuickMatchResult::QuickMatchResult_Win: + { + XP += Config.QuickMatchWinXp; + break; + } + case DS3_Frpg2RequestMessage::QuickMatchResult::QuickMatchResult_Draw: + { + XP += Config.QuickMatchDrawXp; + break; + } + case DS3_Frpg2RequestMessage::QuickMatchResult::QuickMatchResult_Lose: + { + XP += Config.QuickMatchLoseXp; + break; + } + case DS3_Frpg2RequestMessage::QuickMatchResult::QuickMatchResult_Disconnect: + { + // No XP gained. + break; + } } - } - while (Rank < Config.QuickMatchRankXp.size() - 1) - { - uint32_t NextRankXP = Config.QuickMatchRankXp[Rank + 1]; - if (XP > NextRankXP) + while (Rank < Config.QuickMatchRankXp.size() - 1) { - Rank++; - XP -= NextRankXP; - } - else - { - break; + uint32_t NextRankXP = Config.QuickMatchRankXp[Rank + 1]; + if (XP > NextRankXP) + { + Rank++; + XP -= NextRankXP; + } + else + { + break; + } } - } - Response.mutable_new_local_rank()->set_rank(Rank); - Response.mutable_new_local_rank()->set_xp(XP); + Response.mutable_new_local_rank()->set_rank(Rank); + Response.mutable_new_local_rank()->set_xp(XP); - LogS(Client->GetName().c_str(), "Player finished undead match, ranked up to: rank=%i xp=%i (from rank=%i xp=%i)", Rank, XP, OriginalRank, OriginalXP); + LogS(Client->GetName().c_str(), "Player finished undead match, ranked up to: rank=%i xp=%i (from rank=%i xp=%i)", Rank, XP, OriginalRank, OriginalXP); - // Update character state. - if (!Database.UpdateCharacterQuickMatchRank(State.GetPlayerId(), State.GetCharacterId(), Character->QuickMatchDuelRank, Character->QuickMatchDuelXp, Character->QuickMatchBrawlRank, Character->QuickMatchBrawlXp)) - { - WarningS(Client->GetName().c_str(), "Disconnecting client as failed to update their quick match result."); - return MessageHandleResult::Error; + // Update character state. + if (!Database.UpdateCharacterQuickMatchRank(State.GetPlayerId(), State.GetCharacterId(), Character->QuickMatchDuelRank, Character->QuickMatchDuelXp, Character->QuickMatchBrawlRank, Character->QuickMatchBrawlXp)) + { + WarningS(Client->GetName().c_str(), "Disconnecting client as failed to update their quick match result."); + return MessageHandleResult::Error; + } } std::string TypeStatisticKey = StringFormat("QuickMatch/TotalMatches"); diff --git a/Source/Server.DarkSouls3/Server/GameService/GameManagers/Ranking/DS3_RankingManager.cpp b/Source/Server.DarkSouls3/Server/GameService/GameManagers/Ranking/DS3_RankingManager.cpp index 7f686400..dab3d54b 100644 --- a/Source/Server.DarkSouls3/Server/GameService/GameManagers/Ranking/DS3_RankingManager.cpp +++ b/Source/Server.DarkSouls3/Server/GameService/GameManagers/Ranking/DS3_RankingManager.cpp @@ -60,7 +60,6 @@ MessageHandleResult DS3_RankingManager::Handle_RequestRegisterRankingData(GameCl if (!Database.RegisterScore(Request->board_id(), Player.GetPlayerId(), Request->character_id(), Request->score(), Data)) { WarningS(Client->GetName().c_str(), "Failed to register score in database."); - return MessageHandleResult::Error; } std::string TypeStatisticKey = StringFormat("Ranking/TotalRegistrations"); diff --git a/Source/Server.DarkSouls3/Server/GameService/GameManagers/Signs/DS3_SignManager.cpp b/Source/Server.DarkSouls3/Server/GameService/GameManagers/Signs/DS3_SignManager.cpp index 1266a72a..eeed8da0 100644 --- a/Source/Server.DarkSouls3/Server/GameService/GameManagers/Signs/DS3_SignManager.cpp +++ b/Source/Server.DarkSouls3/Server/GameService/GameManagers/Signs/DS3_SignManager.cpp @@ -308,16 +308,15 @@ MessageHandleResult DS3_SignManager::Handle_RequestRemoveSign(GameClient* Client if (auto Iter = std::find(Client->ActiveSummonSigns.begin(), Client->ActiveSummonSigns.end(), Sign); Iter != Client->ActiveSummonSigns.end()) { Client->ActiveSummonSigns.erase(Iter); + + // Tell anyone who is aware of this sign that its been removed. + RemoveSignAndNotifyAware(Sign); } else { - WarningS(Client->GetName().c_str(), "Disconnecting client as attempted to remove summon sign that didn't belong to them, %i.", Request->sign_id()); - return MessageHandleResult::Error; + WarningS(Client->GetName().c_str(), "Client attempted to remove summon sign that didn't belong to them, %i.", Request->sign_id()); } - // Tell anyone who is aware of this sign that its been removed. - RemoveSignAndNotifyAware(Sign); - // Empty response, not sure what purpose this serves really other than saying message-recieved. Client // doesn't work without it though. DS3_Frpg2RequestMessage::RequestRemoveSignResponse Response; diff --git a/Source/Server/Server/Server.cpp b/Source/Server/Server/Server.cpp index a57bc478..fffbf672 100644 --- a/Source/Server/Server/Server.cpp +++ b/Source/Server/Server/Server.cpp @@ -168,11 +168,11 @@ bool Server::Init() } // Patch old server ip. -#ifdef _DEBUG +#if 1//def _DEBUG //Config.MasterServerIp = "127.0.0.1"; Config.MasterServerIp = "ds3os-master.timleonard.uk"; - Config.ServerName = "Debugging Server"; - Config.ServerDescription = "Used for debugging by Infini, don't use."; + //Config.ServerName = "Debugging Server"; + //Config.ServerDescription = "Used for debugging by Infini, don't use."; #else if (Config.MasterServerIp == "timleonard.uk") { @@ -304,6 +304,7 @@ bool Server::Init() } } +#if 0 #define WriteState(State, bEnabled) WriteLog(false, bEnabled ? ConsoleColor::Green : ConsoleColor::Red, "", "Log", "%-25s: %s", State, bEnabled ? "Enabled" : "Disabled"); WriteState("Blood Messages", !Config.DisableBloodMessages); WriteState("Blood Stains", !Config.DisableBloodStains); @@ -313,6 +314,7 @@ bool Server::Init() WriteState("Coop (Auto Summon)", !Config.DisableCoopAutoSummon); WriteState("Coop", !Config.DisableCoop); #undef WriteState +#endif return true; }