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:
275
Server/Billing/GetCharacterData/GetCharacterData.cpp
Normal file
275
Server/Billing/GetCharacterData/GetCharacterData.cpp
Normal file
@@ -0,0 +1,275 @@
|
||||
// GetGameCharacterData.cpp : 응용 프로그램에 대한 진입점을 정의합니다.
|
||||
//
|
||||
#include "stdafx.h"
|
||||
#include <myOLEDB.h>
|
||||
#include <Config.h>
|
||||
#include <Log.h>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <ctime>
|
||||
#include <list>
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
struct CharacterData
|
||||
{
|
||||
int CID;
|
||||
int Class;
|
||||
int Level;
|
||||
char CreateTime[20];
|
||||
char UpdateTime[20];
|
||||
};
|
||||
|
||||
#pragma pack()
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
template<class _Elem, class _Traits>
|
||||
inline basic_ostream<_Elem, _Traits>& __cdecl writetime(basic_ostream<_Elem, _Traits>& _Ostr)
|
||||
{
|
||||
SYSTEMTIME systime;
|
||||
GetLocalTime(&systime);
|
||||
|
||||
_Elem fill = _Ostr.fill();
|
||||
|
||||
_Ostr << setfill('0')
|
||||
<< "["
|
||||
<< setw(4) << systime.wYear << "-"
|
||||
<< setw(2) << systime.wMonth << "-"
|
||||
<< setw(2) << systime.wDay << " "
|
||||
<< setw(2) << systime.wHour << ":"
|
||||
<< setw(2) << systime.wMinute << ":"
|
||||
<< setw(2) << systime.wSecond << "] " << setfill(fill);
|
||||
|
||||
return (_Ostr);
|
||||
}
|
||||
|
||||
bool LoadLastProcessedTime(const char* szFileName, __time64_t* lpLastProcessedTime)
|
||||
{
|
||||
FILE* file = fopen(szFileName, "rb");
|
||||
if(0 != file)
|
||||
{
|
||||
if(0 != lpLastProcessedTime)
|
||||
{
|
||||
tm tmLastProcessedTime;
|
||||
memset(&tmLastProcessedTime, 0, sizeof(tm));
|
||||
|
||||
fscanf(file, "%04d-%02d-%02d %02d:%02d:%02d",
|
||||
&tmLastProcessedTime.tm_year, &tmLastProcessedTime.tm_mon, &tmLastProcessedTime.tm_mday,
|
||||
&tmLastProcessedTime.tm_hour, &tmLastProcessedTime.tm_min, &tmLastProcessedTime.tm_sec);
|
||||
|
||||
tmLastProcessedTime.tm_year -= 1900;
|
||||
tmLastProcessedTime.tm_mon -= 1;
|
||||
|
||||
*lpLastProcessedTime = _mktime64(&tmLastProcessedTime);
|
||||
fclose(file);
|
||||
return true;
|
||||
}
|
||||
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SaveLastProcessedTime(const char* szFileName, __time64_t LastProcessedTime)
|
||||
{
|
||||
FILE* file = fopen(szFileName, "wt");
|
||||
if(0 != file)
|
||||
{
|
||||
tm tmLastProcessedTime = *_localtime64(&LastProcessedTime);
|
||||
|
||||
fprintf(file, "%04d-%02d-%02d %02d:%02d:%02d",
|
||||
tmLastProcessedTime.tm_year + 1900, tmLastProcessedTime.tm_mon + 1, tmLastProcessedTime.tm_mday,
|
||||
tmLastProcessedTime.tm_hour, tmLastProcessedTime.tm_min, tmLastProcessedTime.tm_sec);
|
||||
|
||||
fclose(file);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
int APIENTRY WinMain(HINSTANCE hInstance,
|
||||
HINSTANCE hPrevInstance,
|
||||
LPTSTR lpCmdLine,
|
||||
int nCmdShow)
|
||||
{
|
||||
CLog log;
|
||||
CConfigurator config;
|
||||
|
||||
OleDB gameDB;
|
||||
OleDB gamaDB;
|
||||
|
||||
char szSelectQuery[OleDB::MaxQueryTextLen];
|
||||
char szInserQuery[OleDB::MaxQueryTextLen];
|
||||
int nQueryLen = 0;
|
||||
|
||||
if(!log.RedirectStdOut("GetCharacterDataLog"))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
cout << endl << writetime << "쿼리를 실행합니다." << endl;
|
||||
|
||||
TCHAR* tszConfigFileName = TEXT("CharacterData.cfg");
|
||||
|
||||
if(!config.Load(tszConfigFileName))
|
||||
{
|
||||
cout << writetime << tszConfigFileName << "DB설정 파일을 읽을 수 없습니다." << endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
const char* szTimeFileName = "GetCharacterDataTime.txt";
|
||||
|
||||
unsigned long dwServerID = atoi(config.Get("GameServerID"));
|
||||
|
||||
const char* szGameServerName = config.Get("GameServerName");
|
||||
const char* szGameDBName = config.Get("GameDBName");
|
||||
const char* szGameUserName = config.Get("GameUserName");
|
||||
const char* szGamePassword = config.Get("GamePassword");
|
||||
|
||||
if(!gameDB.ConnectSQLServer(szGameServerName, szGameDBName,
|
||||
szGameUserName, szGamePassword, OleDB::ConnType_MSSQL))
|
||||
{
|
||||
cout << writetime << "게임DB : 접속할 수 없습니다. : " << gameDB.GetErrorString()
|
||||
<< " ServerName : " << szGameServerName
|
||||
<< " DBName : " << szGameDBName
|
||||
<< " UserName : " << szGameUserName
|
||||
<< " Password : " << szGamePassword
|
||||
<< endl;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
const char* szGamaServerName = config.Get("GamaServerName");
|
||||
const char* szGamaDBName = config.Get("GamaDBName");
|
||||
const char* szGamaUserName = config.Get("GamaUserName");
|
||||
const char* szGamaPassword = config.Get("GamaPassword");
|
||||
|
||||
if(!gamaDB.ConnectSQLServer(szGamaServerName, szGamaDBName,
|
||||
szGamaUserName, szGamaPassword, OleDB::ConnType_MSSQL))
|
||||
{
|
||||
cout << writetime << "가마DB : 접속할 수 없습니다. : " << gamaDB.GetErrorString()
|
||||
<< " ServerName : " << szGamaServerName
|
||||
<< " DBName : " << szGamaDBName
|
||||
<< " UserName : " << szGamaUserName
|
||||
<< " Password : " << szGamaPassword
|
||||
<< endl;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
__time64_t lastTime = 0;
|
||||
if(!LoadLastProcessedTime(szTimeFileName, &lastTime))
|
||||
{
|
||||
cout << writetime << szTimeFileName << "시간 설정 파일을 읽을 수 없습니다." << endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
__time64_t currentTime = _time64(0);
|
||||
|
||||
tm tmLastTime = *_localtime64(&lastTime);
|
||||
tm tmCurrentTime = *_localtime64(¤tTime);
|
||||
|
||||
_snprintf(szSelectQuery, OleDB::MaxQueryTextLen - 1, "SELECT "
|
||||
"CAST(CID AS INT), "
|
||||
"CAST(Class AS INT), "
|
||||
"CAST(Level AS INT), "
|
||||
"CONVERT(varchar(20), CreateTime, 20), "
|
||||
"CONVERT(varchar(20), UpdateTime, 20) "
|
||||
"FROM CharInfo A "
|
||||
"JOIN (SELECT CID,CreateTime,UpdateTime FROM CharInfo_Time WHERE UpdateTime >= '%04d-%02d-%02d %02d:%02d:%02d') B ON A.UID = B.CID",
|
||||
|
||||
tmLastTime.tm_year + 1900, tmLastTime.tm_mon + 1, tmLastTime.tm_mday,
|
||||
tmLastTime.tm_hour, tmLastTime.tm_min, tmLastTime.tm_sec);
|
||||
|
||||
szSelectQuery[OleDB::MaxQueryTextLen - 1] = 0;
|
||||
|
||||
if(!gameDB.ExcuteQuery(szSelectQuery))
|
||||
{
|
||||
cout << writetime << "게임DB : 캐릭터 데이터 가져오기 실패"
|
||||
<< gameDB.GetErrorString() << endl;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
typedef std::list<std::pair<int, CharacterData*> > InsertList;
|
||||
|
||||
InsertList insertList;
|
||||
|
||||
const int MAX_DATA = OleDB::MaxRowNum;
|
||||
CharacterData* lpCharacterData = new CharacterData[MAX_DATA];
|
||||
|
||||
int nReturnRow = 0;
|
||||
int nTotalRow = 0;
|
||||
while(gameDB.GetData((void**)lpCharacterData,
|
||||
sizeof(CharacterData), MAX_DATA, &nReturnRow))
|
||||
{
|
||||
if(0 == nReturnRow)
|
||||
{
|
||||
if(0 != lpCharacterData)
|
||||
{
|
||||
delete [] lpCharacterData;
|
||||
lpCharacterData = 0;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
nTotalRow += nReturnRow;
|
||||
insertList.push_back(std::make_pair(nReturnRow, lpCharacterData));
|
||||
lpCharacterData = new CharacterData[MAX_DATA];
|
||||
}
|
||||
|
||||
int nTotal_InsertRow = 0;
|
||||
|
||||
InsertList::iterator pos = insertList.begin();
|
||||
InsertList::iterator end = insertList.end();
|
||||
|
||||
for(;pos != end; ++pos)
|
||||
{
|
||||
CharacterData* lpCharacterData = pos->second;
|
||||
CharacterData* lpCharacterDataEnd = lpCharacterData + pos->first;
|
||||
|
||||
for(; lpCharacterData != lpCharacterDataEnd; ++lpCharacterData)
|
||||
{
|
||||
_snprintf(szInserQuery, OleDB::MaxQueryTextLen - 1,
|
||||
"Statics_InsertCharData %d, %d, %d, %d, '%s', '%s'",
|
||||
dwServerID, lpCharacterData->CID, lpCharacterData->Class, lpCharacterData->Level,
|
||||
lpCharacterData->CreateTime, lpCharacterData->UpdateTime);
|
||||
|
||||
szInserQuery[OleDB::MaxQueryTextLen - 1] = 0;
|
||||
|
||||
if(!gamaDB.ExcuteQuery(szInserQuery))
|
||||
{
|
||||
cout << writetime << "가마DB : 게임DB에서 얻어온 데이터를 세팅할 수 없습니다. : "
|
||||
<< gamaDB.GetErrorString() << " " << szInserQuery;
|
||||
}
|
||||
else
|
||||
{
|
||||
++nTotal_InsertRow;
|
||||
}
|
||||
}
|
||||
|
||||
delete [] pos->second;
|
||||
}
|
||||
|
||||
if(!SaveLastProcessedTime(szTimeFileName, currentTime))
|
||||
{
|
||||
cout << writetime << szTimeFileName << "시간 설정 파일에 저장할 수 없습니다." << endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(nTotal_InsertRow != nTotalRow)
|
||||
{
|
||||
cout << writetime << "삽입 건수 : " << nTotal_InsertRow << " 읽은 건수 : " << nTotalRow << endl;
|
||||
}
|
||||
|
||||
cout << writetime << "쿼리 : " << szSelectQuery << "실행에 성공했습니다. 처리 건수 : " << nTotalRow << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
136
Server/Billing/GetCharacterData/GetCharacterData.vcproj
Normal file
136
Server/Billing/GetCharacterData/GetCharacterData.vcproj
Normal file
@@ -0,0 +1,136 @@
|
||||
<?xml version="1.0" encoding="ks_c_5601-1987"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="GetCharacterData"
|
||||
ProjectGUID="{EBA2EBB1-86CE-4CFB-8A63-CA622558BAA6}"
|
||||
SccProjectName=""
|
||||
SccLocalPath=""
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="../Executable/$(ConfigurationName)"
|
||||
IntermediateDirectory="../Intermediate/$(ProjectName)/$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../DB"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/GetCharacterData.exe"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/GetCharacterData.pdb"
|
||||
SubSystem="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="../Executable/$(ConfigurationName)"
|
||||
IntermediateDirectory="../Intermediate/$(ProjectName)/$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="../DB"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
|
||||
RuntimeLibrary="0"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/GetCharacterData.exe"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="소스 파일"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath=".\GetCharacterData.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="헤더 파일"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="리소스 파일"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
Reference in New Issue
Block a user