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>
162 lines
4.2 KiB
C++
162 lines
4.2 KiB
C++
#ifndef _RYL_DB_PROCESS_LIBRARY_H_
|
|
#define _RYL_DB_PROCESS_LIBRARY_H_
|
|
|
|
#include <atldbcli.h>
|
|
|
|
// forward decl.
|
|
namespace RylDBCommand
|
|
{
|
|
class CCharData;
|
|
class CSkillData;
|
|
class CCharItem;
|
|
class CCharItemEx;
|
|
class CCharQuest;
|
|
|
|
class CUnifiedStore1;
|
|
class CUnifiedStore2;
|
|
|
|
class CPartyData;
|
|
class CFriendData;
|
|
|
|
class CUnifiedCharList;
|
|
}
|
|
|
|
enum ConvertResult
|
|
{
|
|
CONVERT_FAILED,
|
|
CONVERT_SUCCEEDED,
|
|
CONVERT_DO_NOT_WRITE,
|
|
CONVERT_FORCE_WRITE
|
|
};
|
|
|
|
class IShowCounter
|
|
{
|
|
public:
|
|
|
|
virtual bool ShowCounter(const char* szProcessName, int nCount, bool bForceWrite) = 0;
|
|
};
|
|
|
|
class CNoneCounter : public IShowCounter
|
|
{
|
|
public:
|
|
|
|
static CNoneCounter& GetInstance();
|
|
virtual bool ShowCounter(const char* szProcessName, int nCount, bool bForceWrite) { return true; }
|
|
|
|
private:
|
|
|
|
CNoneCounter() { }
|
|
};
|
|
|
|
class CConsoleCounter : public IShowCounter
|
|
{
|
|
public:
|
|
|
|
CConsoleCounter(int nCounterPerLine) : m_nCounterPerLine(nCounterPerLine) { }
|
|
virtual bool ShowCounter(const char* szProcessName, int nCount, bool bForceWrite);
|
|
|
|
private:
|
|
|
|
int m_nCounterPerLine;
|
|
};
|
|
|
|
// ÀÎÅÍÆäÀ̽ºµé
|
|
struct IDBCharInfoProcess
|
|
{
|
|
virtual ConvertResult operator() (RylDBCommand::CCharData& charData_InOut) = 0;
|
|
};
|
|
|
|
struct IDBCharSkillProcess
|
|
{
|
|
virtual ConvertResult operator() (RylDBCommand::CSkillData& charSkillData_InOut) = 0;
|
|
};
|
|
|
|
struct IDBCharItemProcess
|
|
{
|
|
virtual ConvertResult operator() (RylDBCommand::CCharItem& charItem_InOut) = 0;
|
|
};
|
|
|
|
struct IDBCharItemExProcess
|
|
{
|
|
virtual ConvertResult operator() (RylDBCommand::CCharItemEx& charItemEx_InOut) = 0;
|
|
};
|
|
|
|
struct IDBCharQuestProcess
|
|
{
|
|
virtual ConvertResult operator() (RylDBCommand::CCharQuest& charQuest_InOut) = 0;
|
|
};
|
|
|
|
struct IDBStoreProcess
|
|
{
|
|
virtual ConvertResult operator() (RylDBCommand::CUnifiedStore1& unifiedStore1_InOut) = 0;
|
|
virtual ConvertResult operator() (RylDBCommand::CUnifiedStore2& unifiedStore2_InOut) = 0;
|
|
};
|
|
|
|
struct IDBPartyProcess
|
|
{
|
|
virtual ConvertResult operator() (RylDBCommand::CPartyData& partyData) = 0;
|
|
};
|
|
|
|
struct IDBFriendProcess
|
|
{
|
|
virtual ConvertResult operator() (RylDBCommand::CFriendData& friendData) = 0;
|
|
};
|
|
|
|
struct IDBUnifiedCharInfoProcess
|
|
{
|
|
virtual ConvertResult operator() (RylDBCommand::CUnifiedCharList& unifiedCharList) = 0;
|
|
};
|
|
|
|
|
|
class CRylDBProcess
|
|
{
|
|
public:
|
|
|
|
static HRESULT ConnectDB(ATL::CDataSource& ds,
|
|
const char* szDBAddress, const char* szDBName,
|
|
const char* szDBAccount, const char* szDBPassword);
|
|
|
|
CRylDBProcess(ATL::CSession& dataSession) : m_DataSession(dataSession) { }
|
|
|
|
HRESULT CharInfo(IDBCharInfoProcess& charInfoProcess, IShowCounter& showCounter, char* szQuery = NULL);
|
|
HRESULT CharSkill(IDBCharSkillProcess& charSkillProcess, IShowCounter& showCounter, char* szQuery = NULL);
|
|
HRESULT CharItem(IDBCharItemProcess& charItemProcess, IShowCounter& showCounter, char* szQuery = NULL);
|
|
HRESULT CharItemEx(IDBCharItemExProcess& charItemExProcess, IShowCounter& showCounter, char* szQuery = NULL);
|
|
HRESULT CharQuest(IDBCharQuestProcess& charQuestProcess, IShowCounter& showCounter, char* szQuery = NULL);
|
|
|
|
HRESULT Party(IDBPartyProcess& partyProcess, IShowCounter& showCounter, char* szQuery = NULL);
|
|
HRESULT Friend(IDBFriendProcess& friendProcess, IShowCounter& showCounter, char* szQuery = NULL);
|
|
|
|
HRESULT UnifiedStore1(IDBStoreProcess& storeProcess, IShowCounter& showCounter, char* szQuery = NULL);
|
|
HRESULT UnifiedStore2(IDBStoreProcess& storeProcess, IShowCounter& showCounter, char* szQuery = NULL);
|
|
|
|
HRESULT UnifiedCharList(IDBUnifiedCharInfoProcess& process, IShowCounter& showCounter, char* szQuery = NULL);
|
|
|
|
private:
|
|
|
|
ATL::CSession& m_DataSession;
|
|
};
|
|
|
|
class CDBItemSerialMgr
|
|
{
|
|
public:
|
|
|
|
CDBItemSerialMgr();
|
|
~CDBItemSerialMgr();
|
|
|
|
unsigned __int64 GetItemSerial() const { return m_dwItemSerial; }
|
|
unsigned __int64 GetNewItemSerial() { return ++m_dwItemSerial; }
|
|
bool SetItemSerial(unsigned __int64 dwItemSerial);
|
|
|
|
HRESULT LoadItemSerialDB(ATL::CSession& DBSession, unsigned long dwServerID);
|
|
HRESULT SaveItemSerialDB(ATL::CSession& DBSession, unsigned long dwServerID);
|
|
|
|
HRESULT ClearAllSerialDB(ATL::CSession& DBSession);
|
|
|
|
private:
|
|
|
|
unsigned __int64 m_dwItemSerial;
|
|
unsigned long m_dwServerID;
|
|
};
|
|
|
|
#endif |