mmo.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968
  1. // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
  2. // For more information, see LICENCE in the main folder
  3. #ifndef _MMO_H_
  4. #define _MMO_H_
  5. #include "cbasetypes.h"
  6. #include "../config/core.h"
  7. #include "db.h"
  8. #include <time.h>
  9. // server->client protocol version
  10. // 0 - pre-?
  11. // 1 - ? - 0x196
  12. // 2 - ? - 0x78, 0x79
  13. // 3 - ? - 0x1c8, 0x1c9, 0x1de
  14. // 4 - ? - 0x1d7, 0x1d8, 0x1d9, 0x1da
  15. // 5 - 2003-12-18aSakexe+ - 0x1ee, 0x1ef, 0x1f0, ?0x1c4, 0x1c5?
  16. // 6 - 2004-03-02aSakexe+ - 0x1f4, 0x1f5
  17. // 7 - 2005-04-11aSakexe+ - 0x229, 0x22a, 0x22b, 0x22c
  18. // see conf/battle/client.conf for other version
  19. #ifndef PACKETVER
  20. #define PACKETVER 20151104
  21. //#define PACKETVER 20120410
  22. #endif
  23. // Check if the specified packetversion supports the pincode system
  24. #define PACKETVER_SUPPORTS_PINCODE PACKETVER>=20110309
  25. /// Check if the client needs delete_date as remaining time and not the actual delete_date (actually it was tested for clients since 2013)
  26. #define PACKETVER_CHAR_DELETEDATE (PACKETVER > 20130000 && PACKETVER < 20141016) || PACKETVER >= 20150513
  27. // Check if the specified packetvresion supports the cashshop sale system
  28. #define PACKETVER_SUPPORTS_SALES PACKETVER>=20131223
  29. ///Remove/Comment this line to disable sc_data saving. [Skotlex]
  30. #define ENABLE_SC_SAVING
  31. /** Remove/Comment this line to disable server-side hot-key saving support [Skotlex]
  32. * Note that newer clients no longer save hotkeys in the registry! */
  33. #define HOTKEY_SAVING
  34. #if PACKETVER < 20090603
  35. // (27 = 9 skills x 3 bars) (0x02b9,191)
  36. #define MAX_HOTKEYS 27
  37. #elif PACKETVER < 20090617
  38. // (36 = 9 skills x 4 bars) (0x07d9,254)
  39. #define MAX_HOTKEYS 36
  40. #else
  41. // (38 = 9 skills x 4 bars & 2 Quickslots)(0x07d9,268)
  42. #define MAX_HOTKEYS 38
  43. #endif
  44. #define MAX_MAP_PER_SERVER 1500 /// Increased to allow creation of Instance Maps
  45. #define MAX_INVENTORY 100 ///Maximum items in player inventory
  46. /** Max number of characters per account. Note that changing this setting alone is not enough if the client is not hexed to support more characters as well.
  47. * Max value tested was 265 */
  48. #define MAX_CHARS 9
  49. /** Number of slots carded equipment can have. Never set to less than 4 as they are also used to keep the data of forged items/equipment. [Skotlex]
  50. * Note: The client seems unable to receive data for more than 4 slots due to all related packets having a fixed size. */
  51. #define MAX_SLOTS 4
  52. #define MAX_AMOUNT 30000 ////Max amount of a single stacked item
  53. #define MAX_ZENY 1000000000 ///Max zeny
  54. #define MAX_BANK_ZENY SINT32_MAX ///Max zeny in Bank
  55. #define MAX_FAME 1000000000 ///Max fame points
  56. #define MAX_CART 100 ///Maximum item in cart
  57. #define MAX_SKILL 1200 ///Maximum skill can be hold by Player, Homunculus, & Mercenary (skill list) AND skill_db limit
  58. #define DEFAULT_WALK_SPEED 150 ///Default walk speed
  59. #define MIN_WALK_SPEED 20 ///Min walk speed
  60. #define MAX_WALK_SPEED 1000 ///Max walk speed
  61. #define MAX_STORAGE 600 ///Max number of storage slots a player can have
  62. #define MAX_GUILD_STORAGE 600 ///Max number of storage slots a guild
  63. #define MAX_PARTY 12 ///Max party member
  64. #define MAX_GUILD 16+10*6 ///Increased max guild members +6 per 1 extension levels [Lupus]
  65. #define MAX_GUILDPOSITION 20 ///Increased max guild positions to accomodate for all members [Valaris] (removed) [PoW]
  66. #define MAX_GUILDEXPULSION 32 ///Max Guild expulsion
  67. #define MAX_GUILDALLIANCE 16 ///Max Guild alliance
  68. #define MAX_GUILDSKILL 15 ///Increased max guild skills because of new skills [Sara-chan]
  69. #define MAX_GUILDLEVEL 50 ///Max Guild level
  70. #define MAX_GUARDIANS 8 ///Local max per castle. If this value is increased, need to add more fields on MySQL `guild_castle` table [Skotlex]
  71. #define MAX_QUEST_OBJECTIVES 3 ///Max quest objectives for a quest
  72. #define MAX_QUEST_DROPS 3 ///Max quest drops for a quest
  73. #define MAX_PC_BONUS_SCRIPT 50 ///Max bonus script can be fetched from `bonus_script` table on player load [Cydh]
  74. #define MAX_ITEM_RDM_OPT 5 /// Max item random option [Napster]
  75. #define DB_NAME_LEN 256 //max len of dbs
  76. #define MAX_CLAN 500
  77. #define MAX_CLANALLIANCE 6
  78. // for produce
  79. #define MIN_ATTRIBUTE 0
  80. #define MAX_ATTRIBUTE 4
  81. #define ATTRIBUTE_NORMAL 0
  82. #define MIN_STAR 0
  83. #define MAX_STAR 3
  84. #define MAX_STATUS_TYPE 5
  85. #define WEDDING_RING_M 2634
  86. #define WEDDING_RING_F 2635
  87. //For character names, title names, guilds, maps, etc.
  88. //Includes null-terminator as it is the length of the array.
  89. #define NAME_LENGTH (23 + 1)
  90. #define PASSWD_LENGTH (32+1)
  91. //NPC names can be longer than it's displayed on client (NAME_LENGTH).
  92. #define NPC_NAME_LENGTH 50
  93. // <NPC_NAME_LENGTH> for npc name + 2 for a "::" + <NAME_LENGTH> for label + 1 for EOS
  94. #define EVENT_NAME_LENGTH ( NPC_NAME_LENGTH + 2 + NAME_LENGTH + 1 )
  95. //For item names, which tend to have much longer names.
  96. #define ITEM_NAME_LENGTH 50
  97. //For Map Names, which the client considers to be 16 in length including the .gat extension
  98. #define MAP_NAME_LENGTH (11 + 1)
  99. #define MAP_NAME_LENGTH_EXT (MAP_NAME_LENGTH + 4)
  100. //Pincode Length
  101. #define PINCODE_LENGTH 4
  102. #define MAX_FRIENDS 40
  103. #define MAX_MEMOPOINTS 3
  104. #define MAX_SKILLCOOLDOWN 20
  105. //Size of the fame list arrays.
  106. #define MAX_FAME_LIST 10
  107. //Limits to avoid ID collision with other game objects
  108. #define START_ACCOUNT_NUM 2000000
  109. #define END_ACCOUNT_NUM 100000000
  110. #define START_CHAR_NUM 150000
  111. //Guilds
  112. #define MAX_GUILDMES1 60
  113. #define MAX_GUILDMES2 120
  114. //Base Homun skill.
  115. #define HM_SKILLBASE 8001
  116. #define MAX_HOMUNSKILL 43
  117. #define MAX_HOMUNCULUS_CLASS 52 //[orn], Increased to 60 from 16 to allow new Homun-S.
  118. #define HM_CLASS_BASE 6001
  119. #define HM_CLASS_MAX (HM_CLASS_BASE+MAX_HOMUNCULUS_CLASS-1)
  120. //Mail System
  121. #define MAIL_MAX_INBOX 30
  122. #define MAIL_TITLE_LENGTH 40
  123. #define MAIL_BODY_LENGTH 200
  124. //Mercenary System
  125. #define MC_SKILLBASE 8201
  126. #define MAX_MERCSKILL 40
  127. #define MAX_MERCENARY_CLASS 61
  128. //Elemental System
  129. #define MAX_ELEMENTALSKILL 42
  130. #define EL_SKILLBASE 8401
  131. #define MAX_ELESKILLTREE 3
  132. #define MAX_ELEMENTAL_CLASS 12
  133. #define EL_CLASS_BASE 2114
  134. #define EL_CLASS_MAX (EL_CLASS_BASE+MAX_ELEMENTAL_CLASS-1)
  135. enum item_types {
  136. IT_HEALING = 0,
  137. IT_UNKNOWN, //1
  138. IT_USABLE, //2
  139. IT_ETC, //3
  140. IT_ARMOR, //4
  141. IT_WEAPON, //5
  142. IT_CARD, //6
  143. IT_PETEGG, //7
  144. IT_PETARMOR,//8
  145. IT_UNKNOWN2,//9
  146. IT_AMMO, //10
  147. IT_DELAYCONSUME,//11
  148. IT_SHADOWGEAR, //12
  149. IT_CASH = 18,
  150. IT_MAX
  151. };
  152. // Questlog states
  153. enum quest_state {
  154. Q_INACTIVE, ///< Inactive quest (the user can toggle between active and inactive quests)
  155. Q_ACTIVE, ///< Active quest
  156. Q_COMPLETE, ///< Completed quest
  157. };
  158. /// Questlog entry
  159. struct quest {
  160. int quest_id; ///< Quest ID
  161. unsigned int time; ///< Expiration time
  162. int count[MAX_QUEST_OBJECTIVES]; ///< Kill counters of each quest objective
  163. enum quest_state state; ///< Current quest state
  164. };
  165. struct s_item_randomoption {
  166. short id;
  167. short value;
  168. char param;
  169. };
  170. struct item {
  171. int id;
  172. unsigned short nameid;
  173. short amount;
  174. unsigned int equip; // location(s) where item is equipped (using enum equip_pos for bitmasking)
  175. char identify;
  176. char refine;
  177. char attribute;
  178. unsigned short card[MAX_SLOTS];
  179. struct s_item_randomoption option[MAX_ITEM_RDM_OPT]; // max of 5 random options can be supported.
  180. unsigned int expire_time;
  181. char favorite, bound;
  182. uint64 unique_id;
  183. };
  184. //Equip position constants
  185. enum equip_pos {
  186. EQP_HEAD_LOW = 0x000001,
  187. EQP_HEAD_MID = 0x000200, // 512
  188. EQP_HEAD_TOP = 0x000100, // 256
  189. EQP_HAND_R = 0x000002, // 2
  190. EQP_HAND_L = 0x000020, // 32
  191. EQP_ARMOR = 0x000010, // 16
  192. EQP_SHOES = 0x000040, // 64
  193. EQP_GARMENT = 0x000004, // 4
  194. EQP_ACC_L = 0x000008, // 8
  195. EQP_ACC_R = 0x000080, // 128
  196. EQP_COSTUME_HEAD_TOP = 0x000400, // 1024
  197. EQP_COSTUME_HEAD_MID = 0x000800, // 2048
  198. EQP_COSTUME_HEAD_LOW = 0x001000, // 4096
  199. EQP_COSTUME_GARMENT = 0x002000, // 8192
  200. //EQP_COSTUME_FLOOR = 0x004000, // 16384
  201. EQP_AMMO = 0x008000, // 32768
  202. EQP_SHADOW_ARMOR = 0x010000, // 65536
  203. EQP_SHADOW_WEAPON = 0x020000, // 131072
  204. EQP_SHADOW_SHIELD = 0x040000, // 262144
  205. EQP_SHADOW_SHOES = 0x080000, // 524288
  206. EQP_SHADOW_ACC_R = 0x100000, // 1048576
  207. EQP_SHADOW_ACC_L = 0x200000, // 2097152
  208. // Combined
  209. EQP_ACC_RL = EQP_ACC_R|EQP_ACC_L,
  210. EQP_SHADOW_ACC_RL = EQP_SHADOW_ACC_R|EQP_SHADOW_ACC_L,
  211. };
  212. struct point {
  213. unsigned short map;
  214. short x,y;
  215. };
  216. struct startitem {
  217. unsigned short nameid, amount;
  218. short pos;
  219. };
  220. enum e_skill_flag
  221. {
  222. SKILL_FLAG_PERMANENT,
  223. SKILL_FLAG_TEMPORARY,
  224. SKILL_FLAG_PLAGIARIZED,
  225. SKILL_FLAG_PERM_GRANTED, // Permanent, granted through someway e.g. script
  226. SKILL_FLAG_TMP_COMBO, //@FIXME for homunculus combo atm
  227. //! NOTE: This flag be the last flag, and don't change the value if not needed!
  228. SKILL_FLAG_REPLACED_LV_0 = 10, // temporary skill overshadowing permanent skill of level 'N - SKILL_FLAG_REPLACED_LV_0',
  229. };
  230. enum e_mmo_charstatus_opt {
  231. OPT_NONE = 0x0,
  232. OPT_SHOW_EQUIP = 0x1,
  233. OPT_ALLOW_PARTY = 0x2,
  234. };
  235. struct s_skill {
  236. uint16 id;
  237. uint8 lv;
  238. uint8 flag; // see enum e_skill_flag
  239. };
  240. struct script_reg_state {
  241. unsigned int type : 1; // because I'm a memory hoarder and having them in the same struct would be a 8-byte/instance waste while ints outnumber str on a 10000-to-1 ratio.
  242. unsigned int update : 1; // whether it needs to be sent to char server for insertion/update/delete
  243. };
  244. struct script_reg_num {
  245. struct script_reg_state flag;
  246. int value;
  247. };
  248. struct script_reg_str {
  249. struct script_reg_state flag;
  250. char *value;
  251. };
  252. //For saving status changes across sessions. [Skotlex]
  253. struct status_change_data {
  254. unsigned short type; //SC_type
  255. long val1, val2, val3, val4, tick; //Remaining duration.
  256. };
  257. #define MAX_BONUS_SCRIPT_LENGTH 512
  258. struct bonus_script_data {
  259. char script_str[MAX_BONUS_SCRIPT_LENGTH]; //< Script string
  260. uint32 tick; ///< Tick
  261. uint16 flag; ///< Flags @see enum e_bonus_script_flags
  262. int16 icon; ///< Icon SI
  263. uint8 type; ///< 0 - None, 1 - Buff, 2 - Debuff
  264. };
  265. struct skill_cooldown_data {
  266. unsigned short skill_id;
  267. long tick;
  268. };
  269. enum storage_type {
  270. TABLE_INVENTORY = 1,
  271. TABLE_CART,
  272. TABLE_STORAGE,
  273. TABLE_GUILD_STORAGE,
  274. };
  275. enum e_storage_mode {
  276. STOR_MODE_NONE = 0x0,
  277. STOR_MODE_GET = 0x1,
  278. STOR_MODE_PUT = 0x2,
  279. STOR_MODE_ALL = 0x3,
  280. };
  281. struct s_storage {
  282. bool dirty; ///< Dirty status, data needs to be saved
  283. bool status; ///< Current status of storage (opened or closed)
  284. uint16 amount; ///< Amount of items in storage
  285. bool lock; ///< If locked, can't use storage when item bound retrieval
  286. uint32 id; ///< Account ID / Character ID / Guild ID (owner of storage)
  287. enum storage_type type; ///< Type of storage (inventory, cart, storage, guild storage)
  288. uint16 max_amount;
  289. uint8 stor_id; ///< Storage ID
  290. struct {
  291. unsigned get : 1;
  292. unsigned put : 1;
  293. } state;
  294. union { // Max for inventory, storage, cart, and guild storage are 1637 each without changing this struct and struct item [2014/10/27]
  295. struct item items_inventory[MAX_INVENTORY];
  296. struct item items_storage[MAX_STORAGE];
  297. struct item items_cart[MAX_CART];
  298. struct item items_guild[MAX_GUILD_STORAGE];
  299. } u;
  300. };
  301. struct s_storage_table {
  302. char name[NAME_LENGTH];
  303. char table[DB_NAME_LEN];
  304. uint16 max_num;
  305. uint8 id;
  306. };
  307. struct s_pet {
  308. uint32 account_id;
  309. uint32 char_id;
  310. int pet_id;
  311. short class_;
  312. short level;
  313. short egg_id;//pet egg id
  314. short equip;//pet equip name_id
  315. short intimate;//pet friendly
  316. short hungry;//pet hungry
  317. char name[NAME_LENGTH];
  318. char rename_flag;
  319. char incubate;
  320. };
  321. struct s_homunculus { //[orn]
  322. char name[NAME_LENGTH];
  323. int hom_id;
  324. uint32 char_id;
  325. short class_;
  326. short prev_class;
  327. int hp,max_hp,sp,max_sp;
  328. unsigned int intimacy; //[orn]
  329. short hunger;
  330. struct s_skill hskill[MAX_HOMUNSKILL]; //albator
  331. short skillpts;
  332. short level;
  333. unsigned int exp;
  334. short rename_flag;
  335. short vaporize; //albator
  336. int str;
  337. int agi;
  338. int vit;
  339. int int_;
  340. int dex;
  341. int luk;
  342. int str_value;
  343. int agi_value;
  344. int vit_value;
  345. int int_value;
  346. int dex_value;
  347. int luk_value;
  348. char spiritball; //for homun S [lighta]
  349. };
  350. struct s_mercenary {
  351. int mercenary_id;
  352. uint32 char_id;
  353. short class_;
  354. int hp, sp;
  355. unsigned int kill_count;
  356. unsigned int life_time;
  357. };
  358. struct s_elemental {
  359. int elemental_id;
  360. uint32 char_id;
  361. short class_;
  362. int mode;
  363. int hp, sp, max_hp, max_sp, matk, atk, atk2;
  364. short hit, flee, amotion, def, mdef;
  365. int life_time;
  366. };
  367. struct s_friend {
  368. uint32 account_id;
  369. uint32 char_id;
  370. char name[NAME_LENGTH];
  371. };
  372. #ifdef HOTKEY_SAVING
  373. struct hotkey {
  374. unsigned int id;
  375. unsigned short lv;
  376. unsigned char type; // 0: item, 1: skill
  377. };
  378. #endif
  379. struct mmo_charstatus {
  380. uint32 char_id;
  381. uint32 account_id;
  382. uint32 partner_id;
  383. uint32 father;
  384. uint32 mother;
  385. uint32 child;
  386. unsigned int base_exp,job_exp;
  387. int zeny;
  388. short class_; ///< Player's JobID
  389. unsigned int status_point,skill_point;
  390. int hp,max_hp,sp,max_sp;
  391. unsigned int option;
  392. short manner; // Defines how many minutes a char will be muted, each negative point is equivalent to a minute.
  393. unsigned char karma;
  394. short hair,hair_color,clothes_color,body;
  395. int party_id,guild_id,pet_id,hom_id,mer_id,ele_id,clan_id;
  396. int fame;
  397. // Mercenary Guilds Rank
  398. int arch_faith, arch_calls;
  399. int spear_faith, spear_calls;
  400. int sword_faith, sword_calls;
  401. short weapon; // enum weapon_type
  402. short shield; // view-id
  403. short head_top,head_mid,head_bottom;
  404. short robe;
  405. char name[NAME_LENGTH];
  406. unsigned int base_level,job_level;
  407. unsigned short str,agi,vit,int_,dex,luk;
  408. unsigned char slot,sex;
  409. uint32 mapip;
  410. uint16 mapport;
  411. struct point last_point,save_point,memo_point[MAX_MEMOPOINTS];
  412. struct s_skill skill[MAX_SKILL];
  413. struct s_friend friends[MAX_FRIENDS]; //New friend system [Skotlex]
  414. #ifdef HOTKEY_SAVING
  415. struct hotkey hotkeys[MAX_HOTKEYS];
  416. #endif
  417. bool show_equip,allow_party;
  418. short rename;
  419. time_t delete_date;
  420. time_t unban_time;
  421. // Char server addon system
  422. unsigned int character_moves;
  423. unsigned char font;
  424. bool cashshop_sent; // Whether the player has received the CashShop list
  425. uint32 uniqueitem_counter;
  426. unsigned char hotkey_rowshift;
  427. };
  428. typedef enum mail_status {
  429. MAIL_NEW,
  430. MAIL_UNREAD,
  431. MAIL_READ,
  432. } mail_status;
  433. struct mail_message {
  434. int id;
  435. uint32 send_id; //hold char_id of sender
  436. char send_name[NAME_LENGTH]; //sender nickname
  437. uint32 dest_id; //hold char_id of receiver
  438. char dest_name[NAME_LENGTH]; //receiver nickname
  439. char title[MAIL_TITLE_LENGTH];
  440. char body[MAIL_BODY_LENGTH];
  441. mail_status status;
  442. time_t timestamp; // marks when the message was sent
  443. uint32 zeny;
  444. struct item item;
  445. };
  446. struct mail_data {
  447. short amount;
  448. bool full;
  449. short unchecked, unread;
  450. struct mail_message msg[MAIL_MAX_INBOX];
  451. };
  452. struct auction_data {
  453. unsigned int auction_id;
  454. int seller_id;
  455. char seller_name[NAME_LENGTH];
  456. int buyer_id;
  457. char buyer_name[NAME_LENGTH];
  458. struct item item;
  459. // This data is required for searching, as itemdb is not read by char server
  460. char item_name[ITEM_NAME_LENGTH];
  461. short type;
  462. unsigned short hours;
  463. int price, buynow;
  464. time_t timestamp; // auction's end time
  465. int auction_end_timer;
  466. };
  467. struct party_member {
  468. uint32 account_id;
  469. uint32 char_id;
  470. char name[NAME_LENGTH];
  471. unsigned short class_;
  472. unsigned short map;
  473. unsigned short lv;
  474. unsigned leader : 1,
  475. online : 1;
  476. };
  477. struct party {
  478. int party_id;
  479. char name[NAME_LENGTH];
  480. unsigned char count; //Count of online characters.
  481. unsigned exp : 1,
  482. item : 2; //&1: Party-Share (round-robin), &2: pickup style: shared.
  483. struct party_member member[MAX_PARTY];
  484. };
  485. struct map_session_data;
  486. struct guild_member {
  487. uint32 account_id, char_id;
  488. short hair,hair_color,gender,class_,lv;
  489. uint64 exp;
  490. int exp_payper;
  491. short online,position;
  492. char name[NAME_LENGTH];
  493. struct map_session_data *sd;
  494. unsigned char modified;
  495. };
  496. struct guild_position {
  497. char name[NAME_LENGTH];
  498. int mode;
  499. int exp_mode;
  500. unsigned char modified;
  501. };
  502. struct guild_alliance {
  503. int opposition;
  504. int guild_id;
  505. char name[NAME_LENGTH];
  506. };
  507. struct guild_expulsion {
  508. char name[NAME_LENGTH];
  509. char mes[40];
  510. uint32 account_id;
  511. };
  512. struct guild_skill {
  513. int id,lv;
  514. };
  515. struct Channel;
  516. struct guild {
  517. int guild_id;
  518. short guild_lv, connect_member, max_member, average_lv;
  519. uint64 exp;
  520. unsigned int next_exp;
  521. int skill_point;
  522. char name[NAME_LENGTH],master[NAME_LENGTH];
  523. struct guild_member member[MAX_GUILD];
  524. struct guild_position position[MAX_GUILDPOSITION];
  525. char mes1[MAX_GUILDMES1],mes2[MAX_GUILDMES2];
  526. int emblem_len,emblem_id;
  527. char emblem_data[2048];
  528. struct guild_alliance alliance[MAX_GUILDALLIANCE];
  529. struct guild_expulsion expulsion[MAX_GUILDEXPULSION];
  530. struct guild_skill skill[MAX_GUILDSKILL];
  531. struct Channel *channel;
  532. unsigned short instance_id;
  533. /* Used by char-server to save events for guilds */
  534. unsigned short save_flag;
  535. };
  536. struct guild_castle {
  537. int castle_id;
  538. int mapindex;
  539. char castle_name[NAME_LENGTH];
  540. char castle_event[EVENT_NAME_LENGTH];
  541. int guild_id;
  542. int economy;
  543. int defense;
  544. int triggerE;
  545. int triggerD;
  546. int nextTime;
  547. int payTime;
  548. int createTime;
  549. int visibleC;
  550. struct {
  551. unsigned visible : 1;
  552. int id; // object id
  553. } guardian[MAX_GUARDIANS];
  554. int* temp_guardians; // ids of temporary guardians (mobs)
  555. int temp_guardians_max;
  556. };
  557. struct fame_list {
  558. int id;
  559. int fame;
  560. char name[NAME_LENGTH];
  561. };
  562. enum e_guild_info { //Change Guild Infos
  563. GBI_EXP =1, // Guild Experience (EXP)
  564. GBI_GUILDLV, // Guild level
  565. GBI_SKILLPOINT, // Guild skillpoints
  566. GBI_SKILLLV, // Guild skill_lv ?? seem unused
  567. };
  568. enum e_guild_member_info { //Change Member Infos
  569. GMI_POSITION =0,
  570. GMI_EXP,
  571. GMI_HAIR,
  572. GMI_HAIR_COLOR,
  573. GMI_GENDER,
  574. GMI_CLASS,
  575. GMI_LEVEL,
  576. };
  577. enum e_guild_skill {
  578. GD_SKILLBASE=10000,
  579. GD_APPROVAL=10000,
  580. GD_KAFRACONTRACT=10001,
  581. GD_GUARDRESEARCH=10002,
  582. GD_GUARDUP=10003,
  583. GD_EXTENSION=10004,
  584. GD_GLORYGUILD=10005,
  585. GD_LEADERSHIP=10006,
  586. GD_GLORYWOUNDS=10007,
  587. GD_SOULCOLD=10008,
  588. GD_HAWKEYES=10009,
  589. GD_BATTLEORDER=10010,
  590. GD_REGENERATION=10011,
  591. GD_RESTORE=10012,
  592. GD_EMERGENCYCALL=10013,
  593. GD_DEVELOPMENT=10014,
  594. GD_ITEMEMERGENCYCALL=10015,
  595. GD_MAX,
  596. };
  597. #define MAX_SKILL_ID GD_MAX
  598. //These mark the ID of the jobs, as expected by the client. [Skotlex]
  599. enum e_job {
  600. JOB_NOVICE,
  601. JOB_SWORDMAN,
  602. JOB_MAGE,
  603. JOB_ARCHER,
  604. JOB_ACOLYTE,
  605. JOB_MERCHANT,
  606. JOB_THIEF,
  607. JOB_KNIGHT,
  608. JOB_PRIEST,
  609. JOB_WIZARD,
  610. JOB_BLACKSMITH,
  611. JOB_HUNTER,
  612. JOB_ASSASSIN,
  613. JOB_KNIGHT2,
  614. JOB_CRUSADER,
  615. JOB_MONK,
  616. JOB_SAGE,
  617. JOB_ROGUE,
  618. JOB_ALCHEMIST,
  619. JOB_BARD,
  620. JOB_DANCER,
  621. JOB_CRUSADER2,
  622. JOB_WEDDING,
  623. JOB_SUPER_NOVICE,
  624. JOB_GUNSLINGER,
  625. JOB_NINJA,
  626. JOB_XMAS,
  627. JOB_SUMMER,
  628. JOB_HANBOK,
  629. JOB_OKTOBERFEST,
  630. JOB_MAX_BASIC,
  631. JOB_NOVICE_HIGH = 4001,
  632. JOB_SWORDMAN_HIGH,
  633. JOB_MAGE_HIGH,
  634. JOB_ARCHER_HIGH,
  635. JOB_ACOLYTE_HIGH,
  636. JOB_MERCHANT_HIGH,
  637. JOB_THIEF_HIGH,
  638. JOB_LORD_KNIGHT,
  639. JOB_HIGH_PRIEST,
  640. JOB_HIGH_WIZARD,
  641. JOB_WHITESMITH,
  642. JOB_SNIPER,
  643. JOB_ASSASSIN_CROSS,
  644. JOB_LORD_KNIGHT2,
  645. JOB_PALADIN,
  646. JOB_CHAMPION,
  647. JOB_PROFESSOR,
  648. JOB_STALKER,
  649. JOB_CREATOR,
  650. JOB_CLOWN,
  651. JOB_GYPSY,
  652. JOB_PALADIN2,
  653. JOB_BABY,
  654. JOB_BABY_SWORDMAN,
  655. JOB_BABY_MAGE,
  656. JOB_BABY_ARCHER,
  657. JOB_BABY_ACOLYTE,
  658. JOB_BABY_MERCHANT,
  659. JOB_BABY_THIEF,
  660. JOB_BABY_KNIGHT,
  661. JOB_BABY_PRIEST,
  662. JOB_BABY_WIZARD,
  663. JOB_BABY_BLACKSMITH,
  664. JOB_BABY_HUNTER,
  665. JOB_BABY_ASSASSIN,
  666. JOB_BABY_KNIGHT2,
  667. JOB_BABY_CRUSADER,
  668. JOB_BABY_MONK,
  669. JOB_BABY_SAGE,
  670. JOB_BABY_ROGUE,
  671. JOB_BABY_ALCHEMIST,
  672. JOB_BABY_BARD,
  673. JOB_BABY_DANCER,
  674. JOB_BABY_CRUSADER2,
  675. JOB_SUPER_BABY,
  676. JOB_TAEKWON,
  677. JOB_STAR_GLADIATOR,
  678. JOB_STAR_GLADIATOR2,
  679. JOB_SOUL_LINKER,
  680. JOB_GANGSI,
  681. JOB_DEATH_KNIGHT,
  682. JOB_DARK_COLLECTOR,
  683. JOB_RUNE_KNIGHT = 4054,
  684. JOB_WARLOCK,
  685. JOB_RANGER,
  686. JOB_ARCH_BISHOP,
  687. JOB_MECHANIC,
  688. JOB_GUILLOTINE_CROSS,
  689. JOB_RUNE_KNIGHT_T,
  690. JOB_WARLOCK_T,
  691. JOB_RANGER_T,
  692. JOB_ARCH_BISHOP_T,
  693. JOB_MECHANIC_T,
  694. JOB_GUILLOTINE_CROSS_T,
  695. JOB_ROYAL_GUARD,
  696. JOB_SORCERER,
  697. JOB_MINSTREL,
  698. JOB_WANDERER,
  699. JOB_SURA,
  700. JOB_GENETIC,
  701. JOB_SHADOW_CHASER,
  702. JOB_ROYAL_GUARD_T,
  703. JOB_SORCERER_T,
  704. JOB_MINSTREL_T,
  705. JOB_WANDERER_T,
  706. JOB_SURA_T,
  707. JOB_GENETIC_T,
  708. JOB_SHADOW_CHASER_T,
  709. JOB_RUNE_KNIGHT2,
  710. JOB_RUNE_KNIGHT_T2,
  711. JOB_ROYAL_GUARD2,
  712. JOB_ROYAL_GUARD_T2,
  713. JOB_RANGER2,
  714. JOB_RANGER_T2,
  715. JOB_MECHANIC2,
  716. JOB_MECHANIC_T2,
  717. JOB_BABY_RUNE = 4096,
  718. JOB_BABY_WARLOCK,
  719. JOB_BABY_RANGER,
  720. JOB_BABY_BISHOP,
  721. JOB_BABY_MECHANIC,
  722. JOB_BABY_CROSS,
  723. JOB_BABY_GUARD,
  724. JOB_BABY_SORCERER,
  725. JOB_BABY_MINSTREL,
  726. JOB_BABY_WANDERER,
  727. JOB_BABY_SURA,
  728. JOB_BABY_GENETIC,
  729. JOB_BABY_CHASER,
  730. JOB_BABY_RUNE2,
  731. JOB_BABY_GUARD2,
  732. JOB_BABY_RANGER2,
  733. JOB_BABY_MECHANIC2,
  734. JOB_SUPER_NOVICE_E = 4190,
  735. JOB_SUPER_BABY_E,
  736. JOB_KAGEROU = 4211,
  737. JOB_OBORO,
  738. JOB_REBELLION = 4215,
  739. JOB_SUMMONER = 4218,
  740. JOB_BABY_SUMMONER = 4220,
  741. JOB_BABY_NINJA = 4222,
  742. JOB_BABY_KAGEROU,
  743. JOB_BABY_OBORO,
  744. JOB_BABY_TAEKWON,
  745. JOB_BABY_STAR_GLADIATOR,
  746. JOB_BABY_SOUL_LINKER,
  747. JOB_BABY_GUNSLINGER,
  748. JOB_BABY_REBELLION,
  749. JOB_BABY_STAR_GLADIATOR2 = 4238,
  750. JOB_MAX,
  751. };
  752. enum e_sex {
  753. SEX_FEMALE = 0,
  754. SEX_MALE,
  755. SEX_SERVER,
  756. SEX_ACCOUNT = 99
  757. };
  758. /// Item Bound Type
  759. enum bound_type {
  760. BOUND_NONE = 0, /// No bound
  761. BOUND_ACCOUNT, /// 1- Account Bound
  762. BOUND_GUILD, /// 2 - Guild Bound
  763. BOUND_PARTY, /// 3 - Party Bound
  764. BOUND_CHAR, /// 4 - Character Bound
  765. BOUND_MAX,
  766. BOUND_ONEQUIP = 1, ///< Show notification when item will be bound on equip
  767. BOUND_DISPYELLOW = 2, /// Shows the item name in yellow color
  768. };
  769. enum e_pc_reg_loading {
  770. PRL_NONE = 0x0,
  771. PRL_CHAR = 0x1,
  772. PRL_ACCL = 0x2, // local
  773. PRL_ACCG = 0x4, // global
  774. PRL_ALL = 0xFF,
  775. };
  776. enum e_party_member_withdraw {
  777. PARTY_MEMBER_WITHDRAW_LEAVE, ///< /leave
  778. PARTY_MEMBER_WITHDRAW_EXPEL, ///< Kicked
  779. PARTY_MEMBER_WITHDRAW_CANT_LEAVE, ///< TODO: Cannot /leave
  780. PARTY_MEMBER_WITHDRAW_CANT_EXPEL, ///< TODO: Cannot be kicked
  781. };
  782. enum e_rank {
  783. RANK_BLACKSMITH = 0,
  784. RANK_ALCHEMIST = 1,
  785. RANK_TAEKWON = 2,
  786. RANK_KILLER = 3
  787. };
  788. struct clan_alliance {
  789. int opposition;
  790. int clan_id;
  791. char name[NAME_LENGTH];
  792. };
  793. struct clan{
  794. int id;
  795. char name[NAME_LENGTH];
  796. char master[NAME_LENGTH];
  797. char map[MAP_NAME_LENGTH_EXT];
  798. short max_member, connect_member;
  799. struct map_session_data *members[MAX_CLAN];
  800. struct clan_alliance alliance[MAX_CLANALLIANCE];
  801. };
  802. // Sanity checks...
  803. #if MAX_ZENY > INT_MAX
  804. #error MAX_ZENY is too big
  805. #endif
  806. // This sanity check is required, because some other places(like skill.c) rely on this
  807. #if MAX_PARTY < 2
  808. #error MAX_PARTY is too small, you need at least 2 players for a party
  809. #endif
  810. #ifndef VIP_ENABLE
  811. #define MIN_STORAGE MAX_STORAGE // If the VIP system is disabled the min = max.
  812. #define MIN_CHARS MAX_CHARS // Default number of characters per account.
  813. #define MAX_CHAR_BILLING 0
  814. #define MAX_CHAR_VIP 0
  815. #endif
  816. #if (MIN_CHARS + MAX_CHAR_VIP + MAX_CHAR_BILLING) > MAX_CHARS
  817. #error Config of MAX_CHARS is invalid
  818. #endif
  819. #if MIN_STORAGE > MAX_STORAGE
  820. #error Config of MIN_STORAGE is invalid
  821. #endif
  822. #ifdef PACKET_OBFUSCATION
  823. #if PACKETVER < 20110817
  824. #undef PACKET_OBFUSCATION
  825. #endif
  826. #endif
  827. /* Feb 1st 2012 */
  828. #if PACKETVER >= 20120201
  829. #define NEW_CARTS
  830. #ifndef ENABLE_SC_SAVING
  831. #warning "Cart won't be able to be saved for relog"
  832. #endif
  833. #if PACKETVER >= 20150826
  834. #define MAX_CARTS 12 // used for 3 new cart design
  835. #else
  836. #define MAX_CARTS 9
  837. #endif
  838. #else
  839. #define MAX_CARTS 5
  840. #endif
  841. #endif /* _MMO_H_ */