MBaseGameType.h
00001 #ifndef _MBASEGAMETYPE_H 00002 #define _MBASEGAMETYPE_H 00003 00004 #include <crtdbg.h> 00005 #include <map> 00006 #include <set> 00007 using namespace std; 00008 00009 00011 enum MMATCH_GAMETYPE { 00012 MMATCH_GAMETYPE_DEATHMATCH_SOLO =0, 00013 MMATCH_GAMETYPE_DEATHMATCH_TEAM =1, 00014 MMATCH_GAMETYPE_GLADIATOR_SOLO =2, 00015 MMATCH_GAMETYPE_GLADIATOR_TEAM =3, 00016 MMATCH_GAMETYPE_ASSASSINATE =4, 00017 MMATCH_GAMETYPE_TRAINING =5, 00018 00019 #ifdef _QUEST 00020 MMATCH_GAMETYPE_SURVIVAL =6, 00021 MMATCH_GAMETYPE_QUEST =7, 00022 #endif 00023 00024 /* 00025 #ifndef _CLASSIC 00026 MMATCH_GAMETYPE_CLASSIC_SOLO, 00027 MMATCH_GAMETYPE_CLASSIC_TEAM, 00028 #endif 00029 */ 00030 MMATCH_GAMETYPE_MAX 00031 }; 00032 00033 00034 // 디폴트 게임 타입 00035 const MMATCH_GAMETYPE MMATCH_GAMETYPE_DEFAULT = MMATCH_GAMETYPE_DEATHMATCH_SOLO; 00036 00037 00038 struct MMatchGameTypeInfo 00039 { 00040 MMATCH_GAMETYPE nGameTypeID; // ID 00041 char szGameTypeStr[24]; // 게임 타입 이름 00042 float fGameExpRatio; // 경험치 배분 비율 - 현재 Gladiator만 50%이다 00043 float fTeamMyExpRatio; // 팀전에서 개인에게 적용되는 경험치 00044 float fTeamBonusExpRatio; // 팀전에서 팀에게 적립되는 경험치 00045 set<int> MapSet; // 이 게임타입에서 플레이 가능한 맵 00046 void Set(const MMATCH_GAMETYPE a_nGameTypeID, const char* a_szGameTypeStr, const float a_fGameExpRatio, 00047 const float a_fTeamMyExpRatio, const float a_fTeamBonusExpRatio); 00048 void AddMap(int nMapID); 00049 void AddAllMap(); 00050 }; 00051 00052 00053 class MBaseGameTypeCatalogue 00054 { 00055 private: 00056 MMatchGameTypeInfo m_GameTypeInfo[MMATCH_GAMETYPE_MAX]; 00057 public: 00058 MBaseGameTypeCatalogue(); 00059 virtual ~MBaseGameTypeCatalogue(); 00060 00061 inline MMatchGameTypeInfo* GetInfo(MMATCH_GAMETYPE nGameType); 00062 inline const char* GetGameTypeStr(MMATCH_GAMETYPE nGameType); 00063 inline bool IsCorrectGameType(const int nGameTypeID); 00064 inline bool IsTeamGame(MMATCH_GAMETYPE nGameType); 00065 inline bool IsQuestOnly(MMATCH_GAMETYPE nGameType); 00066 inline bool IsQuestDerived(MMATCH_GAMETYPE nGameType); 00067 inline bool IsWorldItemSpawnEnable(MMATCH_GAMETYPE nGameType); 00068 }; 00069 00070 00072 inline bool MBaseGameTypeCatalogue::IsTeamGame(MMATCH_GAMETYPE nGameType) 00073 { 00074 // 좀더 복잡해지면 Description에 teamgame인지 여부값을 넣도록 하자. 00075 00076 if ((nGameType == MMATCH_GAMETYPE_DEATHMATCH_TEAM) || 00077 (nGameType == MMATCH_GAMETYPE_GLADIATOR_TEAM) || 00078 (nGameType == MMATCH_GAMETYPE_ASSASSINATE) ) 00079 { 00080 return true; 00081 } 00082 return false; 00083 } 00084 00085 inline bool MBaseGameTypeCatalogue::IsQuestDerived(MMATCH_GAMETYPE nGameType) 00086 { 00087 #ifdef _QUEST 00088 if ( (nGameType == MMATCH_GAMETYPE_SURVIVAL) ||(nGameType == MMATCH_GAMETYPE_QUEST) ) 00089 { 00090 return true; 00091 } 00092 #endif 00093 return false; 00094 } 00095 00096 inline bool MBaseGameTypeCatalogue::IsQuestOnly(MMATCH_GAMETYPE nGameType) 00097 { 00098 #ifdef _QUEST 00099 if ( nGameType == MMATCH_GAMETYPE_QUEST) 00100 { 00101 return true; 00102 } 00103 #endif 00104 return false; 00105 } 00106 00107 inline const char* MBaseGameTypeCatalogue::GetGameTypeStr(MMATCH_GAMETYPE nGameType) 00108 { 00109 return m_GameTypeInfo[nGameType].szGameTypeStr; 00110 } 00111 00112 bool MBaseGameTypeCatalogue::IsCorrectGameType(const int nGameTypeID) 00113 { 00114 if ((nGameTypeID < 0) || (nGameTypeID >= MMATCH_GAMETYPE_MAX)) return false; 00115 return true; 00116 } 00117 00118 inline MMatchGameTypeInfo* MBaseGameTypeCatalogue::GetInfo(MMATCH_GAMETYPE nGameType) 00119 { 00120 _ASSERT((nGameType >= 0) && (nGameType < MMATCH_GAMETYPE_MAX)); 00121 return &m_GameTypeInfo[nGameType]; 00122 } 00123 00124 inline bool MBaseGameTypeCatalogue::IsWorldItemSpawnEnable(MMATCH_GAMETYPE nGameType) 00125 { 00126 #ifdef _QUEST 00127 if ( (nGameType == MMATCH_GAMETYPE_SURVIVAL) ||(nGameType == MMATCH_GAMETYPE_QUEST) ) 00128 { 00129 return false; 00130 } 00131 #endif 00132 return true; 00133 00134 } 00135 00136 #endif
MAIET entertainment