#ifndef _RYL_DBAGENT_GAME_TIME_DB_MANAGER_H_ #define _RYL_DBAGENT_GAME_TIME_DB_MANAGER_H_ #pragma once #include #include #include #include #include using namespace GameTime; using namespace DBAgent; class CDBComponent; class CDBComponent; class CSessionData; class CGameTimeDBMgr { public: // °ÔÀÓ ½Ã°£º° ±¸Á¶Ã¼ struct sGameTime { unsigned long m_dwID; TimeType m_eTimeType; // °ÔÀÓ ½Ã°£ ŸÀÔ (±æµåÀü, ·¼¸§Àü, °ø¼ºÀü) Cycle m_eTimeCycle; // °ÔÀÓ ½Ã°£ ÁÖ±â (¸ÅÁÖ, ¸ÅÀÏ, ¸Å¿ù, ƯÁ¤ÀÏ) Week m_eWeek; // Cycle ÀÌ Weekly ÀÏ °æ¿ìÀÇ ¿äÀÏ unsigned short m_wYear; // ³âµµ unsigned char m_cMonth; // ¿ù unsigned char m_cDay; // ÀÏ unsigned char m_cHour; // ½Ã°£ unsigned char m_cMinute; // ºÐ unsigned long m_dwDuration; // Ç÷¹ÀÌ Å¸ÀÓ (ºÐ) // edith 2009.07.21 °ÔÀÓŸÀÓ ÀÛ¾÷¹° unsigned long m_dwValue1; // ±âŸÀÛ¾÷¹° unsigned long m_dwValue2; // ±âŸÀÛ¾÷¹° sGameTime::sGameTime() { m_dwID = 0; m_eTimeType = TYPE_NONE; m_eTimeCycle = CYCLE_NONE; m_eWeek = WEEK_NONE; m_wYear = 0; m_cMonth = 0; m_cDay = 0; m_cHour = 0; m_cMinute = 0; m_dwDuration = 0; m_dwValue1 = 0; m_dwValue2 = 0; } }; typedef std::map GameTimeTable; // ÆÄ½Ì ±¸Á¶Ã¼ struct ParseData { typedef bool(*ParseFunc) (sGameTime& gametime, const char* szValue); const char* m_szColumnName; ParseFunc m_fnParseFunc; ParseData(const char* szColumnName, ParseFunc fnParseFunc) : m_szColumnName(szColumnName), m_fnParseFunc(fnParseFunc) { } }; typedef std::vector ParseDataArray; public: bool LoadGameTimeScript(const char* szFileName); bool Initialize(CDBComponent& DBComponent); void InitGameTimeValue(unsigned char cGuildTime, unsigned char cRealmTime, unsigned char cSiegeTime, unsigned char cMiningTime, unsigned char cEnterTime, unsigned char cEventTime); void Process(); void CheckGameTime(); void SendGameTimeInfo(unsigned char cType, bool bUpdateGuildTime, bool bUpdateRealmTime, bool bUpdateSiegeTime, bool bUpdateEnterTime, bool bUpdateEventTime); void SendGameTimeInfo(unsigned long dwCastleID); // ƯÁ¤ ¼ºÀÇ °ø¼º °¡´É¿©ºÎ º¯°æ½Ã unsigned char GetCurrentGameTime(unsigned char cTimeType) const; unsigned char GetCurrentGuildTime() const; unsigned char GetCurrentRealmTime() const; unsigned char GetCurrentSiegeTime() const; unsigned char GetCurrentEnterTime() const; unsigned char GetCurrentMiningTime() const; // edith 2009.07.21 °ÔÀÓŸÀÓ ÀÛ¾÷¹° unsigned char GetCurrentEventTime() const; bool IsGuildWarTime() const; bool IsRealmWarTime() const; bool IsSiegeWarTime() const; bool IsEnterTime() const; bool IsMiningTime() const; // edith 2009.07.21 °ÔÀÓŸÀÓ ÀÛ¾÷¹° bool IsEventTime() const; bool IsGuildWarTime(unsigned char cTime) const; bool IsRealmWarTime(unsigned char cTime) const; bool IsSiegeWarTime(unsigned char cTime) const; bool IsEnterTime(unsigned char cTime) const; bool IsMiningTime(unsigned char cTime) const; // edith 2009.07.21 °ÔÀÓŸÀÓ ÀÛ¾÷¹° bool IsEventTime(unsigned char cTime) const; bool IsRealmWarReadyTime() const; bool IsRealmWarReadyTime(unsigned char cTime) const; const GameTimeTable& GetGameTimeTable() const { return m_GameTimeTable; } static CGameTimeDBMgr& GetInstance(); void CheckRealmCount(CTime& startTime, unsigned long* dwRealmCount_Out); // ±¹°¡ÀüÀï Ƚ¼ö´Â üũ. unsigned long GetRealmDuration(void) { return m_dwRealmTime; } protected: CGameTimeDBMgr(); ~CGameTimeDBMgr(); private: bool SetGameTimeParseData(ParseDataArray& parseDataArray); bool IntegrityCheck(); // ¹«°á¼º °Ë»ç CTime GetTimeByCycle(sGameTime* lpGameTime, CTime nowTime = 0); CTime GetWeeklyTime(sGameTime* lpGameTime, CTime nowTime = 0); CTime GetDailyTime(sGameTime* lpGameTime, CTime nowTime = 0); CTime GetMonthlyTime(sGameTime* lpGameTime, CTime nowTime = 0); CTime GetDateTime(sGameTime* lpGameTime, CTime nowTime = 0); void GetTimeInfo(unsigned char cType, TimeInfo& timeInfo); void GetNextMonth(CTime* pTime); private: unsigned char m_cNowGuildTime; // enum GuildTime unsigned char m_cNowRealmTime; // enum RealmTime unsigned char m_cNowSiegeTime; // enum SiegeTime unsigned char m_cNowEnterTime; // enum EnterTime. Å×¼·¿ë ½Å±ÔÁ¸ ÁøÀÔÁ¦ÇÑ Ç÷¡±× unsigned char m_cNowMiningTime; // enum MiningTime // edith 2009.07.21 °ÔÀÓŸÀÓ ÀÛ¾÷¹° unsigned char m_cNowEventTime; // enum EventTime GameTimeTable m_GameTimeTable; CDBComponent* m_lpDBComponent; unsigned long m_dwRealmTime; // ÇöÀç¿¡ ±¹°¡ÀüÀï Ç÷¹ÀÌ Å¸ÀÓÀ» °¡Áö°í Àִ´Ù. }; namespace RealmPoint { void AddRealmPoint(DBAgent::DataStorage::CSessionData* sessionData, unsigned char cRealmType); void InitRealmTime(DBAgent::DataStorage::CSessionData* sessionData, TIME* pTime); }; #endif // _RYL_DBAGENT_GAME_TIME_DB_MANAGER_H_