MQuestNPC.h
00001 #ifndef _MQUEST_NPC_H 00002 #define _MQUEST_NPC_H 00003 00004 #include "MQuestConst.h" 00005 00007 enum MQUEST_NPC 00008 { 00009 NPC_NONE = 0, 00010 NPC_GOBLIN = 11, 00011 NPC_GOBLIN_GUNNER = 12, 00012 NPC_GOBLIN_WIZARD = 13, 00013 NPC_GOBLIN_COMMANDER = 14, 00014 NPC_GOBLIN_CHIEF = 15, 00015 NPC_GOBLIN_KING = 16, 00016 00017 NPC_PALMPOA = 21, 00018 NPC_PALMPOA_COMMANDER = 22, 00019 NPC_PALMPOW = 23, 00020 NPC_CURSED_PALMPOW = 24, 00021 NPC_PALMPOW_BABY = 25, 00022 00023 NPC_SKELETON = 31, 00024 NPC_SKELETON_MAGE = 32, 00025 NPC_SKELETON_COMMANDER = 33, 00026 NPC_GIANT_SKELETON = 34, 00027 NPC_THE_UNHOLY = 35, 00028 NPC_LICH = 36, 00029 00030 NPC_KOBOLD = 41, 00031 NPC_KOBOLD_SHAMAN = 42, 00032 NPC_KOBOLD_COMMANDER = 43, 00033 NPC_KOBOLD_KING = 44, 00034 NPC_BROKEN_GOLEM = 45, 00035 NPC_SCRIDER = 46, 00036 }; 00037 00039 enum MQUEST_NPC_GRADE 00040 { 00041 NPC_GRADE_REGULAR = 0, 00042 NPC_GRADE_VETERAN, 00043 NPC_GRADE_ELITE, 00044 NPC_GRADE_BOSS, 00045 NPC_GRADE_LEGENDARY, 00046 NPC_GRADE_END 00047 }; 00048 00050 enum MQUEST_NPC_ATTACK 00051 { 00052 NPC_ATTACK_NONE = 0, 00053 NPC_ATTACK_MELEE = 0x1, 00054 NPC_ATTACK_RANGE = 0x2, 00055 NPC_ATTACK_MAGIC = 0x4, 00056 }; 00057 00059 enum MQUEST_NPC_BEHAVIOR 00060 { 00061 00062 }; 00063 00064 00065 00067 struct MQuestNPCInfo 00068 { 00069 // 기본 정보 00070 MQUEST_NPC nID; 00071 MQUEST_NPC_GRADE nGrade; 00072 char szName[256]; 00073 char szDesc[256]; 00074 unsigned long int nNPCAttackTypes; 00075 float fSpeed; 00076 float fWeight; 00077 int nMaxHP; 00078 int nMaxAP; 00079 int nDC; 00080 char szMeshName[256]; 00081 int nWeaponDamage; 00082 float fRotateSpeed; 00083 float fCollRadius; 00084 float fCollHeight; 00085 MVector vScale; 00086 MVector vColor; 00087 unsigned char nSpawnWeight; 00088 unsigned long int nWeaponItemID; 00089 00090 // AI 관련 파라메타 00091 float fAttackRange; 00092 int nAttackRangeAngle; 00093 float fAttackHitRate; 00094 float fCollisionCheckSpeed; 00095 float fUpdateTick; 00096 int nViewAngle; 00097 float fViewDistance; 00098 float fViewDistance360; 00099 00100 // 플래그 00101 bool bNeverBlasted; 00102 bool bMeleeWeaponNeverDamaged; 00103 bool bRangeWeaponNeverDamaged; 00104 bool bShadow; 00105 bool bNeverPushed; 00106 bool bNeverAttackCancel; 00107 00108 int nSkills; 00109 int nSkillIDs[MAX_SKILL]; 00110 00111 // 서버만 사용하는 파라메타 00112 int nDropTableID; 00113 char szDropTableName[8]; 00114 00116 00118 void SetDefault() 00119 { 00120 nID = NPC_GOBLIN; 00121 nGrade = NPC_GRADE_REGULAR; 00122 strcpy(szName, "Noname"); 00123 szDesc[0] = 0; 00124 nNPCAttackTypes = NPC_ATTACK_MELEE; 00125 fSpeed = 300.0f; 00126 fWeight = 1.0f; 00127 nMaxHP = 100; 00128 nMaxAP = 0; 00129 nDC = 5; 00130 szMeshName[0] = 0; 00131 nWeaponDamage = 5; 00132 fRotateSpeed = 6.28318f; 00133 fCollRadius = 35.0f; 00134 fCollHeight = 180.0f; 00135 vScale = MVector(1.0f,1.0f,1.0f); 00136 vColor = MVector(0.6f,0.6f,0.6f); 00137 nSpawnWeight = 100; 00138 nWeaponItemID = 300000; // 고블린 단검 00139 00140 fAttackRange = 130.0f; 00141 nAttackRangeAngle = 180; 00142 fAttackHitRate = 1.0f; // 기본은 100% 명중 (원근 공격 NPC만 이 수치를 사용) 00143 fCollisionCheckSpeed = 0.0f; 00144 fUpdateTick = 1.0f; 00145 nViewAngle = 180; 00146 fViewDistance = 800.0f; 00147 fViewDistance360 = 800.0f; 00148 00149 bNeverBlasted = false; 00150 bMeleeWeaponNeverDamaged = false; 00151 bRangeWeaponNeverDamaged = false; 00152 bShadow = true; 00153 bNeverPushed = false; 00154 bNeverAttackCancel = false; 00155 00156 nSkills = 0; 00157 00158 nDropTableID = 0; 00159 szDropTableName[0] = 0; 00160 } 00161 00162 MQuestNPCSpawnType GetSpawnType(); 00163 }; 00164 00165 00167 class MQuestNPCCatalogue : public map<MQUEST_NPC, MQuestNPCInfo*> 00168 { 00169 private: 00170 // 함수 00171 void ParseNPC(MXmlElement& element); 00172 void Insert(MQuestNPCInfo* pNPCInfo); 00173 public: 00174 MQuestNPCCatalogue(); 00175 ~MQuestNPCCatalogue(); 00176 00177 bool ReadXml(const char* szFileName); 00178 bool ReadXml(MZFileSystem* pFileSystem,const char* szFileName); 00179 void Clear(); 00180 00181 MQuestNPCInfo* GetInfo(MQUEST_NPC nNpc); 00182 MQuestNPCInfo* GetPageInfo( int nPage); 00183 }; 00184 00186 00188 struct MNPCSetNPC 00189 { 00190 MQUEST_NPC nNPC; 00191 float fMinRate; 00192 float fMaxRate; 00193 int nMaxSpawnCount; 00194 00196 MNPCSetNPC() 00197 { 00198 nNPC = NPC_NONE; 00199 fMinRate = 0.0f; 00200 fMaxRate = 0.0f; 00201 nMaxSpawnCount = 0; 00202 } 00203 }; 00204 00206 struct MQuestNPCSetInfo 00207 { 00208 int nID; 00209 char szName[16]; 00210 MQUEST_NPC nBaseNPC; 00211 vector<MNPCSetNPC> vecNPCs; 00212 }; 00213 00215 class MQuestNPCSetCatalogue : public map<int, MQuestNPCSetInfo*> 00216 { 00217 private: 00218 map<string, MQuestNPCSetInfo*> m_NameMap; 00219 // 함수 00220 void Clear(); 00221 void ParseNPCSet(MXmlElement& element); 00222 void Insert(MQuestNPCSetInfo* pNPCSetInfo); 00223 public: 00224 MQuestNPCSetCatalogue(); 00225 ~MQuestNPCSetCatalogue(); 00226 00227 bool ReadXml(const char* szFileName); 00228 bool ReadXml(MZFileSystem* pFileSystem,const char* szFileName); 00229 00230 MQuestNPCSetInfo* GetInfo(int nID); 00231 MQuestNPCSetInfo* GetInfo(const char* szName); 00232 }; 00233 00234 00235 #endif
MAIET entertainment