elws

gametype.h

Nov 10th, 2024
14
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.26 KB | None | 0 0
  1. #pragma once
  2. #include "../GameLib/ItemData.h"
  3.  
  4. BYTE ApplyTypeToPointType(BYTE bApplyType);
  5.  
  6. struct SAffects
  7. {
  8. enum
  9. {
  10. AFFECT_MAX_NUM = 32,
  11. };
  12.  
  13. SAffects() : dwAffects(0) {}
  14. SAffects(const DWORD & c_rAffects)
  15. {
  16. __SetAffects(c_rAffects);
  17. }
  18. int operator = (const DWORD & c_rAffects)
  19. {
  20. __SetAffects(c_rAffects);
  21. }
  22.  
  23. BOOL IsAffect(BYTE byIndex)
  24. {
  25. return dwAffects & (1 << byIndex);
  26. }
  27.  
  28. void __SetAffects(const DWORD & c_rAffects)
  29. {
  30. dwAffects = c_rAffects;
  31. }
  32.  
  33. DWORD dwAffects;
  34. };
  35.  
  36. extern std::string g_strGuildSymbolPathName;
  37.  
  38. const DWORD c_Name_Max_Length = 64;
  39. const DWORD c_FileName_Max_Length = 128;
  40. const DWORD c_Short_Name_Max_Length = 32;
  41.  
  42. const DWORD c_Inventory_Page_Size = 5*9; // x*y
  43. const DWORD c_Inventory_Page_Count = 2;
  44. const DWORD c_ItemSlot_Count = c_Inventory_Page_Size * c_Inventory_Page_Count;
  45. const DWORD c_Equipment_Count = 12;
  46.  
  47. const DWORD c_Equipment_Start = c_ItemSlot_Count;
  48.  
  49. const DWORD c_Equipment_Body = c_Equipment_Start + 0;
  50. const DWORD c_Equipment_Head = c_Equipment_Start + 1;
  51. const DWORD c_Equipment_Shoes = c_Equipment_Start + 2;
  52. const DWORD c_Equipment_Wrist = c_Equipment_Start + 3;
  53. const DWORD c_Equipment_Weapon = c_Equipment_Start + 4;
  54. const DWORD c_Equipment_Neck = c_Equipment_Start + 5;
  55. const DWORD c_Equipment_Ear = c_Equipment_Start + 6;
  56. const DWORD c_Equipment_Unique1 = c_Equipment_Start + 7;
  57. const DWORD c_Equipment_Unique2 = c_Equipment_Start + 8;
  58. const DWORD c_Equipment_Arrow = c_Equipment_Start + 9;
  59. const DWORD c_Equipment_Shield = c_Equipment_Start + 10;
  60.  
  61. // 새로 추가된 신규 반지 & 벨트
  62. // 장착형 아이템에 할당할 수 있는 위치가 기존 장비, 채기랍 퀘스트 보상, 코스튬 시스템 등으로 인해서 공간이 잘려있다.
  63. // 이게 다 채기랍 보상 버프를 장착아이템처럼 구현한 ㅅㄲ 때문에 난리났따... ㅆㅂ
  64. //
  65. // 정리하면, 기존 장비창들은 서버DB상 아이템 포지션이 90 ~ 102 이고,
  66. // 2013년 초에 새로 추가되는 슬롯들은 111 ~ 부터 시작한다. 착용 장비에서 최대로 사용할 수 있는 값은 121 까지이고, 122부터는 용혼석에서 사용한다.
  67. #ifdef ENABLE_NEW_EQUIPMENT_SYSTEM
  68. const DWORD c_New_Equipment_Start = c_Equipment_Start + 21;
  69. const DWORD c_New_Equipment_Count = 3;
  70. const DWORD c_Equipment_Ring1 = c_New_Equipment_Start + 0;
  71. const DWORD c_Equipment_Ring2 = c_New_Equipment_Start + 1;
  72. const DWORD c_Equipment_Belt = c_New_Equipment_Start + 2;;
  73. #endif
  74.  
  75. enum EDragonSoulDeckType
  76. {
  77. DS_DECK_1,
  78. DS_DECK_2,
  79. DS_DECK_MAX_NUM = 2,
  80. };
  81.  
  82. enum EDragonSoulGradeTypes
  83. {
  84. DRAGON_SOUL_GRADE_NORMAL,
  85. DRAGON_SOUL_GRADE_BRILLIANT,
  86. DRAGON_SOUL_GRADE_RARE,
  87. DRAGON_SOUL_GRADE_ANCIENT,
  88. DRAGON_SOUL_GRADE_LEGENDARY,
  89. DRAGON_SOUL_GRADE_MAX,
  90.  
  91. };
  92.  
  93. enum EDragonSoulStepTypes
  94. {
  95. DRAGON_SOUL_STEP_LOWEST,
  96. DRAGON_SOUL_STEP_LOW,
  97. DRAGON_SOUL_STEP_MID,
  98. DRAGON_SOUL_STEP_HIGH,
  99. DRAGON_SOUL_STEP_HIGHEST,
  100. DRAGON_SOUL_STEP_MAX,
  101. };
  102.  
  103. #ifdef ENABLE_COSTUME_SYSTEM
  104. const DWORD c_Costume_Slot_Start = c_Equipment_Start + 19; // [주의] 숫자(19) 하드코딩 주의. 현재 서버에서 코스츔 슬롯은 19부터임. 서버 common/length.h 파일의 EWearPositions 열거형 참고.
  105. const DWORD c_Costume_Slot_Body = c_Costume_Slot_Start + 0;
  106. const DWORD c_Costume_Slot_Hair = c_Costume_Slot_Start + 1;
  107. const DWORD c_Costume_Slot_Count = 2;
  108. const DWORD c_Costume_Slot_End = c_Costume_Slot_Start + c_Costume_Slot_Count;
  109. #endif
  110.  
  111.  
  112. // [주의] 숫자(32) 하드코딩 주의. 현재 서버에서 용혼석 슬롯은 32부터임.
  113. // 서버 common/length.h 파일의 EWearPositions 열거형이 32까지 확장될 것을 염두하고(32 이상은 확장 하기 힘들게 되어있음.),
  114. // 그 이후부터를 용혼석 장착 슬롯으로 사용.
  115. const DWORD c_Wear_Max = 32;
  116. const DWORD c_DragonSoul_Equip_Start = c_ItemSlot_Count + c_Wear_Max;
  117. const DWORD c_DragonSoul_Equip_Slot_Max = 6;
  118. const DWORD c_DragonSoul_Equip_End = c_DragonSoul_Equip_Start + c_DragonSoul_Equip_Slot_Max * DS_DECK_MAX_NUM;
  119.  
  120. // NOTE: 2013년 2월 5일 현재... 용혼석 데크는 2개가 존재하는데, 향후 확장 가능성이 있어서 3개 데크 여유분을 할당 해 둠. 그 뒤 공간은 벨트 인벤토리로 사용
  121. const DWORD c_DragonSoul_Equip_Reserved_Count = c_DragonSoul_Equip_Slot_Max * 3;
  122.  
  123. #ifdef ENABLE_NEW_EQUIPMENT_SYSTEM
  124. // 벨트 아이템이 제공하는 인벤토리
  125. const DWORD c_Belt_Inventory_Slot_Start = c_DragonSoul_Equip_End + c_DragonSoul_Equip_Reserved_Count;
  126. const DWORD c_Belt_Inventory_Width = 4;
  127. const DWORD c_Belt_Inventory_Height= 4;
  128. const DWORD c_Belt_Inventory_Slot_Count = c_Belt_Inventory_Width * c_Belt_Inventory_Height;
  129. const DWORD c_Belt_Inventory_Slot_End = c_Belt_Inventory_Slot_Start + c_Belt_Inventory_Slot_Count;
  130.  
  131. const DWORD c_Inventory_Count = c_Belt_Inventory_Slot_End;
  132. #else
  133. const DWORD c_Inventory_Count = c_DragonSoul_Equip_End;
  134. #endif
  135.  
  136. #ifdef WJ_SPLIT_INVENTORY_SYSTEM
  137. const DWORD c_Skill_Book_Inventory_Slot_Start = c_Belt_Inventory_Slot_End;
  138. const DWORD c_Skill_Book_Inventory_Slot_Count = 135;
  139. const DWORD c_Skill_Book_Inventory_Slot_End = c_Skill_Book_Inventory_Slot_Start + c_Skill_Book_Inventory_Slot_Count;
  140.  
  141. const DWORD c_Upgrade_Items_Inventory_Slot_Start = c_Skill_Book_Inventory_Slot_End;
  142. const DWORD c_Upgrade_Items_Inventory_Slot_Count = 135;
  143. const DWORD c_Upgrade_Items_Inventory_Slot_End = c_Upgrade_Items_Inventory_Slot_Start + c_Upgrade_Items_Inventory_Slot_Count;
  144.  
  145. const DWORD c_Stone_Inventory_Slot_Start = c_Upgrade_Items_Inventory_Slot_End;
  146. const DWORD c_Stone_Inventory_Slot_Count = 135;
  147. const DWORD c_Stone_Inventory_Slot_End = c_Stone_Inventory_Slot_Start + c_Stone_Inventory_Slot_Count;
  148.  
  149. const DWORD c_Sandik_Inventory_Slot_Start = c_Stone_Inventory_Slot_End;
  150. const DWORD c_Sandik_Inventory_Slot_Count = 135;
  151. const DWORD c_Sandik_Inventory_Slot_End = c_Sandik_Inventory_Slot_Start + c_Sandik_Inventory_Slot_Count;
  152.  
  153. const DWORD c_Inventory_Count = c_Sandik_Inventory_Slot_End;
  154. #endif
  155.  
  156. // 용혼석 전용 인벤토리
  157. const DWORD c_DragonSoul_Inventory_Start = 0;
  158. const DWORD c_DragonSoul_Inventory_Box_Size = 32;
  159. const DWORD c_DragonSoul_Inventory_Count = CItemData::DS_SLOT_NUM_TYPES * DRAGON_SOUL_GRADE_MAX * c_DragonSoul_Inventory_Box_Size;
  160. const DWORD c_DragonSoul_Inventory_End = c_DragonSoul_Inventory_Start + c_DragonSoul_Inventory_Count;
  161.  
  162. enum ESlotType
  163. {
  164. SLOT_TYPE_NONE,
  165. SLOT_TYPE_INVENTORY,
  166. SLOT_TYPE_SKILL,
  167. SLOT_TYPE_EMOTION,
  168. SLOT_TYPE_SHOP,
  169. SLOT_TYPE_EXCHANGE_OWNER,
  170. SLOT_TYPE_EXCHANGE_TARGET,
  171. SLOT_TYPE_QUICK_SLOT,
  172. SLOT_TYPE_SAFEBOX,
  173. SLOT_TYPE_PRIVATE_SHOP,
  174. SLOT_TYPE_MALL,
  175. SLOT_TYPE_DRAGON_SOUL_INVENTORY,
  176. #ifdef WJ_SPLIT_INVENTORY_SYSTEM
  177. SLOT_TYPE_SKILL_BOOK_INVENTORY,
  178. SLOT_TYPE_UPGRADE_ITEMS_INVENTORY,
  179. SLOT_TYPE_STONE_INVENTORY,
  180. SLOT_TYPE_SANDIK_INVENTORY,
  181. #endif
  182. SLOT_TYPE_MAX,
  183. };
  184.  
  185. enum EWindows
  186. {
  187. RESERVED_WINDOW,
  188. INVENTORY, // 기본 인벤토리. (45칸 짜리가 2페이지 존재 = 90칸)
  189. EQUIPMENT,
  190. SAFEBOX,
  191. MALL,
  192. DRAGON_SOUL_INVENTORY,
  193. GROUND, // NOTE: 2013년 2월5일 현재까지 unused.. 왜 있는거지???
  194. BELT_INVENTORY, // NOTE: W2.1 버전에 새로 추가되는 벨트 슬롯 아이템이 제공하는 벨트 인벤토리
  195. #ifdef WJ_SPLIT_INVENTORY_SYSTEM
  196. SKILL_BOOK_INVENTORY,
  197. UPGRADE_ITEMS_INVENTORY,
  198. STONE_INVENTORY,
  199. SANDIK_INVENTORY,
  200. #endif
  201. WINDOW_TYPE_MAX,
  202. };
  203.  
  204. enum EDSInventoryMaxNum
  205. {
  206. DS_INVENTORY_MAX_NUM = c_DragonSoul_Inventory_Count,
  207. DS_REFINE_WINDOW_MAX_NUM = 15,
  208. };
  209.  
  210. #pragma pack (push, 1)
  211. #define WORD_MAX 0xffff
  212.  
  213. typedef struct SItemPos
  214. {
  215. BYTE window_type;
  216. WORD cell;
  217. SItemPos ()
  218. {
  219. window_type = INVENTORY;
  220. cell = WORD_MAX;
  221. }
  222. SItemPos (BYTE _window_type, WORD _cell)
  223. {
  224. window_type = _window_type;
  225. cell = _cell;
  226. }
  227.  
  228. // 기존에 cell의 형을 보면 BYTE가 대부분이지만, oi
  229. // 어떤 부분은 int, 어떤 부분은 WORD로 되어있어,
  230. // 가장 큰 자료형인 int로 받는다.
  231. // int operator=(const int _cell)
  232. // {
  233. //window_type = INVENTORY;
  234. // cell = _cell;
  235. // return cell;
  236. // }
  237. bool IsValidCell()
  238. {
  239. switch (window_type)
  240. {
  241. case INVENTORY:
  242. return cell < c_Inventory_Count;
  243. break;
  244. case EQUIPMENT:
  245. return cell < c_DragonSoul_Equip_End;
  246. break;
  247. case DRAGON_SOUL_INVENTORY:
  248. return cell < (DS_INVENTORY_MAX_NUM);
  249. break;
  250. default:
  251. return false;
  252. }
  253. }
  254. bool IsEquipCell()
  255. {
  256. switch (window_type)
  257. {
  258. case INVENTORY:
  259. case EQUIPMENT:
  260. return (c_Equipment_Start + c_Wear_Max > cell) && (c_Equipment_Start <= cell);
  261. break;
  262.  
  263. case BELT_INVENTORY:
  264. case DRAGON_SOUL_INVENTORY:
  265. return false;
  266. break;
  267.  
  268. default:
  269. return false;
  270. }
  271. }
  272.  
  273. #ifdef ENABLE_NEW_EQUIPMENT_SYSTEM
  274. bool IsBeltInventoryCell()
  275. {
  276. bool bResult = c_Belt_Inventory_Slot_Start <= cell && c_Belt_Inventory_Slot_End > cell;
  277. return bResult;
  278. }
  279. #endif
  280.  
  281. #ifdef WJ_SPLIT_INVENTORY_SYSTEM
  282. bool IsSkillBookInventoryCell()
  283. {
  284. bool bResult = c_Skill_Book_Inventory_Slot_Start <= cell && c_Skill_Book_Inventory_Slot_End > cell;
  285. return bResult;
  286. }
  287.  
  288. bool IsUpgradeItemsInventoryCell()
  289. {
  290. bool bResult = c_Upgrade_Items_Inventory_Slot_Start <= cell && c_Upgrade_Items_Inventory_Slot_End > cell;
  291. return bResult;
  292. }
  293.  
  294. bool IsStoneInventoryCell()
  295. {
  296. bool bResult = c_Stone_Inventory_Slot_Start <= cell && c_Stone_Inventory_Slot_End > cell;
  297. return bResult;
  298. }
  299.  
  300. bool IsSandikInventoryCell()
  301. {
  302. bool bResult = c_Sandik_Inventory_Slot_Start <= cell && c_Sandik_Inventory_Slot_End > cell;
  303. return bResult;
  304. }
  305. #endif
  306.  
  307. bool operator==(const struct SItemPos& rhs) const
  308. {
  309. return (window_type == rhs.window_type) && (cell == rhs.cell);
  310. }
  311.  
  312. bool operator<(const struct SItemPos& rhs) const
  313. {
  314. return (window_type < rhs.window_type) || ((window_type == rhs.window_type) && (cell < rhs.cell));
  315. }
  316. } TItemPos;
  317. #pragma pack(pop)
  318.  
  319. const DWORD c_QuickBar_Line_Count = 3;
  320. const DWORD c_QuickBar_Slot_Count = 12;
  321.  
  322. const float c_Idle_WaitTime = 5.0f;
  323.  
  324. const int c_Monster_Race_Start_Number = 6;
  325. const int c_Monster_Model_Start_Number = 20001;
  326.  
  327. const float c_fAttack_Delay_Time = 0.2f;
  328. const float c_fHit_Delay_Time = 0.1f;
  329. const float c_fCrash_Wave_Time = 0.2f;
  330. const float c_fCrash_Wave_Distance = 3.0f;
  331.  
  332. const float c_fHeight_Step_Distance = 50.0f;
  333.  
  334. enum
  335. {
  336. DISTANCE_TYPE_FOUR_WAY,
  337. DISTANCE_TYPE_EIGHT_WAY,
  338. DISTANCE_TYPE_ONE_WAY,
  339. DISTANCE_TYPE_MAX_NUM,
  340. };
  341.  
  342. const float c_fMagic_Script_Version = 1.0f;
  343. const float c_fSkill_Script_Version = 1.0f;
  344. const float c_fMagicSoundInformation_Version = 1.0f;
  345. const float c_fBattleCommand_Script_Version = 1.0f;
  346. const float c_fEmotionCommand_Script_Version = 1.0f;
  347. const float c_fActive_Script_Version = 1.0f;
  348. const float c_fPassive_Script_Version = 1.0f;
  349.  
  350. // Used by PushMove
  351. const float c_fWalkDistance = 175.0f;
  352. const float c_fRunDistance = 310.0f;
  353.  
  354. #define FILE_MAX_LEN 128
  355.  
  356. enum
  357. {
  358. ITEM_SOCKET_SLOT_MAX_NUM = 3,
  359. ITEM_ATTRIBUTE_SLOT_MAX_NUM = 7,
  360. };
  361.  
  362. #pragma pack(push)
  363. #pragma pack(1)
  364.  
  365. typedef struct SQuickSlot
  366. {
  367. BYTE Type;
  368. BYTE Position;
  369. } TQuickSlot;
  370.  
  371. typedef struct TPlayerItemAttribute
  372. {
  373. BYTE bType;
  374. short sValue;
  375. } TPlayerItemAttribute;
  376.  
  377. typedef struct packet_item
  378. {
  379. DWORD vnum;
  380. BYTE count;
  381. DWORD flags;
  382. DWORD anti_flags;
  383. long alSockets[ITEM_SOCKET_SLOT_MAX_NUM];
  384. TPlayerItemAttribute aAttr[ITEM_ATTRIBUTE_SLOT_MAX_NUM];
  385. } TItemData;
  386.  
  387. typedef struct packet_shop_item
  388. {
  389. DWORD vnum;
  390. DWORD price;
  391. BYTE count;
  392. BYTE display_pos;
  393. long alSockets[ITEM_SOCKET_SLOT_MAX_NUM];
  394. TPlayerItemAttribute aAttr[ITEM_ATTRIBUTE_SLOT_MAX_NUM];
  395. } TShopItemData;
  396.  
  397. #pragma pack(pop)
  398.  
  399. inline float GetSqrtDistance(int ix1, int iy1, int ix2, int iy2) // By sqrt
  400. {
  401. float dx, dy;
  402.  
  403. dx = float(ix1 - ix2);
  404. dy = float(iy1 - iy2);
  405.  
  406. return sqrtf(dx*dx + dy*dy);
  407. }
  408.  
  409. // DEFAULT_FONT
  410. void DefaultFont_Startup();
  411. void DefaultFont_Cleanup();
  412. void DefaultFont_SetName(const char * c_szFontName);
  413. CResource* DefaultFont_GetResource();
  414. CResource* DefaultItalicFont_GetResource();
  415. // END_OF_DEFAULT_FONT
  416.  
  417. void SetGuildSymbolPath(const char * c_szPathName);
  418. const char * GetGuildSymbolFileName(DWORD dwGuildID);
  419. BYTE SlotTypeToInvenType(BYTE bSlotType);
  420.  
Advertisement
Add Comment
Please, Sign In to add comment