mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-24 22:47:25 +00:00
feat: Abstract Logger and simplify code (#1207)
* Logger: Rename logger to Logger from dLogger * Logger: Add compile time filename Fix include issues Add writers Add macros Add macro to force compilation * Logger: Replace calls with macros Allows for filename and line number to be logged * Logger: Add comments and remove extra define Logger: Replace with unique_ptr also flush console at exit. regular file writer should be flushed on file close. Logger: Remove constexpr on variable * Logger: Simplify code * Update Logger.cpp
This commit is contained in:
parent
131239538b
commit
5942182486
@ -7,7 +7,7 @@
|
|||||||
//DLU Includes:
|
//DLU Includes:
|
||||||
#include "dCommonVars.h"
|
#include "dCommonVars.h"
|
||||||
#include "dServer.h"
|
#include "dServer.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "Database.h"
|
#include "Database.h"
|
||||||
#include "dConfig.h"
|
#include "dConfig.h"
|
||||||
#include "Diagnostics.h"
|
#include "Diagnostics.h"
|
||||||
@ -25,14 +25,14 @@
|
|||||||
|
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
namespace Game {
|
namespace Game {
|
||||||
dLogger* logger = nullptr;
|
Logger* logger = nullptr;
|
||||||
dServer* server = nullptr;
|
dServer* server = nullptr;
|
||||||
dConfig* config = nullptr;
|
dConfig* config = nullptr;
|
||||||
bool shouldShutdown = false;
|
bool shouldShutdown = false;
|
||||||
std::mt19937 randomEngine;
|
std::mt19937 randomEngine;
|
||||||
}
|
}
|
||||||
|
|
||||||
dLogger* SetupLogger();
|
Logger* SetupLogger();
|
||||||
void HandlePacket(Packet* packet);
|
void HandlePacket(Packet* packet);
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
@ -51,9 +51,9 @@ int main(int argc, char** argv) {
|
|||||||
Game::logger->SetLogToConsole(Game::config->GetValue("log_to_console") != "0");
|
Game::logger->SetLogToConsole(Game::config->GetValue("log_to_console") != "0");
|
||||||
Game::logger->SetLogDebugStatements(Game::config->GetValue("log_debug_statements") == "1");
|
Game::logger->SetLogDebugStatements(Game::config->GetValue("log_debug_statements") == "1");
|
||||||
|
|
||||||
Game::logger->Log("AuthServer", "Starting Auth server...");
|
LOG("Starting Auth server...");
|
||||||
Game::logger->Log("AuthServer", "Version: %i.%i", PROJECT_VERSION_MAJOR, PROJECT_VERSION_MINOR);
|
LOG("Version: %i.%i", PROJECT_VERSION_MAJOR, PROJECT_VERSION_MINOR);
|
||||||
Game::logger->Log("AuthServer", "Compiled on: %s", __TIMESTAMP__);
|
LOG("Compiled on: %s", __TIMESTAMP__);
|
||||||
|
|
||||||
//Connect to the MySQL Database
|
//Connect to the MySQL Database
|
||||||
std::string mysql_host = Game::config->GetValue("mysql_host");
|
std::string mysql_host = Game::config->GetValue("mysql_host");
|
||||||
@ -64,7 +64,7 @@ int main(int argc, char** argv) {
|
|||||||
try {
|
try {
|
||||||
Database::Connect(mysql_host, mysql_database, mysql_username, mysql_password);
|
Database::Connect(mysql_host, mysql_database, mysql_username, mysql_password);
|
||||||
} catch (sql::SQLException& ex) {
|
} catch (sql::SQLException& ex) {
|
||||||
Game::logger->Log("AuthServer", "Got an error while connecting to the database: %s", ex.what());
|
LOG("Got an error while connecting to the database: %s", ex.what());
|
||||||
Database::Destroy("AuthServer");
|
Database::Destroy("AuthServer");
|
||||||
delete Game::server;
|
delete Game::server;
|
||||||
delete Game::logger;
|
delete Game::logger;
|
||||||
@ -161,7 +161,7 @@ int main(int argc, char** argv) {
|
|||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
dLogger* SetupLogger() {
|
Logger* SetupLogger() {
|
||||||
std::string logPath = (BinaryPathFinder::GetBinaryDir() / ("logs/AuthServer_" + std::to_string(time(nullptr)) + ".log")).string();
|
std::string logPath = (BinaryPathFinder::GetBinaryDir() / ("logs/AuthServer_" + std::to_string(time(nullptr)) + ".log")).string();
|
||||||
bool logToConsole = false;
|
bool logToConsole = false;
|
||||||
bool logDebugStatements = false;
|
bool logDebugStatements = false;
|
||||||
@ -170,7 +170,7 @@ dLogger* SetupLogger() {
|
|||||||
logDebugStatements = true;
|
logDebugStatements = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return new dLogger(logPath, logToConsole, logDebugStatements);
|
return new Logger(logPath, logToConsole, logDebugStatements);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HandlePacket(Packet* packet) {
|
void HandlePacket(Packet* packet) {
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include <regex>
|
#include <regex>
|
||||||
|
|
||||||
#include "dCommonVars.h"
|
#include "dCommonVars.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "dConfig.h"
|
#include "dConfig.h"
|
||||||
#include "Database.h"
|
#include "Database.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dServer.h"
|
#include "dServer.h"
|
||||||
#include "GeneralUtils.h"
|
#include "GeneralUtils.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "eAddFriendResponseCode.h"
|
#include "eAddFriendResponseCode.h"
|
||||||
#include "eAddFriendResponseType.h"
|
#include "eAddFriendResponseType.h"
|
||||||
#include "RakString.h"
|
#include "RakString.h"
|
||||||
@ -397,7 +397,7 @@ void ChatPacketHandler::HandleChatMessage(Packet* packet) {
|
|||||||
|
|
||||||
std::string message = PacketUtils::ReadString(0x66, packet, true, 512);
|
std::string message = PacketUtils::ReadString(0x66, packet, true, 512);
|
||||||
|
|
||||||
Game::logger->Log("ChatPacketHandler", "Got a message from (%s) [%d]: %s", senderName.c_str(), channel, message.c_str());
|
LOG("Got a message from (%s) [%d]: %s", senderName.c_str(), channel, message.c_str());
|
||||||
|
|
||||||
if (channel != 8) return;
|
if (channel != 8) return;
|
||||||
|
|
||||||
@ -527,13 +527,13 @@ void ChatPacketHandler::HandleTeamInvite(Packet* packet) {
|
|||||||
if (team->memberIDs.size() > 3) {
|
if (team->memberIDs.size() > 3) {
|
||||||
// no more teams greater than 4
|
// no more teams greater than 4
|
||||||
|
|
||||||
Game::logger->Log("ChatPacketHandler", "Someone tried to invite a 5th player to a team");
|
LOG("Someone tried to invite a 5th player to a team");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SendTeamInvite(other, player);
|
SendTeamInvite(other, player);
|
||||||
|
|
||||||
Game::logger->Log("ChatPacketHandler", "Got team invite: %llu -> %s", playerID, invitedPlayer.c_str());
|
LOG("Got team invite: %llu -> %s", playerID, invitedPlayer.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatPacketHandler::HandleTeamInviteResponse(Packet* packet) {
|
void ChatPacketHandler::HandleTeamInviteResponse(Packet* packet) {
|
||||||
@ -547,7 +547,7 @@ void ChatPacketHandler::HandleTeamInviteResponse(Packet* packet) {
|
|||||||
LWOOBJID leaderID = LWOOBJID_EMPTY;
|
LWOOBJID leaderID = LWOOBJID_EMPTY;
|
||||||
inStream.Read(leaderID);
|
inStream.Read(leaderID);
|
||||||
|
|
||||||
Game::logger->Log("ChatPacketHandler", "Accepted invite: %llu -> %llu (%d)", playerID, leaderID, declined);
|
LOG("Accepted invite: %llu -> %llu (%d)", playerID, leaderID, declined);
|
||||||
|
|
||||||
if (declined) {
|
if (declined) {
|
||||||
return;
|
return;
|
||||||
@ -556,13 +556,13 @@ void ChatPacketHandler::HandleTeamInviteResponse(Packet* packet) {
|
|||||||
auto* team = playerContainer.GetTeam(leaderID);
|
auto* team = playerContainer.GetTeam(leaderID);
|
||||||
|
|
||||||
if (team == nullptr) {
|
if (team == nullptr) {
|
||||||
Game::logger->Log("ChatPacketHandler", "Failed to find team for leader (%llu)", leaderID);
|
LOG("Failed to find team for leader (%llu)", leaderID);
|
||||||
|
|
||||||
team = playerContainer.GetTeam(playerID);
|
team = playerContainer.GetTeam(playerID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (team == nullptr) {
|
if (team == nullptr) {
|
||||||
Game::logger->Log("ChatPacketHandler", "Failed to find team for player (%llu)", playerID);
|
LOG("Failed to find team for player (%llu)", playerID);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -578,7 +578,7 @@ void ChatPacketHandler::HandleTeamLeave(Packet* packet) {
|
|||||||
|
|
||||||
auto* team = playerContainer.GetTeam(playerID);
|
auto* team = playerContainer.GetTeam(playerID);
|
||||||
|
|
||||||
Game::logger->Log("ChatPacketHandler", "(%llu) leaving team", playerID);
|
LOG("(%llu) leaving team", playerID);
|
||||||
|
|
||||||
if (team != nullptr) {
|
if (team != nullptr) {
|
||||||
playerContainer.RemoveMember(team, playerID, false, false, true);
|
playerContainer.RemoveMember(team, playerID, false, false, true);
|
||||||
@ -592,7 +592,7 @@ void ChatPacketHandler::HandleTeamKick(Packet* packet) {
|
|||||||
|
|
||||||
std::string kickedPlayer = PacketUtils::ReadString(0x14, packet, true);
|
std::string kickedPlayer = PacketUtils::ReadString(0x14, packet, true);
|
||||||
|
|
||||||
Game::logger->Log("ChatPacketHandler", "(%llu) kicking (%s) from team", playerID, kickedPlayer.c_str());
|
LOG("(%llu) kicking (%s) from team", playerID, kickedPlayer.c_str());
|
||||||
|
|
||||||
auto* kicked = playerContainer.GetPlayerData(kickedPlayer);
|
auto* kicked = playerContainer.GetPlayerData(kickedPlayer);
|
||||||
|
|
||||||
@ -622,7 +622,7 @@ void ChatPacketHandler::HandleTeamPromote(Packet* packet) {
|
|||||||
|
|
||||||
std::string promotedPlayer = PacketUtils::ReadString(0x14, packet, true);
|
std::string promotedPlayer = PacketUtils::ReadString(0x14, packet, true);
|
||||||
|
|
||||||
Game::logger->Log("ChatPacketHandler", "(%llu) promoting (%s) to team leader", playerID, promotedPlayer.c_str());
|
LOG("(%llu) promoting (%s) to team leader", playerID, promotedPlayer.c_str());
|
||||||
|
|
||||||
auto* promoted = playerContainer.GetPlayerData(promotedPlayer);
|
auto* promoted = playerContainer.GetPlayerData(promotedPlayer);
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
//DLU Includes:
|
//DLU Includes:
|
||||||
#include "dCommonVars.h"
|
#include "dCommonVars.h"
|
||||||
#include "dServer.h"
|
#include "dServer.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "Database.h"
|
#include "Database.h"
|
||||||
#include "dConfig.h"
|
#include "dConfig.h"
|
||||||
#include "dChatFilter.h"
|
#include "dChatFilter.h"
|
||||||
@ -27,7 +27,7 @@
|
|||||||
#include <MessageIdentifiers.h>
|
#include <MessageIdentifiers.h>
|
||||||
|
|
||||||
namespace Game {
|
namespace Game {
|
||||||
dLogger* logger = nullptr;
|
Logger* logger = nullptr;
|
||||||
dServer* server = nullptr;
|
dServer* server = nullptr;
|
||||||
dConfig* config = nullptr;
|
dConfig* config = nullptr;
|
||||||
dChatFilter* chatFilter = nullptr;
|
dChatFilter* chatFilter = nullptr;
|
||||||
@ -37,7 +37,7 @@ namespace Game {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
dLogger* SetupLogger();
|
Logger* SetupLogger();
|
||||||
void HandlePacket(Packet* packet);
|
void HandlePacket(Packet* packet);
|
||||||
|
|
||||||
PlayerContainer playerContainer;
|
PlayerContainer playerContainer;
|
||||||
@ -58,9 +58,9 @@ int main(int argc, char** argv) {
|
|||||||
Game::logger->SetLogToConsole(Game::config->GetValue("log_to_console") != "0");
|
Game::logger->SetLogToConsole(Game::config->GetValue("log_to_console") != "0");
|
||||||
Game::logger->SetLogDebugStatements(Game::config->GetValue("log_debug_statements") == "1");
|
Game::logger->SetLogDebugStatements(Game::config->GetValue("log_debug_statements") == "1");
|
||||||
|
|
||||||
Game::logger->Log("ChatServer", "Starting Chat server...");
|
LOG("Starting Chat server...");
|
||||||
Game::logger->Log("ChatServer", "Version: %i.%i", PROJECT_VERSION_MAJOR, PROJECT_VERSION_MINOR);
|
LOG("Version: %i.%i", PROJECT_VERSION_MAJOR, PROJECT_VERSION_MINOR);
|
||||||
Game::logger->Log("ChatServer", "Compiled on: %s", __TIMESTAMP__);
|
LOG("Compiled on: %s", __TIMESTAMP__);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
std::string clientPathStr = Game::config->GetValue("client_location");
|
std::string clientPathStr = Game::config->GetValue("client_location");
|
||||||
@ -72,7 +72,7 @@ int main(int argc, char** argv) {
|
|||||||
|
|
||||||
Game::assetManager = new AssetManager(clientPath);
|
Game::assetManager = new AssetManager(clientPath);
|
||||||
} catch (std::runtime_error& ex) {
|
} catch (std::runtime_error& ex) {
|
||||||
Game::logger->Log("ChatServer", "Got an error while setting up assets: %s", ex.what());
|
LOG("Got an error while setting up assets: %s", ex.what());
|
||||||
|
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
@ -86,7 +86,7 @@ int main(int argc, char** argv) {
|
|||||||
try {
|
try {
|
||||||
Database::Connect(mysql_host, mysql_database, mysql_username, mysql_password);
|
Database::Connect(mysql_host, mysql_database, mysql_username, mysql_password);
|
||||||
} catch (sql::SQLException& ex) {
|
} catch (sql::SQLException& ex) {
|
||||||
Game::logger->Log("ChatServer", "Got an error while connecting to the database: %s", ex.what());
|
LOG("Got an error while connecting to the database: %s", ex.what());
|
||||||
Database::Destroy("ChatServer");
|
Database::Destroy("ChatServer");
|
||||||
delete Game::server;
|
delete Game::server;
|
||||||
delete Game::logger;
|
delete Game::logger;
|
||||||
@ -185,7 +185,7 @@ int main(int argc, char** argv) {
|
|||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
dLogger* SetupLogger() {
|
Logger* SetupLogger() {
|
||||||
std::string logPath = (BinaryPathFinder::GetBinaryDir() / ("logs/ChatServer_" + std::to_string(time(nullptr)) + ".log")).string();
|
std::string logPath = (BinaryPathFinder::GetBinaryDir() / ("logs/ChatServer_" + std::to_string(time(nullptr)) + ".log")).string();
|
||||||
bool logToConsole = false;
|
bool logToConsole = false;
|
||||||
bool logDebugStatements = false;
|
bool logDebugStatements = false;
|
||||||
@ -194,16 +194,16 @@ dLogger* SetupLogger() {
|
|||||||
logDebugStatements = true;
|
logDebugStatements = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return new dLogger(logPath, logToConsole, logDebugStatements);
|
return new Logger(logPath, logToConsole, logDebugStatements);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HandlePacket(Packet* packet) {
|
void HandlePacket(Packet* packet) {
|
||||||
if (packet->data[0] == ID_DISCONNECTION_NOTIFICATION || packet->data[0] == ID_CONNECTION_LOST) {
|
if (packet->data[0] == ID_DISCONNECTION_NOTIFICATION || packet->data[0] == ID_CONNECTION_LOST) {
|
||||||
Game::logger->Log("ChatServer", "A server has disconnected, erasing their connected players from the list.");
|
LOG("A server has disconnected, erasing their connected players from the list.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (packet->data[0] == ID_NEW_INCOMING_CONNECTION) {
|
if (packet->data[0] == ID_NEW_INCOMING_CONNECTION) {
|
||||||
Game::logger->Log("ChatServer", "A server is connecting, awaiting user list.");
|
LOG("A server is connecting, awaiting user list.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (packet->length < 4) return; // Nothing left to process. Need 4 bytes to continue.
|
if (packet->length < 4) return; // Nothing left to process. Need 4 bytes to continue.
|
||||||
@ -234,7 +234,7 @@ void HandlePacket(Packet* packet) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Game::logger->Log("ChatServer", "Unknown CHAT_INTERNAL id: %i", int(packet->data[3]));
|
LOG("Unknown CHAT_INTERNAL id: %i", int(packet->data[3]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -245,7 +245,7 @@ void HandlePacket(Packet* packet) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case eChatMessageType::GET_IGNORE_LIST:
|
case eChatMessageType::GET_IGNORE_LIST:
|
||||||
Game::logger->Log("ChatServer", "Asked for ignore list, but is unimplemented right now.");
|
LOG("Asked for ignore list, but is unimplemented right now.");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eChatMessageType::TEAM_GET_STATUS:
|
case eChatMessageType::TEAM_GET_STATUS:
|
||||||
@ -303,19 +303,19 @@ void HandlePacket(Packet* packet) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Game::logger->Log("ChatServer", "Unknown CHAT id: %i", int(packet->data[3]));
|
LOG("Unknown CHAT id: %i", int(packet->data[3]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (static_cast<eConnectionType>(packet->data[1]) == eConnectionType::WORLD) {
|
if (static_cast<eConnectionType>(packet->data[1]) == eConnectionType::WORLD) {
|
||||||
switch (static_cast<eWorldMessageType>(packet->data[3])) {
|
switch (static_cast<eWorldMessageType>(packet->data[3])) {
|
||||||
case eWorldMessageType::ROUTE_PACKET: {
|
case eWorldMessageType::ROUTE_PACKET: {
|
||||||
Game::logger->Log("ChatServer", "Routing packet from world");
|
LOG("Routing packet from world");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Game::logger->Log("ChatServer", "Unknown World id: %i", int(packet->data[3]));
|
LOG("Unknown World id: %i", int(packet->data[3]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "ChatPacketHandler.h"
|
#include "ChatPacketHandler.h"
|
||||||
#include "GeneralUtils.h"
|
#include "GeneralUtils.h"
|
||||||
#include "BitStreamUtils.h"
|
#include "BitStreamUtils.h"
|
||||||
@ -44,7 +44,7 @@ void PlayerContainer::InsertPlayer(Packet* packet) {
|
|||||||
mNames[data->playerID] = GeneralUtils::UTF8ToUTF16(data->playerName);
|
mNames[data->playerID] = GeneralUtils::UTF8ToUTF16(data->playerName);
|
||||||
|
|
||||||
mPlayers.insert(std::make_pair(data->playerID, data));
|
mPlayers.insert(std::make_pair(data->playerID, data));
|
||||||
Game::logger->Log("PlayerContainer", "Added user: %s (%llu), zone: %i", data->playerName.c_str(), data->playerID, data->zoneID.GetMapID());
|
LOG("Added user: %s (%llu), zone: %i", data->playerName.c_str(), data->playerID, data->zoneID.GetMapID());
|
||||||
|
|
||||||
auto* insertLog = Database::CreatePreppedStmt("INSERT INTO activity_log (character_id, activity, time, map_id) VALUES (?, ?, ?, ?);");
|
auto* insertLog = Database::CreatePreppedStmt("INSERT INTO activity_log (character_id, activity, time, map_id) VALUES (?, ?, ?, ?);");
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ void PlayerContainer::RemovePlayer(Packet* packet) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::logger->Log("PlayerContainer", "Removed user: %llu", playerID);
|
LOG("Removed user: %llu", playerID);
|
||||||
mPlayers.erase(playerID);
|
mPlayers.erase(playerID);
|
||||||
|
|
||||||
auto* insertLog = Database::CreatePreppedStmt("INSERT INTO activity_log (character_id, activity, time, map_id) VALUES (?, ?, ?, ?);");
|
auto* insertLog = Database::CreatePreppedStmt("INSERT INTO activity_log (character_id, activity, time, map_id) VALUES (?, ?, ?, ?);");
|
||||||
@ -110,7 +110,7 @@ void PlayerContainer::MuteUpdate(Packet* packet) {
|
|||||||
auto* player = this->GetPlayerData(playerID);
|
auto* player = this->GetPlayerData(playerID);
|
||||||
|
|
||||||
if (player == nullptr) {
|
if (player == nullptr) {
|
||||||
Game::logger->Log("PlayerContainer", "Failed to find user: %llu", playerID);
|
LOG("Failed to find user: %llu", playerID);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -214,7 +214,7 @@ TeamData* PlayerContainer::GetTeam(LWOOBJID playerID) {
|
|||||||
|
|
||||||
void PlayerContainer::AddMember(TeamData* team, LWOOBJID playerID) {
|
void PlayerContainer::AddMember(TeamData* team, LWOOBJID playerID) {
|
||||||
if (team->memberIDs.size() >= 4){
|
if (team->memberIDs.size() >= 4){
|
||||||
Game::logger->Log("PlayerContainer", "Tried to add player to team that already had 4 players");
|
LOG("Tried to add player to team that already had 4 players");
|
||||||
auto* player = GetPlayerData(playerID);
|
auto* player = GetPlayerData(playerID);
|
||||||
if (!player) return;
|
if (!player) return;
|
||||||
ChatPackets::SendSystemMessage(player->sysAddr, u"The teams is full! You have not been added to a team!");
|
ChatPackets::SendSystemMessage(player->sysAddr, u"The teams is full! You have not been added to a team!");
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#define __AMF3__H__
|
#define __AMF3__H__
|
||||||
|
|
||||||
#include "dCommonVars.h"
|
#include "dCommonVars.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
|
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "AmfSerialize.h"
|
#include "AmfSerialize.h"
|
||||||
|
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
|
|
||||||
// Writes an AMFValue pointer to a RakNet::BitStream
|
// Writes an AMFValue pointer to a RakNet::BitStream
|
||||||
template<>
|
template<>
|
||||||
@ -29,7 +29,7 @@ void RakNet::BitStream::Write<AMFBaseValue&>(AMFBaseValue& value) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
Game::logger->Log("AmfSerialize", "Encountered unwritable AMFType %i!", type);
|
LOG("Encountered unwritable AMFType %i!", type);
|
||||||
}
|
}
|
||||||
case eAmf::Undefined:
|
case eAmf::Undefined:
|
||||||
case eAmf::Null:
|
case eAmf::Null:
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include "Database.h"
|
#include "Database.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "ZCompression.h"
|
#include "ZCompression.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
|
|
||||||
//! Forward declarations
|
//! Forward declarations
|
||||||
|
|
||||||
@ -59,14 +59,14 @@ uint32_t BrickByBrickFix::TruncateBrokenBrickByBrickXml() {
|
|||||||
completeUncompressedModel.append((char*)uncompressedChunk.get());
|
completeUncompressedModel.append((char*)uncompressedChunk.get());
|
||||||
completeUncompressedModel.resize(previousSize + actualUncompressedSize);
|
completeUncompressedModel.resize(previousSize + actualUncompressedSize);
|
||||||
} else {
|
} else {
|
||||||
Game::logger->Log("BrickByBrickFix", "Failed to inflate chunk %i for model %llu. Error: %i", chunkCount, modelId, err);
|
LOG("Failed to inflate chunk %i for model %llu. Error: %i", chunkCount, modelId, err);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
chunkCount++;
|
chunkCount++;
|
||||||
}
|
}
|
||||||
std::unique_ptr<tinyxml2::XMLDocument> document = std::make_unique<tinyxml2::XMLDocument>();
|
std::unique_ptr<tinyxml2::XMLDocument> document = std::make_unique<tinyxml2::XMLDocument>();
|
||||||
if (!document) {
|
if (!document) {
|
||||||
Game::logger->Log("BrickByBrickFix", "Failed to initialize tinyxml document. Aborting.");
|
LOG("Failed to initialize tinyxml document. Aborting.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,8 +75,7 @@ uint32_t BrickByBrickFix::TruncateBrokenBrickByBrickXml() {
|
|||||||
"</LXFML>",
|
"</LXFML>",
|
||||||
completeUncompressedModel.length() >= 15 ? completeUncompressedModel.length() - 15 : 0) == std::string::npos
|
completeUncompressedModel.length() >= 15 ? completeUncompressedModel.length() - 15 : 0) == std::string::npos
|
||||||
) {
|
) {
|
||||||
Game::logger->Log("BrickByBrickFix",
|
LOG("Brick-by-brick model %llu will be deleted!", modelId);
|
||||||
"Brick-by-brick model %llu will be deleted!", modelId);
|
|
||||||
ugcModelToDelete->setInt64(1, modelsToTruncate->getInt64(1));
|
ugcModelToDelete->setInt64(1, modelsToTruncate->getInt64(1));
|
||||||
pcModelToDelete->setInt64(1, modelsToTruncate->getInt64(1));
|
pcModelToDelete->setInt64(1, modelsToTruncate->getInt64(1));
|
||||||
ugcModelToDelete->execute();
|
ugcModelToDelete->execute();
|
||||||
@ -85,8 +84,7 @@ uint32_t BrickByBrickFix::TruncateBrokenBrickByBrickXml() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Game::logger->Log("BrickByBrickFix",
|
LOG("Brick-by-brick model %llu will be deleted!", modelId);
|
||||||
"Brick-by-brick model %llu will be deleted!", modelId);
|
|
||||||
ugcModelToDelete->setInt64(1, modelsToTruncate->getInt64(1));
|
ugcModelToDelete->setInt64(1, modelsToTruncate->getInt64(1));
|
||||||
pcModelToDelete->setInt64(1, modelsToTruncate->getInt64(1));
|
pcModelToDelete->setInt64(1, modelsToTruncate->getInt64(1));
|
||||||
ugcModelToDelete->execute();
|
ugcModelToDelete->execute();
|
||||||
@ -140,12 +138,10 @@ uint32_t BrickByBrickFix::UpdateBrickByBrickModelsToSd0() {
|
|||||||
insertionStatement->setInt64(2, modelId);
|
insertionStatement->setInt64(2, modelId);
|
||||||
try {
|
try {
|
||||||
insertionStatement->executeUpdate();
|
insertionStatement->executeUpdate();
|
||||||
Game::logger->Log("BrickByBrickFix", "Updated model %i to sd0", modelId);
|
LOG("Updated model %i to sd0", modelId);
|
||||||
updatedModels++;
|
updatedModels++;
|
||||||
} catch (sql::SQLException exception) {
|
} catch (sql::SQLException exception) {
|
||||||
Game::logger->Log(
|
LOG("Failed to update model %i. This model should be inspected manually to see why."
|
||||||
"BrickByBrickFix",
|
|
||||||
"Failed to update model %i. This model should be inspected manually to see why."
|
|
||||||
"The database error is %s", modelId, exception.what());
|
"The database error is %s", modelId, exception.what());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ set(DCOMMON_SOURCES
|
|||||||
"BinaryIO.cpp"
|
"BinaryIO.cpp"
|
||||||
"dConfig.cpp"
|
"dConfig.cpp"
|
||||||
"Diagnostics.cpp"
|
"Diagnostics.cpp"
|
||||||
"dLogger.cpp"
|
"Logger.cpp"
|
||||||
"GeneralUtils.cpp"
|
"GeneralUtils.cpp"
|
||||||
"LDFFormat.cpp"
|
"LDFFormat.cpp"
|
||||||
"MD5.cpp"
|
"MD5.cpp"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "Diagnostics.h"
|
#include "Diagnostics.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
|
|
||||||
// If we're on Win32, we'll include our minidump writer
|
// If we're on Win32, we'll include our minidump writer
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@ -9,7 +9,7 @@
|
|||||||
#include <Dbghelp.h>
|
#include <Dbghelp.h>
|
||||||
|
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
|
|
||||||
void make_minidump(EXCEPTION_POINTERS* e) {
|
void make_minidump(EXCEPTION_POINTERS* e) {
|
||||||
auto hDbgHelp = LoadLibraryA("dbghelp");
|
auto hDbgHelp = LoadLibraryA("dbghelp");
|
||||||
@ -28,7 +28,7 @@ void make_minidump(EXCEPTION_POINTERS* e) {
|
|||||||
"_%4d%02d%02d_%02d%02d%02d.dmp",
|
"_%4d%02d%02d_%02d%02d%02d.dmp",
|
||||||
t.wYear, t.wMonth, t.wDay, t.wHour, t.wMinute, t.wSecond);
|
t.wYear, t.wMonth, t.wDay, t.wHour, t.wMinute, t.wSecond);
|
||||||
}
|
}
|
||||||
Game::logger->Log("Diagnostics", "Creating crash dump %s", name);
|
LOG("Creating crash dump %s", name);
|
||||||
auto hFile = CreateFileA(name, GENERIC_WRITE, FILE_SHARE_READ, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
|
auto hFile = CreateFileA(name, GENERIC_WRITE, FILE_SHARE_READ, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
|
||||||
if (hFile == INVALID_HANDLE_VALUE)
|
if (hFile == INVALID_HANDLE_VALUE)
|
||||||
return;
|
return;
|
||||||
@ -83,7 +83,7 @@ struct bt_ctx {
|
|||||||
|
|
||||||
static inline void Bt(struct backtrace_state* state) {
|
static inline void Bt(struct backtrace_state* state) {
|
||||||
std::string fileName = Diagnostics::GetOutDirectory() + "crash_" + Diagnostics::GetProcessName() + "_" + std::to_string(getpid()) + ".log";
|
std::string fileName = Diagnostics::GetOutDirectory() + "crash_" + Diagnostics::GetProcessName() + "_" + std::to_string(getpid()) + ".log";
|
||||||
Game::logger->Log("Diagnostics", "backtrace is enabled, crash dump located at %s", fileName.c_str());
|
LOG("backtrace is enabled, crash dump located at %s", fileName.c_str());
|
||||||
FILE* file = fopen(fileName.c_str(), "w+");
|
FILE* file = fopen(fileName.c_str(), "w+");
|
||||||
if (file != nullptr) {
|
if (file != nullptr) {
|
||||||
backtrace_print(state, 2, file);
|
backtrace_print(state, 2, file);
|
||||||
@ -118,7 +118,7 @@ void CatchUnhandled(int sig) {
|
|||||||
#ifndef __include_backtrace__
|
#ifndef __include_backtrace__
|
||||||
|
|
||||||
std::string fileName = Diagnostics::GetOutDirectory() + "crash_" + Diagnostics::GetProcessName() + "_" + std::to_string(getpid()) + ".log";
|
std::string fileName = Diagnostics::GetOutDirectory() + "crash_" + Diagnostics::GetProcessName() + "_" + std::to_string(getpid()) + ".log";
|
||||||
Game::logger->Log("Diagnostics", "Encountered signal %i, creating crash dump %s", sig, fileName.c_str());
|
LOG("Encountered signal %i, creating crash dump %s", sig, fileName.c_str());
|
||||||
if (Diagnostics::GetProduceMemoryDump()) {
|
if (Diagnostics::GetProduceMemoryDump()) {
|
||||||
GenerateDump();
|
GenerateDump();
|
||||||
}
|
}
|
||||||
@ -154,7 +154,7 @@ void CatchUnhandled(int sig) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::logger->Log("Diagnostics", "[%02zu] %s", i, functionName.c_str());
|
LOG("[%02zu] %s", i, functionName.c_str());
|
||||||
}
|
}
|
||||||
# else // defined(__GNUG__)
|
# else // defined(__GNUG__)
|
||||||
backtrace_symbols_fd(array, size, STDOUT_FILENO);
|
backtrace_symbols_fd(array, size, STDOUT_FILENO);
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include "CDClientDatabase.h"
|
#include "CDClientDatabase.h"
|
||||||
#include "GeneralUtils.h"
|
#include "GeneralUtils.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "AssetManager.h"
|
#include "AssetManager.h"
|
||||||
|
|
||||||
#include "eSqliteDataType.h"
|
#include "eSqliteDataType.h"
|
||||||
@ -44,7 +44,7 @@ bool FdbToSqlite::Convert::ConvertDatabase(AssetMemoryBuffer& buffer) {
|
|||||||
|
|
||||||
CDClientDatabase::ExecuteQuery("COMMIT;");
|
CDClientDatabase::ExecuteQuery("COMMIT;");
|
||||||
} catch (CppSQLite3Exception& e) {
|
} catch (CppSQLite3Exception& e) {
|
||||||
Game::logger->Log("FdbToSqlite", "Encountered error %s converting FDB to SQLite", e.errorMessage());
|
LOG("Encountered error %s converting FDB to SQLite", e.errorMessage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include <random>
|
#include <random>
|
||||||
|
|
||||||
class dServer;
|
class dServer;
|
||||||
class dLogger;
|
class Logger;
|
||||||
class InstanceManager;
|
class InstanceManager;
|
||||||
class dChatFilter;
|
class dChatFilter;
|
||||||
class dConfig;
|
class dConfig;
|
||||||
@ -14,7 +14,7 @@ class EntityManager;
|
|||||||
class dZoneManager;
|
class dZoneManager;
|
||||||
|
|
||||||
namespace Game {
|
namespace Game {
|
||||||
extern dLogger* logger;
|
extern Logger* logger;
|
||||||
extern dServer* server;
|
extern dServer* server;
|
||||||
extern InstanceManager* im;
|
extern InstanceManager* im;
|
||||||
extern dChatFilter* chatFilter;
|
extern dChatFilter* chatFilter;
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
#include "NiPoint3.h"
|
#include "NiPoint3.h"
|
||||||
|
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
|
|
||||||
enum eInventoryType : uint32_t;
|
enum eInventoryType : uint32_t;
|
||||||
enum class eObjectBits : size_t;
|
enum class eObjectBits : size_t;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include "GeneralUtils.h"
|
#include "GeneralUtils.h"
|
||||||
|
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
|
|
||||||
// C++
|
// C++
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
@ -48,7 +48,7 @@ LDFBaseData* LDFBaseData::DataFromString(const std::string_view& format) {
|
|||||||
try {
|
try {
|
||||||
type = static_cast<eLDFType>(strtol(ldfTypeAndValue.first.data(), &storage, 10));
|
type = static_cast<eLDFType>(strtol(ldfTypeAndValue.first.data(), &storage, 10));
|
||||||
} catch (std::exception) {
|
} catch (std::exception) {
|
||||||
Game::logger->Log("LDFFormat", "Attempted to process invalid ldf type (%s) from string (%s)", ldfTypeAndValue.first.data(), format.data());
|
LOG("Attempted to process invalid ldf type (%s) from string (%s)", ldfTypeAndValue.first.data(), format.data());
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ LDFBaseData* LDFBaseData::DataFromString(const std::string_view& format) {
|
|||||||
case LDF_TYPE_S32: {
|
case LDF_TYPE_S32: {
|
||||||
int32_t data;
|
int32_t data;
|
||||||
if (!GeneralUtils::TryParse(ldfTypeAndValue.second.data(), data)) {
|
if (!GeneralUtils::TryParse(ldfTypeAndValue.second.data(), data)) {
|
||||||
Game::logger->Log("LDFFormat", "Warning: Attempted to process invalid int32 value (%s) from string (%s)", ldfTypeAndValue.second.data(), format.data());
|
LOG("Warning: Attempted to process invalid int32 value (%s) from string (%s)", ldfTypeAndValue.second.data(), format.data());
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
returnValue = new LDFData<int32_t>(key, data);
|
returnValue = new LDFData<int32_t>(key, data);
|
||||||
@ -74,7 +74,7 @@ LDFBaseData* LDFBaseData::DataFromString(const std::string_view& format) {
|
|||||||
case LDF_TYPE_FLOAT: {
|
case LDF_TYPE_FLOAT: {
|
||||||
float data;
|
float data;
|
||||||
if (!GeneralUtils::TryParse(ldfTypeAndValue.second.data(), data)) {
|
if (!GeneralUtils::TryParse(ldfTypeAndValue.second.data(), data)) {
|
||||||
Game::logger->Log("LDFFormat", "Warning: Attempted to process invalid float value (%s) from string (%s)", ldfTypeAndValue.second.data(), format.data());
|
LOG("Warning: Attempted to process invalid float value (%s) from string (%s)", ldfTypeAndValue.second.data(), format.data());
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
returnValue = new LDFData<float>(key, data);
|
returnValue = new LDFData<float>(key, data);
|
||||||
@ -84,7 +84,7 @@ LDFBaseData* LDFBaseData::DataFromString(const std::string_view& format) {
|
|||||||
case LDF_TYPE_DOUBLE: {
|
case LDF_TYPE_DOUBLE: {
|
||||||
double data;
|
double data;
|
||||||
if (!GeneralUtils::TryParse(ldfTypeAndValue.second.data(), data)) {
|
if (!GeneralUtils::TryParse(ldfTypeAndValue.second.data(), data)) {
|
||||||
Game::logger->Log("LDFFormat", "Warning: Attempted to process invalid double value (%s) from string (%s)", ldfTypeAndValue.second.data(), format.data());
|
LOG("Warning: Attempted to process invalid double value (%s) from string (%s)", ldfTypeAndValue.second.data(), format.data());
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
returnValue = new LDFData<double>(key, data);
|
returnValue = new LDFData<double>(key, data);
|
||||||
@ -101,7 +101,7 @@ LDFBaseData* LDFBaseData::DataFromString(const std::string_view& format) {
|
|||||||
data = 0;
|
data = 0;
|
||||||
} else {
|
} else {
|
||||||
if (!GeneralUtils::TryParse(ldfTypeAndValue.second.data(), data)) {
|
if (!GeneralUtils::TryParse(ldfTypeAndValue.second.data(), data)) {
|
||||||
Game::logger->Log("LDFFormat", "Warning: Attempted to process invalid uint32 value (%s) from string (%s)", ldfTypeAndValue.second.data(), format.data());
|
LOG("Warning: Attempted to process invalid uint32 value (%s) from string (%s)", ldfTypeAndValue.second.data(), format.data());
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -119,7 +119,7 @@ LDFBaseData* LDFBaseData::DataFromString(const std::string_view& format) {
|
|||||||
data = false;
|
data = false;
|
||||||
} else {
|
} else {
|
||||||
if (!GeneralUtils::TryParse(ldfTypeAndValue.second.data(), data)) {
|
if (!GeneralUtils::TryParse(ldfTypeAndValue.second.data(), data)) {
|
||||||
Game::logger->Log("LDFFormat", "Warning: Attempted to process invalid bool value (%s) from string (%s)", ldfTypeAndValue.second.data(), format.data());
|
LOG("Warning: Attempted to process invalid bool value (%s) from string (%s)", ldfTypeAndValue.second.data(), format.data());
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -131,7 +131,7 @@ LDFBaseData* LDFBaseData::DataFromString(const std::string_view& format) {
|
|||||||
case LDF_TYPE_U64: {
|
case LDF_TYPE_U64: {
|
||||||
uint64_t data;
|
uint64_t data;
|
||||||
if (!GeneralUtils::TryParse(ldfTypeAndValue.second.data(), data)) {
|
if (!GeneralUtils::TryParse(ldfTypeAndValue.second.data(), data)) {
|
||||||
Game::logger->Log("LDFFormat", "Warning: Attempted to process invalid uint64 value (%s) from string (%s)", ldfTypeAndValue.second.data(), format.data());
|
LOG("Warning: Attempted to process invalid uint64 value (%s) from string (%s)", ldfTypeAndValue.second.data(), format.data());
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
returnValue = new LDFData<uint64_t>(key, data);
|
returnValue = new LDFData<uint64_t>(key, data);
|
||||||
@ -141,7 +141,7 @@ LDFBaseData* LDFBaseData::DataFromString(const std::string_view& format) {
|
|||||||
case LDF_TYPE_OBJID: {
|
case LDF_TYPE_OBJID: {
|
||||||
LWOOBJID data;
|
LWOOBJID data;
|
||||||
if (!GeneralUtils::TryParse(ldfTypeAndValue.second.data(), data)) {
|
if (!GeneralUtils::TryParse(ldfTypeAndValue.second.data(), data)) {
|
||||||
Game::logger->Log("LDFFormat", "Warning: Attempted to process invalid LWOOBJID value (%s) from string (%s)", ldfTypeAndValue.second.data(), format.data());
|
LOG("Warning: Attempted to process invalid LWOOBJID value (%s) from string (%s)", ldfTypeAndValue.second.data(), format.data());
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
returnValue = new LDFData<LWOOBJID>(key, data);
|
returnValue = new LDFData<LWOOBJID>(key, data);
|
||||||
@ -155,12 +155,12 @@ LDFBaseData* LDFBaseData::DataFromString(const std::string_view& format) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case LDF_TYPE_UNKNOWN: {
|
case LDF_TYPE_UNKNOWN: {
|
||||||
Game::logger->Log("LDFFormat", "Warning: Attempted to process invalid unknown value (%s) from string (%s)", ldfTypeAndValue.second.data(), format.data());
|
LOG("Warning: Attempted to process invalid unknown value (%s) from string (%s)", ldfTypeAndValue.second.data(), format.data());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
Game::logger->Log("LDFFormat", "Warning: Attempted to process invalid LDF type (%d) from string (%s)", type, format.data());
|
LOG("Warning: Attempted to process invalid LDF type (%d) from string (%s)", type, format.data());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
96
dCommon/Logger.cpp
Normal file
96
dCommon/Logger.cpp
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
#include "Logger.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <ctime>
|
||||||
|
#include <filesystem>
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
Writer::~Writer() {
|
||||||
|
// Dont try to close stdcout...
|
||||||
|
if (!m_Outfile || m_IsConsoleWriter) return;
|
||||||
|
|
||||||
|
fclose(m_Outfile);
|
||||||
|
m_Outfile = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Writer::Log(const char* time, const char* message) {
|
||||||
|
if (!m_Outfile) return;
|
||||||
|
|
||||||
|
fputs(time, m_Outfile);
|
||||||
|
fputs(message, m_Outfile);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Writer::Flush() {
|
||||||
|
if (!m_Outfile) return;
|
||||||
|
fflush(m_Outfile);
|
||||||
|
}
|
||||||
|
|
||||||
|
FileWriter::FileWriter(const char* outpath) {
|
||||||
|
m_Outfile = fopen(outpath, "wt");
|
||||||
|
if (!m_Outfile) printf("Couldn't open %s for writing!\n", outpath);
|
||||||
|
m_Outpath = outpath;
|
||||||
|
m_IsConsoleWriter = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ConsoleWriter::ConsoleWriter(bool enabled) {
|
||||||
|
m_Enabled = enabled;
|
||||||
|
m_Outfile = stdout;
|
||||||
|
m_IsConsoleWriter = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Logger::Logger(const std::string& outpath, bool logToConsole, bool logDebugStatements) {
|
||||||
|
m_logDebugStatements = logDebugStatements;
|
||||||
|
std::filesystem::path outpathPath(outpath);
|
||||||
|
if (!std::filesystem::exists(outpathPath.parent_path())) std::filesystem::create_directories(outpathPath.parent_path());
|
||||||
|
m_Writers.push_back(std::make_unique<FileWriter>(outpath));
|
||||||
|
m_Writers.push_back(std::make_unique<ConsoleWriter>(logToConsole));
|
||||||
|
}
|
||||||
|
|
||||||
|
void Logger::vLog(const char* format, va_list args) {
|
||||||
|
time_t t = time(NULL);
|
||||||
|
struct tm* time = localtime(&t);
|
||||||
|
char timeStr[70];
|
||||||
|
strftime(timeStr, sizeof(timeStr), "[%d-%m-%y %H:%M:%S ", time);
|
||||||
|
char message[2048];
|
||||||
|
vsnprintf(message, 2048, format, args);
|
||||||
|
for (const auto& writer : m_Writers) {
|
||||||
|
writer->Log(timeStr, message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Logger::Log(const char* className, const char* format, ...) {
|
||||||
|
va_list args;
|
||||||
|
std::string log = std::string(className) + "] " + std::string(format) + "\n";
|
||||||
|
va_start(args, format);
|
||||||
|
vLog(log.c_str(), args);
|
||||||
|
va_end(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Logger::LogDebug(const char* className, const char* format, ...) {
|
||||||
|
if (!m_logDebugStatements) return;
|
||||||
|
va_list args;
|
||||||
|
std::string log = std::string(className) + "] " + std::string(format) + "\n";
|
||||||
|
va_start(args, format);
|
||||||
|
vLog(log.c_str(), args);
|
||||||
|
va_end(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Logger::Flush() {
|
||||||
|
for (const auto& writer : m_Writers) {
|
||||||
|
writer->Flush();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Logger::SetLogToConsole(bool logToConsole) {
|
||||||
|
for (const auto& writer : m_Writers) {
|
||||||
|
if (writer->IsConsoleWriter()) writer->SetEnabled(logToConsole);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Logger::GetLogToConsole() const {
|
||||||
|
bool toReturn = false;
|
||||||
|
for (const auto& writer : m_Writers) {
|
||||||
|
if (writer->IsConsoleWriter()) toReturn |= writer->GetEnabled();
|
||||||
|
}
|
||||||
|
return toReturn;
|
||||||
|
}
|
89
dCommon/Logger.h
Normal file
89
dCommon/Logger.h
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#define STRINGIFY_IMPL(x) #x
|
||||||
|
|
||||||
|
#define STRINGIFY(x) STRINGIFY_IMPL(x)
|
||||||
|
|
||||||
|
#define GET_FILE_NAME(x, y) GetFileNameFromAbsolutePath(__FILE__ x y)
|
||||||
|
|
||||||
|
#define FILENAME_AND_LINE GET_FILE_NAME(":", STRINGIFY(__LINE__))
|
||||||
|
|
||||||
|
// Calculate the filename at compile time from the path.
|
||||||
|
// We just do this by scanning the path for the last '/' or '\' character and returning the string after it.
|
||||||
|
constexpr const char* GetFileNameFromAbsolutePath(const char* path) {
|
||||||
|
const char* file = path;
|
||||||
|
while (*path) {
|
||||||
|
char nextChar = *path++;
|
||||||
|
if (nextChar == '/' || nextChar == '\\') {
|
||||||
|
file = path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
|
||||||
|
// These have to have a constexpr variable to store the filename_and_line result in a local variable otherwise
|
||||||
|
// they will not be valid constexpr and will be evaluated at runtime instead of compile time!
|
||||||
|
// The full string is still stored in the binary, however the offset of the filename in the absolute paths
|
||||||
|
// is used in the instruction instead of the start of the absolute path.
|
||||||
|
#define LOG(message, ...) do { auto str = FILENAME_AND_LINE; Game::logger->Log(str, message, ##__VA_ARGS__); } while(0)
|
||||||
|
#define LOG_DEBUG(message, ...) do { auto str = FILENAME_AND_LINE; Game::logger->LogDebug(str, message, ##__VA_ARGS__); } while(0)
|
||||||
|
|
||||||
|
// Writer class for writing data to files.
|
||||||
|
class Writer {
|
||||||
|
public:
|
||||||
|
Writer(bool enabled = true) : m_Enabled(enabled) {};
|
||||||
|
virtual ~Writer();
|
||||||
|
|
||||||
|
virtual void Log(const char* time, const char* message);
|
||||||
|
virtual void Flush();
|
||||||
|
|
||||||
|
void SetEnabled(bool disabled) { m_Enabled = disabled; }
|
||||||
|
bool GetEnabled() const { return m_Enabled; }
|
||||||
|
|
||||||
|
bool IsConsoleWriter() { return m_IsConsoleWriter; }
|
||||||
|
public:
|
||||||
|
bool m_Enabled = true;
|
||||||
|
bool m_IsConsoleWriter = false;
|
||||||
|
FILE* m_Outfile;
|
||||||
|
};
|
||||||
|
|
||||||
|
// FileWriter class for writing data to a file on a disk.
|
||||||
|
class FileWriter : public Writer {
|
||||||
|
public:
|
||||||
|
FileWriter(const char* outpath);
|
||||||
|
FileWriter(const std::string& outpath) : FileWriter(outpath.c_str()) {};
|
||||||
|
private:
|
||||||
|
std::string m_Outpath;
|
||||||
|
};
|
||||||
|
|
||||||
|
// ConsoleWriter class for writing data to the console.
|
||||||
|
class ConsoleWriter : public Writer {
|
||||||
|
public:
|
||||||
|
ConsoleWriter(bool enabled);
|
||||||
|
};
|
||||||
|
|
||||||
|
class Logger {
|
||||||
|
public:
|
||||||
|
Logger() = delete;
|
||||||
|
Logger(const std::string& outpath, bool logToConsole, bool logDebugStatements);
|
||||||
|
|
||||||
|
void Log(const char* filenameAndLine, const char* format, ...);
|
||||||
|
void LogDebug(const char* filenameAndLine, const char* format, ...);
|
||||||
|
|
||||||
|
void Flush();
|
||||||
|
|
||||||
|
bool GetLogToConsole() const;
|
||||||
|
void SetLogToConsole(bool logToConsole);
|
||||||
|
|
||||||
|
void SetLogDebugStatements(bool logDebugStatements) { m_logDebugStatements = logDebugStatements; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
void vLog(const char* format, va_list args);
|
||||||
|
|
||||||
|
bool m_logDebugStatements;
|
||||||
|
std::vector<std::unique_ptr<Writer>> m_Writers;
|
||||||
|
};
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "AssetManager.h"
|
#include "AssetManager.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
|
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
struct PackRecord {
|
struct PackRecord {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "PackIndex.h"
|
#include "PackIndex.h"
|
||||||
#include "BinaryIO.h"
|
#include "BinaryIO.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
|
|
||||||
PackIndex::PackIndex(const std::filesystem::path& filePath) {
|
PackIndex::PackIndex(const std::filesystem::path& filePath) {
|
||||||
m_FileStream = std::ifstream(filePath / "versions" / "primary.pki", std::ios::in | std::ios::binary);
|
m_FileStream = std::ifstream(filePath / "versions" / "primary.pki", std::ios::in | std::ios::binary);
|
||||||
@ -34,7 +34,7 @@ PackIndex::PackIndex(const std::filesystem::path& filePath) {
|
|||||||
m_PackFileIndices.push_back(packFileIndex);
|
m_PackFileIndices.push_back(packFileIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::logger->Log("PackIndex", "Loaded pack catalog with %i pack files and %i files", m_PackPaths.size(), m_PackFileIndices.size());
|
LOG("Loaded pack catalog with %i pack files and %i files", m_PackPaths.size(), m_PackFileIndices.size());
|
||||||
|
|
||||||
for (auto& item : m_PackPaths) {
|
for (auto& item : m_PackPaths) {
|
||||||
std::replace(item.begin(), item.end(), '\\', '/');
|
std::replace(item.begin(), item.end(), '\\', '/');
|
||||||
|
@ -1,110 +0,0 @@
|
|||||||
#include "dLogger.h"
|
|
||||||
|
|
||||||
dLogger::dLogger(const std::string& outpath, bool logToConsole, bool logDebugStatements) {
|
|
||||||
m_logToConsole = logToConsole;
|
|
||||||
m_logDebugStatements = logDebugStatements;
|
|
||||||
m_outpath = outpath;
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
mFile = std::ofstream(m_outpath);
|
|
||||||
if (!mFile) { printf("Couldn't open %s for writing!\n", outpath.c_str()); }
|
|
||||||
#else
|
|
||||||
fp = fopen(outpath.c_str(), "wt");
|
|
||||||
if (fp == NULL) { printf("Couldn't open %s for writing!\n", outpath.c_str()); }
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
dLogger::~dLogger() {
|
|
||||||
#ifdef _WIN32
|
|
||||||
mFile.close();
|
|
||||||
#else
|
|
||||||
if (fp != nullptr) {
|
|
||||||
fclose(fp);
|
|
||||||
fp = nullptr;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void dLogger::vLog(const char* format, va_list args) {
|
|
||||||
#ifdef _WIN32
|
|
||||||
time_t t = time(NULL);
|
|
||||||
struct tm time;
|
|
||||||
localtime_s(&time, &t);
|
|
||||||
char timeStr[70];
|
|
||||||
strftime(timeStr, sizeof(timeStr), "%d-%m-%y %H:%M:%S", &time);
|
|
||||||
char message[2048];
|
|
||||||
vsnprintf(message, 2048, format, args);
|
|
||||||
|
|
||||||
if (m_logToConsole) std::cout << "[" << timeStr << "] " << message;
|
|
||||||
mFile << "[" << timeStr << "] " << message;
|
|
||||||
#else
|
|
||||||
time_t t = time(NULL);
|
|
||||||
struct tm* time = localtime(&t);
|
|
||||||
char timeStr[70];
|
|
||||||
strftime(timeStr, sizeof(timeStr), "%d-%m-%y %H:%M:%S", time);
|
|
||||||
char message[2048];
|
|
||||||
vsnprintf(message, 2048, format, args);
|
|
||||||
|
|
||||||
if (m_logToConsole) {
|
|
||||||
fputs("[", stdout);
|
|
||||||
fputs(timeStr, stdout);
|
|
||||||
fputs("] ", stdout);
|
|
||||||
fputs(message, stdout);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fp != nullptr) {
|
|
||||||
fputs("[", fp);
|
|
||||||
fputs(timeStr, fp);
|
|
||||||
fputs("] ", fp);
|
|
||||||
fputs(message, fp);
|
|
||||||
} else {
|
|
||||||
printf("Logger not initialized!\n");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void dLogger::LogBasic(const char* format, ...) {
|
|
||||||
va_list args;
|
|
||||||
va_start(args, format);
|
|
||||||
vLog(format, args);
|
|
||||||
va_end(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
void dLogger::LogBasic(const std::string& message) {
|
|
||||||
LogBasic(message.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
void dLogger::Log(const char* className, const char* format, ...) {
|
|
||||||
va_list args;
|
|
||||||
std::string log = "[" + std::string(className) + "] " + std::string(format) + "\n";
|
|
||||||
va_start(args, format);
|
|
||||||
vLog(log.c_str(), args);
|
|
||||||
va_end(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
void dLogger::Log(const std::string& className, const std::string& message) {
|
|
||||||
Log(className.c_str(), message.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
void dLogger::LogDebug(const char* className, const char* format, ...) {
|
|
||||||
if (!m_logDebugStatements) return;
|
|
||||||
va_list args;
|
|
||||||
std::string log = "[" + std::string(className) + "] " + std::string(format) + "\n";
|
|
||||||
va_start(args, format);
|
|
||||||
vLog(log.c_str(), args);
|
|
||||||
va_end(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
void dLogger::LogDebug(const std::string& className, const std::string& message) {
|
|
||||||
LogDebug(className.c_str(), message.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
void dLogger::Flush() {
|
|
||||||
#ifdef _WIN32
|
|
||||||
mFile.flush();
|
|
||||||
#else
|
|
||||||
if (fp != nullptr) {
|
|
||||||
std::fflush(fp);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
@ -1,38 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
#include <ctime>
|
|
||||||
#include <cstdarg>
|
|
||||||
#include <string>
|
|
||||||
#include <fstream>
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
class dLogger {
|
|
||||||
public:
|
|
||||||
dLogger(const std::string& outpath, bool logToConsole, bool logDebugStatements);
|
|
||||||
~dLogger();
|
|
||||||
|
|
||||||
void SetLogToConsole(bool logToConsole) { m_logToConsole = logToConsole; }
|
|
||||||
void SetLogDebugStatements(bool logDebugStatements) { m_logDebugStatements = logDebugStatements; }
|
|
||||||
void vLog(const char* format, va_list args);
|
|
||||||
|
|
||||||
void LogBasic(const std::string& message);
|
|
||||||
void LogBasic(const char* format, ...);
|
|
||||||
void Log(const char* className, const char* format, ...);
|
|
||||||
void Log(const std::string& className, const std::string& message);
|
|
||||||
void LogDebug(const std::string& className, const std::string& message);
|
|
||||||
void LogDebug(const char* className, const char* format, ...);
|
|
||||||
|
|
||||||
void Flush();
|
|
||||||
|
|
||||||
const bool GetIsLoggingToConsole() const { return m_logToConsole; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool m_logDebugStatements;
|
|
||||||
bool m_logToConsole;
|
|
||||||
std::string m_outpath;
|
|
||||||
std::ofstream mFile;
|
|
||||||
|
|
||||||
#ifndef _WIN32
|
|
||||||
//Glorious linux can run with SPEED:
|
|
||||||
FILE* fp = nullptr;
|
|
||||||
#endif
|
|
||||||
};
|
|
@ -1,7 +1,7 @@
|
|||||||
#include "Database.h"
|
#include "Database.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dConfig.h"
|
#include "dConfig.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
#pragma warning (disable:4251) //Disables SQL warnings
|
#pragma warning (disable:4251) //Disables SQL warnings
|
||||||
@ -64,8 +64,8 @@ void Database::Destroy(std::string source, bool log) {
|
|||||||
if (!con) return;
|
if (!con) return;
|
||||||
|
|
||||||
if (log) {
|
if (log) {
|
||||||
if (source != "") Game::logger->Log("Database", "Destroying MySQL connection from %s!", source.c_str());
|
if (source != "") LOG("Destroying MySQL connection from %s!", source.c_str());
|
||||||
else Game::logger->Log("Database", "Destroying MySQL connection!");
|
else LOG("Destroying MySQL connection!");
|
||||||
}
|
}
|
||||||
|
|
||||||
con->close();
|
con->close();
|
||||||
@ -84,7 +84,7 @@ sql::PreparedStatement* Database::CreatePreppedStmt(const std::string& query) {
|
|||||||
|
|
||||||
if (!con) {
|
if (!con) {
|
||||||
Connect();
|
Connect();
|
||||||
Game::logger->Log("Database", "Trying to reconnect to MySQL");
|
LOG("Trying to reconnect to MySQL");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!con->isValid() || con->isClosed()) {
|
if (!con->isValid() || con->isClosed()) {
|
||||||
@ -93,7 +93,7 @@ sql::PreparedStatement* Database::CreatePreppedStmt(const std::string& query) {
|
|||||||
con = nullptr;
|
con = nullptr;
|
||||||
|
|
||||||
Connect();
|
Connect();
|
||||||
Game::logger->Log("Database", "Trying to reconnect to MySQL from invalid or closed connection");
|
LOG("Trying to reconnect to MySQL from invalid or closed connection");
|
||||||
}
|
}
|
||||||
|
|
||||||
auto* stmt = con->prepareStatement(str);
|
auto* stmt = con->prepareStatement(str);
|
||||||
|
@ -5,10 +5,10 @@
|
|||||||
#include "Database.h"
|
#include "Database.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "GeneralUtils.h"
|
#include "GeneralUtils.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "BinaryPathFinder.h"
|
#include "BinaryPathFinder.h"
|
||||||
|
|
||||||
#include <istream>
|
#include <fstream>
|
||||||
|
|
||||||
Migration LoadMigration(std::string path) {
|
Migration LoadMigration(std::string path) {
|
||||||
Migration migration{};
|
Migration migration{};
|
||||||
@ -53,7 +53,7 @@ void MigrationRunner::RunMigrations() {
|
|||||||
delete stmt;
|
delete stmt;
|
||||||
if (doExit) continue;
|
if (doExit) continue;
|
||||||
|
|
||||||
Game::logger->Log("MigrationRunner", "Running migration: %s", migration.name.c_str());
|
LOG("Running migration: %s", migration.name.c_str());
|
||||||
if (migration.name == "dlu/5_brick_model_sd0.sql") {
|
if (migration.name == "dlu/5_brick_model_sd0.sql") {
|
||||||
runSd0Migrations = true;
|
runSd0Migrations = true;
|
||||||
} else {
|
} else {
|
||||||
@ -67,7 +67,7 @@ void MigrationRunner::RunMigrations() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (finalSQL.empty() && !runSd0Migrations) {
|
if (finalSQL.empty() && !runSd0Migrations) {
|
||||||
Game::logger->Log("MigrationRunner", "Server database is up to date.");
|
LOG("Server database is up to date.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ void MigrationRunner::RunMigrations() {
|
|||||||
if (query.empty()) continue;
|
if (query.empty()) continue;
|
||||||
simpleStatement->execute(query.c_str());
|
simpleStatement->execute(query.c_str());
|
||||||
} catch (sql::SQLException& e) {
|
} catch (sql::SQLException& e) {
|
||||||
Game::logger->Log("MigrationRunner", "Encountered error running migration: %s", e.what());
|
LOG("Encountered error running migration: %s", e.what());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -87,9 +87,9 @@ void MigrationRunner::RunMigrations() {
|
|||||||
// Do this last on the off chance none of the other migrations have been run yet.
|
// Do this last on the off chance none of the other migrations have been run yet.
|
||||||
if (runSd0Migrations) {
|
if (runSd0Migrations) {
|
||||||
uint32_t numberOfUpdatedModels = BrickByBrickFix::UpdateBrickByBrickModelsToSd0();
|
uint32_t numberOfUpdatedModels = BrickByBrickFix::UpdateBrickByBrickModelsToSd0();
|
||||||
Game::logger->Log("MasterServer", "%i models were updated from zlib to sd0.", numberOfUpdatedModels);
|
LOG("%i models were updated from zlib to sd0.", numberOfUpdatedModels);
|
||||||
uint32_t numberOfTruncatedModels = BrickByBrickFix::TruncateBrokenBrickByBrickXml();
|
uint32_t numberOfTruncatedModels = BrickByBrickFix::TruncateBrokenBrickByBrickXml();
|
||||||
Game::logger->Log("MasterServer", "%i models were truncated from the database.", numberOfTruncatedModels);
|
LOG("%i models were truncated from the database.", numberOfTruncatedModels);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,14 +135,14 @@ void MigrationRunner::RunSQLiteMigrations() {
|
|||||||
|
|
||||||
// Doing these 1 migration at a time since one takes a long time and some may think it is crashing.
|
// Doing these 1 migration at a time since one takes a long time and some may think it is crashing.
|
||||||
// This will at the least guarentee that the full migration needs to be run in order to be counted as "migrated".
|
// This will at the least guarentee that the full migration needs to be run in order to be counted as "migrated".
|
||||||
Game::logger->Log("MigrationRunner", "Executing migration: %s. This may take a while. Do not shut down server.", migration.name.c_str());
|
LOG("Executing migration: %s. This may take a while. Do not shut down server.", migration.name.c_str());
|
||||||
CDClientDatabase::ExecuteQuery("BEGIN TRANSACTION;");
|
CDClientDatabase::ExecuteQuery("BEGIN TRANSACTION;");
|
||||||
for (const auto& dml : GeneralUtils::SplitString(migration.data, ';')) {
|
for (const auto& dml : GeneralUtils::SplitString(migration.data, ';')) {
|
||||||
if (dml.empty()) continue;
|
if (dml.empty()) continue;
|
||||||
try {
|
try {
|
||||||
CDClientDatabase::ExecuteDML(dml.c_str());
|
CDClientDatabase::ExecuteDML(dml.c_str());
|
||||||
} catch (CppSQLite3Exception& e) {
|
} catch (CppSQLite3Exception& e) {
|
||||||
Game::logger->Log("MigrationRunner", "Encountered error running DML command: (%i) : %s", e.errorCode(), e.errorMessage());
|
LOG("Encountered error running DML command: (%i) : %s", e.errorCode(), e.errorMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,5 +154,5 @@ void MigrationRunner::RunSQLiteMigrations() {
|
|||||||
CDClientDatabase::ExecuteQuery("COMMIT;");
|
CDClientDatabase::ExecuteQuery("COMMIT;");
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::logger->Log("MigrationRunner", "CDServer database is up to date.");
|
LOG("CDServer database is up to date.");
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include "User.h"
|
#include "User.h"
|
||||||
#include "Database.h"
|
#include "Database.h"
|
||||||
#include "GeneralUtils.h"
|
#include "GeneralUtils.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "BitStream.h"
|
#include "BitStream.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
@ -145,16 +145,16 @@ void Character::DoQuickXMLDataParse() {
|
|||||||
if (!m_Doc) return;
|
if (!m_Doc) return;
|
||||||
|
|
||||||
if (m_Doc->Parse(m_XMLData.c_str(), m_XMLData.size()) == 0) {
|
if (m_Doc->Parse(m_XMLData.c_str(), m_XMLData.size()) == 0) {
|
||||||
Game::logger->Log("Character", "Loaded xmlData for character %s (%i)!", m_Name.c_str(), m_ID);
|
LOG("Loaded xmlData for character %s (%i)!", m_Name.c_str(), m_ID);
|
||||||
} else {
|
} else {
|
||||||
Game::logger->Log("Character", "Failed to load xmlData!");
|
LOG("Failed to load xmlData!");
|
||||||
//Server::rakServer->CloseConnection(m_ParentUser->GetSystemAddress(), true);
|
//Server::rakServer->CloseConnection(m_ParentUser->GetSystemAddress(), true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
tinyxml2::XMLElement* mf = m_Doc->FirstChildElement("obj")->FirstChildElement("mf");
|
tinyxml2::XMLElement* mf = m_Doc->FirstChildElement("obj")->FirstChildElement("mf");
|
||||||
if (!mf) {
|
if (!mf) {
|
||||||
Game::logger->Log("Character", "Failed to find mf tag!");
|
LOG("Failed to find mf tag!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,14 +173,14 @@ void Character::DoQuickXMLDataParse() {
|
|||||||
|
|
||||||
tinyxml2::XMLElement* inv = m_Doc->FirstChildElement("obj")->FirstChildElement("inv");
|
tinyxml2::XMLElement* inv = m_Doc->FirstChildElement("obj")->FirstChildElement("inv");
|
||||||
if (!inv) {
|
if (!inv) {
|
||||||
Game::logger->Log("Character", "Char has no inv!");
|
LOG("Char has no inv!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
tinyxml2::XMLElement* bag = inv->FirstChildElement("items")->FirstChildElement("in");
|
tinyxml2::XMLElement* bag = inv->FirstChildElement("items")->FirstChildElement("in");
|
||||||
|
|
||||||
if (!bag) {
|
if (!bag) {
|
||||||
Game::logger->Log("Character", "Couldn't find bag0!");
|
LOG("Couldn't find bag0!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -373,7 +373,7 @@ void Character::SaveXMLToDatabase() {
|
|||||||
|
|
||||||
//Call upon the entity to update our xmlDoc:
|
//Call upon the entity to update our xmlDoc:
|
||||||
if (!m_OurEntity) {
|
if (!m_OurEntity) {
|
||||||
Game::logger->Log("Character", "%i:%s didn't have an entity set while saving! CHARACTER WILL NOT BE SAVED!", this->GetID(), this->GetName().c_str());
|
LOG("%i:%s didn't have an entity set while saving! CHARACTER WILL NOT BE SAVED!", this->GetID(), this->GetName().c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -384,7 +384,7 @@ void Character::SaveXMLToDatabase() {
|
|||||||
//For metrics, log the time it took to save:
|
//For metrics, log the time it took to save:
|
||||||
auto end = std::chrono::system_clock::now();
|
auto end = std::chrono::system_clock::now();
|
||||||
std::chrono::duration<double> elapsed = end - start;
|
std::chrono::duration<double> elapsed = end - start;
|
||||||
Game::logger->Log("Character", "%i:%s Saved character to Database in: %fs", this->GetID(), this->GetName().c_str(), elapsed.count());
|
LOG("%i:%s Saved character to Database in: %fs", this->GetID(), this->GetName().c_str(), elapsed.count());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Character::SetIsNewLogin() {
|
void Character::SetIsNewLogin() {
|
||||||
@ -396,7 +396,7 @@ void Character::SetIsNewLogin() {
|
|||||||
while (currentChild) {
|
while (currentChild) {
|
||||||
if (currentChild->Attribute("si")) {
|
if (currentChild->Attribute("si")) {
|
||||||
flags->DeleteChild(currentChild);
|
flags->DeleteChild(currentChild);
|
||||||
Game::logger->Log("Character", "Removed isLoggedIn flag from character %i:%s, saving character to database", GetID(), GetName().c_str());
|
LOG("Removed isLoggedIn flag from character %i:%s, saving character to database", GetID(), GetName().c_str());
|
||||||
WriteToDatabase();
|
WriteToDatabase();
|
||||||
}
|
}
|
||||||
currentChild = currentChild->NextSiblingElement();
|
currentChild = currentChild->NextSiblingElement();
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include "Entity.h"
|
#include "Entity.h"
|
||||||
#include "CDClientManager.h"
|
#include "CDClientManager.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include <PacketUtils.h>
|
#include <PacketUtils.h>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include "CDDestructibleComponentTable.h"
|
#include "CDDestructibleComponentTable.h"
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#include "dZoneManager.h"
|
#include "dZoneManager.h"
|
||||||
#include "MissionComponent.h"
|
#include "MissionComponent.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "MessageIdentifiers.h"
|
#include "MessageIdentifiers.h"
|
||||||
#include "dConfig.h"
|
#include "dConfig.h"
|
||||||
#include "eTriggerEventType.h"
|
#include "eTriggerEventType.h"
|
||||||
@ -208,7 +208,7 @@ void EntityManager::KillEntities() {
|
|||||||
auto* entity = GetEntity(*entry);
|
auto* entity = GetEntity(*entry);
|
||||||
|
|
||||||
if (!entity) {
|
if (!entity) {
|
||||||
Game::logger->Log("EntityManager", "Attempting to kill null entity %llu", *entry);
|
LOG("Attempting to kill null entity %llu", *entry);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,7 +237,7 @@ void EntityManager::DeleteEntities() {
|
|||||||
|
|
||||||
if (ghostingToDelete != m_EntitiesToGhost.end()) m_EntitiesToGhost.erase(ghostingToDelete);
|
if (ghostingToDelete != m_EntitiesToGhost.end()) m_EntitiesToGhost.erase(ghostingToDelete);
|
||||||
} else {
|
} else {
|
||||||
Game::logger->Log("EntityManager", "Attempted to delete non-existent entity %llu", *entry);
|
LOG("Attempted to delete non-existent entity %llu", *entry);
|
||||||
}
|
}
|
||||||
m_Entities.erase(*entry);
|
m_Entities.erase(*entry);
|
||||||
}
|
}
|
||||||
@ -330,7 +330,7 @@ const std::unordered_map<std::string, LWOOBJID>& EntityManager::GetSpawnPointEnt
|
|||||||
|
|
||||||
void EntityManager::ConstructEntity(Entity* entity, const SystemAddress& sysAddr, const bool skipChecks) {
|
void EntityManager::ConstructEntity(Entity* entity, const SystemAddress& sysAddr, const bool skipChecks) {
|
||||||
if (!entity) {
|
if (!entity) {
|
||||||
Game::logger->Log("EntityManager", "Attempted to construct null entity");
|
LOG("Attempted to construct null entity");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include "Character.h"
|
#include "Character.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "GameMessages.h"
|
#include "GameMessages.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "dConfig.h"
|
#include "dConfig.h"
|
||||||
#include "CDClientManager.h"
|
#include "CDClientManager.h"
|
||||||
#include "GeneralUtils.h"
|
#include "GeneralUtils.h"
|
||||||
@ -236,7 +236,7 @@ void Leaderboard::SetupLeaderboard(bool weekly, uint32_t resultStart, uint32_t r
|
|||||||
baseLookup += std::to_string(static_cast<uint32_t>(this->relatedPlayer));
|
baseLookup += std::to_string(static_cast<uint32_t>(this->relatedPlayer));
|
||||||
}
|
}
|
||||||
baseLookup += " LIMIT 1";
|
baseLookup += " LIMIT 1";
|
||||||
Game::logger->LogDebug("LeaderboardManager", "query is %s", baseLookup.c_str());
|
LOG_DEBUG("query is %s", baseLookup.c_str());
|
||||||
std::unique_ptr<sql::PreparedStatement> baseQuery(Database::CreatePreppedStmt(baseLookup));
|
std::unique_ptr<sql::PreparedStatement> baseQuery(Database::CreatePreppedStmt(baseLookup));
|
||||||
baseQuery->setInt(1, this->gameID);
|
baseQuery->setInt(1, this->gameID);
|
||||||
std::unique_ptr<sql::ResultSet> baseResult(baseQuery->executeQuery());
|
std::unique_ptr<sql::ResultSet> baseResult(baseQuery->executeQuery());
|
||||||
@ -251,7 +251,7 @@ void Leaderboard::SetupLeaderboard(bool weekly, uint32_t resultStart, uint32_t r
|
|||||||
int32_t res = snprintf(lookupBuffer.get(), STRING_LENGTH, queryBase.c_str(), orderBase.data(), filter.c_str(), resultStart, resultEnd);
|
int32_t res = snprintf(lookupBuffer.get(), STRING_LENGTH, queryBase.c_str(), orderBase.data(), filter.c_str(), resultStart, resultEnd);
|
||||||
DluAssert(res != -1);
|
DluAssert(res != -1);
|
||||||
std::unique_ptr<sql::PreparedStatement> query(Database::CreatePreppedStmt(lookupBuffer.get()));
|
std::unique_ptr<sql::PreparedStatement> query(Database::CreatePreppedStmt(lookupBuffer.get()));
|
||||||
Game::logger->LogDebug("LeaderboardManager", "Query is %s vars are %i %i %i", lookupBuffer.get(), this->gameID, this->relatedPlayer, relatedPlayerLeaderboardId);
|
LOG_DEBUG("Query is %s vars are %i %i %i", lookupBuffer.get(), this->gameID, this->relatedPlayer, relatedPlayerLeaderboardId);
|
||||||
query->setInt(1, this->gameID);
|
query->setInt(1, this->gameID);
|
||||||
if (this->infoType == InfoType::Friends) {
|
if (this->infoType == InfoType::Friends) {
|
||||||
query->setInt(2, this->relatedPlayer);
|
query->setInt(2, this->relatedPlayer);
|
||||||
@ -358,7 +358,7 @@ void LeaderboardManager::SaveScore(const LWOOBJID& playerID, const GameID activi
|
|||||||
}
|
}
|
||||||
case Leaderboard::Type::None:
|
case Leaderboard::Type::None:
|
||||||
default:
|
default:
|
||||||
Game::logger->Log("LeaderboardManager", "Unknown leaderboard type %i for game %i. Cannot save score!", leaderboardType, activityId);
|
LOG("Unknown leaderboard type %i for game %i. Cannot save score!", leaderboardType, activityId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bool newHighScore = lowerScoreBetter ? newScore < oldScore : newScore > oldScore;
|
bool newHighScore = lowerScoreBetter ? newScore < oldScore : newScore > oldScore;
|
||||||
@ -377,7 +377,7 @@ void LeaderboardManager::SaveScore(const LWOOBJID& playerID, const GameID activi
|
|||||||
} else {
|
} else {
|
||||||
saveQuery = FormatInsert(leaderboardType, newScore, false);
|
saveQuery = FormatInsert(leaderboardType, newScore, false);
|
||||||
}
|
}
|
||||||
Game::logger->Log("LeaderboardManager", "save query %s %i %i", saveQuery.c_str(), playerID, activityId);
|
LOG("save query %s %i %i", saveQuery.c_str(), playerID, activityId);
|
||||||
std::unique_ptr<sql::PreparedStatement> saveStatement(Database::CreatePreppedStmt(saveQuery));
|
std::unique_ptr<sql::PreparedStatement> saveStatement(Database::CreatePreppedStmt(saveQuery));
|
||||||
saveStatement->setInt(1, playerID);
|
saveStatement->setInt(1, playerID);
|
||||||
saveStatement->setInt(2, activityId);
|
saveStatement->setInt(2, activityId);
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include "MissionComponent.h"
|
#include "MissionComponent.h"
|
||||||
#include "UserManager.h"
|
#include "UserManager.h"
|
||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "ZoneInstanceManager.h"
|
#include "ZoneInstanceManager.h"
|
||||||
#include "WorldPackets.h"
|
#include "WorldPackets.h"
|
||||||
#include "dZoneManager.h"
|
#include "dZoneManager.h"
|
||||||
@ -260,7 +260,7 @@ void Player::SetDroppedCoins(uint64_t value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Player::~Player() {
|
Player::~Player() {
|
||||||
Game::logger->Log("Player", "Deleted player");
|
LOG("Deleted player");
|
||||||
|
|
||||||
for (int32_t i = 0; i < m_ObservedEntitiesUsed; i++) {
|
for (int32_t i = 0; i < m_ObservedEntitiesUsed; i++) {
|
||||||
const auto id = m_ObservedEntities[i];
|
const auto id = m_ObservedEntities[i];
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include "InventoryComponent.h"
|
#include "InventoryComponent.h"
|
||||||
#include "../dWorldServer/ObjectIDManager.h"
|
#include "../dWorldServer/ObjectIDManager.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "Item.h"
|
#include "Item.h"
|
||||||
#include "Character.h"
|
#include "Character.h"
|
||||||
#include "CharacterComponent.h"
|
#include "CharacterComponent.h"
|
||||||
@ -67,7 +67,7 @@ void Trade::SetAccepted(LWOOBJID participant, bool value) {
|
|||||||
if (participant == m_ParticipantA) {
|
if (participant == m_ParticipantA) {
|
||||||
m_AcceptedA = !value;
|
m_AcceptedA = !value;
|
||||||
|
|
||||||
Game::logger->Log("Trade", "Accepted from A (%d), B: (%d)", value, m_AcceptedB);
|
LOG("Accepted from A (%d), B: (%d)", value, m_AcceptedB);
|
||||||
|
|
||||||
auto* entityB = GetParticipantBEntity();
|
auto* entityB = GetParticipantBEntity();
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ void Trade::SetAccepted(LWOOBJID participant, bool value) {
|
|||||||
} else if (participant == m_ParticipantB) {
|
} else if (participant == m_ParticipantB) {
|
||||||
m_AcceptedB = !value;
|
m_AcceptedB = !value;
|
||||||
|
|
||||||
Game::logger->Log("Trade", "Accepted from B (%d), A: (%d)", value, m_AcceptedA);
|
LOG("Accepted from B (%d), A: (%d)", value, m_AcceptedA);
|
||||||
|
|
||||||
auto* entityA = GetParticipantAEntity();
|
auto* entityA = GetParticipantAEntity();
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ void Trade::Complete() {
|
|||||||
|
|
||||||
// First verify both players have the coins and items requested for the trade.
|
// First verify both players have the coins and items requested for the trade.
|
||||||
if (characterA->GetCoins() < m_CoinsA || characterB->GetCoins() < m_CoinsB) {
|
if (characterA->GetCoins() < m_CoinsA || characterB->GetCoins() < m_CoinsB) {
|
||||||
Game::logger->Log("TradingManager", "Possible coin trade cheating attempt! Aborting trade.");
|
LOG("Possible coin trade cheating attempt! Aborting trade.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,11 +133,11 @@ void Trade::Complete() {
|
|||||||
auto* itemToRemove = inventoryA->FindItemById(tradeItem.itemId);
|
auto* itemToRemove = inventoryA->FindItemById(tradeItem.itemId);
|
||||||
if (itemToRemove) {
|
if (itemToRemove) {
|
||||||
if (itemToRemove->GetCount() < tradeItem.itemCount) {
|
if (itemToRemove->GetCount() < tradeItem.itemCount) {
|
||||||
Game::logger->Log("TradingManager", "Possible cheating attempt from %s in trading!!! Aborting trade", characterA->GetName().c_str());
|
LOG("Possible cheating attempt from %s in trading!!! Aborting trade", characterA->GetName().c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Game::logger->Log("TradingManager", "Possible cheating attempt from %s in trading due to item not being available!!!", characterA->GetName().c_str());
|
LOG("Possible cheating attempt from %s in trading due to item not being available!!!", characterA->GetName().c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -146,11 +146,11 @@ void Trade::Complete() {
|
|||||||
auto* itemToRemove = inventoryB->FindItemById(tradeItem.itemId);
|
auto* itemToRemove = inventoryB->FindItemById(tradeItem.itemId);
|
||||||
if (itemToRemove) {
|
if (itemToRemove) {
|
||||||
if (itemToRemove->GetCount() < tradeItem.itemCount) {
|
if (itemToRemove->GetCount() < tradeItem.itemCount) {
|
||||||
Game::logger->Log("TradingManager", "Possible cheating attempt from %s in trading!!! Aborting trade", characterB->GetName().c_str());
|
LOG("Possible cheating attempt from %s in trading!!! Aborting trade", characterB->GetName().c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Game::logger->Log("TradingManager", "Possible cheating attempt from %s in trading due to item not being available!!! Aborting trade", characterB->GetName().c_str());
|
LOG("Possible cheating attempt from %s in trading due to item not being available!!! Aborting trade", characterB->GetName().c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -194,7 +194,7 @@ void Trade::SendUpdateToOther(LWOOBJID participant) {
|
|||||||
uint64_t coins;
|
uint64_t coins;
|
||||||
std::vector<TradeItem> itemIds;
|
std::vector<TradeItem> itemIds;
|
||||||
|
|
||||||
Game::logger->Log("Trade", "Attempting to send trade update");
|
LOG("Attempting to send trade update");
|
||||||
|
|
||||||
if (participant == m_ParticipantA) {
|
if (participant == m_ParticipantA) {
|
||||||
other = GetParticipantBEntity();
|
other = GetParticipantBEntity();
|
||||||
@ -228,7 +228,7 @@ void Trade::SendUpdateToOther(LWOOBJID participant) {
|
|||||||
items.push_back(tradeItem);
|
items.push_back(tradeItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::logger->Log("Trade", "Sending trade update");
|
LOG("Sending trade update");
|
||||||
|
|
||||||
GameMessages::SendServerTradeUpdate(other->GetObjectID(), coins, items, other->GetSystemAddress());
|
GameMessages::SendServerTradeUpdate(other->GetObjectID(), coins, items, other->GetSystemAddress());
|
||||||
}
|
}
|
||||||
@ -279,7 +279,7 @@ Trade* TradingManager::NewTrade(LWOOBJID participantA, LWOOBJID participantB) {
|
|||||||
|
|
||||||
trades[tradeId] = trade;
|
trades[tradeId] = trade;
|
||||||
|
|
||||||
Game::logger->Log("TradingManager", "Created new trade between (%llu) <-> (%llu)", participantA, participantB);
|
LOG("Created new trade between (%llu) <-> (%llu)", participantA, participantB);
|
||||||
|
|
||||||
return trade;
|
return trade;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include "Database.h"
|
#include "Database.h"
|
||||||
#include "Character.h"
|
#include "Character.h"
|
||||||
#include "dServer.h"
|
#include "dServer.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dZoneManager.h"
|
#include "dZoneManager.h"
|
||||||
#include "eServerDisconnectIdentifiers.h"
|
#include "eServerDisconnectIdentifiers.h"
|
||||||
@ -52,7 +52,7 @@ User::User(const SystemAddress& sysAddr, const std::string& username, const std:
|
|||||||
LWOOBJID objID = res->getUInt64(1);
|
LWOOBJID objID = res->getUInt64(1);
|
||||||
Character* character = new Character(uint32_t(objID), this);
|
Character* character = new Character(uint32_t(objID), this);
|
||||||
m_Characters.push_back(character);
|
m_Characters.push_back(character);
|
||||||
Game::logger->Log("User", "Loaded %llu as it is the last used char", objID);
|
LOG("Loaded %llu as it is the last used char", objID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,7 +127,7 @@ void User::UserOutOfSync() {
|
|||||||
m_AmountOfTimesOutOfSync++;
|
m_AmountOfTimesOutOfSync++;
|
||||||
if (m_AmountOfTimesOutOfSync > m_MaxDesyncAllowed) {
|
if (m_AmountOfTimesOutOfSync > m_MaxDesyncAllowed) {
|
||||||
//YEET
|
//YEET
|
||||||
Game::logger->Log("User", "User %s was out of sync %i times out of %i, disconnecting for suspected speedhacking.", m_Username.c_str(), m_AmountOfTimesOutOfSync, m_MaxDesyncAllowed);
|
LOG("User %s was out of sync %i times out of %i, disconnecting for suspected speedhacking.", m_Username.c_str(), m_AmountOfTimesOutOfSync, m_MaxDesyncAllowed);
|
||||||
Game::server->Disconnect(this->m_SystemAddress, eServerDisconnectIdentifiers::PLAY_SCHEDULE_TIME_DONE);
|
Game::server->Disconnect(this->m_SystemAddress, eServerDisconnectIdentifiers::PLAY_SCHEDULE_TIME_DONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,14 +6,14 @@
|
|||||||
|
|
||||||
#include "Database.h"
|
#include "Database.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "User.h"
|
#include "User.h"
|
||||||
#include <WorldPackets.h>
|
#include <WorldPackets.h>
|
||||||
#include "Character.h"
|
#include "Character.h"
|
||||||
#include <BitStream.h>
|
#include <BitStream.h>
|
||||||
#include "PacketUtils.h"
|
#include "PacketUtils.h"
|
||||||
#include "../dWorldServer/ObjectIDManager.h"
|
#include "../dWorldServer/ObjectIDManager.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "GeneralUtils.h"
|
#include "GeneralUtils.h"
|
||||||
#include "ZoneInstanceManager.h"
|
#include "ZoneInstanceManager.h"
|
||||||
#include "dServer.h"
|
#include "dServer.h"
|
||||||
@ -46,7 +46,7 @@ void UserManager::Initialize() {
|
|||||||
|
|
||||||
AssetMemoryBuffer fnBuff = Game::assetManager->GetFileAsBuffer("names/minifigname_first.txt");
|
AssetMemoryBuffer fnBuff = Game::assetManager->GetFileAsBuffer("names/minifigname_first.txt");
|
||||||
if (!fnBuff.m_Success) {
|
if (!fnBuff.m_Success) {
|
||||||
Game::logger->Log("UserManager", "Failed to load %s", (Game::assetManager->GetResPath() / "names/minifigname_first.txt").string().c_str());
|
LOG("Failed to load %s", (Game::assetManager->GetResPath() / "names/minifigname_first.txt").string().c_str());
|
||||||
throw std::runtime_error("Aborting initialization due to missing minifigure name file.");
|
throw std::runtime_error("Aborting initialization due to missing minifigure name file.");
|
||||||
}
|
}
|
||||||
std::istream fnStream = std::istream(&fnBuff);
|
std::istream fnStream = std::istream(&fnBuff);
|
||||||
@ -59,7 +59,7 @@ void UserManager::Initialize() {
|
|||||||
|
|
||||||
AssetMemoryBuffer mnBuff = Game::assetManager->GetFileAsBuffer("names/minifigname_middle.txt");
|
AssetMemoryBuffer mnBuff = Game::assetManager->GetFileAsBuffer("names/minifigname_middle.txt");
|
||||||
if (!mnBuff.m_Success) {
|
if (!mnBuff.m_Success) {
|
||||||
Game::logger->Log("UserManager", "Failed to load %s", (Game::assetManager->GetResPath() / "names/minifigname_middle.txt").string().c_str());
|
LOG("Failed to load %s", (Game::assetManager->GetResPath() / "names/minifigname_middle.txt").string().c_str());
|
||||||
throw std::runtime_error("Aborting initialization due to missing minifigure name file.");
|
throw std::runtime_error("Aborting initialization due to missing minifigure name file.");
|
||||||
}
|
}
|
||||||
std::istream mnStream = std::istream(&mnBuff);
|
std::istream mnStream = std::istream(&mnBuff);
|
||||||
@ -72,7 +72,7 @@ void UserManager::Initialize() {
|
|||||||
|
|
||||||
AssetMemoryBuffer lnBuff = Game::assetManager->GetFileAsBuffer("names/minifigname_last.txt");
|
AssetMemoryBuffer lnBuff = Game::assetManager->GetFileAsBuffer("names/minifigname_last.txt");
|
||||||
if (!lnBuff.m_Success) {
|
if (!lnBuff.m_Success) {
|
||||||
Game::logger->Log("UserManager", "Failed to load %s", (Game::assetManager->GetResPath() / "names/minifigname_last.txt").string().c_str());
|
LOG("Failed to load %s", (Game::assetManager->GetResPath() / "names/minifigname_last.txt").string().c_str());
|
||||||
throw std::runtime_error("Aborting initialization due to missing minifigure name file.");
|
throw std::runtime_error("Aborting initialization due to missing minifigure name file.");
|
||||||
}
|
}
|
||||||
std::istream lnStream = std::istream(&lnBuff);
|
std::istream lnStream = std::istream(&lnBuff);
|
||||||
@ -86,7 +86,7 @@ void UserManager::Initialize() {
|
|||||||
//Load our pre-approved names:
|
//Load our pre-approved names:
|
||||||
AssetMemoryBuffer chatListBuff = Game::assetManager->GetFileAsBuffer("chatplus_en_us.txt");
|
AssetMemoryBuffer chatListBuff = Game::assetManager->GetFileAsBuffer("chatplus_en_us.txt");
|
||||||
if (!chatListBuff.m_Success) {
|
if (!chatListBuff.m_Success) {
|
||||||
Game::logger->Log("UserManager", "Failed to load %s", (Game::assetManager->GetResPath() / "chatplus_en_us.txt").string().c_str());
|
LOG("Failed to load %s", (Game::assetManager->GetResPath() / "chatplus_en_us.txt").string().c_str());
|
||||||
throw std::runtime_error("Aborting initialization due to missing chat whitelist file.");
|
throw std::runtime_error("Aborting initialization due to missing chat whitelist file.");
|
||||||
}
|
}
|
||||||
std::istream chatListStream = std::istream(&chatListBuff);
|
std::istream chatListStream = std::istream(&chatListBuff);
|
||||||
@ -150,7 +150,7 @@ bool UserManager::DeleteUser(const SystemAddress& sysAddr) {
|
|||||||
|
|
||||||
void UserManager::DeletePendingRemovals() {
|
void UserManager::DeletePendingRemovals() {
|
||||||
for (auto* user : m_UsersToDelete) {
|
for (auto* user : m_UsersToDelete) {
|
||||||
Game::logger->Log("UserManager", "Deleted user %i", user->GetAccountID());
|
LOG("Deleted user %i", user->GetAccountID());
|
||||||
|
|
||||||
delete user;
|
delete user;
|
||||||
}
|
}
|
||||||
@ -271,21 +271,21 @@ void UserManager::CreateCharacter(const SystemAddress& sysAddr, Packet* packet)
|
|||||||
LOT pantsLOT = FindCharPantsID(pantsColor);
|
LOT pantsLOT = FindCharPantsID(pantsColor);
|
||||||
|
|
||||||
if (name != "" && !UserManager::IsNameAvailable(name)) {
|
if (name != "" && !UserManager::IsNameAvailable(name)) {
|
||||||
Game::logger->Log("UserManager", "AccountID: %i chose unavailable name: %s", u->GetAccountID(), name.c_str());
|
LOG("AccountID: %i chose unavailable name: %s", u->GetAccountID(), name.c_str());
|
||||||
WorldPackets::SendCharacterCreationResponse(sysAddr, eCharacterCreationResponse::CUSTOM_NAME_IN_USE);
|
WorldPackets::SendCharacterCreationResponse(sysAddr, eCharacterCreationResponse::CUSTOM_NAME_IN_USE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IsNameAvailable(predefinedName)) {
|
if (!IsNameAvailable(predefinedName)) {
|
||||||
Game::logger->Log("UserManager", "AccountID: %i chose unavailable predefined name: %s", u->GetAccountID(), predefinedName.c_str());
|
LOG("AccountID: %i chose unavailable predefined name: %s", u->GetAccountID(), predefinedName.c_str());
|
||||||
WorldPackets::SendCharacterCreationResponse(sysAddr, eCharacterCreationResponse::PREDEFINED_NAME_IN_USE);
|
WorldPackets::SendCharacterCreationResponse(sysAddr, eCharacterCreationResponse::PREDEFINED_NAME_IN_USE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name == "") {
|
if (name == "") {
|
||||||
Game::logger->Log("UserManager", "AccountID: %i is creating a character with predefined name: %s", u->GetAccountID(), predefinedName.c_str());
|
LOG("AccountID: %i is creating a character with predefined name: %s", u->GetAccountID(), predefinedName.c_str());
|
||||||
} else {
|
} else {
|
||||||
Game::logger->Log("UserManager", "AccountID: %i is creating a character with name: %s (temporary: %s)", u->GetAccountID(), name.c_str(), predefinedName.c_str());
|
LOG("AccountID: %i is creating a character with name: %s (temporary: %s)", u->GetAccountID(), name.c_str(), predefinedName.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
//Now that the name is ok, we can get an objectID from Master:
|
//Now that the name is ok, we can get an objectID from Master:
|
||||||
@ -296,7 +296,7 @@ void UserManager::CreateCharacter(const SystemAddress& sysAddr, Packet* packet)
|
|||||||
auto* overlapResult = overlapStmt->executeQuery();
|
auto* overlapResult = overlapStmt->executeQuery();
|
||||||
|
|
||||||
if (overlapResult->next()) {
|
if (overlapResult->next()) {
|
||||||
Game::logger->Log("UserManager", "Character object id unavailable, check objectidtracker!");
|
LOG("Character object id unavailable, check objectidtracker!");
|
||||||
WorldPackets::SendCharacterCreationResponse(sysAddr, eCharacterCreationResponse::OBJECT_ID_UNAVAILABLE);
|
WorldPackets::SendCharacterCreationResponse(sysAddr, eCharacterCreationResponse::OBJECT_ID_UNAVAILABLE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -383,14 +383,14 @@ void UserManager::CreateCharacter(const SystemAddress& sysAddr, Packet* packet)
|
|||||||
void UserManager::DeleteCharacter(const SystemAddress& sysAddr, Packet* packet) {
|
void UserManager::DeleteCharacter(const SystemAddress& sysAddr, Packet* packet) {
|
||||||
User* u = GetUser(sysAddr);
|
User* u = GetUser(sysAddr);
|
||||||
if (!u) {
|
if (!u) {
|
||||||
Game::logger->Log("UserManager", "Couldn't get user to delete character");
|
LOG("Couldn't get user to delete character");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LWOOBJID objectID = PacketUtils::ReadS64(8, packet);
|
LWOOBJID objectID = PacketUtils::ReadS64(8, packet);
|
||||||
uint32_t charID = static_cast<uint32_t>(objectID);
|
uint32_t charID = static_cast<uint32_t>(objectID);
|
||||||
|
|
||||||
Game::logger->Log("UserManager", "Received char delete req for ID: %llu (%u)", objectID, charID);
|
LOG("Received char delete req for ID: %llu (%u)", objectID, charID);
|
||||||
|
|
||||||
bool hasCharacter = CheatDetection::VerifyLwoobjidIsSender(
|
bool hasCharacter = CheatDetection::VerifyLwoobjidIsSender(
|
||||||
objectID,
|
objectID,
|
||||||
@ -402,7 +402,7 @@ void UserManager::DeleteCharacter(const SystemAddress& sysAddr, Packet* packet)
|
|||||||
if (!hasCharacter) {
|
if (!hasCharacter) {
|
||||||
WorldPackets::SendCharacterDeleteResponse(sysAddr, false);
|
WorldPackets::SendCharacterDeleteResponse(sysAddr, false);
|
||||||
} else {
|
} else {
|
||||||
Game::logger->Log("UserManager", "Deleting character %i", charID);
|
LOG("Deleting character %i", charID);
|
||||||
{
|
{
|
||||||
sql::PreparedStatement* stmt = Database::CreatePreppedStmt("DELETE FROM charxml WHERE id=? LIMIT 1;");
|
sql::PreparedStatement* stmt = Database::CreatePreppedStmt("DELETE FROM charxml WHERE id=? LIMIT 1;");
|
||||||
stmt->setUInt64(1, charID);
|
stmt->setUInt64(1, charID);
|
||||||
@ -478,7 +478,7 @@ void UserManager::DeleteCharacter(const SystemAddress& sysAddr, Packet* packet)
|
|||||||
void UserManager::RenameCharacter(const SystemAddress& sysAddr, Packet* packet) {
|
void UserManager::RenameCharacter(const SystemAddress& sysAddr, Packet* packet) {
|
||||||
User* u = GetUser(sysAddr);
|
User* u = GetUser(sysAddr);
|
||||||
if (!u) {
|
if (!u) {
|
||||||
Game::logger->Log("UserManager", "Couldn't get user to delete character");
|
LOG("Couldn't get user to delete character");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -487,7 +487,7 @@ void UserManager::RenameCharacter(const SystemAddress& sysAddr, Packet* packet)
|
|||||||
GeneralUtils::ClearBit(objectID, eObjectBits::PERSISTENT);
|
GeneralUtils::ClearBit(objectID, eObjectBits::PERSISTENT);
|
||||||
|
|
||||||
uint32_t charID = static_cast<uint32_t>(objectID);
|
uint32_t charID = static_cast<uint32_t>(objectID);
|
||||||
Game::logger->Log("UserManager", "Received char rename request for ID: %llu (%u)", objectID, charID);
|
LOG("Received char rename request for ID: %llu (%u)", objectID, charID);
|
||||||
|
|
||||||
std::string newName = PacketUtils::ReadString(16, packet, true);
|
std::string newName = PacketUtils::ReadString(16, packet, true);
|
||||||
|
|
||||||
@ -526,7 +526,7 @@ void UserManager::RenameCharacter(const SystemAddress& sysAddr, Packet* packet)
|
|||||||
stmt->execute();
|
stmt->execute();
|
||||||
delete stmt;
|
delete stmt;
|
||||||
|
|
||||||
Game::logger->Log("UserManager", "Character %s now known as %s", character->GetName().c_str(), newName.c_str());
|
LOG("Character %s now known as %s", character->GetName().c_str(), newName.c_str());
|
||||||
WorldPackets::SendCharacterRenameResponse(sysAddr, eRenameResponse::SUCCESS);
|
WorldPackets::SendCharacterRenameResponse(sysAddr, eRenameResponse::SUCCESS);
|
||||||
UserManager::RequestCharacterList(sysAddr);
|
UserManager::RequestCharacterList(sysAddr);
|
||||||
} else {
|
} else {
|
||||||
@ -537,7 +537,7 @@ void UserManager::RenameCharacter(const SystemAddress& sysAddr, Packet* packet)
|
|||||||
stmt->execute();
|
stmt->execute();
|
||||||
delete stmt;
|
delete stmt;
|
||||||
|
|
||||||
Game::logger->Log("UserManager", "Character %s has been renamed to %s and is pending approval by a moderator.", character->GetName().c_str(), newName.c_str());
|
LOG("Character %s has been renamed to %s and is pending approval by a moderator.", character->GetName().c_str(), newName.c_str());
|
||||||
WorldPackets::SendCharacterRenameResponse(sysAddr, eRenameResponse::SUCCESS);
|
WorldPackets::SendCharacterRenameResponse(sysAddr, eRenameResponse::SUCCESS);
|
||||||
UserManager::RequestCharacterList(sysAddr);
|
UserManager::RequestCharacterList(sysAddr);
|
||||||
}
|
}
|
||||||
@ -545,7 +545,7 @@ void UserManager::RenameCharacter(const SystemAddress& sysAddr, Packet* packet)
|
|||||||
WorldPackets::SendCharacterRenameResponse(sysAddr, eRenameResponse::NAME_IN_USE);
|
WorldPackets::SendCharacterRenameResponse(sysAddr, eRenameResponse::NAME_IN_USE);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Game::logger->Log("UserManager", "Unknown error occurred when renaming character, either hasCharacter or character variable != true.");
|
LOG("Unknown error occurred when renaming character, either hasCharacter or character variable != true.");
|
||||||
WorldPackets::SendCharacterRenameResponse(sysAddr, eRenameResponse::UNKNOWN_ERROR);
|
WorldPackets::SendCharacterRenameResponse(sysAddr, eRenameResponse::UNKNOWN_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -553,7 +553,7 @@ void UserManager::RenameCharacter(const SystemAddress& sysAddr, Packet* packet)
|
|||||||
void UserManager::LoginCharacter(const SystemAddress& sysAddr, uint32_t playerID) {
|
void UserManager::LoginCharacter(const SystemAddress& sysAddr, uint32_t playerID) {
|
||||||
User* u = GetUser(sysAddr);
|
User* u = GetUser(sysAddr);
|
||||||
if (!u) {
|
if (!u) {
|
||||||
Game::logger->Log("UserManager", "Couldn't get user to log in character");
|
LOG("Couldn't get user to log in character");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -576,7 +576,7 @@ void UserManager::LoginCharacter(const SystemAddress& sysAddr, uint32_t playerID
|
|||||||
if (zoneID == LWOZONEID_INVALID) zoneID = 1000; //Send char to VE
|
if (zoneID == LWOZONEID_INVALID) zoneID = 1000; //Send char to VE
|
||||||
|
|
||||||
ZoneInstanceManager::Instance()->RequestZoneTransfer(Game::server, zoneID, character->GetZoneClone(), false, [=](bool mythranShift, uint32_t zoneID, uint32_t zoneInstance, uint32_t zoneClone, std::string serverIP, uint16_t serverPort) {
|
ZoneInstanceManager::Instance()->RequestZoneTransfer(Game::server, zoneID, character->GetZoneClone(), false, [=](bool mythranShift, uint32_t zoneID, uint32_t zoneInstance, uint32_t zoneClone, std::string serverIP, uint16_t serverPort) {
|
||||||
Game::logger->Log("UserManager", "Transferring %s to Zone %i (Instance %i | Clone %i | Mythran Shift: %s) with IP %s and Port %i", character->GetName().c_str(), zoneID, zoneInstance, zoneClone, mythranShift == true ? "true" : "false", serverIP.c_str(), serverPort);
|
LOG("Transferring %s to Zone %i (Instance %i | Clone %i | Mythran Shift: %s) with IP %s and Port %i", character->GetName().c_str(), zoneID, zoneInstance, zoneClone, mythranShift == true ? "true" : "false", serverIP.c_str(), serverPort);
|
||||||
if (character) {
|
if (character) {
|
||||||
character->SetZoneID(zoneID);
|
character->SetZoneID(zoneID);
|
||||||
character->SetZoneInstance(zoneInstance);
|
character->SetZoneInstance(zoneInstance);
|
||||||
@ -586,7 +586,7 @@ void UserManager::LoginCharacter(const SystemAddress& sysAddr, uint32_t playerID
|
|||||||
return;
|
return;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Game::logger->Log("UserManager", "Unknown error occurred when logging in a character, either hasCharacter or character variable != true.");
|
LOG("Unknown error occurred when logging in a character, either hasCharacter or character variable != true.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -601,7 +601,7 @@ uint32_t FindCharShirtID(uint32_t shirtColor, uint32_t shirtStyle) {
|
|||||||
tableData.finalize();
|
tableData.finalize();
|
||||||
return shirtLOT;
|
return shirtLOT;
|
||||||
} catch (const std::exception&) {
|
} catch (const std::exception&) {
|
||||||
Game::logger->Log("Character Create", "Failed to execute query! Using backup...");
|
LOG("Failed to execute query! Using backup...");
|
||||||
// in case of no shirt found in CDServer, return problematic red vest.
|
// in case of no shirt found in CDServer, return problematic red vest.
|
||||||
return 4069;
|
return 4069;
|
||||||
}
|
}
|
||||||
@ -616,7 +616,7 @@ uint32_t FindCharPantsID(uint32_t pantsColor) {
|
|||||||
tableData.finalize();
|
tableData.finalize();
|
||||||
return pantsLOT;
|
return pantsLOT;
|
||||||
} catch (const std::exception&) {
|
} catch (const std::exception&) {
|
||||||
Game::logger->Log("Character Create", "Failed to execute query! Using backup...");
|
LOG("Failed to execute query! Using backup...");
|
||||||
// in case of no pants color found in CDServer, return red pants.
|
// in case of no pants color found in CDServer, return red pants.
|
||||||
return 2508;
|
return 2508;
|
||||||
}
|
}
|
||||||
|
@ -3,13 +3,13 @@
|
|||||||
#include "BehaviorContext.h"
|
#include "BehaviorContext.h"
|
||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
|
|
||||||
void AirMovementBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
void AirMovementBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||||
uint32_t handle{};
|
uint32_t handle{};
|
||||||
|
|
||||||
if (!bitStream->Read(handle)) {
|
if (!bitStream->Read(handle)) {
|
||||||
Game::logger->Log("AirMovementBehavior", "Unable to read handle from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
LOG("Unable to read handle from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,14 +26,14 @@ void AirMovementBehavior::Sync(BehaviorContext* context, RakNet::BitStream* bitS
|
|||||||
uint32_t behaviorId{};
|
uint32_t behaviorId{};
|
||||||
|
|
||||||
if (!bitStream->Read(behaviorId)) {
|
if (!bitStream->Read(behaviorId)) {
|
||||||
Game::logger->Log("AirMovementBehavior", "Unable to read behaviorId from bitStream, aborting Sync! %i", bitStream->GetNumberOfUnreadBits());
|
LOG("Unable to read behaviorId from bitStream, aborting Sync! %i", bitStream->GetNumberOfUnreadBits());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LWOOBJID target{};
|
LWOOBJID target{};
|
||||||
|
|
||||||
if (!bitStream->Read(target)) {
|
if (!bitStream->Read(target)) {
|
||||||
Game::logger->Log("AirMovementBehavior", "Unable to read target from bitStream, aborting Sync! %i", bitStream->GetNumberOfUnreadBits());
|
LOG("Unable to read target from bitStream, aborting Sync! %i", bitStream->GetNumberOfUnreadBits());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "AndBehavior.h"
|
#include "AndBehavior.h"
|
||||||
#include "BehaviorBranchContext.h"
|
#include "BehaviorBranchContext.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
|
|
||||||
void AndBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) {
|
void AndBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) {
|
||||||
for (auto* behavior : this->m_behaviors) {
|
for (auto* behavior : this->m_behaviors) {
|
||||||
|
@ -4,19 +4,19 @@
|
|||||||
|
|
||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "BehaviorBranchContext.h"
|
#include "BehaviorBranchContext.h"
|
||||||
#include "BehaviorContext.h"
|
#include "BehaviorContext.h"
|
||||||
#include "RebuildComponent.h"
|
#include "RebuildComponent.h"
|
||||||
#include "DestroyableComponent.h"
|
#include "DestroyableComponent.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
|
|
||||||
void AreaOfEffectBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
void AreaOfEffectBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||||
uint32_t targetCount{};
|
uint32_t targetCount{};
|
||||||
|
|
||||||
if (!bitStream->Read(targetCount)) {
|
if (!bitStream->Read(targetCount)) {
|
||||||
Game::logger->Log("AreaOfEffectBehavior", "Unable to read targetCount from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
LOG("Unable to read targetCount from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ void AreaOfEffectBehavior::Handle(BehaviorContext* context, RakNet::BitStream* b
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (targetCount > this->m_maxTargets) {
|
if (targetCount > this->m_maxTargets) {
|
||||||
Game::logger->Log("AreaOfEffectBehavior", "Serialized size is greater than max targets! Size: %i, Max: %i", targetCount, this->m_maxTargets);
|
LOG("Serialized size is greater than max targets! Size: %i, Max: %i", targetCount, this->m_maxTargets);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ void AreaOfEffectBehavior::Handle(BehaviorContext* context, RakNet::BitStream* b
|
|||||||
for (auto i = 0u; i < targetCount; ++i) {
|
for (auto i = 0u; i < targetCount; ++i) {
|
||||||
LWOOBJID target{};
|
LWOOBJID target{};
|
||||||
if (!bitStream->Read(target)) {
|
if (!bitStream->Read(target)) {
|
||||||
Game::logger->Log("AreaOfEffectBehavior", "failed to read in target %i from bitStream, aborting target Handle!", i);
|
LOG("failed to read in target %i from bitStream, aborting target Handle!", i);
|
||||||
};
|
};
|
||||||
targets.push_back(target);
|
targets.push_back(target);
|
||||||
}
|
}
|
||||||
|
@ -2,13 +2,13 @@
|
|||||||
#include "BehaviorBranchContext.h"
|
#include "BehaviorBranchContext.h"
|
||||||
#include "BehaviorContext.h"
|
#include "BehaviorContext.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
|
|
||||||
void AttackDelayBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) {
|
void AttackDelayBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) {
|
||||||
uint32_t handle{};
|
uint32_t handle{};
|
||||||
|
|
||||||
if (!bitStream->Read(handle)) {
|
if (!bitStream->Read(handle)) {
|
||||||
Game::logger->Log("AttackDelayBehavior", "Unable to read handle from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
LOG("Unable to read handle from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "BasicAttackBehavior.h"
|
#include "BasicAttackBehavior.h"
|
||||||
#include "BehaviorBranchContext.h"
|
#include "BehaviorBranchContext.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "DestroyableComponent.h"
|
#include "DestroyableComponent.h"
|
||||||
#include "BehaviorContext.h"
|
#include "BehaviorContext.h"
|
||||||
@ -26,10 +26,10 @@ void BasicAttackBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bi
|
|||||||
|
|
||||||
uint16_t allocatedBits{};
|
uint16_t allocatedBits{};
|
||||||
if (!bitStream->Read(allocatedBits) || allocatedBits == 0) {
|
if (!bitStream->Read(allocatedBits) || allocatedBits == 0) {
|
||||||
Game::logger->LogDebug("BasicAttackBehavior", "No allocated bits");
|
LOG_DEBUG("No allocated bits");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Game::logger->LogDebug("BasicAttackBehavior", "Number of allocated bits %i", allocatedBits);
|
LOG_DEBUG("Number of allocated bits %i", allocatedBits);
|
||||||
const auto baseAddress = bitStream->GetReadOffset();
|
const auto baseAddress = bitStream->GetReadOffset();
|
||||||
|
|
||||||
DoHandleBehavior(context, bitStream, branch);
|
DoHandleBehavior(context, bitStream, branch);
|
||||||
@ -40,13 +40,13 @@ void BasicAttackBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bi
|
|||||||
void BasicAttackBehavior::DoHandleBehavior(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
void BasicAttackBehavior::DoHandleBehavior(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||||
auto* targetEntity = Game::entityManager->GetEntity(branch.target);
|
auto* targetEntity = Game::entityManager->GetEntity(branch.target);
|
||||||
if (!targetEntity) {
|
if (!targetEntity) {
|
||||||
Game::logger->Log("BasicAttackBehavior", "Target targetEntity %llu not found.", branch.target);
|
LOG("Target targetEntity %llu not found.", branch.target);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto* destroyableComponent = targetEntity->GetComponent<DestroyableComponent>();
|
auto* destroyableComponent = targetEntity->GetComponent<DestroyableComponent>();
|
||||||
if (!destroyableComponent) {
|
if (!destroyableComponent) {
|
||||||
Game::logger->Log("BasicAttackBehavior", "No destroyable found on the obj/lot %llu/%i", branch.target, targetEntity->GetLOT());
|
LOG("No destroyable found on the obj/lot %llu/%i", branch.target, targetEntity->GetLOT());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ void BasicAttackBehavior::DoHandleBehavior(BehaviorContext* context, RakNet::Bit
|
|||||||
bool isSuccess{};
|
bool isSuccess{};
|
||||||
|
|
||||||
if (!bitStream->Read(isBlocked)) {
|
if (!bitStream->Read(isBlocked)) {
|
||||||
Game::logger->Log("BasicAttackBehavior", "Unable to read isBlocked");
|
LOG("Unable to read isBlocked");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ void BasicAttackBehavior::DoHandleBehavior(BehaviorContext* context, RakNet::Bit
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!bitStream->Read(isImmune)) {
|
if (!bitStream->Read(isImmune)) {
|
||||||
Game::logger->Log("BasicAttackBehavior", "Unable to read isImmune");
|
LOG("Unable to read isImmune");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,20 +77,20 @@ void BasicAttackBehavior::DoHandleBehavior(BehaviorContext* context, RakNet::Bit
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!bitStream->Read(isSuccess)) {
|
if (!bitStream->Read(isSuccess)) {
|
||||||
Game::logger->Log("BasicAttackBehavior", "failed to read success from bitstream");
|
LOG("failed to read success from bitstream");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isSuccess) {
|
if (isSuccess) {
|
||||||
uint32_t armorDamageDealt{};
|
uint32_t armorDamageDealt{};
|
||||||
if (!bitStream->Read(armorDamageDealt)) {
|
if (!bitStream->Read(armorDamageDealt)) {
|
||||||
Game::logger->Log("BasicAttackBehavior", "Unable to read armorDamageDealt");
|
LOG("Unable to read armorDamageDealt");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t healthDamageDealt{};
|
uint32_t healthDamageDealt{};
|
||||||
if (!bitStream->Read(healthDamageDealt)) {
|
if (!bitStream->Read(healthDamageDealt)) {
|
||||||
Game::logger->Log("BasicAttackBehavior", "Unable to read healthDamageDealt");
|
LOG("Unable to read healthDamageDealt");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ void BasicAttackBehavior::DoHandleBehavior(BehaviorContext* context, RakNet::Bit
|
|||||||
|
|
||||||
bool died{};
|
bool died{};
|
||||||
if (!bitStream->Read(died)) {
|
if (!bitStream->Read(died)) {
|
||||||
Game::logger->Log("BasicAttackBehavior", "Unable to read died");
|
LOG("Unable to read died");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto previousArmor = destroyableComponent->GetArmor();
|
auto previousArmor = destroyableComponent->GetArmor();
|
||||||
@ -114,7 +114,7 @@ void BasicAttackBehavior::DoHandleBehavior(BehaviorContext* context, RakNet::Bit
|
|||||||
|
|
||||||
uint8_t successState{};
|
uint8_t successState{};
|
||||||
if (!bitStream->Read(successState)) {
|
if (!bitStream->Read(successState)) {
|
||||||
Game::logger->Log("BasicAttackBehavior", "Unable to read success state");
|
LOG("Unable to read success state");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,7 +127,7 @@ void BasicAttackBehavior::DoHandleBehavior(BehaviorContext* context, RakNet::Bit
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (static_cast<eBasicAttackSuccessTypes>(successState) != eBasicAttackSuccessTypes::FAILIMMUNE) {
|
if (static_cast<eBasicAttackSuccessTypes>(successState) != eBasicAttackSuccessTypes::FAILIMMUNE) {
|
||||||
Game::logger->Log("BasicAttackBehavior", "Unknown success state (%i)!", successState);
|
LOG("Unknown success state (%i)!", successState);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this->m_OnFailImmune->Handle(context, bitStream, branch);
|
this->m_OnFailImmune->Handle(context, bitStream, branch);
|
||||||
@ -157,13 +157,13 @@ void BasicAttackBehavior::Calculate(BehaviorContext* context, RakNet::BitStream*
|
|||||||
void BasicAttackBehavior::DoBehaviorCalculation(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
void BasicAttackBehavior::DoBehaviorCalculation(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||||
auto* targetEntity = Game::entityManager->GetEntity(branch.target);
|
auto* targetEntity = Game::entityManager->GetEntity(branch.target);
|
||||||
if (!targetEntity) {
|
if (!targetEntity) {
|
||||||
Game::logger->Log("BasicAttackBehavior", "Target entity %llu is null!", branch.target);
|
LOG("Target entity %llu is null!", branch.target);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto* destroyableComponent = targetEntity->GetComponent<DestroyableComponent>();
|
auto* destroyableComponent = targetEntity->GetComponent<DestroyableComponent>();
|
||||||
if (!destroyableComponent || !destroyableComponent->GetParent()) {
|
if (!destroyableComponent || !destroyableComponent->GetParent()) {
|
||||||
Game::logger->Log("BasicAttackBehavior", "No destroyable component on %llu", branch.target);
|
LOG("No destroyable component on %llu", branch.target);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,7 +227,7 @@ void BasicAttackBehavior::DoBehaviorCalculation(BehaviorContext* context, RakNet
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (static_cast<eBasicAttackSuccessTypes>(successState) != eBasicAttackSuccessTypes::FAILIMMUNE) {
|
if (static_cast<eBasicAttackSuccessTypes>(successState) != eBasicAttackSuccessTypes::FAILIMMUNE) {
|
||||||
Game::logger->Log("BasicAttackBehavior", "Unknown success state (%i)!", successState);
|
LOG("Unknown success state (%i)!", successState);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
this->m_OnFailImmune->Calculate(context, bitStream, branch);
|
this->m_OnFailImmune->Calculate(context, bitStream, branch);
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include "Behavior.h"
|
#include "Behavior.h"
|
||||||
#include "CDActivitiesTable.h"
|
#include "CDActivitiesTable.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "BehaviorTemplates.h"
|
#include "BehaviorTemplates.h"
|
||||||
#include "BehaviorBranchContext.h"
|
#include "BehaviorBranchContext.h"
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
@ -278,12 +278,12 @@ Behavior* Behavior::CreateBehavior(const uint32_t behaviorId) {
|
|||||||
case BehaviorTemplates::BEHAVIOR_MOUNT: break;
|
case BehaviorTemplates::BEHAVIOR_MOUNT: break;
|
||||||
case BehaviorTemplates::BEHAVIOR_SKILL_SET: break;
|
case BehaviorTemplates::BEHAVIOR_SKILL_SET: break;
|
||||||
default:
|
default:
|
||||||
//Game::logger->Log("Behavior", "Failed to load behavior with invalid template id (%i)!", templateId);
|
//LOG("Failed to load behavior with invalid template id (%i)!", templateId);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (behavior == nullptr) {
|
if (behavior == nullptr) {
|
||||||
//Game::logger->Log("Behavior", "Failed to load unimplemented template id (%i)!", templateId);
|
//LOG("Failed to load unimplemented template id (%i)!", templateId);
|
||||||
|
|
||||||
behavior = new EmptyBehavior(behaviorId);
|
behavior = new EmptyBehavior(behaviorId);
|
||||||
}
|
}
|
||||||
@ -306,7 +306,7 @@ BehaviorTemplates Behavior::GetBehaviorTemplate(const uint32_t behaviorId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (templateID == BehaviorTemplates::BEHAVIOR_EMPTY && behaviorId != 0) {
|
if (templateID == BehaviorTemplates::BEHAVIOR_EMPTY && behaviorId != 0) {
|
||||||
Game::logger->Log("Behavior", "Failed to load behavior template with id (%i)!", behaviorId);
|
LOG("Failed to load behavior template with id (%i)!", behaviorId);
|
||||||
}
|
}
|
||||||
|
|
||||||
return templateID;
|
return templateID;
|
||||||
@ -426,7 +426,7 @@ Behavior::Behavior(const uint32_t behaviorId) {
|
|||||||
|
|
||||||
// Make sure we do not proceed if we are trying to load an invalid behavior
|
// Make sure we do not proceed if we are trying to load an invalid behavior
|
||||||
if (templateInDatabase.behaviorID == 0) {
|
if (templateInDatabase.behaviorID == 0) {
|
||||||
Game::logger->Log("Behavior", "Failed to load behavior with id (%i)!", behaviorId);
|
LOG("Failed to load behavior with id (%i)!", behaviorId);
|
||||||
|
|
||||||
this->m_effectId = 0;
|
this->m_effectId = 0;
|
||||||
this->m_effectHandle = nullptr;
|
this->m_effectHandle = nullptr;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "SkillComponent.h"
|
#include "SkillComponent.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "dServer.h"
|
#include "dServer.h"
|
||||||
#include "BitStreamUtils.h"
|
#include "BitStreamUtils.h"
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ uint32_t BehaviorContext::GetUniqueSkillId() const {
|
|||||||
auto* entity = Game::entityManager->GetEntity(this->originator);
|
auto* entity = Game::entityManager->GetEntity(this->originator);
|
||||||
|
|
||||||
if (entity == nullptr) {
|
if (entity == nullptr) {
|
||||||
Game::logger->Log("BehaviorContext", "Invalid entity for (%llu)!", this->originator);
|
LOG("Invalid entity for (%llu)!", this->originator);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -39,7 +39,7 @@ uint32_t BehaviorContext::GetUniqueSkillId() const {
|
|||||||
auto* component = entity->GetComponent<SkillComponent>();
|
auto* component = entity->GetComponent<SkillComponent>();
|
||||||
|
|
||||||
if (component == nullptr) {
|
if (component == nullptr) {
|
||||||
Game::logger->Log("BehaviorContext", "No skill component attached to (%llu)!", this->originator);;
|
LOG("No skill component attached to (%llu)!", this->originator);;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -126,7 +126,7 @@ void BehaviorContext::SyncBehavior(const uint32_t syncId, RakNet::BitStream* bit
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
Game::logger->Log("BehaviorContext", "Failed to find behavior sync entry with sync id (%i)!", syncId);
|
LOG("Failed to find behavior sync entry with sync id (%i)!", syncId);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -135,7 +135,7 @@ void BehaviorContext::SyncBehavior(const uint32_t syncId, RakNet::BitStream* bit
|
|||||||
const auto branch = entry.branchContext;
|
const auto branch = entry.branchContext;
|
||||||
|
|
||||||
if (behavior == nullptr) {
|
if (behavior == nullptr) {
|
||||||
Game::logger->Log("BehaviorContext", "Invalid behavior for sync id (%i)!", syncId);
|
LOG("Invalid behavior for sync id (%i)!", syncId);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -319,7 +319,7 @@ void BehaviorContext::FilterTargets(std::vector<Entity*>& targets, std::forward_
|
|||||||
// if the caster is not there, return empty targets list
|
// if the caster is not there, return empty targets list
|
||||||
auto* caster = Game::entityManager->GetEntity(this->caster);
|
auto* caster = Game::entityManager->GetEntity(this->caster);
|
||||||
if (!caster) {
|
if (!caster) {
|
||||||
Game::logger->LogDebug("BehaviorContext", "Invalid caster for (%llu)!", this->originator);
|
LOG_DEBUG("Invalid caster for (%llu)!", this->originator);
|
||||||
targets.clear();
|
targets.clear();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include "BehaviorBranchContext.h"
|
#include "BehaviorBranchContext.h"
|
||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "DestroyableComponent.h"
|
#include "DestroyableComponent.h"
|
||||||
|
|
||||||
void BlockBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
void BlockBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||||
@ -13,7 +13,7 @@ void BlockBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStrea
|
|||||||
auto* entity = Game::entityManager->GetEntity(target);
|
auto* entity = Game::entityManager->GetEntity(target);
|
||||||
|
|
||||||
if (entity == nullptr) {
|
if (entity == nullptr) {
|
||||||
Game::logger->Log("DamageAbsorptionBehavior", "Failed to find target (%llu)!", branch.target);
|
LOG("Failed to find target (%llu)!", branch.target);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -43,7 +43,7 @@ void BlockBehavior::UnCast(BehaviorContext* context, BehaviorBranchContext branc
|
|||||||
auto* entity = Game::entityManager->GetEntity(target);
|
auto* entity = Game::entityManager->GetEntity(target);
|
||||||
|
|
||||||
if (entity == nullptr) {
|
if (entity == nullptr) {
|
||||||
Game::logger->Log("DamageAbsorptionBehavior", "Failed to find target (%llu)!", branch.target);
|
LOG("Failed to find target (%llu)!", branch.target);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include "BehaviorBranchContext.h"
|
#include "BehaviorBranchContext.h"
|
||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "DestroyableComponent.h"
|
#include "DestroyableComponent.h"
|
||||||
|
|
||||||
void BuffBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
void BuffBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||||
@ -13,7 +13,7 @@ void BuffBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream
|
|||||||
auto* entity = Game::entityManager->GetEntity(target);
|
auto* entity = Game::entityManager->GetEntity(target);
|
||||||
|
|
||||||
if (entity == nullptr) {
|
if (entity == nullptr) {
|
||||||
Game::logger->Log("BuffBehavior", "Invalid target (%llu)!", target);
|
LOG("Invalid target (%llu)!", target);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -21,7 +21,7 @@ void BuffBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream
|
|||||||
auto* component = entity->GetComponent<DestroyableComponent>();
|
auto* component = entity->GetComponent<DestroyableComponent>();
|
||||||
|
|
||||||
if (component == nullptr) {
|
if (component == nullptr) {
|
||||||
Game::logger->Log("BuffBehavior", "Invalid target, no destroyable component (%llu)!", target);
|
LOG("Invalid target, no destroyable component (%llu)!", target);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -47,7 +47,7 @@ void BuffBehavior::UnCast(BehaviorContext* context, BehaviorBranchContext branch
|
|||||||
auto* entity = Game::entityManager->GetEntity(target);
|
auto* entity = Game::entityManager->GetEntity(target);
|
||||||
|
|
||||||
if (entity == nullptr) {
|
if (entity == nullptr) {
|
||||||
Game::logger->Log("BuffBehavior", "Invalid target (%llu)!", target);
|
LOG("Invalid target (%llu)!", target);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -55,7 +55,7 @@ void BuffBehavior::UnCast(BehaviorContext* context, BehaviorBranchContext branch
|
|||||||
auto* component = entity->GetComponent<DestroyableComponent>();
|
auto* component = entity->GetComponent<DestroyableComponent>();
|
||||||
|
|
||||||
if (component == nullptr) {
|
if (component == nullptr) {
|
||||||
Game::logger->Log("BuffBehavior", "Invalid target, no destroyable component (%llu)!", target);
|
LOG("Invalid target, no destroyable component (%llu)!", target);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include "BehaviorContext.h"
|
#include "BehaviorContext.h"
|
||||||
#include "CharacterComponent.h"
|
#include "CharacterComponent.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "PossessableComponent.h"
|
#include "PossessableComponent.h"
|
||||||
|
|
||||||
void CarBoostBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
void CarBoostBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||||
@ -17,7 +17,7 @@ void CarBoostBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitSt
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::logger->Log("Car boost", "Activating car boost!");
|
LOG("Activating car boost!");
|
||||||
|
|
||||||
auto* possessableComponent = entity->GetComponent<PossessableComponent>();
|
auto* possessableComponent = entity->GetComponent<PossessableComponent>();
|
||||||
if (possessableComponent != nullptr) {
|
if (possessableComponent != nullptr) {
|
||||||
@ -27,7 +27,7 @@ void CarBoostBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitSt
|
|||||||
|
|
||||||
auto* characterComponent = possessor->GetComponent<CharacterComponent>();
|
auto* characterComponent = possessor->GetComponent<CharacterComponent>();
|
||||||
if (characterComponent != nullptr) {
|
if (characterComponent != nullptr) {
|
||||||
Game::logger->Log("Car boost", "Tracking car boost!");
|
LOG("Tracking car boost!");
|
||||||
characterComponent->UpdatePlayerStatistic(RacingCarBoostsActivated);
|
characterComponent->UpdatePlayerStatistic(RacingCarBoostsActivated);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
#include "ChainBehavior.h"
|
#include "ChainBehavior.h"
|
||||||
#include "BehaviorBranchContext.h"
|
#include "BehaviorBranchContext.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
|
|
||||||
void ChainBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) {
|
void ChainBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) {
|
||||||
uint32_t chainIndex{};
|
uint32_t chainIndex{};
|
||||||
|
|
||||||
if (!bitStream->Read(chainIndex)) {
|
if (!bitStream->Read(chainIndex)) {
|
||||||
Game::logger->Log("ChainBehavior", "Unable to read chainIndex from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
LOG("Unable to read chainIndex from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ void ChainBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStrea
|
|||||||
if (chainIndex < this->m_behaviors.size()) {
|
if (chainIndex < this->m_behaviors.size()) {
|
||||||
this->m_behaviors.at(chainIndex)->Handle(context, bitStream, branch);
|
this->m_behaviors.at(chainIndex)->Handle(context, bitStream, branch);
|
||||||
} else {
|
} else {
|
||||||
Game::logger->Log("ChainBehavior", "chainIndex out of bounds, aborting handle of chain %i bits unread %i", chainIndex, bitStream->GetNumberOfUnreadBits());
|
LOG("chainIndex out of bounds, aborting handle of chain %i bits unread %i", chainIndex, bitStream->GetNumberOfUnreadBits());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,13 +2,13 @@
|
|||||||
#include "BehaviorBranchContext.h"
|
#include "BehaviorBranchContext.h"
|
||||||
#include "BehaviorContext.h"
|
#include "BehaviorContext.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
|
|
||||||
void ChargeUpBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) {
|
void ChargeUpBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) {
|
||||||
uint32_t handle{};
|
uint32_t handle{};
|
||||||
|
|
||||||
if (!bitStream->Read(handle)) {
|
if (!bitStream->Read(handle)) {
|
||||||
Game::logger->Log("ChargeUpBehavior", "Unable to read handle from bitStream, aborting Handle! variable_type");
|
LOG("Unable to read handle from bitStream, aborting Handle! variable_type");
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -4,14 +4,14 @@
|
|||||||
#include "BehaviorContext.h"
|
#include "BehaviorContext.h"
|
||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "DestroyableComponent.h"
|
#include "DestroyableComponent.h"
|
||||||
|
|
||||||
void DamageAbsorptionBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) {
|
void DamageAbsorptionBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) {
|
||||||
auto* target = Game::entityManager->GetEntity(branch.target);
|
auto* target = Game::entityManager->GetEntity(branch.target);
|
||||||
|
|
||||||
if (target == nullptr) {
|
if (target == nullptr) {
|
||||||
Game::logger->Log("DamageAbsorptionBehavior", "Failed to find target (%llu)!", branch.target);
|
LOG("Failed to find target (%llu)!", branch.target);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -37,7 +37,7 @@ void DamageAbsorptionBehavior::Timer(BehaviorContext* context, BehaviorBranchCon
|
|||||||
auto* target = Game::entityManager->GetEntity(second);
|
auto* target = Game::entityManager->GetEntity(second);
|
||||||
|
|
||||||
if (target == nullptr) {
|
if (target == nullptr) {
|
||||||
Game::logger->Log("DamageAbsorptionBehavior", "Failed to find target (%llu)!", second);
|
LOG("Failed to find target (%llu)!", second);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -4,14 +4,14 @@
|
|||||||
#include "BehaviorContext.h"
|
#include "BehaviorContext.h"
|
||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "DestroyableComponent.h"
|
#include "DestroyableComponent.h"
|
||||||
|
|
||||||
void DamageReductionBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) {
|
void DamageReductionBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) {
|
||||||
auto* target = Game::entityManager->GetEntity(branch.target);
|
auto* target = Game::entityManager->GetEntity(branch.target);
|
||||||
|
|
||||||
if (target == nullptr) {
|
if (target == nullptr) {
|
||||||
Game::logger->Log("DamageReductionBehavior", "Failed to find target (%llu)!", branch.target);
|
LOG("Failed to find target (%llu)!", branch.target);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -35,7 +35,7 @@ void DamageReductionBehavior::Timer(BehaviorContext* context, BehaviorBranchCont
|
|||||||
auto* target = Game::entityManager->GetEntity(second);
|
auto* target = Game::entityManager->GetEntity(second);
|
||||||
|
|
||||||
if (target == nullptr) {
|
if (target == nullptr) {
|
||||||
Game::logger->Log("DamageReductionBehavior", "Failed to find target (%llu)!", second);
|
LOG("Failed to find target (%llu)!", second);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ void DarkInspirationBehavior::Handle(BehaviorContext* context, RakNet::BitStream
|
|||||||
auto* target = Game::entityManager->GetEntity(branch.target);
|
auto* target = Game::entityManager->GetEntity(branch.target);
|
||||||
|
|
||||||
if (target == nullptr) {
|
if (target == nullptr) {
|
||||||
Game::logger->LogDebug("DarkInspirationBehavior", "Failed to find target (%llu)!", branch.target);
|
LOG_DEBUG("Failed to find target (%llu)!", branch.target);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ void DarkInspirationBehavior::Calculate(BehaviorContext* context, RakNet::BitStr
|
|||||||
auto* target = Game::entityManager->GetEntity(branch.target);
|
auto* target = Game::entityManager->GetEntity(branch.target);
|
||||||
|
|
||||||
if (target == nullptr) {
|
if (target == nullptr) {
|
||||||
Game::logger->LogDebug("DarkInspirationBehavior", "Failed to find target (%llu)!", branch.target);
|
LOG_DEBUG("Failed to find target (%llu)!", branch.target);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include "ControllablePhysicsComponent.h"
|
#include "ControllablePhysicsComponent.h"
|
||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
|
|
||||||
void ForceMovementBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) {
|
void ForceMovementBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) {
|
||||||
if (this->m_hitAction->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY && this->m_hitEnemyAction->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY && this->m_hitFactionAction->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY) {
|
if (this->m_hitAction->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY && this->m_hitEnemyAction->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY && this->m_hitFactionAction->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY) {
|
||||||
@ -13,7 +13,7 @@ void ForceMovementBehavior::Handle(BehaviorContext* context, RakNet::BitStream*
|
|||||||
|
|
||||||
uint32_t handle{};
|
uint32_t handle{};
|
||||||
if (!bitStream->Read(handle)) {
|
if (!bitStream->Read(handle)) {
|
||||||
Game::logger->Log("ForceMovementBehavior", "Unable to read handle from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
LOG("Unable to read handle from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
context->RegisterSyncBehavior(handle, this, branch, this->m_Duration);
|
context->RegisterSyncBehavior(handle, this, branch, this->m_Duration);
|
||||||
@ -22,13 +22,13 @@ void ForceMovementBehavior::Handle(BehaviorContext* context, RakNet::BitStream*
|
|||||||
void ForceMovementBehavior::Sync(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
void ForceMovementBehavior::Sync(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||||
uint32_t next{};
|
uint32_t next{};
|
||||||
if (!bitStream->Read(next)) {
|
if (!bitStream->Read(next)) {
|
||||||
Game::logger->Log("ForceMovementBehavior", "Unable to read target from bitStream, aborting Sync! %i", bitStream->GetNumberOfUnreadBits());
|
LOG("Unable to read target from bitStream, aborting Sync! %i", bitStream->GetNumberOfUnreadBits());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LWOOBJID target{};
|
LWOOBJID target{};
|
||||||
if (!bitStream->Read(target)) {
|
if (!bitStream->Read(target)) {
|
||||||
Game::logger->Log("ForceMovementBehavior", "Unable to read target from bitStream, aborting Sync! %i", bitStream->GetNumberOfUnreadBits());
|
LOG("Unable to read target from bitStream, aborting Sync! %i", bitStream->GetNumberOfUnreadBits());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "HealBehavior.h"
|
#include "HealBehavior.h"
|
||||||
#include "BehaviorBranchContext.h"
|
#include "BehaviorBranchContext.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "DestroyableComponent.h"
|
#include "DestroyableComponent.h"
|
||||||
#include "eReplicaComponentType.h"
|
#include "eReplicaComponentType.h"
|
||||||
@ -11,7 +11,7 @@ void HealBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit_strea
|
|||||||
auto* entity = Game::entityManager->GetEntity(branch.target);
|
auto* entity = Game::entityManager->GetEntity(branch.target);
|
||||||
|
|
||||||
if (entity == nullptr) {
|
if (entity == nullptr) {
|
||||||
Game::logger->Log("HealBehavior", "Failed to find entity for (%llu)!", branch.target);
|
LOG("Failed to find entity for (%llu)!", branch.target);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -19,7 +19,7 @@ void HealBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit_strea
|
|||||||
auto* destroyable = static_cast<DestroyableComponent*>(entity->GetComponent(eReplicaComponentType::DESTROYABLE));
|
auto* destroyable = static_cast<DestroyableComponent*>(entity->GetComponent(eReplicaComponentType::DESTROYABLE));
|
||||||
|
|
||||||
if (destroyable == nullptr) {
|
if (destroyable == nullptr) {
|
||||||
Game::logger->Log("HealBehavior", "Failed to find destroyable component for %(llu)!", branch.target);
|
LOG("Failed to find destroyable component for %(llu)!", branch.target);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include "DestroyableComponent.h"
|
#include "DestroyableComponent.h"
|
||||||
#include "dpWorld.h"
|
#include "dpWorld.h"
|
||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
|
|
||||||
|
|
||||||
void ImaginationBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit_stream, const BehaviorBranchContext branch) {
|
void ImaginationBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit_stream, const BehaviorBranchContext branch) {
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include "BehaviorContext.h"
|
#include "BehaviorContext.h"
|
||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "DestroyableComponent.h"
|
#include "DestroyableComponent.h"
|
||||||
#include "ControllablePhysicsComponent.h"
|
#include "ControllablePhysicsComponent.h"
|
||||||
#include "eStateChangeType.h"
|
#include "eStateChangeType.h"
|
||||||
@ -13,7 +13,7 @@ void ImmunityBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitSt
|
|||||||
auto* target = Game::entityManager->GetEntity(branch.target);
|
auto* target = Game::entityManager->GetEntity(branch.target);
|
||||||
|
|
||||||
if (!target) {
|
if (!target) {
|
||||||
Game::logger->Log("DamageAbsorptionBehavior", "Failed to find target (%llu)!", branch.target);
|
LOG("Failed to find target (%llu)!", branch.target);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ void ImmunityBehavior::Timer(BehaviorContext* context, BehaviorBranchContext bra
|
|||||||
auto* target = Game::entityManager->GetEntity(second);
|
auto* target = Game::entityManager->GetEntity(second);
|
||||||
|
|
||||||
if (!target) {
|
if (!target) {
|
||||||
Game::logger->Log("DamageAbsorptionBehavior", "Failed to find target (%llu)!", second);
|
LOG("Failed to find target (%llu)!", second);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include "BehaviorBranchContext.h"
|
#include "BehaviorBranchContext.h"
|
||||||
#include "BehaviorContext.h"
|
#include "BehaviorContext.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "SkillComponent.h"
|
#include "SkillComponent.h"
|
||||||
|
|
||||||
@ -12,7 +12,7 @@ void InterruptBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitS
|
|||||||
bool unknown = false;
|
bool unknown = false;
|
||||||
|
|
||||||
if (!bitStream->Read(unknown)) {
|
if (!bitStream->Read(unknown)) {
|
||||||
Game::logger->Log("InterruptBehavior", "Unable to read unknown1 from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
LOG("Unable to read unknown1 from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ void InterruptBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitS
|
|||||||
bool unknown = false;
|
bool unknown = false;
|
||||||
|
|
||||||
if (!bitStream->Read(unknown)) {
|
if (!bitStream->Read(unknown)) {
|
||||||
Game::logger->Log("InterruptBehavior", "Unable to read unknown2 from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
LOG("Unable to read unknown2 from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ void InterruptBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitS
|
|||||||
bool unknown = false;
|
bool unknown = false;
|
||||||
|
|
||||||
if (!bitStream->Read(unknown)) {
|
if (!bitStream->Read(unknown)) {
|
||||||
Game::logger->Log("InterruptBehavior", "Unable to read unknown3 from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
LOG("Unable to read unknown3 from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -7,13 +7,13 @@
|
|||||||
#include "GameMessages.h"
|
#include "GameMessages.h"
|
||||||
#include "DestroyableComponent.h"
|
#include "DestroyableComponent.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
|
|
||||||
void KnockbackBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
void KnockbackBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||||
bool unknown{};
|
bool unknown{};
|
||||||
|
|
||||||
if (!bitStream->Read(unknown)) {
|
if (!bitStream->Read(unknown)) {
|
||||||
Game::logger->Log("KnockbackBehavior", "Unable to read unknown from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
LOG("Unable to read unknown from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "MovementSwitchBehavior.h"
|
#include "MovementSwitchBehavior.h"
|
||||||
#include "BehaviorBranchContext.h"
|
#include "BehaviorBranchContext.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
|
|
||||||
void MovementSwitchBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) {
|
void MovementSwitchBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) {
|
||||||
uint32_t movementType{};
|
uint32_t movementType{};
|
||||||
@ -15,7 +15,7 @@ void MovementSwitchBehavior::Handle(BehaviorContext* context, RakNet::BitStream*
|
|||||||
this->m_movingAction->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY) {
|
this->m_movingAction->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Game::logger->Log("MovementSwitchBehavior", "Unable to read movementType from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
LOG("Unable to read movementType from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include "BehaviorBranchContext.h"
|
#include "BehaviorBranchContext.h"
|
||||||
#include "BehaviorContext.h"
|
#include "BehaviorContext.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "SkillComponent.h"
|
#include "SkillComponent.h"
|
||||||
#include "DestroyableComponent.h"
|
#include "DestroyableComponent.h"
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include "BehaviorContext.h"
|
#include "BehaviorContext.h"
|
||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "SkillComponent.h"
|
#include "SkillComponent.h"
|
||||||
#include "../dWorldServer/ObjectIDManager.h"
|
#include "../dWorldServer/ObjectIDManager.h"
|
||||||
#include "eObjectBits.h"
|
#include "eObjectBits.h"
|
||||||
@ -12,14 +12,14 @@ void ProjectileAttackBehavior::Handle(BehaviorContext* context, RakNet::BitStrea
|
|||||||
LWOOBJID target{};
|
LWOOBJID target{};
|
||||||
|
|
||||||
if (!bitStream->Read(target)) {
|
if (!bitStream->Read(target)) {
|
||||||
Game::logger->Log("ProjectileAttackBehavior", "Unable to read target from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
LOG("Unable to read target from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
auto* entity = Game::entityManager->GetEntity(context->originator);
|
auto* entity = Game::entityManager->GetEntity(context->originator);
|
||||||
|
|
||||||
if (entity == nullptr) {
|
if (entity == nullptr) {
|
||||||
Game::logger->Log("ProjectileAttackBehavior", "Failed to find originator (%llu)!", context->originator);
|
LOG("Failed to find originator (%llu)!", context->originator);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -27,7 +27,7 @@ void ProjectileAttackBehavior::Handle(BehaviorContext* context, RakNet::BitStrea
|
|||||||
auto* skillComponent = entity->GetComponent<SkillComponent>();
|
auto* skillComponent = entity->GetComponent<SkillComponent>();
|
||||||
|
|
||||||
if (skillComponent == nullptr) {
|
if (skillComponent == nullptr) {
|
||||||
Game::logger->Log("ProjectileAttackBehavior", "Failed to find skill component for (%llu)!", -context->originator);
|
LOG("Failed to find skill component for (%llu)!", -context->originator);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -35,7 +35,7 @@ void ProjectileAttackBehavior::Handle(BehaviorContext* context, RakNet::BitStrea
|
|||||||
if (m_useMouseposit && !branch.isSync) {
|
if (m_useMouseposit && !branch.isSync) {
|
||||||
NiPoint3 targetPosition = NiPoint3::ZERO;
|
NiPoint3 targetPosition = NiPoint3::ZERO;
|
||||||
if (!bitStream->Read(targetPosition)) {
|
if (!bitStream->Read(targetPosition)) {
|
||||||
Game::logger->Log("ProjectileAttackBehavior", "Unable to read targetPosition from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
LOG("Unable to read targetPosition from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -46,7 +46,7 @@ void ProjectileAttackBehavior::Handle(BehaviorContext* context, RakNet::BitStrea
|
|||||||
LWOOBJID projectileId{};
|
LWOOBJID projectileId{};
|
||||||
|
|
||||||
if (!bitStream->Read(projectileId)) {
|
if (!bitStream->Read(projectileId)) {
|
||||||
Game::logger->Log("ProjectileAttackBehavior", "Unable to read projectileId from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
LOG("Unable to read projectileId from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ void ProjectileAttackBehavior::Calculate(BehaviorContext* context, RakNet::BitSt
|
|||||||
auto* entity = Game::entityManager->GetEntity(context->originator);
|
auto* entity = Game::entityManager->GetEntity(context->originator);
|
||||||
|
|
||||||
if (entity == nullptr) {
|
if (entity == nullptr) {
|
||||||
Game::logger->Log("ProjectileAttackBehavior", "Failed to find originator (%llu)!", context->originator);
|
LOG("Failed to find originator (%llu)!", context->originator);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -72,7 +72,7 @@ void ProjectileAttackBehavior::Calculate(BehaviorContext* context, RakNet::BitSt
|
|||||||
auto* skillComponent = entity->GetComponent<SkillComponent>();
|
auto* skillComponent = entity->GetComponent<SkillComponent>();
|
||||||
|
|
||||||
if (skillComponent == nullptr) {
|
if (skillComponent == nullptr) {
|
||||||
Game::logger->Log("ProjectileAttackBehavior", "Failed to find skill component for (%llu)!", context->originator);
|
LOG("Failed to find skill component for (%llu)!", context->originator);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ void ProjectileAttackBehavior::Calculate(BehaviorContext* context, RakNet::BitSt
|
|||||||
auto* other = Game::entityManager->GetEntity(branch.target);
|
auto* other = Game::entityManager->GetEntity(branch.target);
|
||||||
|
|
||||||
if (other == nullptr) {
|
if (other == nullptr) {
|
||||||
Game::logger->Log("ProjectileAttackBehavior", "Invalid projectile target (%llu)!", branch.target);
|
LOG("Invalid projectile target (%llu)!", branch.target);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ void PropertyTeleportBehavior::Handle(BehaviorContext* context, RakNet::BitStrea
|
|||||||
if (zoneClone != 0) ChatPackets::SendSystemMessage(sysAddr, u"Transfering to your property!");
|
if (zoneClone != 0) ChatPackets::SendSystemMessage(sysAddr, u"Transfering to your property!");
|
||||||
else ChatPackets::SendSystemMessage(sysAddr, u"Transfering back to previous world!");
|
else ChatPackets::SendSystemMessage(sysAddr, u"Transfering back to previous world!");
|
||||||
|
|
||||||
Game::logger->Log("PropertyTeleportBehavior", "Transferring %s to Zone %i (Instance %i | Clone %i | Mythran Shift: %s) with IP %s and Port %i", sysAddr.ToString(), zoneID, zoneInstance, zoneClone, mythranShift == true ? "true" : "false", serverIP.c_str(), serverPort);
|
LOG("Transferring %s to Zone %i (Instance %i | Clone %i | Mythran Shift: %s) with IP %s and Port %i", sysAddr.ToString(), zoneID, zoneInstance, zoneClone, mythranShift == true ? "true" : "false", serverIP.c_str(), serverPort);
|
||||||
if (entity->GetCharacter()) {
|
if (entity->GetCharacter()) {
|
||||||
entity->GetCharacter()->SetZoneID(zoneID);
|
entity->GetCharacter()->SetZoneID(zoneID);
|
||||||
entity->GetCharacter()->SetZoneInstance(zoneInstance);
|
entity->GetCharacter()->SetZoneInstance(zoneInstance);
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include "DestroyableComponent.h"
|
#include "DestroyableComponent.h"
|
||||||
#include "dpWorld.h"
|
#include "dpWorld.h"
|
||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "eReplicaComponentType.h"
|
#include "eReplicaComponentType.h"
|
||||||
|
|
||||||
@ -11,7 +11,7 @@ void RepairBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit_str
|
|||||||
auto* entity = Game::entityManager->GetEntity(branch.target);
|
auto* entity = Game::entityManager->GetEntity(branch.target);
|
||||||
|
|
||||||
if (entity == nullptr) {
|
if (entity == nullptr) {
|
||||||
Game::logger->Log("RepairBehavior", "Failed to find entity for (%llu)!", branch.target);
|
LOG("Failed to find entity for (%llu)!", branch.target);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -19,7 +19,7 @@ void RepairBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit_str
|
|||||||
auto* destroyable = static_cast<DestroyableComponent*>(entity->GetComponent(eReplicaComponentType::DESTROYABLE));
|
auto* destroyable = static_cast<DestroyableComponent*>(entity->GetComponent(eReplicaComponentType::DESTROYABLE));
|
||||||
|
|
||||||
if (destroyable == nullptr) {
|
if (destroyable == nullptr) {
|
||||||
Game::logger->Log("RepairBehavior", "Failed to find destroyable component for %(llu)!", branch.target);
|
LOG("Failed to find destroyable component for %(llu)!", branch.target);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include "BehaviorBranchContext.h"
|
#include "BehaviorBranchContext.h"
|
||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "DestroyableComponent.h"
|
#include "DestroyableComponent.h"
|
||||||
#include "RebuildComponent.h"
|
#include "RebuildComponent.h"
|
||||||
#include "Entity.h"
|
#include "Entity.h"
|
||||||
@ -15,7 +15,7 @@ void SpawnBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStrea
|
|||||||
auto* origin = Game::entityManager->GetEntity(context->originator);
|
auto* origin = Game::entityManager->GetEntity(context->originator);
|
||||||
|
|
||||||
if (origin == nullptr) {
|
if (origin == nullptr) {
|
||||||
Game::logger->Log("SpawnBehavior", "Failed to find self entity (%llu)!", context->originator);
|
LOG("Failed to find self entity (%llu)!", context->originator);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -45,7 +45,7 @@ void SpawnBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStrea
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (entity == nullptr) {
|
if (entity == nullptr) {
|
||||||
Game::logger->Log("SpawnBehavior", "Failed to spawn entity (%i)!", this->m_lot);
|
LOG("Failed to spawn entity (%i)!", this->m_lot);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -82,7 +82,7 @@ void SpawnBehavior::Timer(BehaviorContext* context, const BehaviorBranchContext
|
|||||||
auto* entity = Game::entityManager->GetEntity(second);
|
auto* entity = Game::entityManager->GetEntity(second);
|
||||||
|
|
||||||
if (entity == nullptr) {
|
if (entity == nullptr) {
|
||||||
Game::logger->Log("SpawnBehavior", "Failed to find spawned entity (%llu)!", second);
|
LOG("Failed to find spawned entity (%llu)!", second);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include "ControllablePhysicsComponent.h"
|
#include "ControllablePhysicsComponent.h"
|
||||||
#include "BehaviorContext.h"
|
#include "BehaviorContext.h"
|
||||||
#include "BehaviorBranchContext.h"
|
#include "BehaviorBranchContext.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
|
|
||||||
|
|
||||||
void SpeedBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
void SpeedBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include "BehaviorContext.h"
|
#include "BehaviorContext.h"
|
||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "DestroyableComponent.h"
|
#include "DestroyableComponent.h"
|
||||||
#include "eReplicaComponentType.h"
|
#include "eReplicaComponentType.h"
|
||||||
|
|
||||||
@ -17,14 +17,14 @@ void StunBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream
|
|||||||
|
|
||||||
bool blocked{};
|
bool blocked{};
|
||||||
if (!bitStream->Read(blocked)) {
|
if (!bitStream->Read(blocked)) {
|
||||||
Game::logger->Log("StunBehavior", "Unable to read blocked from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
LOG("Unable to read blocked from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
auto* target = Game::entityManager->GetEntity(branch.target);
|
auto* target = Game::entityManager->GetEntity(branch.target);
|
||||||
|
|
||||||
if (target == nullptr) {
|
if (target == nullptr) {
|
||||||
Game::logger->Log("StunBehavior", "Failed to find target (%llu)!", branch.target);
|
LOG("Failed to find target (%llu)!", branch.target);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -47,7 +47,7 @@ void StunBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStr
|
|||||||
auto* self = Game::entityManager->GetEntity(context->originator);
|
auto* self = Game::entityManager->GetEntity(context->originator);
|
||||||
|
|
||||||
if (self == nullptr) {
|
if (self == nullptr) {
|
||||||
Game::logger->Log("StunBehavior", "Invalid self entity (%llu)!", context->originator);
|
LOG("Invalid self entity (%llu)!", context->originator);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -82,7 +82,7 @@ void StunBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStr
|
|||||||
bitStream->Write(blocked);
|
bitStream->Write(blocked);
|
||||||
|
|
||||||
if (target == nullptr) {
|
if (target == nullptr) {
|
||||||
Game::logger->Log("StunBehavior", "Failed to find target (%llu)!", branch.target);
|
LOG("Failed to find target (%llu)!", branch.target);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "SwitchBehavior.h"
|
#include "SwitchBehavior.h"
|
||||||
#include "BehaviorBranchContext.h"
|
#include "BehaviorBranchContext.h"
|
||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "DestroyableComponent.h"
|
#include "DestroyableComponent.h"
|
||||||
#include "BehaviorContext.h"
|
#include "BehaviorContext.h"
|
||||||
#include "BuffComponent.h"
|
#include "BuffComponent.h"
|
||||||
@ -11,7 +11,7 @@ void SwitchBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStre
|
|||||||
|
|
||||||
if (this->m_imagination > 0 || !this->m_isEnemyFaction) {
|
if (this->m_imagination > 0 || !this->m_isEnemyFaction) {
|
||||||
if (!bitStream->Read(state)) {
|
if (!bitStream->Read(state)) {
|
||||||
Game::logger->Log("SwitchBehavior", "Unable to read state from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
LOG("Unable to read state from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -28,7 +28,7 @@ void SwitchBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStre
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::logger->LogDebug("SwitchBehavior", "[%i] State: (%d), imagination: (%i) / (%f)", entity->GetLOT(), state, destroyableComponent->GetImagination(), destroyableComponent->GetMaxImagination());
|
LOG_DEBUG("[%i] State: (%d), imagination: (%i) / (%f)", entity->GetLOT(), state, destroyableComponent->GetImagination(), destroyableComponent->GetMaxImagination());
|
||||||
|
|
||||||
if (state) {
|
if (state) {
|
||||||
this->m_actionTrue->Handle(context, bitStream, branch);
|
this->m_actionTrue->Handle(context, bitStream, branch);
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include "BehaviorBranchContext.h"
|
#include "BehaviorBranchContext.h"
|
||||||
#include "CDActivitiesTable.h"
|
#include "CDActivitiesTable.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
|
|
||||||
|
|
||||||
@ -13,7 +13,7 @@ void SwitchMultipleBehavior::Handle(BehaviorContext* context, RakNet::BitStream*
|
|||||||
float value{};
|
float value{};
|
||||||
|
|
||||||
if (!bitStream->Read(value)) {
|
if (!bitStream->Read(value)) {
|
||||||
Game::logger->Log("SwitchMultipleBehavior", "Unable to read value from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
LOG("Unable to read value from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "TacArcBehavior.h"
|
#include "TacArcBehavior.h"
|
||||||
#include "BehaviorBranchContext.h"
|
#include "BehaviorBranchContext.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "Entity.h"
|
#include "Entity.h"
|
||||||
#include "BehaviorContext.h"
|
#include "BehaviorContext.h"
|
||||||
#include "BaseCombatAIComponent.h"
|
#include "BaseCombatAIComponent.h"
|
||||||
@ -16,7 +16,7 @@ void TacArcBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStre
|
|||||||
|
|
||||||
if (this->m_usePickedTarget && branch.target != LWOOBJID_EMPTY) {
|
if (this->m_usePickedTarget && branch.target != LWOOBJID_EMPTY) {
|
||||||
auto target = Game::entityManager->GetEntity(branch.target);
|
auto target = Game::entityManager->GetEntity(branch.target);
|
||||||
if (!target) Game::logger->Log("TacArcBehavior", "target %llu is null", branch.target);
|
if (!target) LOG("target %llu is null", branch.target);
|
||||||
else {
|
else {
|
||||||
targets.push_back(target);
|
targets.push_back(target);
|
||||||
context->FilterTargets(targets, this->m_ignoreFactionList, this->m_includeFactionList, this->m_targetSelf, this->m_targetEnemy, this->m_targetFriend, this->m_targetTeam);
|
context->FilterTargets(targets, this->m_ignoreFactionList, this->m_includeFactionList, this->m_targetSelf, this->m_targetEnemy, this->m_targetFriend, this->m_targetTeam);
|
||||||
@ -29,7 +29,7 @@ void TacArcBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStre
|
|||||||
|
|
||||||
bool hasTargets = false;
|
bool hasTargets = false;
|
||||||
if (!bitStream->Read(hasTargets)) {
|
if (!bitStream->Read(hasTargets)) {
|
||||||
Game::logger->Log("TacArcBehavior", "Unable to read hasTargets from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
LOG("Unable to read hasTargets from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ void TacArcBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStre
|
|||||||
bool blocked = false;
|
bool blocked = false;
|
||||||
|
|
||||||
if (!bitStream->Read(blocked)) {
|
if (!bitStream->Read(blocked)) {
|
||||||
Game::logger->Log("TacArcBehavior", "Unable to read blocked from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
LOG("Unable to read blocked from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -50,12 +50,12 @@ void TacArcBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStre
|
|||||||
if (hasTargets) {
|
if (hasTargets) {
|
||||||
uint32_t count = 0;
|
uint32_t count = 0;
|
||||||
if (!bitStream->Read(count)) {
|
if (!bitStream->Read(count)) {
|
||||||
Game::logger->Log("TacArcBehavior", "Unable to read count from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
LOG("Unable to read count from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (count > m_maxTargets) {
|
if (count > m_maxTargets) {
|
||||||
Game::logger->Log("TacArcBehavior", "Bitstream has too many targets Max:%i Recv:%i", this->m_maxTargets, count);
|
LOG("Bitstream has too many targets Max:%i Recv:%i", this->m_maxTargets, count);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ void TacArcBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStre
|
|||||||
LWOOBJID id{};
|
LWOOBJID id{};
|
||||||
|
|
||||||
if (!bitStream->Read(id)) {
|
if (!bitStream->Read(id)) {
|
||||||
Game::logger->Log("TacArcBehavior", "Unable to read id from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
LOG("Unable to read id from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ void TacArcBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStre
|
|||||||
auto* canidate = Game::entityManager->GetEntity(id);
|
auto* canidate = Game::entityManager->GetEntity(id);
|
||||||
if (canidate) targets.push_back(canidate);
|
if (canidate) targets.push_back(canidate);
|
||||||
} else {
|
} else {
|
||||||
Game::logger->Log("TacArcBehavior", "Bitstream has LWOOBJID_EMPTY as a target!");
|
LOG("Bitstream has LWOOBJID_EMPTY as a target!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ void TacArcBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStre
|
|||||||
void TacArcBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
void TacArcBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||||
auto* self = Game::entityManager->GetEntity(context->originator);
|
auto* self = Game::entityManager->GetEntity(context->originator);
|
||||||
if (self == nullptr) {
|
if (self == nullptr) {
|
||||||
Game::logger->Log("TacArcBehavior", "Invalid self for (%llu)!", context->originator);
|
LOG("Invalid self for (%llu)!", context->originator);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,14 +3,14 @@
|
|||||||
#include "BehaviorContext.h"
|
#include "BehaviorContext.h"
|
||||||
#include "BaseCombatAIComponent.h"
|
#include "BaseCombatAIComponent.h"
|
||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
|
|
||||||
|
|
||||||
void TauntBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
void TauntBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||||
auto* target = Game::entityManager->GetEntity(branch.target);
|
auto* target = Game::entityManager->GetEntity(branch.target);
|
||||||
|
|
||||||
if (target == nullptr) {
|
if (target == nullptr) {
|
||||||
Game::logger->Log("TauntBehavior", "Failed to find target (%llu)!", branch.target);
|
LOG("Failed to find target (%llu)!", branch.target);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -26,7 +26,7 @@ void TauntBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitSt
|
|||||||
auto* target = Game::entityManager->GetEntity(branch.target);
|
auto* target = Game::entityManager->GetEntity(branch.target);
|
||||||
|
|
||||||
if (target == nullptr) {
|
if (target == nullptr) {
|
||||||
Game::logger->Log("TauntBehavior", "Failed to find target (%llu)!", branch.target);
|
LOG("Failed to find target (%llu)!", branch.target);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include "NiPoint3.h"
|
#include "NiPoint3.h"
|
||||||
#include "BehaviorContext.h"
|
#include "BehaviorContext.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
|
|
||||||
|
|
||||||
void VerifyBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
void VerifyBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||||
@ -18,7 +18,7 @@ void VerifyBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitS
|
|||||||
auto* self = Game::entityManager->GetEntity(context->originator);
|
auto* self = Game::entityManager->GetEntity(context->originator);
|
||||||
|
|
||||||
if (self == nullptr) {
|
if (self == nullptr) {
|
||||||
Game::logger->Log("VerifyBehavior", "Invalid self for (%llu)", context->originator);
|
LOG("Invalid self for (%llu)", context->originator);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -540,7 +540,7 @@ bool BaseCombatAIComponent::IsEnemy(LWOOBJID target) const {
|
|||||||
auto* entity = Game::entityManager->GetEntity(target);
|
auto* entity = Game::entityManager->GetEntity(target);
|
||||||
|
|
||||||
if (entity == nullptr) {
|
if (entity == nullptr) {
|
||||||
Game::logger->Log("BaseCombatAIComponent", "Invalid entity for checking validity (%llu)!", target);
|
LOG("Invalid entity for checking validity (%llu)!", target);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -554,7 +554,7 @@ bool BaseCombatAIComponent::IsEnemy(LWOOBJID target) const {
|
|||||||
auto* referenceDestroyable = m_Parent->GetComponent<DestroyableComponent>();
|
auto* referenceDestroyable = m_Parent->GetComponent<DestroyableComponent>();
|
||||||
|
|
||||||
if (referenceDestroyable == nullptr) {
|
if (referenceDestroyable == nullptr) {
|
||||||
Game::logger->Log("BaseCombatAIComponent", "Invalid reference destroyable component on (%llu)!", m_Parent->GetObjectID());
|
LOG("Invalid reference destroyable component on (%llu)!", m_Parent->GetObjectID());
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include "dZoneManager.h"
|
#include "dZoneManager.h"
|
||||||
#include "SwitchComponent.h"
|
#include "SwitchComponent.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "GameMessages.h"
|
#include "GameMessages.h"
|
||||||
#include <BitStream.h>
|
#include <BitStream.h>
|
||||||
#include "eTriggerEventType.h"
|
#include "eTriggerEventType.h"
|
||||||
@ -81,13 +81,13 @@ void BouncerComponent::LookupPetSwitch() {
|
|||||||
|
|
||||||
Game::entityManager->SerializeEntity(m_Parent);
|
Game::entityManager->SerializeEntity(m_Parent);
|
||||||
|
|
||||||
Game::logger->Log("BouncerComponent", "Loaded pet bouncer");
|
LOG("Loaded pet bouncer");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_PetSwitchLoaded) {
|
if (!m_PetSwitchLoaded) {
|
||||||
Game::logger->Log("BouncerComponent", "Failed to load pet bouncer");
|
LOG("Failed to load pet bouncer");
|
||||||
|
|
||||||
m_Parent->AddCallbackTimer(0.5f, [this]() {
|
m_Parent->AddCallbackTimer(0.5f, [this]() {
|
||||||
LookupPetSwitch();
|
LookupPetSwitch();
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include "DestroyableComponent.h"
|
#include "DestroyableComponent.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "GameMessages.h"
|
#include "GameMessages.h"
|
||||||
#include "SkillComponent.h"
|
#include "SkillComponent.h"
|
||||||
#include "ControllablePhysicsComponent.h"
|
#include "ControllablePhysicsComponent.h"
|
||||||
@ -334,7 +334,7 @@ const std::vector<BuffParameter>& BuffComponent::GetBuffParameters(int32_t buffI
|
|||||||
|
|
||||||
param.values.push_back(value);
|
param.values.push_back(value);
|
||||||
} catch (std::invalid_argument& exception) {
|
} catch (std::invalid_argument& exception) {
|
||||||
Game::logger->Log("BuffComponent", "Failed to parse value (%s): (%s)!", token.c_str(), exception.what());
|
LOG("Failed to parse value (%s): (%s)!", token.c_str(), exception.what());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include "GameMessages.h"
|
#include "GameMessages.h"
|
||||||
#include "Entity.h"
|
#include "Entity.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "InventoryComponent.h"
|
#include "InventoryComponent.h"
|
||||||
#include "Item.h"
|
#include "Item.h"
|
||||||
#include "PropertyManagementComponent.h"
|
#include "PropertyManagementComponent.h"
|
||||||
@ -24,7 +24,7 @@ void BuildBorderComponent::OnUse(Entity* originator) {
|
|||||||
if (!entities.empty()) {
|
if (!entities.empty()) {
|
||||||
buildArea = entities[0]->GetObjectID();
|
buildArea = entities[0]->GetObjectID();
|
||||||
|
|
||||||
Game::logger->Log("BuildBorderComponent", "Using PropertyPlaque");
|
LOG("Using PropertyPlaque");
|
||||||
}
|
}
|
||||||
|
|
||||||
auto* inventoryComponent = originator->GetComponent<InventoryComponent>();
|
auto* inventoryComponent = originator->GetComponent<InventoryComponent>();
|
||||||
@ -41,7 +41,7 @@ void BuildBorderComponent::OnUse(Entity* originator) {
|
|||||||
|
|
||||||
inventoryComponent->PushEquippedItems();
|
inventoryComponent->PushEquippedItems();
|
||||||
|
|
||||||
Game::logger->Log("BuildBorderComponent", "Starting with %llu", buildArea);
|
LOG("Starting with %llu", buildArea);
|
||||||
|
|
||||||
if (PropertyManagementComponent::Instance() != nullptr) {
|
if (PropertyManagementComponent::Instance() != nullptr) {
|
||||||
GameMessages::SendStartArrangingWithItem(
|
GameMessages::SendStartArrangingWithItem(
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include <BitStream.h>
|
#include <BitStream.h>
|
||||||
#include "tinyxml2.h"
|
#include "tinyxml2.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "GeneralUtils.h"
|
#include "GeneralUtils.h"
|
||||||
#include "dServer.h"
|
#include "dServer.h"
|
||||||
#include "dZoneManager.h"
|
#include "dZoneManager.h"
|
||||||
@ -16,6 +16,7 @@
|
|||||||
#include "Amf3.h"
|
#include "Amf3.h"
|
||||||
#include "eGameMasterLevel.h"
|
#include "eGameMasterLevel.h"
|
||||||
#include "eGameActivity.h"
|
#include "eGameActivity.h"
|
||||||
|
#include <ctime>
|
||||||
|
|
||||||
CharacterComponent::CharacterComponent(Entity* parent, Character* character) : Component(parent) {
|
CharacterComponent::CharacterComponent(Entity* parent, Character* character) : Component(parent) {
|
||||||
m_Character = character;
|
m_Character = character;
|
||||||
@ -178,7 +179,7 @@ void CharacterComponent::LoadFromXml(tinyxml2::XMLDocument* doc) {
|
|||||||
|
|
||||||
tinyxml2::XMLElement* character = doc->FirstChildElement("obj")->FirstChildElement("char");
|
tinyxml2::XMLElement* character = doc->FirstChildElement("obj")->FirstChildElement("char");
|
||||||
if (!character) {
|
if (!character) {
|
||||||
Game::logger->Log("CharacterComponent", "Failed to find char tag while loading XML!");
|
LOG("Failed to find char tag while loading XML!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (character->QueryAttribute("rpt", &m_Reputation) == tinyxml2::XML_NO_ATTRIBUTE) {
|
if (character->QueryAttribute("rpt", &m_Reputation) == tinyxml2::XML_NO_ATTRIBUTE) {
|
||||||
@ -283,7 +284,7 @@ void CharacterComponent::LoadFromXml(tinyxml2::XMLDocument* doc) {
|
|||||||
void CharacterComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
|
void CharacterComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
|
||||||
tinyxml2::XMLElement* minifig = doc->FirstChildElement("obj")->FirstChildElement("mf");
|
tinyxml2::XMLElement* minifig = doc->FirstChildElement("obj")->FirstChildElement("mf");
|
||||||
if (!minifig) {
|
if (!minifig) {
|
||||||
Game::logger->Log("CharacterComponent", "Failed to find mf tag while updating XML!");
|
LOG("Failed to find mf tag while updating XML!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -303,7 +304,7 @@ void CharacterComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
|
|||||||
|
|
||||||
tinyxml2::XMLElement* character = doc->FirstChildElement("obj")->FirstChildElement("char");
|
tinyxml2::XMLElement* character = doc->FirstChildElement("obj")->FirstChildElement("char");
|
||||||
if (!character) {
|
if (!character) {
|
||||||
Game::logger->Log("CharacterComponent", "Failed to find char tag while updating XML!");
|
LOG("Failed to find char tag while updating XML!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -351,7 +352,7 @@ void CharacterComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
|
|||||||
//
|
//
|
||||||
|
|
||||||
auto newUpdateTimestamp = std::time(nullptr);
|
auto newUpdateTimestamp = std::time(nullptr);
|
||||||
Game::logger->Log("TotalTimePlayed", "Time since last save: %d", newUpdateTimestamp - m_LastUpdateTimestamp);
|
LOG("Time since last save: %d", newUpdateTimestamp - m_LastUpdateTimestamp);
|
||||||
|
|
||||||
m_TotalTimePlayed += newUpdateTimestamp - m_LastUpdateTimestamp;
|
m_TotalTimePlayed += newUpdateTimestamp - m_LastUpdateTimestamp;
|
||||||
character->SetAttribute("time", m_TotalTimePlayed);
|
character->SetAttribute("time", m_TotalTimePlayed);
|
||||||
@ -381,7 +382,7 @@ Item* CharacterComponent::GetRocket(Entity* player) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!rocket) {
|
if (!rocket) {
|
||||||
Game::logger->Log("CharacterComponent", "Unable to find rocket to equip!");
|
LOG("Unable to find rocket to equip!");
|
||||||
return rocket;
|
return rocket;
|
||||||
}
|
}
|
||||||
return rocket;
|
return rocket;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "ControllablePhysicsComponent.h"
|
#include "ControllablePhysicsComponent.h"
|
||||||
#include "Entity.h"
|
#include "Entity.h"
|
||||||
#include "BitStream.h"
|
#include "BitStream.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
|
|
||||||
#include "dpWorld.h"
|
#include "dpWorld.h"
|
||||||
@ -52,7 +52,7 @@ ControllablePhysicsComponent::ControllablePhysicsComponent(Entity* entity) : Phy
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (entity->GetLOT() == 1) {
|
if (entity->GetLOT() == 1) {
|
||||||
Game::logger->Log("ControllablePhysicsComponent", "Using patch to load minifig physics");
|
LOG("Using patch to load minifig physics");
|
||||||
|
|
||||||
float radius = 1.5f;
|
float radius = 1.5f;
|
||||||
m_dpEntity = new dpEntity(m_Parent->GetObjectID(), radius, false);
|
m_dpEntity = new dpEntity(m_Parent->GetObjectID(), radius, false);
|
||||||
@ -161,7 +161,7 @@ void ControllablePhysicsComponent::Serialize(RakNet::BitStream* outBitStream, bo
|
|||||||
void ControllablePhysicsComponent::LoadFromXml(tinyxml2::XMLDocument* doc) {
|
void ControllablePhysicsComponent::LoadFromXml(tinyxml2::XMLDocument* doc) {
|
||||||
tinyxml2::XMLElement* character = doc->FirstChildElement("obj")->FirstChildElement("char");
|
tinyxml2::XMLElement* character = doc->FirstChildElement("obj")->FirstChildElement("char");
|
||||||
if (!character) {
|
if (!character) {
|
||||||
Game::logger->Log("ControllablePhysicsComponent", "Failed to find char tag!");
|
LOG("Failed to find char tag!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,7 +181,7 @@ void ControllablePhysicsComponent::LoadFromXml(tinyxml2::XMLDocument* doc) {
|
|||||||
void ControllablePhysicsComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
|
void ControllablePhysicsComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
|
||||||
tinyxml2::XMLElement* character = doc->FirstChildElement("obj")->FirstChildElement("char");
|
tinyxml2::XMLElement* character = doc->FirstChildElement("obj")->FirstChildElement("char");
|
||||||
if (!character) {
|
if (!character) {
|
||||||
Game::logger->Log("ControllablePhysicsComponent", "Failed to find char tag while updating XML!");
|
LOG("Failed to find char tag while updating XML!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -268,7 +268,7 @@ void ControllablePhysicsComponent::RemovePickupRadiusScale(float value) {
|
|||||||
if (pos != m_ActivePickupRadiusScales.end()) {
|
if (pos != m_ActivePickupRadiusScales.end()) {
|
||||||
m_ActivePickupRadiusScales.erase(pos);
|
m_ActivePickupRadiusScales.erase(pos);
|
||||||
} else {
|
} else {
|
||||||
Game::logger->LogDebug("ControllablePhysicsComponent", "Warning: Could not find pickup radius %f in list of active radii. List has %i active radii.", value, m_ActivePickupRadiusScales.size());
|
LOG_DEBUG("Warning: Could not find pickup radius %f in list of active radii. List has %i active radii.", value, m_ActivePickupRadiusScales.size());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -293,7 +293,7 @@ void ControllablePhysicsComponent::RemoveSpeedboost(float value) {
|
|||||||
if (pos != m_ActiveSpeedBoosts.end()) {
|
if (pos != m_ActiveSpeedBoosts.end()) {
|
||||||
m_ActiveSpeedBoosts.erase(pos);
|
m_ActiveSpeedBoosts.erase(pos);
|
||||||
} else {
|
} else {
|
||||||
Game::logger->LogDebug("ControllablePhysicsComponent", "Warning: Could not find speedboost %f in list of active speedboosts. List has %i active speedboosts.", value, m_ActiveSpeedBoosts.size());
|
LOG_DEBUG("Warning: Could not find speedboost %f in list of active speedboosts. List has %i active speedboosts.", value, m_ActiveSpeedBoosts.size());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,7 +311,7 @@ void ControllablePhysicsComponent::RemoveSpeedboost(float value) {
|
|||||||
|
|
||||||
void ControllablePhysicsComponent::ActivateBubbleBuff(eBubbleType bubbleType, bool specialAnims){
|
void ControllablePhysicsComponent::ActivateBubbleBuff(eBubbleType bubbleType, bool specialAnims){
|
||||||
if (m_IsInBubble) {
|
if (m_IsInBubble) {
|
||||||
Game::logger->Log("ControllablePhysicsComponent", "Already in bubble");
|
LOG("Already in bubble");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_BubbleType = bubbleType;
|
m_BubbleType = bubbleType;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "DestroyableComponent.h"
|
#include "DestroyableComponent.h"
|
||||||
#include <BitStream.h>
|
#include <BitStream.h>
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dConfig.h"
|
#include "dConfig.h"
|
||||||
|
|
||||||
@ -182,7 +182,7 @@ void DestroyableComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsIn
|
|||||||
void DestroyableComponent::LoadFromXml(tinyxml2::XMLDocument* doc) {
|
void DestroyableComponent::LoadFromXml(tinyxml2::XMLDocument* doc) {
|
||||||
tinyxml2::XMLElement* dest = doc->FirstChildElement("obj")->FirstChildElement("dest");
|
tinyxml2::XMLElement* dest = doc->FirstChildElement("obj")->FirstChildElement("dest");
|
||||||
if (!dest) {
|
if (!dest) {
|
||||||
Game::logger->Log("DestroyableComponent", "Failed to find dest tag!");
|
LOG("Failed to find dest tag!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -204,7 +204,7 @@ void DestroyableComponent::LoadFromXml(tinyxml2::XMLDocument* doc) {
|
|||||||
void DestroyableComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
|
void DestroyableComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
|
||||||
tinyxml2::XMLElement* dest = doc->FirstChildElement("obj")->FirstChildElement("dest");
|
tinyxml2::XMLElement* dest = doc->FirstChildElement("obj")->FirstChildElement("dest");
|
||||||
if (!dest) {
|
if (!dest) {
|
||||||
Game::logger->Log("DestroyableComponent", "Failed to find dest tag!");
|
LOG("Failed to find dest tag!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -643,19 +643,19 @@ void DestroyableComponent::Damage(uint32_t damage, const LWOOBJID source, uint32
|
|||||||
|
|
||||||
void DestroyableComponent::Subscribe(LWOOBJID scriptObjId, CppScripts::Script* scriptToAdd) {
|
void DestroyableComponent::Subscribe(LWOOBJID scriptObjId, CppScripts::Script* scriptToAdd) {
|
||||||
m_SubscribedScripts.insert(std::make_pair(scriptObjId, scriptToAdd));
|
m_SubscribedScripts.insert(std::make_pair(scriptObjId, scriptToAdd));
|
||||||
Game::logger->LogDebug("DestroyableComponent", "Added script %llu to entity %llu", scriptObjId, m_Parent->GetObjectID());
|
LOG_DEBUG("Added script %llu to entity %llu", scriptObjId, m_Parent->GetObjectID());
|
||||||
Game::logger->LogDebug("DestroyableComponent", "Number of subscribed scripts %i", m_SubscribedScripts.size());
|
LOG_DEBUG("Number of subscribed scripts %i", m_SubscribedScripts.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DestroyableComponent::Unsubscribe(LWOOBJID scriptObjId) {
|
void DestroyableComponent::Unsubscribe(LWOOBJID scriptObjId) {
|
||||||
auto foundScript = m_SubscribedScripts.find(scriptObjId);
|
auto foundScript = m_SubscribedScripts.find(scriptObjId);
|
||||||
if (foundScript != m_SubscribedScripts.end()) {
|
if (foundScript != m_SubscribedScripts.end()) {
|
||||||
m_SubscribedScripts.erase(foundScript);
|
m_SubscribedScripts.erase(foundScript);
|
||||||
Game::logger->LogDebug("DestroyableComponent", "Removed script %llu from entity %llu", scriptObjId, m_Parent->GetObjectID());
|
LOG_DEBUG("Removed script %llu from entity %llu", scriptObjId, m_Parent->GetObjectID());
|
||||||
} else {
|
} else {
|
||||||
Game::logger->LogDebug("DestroyableComponent", "Tried to remove a script for Entity %llu but script %llu didnt exist", m_Parent->GetObjectID(), scriptObjId);
|
LOG_DEBUG("Tried to remove a script for Entity %llu but script %llu didnt exist", m_Parent->GetObjectID(), scriptObjId);
|
||||||
}
|
}
|
||||||
Game::logger->LogDebug("DestroyableComponent", "Number of subscribed scripts %i", m_SubscribedScripts.size());
|
LOG_DEBUG("Number of subscribed scripts %i", m_SubscribedScripts.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DestroyableComponent::NotifySubscribers(Entity* attacker, uint32_t damage) {
|
void DestroyableComponent::NotifySubscribers(Entity* attacker, uint32_t damage) {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include "Entity.h"
|
#include "Entity.h"
|
||||||
#include "Item.h"
|
#include "Item.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "CDClientManager.h"
|
#include "CDClientManager.h"
|
||||||
#include "../dWorldServer/ObjectIDManager.h"
|
#include "../dWorldServer/ObjectIDManager.h"
|
||||||
#include "MissionComponent.h"
|
#include "MissionComponent.h"
|
||||||
@ -175,14 +175,14 @@ void InventoryComponent::AddItem(
|
|||||||
const bool bound,
|
const bool bound,
|
||||||
int32_t preferredSlot) {
|
int32_t preferredSlot) {
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
Game::logger->Log("InventoryComponent", "Attempted to add 0 of item (%i) to the inventory!", lot);
|
LOG("Attempted to add 0 of item (%i) to the inventory!", lot);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Inventory::IsValidItem(lot)) {
|
if (!Inventory::IsValidItem(lot)) {
|
||||||
if (lot > 0) {
|
if (lot > 0) {
|
||||||
Game::logger->Log("InventoryComponent", "Attempted to add invalid item (%i) to the inventory!", lot);
|
LOG("Attempted to add invalid item (%i) to the inventory!", lot);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -200,7 +200,7 @@ void InventoryComponent::AddItem(
|
|||||||
const auto slot = preferredSlot != -1 && inventory->IsSlotEmpty(preferredSlot) ? preferredSlot : inventory->FindEmptySlot();
|
const auto slot = preferredSlot != -1 && inventory->IsSlotEmpty(preferredSlot) ? preferredSlot : inventory->FindEmptySlot();
|
||||||
|
|
||||||
if (slot == -1) {
|
if (slot == -1) {
|
||||||
Game::logger->Log("InventoryComponent", "Failed to find empty slot for inventory (%i)!", inventoryType);
|
LOG("Failed to find empty slot for inventory (%i)!", inventoryType);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -302,7 +302,7 @@ void InventoryComponent::AddItem(
|
|||||||
|
|
||||||
void InventoryComponent::RemoveItem(const LOT lot, const uint32_t count, eInventoryType inventoryType, const bool ignoreBound) {
|
void InventoryComponent::RemoveItem(const LOT lot, const uint32_t count, eInventoryType inventoryType, const bool ignoreBound) {
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
Game::logger->Log("InventoryComponent", "Attempted to remove 0 of item (%i) from the inventory!", lot);
|
LOG("Attempted to remove 0 of item (%i) from the inventory!", lot);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -496,7 +496,7 @@ void InventoryComponent::LoadXml(tinyxml2::XMLDocument* document) {
|
|||||||
auto* inventoryElement = document->FirstChildElement("obj")->FirstChildElement("inv");
|
auto* inventoryElement = document->FirstChildElement("obj")->FirstChildElement("inv");
|
||||||
|
|
||||||
if (inventoryElement == nullptr) {
|
if (inventoryElement == nullptr) {
|
||||||
Game::logger->Log("InventoryComponent", "Failed to find 'inv' xml element!");
|
LOG("Failed to find 'inv' xml element!");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -504,7 +504,7 @@ void InventoryComponent::LoadXml(tinyxml2::XMLDocument* document) {
|
|||||||
auto* bags = inventoryElement->FirstChildElement("bag");
|
auto* bags = inventoryElement->FirstChildElement("bag");
|
||||||
|
|
||||||
if (bags == nullptr) {
|
if (bags == nullptr) {
|
||||||
Game::logger->Log("InventoryComponent", "Failed to find 'bags' xml element!");
|
LOG("Failed to find 'bags' xml element!");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -530,7 +530,7 @@ void InventoryComponent::LoadXml(tinyxml2::XMLDocument* document) {
|
|||||||
auto* items = inventoryElement->FirstChildElement("items");
|
auto* items = inventoryElement->FirstChildElement("items");
|
||||||
|
|
||||||
if (items == nullptr) {
|
if (items == nullptr) {
|
||||||
Game::logger->Log("InventoryComponent", "Failed to find 'items' xml element!");
|
LOG("Failed to find 'items' xml element!");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -545,7 +545,7 @@ void InventoryComponent::LoadXml(tinyxml2::XMLDocument* document) {
|
|||||||
auto* inventory = GetInventory(static_cast<eInventoryType>(type));
|
auto* inventory = GetInventory(static_cast<eInventoryType>(type));
|
||||||
|
|
||||||
if (inventory == nullptr) {
|
if (inventory == nullptr) {
|
||||||
Game::logger->Log("InventoryComponent", "Failed to find inventory (%i)!", type);
|
LOG("Failed to find inventory (%i)!", type);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -618,7 +618,7 @@ void InventoryComponent::UpdateXml(tinyxml2::XMLDocument* document) {
|
|||||||
auto* inventoryElement = document->FirstChildElement("obj")->FirstChildElement("inv");
|
auto* inventoryElement = document->FirstChildElement("obj")->FirstChildElement("inv");
|
||||||
|
|
||||||
if (inventoryElement == nullptr) {
|
if (inventoryElement == nullptr) {
|
||||||
Game::logger->Log("InventoryComponent", "Failed to find 'inv' xml element!");
|
LOG("Failed to find 'inv' xml element!");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -641,7 +641,7 @@ void InventoryComponent::UpdateXml(tinyxml2::XMLDocument* document) {
|
|||||||
auto* bags = inventoryElement->FirstChildElement("bag");
|
auto* bags = inventoryElement->FirstChildElement("bag");
|
||||||
|
|
||||||
if (bags == nullptr) {
|
if (bags == nullptr) {
|
||||||
Game::logger->Log("InventoryComponent", "Failed to find 'bags' xml element!");
|
LOG("Failed to find 'bags' xml element!");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -660,7 +660,7 @@ void InventoryComponent::UpdateXml(tinyxml2::XMLDocument* document) {
|
|||||||
auto* items = inventoryElement->FirstChildElement("items");
|
auto* items = inventoryElement->FirstChildElement("items");
|
||||||
|
|
||||||
if (items == nullptr) {
|
if (items == nullptr) {
|
||||||
Game::logger->Log("InventoryComponent", "Failed to find 'items' xml element!");
|
LOG("Failed to find 'items' xml element!");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -935,7 +935,7 @@ void InventoryComponent::EquipScripts(Item* equippedItem) {
|
|||||||
CDScriptComponent scriptCompData = scriptCompTable->GetByID(scriptComponentID);
|
CDScriptComponent scriptCompData = scriptCompTable->GetByID(scriptComponentID);
|
||||||
auto* itemScript = CppScripts::GetScript(m_Parent, scriptCompData.script_name);
|
auto* itemScript = CppScripts::GetScript(m_Parent, scriptCompData.script_name);
|
||||||
if (!itemScript) {
|
if (!itemScript) {
|
||||||
Game::logger->Log("InventoryComponent", "null script?");
|
LOG("null script?");
|
||||||
}
|
}
|
||||||
itemScript->OnFactionTriggerItemEquipped(m_Parent, equippedItem->GetId());
|
itemScript->OnFactionTriggerItemEquipped(m_Parent, equippedItem->GetId());
|
||||||
}
|
}
|
||||||
@ -950,7 +950,7 @@ void InventoryComponent::UnequipScripts(Item* unequippedItem) {
|
|||||||
CDScriptComponent scriptCompData = scriptCompTable->GetByID(scriptComponentID);
|
CDScriptComponent scriptCompData = scriptCompTable->GetByID(scriptComponentID);
|
||||||
auto* itemScript = CppScripts::GetScript(m_Parent, scriptCompData.script_name);
|
auto* itemScript = CppScripts::GetScript(m_Parent, scriptCompData.script_name);
|
||||||
if (!itemScript) {
|
if (!itemScript) {
|
||||||
Game::logger->Log("InventoryComponent", "null script?");
|
LOG("null script?");
|
||||||
}
|
}
|
||||||
itemScript->OnFactionTriggerItemUnequipped(m_Parent, unequippedItem->GetId());
|
itemScript->OnFactionTriggerItemUnequipped(m_Parent, unequippedItem->GetId());
|
||||||
}
|
}
|
||||||
@ -1330,7 +1330,7 @@ std::vector<uint32_t> InventoryComponent::FindBuffs(Item* item, bool castOnEquip
|
|||||||
const auto entry = behaviors->GetSkillByID(result.skillID);
|
const auto entry = behaviors->GetSkillByID(result.skillID);
|
||||||
|
|
||||||
if (entry.skillID == 0) {
|
if (entry.skillID == 0) {
|
||||||
Game::logger->Log("InventoryComponent", "Failed to find buff behavior for skill (%i)!", result.skillID);
|
LOG("Failed to find buff behavior for skill (%i)!", result.skillID);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1397,7 +1397,7 @@ std::vector<Item*> InventoryComponent::GenerateProxies(Item* parent) {
|
|||||||
try {
|
try {
|
||||||
lots.push_back(std::stoi(segment));
|
lots.push_back(std::stoi(segment));
|
||||||
} catch (std::invalid_argument& exception) {
|
} catch (std::invalid_argument& exception) {
|
||||||
Game::logger->Log("InventoryComponent", "Failed to parse proxy (%s): (%s)!", segment.c_str(), exception.what());
|
LOG("Failed to parse proxy (%s): (%s)!", segment.c_str(), exception.what());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ LevelProgressionComponent::LevelProgressionComponent(Entity* parent) : Component
|
|||||||
void LevelProgressionComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
|
void LevelProgressionComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
|
||||||
tinyxml2::XMLElement* level = doc->FirstChildElement("obj")->FirstChildElement("lvl");
|
tinyxml2::XMLElement* level = doc->FirstChildElement("obj")->FirstChildElement("lvl");
|
||||||
if (!level) {
|
if (!level) {
|
||||||
Game::logger->Log("LevelProgressionComponent", "Failed to find lvl tag while updating XML!");
|
LOG("Failed to find lvl tag while updating XML!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
level->SetAttribute("l", m_Level);
|
level->SetAttribute("l", m_Level);
|
||||||
@ -27,7 +27,7 @@ void LevelProgressionComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
|
|||||||
void LevelProgressionComponent::LoadFromXml(tinyxml2::XMLDocument* doc) {
|
void LevelProgressionComponent::LoadFromXml(tinyxml2::XMLDocument* doc) {
|
||||||
tinyxml2::XMLElement* level = doc->FirstChildElement("obj")->FirstChildElement("lvl");
|
tinyxml2::XMLElement* level = doc->FirstChildElement("obj")->FirstChildElement("lvl");
|
||||||
if (!level) {
|
if (!level) {
|
||||||
Game::logger->Log("LevelProgressionComponent", "Failed to find lvl tag while loading XML!");
|
LOG("Failed to find lvl tag while loading XML!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
level->QueryAttribute("l", &m_Level);
|
level->QueryAttribute("l", &m_Level);
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "MissionComponent.h"
|
#include "MissionComponent.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "CDClientManager.h"
|
#include "CDClientManager.h"
|
||||||
#include "CDMissionTasksTable.h"
|
#include "CDMissionTasksTable.h"
|
||||||
#include "InventoryComponent.h"
|
#include "InventoryComponent.h"
|
||||||
@ -363,7 +363,7 @@ bool MissionComponent::LookForAchievements(eMissionTaskType type, int32_t value,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} catch (std::invalid_argument& exception) {
|
} catch (std::invalid_argument& exception) {
|
||||||
Game::logger->Log("MissionComponent", "Failed to parse target (%s): (%s)!", token.c_str(), exception.what());
|
LOG("Failed to parse target (%s): (%s)!", token.c_str(), exception.what());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include "GameMessages.h"
|
#include "GameMessages.h"
|
||||||
#include "Entity.h"
|
#include "Entity.h"
|
||||||
#include "MissionComponent.h"
|
#include "MissionComponent.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "MissionPrerequisites.h"
|
#include "MissionPrerequisites.h"
|
||||||
#include "eMissionState.h"
|
#include "eMissionState.h"
|
||||||
@ -82,7 +82,7 @@ void MissionOfferComponent::OfferMissions(Entity* entity, const uint32_t specifi
|
|||||||
auto* missionComponent = static_cast<MissionComponent*>(entity->GetComponent(eReplicaComponentType::MISSION));
|
auto* missionComponent = static_cast<MissionComponent*>(entity->GetComponent(eReplicaComponentType::MISSION));
|
||||||
|
|
||||||
if (!missionComponent) {
|
if (!missionComponent) {
|
||||||
Game::logger->Log("MissionOfferComponent", "Unable to get mission component for Entity %llu", entity->GetObjectID());
|
LOG("Unable to get mission component for Entity %llu", entity->GetObjectID());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,7 +154,7 @@ void MissionOfferComponent::OfferMissions(Entity* entity, const uint32_t specifi
|
|||||||
|
|
||||||
randomMissionPool.push_back(value);
|
randomMissionPool.push_back(value);
|
||||||
} catch (std::invalid_argument& exception) {
|
} catch (std::invalid_argument& exception) {
|
||||||
Game::logger->Log("MissionOfferComponent", "Failed to parse value (%s): (%s)!", token.c_str(), exception.what());
|
LOG("Failed to parse value (%s): (%s)!", token.c_str(), exception.what());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include "GameMessages.h"
|
#include "GameMessages.h"
|
||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "Component.h"
|
#include "Component.h"
|
||||||
#include "eReplicaComponentType.h"
|
#include "eReplicaComponentType.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include "GeneralUtils.h"
|
#include "GeneralUtils.h"
|
||||||
#include "dZoneManager.h"
|
#include "dZoneManager.h"
|
||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "GameMessages.h"
|
#include "GameMessages.h"
|
||||||
#include "CppScripts.h"
|
#include "CppScripts.h"
|
||||||
#include "SimplePhysicsComponent.h"
|
#include "SimplePhysicsComponent.h"
|
||||||
@ -63,7 +63,7 @@ MovingPlatformComponent::MovingPlatformComponent(Entity* parent, const std::stri
|
|||||||
m_NoAutoStart = false;
|
m_NoAutoStart = false;
|
||||||
|
|
||||||
if (m_Path == nullptr) {
|
if (m_Path == nullptr) {
|
||||||
Game::logger->Log("MovingPlatformComponent", "Path not found: %s", pathName.c_str());
|
LOG("Path not found: %s", pathName.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,7 +240,7 @@ void PetComponent::OnUse(Entity* originator) {
|
|||||||
|
|
||||||
if (bricks.empty()) {
|
if (bricks.empty()) {
|
||||||
ChatPackets::SendSystemMessage(originator->GetSystemAddress(), u"Failed to load the puzzle minigame for this pet.");
|
ChatPackets::SendSystemMessage(originator->GetSystemAddress(), u"Failed to load the puzzle minigame for this pet.");
|
||||||
Game::logger->Log("PetComponent", "Couldn't find %s for minigame!", buildFile.c_str());
|
LOG("Couldn't find %s for minigame!", buildFile.c_str());
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -647,7 +647,7 @@ void PetComponent::RequestSetPetName(std::u16string name) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::logger->Log("PetComponent", "Got set pet name (%s)", GeneralUtils::UTF16ToWTF8(name).c_str());
|
LOG("Got set pet name (%s)", GeneralUtils::UTF16ToWTF8(name).c_str());
|
||||||
|
|
||||||
auto* inventoryComponent = tamer->GetComponent<InventoryComponent>();
|
auto* inventoryComponent = tamer->GetComponent<InventoryComponent>();
|
||||||
|
|
||||||
@ -923,7 +923,7 @@ void PetComponent::AddDrainImaginationTimer(Item* item, bool fromTaming) {
|
|||||||
// Set this to a variable so when this is called back from the player the timer doesn't fire off.
|
// Set this to a variable so when this is called back from the player the timer doesn't fire off.
|
||||||
m_Parent->AddCallbackTimer(imaginationDrainRate, [playerDestroyableComponent, this, item]() {
|
m_Parent->AddCallbackTimer(imaginationDrainRate, [playerDestroyableComponent, this, item]() {
|
||||||
if (!playerDestroyableComponent) {
|
if (!playerDestroyableComponent) {
|
||||||
Game::logger->Log("PetComponent", "No petComponent and/or no playerDestroyableComponent");
|
LOG("No petComponent and/or no playerDestroyableComponent");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include "PhantomPhysicsComponent.h"
|
#include "PhantomPhysicsComponent.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "LDFFormat.h"
|
#include "LDFFormat.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "Entity.h"
|
#include "Entity.h"
|
||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "ControllablePhysicsComponent.h"
|
#include "ControllablePhysicsComponent.h"
|
||||||
@ -223,7 +223,7 @@ PhantomPhysicsComponent::PhantomPhysicsComponent(Entity* parent) : PhysicsCompon
|
|||||||
m_dpEntity->SetPosition(m_Position);
|
m_dpEntity->SetPosition(m_Position);
|
||||||
dpWorld::Instance().AddEntity(m_dpEntity);
|
dpWorld::Instance().AddEntity(m_dpEntity);
|
||||||
} else {
|
} else {
|
||||||
//Game::logger->Log("PhantomPhysicsComponent", "This one is supposed to have %s", info->physicsAsset.c_str());
|
//LOG("This one is supposed to have %s", info->physicsAsset.c_str());
|
||||||
|
|
||||||
//add fallback cube:
|
//add fallback cube:
|
||||||
m_dpEntity = new dpEntity(m_Parent->GetObjectID(), 2.0f, 2.0f, 2.0f);
|
m_dpEntity = new dpEntity(m_Parent->GetObjectID(), 2.0f, 2.0f, 2.0f);
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#include "RocketLaunchpadControlComponent.h"
|
#include "RocketLaunchpadControlComponent.h"
|
||||||
#include "CharacterComponent.h"
|
#include "CharacterComponent.h"
|
||||||
#include "UserManager.h"
|
#include "UserManager.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "Amf3.h"
|
#include "Amf3.h"
|
||||||
#include "eObjectBits.h"
|
#include "eObjectBits.h"
|
||||||
#include "eGameMasterLevel.h"
|
#include "eGameMasterLevel.h"
|
||||||
@ -219,7 +219,7 @@ void PropertyEntranceComponent::OnPropertyEntranceSync(Entity* entity, bool incl
|
|||||||
delete nameLookup;
|
delete nameLookup;
|
||||||
nameLookup = nullptr;
|
nameLookup = nullptr;
|
||||||
|
|
||||||
Game::logger->Log("PropertyEntranceComponent", "Failed to find property owner name for %llu!", cloneId);
|
LOG("Failed to find property owner name for %llu!", cloneId);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
|
@ -123,7 +123,7 @@ std::vector<NiPoint3> PropertyManagementComponent::GetPaths() const {
|
|||||||
|
|
||||||
points.push_back(value);
|
points.push_back(value);
|
||||||
} catch (std::invalid_argument& exception) {
|
} catch (std::invalid_argument& exception) {
|
||||||
Game::logger->Log("PropertyManagementComponent", "Failed to parse value (%s): (%s)!", token.c_str(), exception.what());
|
LOG("Failed to parse value (%s): (%s)!", token.c_str(), exception.what());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,7 +234,7 @@ bool PropertyManagementComponent::Claim(const LWOOBJID playerId) {
|
|||||||
try {
|
try {
|
||||||
insertion->execute();
|
insertion->execute();
|
||||||
} catch (sql::SQLException& exception) {
|
} catch (sql::SQLException& exception) {
|
||||||
Game::logger->Log("PropertyManagementComponent", "Failed to execute query: (%s)!", exception.what());
|
LOG("Failed to execute query: (%s)!", exception.what());
|
||||||
|
|
||||||
throw exception;
|
throw exception;
|
||||||
return false;
|
return false;
|
||||||
@ -294,7 +294,7 @@ void PropertyManagementComponent::OnFinishBuilding() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PropertyManagementComponent::UpdateModelPosition(const LWOOBJID id, const NiPoint3 position, NiQuaternion rotation) {
|
void PropertyManagementComponent::UpdateModelPosition(const LWOOBJID id, const NiPoint3 position, NiQuaternion rotation) {
|
||||||
Game::logger->Log("PropertyManagementComponent", "Placing model <%f, %f, %f>", position.x, position.y, position.z);
|
LOG("Placing model <%f, %f, %f>", position.x, position.y, position.z);
|
||||||
|
|
||||||
auto* entity = GetOwner();
|
auto* entity = GetOwner();
|
||||||
|
|
||||||
@ -311,7 +311,7 @@ void PropertyManagementComponent::UpdateModelPosition(const LWOOBJID id, const N
|
|||||||
auto* item = inventoryComponent->FindItemById(id);
|
auto* item = inventoryComponent->FindItemById(id);
|
||||||
|
|
||||||
if (item == nullptr) {
|
if (item == nullptr) {
|
||||||
Game::logger->Log("PropertyManagementComponent", "Failed to find item with id %d", id);
|
LOG("Failed to find item with id %d", id);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -409,7 +409,7 @@ void PropertyManagementComponent::UpdateModelPosition(const LWOOBJID id, const N
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PropertyManagementComponent::DeleteModel(const LWOOBJID id, const int deleteReason) {
|
void PropertyManagementComponent::DeleteModel(const LWOOBJID id, const int deleteReason) {
|
||||||
Game::logger->Log("PropertyManagementComponent", "Delete model: (%llu) (%i)", id, deleteReason);
|
LOG("Delete model: (%llu) (%i)", id, deleteReason);
|
||||||
|
|
||||||
auto* entity = GetOwner();
|
auto* entity = GetOwner();
|
||||||
|
|
||||||
@ -426,7 +426,7 @@ void PropertyManagementComponent::DeleteModel(const LWOOBJID id, const int delet
|
|||||||
const auto index = models.find(id);
|
const auto index = models.find(id);
|
||||||
|
|
||||||
if (index == models.end()) {
|
if (index == models.end()) {
|
||||||
Game::logger->Log("PropertyManagementComponent", "Failed to find model");
|
LOG("Failed to find model");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -438,20 +438,20 @@ void PropertyManagementComponent::DeleteModel(const LWOOBJID id, const int delet
|
|||||||
models.erase(id);
|
models.erase(id);
|
||||||
|
|
||||||
if (spawner == nullptr) {
|
if (spawner == nullptr) {
|
||||||
Game::logger->Log("PropertyManagementComponent", "Failed to find spawner");
|
LOG("Failed to find spawner");
|
||||||
}
|
}
|
||||||
|
|
||||||
auto* model = Game::entityManager->GetEntity(id);
|
auto* model = Game::entityManager->GetEntity(id);
|
||||||
|
|
||||||
if (model == nullptr) {
|
if (model == nullptr) {
|
||||||
Game::logger->Log("PropertyManagementComponent", "Failed to find model entity");
|
LOG("Failed to find model entity");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::entityManager->DestructEntity(model);
|
Game::entityManager->DestructEntity(model);
|
||||||
|
|
||||||
Game::logger->Log("PropertyManagementComponent", "Deleting model LOT %i", model->GetLOT());
|
LOG("Deleting model LOT %i", model->GetLOT());
|
||||||
|
|
||||||
if (model->GetLOT() == 14) {
|
if (model->GetLOT() == 14) {
|
||||||
//add it to the inv
|
//add it to the inv
|
||||||
@ -534,13 +534,13 @@ void PropertyManagementComponent::DeleteModel(const LWOOBJID id, const int delet
|
|||||||
{
|
{
|
||||||
item->SetCount(item->GetCount() - 1);
|
item->SetCount(item->GetCount() - 1);
|
||||||
|
|
||||||
Game::logger->Log("BODGE TIME", "YES IT GOES HERE");
|
LOG("YES IT GOES HERE");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
Game::logger->Log("PropertyManagementComponent", "Invalid delete reason");
|
LOG("Invalid delete reason");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -679,7 +679,7 @@ void PropertyManagementComponent::Save() {
|
|||||||
try {
|
try {
|
||||||
lookupResult = lookup->executeQuery();
|
lookupResult = lookup->executeQuery();
|
||||||
} catch (sql::SQLException& ex) {
|
} catch (sql::SQLException& ex) {
|
||||||
Game::logger->Log("PropertyManagementComponent", "lookup error %s", ex.what());
|
LOG("lookup error %s", ex.what());
|
||||||
}
|
}
|
||||||
std::vector<LWOOBJID> present;
|
std::vector<LWOOBJID> present;
|
||||||
|
|
||||||
@ -729,7 +729,7 @@ void PropertyManagementComponent::Save() {
|
|||||||
try {
|
try {
|
||||||
insertion->execute();
|
insertion->execute();
|
||||||
} catch (sql::SQLException& ex) {
|
} catch (sql::SQLException& ex) {
|
||||||
Game::logger->Log("PropertyManagementComponent", "Error inserting into properties_contents. Error %s", ex.what());
|
LOG("Error inserting into properties_contents. Error %s", ex.what());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
update->setDouble(1, position.x);
|
update->setDouble(1, position.x);
|
||||||
@ -744,7 +744,7 @@ void PropertyManagementComponent::Save() {
|
|||||||
try {
|
try {
|
||||||
update->executeUpdate();
|
update->executeUpdate();
|
||||||
} catch (sql::SQLException& ex) {
|
} catch (sql::SQLException& ex) {
|
||||||
Game::logger->Log("PropertyManagementComponent", "Error updating properties_contents. Error: %s", ex.what());
|
LOG("Error updating properties_contents. Error: %s", ex.what());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -758,7 +758,7 @@ void PropertyManagementComponent::Save() {
|
|||||||
try {
|
try {
|
||||||
remove->execute();
|
remove->execute();
|
||||||
} catch (sql::SQLException& ex) {
|
} catch (sql::SQLException& ex) {
|
||||||
Game::logger->Log("PropertyManagementComponent", "Error removing from properties_contents. Error %s", ex.what());
|
LOG("Error removing from properties_contents. Error %s", ex.what());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -789,7 +789,7 @@ void PropertyManagementComponent::OnQueryPropertyData(Entity* originator, const
|
|||||||
const auto& worldId = Game::zoneManager->GetZone()->GetZoneID();
|
const auto& worldId = Game::zoneManager->GetZone()->GetZoneID();
|
||||||
const auto zoneId = worldId.GetMapID();
|
const auto zoneId = worldId.GetMapID();
|
||||||
|
|
||||||
Game::logger->Log("Properties", "Getting property info for %d", zoneId);
|
LOG("Getting property info for %d", zoneId);
|
||||||
GameMessages::PropertyDataMessage message = GameMessages::PropertyDataMessage(zoneId);
|
GameMessages::PropertyDataMessage message = GameMessages::PropertyDataMessage(zoneId);
|
||||||
|
|
||||||
const auto isClaimed = GetOwnerId() != LWOOBJID_EMPTY;
|
const auto isClaimed = GetOwnerId() != LWOOBJID_EMPTY;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "dZoneManager.h"
|
#include "dZoneManager.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "PropertyManagementComponent.h"
|
#include "PropertyManagementComponent.h"
|
||||||
#include "UserManager.h"
|
#include "UserManager.h"
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ void PropertyVendorComponent::OnUse(Entity* originator) {
|
|||||||
OnQueryPropertyData(originator, originator->GetSystemAddress());
|
OnQueryPropertyData(originator, originator->GetSystemAddress());
|
||||||
|
|
||||||
if (PropertyManagementComponent::Instance()->GetOwnerId() == LWOOBJID_EMPTY) {
|
if (PropertyManagementComponent::Instance()->GetOwnerId() == LWOOBJID_EMPTY) {
|
||||||
Game::logger->Log("PropertyVendorComponent", "Property vendor opening!");
|
LOG("Property vendor opening!");
|
||||||
|
|
||||||
GameMessages::SendOpenPropertyVendor(m_Parent->GetObjectID(), originator->GetSystemAddress());
|
GameMessages::SendOpenPropertyVendor(m_Parent->GetObjectID(), originator->GetSystemAddress());
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ void PropertyVendorComponent::OnBuyFromVendor(Entity* originator, const bool con
|
|||||||
if (PropertyManagementComponent::Instance() == nullptr) return;
|
if (PropertyManagementComponent::Instance() == nullptr) return;
|
||||||
|
|
||||||
if (PropertyManagementComponent::Instance()->Claim(originator->GetObjectID()) == false) {
|
if (PropertyManagementComponent::Instance()->Claim(originator->GetObjectID()) == false) {
|
||||||
Game::logger->Log("PropertyVendorComponent", "FAILED TO CLAIM PROPERTY. PLAYER ID IS %llu", originator->GetObjectID());
|
LOG("FAILED TO CLAIM PROPERTY. PLAYER ID IS %llu", originator->GetObjectID());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,6 +51,6 @@ void PropertyVendorComponent::OnBuyFromVendor(Entity* originator, const bool con
|
|||||||
|
|
||||||
PropertyManagementComponent::Instance()->OnQueryPropertyData(originator, originator->GetSystemAddress());
|
PropertyManagementComponent::Instance()->OnQueryPropertyData(originator, originator->GetSystemAddress());
|
||||||
|
|
||||||
Game::logger->Log("PropertyVendorComponent", "Fired event; (%d) (%i) (%i)", confirmed, lot, count);
|
LOG("Fired event; (%d) (%i) (%i)", confirmed, lot, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "LeaderboardManager.h"
|
#include "LeaderboardManager.h"
|
||||||
#include "dZoneManager.h"
|
#include "dZoneManager.h"
|
||||||
#include "CDActivitiesTable.h"
|
#include "CDActivitiesTable.h"
|
||||||
|
#include <ctime>
|
||||||
|
|
||||||
#ifndef M_PI
|
#ifndef M_PI
|
||||||
#define M_PI 3.14159265358979323846264338327950288
|
#define M_PI 3.14159265358979323846264338327950288
|
||||||
@ -79,7 +80,7 @@ void RacingControlComponent::OnPlayerLoaded(Entity* player) {
|
|||||||
|
|
||||||
m_LoadedPlayers++;
|
m_LoadedPlayers++;
|
||||||
|
|
||||||
Game::logger->Log("RacingControlComponent", "Loading player %i",
|
LOG("Loading player %i",
|
||||||
m_LoadedPlayers);
|
m_LoadedPlayers);
|
||||||
m_LobbyPlayers.push_back(player->GetObjectID());
|
m_LobbyPlayers.push_back(player->GetObjectID());
|
||||||
}
|
}
|
||||||
@ -103,7 +104,7 @@ void RacingControlComponent::LoadPlayerVehicle(Entity* player,
|
|||||||
auto* item = inventoryComponent->FindItemByLot(8092);
|
auto* item = inventoryComponent->FindItemByLot(8092);
|
||||||
|
|
||||||
if (item == nullptr) {
|
if (item == nullptr) {
|
||||||
Game::logger->Log("RacingControlComponent", "Failed to find item");
|
LOG("Failed to find item");
|
||||||
auto* playerInstance = dynamic_cast<Player*>(player);
|
auto* playerInstance = dynamic_cast<Player*>(player);
|
||||||
if(playerInstance){
|
if(playerInstance){
|
||||||
m_LoadedPlayers--;
|
m_LoadedPlayers--;
|
||||||
@ -552,12 +553,10 @@ void RacingControlComponent::Update(float deltaTime) {
|
|||||||
// From the first 2 players loading in the rest have a max of 15 seconds
|
// From the first 2 players loading in the rest have a max of 15 seconds
|
||||||
// to load in, can raise this if it's too low
|
// to load in, can raise this if it's too low
|
||||||
if (m_LoadTimer >= 15) {
|
if (m_LoadTimer >= 15) {
|
||||||
Game::logger->Log("RacingControlComponent",
|
LOG("Loading all players...");
|
||||||
"Loading all players...");
|
|
||||||
|
|
||||||
for (size_t positionNumber = 0; positionNumber < m_LobbyPlayers.size(); positionNumber++) {
|
for (size_t positionNumber = 0; positionNumber < m_LobbyPlayers.size(); positionNumber++) {
|
||||||
Game::logger->Log("RacingControlComponent",
|
LOG("Loading player now!");
|
||||||
"Loading player now!");
|
|
||||||
|
|
||||||
auto* player =
|
auto* player =
|
||||||
Game::entityManager->GetEntity(m_LobbyPlayers[positionNumber]);
|
Game::entityManager->GetEntity(m_LobbyPlayers[positionNumber]);
|
||||||
@ -566,8 +565,7 @@ void RacingControlComponent::Update(float deltaTime) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::logger->Log("RacingControlComponent",
|
LOG("Loading player now NOW!");
|
||||||
"Loading player now NOW!");
|
|
||||||
|
|
||||||
LoadPlayerVehicle(player, positionNumber + 1, true);
|
LoadPlayerVehicle(player, positionNumber + 1, true);
|
||||||
|
|
||||||
@ -717,7 +715,7 @@ void RacingControlComponent::Update(float deltaTime) {
|
|||||||
|
|
||||||
m_Started = true;
|
m_Started = true;
|
||||||
|
|
||||||
Game::logger->Log("RacingControlComponent", "Starting race");
|
LOG("Starting race");
|
||||||
|
|
||||||
Game::entityManager->SerializeEntity(m_Parent);
|
Game::entityManager->SerializeEntity(m_Parent);
|
||||||
|
|
||||||
@ -820,8 +818,7 @@ void RacingControlComponent::Update(float deltaTime) {
|
|||||||
if (player.bestLapTime == 0 || player.bestLapTime > lapTime) {
|
if (player.bestLapTime == 0 || player.bestLapTime > lapTime) {
|
||||||
player.bestLapTime = lapTime;
|
player.bestLapTime = lapTime;
|
||||||
|
|
||||||
Game::logger->Log("RacingControlComponent",
|
LOG("Best lap time (%llu)", lapTime);
|
||||||
"Best lap time (%llu)", lapTime);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto* missionComponent =
|
auto* missionComponent =
|
||||||
@ -841,8 +838,7 @@ void RacingControlComponent::Update(float deltaTime) {
|
|||||||
|
|
||||||
player.raceTime = raceTime;
|
player.raceTime = raceTime;
|
||||||
|
|
||||||
Game::logger->Log("RacingControlComponent",
|
LOG("Completed time %llu, %llu",
|
||||||
"Completed time %llu, %llu",
|
|
||||||
raceTime, raceTime * 1000);
|
raceTime, raceTime * 1000);
|
||||||
|
|
||||||
LeaderboardManager::SaveScore(playerEntity->GetObjectID(), m_ActivityID, static_cast<float>(player.raceTime), static_cast<float>(player.bestLapTime), static_cast<float>(player.finished == 1));
|
LeaderboardManager::SaveScore(playerEntity->GetObjectID(), m_ActivityID, static_cast<float>(player.raceTime), static_cast<float>(player.bestLapTime), static_cast<float>(player.finished == 1));
|
||||||
@ -858,13 +854,11 @@ void RacingControlComponent::Update(float deltaTime) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::logger->Log("RacingControlComponent",
|
LOG("Lapped (%i) in (%llu)", player.lap,
|
||||||
"Lapped (%i) in (%llu)", player.lap,
|
|
||||||
lapTime);
|
lapTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::logger->Log("RacingControlComponent",
|
LOG("Reached point (%i)/(%i)", player.respawnIndex,
|
||||||
"Reached point (%i)/(%i)", player.respawnIndex,
|
|
||||||
path->pathWaypoints.size());
|
path->pathWaypoints.size());
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include "GameMessages.h"
|
#include "GameMessages.h"
|
||||||
#include "RebuildComponent.h"
|
#include "RebuildComponent.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "RenderComponent.h"
|
#include "RenderComponent.h"
|
||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "eStateChangeType.h"
|
#include "eStateChangeType.h"
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include "GameMessages.h"
|
#include "GameMessages.h"
|
||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "CharacterComponent.h"
|
#include "CharacterComponent.h"
|
||||||
#include "MissionComponent.h"
|
#include "MissionComponent.h"
|
||||||
#include "eMissionTaskType.h"
|
#include "eMissionTaskType.h"
|
||||||
@ -39,7 +39,7 @@ RebuildComponent::RebuildComponent(Entity* entity) : Component(entity) {
|
|||||||
GeneralUtils::TryParse(positionAsVector[1], m_ActivatorPosition.y) &&
|
GeneralUtils::TryParse(positionAsVector[1], m_ActivatorPosition.y) &&
|
||||||
GeneralUtils::TryParse(positionAsVector[2], m_ActivatorPosition.z)) {
|
GeneralUtils::TryParse(positionAsVector[2], m_ActivatorPosition.z)) {
|
||||||
} else {
|
} else {
|
||||||
Game::logger->Log("RebuildComponent", "Failed to find activator position for lot %i. Defaulting to parents position.", m_Parent->GetLOT());
|
LOG("Failed to find activator position for lot %i. Defaulting to parents position.", m_Parent->GetLOT());
|
||||||
m_ActivatorPosition = m_Parent->GetPosition();
|
m_ActivatorPosition = m_Parent->GetPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -439,7 +439,7 @@ void RebuildComponent::CompleteRebuild(Entity* user) {
|
|||||||
characterComponent->SetCurrentActivity(eGameActivity::NONE);
|
characterComponent->SetCurrentActivity(eGameActivity::NONE);
|
||||||
characterComponent->TrackRebuildComplete();
|
characterComponent->TrackRebuildComplete();
|
||||||
} else {
|
} else {
|
||||||
Game::logger->Log("RebuildComponent", "Some user tried to finish the rebuild but they didn't have a character somehow.");
|
LOG("Some user tried to finish the rebuild but they didn't have a character somehow.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#include "CDClientManager.h"
|
#include "CDClientManager.h"
|
||||||
#include "GameMessages.h"
|
#include "GameMessages.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "CDAnimationsTable.h"
|
#include "CDAnimationsTable.h"
|
||||||
|
|
||||||
std::unordered_map<int32_t, float> RenderComponent::m_DurationCache{};
|
std::unordered_map<int32_t, float> RenderComponent::m_DurationCache{};
|
||||||
@ -32,7 +32,7 @@ RenderComponent::RenderComponent(Entity* parent, int32_t componentId): Component
|
|||||||
for (auto& groupId : groupIdsSplit) {
|
for (auto& groupId : groupIdsSplit) {
|
||||||
int32_t groupIdInt;
|
int32_t groupIdInt;
|
||||||
if (!GeneralUtils::TryParse(groupId, groupIdInt)) {
|
if (!GeneralUtils::TryParse(groupId, groupIdInt)) {
|
||||||
Game::logger->Log("RenderComponent", "bad animation group Id %s", groupId.c_str());
|
LOG("bad animation group Id %s", groupId.c_str());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
m_animationGroupIds.push_back(groupIdInt);
|
m_animationGroupIds.push_back(groupIdInt);
|
||||||
@ -229,6 +229,6 @@ float RenderComponent::DoAnimation(Entity* self, const std::string& animation, b
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sendAnimation) GameMessages::SendPlayAnimation(self, GeneralUtils::ASCIIToUTF16(animation), priority, scale);
|
if (sendAnimation) GameMessages::SendPlayAnimation(self, GeneralUtils::ASCIIToUTF16(animation), priority, scale);
|
||||||
if (returnlength == 0.0f) Game::logger->Log("RenderComponent", "WARNING: Unable to find animation %s for lot %i in any group.", animation.c_str(), self->GetLOT());
|
if (returnlength == 0.0f) LOG("WARNING: Unable to find animation %s for lot %i in any group.", animation.c_str(), self->GetLOT());
|
||||||
return returnlength;
|
return returnlength;
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "Item.h"
|
#include "Item.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "CDClientDatabase.h"
|
#include "CDClientDatabase.h"
|
||||||
#include "ChatPackets.h"
|
#include "ChatPackets.h"
|
||||||
#include "MissionComponent.h"
|
#include "MissionComponent.h"
|
||||||
@ -57,7 +57,7 @@ void RocketLaunchpadControlComponent::Launch(Entity* originator, LWOMAPID mapId,
|
|||||||
|
|
||||||
auto* rocket = characterComponent->GetRocket(originator);
|
auto* rocket = characterComponent->GetRocket(originator);
|
||||||
if (!rocket) {
|
if (!rocket) {
|
||||||
Game::logger->Log("RocketLaunchpadControlComponent", "Unable to find rocket!");
|
LOG("Unable to find rocket!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include "dZoneManager.h"
|
#include "dZoneManager.h"
|
||||||
#include "ZoneInstanceManager.h"
|
#include "ZoneInstanceManager.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include <WorldPackets.h>
|
#include <WorldPackets.h>
|
||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "ChatPackets.h"
|
#include "ChatPackets.h"
|
||||||
@ -273,7 +273,7 @@ void ScriptedActivityComponent::Update(float deltaTime) {
|
|||||||
|
|
||||||
// The timer has elapsed, start the instance
|
// The timer has elapsed, start the instance
|
||||||
if (lobby->timer <= 0.0f) {
|
if (lobby->timer <= 0.0f) {
|
||||||
Game::logger->Log("ScriptedActivityComponent", "Setting up instance.");
|
LOG("Setting up instance.");
|
||||||
ActivityInstance* instance = NewInstance();
|
ActivityInstance* instance = NewInstance();
|
||||||
LoadPlayersIntoInstance(instance, lobby->players);
|
LoadPlayersIntoInstance(instance, lobby->players);
|
||||||
instance->StartZone();
|
instance->StartZone();
|
||||||
@ -539,7 +539,7 @@ void ActivityInstance::StartZone() {
|
|||||||
if (player == nullptr)
|
if (player == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Game::logger->Log("UserManager", "Transferring %s to Zone %i (Instance %i | Clone %i | Mythran Shift: %s) with IP %s and Port %i", player->GetCharacter()->GetName().c_str(), zoneID, zoneInstance, zoneClone, mythranShift == true ? "true" : "false", serverIP.c_str(), serverPort);
|
LOG("Transferring %s to Zone %i (Instance %i | Clone %i | Mythran Shift: %s) with IP %s and Port %i", player->GetCharacter()->GetName().c_str(), zoneID, zoneInstance, zoneClone, mythranShift == true ? "true" : "false", serverIP.c_str(), serverPort);
|
||||||
if (player->GetCharacter()) {
|
if (player->GetCharacter()) {
|
||||||
player->GetCharacter()->SetZoneID(zoneID);
|
player->GetCharacter()->SetZoneID(zoneID);
|
||||||
player->GetCharacter()->SetZoneInstance(zoneInstance);
|
player->GetCharacter()->SetZoneInstance(zoneInstance);
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include "SimplePhysicsComponent.h"
|
#include "SimplePhysicsComponent.h"
|
||||||
#include "BitStream.h"
|
#include "BitStream.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "dpWorld.h"
|
#include "dpWorld.h"
|
||||||
#include "CDClientManager.h"
|
#include "CDClientManager.h"
|
||||||
#include "CDPhysicsComponentTable.h"
|
#include "CDPhysicsComponentTable.h"
|
||||||
|
@ -55,7 +55,7 @@ void SkillComponent::SyncPlayerSkill(const uint32_t skillUid, const uint32_t syn
|
|||||||
const auto index = this->m_managedBehaviors.find(skillUid);
|
const auto index = this->m_managedBehaviors.find(skillUid);
|
||||||
|
|
||||||
if (index == this->m_managedBehaviors.end()) {
|
if (index == this->m_managedBehaviors.end()) {
|
||||||
Game::logger->Log("SkillComponent", "Failed to find skill with uid (%i)!", skillUid, syncId);
|
LOG("Failed to find skill with uid (%i)!", skillUid, syncId);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -80,7 +80,7 @@ void SkillComponent::SyncPlayerProjectile(const LWOOBJID projectileId, RakNet::B
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (index == -1) {
|
if (index == -1) {
|
||||||
Game::logger->Log("SkillComponent", "Failed to find projectile id (%llu)!", projectileId);
|
LOG("Failed to find projectile id (%llu)!", projectileId);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -94,7 +94,7 @@ void SkillComponent::SyncPlayerProjectile(const LWOOBJID projectileId, RakNet::B
|
|||||||
auto result = query.execQuery();
|
auto result = query.execQuery();
|
||||||
|
|
||||||
if (result.eof()) {
|
if (result.eof()) {
|
||||||
Game::logger->Log("SkillComponent", "Failed to find skill id for (%i)!", sync_entry.lot);
|
LOG("Failed to find skill id for (%i)!", sync_entry.lot);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -243,7 +243,7 @@ bool SkillComponent::CastSkill(const uint32_t skillId, LWOOBJID target, const LW
|
|||||||
|
|
||||||
// check to see if we got back a valid behavior
|
// check to see if we got back a valid behavior
|
||||||
if (behaviorId == -1) {
|
if (behaviorId == -1) {
|
||||||
Game::logger->LogDebug("SkillComponent", "Tried to cast skill %i but found no behavior", skillId);
|
LOG_DEBUG("Tried to cast skill %i but found no behavior", skillId);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -401,7 +401,7 @@ void SkillComponent::SyncProjectileCalculation(const ProjectileSyncEntry& entry)
|
|||||||
|
|
||||||
if (other == nullptr) {
|
if (other == nullptr) {
|
||||||
if (entry.branchContext.target != LWOOBJID_EMPTY) {
|
if (entry.branchContext.target != LWOOBJID_EMPTY) {
|
||||||
Game::logger->Log("SkillComponent", "Invalid projectile target (%llu)!", entry.branchContext.target);
|
LOG("Invalid projectile target (%llu)!", entry.branchContext.target);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -413,7 +413,7 @@ void SkillComponent::SyncProjectileCalculation(const ProjectileSyncEntry& entry)
|
|||||||
auto result = query.execQuery();
|
auto result = query.execQuery();
|
||||||
|
|
||||||
if (result.eof()) {
|
if (result.eof()) {
|
||||||
Game::logger->Log("SkillComponent", "Failed to find skill id for (%i)!", entry.lot);
|
LOG("Failed to find skill id for (%i)!", entry.lot);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#include "BitStream.h"
|
#include "BitStream.h"
|
||||||
#include "Component.h"
|
#include "Component.h"
|
||||||
#include "Entity.h"
|
#include "Entity.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "eReplicaComponentType.h"
|
#include "eReplicaComponentType.h"
|
||||||
|
|
||||||
struct ProjectileSyncEntry {
|
struct ProjectileSyncEntry {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "SoundTriggerComponent.h"
|
#include "SoundTriggerComponent.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
|
|
||||||
void MusicCue::Serialize(RakNet::BitStream* outBitStream){
|
void MusicCue::Serialize(RakNet::BitStream* outBitStream){
|
||||||
outBitStream->Write<uint8_t>(name.size());
|
outBitStream->Write<uint8_t>(name.size());
|
||||||
|
@ -155,7 +155,7 @@ void TriggerComponent::HandleTriggerCommand(LUTriggers::Command* command, Entity
|
|||||||
case eTriggerCommandType::DEACTIVATE_MIXER_PROGRAM: break;
|
case eTriggerCommandType::DEACTIVATE_MIXER_PROGRAM: break;
|
||||||
// DEPRECATED BLOCK END
|
// DEPRECATED BLOCK END
|
||||||
default:
|
default:
|
||||||
Game::logger->LogDebug("TriggerComponent", "Event %i was not handled!", command->id);
|
LOG_DEBUG("Event %i was not handled!", command->id);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -198,7 +198,7 @@ void TriggerComponent::HandleDestroyObject(Entity* targetEntity, std::string arg
|
|||||||
void TriggerComponent::HandleToggleTrigger(Entity* targetEntity, std::string args){
|
void TriggerComponent::HandleToggleTrigger(Entity* targetEntity, std::string args){
|
||||||
auto* triggerComponent = targetEntity->GetComponent<TriggerComponent>();
|
auto* triggerComponent = targetEntity->GetComponent<TriggerComponent>();
|
||||||
if (!triggerComponent) {
|
if (!triggerComponent) {
|
||||||
Game::logger->LogDebug("TriggerComponent::HandleToggleTrigger", "Trigger component not found!");
|
LOG_DEBUG("Trigger component not found!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
triggerComponent->SetTriggerEnabled(args == "1");
|
triggerComponent->SetTriggerEnabled(args == "1");
|
||||||
@ -207,7 +207,7 @@ void TriggerComponent::HandleToggleTrigger(Entity* targetEntity, std::string arg
|
|||||||
void TriggerComponent::HandleResetRebuild(Entity* targetEntity, std::string args){
|
void TriggerComponent::HandleResetRebuild(Entity* targetEntity, std::string args){
|
||||||
auto* rebuildComponent = targetEntity->GetComponent<RebuildComponent>();
|
auto* rebuildComponent = targetEntity->GetComponent<RebuildComponent>();
|
||||||
if (!rebuildComponent) {
|
if (!rebuildComponent) {
|
||||||
Game::logger->LogDebug("TriggerComponent::HandleResetRebuild", "Rebuild component not found!");
|
LOG_DEBUG("Rebuild component not found!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
rebuildComponent->ResetRebuild(args == "1");
|
rebuildComponent->ResetRebuild(args == "1");
|
||||||
@ -239,7 +239,7 @@ void TriggerComponent::HandlePushObject(Entity* targetEntity, std::vector<std::s
|
|||||||
|
|
||||||
auto* phantomPhysicsComponent = m_Parent->GetComponent<PhantomPhysicsComponent>();
|
auto* phantomPhysicsComponent = m_Parent->GetComponent<PhantomPhysicsComponent>();
|
||||||
if (!phantomPhysicsComponent) {
|
if (!phantomPhysicsComponent) {
|
||||||
Game::logger->LogDebug("TriggerComponent::HandlePushObject", "Phantom Physics component not found!");
|
LOG_DEBUG("Phantom Physics component not found!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
phantomPhysicsComponent->SetPhysicsEffectActive(true);
|
phantomPhysicsComponent->SetPhysicsEffectActive(true);
|
||||||
@ -256,7 +256,7 @@ void TriggerComponent::HandlePushObject(Entity* targetEntity, std::vector<std::s
|
|||||||
void TriggerComponent::HandleRepelObject(Entity* targetEntity, std::string args){
|
void TriggerComponent::HandleRepelObject(Entity* targetEntity, std::string args){
|
||||||
auto* phantomPhysicsComponent = m_Parent->GetComponent<PhantomPhysicsComponent>();
|
auto* phantomPhysicsComponent = m_Parent->GetComponent<PhantomPhysicsComponent>();
|
||||||
if (!phantomPhysicsComponent) {
|
if (!phantomPhysicsComponent) {
|
||||||
Game::logger->LogDebug("TriggerComponent::HandleRepelObject", "Phantom Physics component not found!");
|
LOG_DEBUG("Phantom Physics component not found!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
float forceMultiplier;
|
float forceMultiplier;
|
||||||
@ -279,7 +279,7 @@ void TriggerComponent::HandleRepelObject(Entity* targetEntity, std::string args)
|
|||||||
|
|
||||||
void TriggerComponent::HandleSetTimer(Entity* targetEntity, std::vector<std::string> argArray){
|
void TriggerComponent::HandleSetTimer(Entity* targetEntity, std::vector<std::string> argArray){
|
||||||
if (argArray.size() != 2) {
|
if (argArray.size() != 2) {
|
||||||
Game::logger->LogDebug("TriggerComponent::HandleSetTimer", "Not ehought variables!");
|
LOG_DEBUG("Not ehought variables!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
float time = 0.0;
|
float time = 0.0;
|
||||||
@ -320,7 +320,7 @@ void TriggerComponent::HandlePlayCinematic(Entity* targetEntity, std::vector<std
|
|||||||
void TriggerComponent::HandleToggleBBB(Entity* targetEntity, std::string args) {
|
void TriggerComponent::HandleToggleBBB(Entity* targetEntity, std::string args) {
|
||||||
auto* character = targetEntity->GetCharacter();
|
auto* character = targetEntity->GetCharacter();
|
||||||
if (!character) {
|
if (!character) {
|
||||||
Game::logger->LogDebug("TriggerComponent::HandleToggleBBB", "Character was not found!");
|
LOG_DEBUG("Character was not found!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bool buildMode = !(character->GetBuildMode());
|
bool buildMode = !(character->GetBuildMode());
|
||||||
@ -336,7 +336,7 @@ void TriggerComponent::HandleUpdateMission(Entity* targetEntity, std::vector<std
|
|||||||
if (argArray.at(0) != "exploretask") return;
|
if (argArray.at(0) != "exploretask") return;
|
||||||
MissionComponent* missionComponent = targetEntity->GetComponent<MissionComponent>();
|
MissionComponent* missionComponent = targetEntity->GetComponent<MissionComponent>();
|
||||||
if (!missionComponent){
|
if (!missionComponent){
|
||||||
Game::logger->LogDebug("TriggerComponent::HandleUpdateMission", "Mission component not found!");
|
LOG_DEBUG("Mission component not found!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
missionComponent->Progress(eMissionTaskType::EXPLORE, 0, 0, argArray.at(4));
|
missionComponent->Progress(eMissionTaskType::EXPLORE, 0, 0, argArray.at(4));
|
||||||
@ -355,7 +355,7 @@ void TriggerComponent::HandlePlayEffect(Entity* targetEntity, std::vector<std::s
|
|||||||
void TriggerComponent::HandleCastSkill(Entity* targetEntity, std::string args){
|
void TriggerComponent::HandleCastSkill(Entity* targetEntity, std::string args){
|
||||||
auto* skillComponent = targetEntity->GetComponent<SkillComponent>();
|
auto* skillComponent = targetEntity->GetComponent<SkillComponent>();
|
||||||
if (!skillComponent) {
|
if (!skillComponent) {
|
||||||
Game::logger->LogDebug("TriggerComponent::HandleCastSkill", "Skill component not found!");
|
LOG_DEBUG("Skill component not found!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uint32_t skillId;
|
uint32_t skillId;
|
||||||
@ -366,7 +366,7 @@ void TriggerComponent::HandleCastSkill(Entity* targetEntity, std::string args){
|
|||||||
void TriggerComponent::HandleSetPhysicsVolumeEffect(Entity* targetEntity, std::vector<std::string> argArray) {
|
void TriggerComponent::HandleSetPhysicsVolumeEffect(Entity* targetEntity, std::vector<std::string> argArray) {
|
||||||
auto* phantomPhysicsComponent = targetEntity->GetComponent<PhantomPhysicsComponent>();
|
auto* phantomPhysicsComponent = targetEntity->GetComponent<PhantomPhysicsComponent>();
|
||||||
if (!phantomPhysicsComponent) {
|
if (!phantomPhysicsComponent) {
|
||||||
Game::logger->LogDebug("TriggerComponent::HandleSetPhysicsVolumeEffect", "Phantom Physics component not found!");
|
LOG_DEBUG("Phantom Physics component not found!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
phantomPhysicsComponent->SetPhysicsEffectActive(true);
|
phantomPhysicsComponent->SetPhysicsEffectActive(true);
|
||||||
@ -401,7 +401,7 @@ void TriggerComponent::HandleSetPhysicsVolumeEffect(Entity* targetEntity, std::v
|
|||||||
void TriggerComponent::HandleSetPhysicsVolumeStatus(Entity* targetEntity, std::string args) {
|
void TriggerComponent::HandleSetPhysicsVolumeStatus(Entity* targetEntity, std::string args) {
|
||||||
auto* phantomPhysicsComponent = targetEntity->GetComponent<PhantomPhysicsComponent>();
|
auto* phantomPhysicsComponent = targetEntity->GetComponent<PhantomPhysicsComponent>();
|
||||||
if (!phantomPhysicsComponent) {
|
if (!phantomPhysicsComponent) {
|
||||||
Game::logger->LogDebug("TriggerComponent::HandleSetPhysicsVolumeEffect", "Phantom Physics component not found!");
|
LOG_DEBUG("Phantom Physics component not found!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
phantomPhysicsComponent->SetPhysicsEffectActive(args == "On");
|
phantomPhysicsComponent->SetPhysicsEffectActive(args == "On");
|
||||||
@ -438,6 +438,6 @@ void TriggerComponent::HandleActivatePhysics(Entity* targetEntity, std::string a
|
|||||||
} else if (args == "false"){
|
} else if (args == "false"){
|
||||||
// TODO remove Phsyics entity if there is one
|
// TODO remove Phsyics entity if there is one
|
||||||
} else {
|
} else {
|
||||||
Game::logger->LogDebug("TriggerComponent", "Invalid argument for ActivatePhysics Trigger: %s", args.c_str());
|
LOG_DEBUG("Invalid argument for ActivatePhysics Trigger: %s", args.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ void VendorComponent::RefreshInventory(bool isCreation) {
|
|||||||
if (!m_HasStandardCostItems || !m_HasMultiCostItems) {
|
if (!m_HasStandardCostItems || !m_HasMultiCostItems) {
|
||||||
auto itemComponentID = compRegistryTable->GetByIDAndType(item.itemid, eReplicaComponentType::ITEM, -1);
|
auto itemComponentID = compRegistryTable->GetByIDAndType(item.itemid, eReplicaComponentType::ITEM, -1);
|
||||||
if (itemComponentID == -1) {
|
if (itemComponentID == -1) {
|
||||||
Game::logger->Log("VendorComponent", "Attempted to add item %i with ItemComponent ID -1 to vendor %i inventory. Not adding item!", itemComponentID, m_Parent->GetLOT());
|
LOG("Attempted to add item %i with ItemComponent ID -1 to vendor %i inventory. Not adding item!", itemComponentID, m_Parent->GetLOT());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
auto itemComponent = itemComponentTable->GetItemComponentByID(itemComponentID);
|
auto itemComponent = itemComponentTable->GetItemComponentByID(itemComponentID);
|
||||||
@ -77,7 +77,7 @@ void VendorComponent::RefreshInventory(bool isCreation) {
|
|||||||
if (!m_HasStandardCostItems || !m_HasMultiCostItems) {
|
if (!m_HasStandardCostItems || !m_HasMultiCostItems) {
|
||||||
auto itemComponentID = compRegistryTable->GetByIDAndType(randomItem.itemid, eReplicaComponentType::ITEM, -1);
|
auto itemComponentID = compRegistryTable->GetByIDAndType(randomItem.itemid, eReplicaComponentType::ITEM, -1);
|
||||||
if (itemComponentID == -1) {
|
if (itemComponentID == -1) {
|
||||||
Game::logger->Log("VendorComponent", "Attempted to add item %i with ItemComponent ID -1 to vendor %i inventory. Not adding item!", itemComponentID, m_Parent->GetLOT());
|
LOG("Attempted to add item %i with ItemComponent ID -1 to vendor %i inventory. Not adding item!", itemComponentID, m_Parent->GetLOT());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
auto itemComponent = itemComponentTable->GetItemComponentByID(itemComponentID);
|
auto itemComponent = itemComponentTable->GetItemComponentByID(itemComponentID);
|
||||||
|
@ -47,11 +47,11 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System
|
|||||||
User* usr = UserManager::Instance()->GetUser(sysAddr);
|
User* usr = UserManager::Instance()->GetUser(sysAddr);
|
||||||
|
|
||||||
if (!entity) {
|
if (!entity) {
|
||||||
Game::logger->Log("GameMessageHandler", "Failed to find associated entity (%llu), aborting GM (%X)!", objectID, messageID);
|
LOG("Failed to find associated entity (%llu), aborting GM (%X)!", objectID, messageID);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (messageID != eGameMessageType::READY_FOR_UPDATES) Game::logger->LogDebug("GameMessageHandler", "received game message ID: %i", messageID);
|
if (messageID != eGameMessageType::READY_FOR_UPDATES) LOG_DEBUG("received game message ID: %i", messageID);
|
||||||
|
|
||||||
switch (messageID) {
|
switch (messageID) {
|
||||||
|
|
||||||
@ -167,7 +167,7 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System
|
|||||||
character->OnZoneLoad();
|
character->OnZoneLoad();
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::logger->Log("GameMessageHandler", "Player %s (%llu) loaded.", entity->GetCharacter()->GetName().c_str(), entity->GetObjectID());
|
LOG("Player %s (%llu) loaded.", entity->GetCharacter()->GetName().c_str(), entity->GetObjectID());
|
||||||
|
|
||||||
// After we've done our thing, tell the client they're ready
|
// After we've done our thing, tell the client they're ready
|
||||||
GameMessages::SendPlayerReady(entity, sysAddr);
|
GameMessages::SendPlayerReady(entity, sysAddr);
|
||||||
@ -694,7 +694,7 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System
|
|||||||
GameMessages::HandleCancelDonationOnPlayer(inStream, entity);
|
GameMessages::HandleCancelDonationOnPlayer(inStream, entity);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Game::logger->LogDebug("GameMessageHandler", "Unknown game message ID: %i", messageID);
|
LOG_DEBUG("Unknown game message ID: %i", messageID);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#include "Entity.h"
|
#include "Entity.h"
|
||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "GameMessages.h"
|
#include "GameMessages.h"
|
||||||
#include "../dDatabase/CDClientDatabase.h"
|
#include "../dDatabase/CDClientDatabase.h"
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include "SlashCommandHandler.h"
|
#include "SlashCommandHandler.h"
|
||||||
#include "NiPoint3.h"
|
#include "NiPoint3.h"
|
||||||
#include "NiQuaternion.h"
|
#include "NiQuaternion.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "GeneralUtils.h"
|
#include "GeneralUtils.h"
|
||||||
#include "Character.h"
|
#include "Character.h"
|
||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
@ -156,7 +156,7 @@ void GameMessages::SendTeleport(const LWOOBJID& objectID, const NiPoint3& pos, c
|
|||||||
|
|
||||||
void GameMessages::SendPlayAnimation(Entity* entity, const std::u16string& animationName, float fPriority, float fScale) {
|
void GameMessages::SendPlayAnimation(Entity* entity, const std::u16string& animationName, float fPriority, float fScale) {
|
||||||
if (!entity) {
|
if (!entity) {
|
||||||
Game::logger->Log("SendPlayAnimation", "Trying to play animation, but entity var is nullptr!");
|
LOG("Trying to play animation, but entity var is nullptr!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1631,7 +1631,7 @@ void GameMessages::HandleUpdateShootingGalleryRotation(RakNet::BitStream* inStre
|
|||||||
|
|
||||||
void GameMessages::HandleActivitySummaryLeaderboardData(RakNet::BitStream* instream, Entity* entity,
|
void GameMessages::HandleActivitySummaryLeaderboardData(RakNet::BitStream* instream, Entity* entity,
|
||||||
const SystemAddress& sysAddr) {
|
const SystemAddress& sysAddr) {
|
||||||
Game::logger->Log("AGS", "We got mail!");
|
LOG("We got mail!");
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameMessages::SendActivitySummaryLeaderboardData(const LWOOBJID& objectID, const Leaderboard* leaderboard, const SystemAddress& sysAddr) {
|
void GameMessages::SendActivitySummaryLeaderboardData(const LWOOBJID& objectID, const Leaderboard* leaderboard, const SystemAddress& sysAddr) {
|
||||||
@ -1688,7 +1688,7 @@ void GameMessages::HandleActivityStateChangeRequest(RakNet::BitStream* inStream,
|
|||||||
|
|
||||||
auto* assosiate = Game::entityManager->GetEntity(objectID);
|
auto* assosiate = Game::entityManager->GetEntity(objectID);
|
||||||
|
|
||||||
Game::logger->Log("Activity State Change", "%s [%i, %i] from %i to %i", GeneralUtils::UTF16ToWTF8(stringValue).c_str(), value1, value2, entity->GetLOT(), assosiate != nullptr ? assosiate->GetLOT() : 0);
|
LOG("%s [%i, %i] from %i to %i", GeneralUtils::UTF16ToWTF8(stringValue).c_str(), value1, value2, entity->GetLOT(), assosiate != nullptr ? assosiate->GetLOT() : 0);
|
||||||
|
|
||||||
std::vector<Entity*> scriptedActs = Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::SHOOTING_GALLERY);
|
std::vector<Entity*> scriptedActs = Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::SHOOTING_GALLERY);
|
||||||
for (Entity* scriptEntity : scriptedActs) {
|
for (Entity* scriptEntity : scriptedActs) {
|
||||||
@ -1982,7 +1982,7 @@ void GameMessages::SendDownloadPropertyData(const LWOOBJID objectId, const Prope
|
|||||||
|
|
||||||
data.Serialize(bitStream);
|
data.Serialize(bitStream);
|
||||||
|
|
||||||
Game::logger->Log("SendDownloadPropertyData", "(%llu) sending property data (%d)", objectId, sysAddr == UNASSIGNED_SYSTEM_ADDRESS);
|
LOG("(%llu) sending property data (%d)", objectId, sysAddr == UNASSIGNED_SYSTEM_ADDRESS);
|
||||||
|
|
||||||
if (sysAddr == UNASSIGNED_SYSTEM_ADDRESS) SEND_PACKET_BROADCAST;
|
if (sysAddr == UNASSIGNED_SYSTEM_ADDRESS) SEND_PACKET_BROADCAST;
|
||||||
SEND_PACKET;
|
SEND_PACKET;
|
||||||
@ -2053,7 +2053,7 @@ void GameMessages::SendGetModelsOnProperty(LWOOBJID objectId, std::map<LWOOBJID,
|
|||||||
bitStream.Write(pair.second);
|
bitStream.Write(pair.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::logger->Log("SendGetModelsOnProperty", "Sending property models to (%llu) (%d)", objectId, sysAddr == UNASSIGNED_SYSTEM_ADDRESS);
|
LOG("Sending property models to (%llu) (%d)", objectId, sysAddr == UNASSIGNED_SYSTEM_ADDRESS);
|
||||||
|
|
||||||
if (sysAddr == UNASSIGNED_SYSTEM_ADDRESS) SEND_PACKET_BROADCAST;
|
if (sysAddr == UNASSIGNED_SYSTEM_ADDRESS) SEND_PACKET_BROADCAST;
|
||||||
SEND_PACKET;
|
SEND_PACKET;
|
||||||
@ -2150,7 +2150,7 @@ void GameMessages::HandleSetPropertyAccess(RakNet::BitStream* inStream, Entity*
|
|||||||
inStream->Read(renewIsDefault);
|
inStream->Read(renewIsDefault);
|
||||||
if (renewIsDefault != 0) inStream->Read(renew);
|
if (renewIsDefault != 0) inStream->Read(renew);
|
||||||
|
|
||||||
Game::logger->Log("GameMessages", "Set privacy option to: %i", accessType);
|
LOG("Set privacy option to: %i", accessType);
|
||||||
|
|
||||||
if (PropertyManagementComponent::Instance() == nullptr) return;
|
if (PropertyManagementComponent::Instance() == nullptr) return;
|
||||||
|
|
||||||
@ -2169,7 +2169,7 @@ void GameMessages::HandleUnUseModel(RakNet::BitStream* inStream, Entity* entity,
|
|||||||
if (item) {
|
if (item) {
|
||||||
inventoryComponent->MoveItemToInventory(item, eInventoryType::MODELS, 1);
|
inventoryComponent->MoveItemToInventory(item, eInventoryType::MODELS, 1);
|
||||||
} else {
|
} else {
|
||||||
Game::logger->Log("GameMessages", "item id %llu not found in MODELS_IN_BBB inventory, likely because it does not exist", objIdToAddToInventory);
|
LOG("item id %llu not found in MODELS_IN_BBB inventory, likely because it does not exist", objIdToAddToInventory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2216,7 +2216,7 @@ void GameMessages::HandleUpdatePropertyOrModelForFilterCheck(RakNet::BitStream*
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GameMessages::HandleQueryPropertyData(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) {
|
void GameMessages::HandleQueryPropertyData(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) {
|
||||||
Game::logger->Log("HandleQueryPropertyData", "Entity (%i) requesting data", entity->GetLOT());
|
LOG("Entity (%i) requesting data", entity->GetLOT());
|
||||||
|
|
||||||
/*
|
/*
|
||||||
auto entites = Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::PROPERTY_VENDOR);
|
auto entites = Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::PROPERTY_VENDOR);
|
||||||
@ -2274,7 +2274,7 @@ void GameMessages::HandleSetBuildMode(RakNet::BitStream* inStream, Entity* entit
|
|||||||
|
|
||||||
player->GetCharacter()->SetBuildMode(start);
|
player->GetCharacter()->SetBuildMode(start);
|
||||||
|
|
||||||
Game::logger->Log("GameMessages", "Sending build mode confirm (%i): (%d) (%i) (%d) (%i) (%llu)", entity->GetLOT(), start, distanceType, modePaused, modeValue, playerId);
|
LOG("Sending build mode confirm (%i): (%d) (%i) (%d) (%i) (%llu)", entity->GetLOT(), start, distanceType, modePaused, modeValue, playerId);
|
||||||
|
|
||||||
SendSetBuildModeConfirmed(entity->GetObjectID(), UNASSIGNED_SYSTEM_ADDRESS, start, false, modePaused, modeValue, playerId, startPosition);
|
SendSetBuildModeConfirmed(entity->GetObjectID(), UNASSIGNED_SYSTEM_ADDRESS, start, false, modePaused, modeValue, playerId, startPosition);
|
||||||
}
|
}
|
||||||
@ -2310,7 +2310,7 @@ void GameMessages::HandleStartBuildingWithItem(RakNet::BitStream* inStream, Enti
|
|||||||
sourceType = 4;
|
sourceType = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::logger->Log("GameMessages", "Handling start building with item (%i): (%d) (%d) (%i) (%llu) (%i) (%i) (%llu) (%i) (%i)", entity->GetLOT(), firstTime, success, sourceBag, sourceId, sourceLot, sourceType, targetId, targetLot, targetType);
|
LOG("Handling start building with item (%i): (%d) (%d) (%i) (%llu) (%i) (%i) (%llu) (%i) (%i)", entity->GetLOT(), firstTime, success, sourceBag, sourceId, sourceLot, sourceType, targetId, targetLot, targetType);
|
||||||
|
|
||||||
auto* user = UserManager::Instance()->GetUser(sysAddr);
|
auto* user = UserManager::Instance()->GetUser(sysAddr);
|
||||||
|
|
||||||
@ -2400,7 +2400,7 @@ void GameMessages::HandleBBBLoadItemRequest(RakNet::BitStream* inStream, Entity*
|
|||||||
LWOOBJID previousItemID = LWOOBJID_EMPTY;
|
LWOOBJID previousItemID = LWOOBJID_EMPTY;
|
||||||
inStream->Read(previousItemID);
|
inStream->Read(previousItemID);
|
||||||
|
|
||||||
Game::logger->Log("BBB", "Load item request for: %lld", previousItemID);
|
LOG("Load item request for: %lld", previousItemID);
|
||||||
LWOOBJID newId = previousItemID;
|
LWOOBJID newId = previousItemID;
|
||||||
auto* inventoryComponent = entity->GetComponent<InventoryComponent>();
|
auto* inventoryComponent = entity->GetComponent<InventoryComponent>();
|
||||||
if (inventoryComponent) {
|
if (inventoryComponent) {
|
||||||
@ -2417,7 +2417,7 @@ void GameMessages::HandleBBBLoadItemRequest(RakNet::BitStream* inStream, Entity*
|
|||||||
if (movedItem) newId = movedItem->GetId();
|
if (movedItem) newId = movedItem->GetId();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Game::logger->Log("GameMessages", "item id %llu not found in MODELS inventory, likely because it does not exist", previousItemID);
|
LOG("item id %llu not found in MODELS inventory, likely because it does not exist", previousItemID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2555,7 +2555,7 @@ void GameMessages::HandleBBBSaveRequest(RakNet::BitStream* inStream, Entity* ent
|
|||||||
//int32_t size = ZCompression::Decompress(inData, lxfmlSize, outData, 327680, error);
|
//int32_t size = ZCompression::Decompress(inData, lxfmlSize, outData, 327680, error);
|
||||||
|
|
||||||
//if (size == -1) {
|
//if (size == -1) {
|
||||||
// Game::logger->Log("GameMessages", "Failed to decompress LXFML: (%i)", error);
|
// LOG("Failed to decompress LXFML: (%i)", error);
|
||||||
// return;
|
// return;
|
||||||
//}
|
//}
|
||||||
//
|
//
|
||||||
@ -3304,7 +3304,7 @@ void GameMessages::HandleClientTradeRequest(RakNet::BitStream* inStream, Entity*
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::logger->Log("GameMessages", "Trade request to (%llu)", i64Invitee);
|
LOG("Trade request to (%llu)", i64Invitee);
|
||||||
|
|
||||||
auto* trade = TradingManager::Instance()->GetPlayerTrade(entity->GetObjectID());
|
auto* trade = TradingManager::Instance()->GetPlayerTrade(entity->GetObjectID());
|
||||||
|
|
||||||
@ -3333,7 +3333,7 @@ void GameMessages::HandleClientTradeCancel(RakNet::BitStream* inStream, Entity*
|
|||||||
|
|
||||||
if (trade == nullptr) return;
|
if (trade == nullptr) return;
|
||||||
|
|
||||||
Game::logger->Log("GameMessages", "Trade canceled from (%llu)", entity->GetObjectID());
|
LOG("Trade canceled from (%llu)", entity->GetObjectID());
|
||||||
|
|
||||||
TradingManager::Instance()->CancelTrade(trade->GetTradeId());
|
TradingManager::Instance()->CancelTrade(trade->GetTradeId());
|
||||||
}
|
}
|
||||||
@ -3341,7 +3341,7 @@ void GameMessages::HandleClientTradeCancel(RakNet::BitStream* inStream, Entity*
|
|||||||
void GameMessages::HandleClientTradeAccept(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) {
|
void GameMessages::HandleClientTradeAccept(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) {
|
||||||
bool bFirst = inStream->ReadBit();
|
bool bFirst = inStream->ReadBit();
|
||||||
|
|
||||||
Game::logger->Log("GameMessages", "Trade accepted from (%llu) -> (%d)", entity->GetObjectID(), bFirst);
|
LOG("Trade accepted from (%llu) -> (%d)", entity->GetObjectID(), bFirst);
|
||||||
|
|
||||||
auto* trade = TradingManager::Instance()->GetPlayerTrade(entity->GetObjectID());
|
auto* trade = TradingManager::Instance()->GetPlayerTrade(entity->GetObjectID());
|
||||||
|
|
||||||
@ -3357,7 +3357,7 @@ void GameMessages::HandleClientTradeUpdate(RakNet::BitStream* inStream, Entity*
|
|||||||
inStream->Read(currency);
|
inStream->Read(currency);
|
||||||
inStream->Read(itemCount);
|
inStream->Read(itemCount);
|
||||||
|
|
||||||
Game::logger->Log("GameMessages", "Trade update from (%llu) -> (%llu), (%i)", entity->GetObjectID(), currency, itemCount);
|
LOG("Trade update from (%llu) -> (%llu), (%i)", entity->GetObjectID(), currency, itemCount);
|
||||||
|
|
||||||
std::vector<TradeItem> items{};
|
std::vector<TradeItem> items{};
|
||||||
|
|
||||||
@ -3405,7 +3405,7 @@ void GameMessages::HandleClientTradeUpdate(RakNet::BitStream* inStream, Entity*
|
|||||||
|
|
||||||
items.push_back({ itemId, lot, unknown2 });
|
items.push_back({ itemId, lot, unknown2 });
|
||||||
|
|
||||||
Game::logger->Log("GameMessages", "Trade item from (%llu) -> (%llu)/(%llu), (%i), (%llu), (%i), (%i)", entity->GetObjectID(), itemId, itemId2, lot, unknown1, unknown2, unknown3);
|
LOG("Trade item from (%llu) -> (%llu)/(%llu), (%i), (%llu), (%i), (%i)", entity->GetObjectID(), itemId, itemId2, lot, unknown1, unknown2, unknown3);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto* trade = TradingManager::Instance()->GetPlayerTrade(entity->GetObjectID());
|
auto* trade = TradingManager::Instance()->GetPlayerTrade(entity->GetObjectID());
|
||||||
@ -3848,7 +3848,7 @@ void GameMessages::HandleMessageBoxResponse(RakNet::BitStream* inStream, Entity*
|
|||||||
userData.push_back(character);
|
userData.push_back(character);
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::logger->Log("HandleMessageBoxResponse", "Button: %d; LOT: %u identifier: %s; userData: %s", iButton, entity->GetLOT(), GeneralUtils::UTF16ToWTF8(identifier).c_str(), GeneralUtils::UTF16ToWTF8(userData).c_str());
|
LOG("Button: %d; LOT: %u identifier: %s; userData: %s", iButton, entity->GetLOT(), GeneralUtils::UTF16ToWTF8(identifier).c_str(), GeneralUtils::UTF16ToWTF8(userData).c_str());
|
||||||
|
|
||||||
auto* user = UserManager::Instance()->GetUser(sysAddr);
|
auto* user = UserManager::Instance()->GetUser(sysAddr);
|
||||||
|
|
||||||
@ -3904,7 +3904,7 @@ void GameMessages::HandleChoiceBoxRespond(RakNet::BitStream* inStream, Entity* e
|
|||||||
identifier.push_back(character);
|
identifier.push_back(character);
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::logger->Log("HandleChoiceBoxRespond", "Button: %d; LOT: %u buttonIdentifier: %s; userData: %s", iButton, entity->GetLOT(), GeneralUtils::UTF16ToWTF8(buttonIdentifier).c_str(), GeneralUtils::UTF16ToWTF8(identifier).c_str());
|
LOG("Button: %d; LOT: %u buttonIdentifier: %s; userData: %s", iButton, entity->GetLOT(), GeneralUtils::UTF16ToWTF8(buttonIdentifier).c_str(), GeneralUtils::UTF16ToWTF8(identifier).c_str());
|
||||||
|
|
||||||
auto* user = UserManager::Instance()->GetUser(sysAddr);
|
auto* user = UserManager::Instance()->GetUser(sysAddr);
|
||||||
|
|
||||||
@ -4084,10 +4084,10 @@ void GameMessages::HandleAcknowledgePossession(RakNet::BitStream* inStream, Enti
|
|||||||
void GameMessages::HandleModuleAssemblyQueryData(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) {
|
void GameMessages::HandleModuleAssemblyQueryData(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) {
|
||||||
auto* moduleAssemblyComponent = entity->GetComponent<ModuleAssemblyComponent>();
|
auto* moduleAssemblyComponent = entity->GetComponent<ModuleAssemblyComponent>();
|
||||||
|
|
||||||
Game::logger->Log("HandleModuleAssemblyQueryData", "Got Query from %i", entity->GetLOT());
|
LOG("Got Query from %i", entity->GetLOT());
|
||||||
|
|
||||||
if (moduleAssemblyComponent != nullptr) {
|
if (moduleAssemblyComponent != nullptr) {
|
||||||
Game::logger->Log("HandleModuleAssemblyQueryData", "Returning assembly %s", GeneralUtils::UTF16ToWTF8(moduleAssemblyComponent->GetAssemblyPartsLOTs()).c_str());
|
LOG("Returning assembly %s", GeneralUtils::UTF16ToWTF8(moduleAssemblyComponent->GetAssemblyPartsLOTs()).c_str());
|
||||||
|
|
||||||
SendModuleAssemblyDBDataForClient(entity->GetObjectID(), moduleAssemblyComponent->GetSubKey(), moduleAssemblyComponent->GetAssemblyPartsLOTs(), UNASSIGNED_SYSTEM_ADDRESS);
|
SendModuleAssemblyDBDataForClient(entity->GetObjectID(), moduleAssemblyComponent->GetSubKey(), moduleAssemblyComponent->GetAssemblyPartsLOTs(), UNASSIGNED_SYSTEM_ADDRESS);
|
||||||
}
|
}
|
||||||
@ -4170,7 +4170,7 @@ void GameMessages::HandleRequestDie(RakNet::BitStream* inStream, Entity* entity,
|
|||||||
|
|
||||||
auto* racingControlComponent = zoneController->GetComponent<RacingControlComponent>();
|
auto* racingControlComponent = zoneController->GetComponent<RacingControlComponent>();
|
||||||
|
|
||||||
Game::logger->Log("HandleRequestDie", "Got die request: %i", entity->GetLOT());
|
LOG("Got die request: %i", entity->GetLOT());
|
||||||
|
|
||||||
if (racingControlComponent != nullptr) {
|
if (racingControlComponent != nullptr) {
|
||||||
auto* possessableComponent = entity->GetComponent<PossessableComponent>();
|
auto* possessableComponent = entity->GetComponent<PossessableComponent>();
|
||||||
@ -4213,7 +4213,7 @@ void GameMessages::HandleRacingPlayerInfoResetFinished(RakNet::BitStream* inStre
|
|||||||
|
|
||||||
auto* racingControlComponent = zoneController->GetComponent<RacingControlComponent>();
|
auto* racingControlComponent = zoneController->GetComponent<RacingControlComponent>();
|
||||||
|
|
||||||
Game::logger->Log("HandleRacingPlayerInfoResetFinished", "Got finished: %i", entity->GetLOT());
|
LOG("Got finished: %i", entity->GetLOT());
|
||||||
|
|
||||||
if (racingControlComponent != nullptr) {
|
if (racingControlComponent != nullptr) {
|
||||||
racingControlComponent->OnRacingPlayerInfoResetFinished(player);
|
racingControlComponent->OnRacingPlayerInfoResetFinished(player);
|
||||||
@ -4720,7 +4720,7 @@ void GameMessages::HandleBuyFromVendor(RakNet::BitStream* inStream, Entity* enti
|
|||||||
if (!inv) return;
|
if (!inv) return;
|
||||||
|
|
||||||
if (!isCommendationVendor && !vend->SellsItem(item)) {
|
if (!isCommendationVendor && !vend->SellsItem(item)) {
|
||||||
Game::logger->Log("GameMessages", "User %llu %s tried to buy an item %i from a vendor when they do not sell said item", player->GetObjectID(), user->GetUsername().c_str(), item);
|
LOG("User %llu %s tried to buy an item %i from a vendor when they do not sell said item", player->GetObjectID(), user->GetUsername().c_str(), item);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4974,7 +4974,7 @@ void GameMessages::HandleFireEventServerSide(RakNet::BitStream* inStream, Entity
|
|||||||
mapId = Game::zoneManager->GetZoneID().GetMapID(); // Fallback to sending the player back to the same zone.
|
mapId = Game::zoneManager->GetZoneID().GetMapID(); // Fallback to sending the player back to the same zone.
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::logger->Log("FireEventServerSide", "Player %llu has requested zone transfer to (%i, %i).", sender->GetObjectID(), (int)mapId, (int)cloneId);
|
LOG("Player %llu has requested zone transfer to (%i, %i).", sender->GetObjectID(), (int)mapId, (int)cloneId);
|
||||||
|
|
||||||
auto* character = player->GetCharacter();
|
auto* character = player->GetCharacter();
|
||||||
|
|
||||||
@ -4983,7 +4983,7 @@ void GameMessages::HandleFireEventServerSide(RakNet::BitStream* inStream, Entity
|
|||||||
}
|
}
|
||||||
|
|
||||||
ZoneInstanceManager::Instance()->RequestZoneTransfer(Game::server, mapId, cloneId, false, [=](bool mythranShift, uint32_t zoneID, uint32_t zoneInstance, uint32_t zoneClone, std::string serverIP, uint16_t serverPort) {
|
ZoneInstanceManager::Instance()->RequestZoneTransfer(Game::server, mapId, cloneId, false, [=](bool mythranShift, uint32_t zoneID, uint32_t zoneInstance, uint32_t zoneClone, std::string serverIP, uint16_t serverPort) {
|
||||||
Game::logger->Log("UserManager", "Transferring %s to Zone %i (Instance %i | Clone %i | Mythran Shift: %s) with IP %s and Port %i", character->GetName().c_str(), zoneID, zoneInstance, zoneClone, mythranShift == true ? "true" : "false", serverIP.c_str(), serverPort);
|
LOG("Transferring %s to Zone %i (Instance %i | Clone %i | Mythran Shift: %s) with IP %s and Port %i", character->GetName().c_str(), zoneID, zoneInstance, zoneClone, mythranShift == true ? "true" : "false", serverIP.c_str(), serverPort);
|
||||||
|
|
||||||
if (character) {
|
if (character) {
|
||||||
character->SetZoneID(zoneID);
|
character->SetZoneID(zoneID);
|
||||||
@ -5033,7 +5033,7 @@ void GameMessages::HandleRequestUse(RakNet::BitStream* inStream, Entity* entity,
|
|||||||
Entity* interactedObject = Game::entityManager->GetEntity(objectID);
|
Entity* interactedObject = Game::entityManager->GetEntity(objectID);
|
||||||
|
|
||||||
if (interactedObject == nullptr) {
|
if (interactedObject == nullptr) {
|
||||||
Game::logger->Log("GameMessages", "Object %llu tried to interact, but doesn't exist!", objectID);
|
LOG("Object %llu tried to interact, but doesn't exist!", objectID);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -5072,7 +5072,7 @@ void GameMessages::HandlePlayEmote(RakNet::BitStream* inStream, Entity* entity)
|
|||||||
inStream->Read(emoteID);
|
inStream->Read(emoteID);
|
||||||
inStream->Read(targetID);
|
inStream->Read(targetID);
|
||||||
|
|
||||||
Game::logger->LogDebug("GameMessages", "Emote (%i) (%llu)", emoteID, targetID);
|
LOG_DEBUG("Emote (%i) (%llu)", emoteID, targetID);
|
||||||
|
|
||||||
//TODO: If targetID != 0, and we have one of the "perform emote" missions, complete them.
|
//TODO: If targetID != 0, and we have one of the "perform emote" missions, complete them.
|
||||||
|
|
||||||
@ -5085,14 +5085,14 @@ void GameMessages::HandlePlayEmote(RakNet::BitStream* inStream, Entity* entity)
|
|||||||
if (targetID != LWOOBJID_EMPTY) {
|
if (targetID != LWOOBJID_EMPTY) {
|
||||||
auto* targetEntity = Game::entityManager->GetEntity(targetID);
|
auto* targetEntity = Game::entityManager->GetEntity(targetID);
|
||||||
|
|
||||||
Game::logger->LogDebug("GameMessages", "Emote target found (%d)", targetEntity != nullptr);
|
LOG_DEBUG("Emote target found (%d)", targetEntity != nullptr);
|
||||||
|
|
||||||
if (targetEntity != nullptr) {
|
if (targetEntity != nullptr) {
|
||||||
targetEntity->OnEmoteReceived(emoteID, entity);
|
targetEntity->OnEmoteReceived(emoteID, entity);
|
||||||
missionComponent->Progress(eMissionTaskType::EMOTE, emoteID, targetID);
|
missionComponent->Progress(eMissionTaskType::EMOTE, emoteID, targetID);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Game::logger->LogDebug("GameMessages", "Target ID is empty, using backup");
|
LOG_DEBUG("Target ID is empty, using backup");
|
||||||
const auto scriptedEntities = Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::SCRIPT);
|
const auto scriptedEntities = Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::SCRIPT);
|
||||||
|
|
||||||
const auto& referencePoint = entity->GetPosition();
|
const auto& referencePoint = entity->GetPosition();
|
||||||
@ -5168,7 +5168,7 @@ void GameMessages::HandleRespondToMission(RakNet::BitStream* inStream, Entity* e
|
|||||||
|
|
||||||
MissionComponent* missionComponent = static_cast<MissionComponent*>(entity->GetComponent(eReplicaComponentType::MISSION));
|
MissionComponent* missionComponent = static_cast<MissionComponent*>(entity->GetComponent(eReplicaComponentType::MISSION));
|
||||||
if (!missionComponent) {
|
if (!missionComponent) {
|
||||||
Game::logger->Log("GameMessages", "Unable to get mission component for entity %llu to handle RespondToMission", playerID);
|
LOG("Unable to get mission component for entity %llu to handle RespondToMission", playerID);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5176,13 +5176,13 @@ void GameMessages::HandleRespondToMission(RakNet::BitStream* inStream, Entity* e
|
|||||||
if (mission) {
|
if (mission) {
|
||||||
mission->SetReward(reward);
|
mission->SetReward(reward);
|
||||||
} else {
|
} else {
|
||||||
Game::logger->Log("GameMessages", "Unable to get mission %i for entity %llu to update reward in RespondToMission", missionID, playerID);
|
LOG("Unable to get mission %i for entity %llu to update reward in RespondToMission", missionID, playerID);
|
||||||
}
|
}
|
||||||
|
|
||||||
Entity* offerer = Game::entityManager->GetEntity(receiverID);
|
Entity* offerer = Game::entityManager->GetEntity(receiverID);
|
||||||
|
|
||||||
if (offerer == nullptr) {
|
if (offerer == nullptr) {
|
||||||
Game::logger->Log("GameMessages", "Unable to get receiver entity %llu for RespondToMission", receiverID);
|
LOG("Unable to get receiver entity %llu for RespondToMission", receiverID);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5211,7 +5211,7 @@ void GameMessages::HandleMissionDialogOK(RakNet::BitStream* inStream, Entity* en
|
|||||||
// Get the player's mission component
|
// Get the player's mission component
|
||||||
MissionComponent* missionComponent = static_cast<MissionComponent*>(player->GetComponent(eReplicaComponentType::MISSION));
|
MissionComponent* missionComponent = static_cast<MissionComponent*>(player->GetComponent(eReplicaComponentType::MISSION));
|
||||||
if (!missionComponent) {
|
if (!missionComponent) {
|
||||||
Game::logger->Log("GameMessages", "Unable to get mission component for entity %llu to handle MissionDialogueOK", player->GetObjectID());
|
LOG("Unable to get mission component for entity %llu to handle MissionDialogueOK", player->GetObjectID());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5564,7 +5564,7 @@ void GameMessages::HandleBuildModeSet(RakNet::BitStream* inStream, Entity* entit
|
|||||||
inStream->Read(bStart);
|
inStream->Read(bStart);
|
||||||
// there's more here but we don't need it (for now?)
|
// there's more here but we don't need it (for now?)
|
||||||
|
|
||||||
Game::logger->Log("GameMessages", "Set build mode to (%d) for (%llu)", bStart, entity->GetObjectID());
|
LOG("Set build mode to (%d) for (%llu)", bStart, entity->GetObjectID());
|
||||||
|
|
||||||
if (entity->GetCharacter()) {
|
if (entity->GetCharacter()) {
|
||||||
entity->GetCharacter()->SetBuildMode(bStart);
|
entity->GetCharacter()->SetBuildMode(bStart);
|
||||||
@ -5579,7 +5579,7 @@ void GameMessages::HandleModularBuildFinish(RakNet::BitStream* inStream, Entity*
|
|||||||
InventoryComponent* inv = static_cast<InventoryComponent*>(character->GetComponent(eReplicaComponentType::INVENTORY));
|
InventoryComponent* inv = static_cast<InventoryComponent*>(character->GetComponent(eReplicaComponentType::INVENTORY));
|
||||||
if (!inv) return;
|
if (!inv) return;
|
||||||
|
|
||||||
Game::logger->Log("GameMessages", "Build finished");
|
LOG("Build finished");
|
||||||
|
|
||||||
GameMessages::SendFinishArrangingWithItem(character, entity->GetObjectID()); // kick them from modular build
|
GameMessages::SendFinishArrangingWithItem(character, entity->GetObjectID()); // kick them from modular build
|
||||||
GameMessages::SendModularBuildEnd(character); // i dont know if this does anything but DLUv2 did it
|
GameMessages::SendModularBuildEnd(character); // i dont know if this does anything but DLUv2 did it
|
||||||
@ -5708,7 +5708,7 @@ void GameMessages::HandleDoneArrangingWithItem(RakNet::BitStream* inStream, Enti
|
|||||||
inStream->Read(oldItemTYPE);
|
inStream->Read(oldItemTYPE);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Game::logger->Log("GameMessages",
|
LOG("GameMessages",
|
||||||
"\nnewSourceBAG: %d\nnewSourceID: %llu\nnewSourceLOT: %d\nnewSourceTYPE: %d\nnewTargetID: %llu\nnewTargetLOT: %d\nnewTargetTYPE: %d\nnewTargetPOS: %f, %f, %f\noldItemBAG: %d\noldItemID: %llu\noldItemLOT: %d\noldItemTYPE: %d",
|
"\nnewSourceBAG: %d\nnewSourceID: %llu\nnewSourceLOT: %d\nnewSourceTYPE: %d\nnewTargetID: %llu\nnewTargetLOT: %d\nnewTargetTYPE: %d\nnewTargetPOS: %f, %f, %f\noldItemBAG: %d\noldItemID: %llu\noldItemLOT: %d\noldItemTYPE: %d",
|
||||||
newSourceBAG, newSourceID, newSourceLOT, newSourceTYPE, newTargetID, newTargetLOT, newTargetTYPE, newTargetPOS.x, newTargetPOS.y, newTargetPOS.z, oldItemBAG, oldItemID, oldItemLOT, oldItemTYPE
|
newSourceBAG, newSourceID, newSourceLOT, newSourceTYPE, newTargetID, newTargetLOT, newTargetTYPE, newTargetPOS.x, newTargetPOS.y, newTargetPOS.z, oldItemBAG, oldItemID, oldItemLOT, oldItemTYPE
|
||||||
);
|
);
|
||||||
@ -5726,14 +5726,14 @@ void GameMessages::HandleDoneArrangingWithItem(RakNet::BitStream* inStream, Enti
|
|||||||
} else if (!entities.empty()) {
|
} else if (!entities.empty()) {
|
||||||
buildArea = entities[0];
|
buildArea = entities[0];
|
||||||
|
|
||||||
Game::logger->Log("BuildBorderComponent", "Using PropertyPlaque");
|
LOG("Using PropertyPlaque");
|
||||||
} else {
|
} else {
|
||||||
Game::logger->Log("BuildBorderComponent", "No build area found");
|
LOG("No build area found");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::logger->Log("GameMessages", "Build area found: %llu", buildArea->GetObjectID());
|
LOG("Build area found: %llu", buildArea->GetObjectID());
|
||||||
|
|
||||||
GameMessages::SendStartArrangingWithItem(
|
GameMessages::SendStartArrangingWithItem(
|
||||||
character,
|
character,
|
||||||
@ -5752,7 +5752,7 @@ void GameMessages::HandleDoneArrangingWithItem(RakNet::BitStream* inStream, Enti
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::logger->Log("GameMessages", "Done Arranging");
|
LOG("Done Arranging");
|
||||||
|
|
||||||
//GenericInventory* models = inv->GetGenericInventory(MODELS);
|
//GenericInventory* models = inv->GetGenericInventory(MODELS);
|
||||||
//GenericInventory* tempModels = inv->GetGenericInventory(TEMP_MODELS);
|
//GenericInventory* tempModels = inv->GetGenericInventory(TEMP_MODELS);
|
||||||
@ -5776,7 +5776,7 @@ void GameMessages::HandleModularBuildMoveAndEquip(RakNet::BitStream* inStream, E
|
|||||||
Entity* character = Game::entityManager->GetEntity(user->GetLoggedInChar());
|
Entity* character = Game::entityManager->GetEntity(user->GetLoggedInChar());
|
||||||
if (!character) return;
|
if (!character) return;
|
||||||
|
|
||||||
Game::logger->Log("GameMessages", "Build and move");
|
LOG("Build and move");
|
||||||
|
|
||||||
LOT templateID;
|
LOT templateID;
|
||||||
|
|
||||||
@ -6036,7 +6036,7 @@ void GameMessages::HandleReportBug(RakNet::BitStream* inStream, Entity* entity)
|
|||||||
insertBug->execute();
|
insertBug->execute();
|
||||||
delete insertBug;
|
delete insertBug;
|
||||||
} catch (sql::SQLException& e) {
|
} catch (sql::SQLException& e) {
|
||||||
Game::logger->Log("HandleReportBug", "Couldn't save bug report! (%s)", e.what());
|
LOG("Couldn't save bug report! (%s)", e.what());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6228,7 +6228,7 @@ void GameMessages::HandleAddDonationItem(RakNet::BitStream* inStream, Entity* en
|
|||||||
auto* donationVendorComponent = entity->GetComponent<DonationVendorComponent>();
|
auto* donationVendorComponent = entity->GetComponent<DonationVendorComponent>();
|
||||||
if (!donationVendorComponent) return;
|
if (!donationVendorComponent) return;
|
||||||
if (donationVendorComponent->GetActivityID() == 0) {
|
if (donationVendorComponent->GetActivityID() == 0) {
|
||||||
Game::logger->Log("GameMessages", "WARNING: Trying to dontate to a vendor with no activity");
|
LOG("WARNING: Trying to dontate to a vendor with no activity");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
User* user = UserManager::Instance()->GetUser(sysAddr);
|
User* user = UserManager::Instance()->GetUser(sysAddr);
|
||||||
@ -6283,7 +6283,7 @@ void GameMessages::HandleConfirmDonationOnPlayer(RakNet::BitStream* inStream, En
|
|||||||
auto* donationVendorComponent = donationEntity->GetComponent<DonationVendorComponent>();
|
auto* donationVendorComponent = donationEntity->GetComponent<DonationVendorComponent>();
|
||||||
if (!donationVendorComponent) return;
|
if (!donationVendorComponent) return;
|
||||||
if (donationVendorComponent->GetActivityID() == 0) {
|
if (donationVendorComponent->GetActivityID() == 0) {
|
||||||
Game::logger->Log("GameMessages", "WARNING: Trying to dontate to a vendor with no activity");
|
LOG("WARNING: Trying to dontate to a vendor with no activity");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto* inventory = inventoryComponent->GetInventory(eInventoryType::DONATION);
|
auto* inventory = inventoryComponent->GetInventory(eInventoryType::DONATION);
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include "GeneralUtils.h"
|
#include "GeneralUtils.h"
|
||||||
|
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "dLogger.h"
|
#include "Logger.h"
|
||||||
#include "CDClientManager.h"
|
#include "CDClientManager.h"
|
||||||
|
|
||||||
#include "CDPropertyTemplateTable.h"
|
#include "CDPropertyTemplateTable.h"
|
||||||
|
@ -194,7 +194,7 @@ void Inventory::AddManagedItem(Item* item) {
|
|||||||
const auto id = item->GetId();
|
const auto id = item->GetId();
|
||||||
|
|
||||||
if (items.find(id) != items.end()) {
|
if (items.find(id) != items.end()) {
|
||||||
Game::logger->Log("Inventory", "Attempting to add an item with an already present id (%llu)!", id);
|
LOG("Attempting to add an item with an already present id (%llu)!", id);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -204,7 +204,7 @@ void Inventory::AddManagedItem(Item* item) {
|
|||||||
const auto slot = item->GetSlot();
|
const auto slot = item->GetSlot();
|
||||||
|
|
||||||
if (slots.find(slot) != slots.end()) {
|
if (slots.find(slot) != slots.end()) {
|
||||||
Game::logger->Log("Inventory", "Attempting to add an item with an already present slot (%i)!", slot);
|
LOG("Attempting to add an item with an already present slot (%i)!", slot);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -218,7 +218,7 @@ void Inventory::RemoveManagedItem(Item* item) {
|
|||||||
const auto id = item->GetId();
|
const auto id = item->GetId();
|
||||||
|
|
||||||
if (items.find(id) == items.end()) {
|
if (items.find(id) == items.end()) {
|
||||||
Game::logger->Log("Inventory", "Attempting to remove an item with an invalid id (%llu), lot (%i)!", id, item->GetLot());
|
LOG("Attempting to remove an item with an invalid id (%llu), lot (%i)!", id, item->GetLot());
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -282,7 +282,7 @@ const CDItemComponent& Inventory::FindItemComponent(const LOT lot) {
|
|||||||
const auto componentId = registry->GetByIDAndType(lot, eReplicaComponentType::ITEM);
|
const auto componentId = registry->GetByIDAndType(lot, eReplicaComponentType::ITEM);
|
||||||
|
|
||||||
if (componentId == 0) {
|
if (componentId == 0) {
|
||||||
Game::logger->Log("Inventory", "Failed to find item component for (%i)!", lot);
|
LOG("Failed to find item component for (%i)!", lot);
|
||||||
|
|
||||||
return CDItemComponentTable::Default;
|
return CDItemComponentTable::Default;
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user