trus7

input.h

Nov 20th, 2020
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.15 KB | None | 0 0
  1. #ifndef __INC_METIN_II_GAME_INPUT_PROCESSOR__
  2. #define __INC_METIN_II_GAME_INPUT_PROCESSOR__
  3.  
  4. #include "packet_info.h"
  5.  
  6. enum
  7. {
  8. INPROC_CLOSE,
  9. INPROC_HANDSHAKE,
  10. INPROC_LOGIN,
  11. INPROC_MAIN,
  12. INPROC_DEAD,
  13. INPROC_DB,
  14. INPROC_UDP,
  15. INPROC_P2P,
  16. INPROC_AUTH,
  17. INPROC_TEEN,
  18. };
  19.  
  20. void LoginFailure(LPDESC d, const char * c_pszStatus);
  21. extern void SendShout(const char * szText, BYTE bEmpire);
  22.  
  23. class CInputProcessor
  24. {
  25. public:
  26. CInputProcessor();
  27. virtual ~CInputProcessor() {};
  28.  
  29. virtual bool Process(LPDESC d, const void * c_pvOrig, int iBytes, int & r_iBytesProceed);
  30. virtual BYTE GetType() = 0;
  31.  
  32. void BindPacketInfo(CPacketInfo * pPacketInfo);
  33. void Pong(LPDESC d);
  34. void Handshake(LPDESC d, const char * c_pData);
  35. void Version(LPCHARACTER ch, const char* c_pData);
  36.  
  37. protected:
  38. virtual int Analyze(LPDESC d, BYTE bHeader, const char * c_pData) = 0;
  39.  
  40. CPacketInfo * m_pPacketInfo;
  41. int m_iBufferLeft;
  42.  
  43. CPacketInfoCG m_packetInfoCG;
  44. };
  45.  
  46. class CInputClose : public CInputProcessor
  47. {
  48. public:
  49. virtual BYTE GetType() { return INPROC_CLOSE; }
  50.  
  51. protected:
  52. virtual int Analyze(LPDESC d, BYTE bHeader, const char * c_pData) { return m_iBufferLeft; }
  53. };
  54.  
  55. class CInputHandshake : public CInputProcessor
  56. {
  57. public:
  58. CInputHandshake();
  59. virtual ~CInputHandshake();
  60.  
  61. virtual BYTE GetType() { return INPROC_HANDSHAKE; }
  62.  
  63. protected:
  64. virtual int Analyze(LPDESC d, BYTE bHeader, const char * c_pData);
  65.  
  66. protected:
  67. void GuildMarkLogin(LPDESC d, const char* c_pData);
  68.  
  69. CPacketInfo * m_pMainPacketInfo;
  70. };
  71.  
  72. class CInputLogin : public CInputProcessor
  73. {
  74. public:
  75. virtual BYTE GetType() { return INPROC_LOGIN; }
  76.  
  77. protected:
  78. virtual int Analyze(LPDESC d, BYTE bHeader, const char * c_pData);
  79.  
  80. protected:
  81. void Login(LPDESC d, const char * data);
  82. void LoginByKey(LPDESC d, const char * data);
  83.  
  84. void CharacterSelect(LPDESC d, const char * data);
  85. void CharacterCreate(LPDESC d, const char * data);
  86. void CharacterDelete(LPDESC d, const char * data);
  87. void Entergame(LPDESC d, const char * data);
  88. void Empire(LPDESC d, const char * c_pData);
  89. void GuildMarkCRCList(LPDESC d, const char* c_pData);
  90. // MARK_BUG_FIX
  91. void GuildMarkIDXList(LPDESC d, const char* c_pData);
  92. // END_OF_MARK_BUG_FIX
  93. void GuildMarkUpload(LPDESC d, const char* c_pData);
  94. int GuildSymbolUpload(LPDESC d, const char* c_pData, size_t uiBytes);
  95. void GuildSymbolCRC(LPDESC d, const char* c_pData);
  96. void ChangeName(LPDESC d, const char * data);
  97. };
  98.  
  99. class CInputMain : public CInputProcessor
  100. {
  101. public:
  102. virtual BYTE GetType() { return INPROC_MAIN; }
  103.  
  104. protected:
  105. virtual int Analyze(LPDESC d, BYTE bHeader, const char * c_pData);
  106.  
  107. protected:
  108. void Attack(LPCHARACTER ch, const BYTE header, const char* data);
  109.  
  110. int Whisper(LPCHARACTER ch, const char * data, size_t uiBytes);
  111. #ifdef NEW_PET_SYSTEM
  112. void BraveRequestPetName(LPCHARACTER ch, const char* c_pData);
  113. #endif
  114. int Chat(LPCHARACTER ch, const char * data, size_t uiBytes);
  115. void ItemUse(LPCHARACTER ch, const char * data);
  116. void ItemDrop(LPCHARACTER ch, const char * data);
  117. void ItemDrop2(LPCHARACTER ch, const char * data);
  118. void ItemDestroy(LPCHARACTER ch, const char * data);
  119. void ItemMove(LPCHARACTER ch, const char * data);
  120. void ItemPickup(LPCHARACTER ch, const char * data);
  121. #if defined(WHEEL_OF_DESTINY)
  122. void WheelDestiny(LPCHARACTER ch, const char* data);
  123. #endif
  124. void ItemToItem(LPCHARACTER ch, const char * pcData);
  125. void QuickslotAdd(LPCHARACTER ch, const char * data);
  126. void QuickslotDelete(LPCHARACTER ch, const char * data);
  127. void QuickslotSwap(LPCHARACTER ch, const char * data);
  128. int Shop(LPCHARACTER ch, const char * data, size_t uiBytes);
  129. #ifdef ENABLE_FISH_EVENT
  130. int FishEvent(LPCHARACTER ch, const char * data, size_t uiBytes);
  131. #endif
  132. #ifdef ENABLE_GEM_SYSTEM
  133. int GemShop(LPCHARACTER ch, const char * data, size_t uiBytes);
  134. #endif
  135. void OnClick(LPCHARACTER ch, const char * data);
  136. void Exchange(LPCHARACTER ch, const char * data);
  137. void Position(LPCHARACTER ch, const char * data);
  138. void Move(LPCHARACTER ch, const char * data);
  139. int SyncPosition(LPCHARACTER ch, const char * data, size_t uiBytes);
  140. void FlyTarget(LPCHARACTER ch, const char * pcData, BYTE bHeader);
  141. void UseSkill(LPCHARACTER ch, const char * pcData);
  142.  
  143. void ScriptAnswer(LPCHARACTER ch, const void * pvData);
  144. void ScriptButton(LPCHARACTER ch, const void * pvData);
  145. void ScriptSelectItem(LPCHARACTER ch, const void * pvData);
  146.  
  147. void QuestInputString(LPCHARACTER ch, const void * pvData);
  148. void QuestConfirm(LPCHARACTER ch, const void* pvData);
  149. void Target(LPCHARACTER ch, const char * pcData);
  150. void Warp(LPCHARACTER ch, const char * pcData);
  151. void SafeboxCheckin(LPCHARACTER ch, const char * c_pData);
  152. void SafeboxCheckout(LPCHARACTER ch, const char * c_pData, bool bMall);
  153. void SafeboxItemMove(LPCHARACTER ch, const char * data);
  154. int Messenger(LPCHARACTER ch, const char* c_pData, size_t uiBytes);
  155.  
  156. void PartyInvite(LPCHARACTER ch, const char * c_pData);
  157. void PartyInviteAnswer(LPCHARACTER ch, const char * c_pData);
  158. void PartyRemove(LPCHARACTER ch, const char * c_pData);
  159. void PartySetState(LPCHARACTER ch, const char * c_pData);
  160. void PartyUseSkill(LPCHARACTER ch, const char * c_pData);
  161. void PartyParameter(LPCHARACTER ch, const char * c_pData);
  162.  
  163. int Guild(LPCHARACTER ch, const char * data, size_t uiBytes);
  164. void AnswerMakeGuild(LPCHARACTER ch, const char* c_pData);
  165.  
  166. void Fishing(LPCHARACTER ch, const char* c_pData);
  167. void ItemGive(LPCHARACTER ch, const char* c_pData);
  168. void Hack(LPCHARACTER ch, const char * c_pData);
  169. int MyShop(LPCHARACTER ch, const char * c_pData, size_t uiBytes);
  170.  
  171. void Refine(LPCHARACTER ch, const char* c_pData);
  172. #ifdef __SHOW_CHEST_DROP__
  173. void ChestDropInfo(LPCHARACTER ch, const char * c_pData);
  174. #endif
  175. #ifdef __ADMIN_MANAGER__
  176. void SendAdminBanManager(LPCHARACTER ch, const char* c_pData);
  177. #endif
  178. #ifdef __CHANGELOOK_SYSTEM__
  179. void ChangeLook(LPCHARACTER pkChar, const char* c_pData);
  180. #endif
  181. #ifdef __SASH_SYSTEM__
  182. void Sash(LPCHARACTER pkChar, const char* c_pData);
  183. #endif
  184.  
  185. void Roulette(LPCHARACTER ch, const char* c_pData);
  186. #ifdef __SEND_TARGET_INFO__
  187. void TargetInfoLoad(LPCHARACTER ch, const char* c_pData);
  188. #endif
  189. #ifdef __UPGRADE_ITEMS_STORAGE__
  190. void UpgradeItemsStorageCheckin(LPCHARACTER ch, const char * c_pData);
  191. void UpgradeItemsStorageCheckout(LPCHARACTER ch, const char * c_pData);
  192. void UpgradeItemsStorageItemMove(LPCHARACTER ch, const char * data);
  193. #endif
  194.  
  195. };
  196.  
  197. class CInputDead : public CInputMain
  198. {
  199. public:
  200. virtual BYTE GetType() { return INPROC_DEAD; }
  201.  
  202. protected:
  203. virtual int Analyze(LPDESC d, BYTE bHeader, const char * c_pData);
  204. };
  205.  
  206. class CInputDB : public CInputProcessor
  207. {
  208. public:
  209. virtual bool Process(LPDESC d, const void * c_pvOrig, int iBytes, int & r_iBytesProceed);
  210. virtual BYTE GetType() { return INPROC_DB; }
  211.  
  212. protected:
  213. virtual int Analyze(LPDESC d, BYTE bHeader, const char * c_pData);
  214.  
  215. protected:
  216. void MapLocations(const char * c_pData);
  217. void LoginSuccess(DWORD dwHandle, const char *data);
  218. void PlayerCreateFailure(LPDESC d, BYTE bType); // 0 = ÀÏ¹Ý ½ÇÆÐ 1 = ÀÌ¹Ì ÀÖÀ½
  219. void PlayerDeleteSuccess(LPDESC d, const char * data);
  220. void PlayerDeleteFail(LPDESC d);
  221. void PlayerLoad(LPDESC d, const char* data);
  222. void PlayerCreateSuccess(LPDESC d, const char * data);
  223. void Boot(const char* data);
  224. void QuestLoad(LPDESC d, const char * c_pData);
  225. void SafeboxLoad(LPDESC d, const char * c_pData);
  226. void SafeboxChangeSize(LPDESC d, const char * c_pData);
  227. void SafeboxWrongPassword(LPDESC d);
  228. void SafeboxChangePasswordAnswer(LPDESC d, const char* c_pData);
  229. void MallLoad(LPDESC d, const char * c_pData);
  230. void EmpireSelect(LPDESC d, const char * c_pData);
  231. void P2P(const char * c_pData);
  232. void ItemLoad(LPDESC d, const char * c_pData);
  233. void AffectLoad(LPDESC d, const char * c_pData);
  234.  
  235. void GuildLoad(const char * c_pData);
  236. void GuildSkillUpdate(const char* c_pData);
  237. void GuildSkillRecharge();
  238. void GuildExpUpdate(const char* c_pData);
  239. void GuildAddMember(const char* c_pData);
  240. void GuildRemoveMember(const char* c_pData);
  241. void GuildChangeGrade(const char* c_pData);
  242. void GuildChangeMemberData(const char* c_pData);
  243. void GuildDisband(const char* c_pData);
  244. void GuildLadder(const char* c_pData);
  245. void GuildWar(const char* c_pData);
  246. void GuildWarScore(const char* c_pData);
  247. void GuildSkillUsableChange(const char* c_pData);
  248. void GuildMoneyChange(const char* c_pData);
  249. void GuildWithdrawMoney(const char* c_pData);
  250. void GuildWarReserveAdd(TGuildWarReserve * p);
  251. void GuildWarReserveUpdate(TGuildWarReserve * p);
  252. void GuildWarReserveDelete(DWORD dwID);
  253. void GuildWarBet(TPacketGDGuildWarBet * p);
  254. void GuildChangeMaster(TPacketChangeGuildMaster* p);
  255.  
  256. void LoginAlready(LPDESC d, const char * c_pData);
  257.  
  258. void PartyCreate(const char* c_pData);
  259. void PartyDelete(const char* c_pData);
  260. void PartyAdd(const char* c_pData);
  261. void PartyRemove(const char* c_pData);
  262. void PartyStateChange(const char* c_pData);
  263. void PartySetMemberLevel(const char* c_pData);
  264.  
  265. void Time(const char * c_pData);
  266.  
  267. void ReloadProto(const char * c_pData);
  268. void ChangeName(LPDESC d, const char * data);
  269.  
  270. void AuthLogin(LPDESC d, const char * c_pData);
  271. void AuthLoginOpenID(LPDESC d, const char * c_pData);
  272. void ItemAward(const char * c_pData);
  273.  
  274. void ChangeEmpirePriv(const char* c_pData);
  275. void ChangeGuildPriv(const char* c_pData);
  276. void ChangeCharacterPriv(const char* c_pData);
  277.  
  278. void MoneyLog(const char* c_pData);
  279.  
  280. void SetEventFlag(const char* c_pData);
  281.  
  282. void BillingRepair(const char * c_pData);
  283. void BillingExpire(const char * c_pData);
  284. void BillingLogin(const char * c_pData);
  285. void BillingCheck(const char * c_pData);
  286. void VCard(const char * c_pData);
  287.  
  288. void CreateObject(const char * c_pData);
  289. void DeleteObject(const char * c_pData);
  290. void UpdateLand(const char * c_pData);
  291.  
  292. void Notice(const char * c_pData);
  293.  
  294. void MarriageAdd(TPacketMarriageAdd * p);
  295. void MarriageUpdate(TPacketMarriageUpdate * p);
  296. void MarriageRemove(TPacketMarriageRemove * p);
  297.  
  298. void WeddingRequest(TPacketWeddingRequest* p);
  299. void WeddingReady(TPacketWeddingReady* p);
  300. void WeddingStart(TPacketWeddingStart* p);
  301. void WeddingEnd(TPacketWeddingEnd* p);
  302.  
  303. void TakeMonarchMoney(LPDESC d, const char * data );
  304. void AddMonarchMoney(LPDESC d, const char * data );
  305. void DecMonarchMoney(LPDESC d, const char * data );
  306. void SetMonarch( LPDESC d, const char * data );
  307.  
  308. void ChangeMonarchLord(TPacketChangeMonarchLordACK* data);
  309. void UpdateMonarchInfo(TMonarchInfo* data);
  310. void AddBlockCountryIp(TPacketBlockCountryIp * data);
  311. void BlockException(TPacketBlockException * data);
  312. #ifdef OFFLINE_SHOP
  313. public:
  314. void ShopName(const char * c_pData);
  315. void ShopClose(const char * c_pData);
  316. void ShopUpdateItem(const char * c_pData);
  317. #endif
  318.  
  319. // MYSHOP_PRICE_LIST
  320. /// ¾ÆÀÌÅÛ °¡°ÝÁ¤º¸ ¸®½ºÆ® ¿äû¿¡ ´ëÇÑ ÀÀ´ä ÆÐŶ(HEADER_DG_MYSHOP_PRICELIST_RES) ó¸®ÇÔ¼ö
  321. /**
  322. * @param d ¾ÆÀÌÅÛ °¡°ÝÁ¤º¸ ¸®½ºÆ®¸¦ ¿äûÇÑ Ç÷¹À̾îÀÇ descriptor
  323. * @param p ÆÐŶµ¥ÀÌÅÍÀÇ Æ÷ÀÎÅÍ
  324. */
  325. void MyshopPricelistRes( LPDESC d, const TPacketMyshopPricelistHeader* p );
  326. // END_OF_MYSHOP_PRICE_LIST
  327. //
  328. //RELOAD_ADMIN
  329. void ReloadAdmin( const char * c_pData );
  330. //END_RELOAD_ADMIN
  331.  
  332. void DetailLog(const TPacketNeedLoginLogInfo* info);
  333. // µ¶ÀÏ ¼±¹° ±â´É Å×½ºÆ®
  334. void ItemAwardInformer(TPacketItemAwardInfromer* data);
  335.  
  336. void RespondChannelStatus(LPDESC desc, const char* pcData);
  337. #ifdef __DUNGEON_FOR_GUILD__
  338. void GuildDungeon(const char* c_pData);
  339. void GuildDungeonCD(const char* c_pData);
  340. void GuildDungeonST(const char* c_pData); //Fix Meley lair
  341. #endif
  342. protected:
  343. DWORD m_dwHandle;
  344. };
  345.  
  346. class CInputUDP : public CInputProcessor
  347. {
  348. public:
  349. CInputUDP();
  350. virtual bool Process(LPDESC d, const void * c_pvOrig, int iBytes, int & r_iBytesProceed);
  351.  
  352. virtual BYTE GetType() { return INPROC_UDP; }
  353. void SetSockAddr(struct sockaddr_in & rSockAddr) { m_SockAddr = rSockAddr; };
  354.  
  355. protected:
  356. virtual int Analyze(LPDESC d, BYTE bHeader, const char * c_pData);
  357.  
  358. protected:
  359. void Handshake(LPDESC lpDesc, const char * c_pData);
  360. void StateChecker(const char * c_pData);
  361.  
  362. protected:
  363. struct sockaddr_in m_SockAddr;
  364. CPacketInfoUDP m_packetInfoUDP;
  365. };
  366.  
  367. class CInputP2P : public CInputProcessor
  368. {
  369. public:
  370. CInputP2P();
  371. virtual BYTE GetType() { return INPROC_P2P; }
  372.  
  373. protected:
  374. virtual int Analyze(LPDESC d, BYTE bHeader, const char * c_pData);
  375.  
  376. public:
  377. void Setup(LPDESC d, const char * c_pData);
  378. void Login(LPDESC d, const char * c_pData);
  379. void Logout(LPDESC d, const char * c_pData);
  380. int Relay(LPDESC d, const char * c_pData, size_t uiBytes);
  381. #ifdef ENABLE_FULL_NOTICE
  382. int Notice(LPDESC d, const char * c_pData, size_t uiBytes, bool bBigFont=false);
  383. #else
  384. int Notice(LPDESC d, const char * c_pData, size_t uiBytes);
  385. #endif
  386. int MonarchNotice(LPDESC d, const char * c_pData, size_t uiBytes);
  387. int MonarchTransfer(LPDESC d, const char * c_pData);
  388. int Guild(LPDESC d, const char* c_pData, size_t uiBytes);
  389. void Shout(const char * c_pData);
  390. void Disconnect(const char * c_pData);
  391. void MessengerAdd(const char * c_pData);
  392. void MessengerRemove(const char * c_pData);
  393. void MessengerMobile(const char * c_pData);
  394. void FindPosition(LPDESC d, const char* c_pData);
  395. void WarpCharacter(const char* c_pData);
  396. void GuildWarZoneMapIndex(const char* c_pData);
  397. void Transfer(const char * c_pData);
  398. void XmasWarpSanta(const char * c_pData);
  399. void XmasWarpSantaReply(const char * c_pData);
  400. void LoginPing(LPDESC d, const char * c_pData);
  401. void BlockChat(const char * c_pData);
  402. void PCBangUpdate(const char* c_pData);
  403. void IamAwake(LPDESC d, const char * c_pData);
  404.  
  405. protected:
  406. CPacketInfoGG m_packetInfoGG;
  407. };
  408.  
  409. class CInputAuth : public CInputProcessor
  410. {
  411. public:
  412. CInputAuth();
  413. virtual BYTE GetType() { return INPROC_AUTH; }
  414.  
  415. protected:
  416. virtual int Analyze(LPDESC d, BYTE bHeader, const char * c_pData);
  417. int auth_OpenID(const char *authKey, const char *ipAddr, char *rID);
  418.  
  419. public:
  420. void Login(LPDESC d, const char * c_pData);
  421. void LoginOpenID(LPDESC d, const char * c_pData); //2012.07.19 OpenID : ±è¿ë¿í
  422. void PasspodAnswer(LPDESC d, const char * c_pData );
  423.  
  424. };
  425.  
  426. class CInputTeen : public CInputProcessor
  427. {
  428. public :
  429. virtual BYTE GetType() { return INPROC_TEEN; }
  430.  
  431. void SetStep(int step);
  432.  
  433. protected :
  434. virtual bool Process(LPDESC lpDesc, const void * c_pvOrig, int iBytes, int & r_iBytesProceed);
  435. virtual int Analyze(LPDESC d, BYTE bHeader, const char * c_pData) { return 0; };
  436.  
  437. private:
  438. int m_step;
  439.  
  440. bool ProcessHandshake(LPDESC lpDesc, const void * c_pvOrig, size_t uiBytes, int & r_iBytesProceed);
  441. bool ProcessMain(LPDESC lpDesc, const void * c_pvOrig, size_t uiBytes, int & r_iBytesProceed);
  442. };
  443.  
  444. #endif /* __INC_METIN_II_GAME_INPUT_PROCESSOR__ */
  445.  
  446.  
Advertisement
Add Comment
Please, Sign In to add comment