#ifndef _RYL_DBAGENT_SESSION_DATA_H_ #define _RYL_DBAGENT_SESSION_DATA_H_ #include #include #include #include "Billing.h" #include //! forward decl. class CDBComponent; namespace DBAgent { namespace DataStorage { //! forward decl. class CCharacterData; class CStoreData; struct RequestData { enum { // edith 2008.03.17 ID,PASS ±æÀÌÁ¶Á¤ MaxName = 24, MaxPass = 36, }; unsigned long m_dwRequestKey; unsigned long m_dwSelectedCID; unsigned long m_dwServerID; unsigned long m_dwSessionID; IN_ADDR m_PeerAddress; char m_szAccount[MaxName]; // edith 2008.01.15 ÆÐ½º¿öµå Ãß°¡ÀÛ¾÷ char m_szPassword[MaxPass]; RequestData(); // edith 2008.01.15 ÆÐ½º¿öµå Ãß°¡ÀÛ¾÷ RequestData(unsigned long dwRequestKey, unsigned long dwSelectedCID, unsigned long dwServerID, unsigned long dwSessionID, IN_ADDR peerAddr, const char* szAccountName, const char* szPassword); }; class CSessionData { public: enum SessionState { SE_NONE = 0, SE_USER_ENABLED = 1, SE_USER_DISABLED = 2, SE_MOVE = 3, SE_CHAR_ENABLED = 4, SE_CHAR_DISABLED = 5, SE_MAX_STATE = 6 }; enum { MAX_REALM_POINT = 5, // ¸¶¶¥È÷ ³ÖÀ»°÷ÀÌ ¾ø¾î¼­ ¤Ð,.¤Ð by Minbobo. REALM_POINT_TIME = 60, // 60 ºÐ FAME_PANELTY_VALUE_1ST = 5000, FAME_PANELTY_VALUE_2ND = 10000, }; struct SaveEnemy { enum { MAX_SAVING_ENEMY = 5, // ±â¾ïÇÏ´Â ÃÖ´ë °³Ã¼ ¼ö }; unsigned long m_dwCID; unsigned long m_dwTick; }; typedef std::deque RequestQueue; CSessionData(); ~CSessionData(); //! ¼¼¼Ç ±âº» µ¥ÀÌÅÍ. unsigned long GetUID() const { return m_dwUID; } unsigned long GetCID() const { return m_dwCID; } unsigned long GetSessionID() const { return m_dwSessionID; } unsigned long GetServerID() const { return m_dwServerID; } IN_ADDR GetRemoteAddress() const { return m_RemoteAddress; } const char* GetAccountName() const { return m_szAccount; } unsigned char GetAdminLevel() const { return m_cAdminLevel; } // WORK_LIST 2.1 °èÁ¤ ±¹Àû Ãß°¡ unsigned char GetAccountNation() const { return m_UserInfo.Nation; } void SetAccountNation(unsigned char cNation) { m_UserInfo.Nation = cNation; } const USER_INFO& GetUserInfo() const { return m_UserInfo; } const CHAR_VIEW* GetCharView(unsigned char cIndex) const { return (cIndex < USER_INFO::MAX_CHAR_NUM) ? m_CharView + cIndex : 0; } bool GetCharView(unsigned long dwCID, CHAR_VIEW& charView_Out); // WORK_LIST 2.3 °èÁ¤ ±¹Àû º¯°æ ±â´É ±¸Çö bool SetCharViewGID(unsigned long dwCID, unsigned long dwGID); bool SetCharViewFame(unsigned long dwCID, unsigned long dwFame); CBilling& GetBilling() { return m_Billing; } bool HasCharacter(unsigned long dwCID) const; //! ¼¼¼Ç »óÅ ¾ò¾î¿À±â ¹×, ¼¼¼Ç »óÅ Àüȯ ÇÔ¼ö SessionState GetSessionState() const { return m_eSessionState; } void SetSessionState(SessionState eSessionState) { m_eSessionState = eSessionState; } //! ÀÎÁõ¼­¹ö ID·Î ¼¼ÆÃ void SetAuthServerID(); void SetAccountName(const char* szAccountName); //! À¯Àú Enable/Disable/Move bool UserEnable(CDBComponent& DBComponent, unsigned long dwUID); bool UserDisable(); bool UserMove(); //! ij¸¯ÅÍ Enable/Disable/Move bool LoadData(unsigned long dwCID); void UnloadData(); bool CharEnable(unsigned long dwCID, unsigned long dwServerID); bool CharDisable(unsigned long dwCID, unsigned long dwServerID); bool CharMove(unsigned long dwCID, unsigned long dwServerID); //! ¼¼¼Ç ¿¬µ¿µÈ µ¥ÀÌÅÍ. (ij¸¯ÅÍ) CCharacterData* GetCharacterData() { return m_lpCharacterData; } CStoreData* GetStoreData() { return m_lpStoreData; } SaveEnemy* GetSaveEnemy() { return m_SaveEnemy; } //! ¼¼¼Ç ¿¬µ¿µÈ µ¥ÀÌÅÍ. (â°í) void SetCharacterData(CCharacterData* lpCharacterData) { m_lpCharacterData = lpCharacterData; } void SetStoreData(CStoreData* lpStoreData) { m_lpStoreData = lpStoreData; } //! Á¸ À̵¿ °ü·Ã µ¥ÀÌÅÍ bool SetMoveZone(unsigned char cZone, const POS& Pos); void UpdateMoveZone(); bool CheckCharZone(unsigned char cZone); unsigned char GetCharStartZone(char cRace); bool GetPlayTimeFromDB(CDBComponent& DBComponent); bool GetPremiumServiceFromDB(CDBComponent& DBComponent); bool GetUserInfoFromDB(CDBComponent& DBComponent); //! DB·ÎºÎÅÍ À¯Àú Á¤º¸ ¹× ºä¸¦ ¾ò¾î¿Â´Ù. bool GetUnifiedDataFromDB(CDBComponent& DBComponent); //! DB·ÎºÎÅÍ ÅëÇÕ À¯Àú Á¤º¸¸¦ ¾ò¾î¿Â´Ù. //! µ¥ÀÌÅÍ ·Î±× °ü·Ã ¸Þ¼Òµå void LogUserData(const char* szMessage); void LogCharData(const char* szMessage); void LogUserDataError(const char* szMessage, const char* szRoutine, const char* szFile, int nLine); void LogCharDataError(const char* szMessage, const char* szRoutine, const char* szFile, int nLine); //! µ¥ÀÌÅÍ ¼¼ÆÃ °ü·Ã ¸Þ¼Òµå void SetUID(unsigned long dwUID) { m_dwUID = dwUID; } void SetAddress(IN_ADDR addr) { m_RemoteAddress = addr; } //! ¿äû Å¥ °ü·Ã (dwRequestKey°¡ 0ÀÌ¸é ¿¡·¯) void PushRequest(const RequestData& reqData); RequestData PopRequest(); void SetRequestData(const RequestData& reqData); //! ¼­¹öÅëÇÕ °ü·Ã µ¥ÀÌÅÍ unsigned char GetOldServerGroupID() const { return m_cOldServerGroupID; } void SetOldServerGroupID(unsigned char cOldServerGroupID) { m_cOldServerGroupID = cOldServerGroupID; } const UnifiedStoreInfo* GetUnifiedStoreInfo() const { return m_UnifiedStoreInfo; } const UnifiedCharData* GetUnifiedCharData() const { return m_UnifiedCharData; } const UnifiedCharData* GetUnifiedCharData(unsigned long dwCID) const; int GetUnifiedStoreInfoNum() const { return m_nUnifiedStoreInfoNum; } int GetUnifiedCharDataNum() const { return m_nUnifiedCharDataNum; } // â°í ¼±Åà / óÀ½ ·Î±×ÀÎ ¿©ºÎ µî Á¤º¸¸¦ ´ã°í ÀÖ´Â µ¥ÀÌÅÍ unsigned char GetFirstLogin() const { return m_UserInfo.FirstLogin; } void SetFirstLogin(unsigned char cFirstLogin) { m_UserInfo.FirstLogin = cFirstLogin; } // ÇØ´çÇÏ´Â ¼­¹ö±º ¹øÈ£ÀÇ Ã¢°í°¡ ÀÖ´ÂÁö »ìÇÉ´Ù. bool HasUnifiedStoreInfo(unsigned char cOldServerGroupID); // ÇØ´çÇÏ´Â ¼­¹ö±º ¹øÈ£ÀÇ Ã¢°íÀÇ ¼­¹ö±º ¹øÈ£¸¦ ¹Ù²Û´Ù. bool ChangeUnifiedStoreInfoGroup(CDBComponent& DBComponent, unsigned char cOldServerGroupID, unsigned char cNewServerGroupID); // UID/CID°¡ ÀÏÄ¡Çϴ ij¸¯ÅÍÀÇ ¼­¹ö±×·ìID¸¦ ¹Ù²Û´Ù. bool ChangeUnifiedCharServerGroupID(CDBComponent& DBComponent, unsigned long dwUID, unsigned long dwCID, unsigned char cOldServerGroupID); // ÇØ´çÇÏ´Â ÅëÇÕ¼­¹ö ij¸¯ÅÍ Á¤º¸¸¦ Á¦°ÅÇÑ´Ù(ij¸¯ÅÍ »èÁ¦½Ã »ç¿ë) bool DelUnifiedCharData(unsigned long dwCID); // ij¸¯ÅÍ ¹ÙÀεùÀ» ¼öÁ¤ÇÑ´Ù. bool UpdateCharacterBinding(CDBComponent& DBComponent, unsigned long dwSelectedCID[USER_INFO::MAX_CHAR_NUM]); // ij¸¯ÅÍ CID¸¦ ÁÖ¸é ¼±ÅÃµÈ Á¾Á·À» µ¹·ÁÁØ´Ù. CClass::RaceType CheckUnifiedCharRace(unsigned long dwSelectedCID[USER_INFO::MAX_CHAR_NUM]); // Part1 -> Part2 ij¸¯ÅÍ ÀÌÀü ȸ¼ö¸¦ Á¦¾îÇÑ´Ù. unsigned char GetTransferedCharCount(CDBComponent& DBComponent); bool UpdateTransferedCharCount(CDBComponent& DBComponent); // ij¸¯ÅÍ Ã¢°í Á¤º¸. bool GetUnifiedInfo(CDBComponent& DBComponent, unsigned long UserID_In); // ij¸¯ÅÍ ±¹°¡ÀüÀï Æ÷ÀÎÆ® üũ. bool GetRealmPointCheck(); // Á¶À̽ºÆ½ Á¤º¸¸¦ ¾ò¾î¿Â´Ù. KeyInfo* GetKeyInfo(void) { return &m_KeyInfo; } unsigned int GetPlayTime() { return m_dwPlayTime; } long GetPremiumTime() { return m_PremiumService.lPremiumTime; } int GetPremiumType() { return m_PremiumService.iPremiumType; } private: USER_INFO m_UserInfo; //! À¯Àú Á¤º¸ CHAR_VIEW m_CharView[USER_INFO::MAX_CHAR_NUM]; //! ij¸¯ÅÍ ºä UnifiedStoreInfo m_UnifiedStoreInfo[PktUnifiedCharInfo::MAX_STORE_INFO]; // ÅëÇÕ Ã¢°í Á¤º¸ UnifiedCharData m_UnifiedCharData[PktUnifiedCharInfo::MAX_CHAR_DATA]; // ÅëÇÕ Ä³¸¯ÅÍ Á¤º¸ int m_nUnifiedStoreInfoNum; int m_nUnifiedCharDataNum; char m_szAccount[CHAR_INFOST::MAX_ACCOUNT_LEN]; //! °èÁ¤¸í IN_ADDR m_RemoteAddress; //! Á¢¼Ó À¯ÀúÀÇ ÁÖ¼Ò unsigned long m_dwUID; //! Á¢¼Ó À¯Àú UID unsigned long m_dwCID; //! Á¢¼Ó À¯Àú CID unsigned long m_dwSessionID; //! Á¢¼Ó À¯Àú SessionID unsigned long m_dwServerID; //! Á¢¼Ó À¯Àú ServerID SessionState m_eSessionState; //! ÇöÀç ¼¼¼ÇÀÇ »óÅ unsigned long m_dwFlags; //! °¢Á¾ Flagµé CBilling m_Billing; //! °ú±Ý°ü·Ã Á¤º¸ ¹× ó¸® RequestQueue m_RequestQueue; //! ¿äû Å¥ CCharacterData* m_lpCharacterData; //! ij¸¯ÅÍ µ¥ÀÌÅÍ CStoreData* m_lpStoreData; //! â°í µ¥ÀÌÅÍ unsigned char m_cAdminLevel; //! ¿î¿µÀÚ ·¹º§ unsigned char m_cOldServerGroupID; //! ¿¹Àü ¼­¹ö±º ID : 1~10 / ³ª¸ÓÁö´Â CServerSetup::AgentServerType À» Âü°í. unsigned char m_cTransferedCharCount; //! ij¸¯ÅÍ ÀÌÀü ȸ¼ö. ÃʱⰪÀº UCHAR_MAX À̰í, //! GetTransferedCharCount¸¦ È£Ãâ½Ã¿¡, ÃʱⰪ ±×´ë·ÎÀ̸é DB¿¡¼­ ·ÎµåÇÑ´Ù. char m_cNewZone; //! Á¸ À̵¿½Ã À̵¿ÇÒ Á¸ Ç¥½Ã POS m_NewPos; //! Á¸ À̵¿½Ã À̵¿ÇÒ ÁÂÇ¥ Ç¥½Ã SaveEnemy m_SaveEnemy[SaveEnemy::MAX_SAVING_ENEMY]; KeyInfo m_KeyInfo; unsigned int m_dwPlayTime; PREMIUMSERVICE m_PremiumService; }; extern const char* g_szSessionStateString[CSessionData::SE_MAX_STATE]; } } #endif