Restructure repository to include all source folders
Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
291
Server/RylServerProject/RylGameServer/ManageGameObject.cpp
Normal file
291
Server/RylServerProject/RylGameServer/ManageGameObject.cpp
Normal file
@@ -0,0 +1,291 @@
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "RylGameServer.h"
|
||||
|
||||
#include <Network/Dispatch/CheckPing.h>
|
||||
#include <Network/Dispatch/GameClient/CheckSpeedHack.h>
|
||||
#include <Network/Dispatch/GameClient/FieldServerClientDispatch.h>
|
||||
#include <Network/Packet/PacketStruct/ServerInfo.h>
|
||||
#include <Network/Packet/PacketStatistics.h>
|
||||
|
||||
#include <Utility/Filter/Filter.h>
|
||||
#include <Utility/Setup/ServerSetup.h>
|
||||
#include <Utility/Debug/DebugUtils.h>
|
||||
#include <Utility/Debug/PerformanceCheck.h>
|
||||
|
||||
#include <Creature/EnemyCheck.h>
|
||||
#include <Creature/CreatureManager.h>
|
||||
#include <Creature/Monster/MonsterShout.h>
|
||||
#include <Creature/Character/CharRespawnMgr.h>
|
||||
|
||||
#include <Skill/SkillMgr.h>
|
||||
#include <Skill/SkillTable.h>
|
||||
|
||||
#include <Map/FieldMap/CellManager.h>
|
||||
#include <Map/FieldMap/MineralVeinMgr.h>
|
||||
|
||||
#include <Log/GameLog.h>
|
||||
#include <GameEvent/GameEventMgr.h>
|
||||
#include <Item/ItemMgr.h>
|
||||
#include <GameGuardLib/ggsrv.h>
|
||||
|
||||
// edith 2009.08.11 <20><><EFBFBD>Ӱ<EFBFBD><D3B0><EFBFBD> 2.5 <20><><EFBFBD><EFBFBD><D7B7>̵<EFBFBD>
|
||||
void Log(const char *szMsg, ... )
|
||||
{
|
||||
va_list marker;
|
||||
char szTmp[256] = {0,};
|
||||
|
||||
va_start( marker ,szMsg );
|
||||
vsprintf(szTmp,szMsg, marker);
|
||||
va_end( marker );
|
||||
|
||||
// DebugView <20><> <20><><EFBFBD>ؼ<EFBFBD> <20>α<CEB1> Ȯ<><C8AE> <20><> <20><> <20>ֽ<EFBFBD><D6BD>ϴ<EFBFBD>.
|
||||
// OutputDebugString( szTmp );
|
||||
DETLOG0(g_Log, szTmp);
|
||||
}
|
||||
|
||||
GGAUTHS_API void NpLog(int mode, char* msg)
|
||||
{
|
||||
if(mode & (NPLOG_DEBUG | NPLOG_ERROR))
|
||||
{
|
||||
Log(msg);
|
||||
}
|
||||
}
|
||||
|
||||
GGAUTHS_API void GGAuthUpdateCallback(PGG_UPREPORT report)
|
||||
{
|
||||
Log( "GGAuth version update [%s] : [%ld] -> [%ld] \n",
|
||||
report->nType==1?"GameGuard Ver":"Protocol Num",
|
||||
report->dwBefore, report->dwNext );
|
||||
}
|
||||
|
||||
|
||||
void PrePerformanceMsg(FILE* lpFile)
|
||||
{
|
||||
if(0 != lpFile)
|
||||
{
|
||||
SYSTEMTIME currentTime;
|
||||
GetLocalTime(¤tTime);
|
||||
|
||||
fprintf(lpFile, "\n------------------------------------------------------------------------\n"
|
||||
"\tPID:0x%08x/ServerID:0x%08x/ServerZone:%02d/ServerChannel:%02d/\n"
|
||||
"\tGameServer PerformanceCheck. %04d-%02d-%02d %02d:%02d:%02d:%04d\n\n",
|
||||
GetCurrentProcessId(), CServerSetup::GetInstance().GetServerID(),
|
||||
CServerSetup::GetZoneFromCmdLine(),
|
||||
CServerSetup::GetChannelFromCmdLine(),
|
||||
|
||||
currentTime.wYear,
|
||||
currentTime.wMonth,
|
||||
currentTime.wDay,
|
||||
currentTime.wHour,
|
||||
currentTime.wMinute,
|
||||
currentTime.wSecond,
|
||||
currentTime.wMilliseconds);
|
||||
}
|
||||
}
|
||||
|
||||
bool CRylGameServer::InitializeGameObject(void)
|
||||
{
|
||||
// <20>α<EFBFBD> <20≯<EFBFBD> <20>ʱ<EFBFBD>ȭ.
|
||||
char szProgramName[MAX_PATH];
|
||||
char szLogFilePrefixName[MAX_PATH];
|
||||
char szSessionLogFilePrefixName[MAX_PATH];
|
||||
char szSkillLogFilePrefixName[MAX_PATH];
|
||||
|
||||
DbgUtils::SetProgramName(szProgramName, MAX_PATH);
|
||||
szProgramName[MAX_PATH - 1] = 0;
|
||||
|
||||
_snprintf(szLogFilePrefixName, MAX_PATH - 1, "%sZ%02dC%02d-", szProgramName,
|
||||
CServerSetup::GetInstance().GetServerZone(),
|
||||
CServerSetup::GetInstance().GetServerChannel());
|
||||
|
||||
_snprintf(szSessionLogFilePrefixName, MAX_PATH - 1, "SessionLogZ%02dC%02d-",
|
||||
CServerSetup::GetInstance().GetServerZone(),
|
||||
CServerSetup::GetInstance().GetServerChannel());
|
||||
|
||||
_snprintf(szSkillLogFilePrefixName, MAX_PATH - 1, "SkillLogZ%02dC%02d-",
|
||||
CServerSetup::GetInstance().GetServerZone(),
|
||||
CServerSetup::GetInstance().GetServerChannel());
|
||||
|
||||
g_Log.SetLogFileName(szLogFilePrefixName, szProgramName);
|
||||
g_SessionLog.SetLogFileName(szSessionLogFilePrefixName, szProgramName);
|
||||
g_SkillLog.SetLogFileName(szSkillLogFilePrefixName, szProgramName);
|
||||
|
||||
// <20><>Ŷ <20><><EFBFBD><EFBFBD> <20>α<EFBFBD> <20><><EFBFBD><EFBFBD> <20>ʱ<EFBFBD>ȭ
|
||||
CPacketStatistics::GetInstance().SetUserMessageFunc(PrePerformanceMsg, 0);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>ս<EFBFBD> <20>α<EFBFBD> <20><><EFBFBD><EFBFBD> <20>ʱ<EFBFBD>ȭ
|
||||
CPerformanceCheck::GetInstance().SetUserMessageFunc(PrePerformanceMsg, 0);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> <20>α<EFBFBD> <20>ʱ<EFBFBD>ȭ
|
||||
if (false == CGameLog::GetInstance().Initialize(szLogFilePrefixName))
|
||||
{
|
||||
ERRLOG0(g_Log, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>α<CEB1> <20>ʱ<EFBFBD>ȭ<EFBFBD>ϴµ<CFB4> <20><><EFBFBD><EFBFBD><EFBFBD>߽<EFBFBD><DFBD>ϴ<EFBFBD>.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ũ<EFBFBD><C5A9>Ʈ <20>ε<EFBFBD>
|
||||
char szItemScriptName[MAX_PATH];
|
||||
if (SERVER_ID::GROUP_BATTLE_SERVER == CServerSetup::GetInstance().GetServerGroup())
|
||||
{
|
||||
strncpy(szItemScriptName, "./Script/Game/BGItemScript.txt", MAX_PATH);
|
||||
}
|
||||
else
|
||||
{
|
||||
strncpy(szItemScriptName, "./Script/Game/ItemScript.txt", MAX_PATH);
|
||||
}
|
||||
|
||||
if (false == Item::CItemMgr::GetInstance().LoadItemProtoType(szItemScriptName))
|
||||
{
|
||||
ERRLOG0(g_Log, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ũ<EFBFBD><C5A9>Ʈ<EFBFBD><C6AE> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ռ<EFBFBD> <20><>ũ<EFBFBD><C5A9>Ʈ <20>ε<EFBFBD>
|
||||
if (false == Item::CItemMgr::GetInstance().LoadItemChemical())
|
||||
{
|
||||
ERRLOG0(g_Log, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ռ<EFBFBD> <20><>ũ<EFBFBD><C5A9>Ʈ<EFBFBD><C6AE> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>ũ<EFBFBD><C5A9>Ʈ <20>ε<EFBFBD>
|
||||
if (false == Item::CItemMgr::GetInstance().LoadItemSpeacialCompensation())
|
||||
{
|
||||
ERRLOG0(g_Log, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>ũ<EFBFBD><C5A9>Ʈ<EFBFBD><C6AE> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// <20><>ų <20><>ũ<EFBFBD><C5A9>Ʈ <20>ε<EFBFBD>
|
||||
if (false == CSkillMgr::GetInstance().LoadSkillsFromFile())
|
||||
{
|
||||
ERRLOG0(g_Log, "<EFBFBD><EFBFBD>ų <20><>ũ<EFBFBD><C5A9>Ʈ<EFBFBD><C6AE> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// <20><>ų <20><><EFBFBD>̺<EFBFBD> <20>ʱ<EFBFBD>ȭ
|
||||
if (false == Skill::CProcessTable::GetInstance().Initialize())
|
||||
{
|
||||
ERRLOG0(g_Log, "<EFBFBD><EFBFBD>ų ó<><C3B3> <20><><EFBFBD>̺<EFBFBD><CCBA><EFBFBD> <20>ʱ<EFBFBD>ȭ <20><> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> <20>̺<EFBFBD>Ʈ <20>ʱ<EFBFBD>ȭ
|
||||
if (false == CGameEventMgr::GetInstance().Initialize())
|
||||
{
|
||||
ERRLOG0(g_Log, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>̺<EFBFBD>Ʈ <20>ʱ<EFBFBD>ȭ<EFBFBD><C8AD> <20><><EFBFBD><EFBFBD><EFBFBD>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD>ϴ<EFBFBD>.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ġ <20><>ũ<EFBFBD><C5A9>Ʈ <20>ε<EFBFBD>
|
||||
if (false == CCharRespawnMgr::GetInstance().LoadRespawnFromFile())
|
||||
{
|
||||
ERRLOG0(g_Log, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ġ <20><>ũ<EFBFBD><C5A9>Ʈ<EFBFBD><C6AE> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (false == Filter::InitFilter())
|
||||
{
|
||||
ERRLOG0(g_Log, "<EFBFBD≯<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// <20><> <20>ε<EFBFBD>
|
||||
CCellManager& CellManager = CCellManager::GetInstance();
|
||||
|
||||
if (false == CellManager.LoadComplete())
|
||||
{
|
||||
CellManager.Load();
|
||||
CellManager.SetMoving(true);
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> <20><>ġ <20><>ũ<EFBFBD><C5A9>Ʈ <20>ε<EFBFBD>
|
||||
switch ( CServerSetup::GetInstance().GetServerZone() )
|
||||
{
|
||||
case SERVER_ID::CAPITAL:
|
||||
{
|
||||
char szMineralVeinScriptName[MAX_PATH];
|
||||
sprintf(szMineralVeinScriptName, "./Script/Game/MineralVein/MineralVein%d.gsf", CServerSetup::GetInstance().GetServerZone());
|
||||
CMineralVeinMgr& MineralVeinMgr = CMineralVeinMgr::GetInstance();
|
||||
if (false == MineralVeinMgr.LoadMineralVeinsFromBinary(szMineralVeinScriptName))
|
||||
{
|
||||
ERRLOG0(g_Log, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ġ <20><>ũ<EFBFBD><C5A9>Ʈ <20>ε忡 <20><><EFBFBD><EFBFBD><EFBFBD>߽<EFBFBD><DFBD>ϴ<EFBFBD>.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ä<><C3A4> <20><>ũ<EFBFBD><C5A9>Ʈ <20>ʱ<EFBFBD>ȭ - <20><> <20>ε<EFBFBD><CEB5>ؼ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ε<EFBFBD><CEB5><EFBFBD> <20><> <20>ε<EFBFBD>
|
||||
if (false == CMonsterShout::GetInstance().LoadScript())
|
||||
{
|
||||
ERRLOG0(g_Log, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ä<><C3A4> <20><>ũ<EFBFBD><C5A9>Ʈ <20>ε忡 <20><><EFBFBD><EFBFBD><EFBFBD>߽<EFBFBD><DFBD>ϴ<EFBFBD>.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// <20>Ǿƽĺ<C6BD> <20><> <20>ʱ<EFBFBD>ȭ
|
||||
if (false == EnemyCheck::CCheckTable::GetInstance().Initialize())
|
||||
{
|
||||
ERRLOG0(g_Log, "<EFBFBD>Ǿƽĺ<EFBFBD> <20><><EFBFBD><EFBFBD> <20>ʱ<EFBFBD>ȭ<EFBFBD>ϴµ<CFB4> <20><><EFBFBD><EFBFBD><EFBFBD>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD>ϴ<EFBFBD>.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------
|
||||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ʱ<EFBFBD>ȭ
|
||||
// edith 2009.08.11 <20><><EFBFBD>Ӱ<EFBFBD><D3B0><EFBFBD> 2.5 <20><><EFBFBD><EFBFBD><D7B7>̵<EFBFBD>
|
||||
/*
|
||||
if (0 == LoadAuthTable("./Script/Server/CSAuth.tab"))
|
||||
{
|
||||
ERRLOG0(g_Log, "RowGameServer initialize failed : GameGuard LoadAuthTable failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (0 == LoadAuthIndex("./Script/Server/CSAuth.idx"))
|
||||
{
|
||||
ERRLOG0(g_Log, "RowGameServer initialize failed : GameGuard LoadAuthIndex failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (0 == InitPacketProtect("RYLPART2", 1))
|
||||
{
|
||||
ERRLOG0(g_Log, "RowGameServer initialize failed : GameGuard InitPacketProtect failed");
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
|
||||
#ifndef NO_GAMEGUARD
|
||||
|
||||
/*
|
||||
// edith 2009.08.11 <20><><EFBFBD>Ӱ<EFBFBD><D3B0><EFBFBD> 2.5 <20><><EFBFBD><EFBFBD><D7B7>̵<EFBFBD>
|
||||
// 1. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʱ<EFBFBD>ȭ <20>Լ<EFBFBD> : InitGameguardAuth
|
||||
unsigned long dwGGErrCode = InitGameguardAuth("./Script/Server", 50);
|
||||
if (ERROR_SUCCESS != dwGGErrCode)
|
||||
{
|
||||
ERRLOG1(g_Log, "RowGameServer initialize failed : GameGuard InitGameguardAuth failed(%d)", dwGGErrCode);
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
// 1. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʱ<EFBFBD>ȭ <20>Լ<EFBFBD> : InitGameguardAuth
|
||||
unsigned long dwGGErrCode = InitGameguardAuth("./Script/Server", 50, true, NPLOG_DEBUG|NPLOG_ERROR);
|
||||
if (ERROR_SUCCESS != dwGGErrCode)
|
||||
{
|
||||
ERRLOG1(g_Log, "RowGameServer initialize failed : GameGuard InitGameguardAuth failed(%d)", dwGGErrCode);
|
||||
return false;
|
||||
}
|
||||
|
||||
// 2. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD> : SetUpdateCondition
|
||||
// 2. Storage function of server certification condition : SetUpdateCondition
|
||||
SetUpdateCondition(30, 50);
|
||||
// ------------------------------------------------------------------------------------------
|
||||
|
||||
#endif
|
||||
|
||||
m_bInitialized = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
void CRylGameServer::DestoryGameObject(void)
|
||||
{
|
||||
#ifndef NO_GAMEGUARD
|
||||
CleanupGameguardAuth();
|
||||
#endif
|
||||
}
|
||||
Reference in New Issue
Block a user