1. #ifndef __INC_METIN_II_GAME_INPUT_PROCESSOR__
  2. #define __INC_METIN_II_GAME_INPUT_PROCESSOR__
  3. #include "packet_info.h"
  4. enum
  5. {
  6. INPROC_CLOSE,
  7. INPROC_HANDSHAKE,
  8. INPROC_LOGIN,
  9. INPROC_MAIN,
  10. INPROC_DEAD,
  11. INPROC_DB,
  12. INPROC_UDP,
  13. INPROC_P2P,
  14. INPROC_AUTH,
  15. };
  16. void LoginFailure (LPDESC d, const char* c_pszStatus);
  17. class CInputProcessor
  18. {
  19. public:
  20. CInputProcessor();
  21. virtual ~CInputProcessor() {};
  22. virtual bool Process (LPDESC d, const void* c_pvOrig, int iBytes, int& r_iBytesProceed);
  23. virtual BYTE GetType() = 0;
  24. void BindPacketInfo (CPacketInfo* pPacketInfo);
  25. void Pong (LPDESC d);
  26. void Handshake (LPDESC d, const char* c_pData);
  27. void Version (LPCHARACTER ch, const char* c_pData);
  28. protected:
  29. virtual int Analyze (LPDESC d, BYTE bHeader, const char* c_pData) = 0;
  30. CPacketInfo* m_pPacketInfo;
  31. int m_iBufferLeft;
  32. CPacketInfoCG m_packetInfoCG;
  33. };
  34. class CInputClose : public CInputProcessor
  35. {
  36. public:
  37. virtual BYTE GetType()
  38. {
  39. return INPROC_CLOSE;
  40. }
  41. protected:
  42. virtual int Analyze (LPDESC d, BYTE bHeader, const char* c_pData)
  43. {
  44. return m_iBufferLeft;
  45. }
  46. };
  47. class CInputHandshake : public CInputProcessor
  48. {
  49. public:
  50. CInputHandshake();
  51. virtual ~CInputHandshake();
  52. virtual BYTE GetType()
  53. {
  54. return INPROC_HANDSHAKE;
  55. }
  56. protected:
  57. virtual int Analyze (LPDESC d, BYTE bHeader, const char* c_pData);
  58. protected:
  59. void GuildMarkLogin (LPDESC d, const char* c_pData);
  60. CPacketInfo* m_pMainPacketInfo;
  61. };
  62. class CInputLogin : public CInputProcessor
  63. {
  64. public:
  65. virtual BYTE GetType()
  66. {
  67. return INPROC_LOGIN;
  68. }
  69. protected:
  70. virtual int Analyze (LPDESC d, BYTE bHeader, const char* c_pData);
  71. protected:
  72. void Login (LPDESC d, const char* data);
  73. void LoginByKey (LPDESC d, const char* data);
  74. void CharacterSelect (LPDESC d, const char* data);
  75. void CharacterCreate (LPDESC d, const char* data);
  76. void CharacterDelete (LPDESC d, const char* data);
  77. void Entergame (LPDESC d, const char* data);
  78. void Empire (LPDESC d, const char* c_pData);
  79. void GuildMarkCRCList (LPDESC d, const char* c_pData);
  80. // MARK_BUG_FIX
  81. void GuildMarkIDXList (LPDESC d, const char* c_pData);
  82. // END_OF_MARK_BUG_FIX
  83. void GuildMarkUpload (LPDESC d, const char* c_pData);
  84. int GuildSymbolUpload (LPDESC d, const char* c_pData, size_t uiBytes);
  85. void GuildSymbolCRC (LPDESC d, const char* c_pData);
  86. void ChangeName (LPDESC d, const char* data);
  87. };
  88. class CInputMain : public CInputProcessor
  89. {
  90. public:
  91. virtual BYTE GetType()
  92. {
  93. return INPROC_MAIN;
  94. }
  95. protected:
  96. virtual int Analyze (LPDESC d, BYTE bHeader, const char* c_pData);
  97. protected:
  98. void Attack (LPCHARACTER ch, const BYTE header, const char* data);
  99. int Whisper (LPCHARACTER ch, const char* data, size_t uiBytes);
  100. int Chat (LPCHARACTER ch, const char* data, size_t uiBytes);
  101. void ItemUse (LPCHARACTER ch, const char* data);
  102. void ItemDrop (LPCHARACTER ch, const char* data);
  103. void ItemDrop2 (LPCHARACTER ch, const char* data);
  104. void ItemMove (LPCHARACTER ch, const char* data);
  105. void ItemPickup (LPCHARACTER ch, const char* data);
  106. void ItemToItem (LPCHARACTER ch, const char* pcData);
  107. void QuickslotAdd (LPCHARACTER ch, const char* data);
  108. void QuickslotDelete (LPCHARACTER ch, const char* data);
  109. void QuickslotSwap (LPCHARACTER ch, const char* data);
  110. int Shop (LPCHARACTER ch, const char* data, size_t uiBytes);
  111. void OnClick (LPCHARACTER ch, const char* data);
  112. void Exchange (LPCHARACTER ch, const char* data);
  113. void Position (LPCHARACTER ch, const char* data);
  114. void Move (LPCHARACTER ch, const char* data);
  115. int SyncPosition (LPCHARACTER ch, const char* data, size_t uiBytes);
  116. void FlyTarget (LPCHARACTER ch, const char* pcData, BYTE bHeader);
  117. void UseSkill (LPCHARACTER ch, const char* pcData);
  118. void ScriptAnswer (LPCHARACTER ch, const void* pvData);
  119. void ScriptButton (LPCHARACTER ch, const void* pvData);
  120. void ScriptSelectItem (LPCHARACTER ch, const void* pvData);
  121. void QuestInputString (LPCHARACTER ch, const void* pvData);
  122. void QuestConfirm (LPCHARACTER ch, const void* pvData);
  123. void Target (LPCHARACTER ch, const char* pcData);
  124. void Warp (LPCHARACTER ch, const char* pcData);
  125. void SafeboxCheckin (LPCHARACTER ch, const char* c_pData);
  126. void SafeboxCheckout (LPCHARACTER ch, const char* c_pData, bool bMall);
  127. void SafeboxItemMove (LPCHARACTER ch, const char* data);
  128. int Messenger (LPCHARACTER ch, const char* c_pData, size_t uiBytes);
  129. void PartyInvite (LPCHARACTER ch, const char* c_pData);
  130. void PartyInviteAnswer (LPCHARACTER ch, const char* c_pData);
  131. void PartyRemove (LPCHARACTER ch, const char* c_pData);
  132. void PartySetState (LPCHARACTER ch, const char* c_pData);
  133. void PartyUseSkill (LPCHARACTER ch, const char* c_pData);
  134. void PartyParameter (LPCHARACTER ch, const char* c_pData);
  135. int Guild (LPCHARACTER ch, const char* data, size_t uiBytes);
  136. void AnswerMakeGuild (LPCHARACTER ch, const char* c_pData);
  137. void Fishing (LPCHARACTER ch, const char* c_pData);
  138. void ItemGive (LPCHARACTER ch, const char* c_pData);
  139. void Hack (LPCHARACTER ch, const char* c_pData);
  140. int MyShop (LPCHARACTER ch, const char* c_pData, size_t uiBytes);
  141. void Refine (LPCHARACTER ch, const char* c_pData);
  142. };
  143. class CInputDead : public CInputMain
  144. {
  145. public:
  146. virtual BYTE GetType()
  147. {
  148. return INPROC_DEAD;
  149. }
  150. protected:
  151. virtual int Analyze (LPDESC d, BYTE bHeader, const char* c_pData);
  152. };
  153. class CInputDB : public CInputProcessor
  154. {
  155. public:
  156. virtual bool Process (LPDESC d, const void* c_pvOrig, int iBytes, int& r_iBytesProceed);
  157. virtual BYTE GetType()
  158. {
  159. return INPROC_DB;
  160. }
  161. protected:
  162. virtual int Analyze (LPDESC d, BYTE bHeader, const char* c_pData);
  163. protected:
  164. void MapLocations (const char* c_pData);
  165. void LoginSuccess (DWORD dwHandle, const char* data);
  166. void PlayerCreateFailure (LPDESC d, BYTE bType); // 0 = �Ϲ� ���� 1 = �̹� ����
  167. void PlayerDeleteSuccess (LPDESC d, const char* data);
  168. void PlayerDeleteFail (LPDESC d);
  169. void PlayerLoad (LPDESC d, const char* data);
  170. void PlayerCreateSuccess (LPDESC d, const char* data);
  171. void Boot (const char* data);
  172. void QuestLoad (LPDESC d, const char* c_pData);
  173. void SafeboxLoad (LPDESC d, const char* c_pData);
  174. void SafeboxChangeSize (LPDESC d, const char* c_pData);
  175. void SafeboxWrongPassword (LPDESC d);
  176. void SafeboxChangePasswordAnswer (LPDESC d, const char* c_pData);
  177. void MallLoad (LPDESC d, const char* c_pData);
  178. void EmpireSelect (LPDESC d, const char* c_pData);
  179. void P2P (const char* c_pData);
  180. void ItemLoad (LPDESC d, const char* c_pData);
  181. void AffectLoad (LPDESC d, const char* c_pData);
  182. void GuildLoad (const char* c_pData);
  183. void GuildSkillUpdate (const char* c_pData);
  184. void GuildSkillRecharge();
  185. void GuildExpUpdate (const char* c_pData);
  186. void GuildAddMember (const char* c_pData);
  187. void GuildRemoveMember (const char* c_pData);
  188. void GuildChangeGrade (const char* c_pData);
  189. void GuildChangeMemberData (const char* c_pData);
  190. void GuildDisband (const char* c_pData);
  191. void GuildLadder (const char* c_pData);
  192. void GuildWar (const char* c_pData);
  193. void GuildWarScore (const char* c_pData);
  194. void GuildSkillUsableChange (const char* c_pData);
  195. void GuildMoneyChange (const char* c_pData);
  196. void GuildWithdrawMoney (const char* c_pData);
  197. void GuildWarReserveAdd (TGuildWarReserve* p);
  198. void GuildWarReserveUpdate (TGuildWarReserve* p);
  199. void GuildWarReserveDelete (DWORD dwID);
  200. void GuildWarBet (TPacketGDGuildWarBet* p);
  201. void GuildChangeMaster (TPacketChangeGuildMaster* p);
  202. void LoginAlready (LPDESC d, const char* c_pData);
  203. void PartyCreate (const char* c_pData);
  204. void PartyDelete (const char* c_pData);
  205. void PartyAdd (const char* c_pData);
  206. void PartyRemove (const char* c_pData);
  207. void PartyStateChange (const char* c_pData);
  208. void PartySetMemberLevel (const char* c_pData);
  209. void Time (const char* c_pData);
  210. void ReloadProto (const char* c_pData);
  211. void ChangeName (LPDESC d, const char* data);
  212. void AuthLogin (LPDESC d, const char* c_pData);
  213. void ItemAward (const char* c_pData);
  214. void ChangeEmpirePriv (const char* c_pData);
  215. void ChangeGuildPriv (const char* c_pData);
  216. void ChangeCharacterPriv (const char* c_pData);
  217. void MoneyLog (const char* c_pData);
  218. void SetEventFlag (const char* c_pData);
  219. void BillingRepair (const char* c_pData);
  220. void BillingExpire (const char* c_pData);
  221. void BillingLogin (const char* c_pData);
  222. void BillingCheck (const char* c_pData);
  223. void CreateObject (const char* c_pData);
  224. void DeleteObject (const char* c_pData);
  225. void UpdateLand (const char* c_pData);
  226. void Notice (const char* c_pData);
  227. void MarriageAdd (TPacketMarriageAdd* p);
  228. void MarriageUpdate (TPacketMarriageUpdate* p);
  229. void MarriageRemove (TPacketMarriageRemove* p);
  230. void WeddingRequest (TPacketWeddingRequest* p);
  231. void WeddingReady (TPacketWeddingReady* p);
  232. void WeddingStart (TPacketWeddingStart* p);
  233. void WeddingEnd (TPacketWeddingEnd* p);
  234. // MYSHOP_PRICE_LIST
  235. /// ������ �������� ����Ʈ ��û�� ���� ���� ��Ŷ(HEADER_DG_MYSHOP_PRICELIST_RES) ó���Լ�
  236. /**
  237. * @param d ������ �������� ����Ʈ�� ��û�� �÷��̾��� descriptor
  238. * @param p ��Ŷ�������� ������
  239. */
  240. void MyshopPricelistRes (LPDESC d, const TPacketMyshopPricelistHeader* p);
  241. // END_OF_MYSHOP_PRICE_LIST
  242. //
  243. //RELOAD_ADMIN
  244. void ReloadAdmin (const char* c_pData);
  245. //END_RELOAD_ADMIN
  246. void DetailLog (const TPacketNeedLoginLogInfo* info);
  247. // ���� ���� ��� �׽�Ʈ
  248. void ItemAwardInformer (TPacketItemAwardInfromer* data);
  249. void RespondChannelStatus (LPDESC desc, const char* pcData);
  250. protected:
  251. DWORD m_dwHandle;
  252. };
  253. class CInputP2P : public CInputProcessor
  254. {
  255. public:
  256. CInputP2P();
  257. virtual BYTE GetType()
  258. {
  259. return INPROC_P2P;
  260. }
  261. protected:
  262. virtual int Analyze (LPDESC d, BYTE bHeader, const char* c_pData);
  263. public:
  264. void Setup (LPDESC d, const char* c_pData);
  265. void Login (LPDESC d, const char* c_pData);
  266. void Logout (LPDESC d, const char* c_pData);
  267. int Relay (LPDESC d, const char* c_pData, size_t uiBytes);
  268. int Notice (LPDESC d, const char* c_pData, size_t uiBytes);
  269. int Guild (LPDESC d, const char* c_pData, size_t uiBytes);
  270. void Shout (const char* c_pData);
  271. void Disconnect (const char* c_pData);
  272. void MessengerAdd (const char* c_pData);
  273. void MessengerRemove (const char* c_pData);
  274. void FindPosition (LPDESC d, const char* c_pData);
  275. void WarpCharacter (const char* c_pData);
  276. void GuildWarZoneMapIndex (const char* c_pData);
  277. void Transfer (const char* c_pData);
  278. void XmasWarpSanta (const char* c_pData);
  279. void XmasWarpSantaReply (const char* c_pData);
  280. void LoginPing (LPDESC d, const char* c_pData);
  281. void BlockChat (const char* c_pData);
  282. void IamAwake (LPDESC d, const char* c_pData);
  283. protected:
  284. CPacketInfoGG m_packetInfoGG;
  285. };
  286. class CInputAuth : public CInputProcessor
  287. {
  288. public:
  289. CInputAuth();
  290. virtual BYTE GetType()
  291. {
  292. return INPROC_AUTH;
  293. }
  294. protected:
  295. virtual int Analyze (LPDESC d, BYTE bHeader, const char* c_pData);
  296. public:
  297. void Login (LPDESC d, const char* c_pData);
  298. };
  299. #endif /* __INC_METIN_II_GAME_INPUT_PROCESSOR__ */

input.h