Chat log no longer needed

This commit is contained in:
EmosewaMC 2022-04-09 16:02:27 -07:00
parent aee3290248
commit ae61b23896

View File

@ -486,7 +486,7 @@ int main(int argc, char** argv) {
const auto& player = Game::server->GetReplicaManager()->GetParticipantAtIndex(i); const auto& player = Game::server->GetReplicaManager()->GetParticipantAtIndex(i);
auto* entity = Player::GetPlayer(player); auto* entity = Player::GetPlayer(player);
Game::logger->Log("WorldServer", "Saving data!\n");
if (entity != nullptr && entity->GetCharacter() != nullptr) if (entity != nullptr && entity->GetCharacter() != nullptr)
{ {
auto* skillComponent = entity->GetComponent<SkillComponent>(); auto* skillComponent = entity->GetComponent<SkillComponent>();
@ -495,35 +495,35 @@ int main(int argc, char** argv) {
{ {
skillComponent->Reset(); skillComponent->Reset();
} }
std::string message = "Saving character " + entity->GetCharacter()->GetName() + "...\n";
Game::logger->Log("WorldServer", message);
entity->GetCharacter()->SaveXMLToDatabase(); entity->GetCharacter()->SaveXMLToDatabase();
message = "Character data for " + entity->GetCharacter()->GetName() + " was saved!\n";
Game::logger->Log("WorldServer", message);
} }
} }
if (PropertyManagementComponent::Instance() != nullptr) { if (PropertyManagementComponent::Instance() != nullptr) {
ChatPackets::SendSystemMessage(UNASSIGNED_SYSTEM_ADDRESS, u"Property data saved...", true); Game::logger->Log("WorldServer", "Saving ALL property data!\n");
PropertyManagementComponent::Instance()->Save(); PropertyManagementComponent::Instance()->Save();
Game::logger->Log("WorldServer", "ALL property data saved!\n");
} }
ChatPackets::SendSystemMessage(UNASSIGNED_SYSTEM_ADDRESS, u"Character data saved...", true); Game::logger->Log("WorldServer", "ALL DATA HAS BEEN SAVED!\n");
} }
framesSinceShutdownSequence++; framesSinceShutdownSequence++;
if (framesSinceShutdownSequence == 100) while (Game::server->GetReplicaManager()->GetParticipantCount() > 0) {
{ const auto& player = Game::server->GetReplicaManager()->GetParticipantAtIndex(0);
while (Game::server->GetReplicaManager()->GetParticipantCount() > 0)
{
const auto& player = Game::server->GetReplicaManager()->GetParticipantAtIndex(0);
Game::server->Disconnect(player, SERVER_DISCON_KICK); Game::server->Disconnect(player, SERVER_DISCON_KICK);
}
CBITSTREAM;
PacketUtils::WriteHeader(bitStream, MASTER, MSG_MASTER_SHUTDOWN_RESPONSE);
Game::server->SendToMaster(&bitStream);
break;
} }
CBITSTREAM;
PacketUtils::WriteHeader(bitStream, MASTER, MSG_MASTER_SHUTDOWN_RESPONSE);
Game::server->SendToMaster(&bitStream);
break;
} }
Metrics::AddMeasurement(MetricVariable::CPUTime, (1e6 * (1000.0 * (std::clock() - metricCPUTimeStart))) / CLOCKS_PER_SEC); Metrics::AddMeasurement(MetricVariable::CPUTime, (1e6 * (1000.0 * (std::clock() - metricCPUTimeStart))) / CLOCKS_PER_SEC);
@ -537,14 +537,15 @@ int main(int argc, char** argv) {
Game::logger->Log("WorldServer", "Shutdown complete, zone (%i), instance (%i)\n", Game::server->GetZoneID(), instanceID); Game::logger->Log("WorldServer", "Shutdown complete, zone (%i), instance (%i)\n", Game::server->GetZoneID(), instanceID);
Metrics::Clear(); Metrics::Clear();
Database::Destroy(); Database::Destroy("WorldServer");
delete Game::chatFilter; delete Game::chatFilter;
delete Game::server; delete Game::server;
delete Game::logger; delete Game::logger;
worldShutdownSequenceComplete = true; worldShutdownSequenceComplete = true;
exit(0); exit(EXIT_SUCCESS);
return EXIT_SUCCESS;
} }
dLogger * SetupLogger(int zoneID, int instanceID) { dLogger * SetupLogger(int zoneID, int instanceID) {