mirror of
				https://github.com/DarkflameUniverse/DarkflameServer.git
				synced 2025-10-31 12:41:55 +00:00 
			
		
		
		
	converting more format strings
This commit is contained in:
		| @@ -41,7 +41,7 @@ template <typename T> | ||||
| class location_wrapper { | ||||
| public: | ||||
| 	// Constructor | ||||
| 	template <std::convertible_to<T> U = T> | ||||
| 	template <typename U = T> | ||||
| 	consteval location_wrapper(const U val, const std::source_location loc = std::source_location::current()) | ||||
| 		: m_Obj(val) | ||||
| 		, m_Loc(loc) { | ||||
| @@ -67,12 +67,15 @@ protected: | ||||
| */ | ||||
| namespace Log { | ||||
| 	template <typename... Ts> | ||||
| 	constexpr tm Time() { // TODO: Move? | ||||
| 	[[nodiscard]] inline tm Time() { // TODO: Move? | ||||
| 		return fmt::localtime(std::time(nullptr)); | ||||
| 	} | ||||
|  | ||||
| 	template <typename... Ts> | ||||
| 	constexpr void Info(const location_wrapper<fmt::format_string<Ts...>> fmt_str, Ts&&... args) { | ||||
| 	using FormatString = location_wrapper<fmt::format_string<Ts...>>; | ||||
|  | ||||
| 	template <typename... Ts> | ||||
| 	inline void Info(const FormatString<Ts...> fmt_str, Ts&&... args) { | ||||
| 		const auto filename = GetFileNameFromAbsolutePath(fmt_str.loc().file_name()); | ||||
|  | ||||
| 		fmt::print("[{:%d-%m-%y %H:%M:%S} {:s}:{:d}] ", Time(), filename, fmt_str.loc().line()); | ||||
| @@ -80,7 +83,7 @@ namespace Log { | ||||
| 	} | ||||
|  | ||||
| 	template <typename... Ts> | ||||
| 	constexpr void Warn(const location_wrapper<fmt::format_string<Ts...>> fmt_str, Ts&&... args) { | ||||
| 	inline void Warn(const FormatString<Ts...> fmt_str, Ts&&... args) { | ||||
| 		const auto filename = GetFileNameFromAbsolutePath(fmt_str.loc().file_name()); | ||||
|  | ||||
| 		fmt::print("[{:%d-%m-%y %H:%M:%S} {:s}:{:d}] Warning: ", Time(), filename, fmt_str.loc().line()); | ||||
| @@ -88,7 +91,7 @@ namespace Log { | ||||
| 	} | ||||
|  | ||||
| 	template <typename... Ts> | ||||
| 	constexpr void Debug(const location_wrapper<fmt::format_string<Ts...>> fmt_str, Ts&&... args) { | ||||
| 	inline void Debug(const FormatString<Ts...> fmt_str, Ts&&... args) { | ||||
| 		// if (!m_logDebugStatements) return; | ||||
| 		Log::Info(fmt_str, std::forward<Ts>(args)...); | ||||
| 	} | ||||
|   | ||||
| @@ -190,7 +190,7 @@ void CharacterComponent::LoadFromXml(tinyxml2::XMLDocument* doc) { | ||||
|  | ||||
| 	tinyxml2::XMLElement* character = doc->FirstChildElement("obj")->FirstChildElement("char"); | ||||
| 	if (!character) { | ||||
| 		LOG("Failed to find char tag while loading XML!"); | ||||
| 		Log::Warn("Failed to find char tag while loading XML!"); | ||||
| 		return; | ||||
| 	} | ||||
| 	if (character->QueryAttribute("rpt", &m_Reputation) == tinyxml2::XML_NO_ATTRIBUTE) { | ||||
| @@ -302,7 +302,7 @@ void CharacterComponent::LoadFromXml(tinyxml2::XMLDocument* doc) { | ||||
| void CharacterComponent::UpdateXml(tinyxml2::XMLDocument* doc) { | ||||
| 	tinyxml2::XMLElement* minifig = doc->FirstChildElement("obj")->FirstChildElement("mf"); | ||||
| 	if (!minifig) { | ||||
| 		LOG("Failed to find mf tag while updating XML!"); | ||||
| 		Log::Warn("Failed to find mf tag while updating XML!"); | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| @@ -322,7 +322,7 @@ void CharacterComponent::UpdateXml(tinyxml2::XMLDocument* doc) { | ||||
|  | ||||
| 	tinyxml2::XMLElement* character = doc->FirstChildElement("obj")->FirstChildElement("char"); | ||||
| 	if (!character) { | ||||
| 		LOG("Failed to find char tag while updating XML!"); | ||||
| 		Log::Warn("Failed to find char tag while updating XML!"); | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| @@ -375,7 +375,7 @@ void CharacterComponent::UpdateXml(tinyxml2::XMLDocument* doc) { | ||||
| 	// | ||||
|  | ||||
| 	auto newUpdateTimestamp = std::time(nullptr); | ||||
| 	LOG("Time since last save: %d", newUpdateTimestamp - m_LastUpdateTimestamp); | ||||
| 	Log::Warn("Time since last save: {:d}", newUpdateTimestamp - m_LastUpdateTimestamp); | ||||
|  | ||||
| 	m_TotalTimePlayed += newUpdateTimestamp - m_LastUpdateTimestamp; | ||||
| 	character->SetAttribute("time", m_TotalTimePlayed); | ||||
| @@ -405,7 +405,7 @@ Item* CharacterComponent::GetRocket(Entity* player) { | ||||
| 	} | ||||
|  | ||||
| 	if (!rocket) { | ||||
| 		LOG("Unable to find rocket to equip!"); | ||||
| 		Log::Warn("Unable to find rocket to equip!"); | ||||
| 		return rocket; | ||||
| 	} | ||||
| 	return rocket; | ||||
| @@ -772,7 +772,7 @@ void CharacterComponent::AwardClaimCodes() { | ||||
|  | ||||
| 	auto* cdrewardCodes = CDClientManager::GetTable<CDRewardCodesTable>(); | ||||
| 	for (auto const rewardCode : rewardCodes) { | ||||
| 		LOG_DEBUG("Processing RewardCode %i", rewardCode); | ||||
| 		Log::Debug("Processing RewardCode {:d}", rewardCode); | ||||
| 		const uint32_t rewardCodeIndex = rewardCode >> 6; | ||||
| 		const uint32_t bitIndex = rewardCode % 64; | ||||
| 		if (GeneralUtils::CheckBit(m_ClaimCodes[rewardCodeIndex], bitIndex)) continue; | ||||
|   | ||||
| @@ -47,7 +47,7 @@ Mission::Mission(MissionComponent* missionComponent, const uint32_t missionId) { | ||||
| 	info = *mis; | ||||
|  | ||||
| 	if (mis == &CDMissionsTable::Default) { | ||||
| 		LOG("Failed to find mission (%i)!", missionId); | ||||
| 		Log::Info("Failed to find mission ({:d})!", missionId); | ||||
|  | ||||
| 		return; | ||||
| 	} | ||||
|   | ||||
| @@ -53,18 +53,18 @@ void AuthPackets::HandleHandshake(dServer* server, Packet* packet) { | ||||
|  | ||||
| 	ServiceId serviceId; | ||||
| 	inStream.Read(serviceId); | ||||
| 	if (serviceId != ServiceId::Client) LOG("WARNING: Service ID is not a Client!"); | ||||
| 	if (serviceId != ServiceId::Client) Log::Warn("Service ID is not a Client!"); | ||||
|  | ||||
| 	uint32_t processID; | ||||
| 	inStream.Read(processID); | ||||
|  | ||||
| 	uint16_t port; | ||||
| 	inStream.Read(port); | ||||
| 	if (port != packet->systemAddress.port) LOG("WARNING: Port written in packet does not match the port the client is connecting over!"); | ||||
| 	if (port != packet->systemAddress.port) Log::Warn("Port written in packet does not match the port the client is connecting over!"); | ||||
|  | ||||
| 	inStream.IgnoreBytes(33); | ||||
| 	 | ||||
| 	LOG_DEBUG("Client Data [Version: %i, Service: %s, Process: %u, Port: %u, Sysaddr Port: %u]", clientVersion, StringifiedEnum::ToString(serviceId).data(), processID, port, packet->systemAddress.port); | ||||
| 	Log::Debug("Client Data [Version: {:d}, Service: {:s}, Process: {:d}, Port: {:d}, Sysaddr Port: {:d}]", clientVersion, StringifiedEnum::ToString(serviceId), processID, port, packet->systemAddress.port); | ||||
|  | ||||
| 	SendHandshake(server, packet->systemAddress, server->GetIP(), server->GetPort(), server->GetServerType()); | ||||
| } | ||||
| @@ -102,20 +102,20 @@ void AuthPackets::HandleLoginRequest(dServer* server, Packet* packet) { | ||||
|  | ||||
| 	LanguageCodeID locale_id; | ||||
| 	inStream.Read(locale_id); | ||||
| 	LOG_DEBUG("Locale ID: %s", StringifiedEnum::ToString(locale_id).data()); | ||||
| 	Log::Debug("Locale ID: {:s}", StringifiedEnum::ToString(locale_id)); | ||||
|  | ||||
| 	ClientOS clientOS; | ||||
| 	inStream.Read(clientOS); | ||||
| 	LOG_DEBUG("Operating System: %s", StringifiedEnum::ToString(clientOS).data()); | ||||
| 	Log::Debug("Operating System: {:s}", StringifiedEnum::ToString(clientOS)); | ||||
| 	stamps.emplace_back(eStamps::PASSPORT_AUTH_CLIENT_OS, 0); | ||||
|  | ||||
| 	LUWString memoryStats(256); | ||||
| 	inStream.Read(memoryStats); | ||||
| 	LOG_DEBUG("Memory Stats [%s]", memoryStats.GetAsString().c_str()); | ||||
| 	Log::Debug("Memory Stats {:s}", memoryStats.GetAsString()); | ||||
|  | ||||
| 	LUWString videoCard(128); | ||||
| 	inStream.Read(videoCard); | ||||
| 	LOG_DEBUG("VideoCard Info: [%s]", videoCard.GetAsString().c_str()); | ||||
| 	Log::Debug("VideoCard Info: {:s}", videoCard.GetAsString()); | ||||
|  | ||||
| 	// Processor/CPU info | ||||
| 	uint32_t numOfProcessors; | ||||
| @@ -126,7 +126,7 @@ void AuthPackets::HandleLoginRequest(dServer* server, Packet* packet) { | ||||
| 	inStream.Read(processorLevel); | ||||
| 	uint16_t processorRevision; | ||||
| 	inStream.Read(processorRevision); | ||||
| 	LOG_DEBUG("CPU Info: [#Processors: %i, Processor Type: %i, Processor Level: %i, Processor Revision: %i]", numOfProcessors, processorType, processorLevel, processorRevision); | ||||
| 	Log::Debug("CPU Info: [#Processors: {:d}, Processor Type: {:d}, Processor Level: {:d}, Processor Revision: {:d}]", numOfProcessors, processorType, processorLevel, processorRevision); | ||||
|  | ||||
| 	// OS Info | ||||
| 	uint32_t osVersionInfoSize; | ||||
| @@ -139,13 +139,13 @@ void AuthPackets::HandleLoginRequest(dServer* server, Packet* packet) { | ||||
| 	inStream.Read(buildNumber); | ||||
| 	uint32_t platformID; | ||||
| 	inStream.Read(platformID); | ||||
| 	LOG_DEBUG("OS Info: [Size: %i, Major: %i, Minor %i, Buid#: %i, platformID: %i]", osVersionInfoSize, majorVersion, minorVersion, buildNumber, platformID); | ||||
| 	Log::Debug("OS Info: [Size: {:d}, Major: {:d}, Minor {:d}, Buid#: {:d}, platformID: {:d}]", osVersionInfoSize, majorVersion, minorVersion, buildNumber, platformID); | ||||
|  | ||||
| 	// Fetch account details | ||||
| 	auto accountInfo = Database::Get()->GetAccountInfo(username); | ||||
|  | ||||
| 	if (!accountInfo) { | ||||
| 		LOG("No user by name %s found!", username.c_str()); | ||||
| 		Log::Info("No user by name {:s} found!", username); | ||||
| 		stamps.emplace_back(eStamps::PASSPORT_AUTH_ERROR, 1); | ||||
| 		AuthPackets::SendLoginResponse(server, packet->systemAddress, eLoginResponse::INVALID_USER, "", "", 2001, username, stamps); | ||||
| 		return; | ||||
| @@ -164,7 +164,7 @@ void AuthPackets::HandleLoginRequest(dServer* server, Packet* packet) { | ||||
| 		if (accountInfo->playKeyId == 0) { | ||||
| 			stamps.emplace_back(eStamps::PASSPORT_AUTH_ERROR, 1); | ||||
| 			AuthPackets::SendLoginResponse(server, packet->systemAddress, eLoginResponse::PERMISSIONS_NOT_HIGH_ENOUGH, "Your account doesn't have a play key associated with it!", "", 2001, username, stamps); | ||||
| 			LOG("User %s tried to log in, but they don't have a play key.", username.c_str()); | ||||
| 			Log::Info("User {:s} tried to log in, but they don't have a play key.", username); | ||||
| 			return; | ||||
| 		} | ||||
|  | ||||
| @@ -180,7 +180,7 @@ void AuthPackets::HandleLoginRequest(dServer* server, Packet* packet) { | ||||
| 		if (!playKeyStatus.value()) { | ||||
| 			stamps.emplace_back(eStamps::PASSPORT_AUTH_ERROR, 1); | ||||
| 			AuthPackets::SendLoginResponse(server, packet->systemAddress, eLoginResponse::PERMISSIONS_NOT_HIGH_ENOUGH, "Your play key has been disabled.", "", 2001, username, stamps); | ||||
| 			LOG("User %s tried to log in, but their play key was disabled", username.c_str()); | ||||
| 			Log::Info("User {:s} tried to log in, but their play key was disabled", username); | ||||
| 			return; | ||||
| 		} | ||||
| 	} else if (Game::config->GetValue("dont_use_keys") == "1" || accountInfo->maxGmLevel > eGameMasterLevel::CIVILIAN){ | ||||
| @@ -204,7 +204,7 @@ void AuthPackets::HandleLoginRequest(dServer* server, Packet* packet) { | ||||
| 	if (!loginSuccess) { | ||||
| 		stamps.emplace_back(eStamps::PASSPORT_AUTH_ERROR, 1); | ||||
| 		AuthPackets::SendLoginResponse(server, packet->systemAddress, eLoginResponse::WRONG_PASS, "", "", 2001, username, stamps); | ||||
| 		LOG("Wrong password used"); | ||||
| 		Log::Info("Wrong password used"); | ||||
| 	} else { | ||||
| 		SystemAddress system = packet->systemAddress; //Copy the sysAddr before the Packet gets destroyed from main | ||||
|  | ||||
| @@ -302,6 +302,6 @@ void AuthPackets::SendLoginResponse(dServer* server, const SystemAddress& sysAdd | ||||
| 		bitStream.Write(LUString(username)); | ||||
| 		server->SendToMaster(bitStream); | ||||
|  | ||||
| 		LOG("Set sessionKey: %i for user %s", sessionKey, username.c_str()); | ||||
| 		Log::Info("Set sessionKey: {:d} for user {:s}", sessionKey, username); | ||||
| 	} | ||||
| } | ||||
|   | ||||
| @@ -122,7 +122,7 @@ void WorldPackets::SendCreateCharacter(const SystemAddress& sysAddr, int64_t rep | ||||
|  | ||||
| 	SEND_PACKET; | ||||
| 	delete[] compressedData; | ||||
| 	LOG("Sent CreateCharacter for ID: %llu", player); | ||||
| 	Log::Info("Sent CreateCharacter for ID: {:d}", player); | ||||
| } | ||||
|  | ||||
| void WorldPackets::SendChatModerationResponse(const SystemAddress& sysAddr, bool requestAccepted, uint32_t requestID, const std::string& receiver, std::vector<std::pair<uint8_t, uint8_t>> unacceptedItems) { | ||||
|   | ||||
| @@ -65,10 +65,13 @@ dServer::dServer(const std::string& ip, int port, int instanceID, int maxConnect | ||||
|  | ||||
| 	if (mIsOkay) { | ||||
| 		if (zoneID == 0) | ||||
| 			LOG("%s Server is listening on %s:%i with encryption: %i", StringifiedEnum::ToString(serverType).data(), ip.c_str(), port, int(useEncryption)); | ||||
| 			Log::Info("{:s} Server is listening on {:s}:{:d} with encryption: '{}'", StringifiedEnum::ToString(serverType), ip, port, useEncryption); | ||||
| 		else | ||||
| 			LOG("%s Server is listening on %s:%i with encryption: %i, running zone %i / %i", StringifiedEnum::ToString(serverType).data(), ip.c_str(), port, int(useEncryption), zoneID, instanceID); | ||||
| 	} else { LOG("FAILED TO START SERVER ON IP/PORT: %s:%i", ip.c_str(), port); return; } | ||||
| 			Log::Info("{:s} Server is listening on {:s}:{:d} with encryption: '{}' running zone {:d} / {:d}", StringifiedEnum::ToString(serverType), ip, port, useEncryption, zoneID, instanceID); | ||||
| 	} else { | ||||
| 		Log::Warn("FAILED TO START SERVER ON IP/PORT: {:s}:{:d}", ip, port); | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	mLogger->SetLogToConsole(prevLogSetting); | ||||
|  | ||||
| @@ -76,7 +79,7 @@ dServer::dServer(const std::string& ip, int port, int instanceID, int maxConnect | ||||
| 	if (serverType != ServerType::Master) { | ||||
| 		SetupForMasterConnection(); | ||||
| 		if (!ConnectToMaster()) { | ||||
| 			LOG("Failed ConnectToMaster!"); | ||||
| 			Log::Warn("Failed ConnectToMaster!"); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| @@ -110,13 +113,13 @@ Packet* dServer::ReceiveFromMaster() { | ||||
| 		if (packet->length < 1) { mMasterPeer->DeallocatePacket(packet); return nullptr; } | ||||
|  | ||||
| 		if (packet->data[0] == ID_DISCONNECTION_NOTIFICATION || packet->data[0] == ID_CONNECTION_LOST) { | ||||
| 			LOG("Lost our connection to master, shutting DOWN!"); | ||||
| 			Log::Info("Lost our connection to master, shutting DOWN!"); | ||||
| 			mMasterConnectionActive = false; | ||||
| 			//ConnectToMaster(); //We'll just shut down now | ||||
| 		} | ||||
|  | ||||
| 		if (packet->data[0] == ID_CONNECTION_REQUEST_ACCEPTED) { | ||||
| 			LOG("Established connection to master, zone (%i), instance (%i)", this->GetZoneID(), this->GetInstanceID()); | ||||
| 			Log::Info("Established connection to master, zone ({:d}), instance ({:d})", this->GetZoneID(), this->GetInstanceID()); | ||||
| 			mMasterConnectionActive = true; | ||||
| 			mMasterSystemAddress = packet->systemAddress; | ||||
| 			MasterPackets::SendServerInfo(this, packet); | ||||
| @@ -238,11 +241,11 @@ void dServer::SetupForMasterConnection() { | ||||
| 	mMasterSocketDescriptor = SocketDescriptor(uint16_t(mPort + 1), 0); | ||||
| 	mMasterPeer = RakNetworkFactory::GetRakPeerInterface(); | ||||
| 	bool ret = mMasterPeer->Startup(1, 30, &mMasterSocketDescriptor, 1); | ||||
| 	if (!ret) LOG("Failed MasterPeer Startup!"); | ||||
| 	if (!ret) Log::Warn("Failed MasterPeer Startup!"); | ||||
| } | ||||
|  | ||||
| bool dServer::ConnectToMaster() { | ||||
| 	//LOG("Connection to Master %s:%d", mMasterIP.c_str(), mMasterPort); | ||||
| 	//Log::Info("Connection to Master {:s}:{:d}", mMasterIP, mMasterPort); | ||||
| 	return mMasterPeer->Connect(mMasterIP.c_str(), mMasterPort, "3.25 DARKFLAME1", 15); | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -958,7 +958,7 @@ CppScripts::Script* const CppScripts::GetScript(Entity* parent, const std::strin | ||||
| 			(scriptName =="scripts\\ai\\FV\\L_ACT_NINJA_STUDENT.lua") || | ||||
| 			(scriptName == "scripts\\ai\\WILD\\L_WILD_GF_FROG.lua") || | ||||
| 			(scriptName == "scripts\\empty.lua") | ||||
| 			)) LOG_DEBUG("LOT %i attempted to load CppScript for '%s', but returned InvalidScript.", parent->GetLOT(), scriptName.c_str()); | ||||
| 			)) Log::Debug("LOT {:d} attempted to load CppScript for '{:s}', but returned InvalidScript.", parent->GetLOT(), scriptName); | ||||
| 	} | ||||
|  | ||||
| 	m_Scripts[scriptName] = script; | ||||
|   | ||||
| @@ -7,7 +7,7 @@ | ||||
|  | ||||
| void Server::SetupLogger(const std::string_view serviceName) { | ||||
| 	if (Game::logger) { | ||||
| 		LOG("A logger has already been setup, skipping."); | ||||
| 		Log::Info("A logger has already been setup, skipping."); | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
|   | ||||
| @@ -176,7 +176,7 @@ int main(int argc, char** argv) { | ||||
| 	} catch (CppSQLite3Exception& e) { | ||||
| 		Log::Warn("Unable to connect to CDServer SQLite Database"); | ||||
| 		Log::Warn("Error: {:s}", e.errorMessage()); | ||||
| 		Log::Warn("Error Code: %i", e.errorCode()); | ||||
| 		Log::Warn("Error Code: {:d}", e.errorCode()); | ||||
| 		return EXIT_FAILURE; | ||||
| 	} | ||||
|  | ||||
| @@ -630,20 +630,20 @@ void HandlePacketChat(Packet* packet) { | ||||
| 				if (deleteTeam) { | ||||
| 					TeamManager::Instance()->DeleteTeam(teamID); | ||||
|  | ||||
| 					Log::Info("Deleting team (%llu)", teamID); | ||||
| 					Log::Info("Deleting team ({:d})", teamID); | ||||
|  | ||||
| 					break; | ||||
| 				} | ||||
|  | ||||
| 				inStream.Read(lootOption); | ||||
| 				inStream.Read(memberCount); | ||||
| 				Log::Info("Updating team (%llu), ({:d}), ({:d})", teamID, lootOption, memberCount); | ||||
| 				Log::Info("Updating team ({:d}), ({:d}), ({:d})", teamID, lootOption, memberCount); | ||||
| 				for (char i = 0; i < memberCount; i++) { | ||||
| 					LWOOBJID member = LWOOBJID_EMPTY; | ||||
| 					inStream.Read(member); | ||||
| 					members.push_back(member); | ||||
|  | ||||
| 					Log::Info("Updating team member (%llu)", member); | ||||
| 					Log::Info("Updating team member ({:d})", member); | ||||
| 				} | ||||
|  | ||||
| 				TeamManager::Instance()->UpdateTeam(teamID, lootOption, members); | ||||
| @@ -740,7 +740,7 @@ void HandleMasterPacket(Packet* packet) { | ||||
| 		CINSTREAM_SKIP_HEADER; | ||||
| 		uint64_t requestID; | ||||
| 		inStream.Read(requestID); | ||||
| 		Log::Info("Got affirmation request of transfer %llu", requestID); | ||||
| 		Log::Info("Got affirmation request of transfer {:d}", requestID); | ||||
|  | ||||
| 		CBITSTREAM; | ||||
|  | ||||
| @@ -753,7 +753,7 @@ void HandleMasterPacket(Packet* packet) { | ||||
|  | ||||
| 	case eMasterMessageType::SHUTDOWN: { | ||||
| 		Game::lastSignal = -1; | ||||
| 		Log::Info("Got shutdown request from master, zone (%i), instance (%i)", Game::server->GetZoneID(), Game::server->GetInstanceID()); | ||||
| 		Log::Info("Got shutdown request from master, zone ({:d}), instance ({:d})", Game::server->GetZoneID(), Game::server->GetInstanceID()); | ||||
| 		break; | ||||
| 	} | ||||
|  | ||||
| @@ -780,7 +780,7 @@ void HandleMasterPacket(Packet* packet) { | ||||
| 		break; | ||||
| 	} | ||||
| 	default: | ||||
| 		Log::Info("Unknown packet ID from master %i", int(packet->data[3])); | ||||
| 		Log::Info("Unknown packet ID from master {:d}", static_cast<int>(packet->data[3])); | ||||
| 	} | ||||
| } | ||||
|  | ||||
| @@ -810,7 +810,7 @@ void HandlePacket(Packet* packet) { | ||||
|  | ||||
| 			entity->GetCharacter()->SaveXMLToDatabase(); | ||||
|  | ||||
| 			Log::Info("Deleting player %llu", entity->GetObjectID()); | ||||
| 			Log::Info("Deleting player {:d}", entity->GetObjectID()); | ||||
|  | ||||
| 			Game::entityManager->DestroyEntity(entity); | ||||
| 		} | ||||
| @@ -1084,11 +1084,11 @@ void HandlePacket(Packet* packet) { | ||||
| 					LWOOBJID propertyId = LWOOBJID_EMPTY; | ||||
| 					if (propertyInfo) propertyId = propertyInfo->id; | ||||
| 					else { | ||||
| 						Log::Info("Couldn't find property ID for zone %i, clone %i", zoneId, cloneId); | ||||
| 						Log::Warn("Couldn't find property ID for zone {:d}, clone {:d}", zoneId, cloneId); | ||||
| 						goto noBBB; | ||||
| 					} | ||||
| 					for (auto& bbbModel : Database::Get()->GetUgcModels(propertyId)) { | ||||
| 						Log::Info("Getting lxfml ugcID: %llu", bbbModel.id); | ||||
| 						Log::Info("Getting lxfml ugcID: {:d}", bbbModel.id); | ||||
|  | ||||
| 						bbbModel.lxfmlData.seekg(0, std::ios::end); | ||||
| 						size_t lxfmlSize = bbbModel.lxfmlData.tellg(); | ||||
| @@ -1149,7 +1149,7 @@ void HandlePacket(Packet* packet) { | ||||
| 					Game::chatServer->Send(&bitStream, SYSTEM_PRIORITY, RELIABLE, 0, Game::chatSysAddr, false); | ||||
| 				} | ||||
| 			} else { | ||||
| 				Log::Warn("Couldn't find character to log in with for user {:s} (%i)!", user->GetUsername(), user->GetAccountID()); | ||||
| 				Log::Warn("Couldn't find character to log in with for user {:s} ({:d})!", user->GetUsername(), user->GetAccountID()); | ||||
| 				Game::server->Disconnect(packet->systemAddress, eServerDisconnectIdentifiers::CHARACTER_NOT_FOUND); | ||||
| 			} | ||||
| 		} else { | ||||
| @@ -1307,7 +1307,7 @@ void HandlePacket(Packet* packet) { | ||||
| 			std::string playerName = user->GetLastUsedChar()->GetName(); | ||||
| 			bool isMythran = user->GetLastUsedChar()->GetGMLevel() > eGameMasterLevel::CIVILIAN; | ||||
| 			bool isOk = Game::chatFilter->IsSentenceOkay(GeneralUtils::UTF16ToWTF8(chatMessage.message), user->GetLastUsedChar()->GetGMLevel()).empty(); | ||||
| 			Log::Debug("Msg: {:s} was approved previously? %i", GeneralUtils::UTF16ToWTF8(chatMessage.message), user->GetLastChatMessageApproved()); | ||||
| 			Log::Debug("Msg: {:s} was approved previously? {}", GeneralUtils::UTF16ToWTF8(chatMessage.message), user->GetLastChatMessageApproved()); | ||||
| 			if (!isOk) return; | ||||
| 			if (!isOk && !isMythran) return; | ||||
|  | ||||
| @@ -1381,7 +1381,7 @@ void HandlePacket(Packet* packet) { | ||||
| } | ||||
|  | ||||
| void WorldShutdownProcess(uint32_t zoneId) { | ||||
| 	Log::Info("Saving map %i instance %i", zoneId, instanceID); | ||||
| 	Log::Info("Saving map {:d} instance {:d}", zoneId, instanceID); | ||||
| 	for (auto i = 0; i < Game::server->GetReplicaManager()->GetParticipantCount(); ++i) { | ||||
| 		const auto& player = Game::server->GetReplicaManager()->GetParticipantAtIndex(i); | ||||
|  | ||||
| @@ -1400,13 +1400,13 @@ void WorldShutdownProcess(uint32_t zoneId) { | ||||
| 	} | ||||
|  | ||||
| 	if (PropertyManagementComponent::Instance() != nullptr) { | ||||
| 		Log::Info("Saving ALL property data for zone %i clone %i!", zoneId, PropertyManagementComponent::Instance()->GetCloneId()); | ||||
| 		Log::Info("Saving ALL property data for zone {:d} clone {:d}!", zoneId, PropertyManagementComponent::Instance()->GetCloneId()); | ||||
| 		PropertyManagementComponent::Instance()->Save(); | ||||
| 		Database::Get()->RemoveUnreferencedUgcModels(); | ||||
| 		Log::Info("ALL property data saved for zone %i clone %i!", zoneId, PropertyManagementComponent::Instance()->GetCloneId()); | ||||
| 		Log::Info("ALL property data saved for zone {:d} clone {:d}!", zoneId, PropertyManagementComponent::Instance()->GetCloneId()); | ||||
| 	} | ||||
|  | ||||
| 	Log::Info("ALL DATA HAS BEEN SAVED FOR ZONE %i INSTANCE %i!", zoneId, instanceID); | ||||
| 	Log::Info("ALL DATA HAS BEEN SAVED FOR ZONE {:d} INSTANCE {:d}!", zoneId, instanceID); | ||||
|  | ||||
| 	while (Game::server->GetReplicaManager()->GetParticipantCount() > 0) { | ||||
| 		const auto& player = Game::server->GetReplicaManager()->GetParticipantAtIndex(0); | ||||
| @@ -1428,13 +1428,13 @@ void WorldShutdownSequence() { | ||||
|  | ||||
| 	if (!Game::logger) return; | ||||
|  | ||||
| 	Log::Info("Zone (%i) instance (%i) shutting down outside of main loop!", Game::server->GetZoneID(), instanceID); | ||||
| 	Log::Info("Zone ({:d}) instance ({:d}) shutting down outside of main loop!", Game::server->GetZoneID(), instanceID); | ||||
| 	WorldShutdownProcess(Game::server->GetZoneID()); | ||||
| 	FinalizeShutdown(); | ||||
| } | ||||
|  | ||||
| void FinalizeShutdown() { | ||||
| 	Log::Info("Shutdown complete, zone (%i), instance (%i)", Game::server->GetZoneID(), instanceID); | ||||
| 	Log::Info("Shutdown complete, zone ({:d}), instance ({:d})", Game::server->GetZoneID(), instanceID); | ||||
|  | ||||
| 	//Delete our objects here: | ||||
| 	Metrics::Clear(); | ||||
|   | ||||
| @@ -18,7 +18,7 @@ | ||||
| #include "ObjectIDManager.h" | ||||
|  | ||||
| void dZoneManager::Initialize(const LWOZONEID& zoneID) { | ||||
| 	LOG("Preparing zone: %i/%i/%i", zoneID.GetMapID(), zoneID.GetInstanceID(), zoneID.GetCloneID()); | ||||
| 	Log::Info("Preparing zone: {:d}/{:d}/{:d}", zoneID.GetMapID(), zoneID.GetInstanceID(), zoneID.GetCloneID()); | ||||
|  | ||||
| 	int64_t startTime = 0; | ||||
| 	int64_t endTime = 0; | ||||
| @@ -46,11 +46,11 @@ void dZoneManager::Initialize(const LWOZONEID& zoneID) { | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	LOG("Creating zone control object %i", zoneControlTemplate); | ||||
| 	Log::Info("Creating zone control object {:d}", zoneControlTemplate); | ||||
|  | ||||
| 	// Create ZoneControl object | ||||
| 	if (!Game::entityManager) { | ||||
| 		LOG("ERROR: No entity manager loaded. Cannot proceed."); | ||||
| 		Log::Warn("ERROR: No entity manager loaded. Cannot proceed."); | ||||
| 		throw std::invalid_argument("No entity manager loaded. Cannot proceed."); | ||||
| 	} | ||||
| 	Game::entityManager->Initialize(); | ||||
| @@ -66,7 +66,7 @@ void dZoneManager::Initialize(const LWOZONEID& zoneID) { | ||||
|  | ||||
| 	LoadWorldConfig(); | ||||
|  | ||||
| 	LOG("Zone prepared in: %llu ms", (endTime - startTime)); | ||||
| 	Log::Info("Zone prepared in: {:d} ms", (endTime - startTime)); | ||||
|  | ||||
| 	VanityUtilities::SpawnVanity(); | ||||
| } | ||||
| @@ -148,7 +148,7 @@ void dZoneManager::RemoveSpawner(const LWOOBJID id) { | ||||
| 	auto* spawner = GetSpawner(id); | ||||
|  | ||||
| 	if (spawner == nullptr) { | ||||
| 		LOG("Failed to find spawner (%llu)", id); | ||||
| 		Log::Info("Failed to find spawner ({:d})", id); | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| @@ -158,14 +158,14 @@ void dZoneManager::RemoveSpawner(const LWOOBJID id) { | ||||
| 		entity->Kill(); | ||||
| 	} else { | ||||
|  | ||||
| 		LOG("Failed to find spawner entity (%llu)", id); | ||||
| 		Log::Info("Failed to find spawner entity ({:d})", id); | ||||
| 	} | ||||
|  | ||||
| 	spawner->DestroyAllEntities(); | ||||
|  | ||||
| 	spawner->Deactivate(); | ||||
|  | ||||
| 	LOG("Destroying spawner (%llu)", id); | ||||
| 	Log::Info("Destroying spawner ({:d})", id); | ||||
|  | ||||
| 	m_Spawners.erase(id); | ||||
|  | ||||
| @@ -218,14 +218,14 @@ bool dZoneManager::CheckIfAccessibleZone(LWOMAPID zoneID) { | ||||
| } | ||||
|  | ||||
| void dZoneManager::LoadWorldConfig() { | ||||
| 	LOG("Loading WorldConfig into memory"); | ||||
| 	Log::Info("Loading WorldConfig into memory"); | ||||
|  | ||||
| 	auto worldConfig = CDClientDatabase::ExecuteQuery("SELECT * FROM WorldConfig;"); | ||||
|  | ||||
| 	if (!m_WorldConfig) m_WorldConfig = new WorldConfig(); | ||||
|  | ||||
| 	if (worldConfig.eof()) { | ||||
| 		LOG("WorldConfig table is empty.  Is this intended?"); | ||||
| 		Log::Info("WorldConfig table is empty.  Is this intended?"); | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| @@ -288,5 +288,5 @@ void dZoneManager::LoadWorldConfig() { | ||||
| 	m_WorldConfig->characterVersion = worldConfig.getIntField("CharacterVersion"); | ||||
| 	m_WorldConfig->levelCapCurrencyConversion = worldConfig.getIntField("LevelCapCurrencyConversion"); | ||||
| 	worldConfig.finalize(); | ||||
| 	LOG("Loaded WorldConfig into memory"); | ||||
| 	Log::Info("Loaded WorldConfig into memory"); | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 jadebenn
					jadebenn