Guest User

Untitled

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