mmo.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608
  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 <time.h>
  7. #define FIFOSIZE_SERVERLINK 256*1024
  8. //Remove/Comment this line to disable sc_data saving. [Skotlex]
  9. #define ENABLE_SC_SAVING
  10. //Remove/Comment this line to disable server-side hot-key saving support [Skotlex]
  11. //Note that newer clients no longer save hotkeys in the registry!
  12. #define HOTKEY_SAVING
  13. //The number is the max number of hotkeys to save (27 = 9 skills x 3 bars)
  14. #define MAX_HOTKEYS 27
  15. #define MAX_MAP_PER_SERVER 1500 // Increased to allow creation of Instance Maps
  16. #define MAX_INVENTORY 100
  17. //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.
  18. #define MAX_CHARS 9
  19. //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]
  20. //Note: The client seems unable to receive data for more than 4 slots due to all related packets having a fixed size.
  21. #define MAX_SLOTS 4
  22. //Max amount of a single stacked item
  23. #define MAX_AMOUNT 30000
  24. #define MAX_ZENY 1000000000
  25. #define MAX_FAME 1000000000
  26. #define MAX_CART 100
  27. #define MAX_SKILL 1020
  28. #define GLOBAL_REG_NUM 96
  29. #define ACCOUNT_REG_NUM 64
  30. #define ACCOUNT_REG2_NUM 16
  31. //Should hold the max of GLOBAL/ACCOUNT/ACCOUNT2 (needed for some arrays that hold all three)
  32. #define MAX_REG_NUM 96
  33. #define DEFAULT_WALK_SPEED 150
  34. #define MIN_WALK_SPEED 0
  35. #define MAX_WALK_SPEED 1000
  36. #define MAX_STORAGE 600
  37. #define MAX_GUILD_STORAGE 1000
  38. #define MAX_PARTY 12
  39. #define MAX_GUILD 16+10*6 // increased max guild members +6 per 1 extension levels [Lupus]
  40. #define MAX_GUILDPOSITION 20 // increased max guild positions to accomodate for all members [Valaris] (removed) [PoW]
  41. #define MAX_GUILDEXPULSION 32
  42. #define MAX_GUILDALLIANCE 16
  43. #define MAX_GUILDSKILL 15 // increased max guild skills because of new skills [Sara-chan]
  44. #define MAX_GUILDCASTLE 34 // Updated to include new entries for WoE:SE. [L0ne_W0lf]
  45. #define MAX_GUILDLEVEL 50
  46. #define MAX_GUARDIANS 8 //Local max per castle. [Skotlex]
  47. #define MAX_QUEST 25 //Max quests for a PC
  48. #define MAX_QUEST_OBJECTIVES 3 //Max quest objectives for a quest
  49. #define MIN_HAIR_STYLE battle_config.min_hair_style
  50. #define MAX_HAIR_STYLE battle_config.max_hair_style
  51. #define MIN_HAIR_COLOR battle_config.min_hair_color
  52. #define MAX_HAIR_COLOR battle_config.max_hair_color
  53. #define MIN_CLOTH_COLOR battle_config.min_cloth_color
  54. #define MAX_CLOTH_COLOR battle_config.max_cloth_color
  55. // for produce
  56. #define MIN_ATTRIBUTE 0
  57. #define MAX_ATTRIBUTE 4
  58. #define ATTRIBUTE_NORMAL 0
  59. #define MIN_STAR 0
  60. #define MAX_STAR 3
  61. #define MAX_STATUS_TYPE 5
  62. #define WEDDING_RING_M 2634
  63. #define WEDDING_RING_F 2635
  64. //For character names, title names, guilds, maps, etc.
  65. //Includes null-terminator as it is the length of the array.
  66. #define NAME_LENGTH (23 + 1)
  67. //For item names, which tend to have much longer names.
  68. #define ITEM_NAME_LENGTH 50
  69. //For Map Names, which the client considers to be 16 in length including the .gat extension
  70. #define MAP_NAME_LENGTH (11 + 1)
  71. #define MAP_NAME_LENGTH_EXT (MAP_NAME_LENGTH + 4)
  72. #define MAX_FRIENDS 40
  73. #define MAX_MEMOPOINTS 3
  74. //Size of the fame list arrays.
  75. #define MAX_FAME_LIST 10
  76. //Limits to avoid ID collision with other game objects
  77. #define START_ACCOUNT_NUM 2000000
  78. #define END_ACCOUNT_NUM 100000000
  79. #define START_CHAR_NUM 150000
  80. //Base Homun skill.
  81. #define HM_SKILLBASE 8001
  82. #define MAX_HOMUNSKILL 16
  83. #define MAX_HOMUNCULUS_CLASS 16 //[orn]
  84. #define HM_CLASS_BASE 6001
  85. #define HM_CLASS_MAX (HM_CLASS_BASE+MAX_HOMUNCULUS_CLASS-1)
  86. //Mail System
  87. #define MAIL_MAX_INBOX 30
  88. #define MAIL_TITLE_LENGTH 40
  89. #define MAIL_BODY_LENGTH 200
  90. //Mercenary System
  91. #define MC_SKILLBASE 8201
  92. #define MAX_MERCSKILL 37
  93. #define MAX_MERCENARY_CLASS 36
  94. enum item_types {
  95. IT_HEALING = 0,
  96. IT_UNKNOWN, //1
  97. IT_USABLE, //2
  98. IT_ETC, //3
  99. IT_WEAPON, //4
  100. IT_ARMOR, //5
  101. IT_CARD, //6
  102. IT_PETEGG, //7
  103. IT_PETARMOR,//8
  104. IT_UNKNOWN2,//9
  105. IT_AMMO, //10
  106. IT_DELAYCONSUME,//11
  107. IT_MAX
  108. };
  109. //Questlog system [Kevin]
  110. typedef enum quest_state { Q_INACTIVE, Q_ACTIVE } quest_state;
  111. struct quest_objective {
  112. char name[NAME_LENGTH];
  113. int count;
  114. };
  115. struct quest {
  116. int quest_id;
  117. quest_state state;
  118. int num_objectives;
  119. int time;
  120. struct quest_objective objectives[MAX_QUEST_OBJECTIVES];
  121. };
  122. struct item {
  123. int id;
  124. short nameid;
  125. short amount;
  126. unsigned short equip; // location(s) where item is equipped (using enum equip_pos for bitmasking)
  127. char identify;
  128. char refine;
  129. char attribute;
  130. short card[MAX_SLOTS];
  131. unsigned int expire_time;
  132. };
  133. struct point {
  134. unsigned short map;
  135. short x,y;
  136. };
  137. struct s_skill {
  138. unsigned short id,lv,flag;
  139. };
  140. struct global_reg {
  141. char str[32];
  142. char value[256];
  143. };
  144. //Holds array of global registries, used by the char server and converter.
  145. struct accreg {
  146. int account_id, char_id;
  147. int reg_num;
  148. struct global_reg reg[MAX_REG_NUM];
  149. };
  150. //For saving status changes across sessions. [Skotlex]
  151. struct status_change_data {
  152. unsigned short type; //SC_type
  153. int val1, val2, val3, val4, tick; //Remaining duration.
  154. };
  155. struct storage_data {
  156. int storage_amount;
  157. struct item items[MAX_STORAGE];
  158. };
  159. struct guild_storage {
  160. int dirty;
  161. int guild_id;
  162. short storage_status;
  163. short storage_amount;
  164. struct item storage_[MAX_GUILD_STORAGE];
  165. };
  166. struct s_pet {
  167. int account_id;
  168. int char_id;
  169. int pet_id;
  170. short class_;
  171. short level;
  172. short egg_id;//pet egg id
  173. short equip;//pet equip name_id
  174. short intimate;//pet friendly
  175. short hungry;//pet hungry
  176. char name[NAME_LENGTH];
  177. char rename_flag;
  178. char incuvate;
  179. };
  180. struct s_homunculus { //[orn]
  181. char name[NAME_LENGTH];
  182. int hom_id;
  183. int char_id;
  184. short class_;
  185. int hp,max_hp,sp,max_sp;
  186. unsigned int intimacy; //[orn]
  187. short hunger;
  188. struct s_skill hskill[MAX_HOMUNSKILL]; //albator
  189. short skillpts;
  190. short level;
  191. unsigned int exp;
  192. short rename_flag;
  193. short vaporize; //albator
  194. int str ;
  195. int agi ;
  196. int vit ;
  197. int int_ ;
  198. int dex ;
  199. int luk ;
  200. };
  201. struct s_mercenary {
  202. int mercenary_id;
  203. int char_id;
  204. short class_;
  205. int hp, sp;
  206. unsigned int kill_count;
  207. unsigned int life_time;
  208. };
  209. struct s_friend {
  210. int account_id;
  211. int char_id;
  212. char name[NAME_LENGTH];
  213. };
  214. #ifdef HOTKEY_SAVING
  215. struct hotkey {
  216. unsigned int id;
  217. unsigned short lv;
  218. unsigned char type; // 0: item, 1: skill
  219. };
  220. #endif
  221. struct mmo_charstatus {
  222. int char_id;
  223. int account_id;
  224. int partner_id;
  225. int father;
  226. int mother;
  227. int child;
  228. unsigned int base_exp,job_exp;
  229. int zeny;
  230. short class_;
  231. unsigned int status_point,skill_point;
  232. int hp,max_hp,sp,max_sp;
  233. unsigned int option;
  234. short manner;
  235. unsigned char karma;
  236. short hair,hair_color,clothes_color;
  237. int party_id,guild_id,pet_id,hom_id,mer_id;
  238. int fame;
  239. // Mercenary Guilds Rank
  240. int arch_faith, arch_calls;
  241. int spear_faith, spear_calls;
  242. int sword_faith, sword_calls;
  243. short weapon; // enum weapon_type
  244. short shield; // view-id
  245. short head_top,head_mid,head_bottom;
  246. char name[NAME_LENGTH];
  247. unsigned int base_level,job_level;
  248. short str,agi,vit,int_,dex,luk;
  249. unsigned char slot,sex;
  250. uint32 mapip;
  251. uint16 mapport;
  252. struct point last_point,save_point,memo_point[MAX_MEMOPOINTS];
  253. struct item inventory[MAX_INVENTORY],cart[MAX_CART];
  254. struct storage_data storage;
  255. struct s_skill skill[MAX_SKILL];
  256. struct s_friend friends[MAX_FRIENDS]; //New friend system [Skotlex]
  257. #ifdef HOTKEY_SAVING
  258. struct hotkey hotkeys[MAX_HOTKEYS];
  259. #endif
  260. bool show_equip;
  261. };
  262. typedef enum mail_status {
  263. MAIL_NEW,
  264. MAIL_UNREAD,
  265. MAIL_READ,
  266. } mail_status;
  267. struct mail_message {
  268. unsigned int id;
  269. int send_id;
  270. char send_name[NAME_LENGTH];
  271. int dest_id;
  272. char dest_name[NAME_LENGTH];
  273. char title[MAIL_TITLE_LENGTH];
  274. char body[MAIL_BODY_LENGTH];
  275. mail_status status;
  276. time_t timestamp; // marks when the message was sent
  277. int zeny;
  278. struct item item;
  279. };
  280. struct mail_data {
  281. short amount;
  282. bool full;
  283. short unchecked, unread;
  284. struct mail_message msg[MAIL_MAX_INBOX];
  285. };
  286. struct auction_data {
  287. unsigned int auction_id;
  288. int seller_id;
  289. char seller_name[NAME_LENGTH];
  290. int buyer_id;
  291. char buyer_name[NAME_LENGTH];
  292. struct item item;
  293. // This data is required for searching, as itemdb is not read by char server
  294. char item_name[ITEM_NAME_LENGTH];
  295. short type;
  296. unsigned short hours;
  297. int price, buynow;
  298. time_t timestamp; // auction's end time
  299. int auction_end_timer;
  300. };
  301. struct registry {
  302. int global_num;
  303. struct global_reg global[GLOBAL_REG_NUM];
  304. int account_num;
  305. struct global_reg account[ACCOUNT_REG_NUM];
  306. int account2_num;
  307. struct global_reg account2[ACCOUNT_REG2_NUM];
  308. };
  309. struct party_member {
  310. int account_id;
  311. int char_id;
  312. char name[NAME_LENGTH];
  313. unsigned short class_;
  314. unsigned short map;
  315. unsigned short lv;
  316. unsigned leader : 1,
  317. online : 1;
  318. };
  319. struct party {
  320. int party_id;
  321. char name[NAME_LENGTH];
  322. unsigned char count; //Count of online characters.
  323. unsigned exp : 1,
  324. item : 2; //&1: Party-Share (round-robin), &2: pickup style: shared.
  325. struct party_member member[MAX_PARTY];
  326. };
  327. struct map_session_data;
  328. struct guild_member {
  329. int account_id, char_id;
  330. short hair,hair_color,gender,class_,lv;
  331. unsigned int exp;
  332. int exp_payper;
  333. short online,position;
  334. char name[NAME_LENGTH];
  335. struct map_session_data *sd;
  336. unsigned char modified;
  337. };
  338. struct guild_position {
  339. char name[NAME_LENGTH];
  340. int mode;
  341. int exp_mode;
  342. unsigned char modified;
  343. };
  344. struct guild_alliance {
  345. int opposition;
  346. int guild_id;
  347. char name[NAME_LENGTH];
  348. };
  349. struct guild_expulsion {
  350. char name[NAME_LENGTH];
  351. char mes[40];
  352. int account_id;
  353. };
  354. struct guild_skill {
  355. int id,lv;
  356. };
  357. struct guild {
  358. int guild_id;
  359. short guild_lv, connect_member, max_member, average_lv;
  360. unsigned int exp,next_exp;
  361. int skill_point;
  362. char name[NAME_LENGTH],master[NAME_LENGTH];
  363. struct guild_member member[MAX_GUILD];
  364. struct guild_position position[MAX_GUILDPOSITION];
  365. char mes1[60],mes2[120];
  366. int emblem_len,emblem_id;
  367. char emblem_data[2048];
  368. struct guild_alliance alliance[MAX_GUILDALLIANCE];
  369. struct guild_expulsion expulsion[MAX_GUILDEXPULSION];
  370. struct guild_skill skill[MAX_GUILDSKILL];
  371. unsigned short save_flag; // for TXT saving
  372. };
  373. struct guild_castle {
  374. int castle_id;
  375. int mapindex;
  376. char castle_name[NAME_LENGTH];
  377. char castle_event[NAME_LENGTH];
  378. int guild_id;
  379. int economy;
  380. int defense;
  381. int triggerE;
  382. int triggerD;
  383. int nextTime;
  384. int payTime;
  385. int createTime;
  386. int visibleC;
  387. struct {
  388. unsigned visible : 1;
  389. int id; // object id
  390. } guardian[MAX_GUARDIANS];
  391. int* temp_guardians; // ids of temporary guardians (mobs)
  392. int temp_guardians_max;
  393. };
  394. // for Brandish Spear calculations
  395. struct square {
  396. int val1[5];
  397. int val2[5];
  398. };
  399. struct fame_list {
  400. int id;
  401. int fame;
  402. char name[NAME_LENGTH];
  403. };
  404. enum {
  405. GBI_EXP =1, // ギルドのEXP
  406. GBI_GUILDLV, // ギルドのLv
  407. GBI_SKILLPOINT, // ギルドのスキルポイント
  408. GBI_SKILLLV, // ギルドスキルLv
  409. };
  410. enum {
  411. GMI_POSITION =0, // メンバーの役職変更
  412. GMI_EXP,
  413. GMI_HAIR,
  414. GMI_HAIR_COLOR,
  415. GMI_GENDER,
  416. GMI_CLASS,
  417. GMI_LEVEL,
  418. };
  419. enum {
  420. GD_SKILLBASE=10000,
  421. GD_APPROVAL=10000,
  422. GD_KAFRACONTRACT=10001,
  423. GD_GUARDRESEARCH=10002,
  424. GD_GUARDUP=10003,
  425. GD_EXTENSION=10004,
  426. GD_GLORYGUILD=10005,
  427. GD_LEADERSHIP=10006,
  428. GD_GLORYWOUNDS=10007,
  429. GD_SOULCOLD=10008,
  430. GD_HAWKEYES=10009,
  431. GD_BATTLEORDER=10010,
  432. GD_REGENERATION=10011,
  433. GD_RESTORE=10012,
  434. GD_EMERGENCYCALL=10013,
  435. GD_DEVELOPMENT=10014,
  436. };
  437. //These mark the ID of the jobs, as expected by the client. [Skotlex]
  438. enum {
  439. JOB_NOVICE,
  440. JOB_SWORDMAN,
  441. JOB_MAGE,
  442. JOB_ARCHER,
  443. JOB_ACOLYTE,
  444. JOB_MERCHANT,
  445. JOB_THIEF,
  446. JOB_KNIGHT,
  447. JOB_PRIEST,
  448. JOB_WIZARD,
  449. JOB_BLACKSMITH,
  450. JOB_HUNTER,
  451. JOB_ASSASSIN,
  452. JOB_KNIGHT2,
  453. JOB_CRUSADER,
  454. JOB_MONK,
  455. JOB_SAGE,
  456. JOB_ROGUE,
  457. JOB_ALCHEMIST,
  458. JOB_BARD,
  459. JOB_DANCER,
  460. JOB_CRUSADER2,
  461. JOB_WEDDING,
  462. JOB_SUPER_NOVICE,
  463. JOB_GUNSLINGER,
  464. JOB_NINJA,
  465. JOB_XMAS,
  466. JOB_SUMMER,
  467. JOB_MAX_BASIC,
  468. JOB_NOVICE_HIGH = 4001,
  469. JOB_SWORDMAN_HIGH,
  470. JOB_MAGE_HIGH,
  471. JOB_ARCHER_HIGH,
  472. JOB_ACOLYTE_HIGH,
  473. JOB_MERCHANT_HIGH,
  474. JOB_THIEF_HIGH,
  475. JOB_LORD_KNIGHT,
  476. JOB_HIGH_PRIEST,
  477. JOB_HIGH_WIZARD,
  478. JOB_WHITESMITH,
  479. JOB_SNIPER,
  480. JOB_ASSASSIN_CROSS,
  481. JOB_LORD_KNIGHT2,
  482. JOB_PALADIN,
  483. JOB_CHAMPION,
  484. JOB_PROFESSOR,
  485. JOB_STALKER,
  486. JOB_CREATOR,
  487. JOB_CLOWN,
  488. JOB_GYPSY,
  489. JOB_PALADIN2,
  490. JOB_BABY,
  491. JOB_BABY_SWORDMAN,
  492. JOB_BABY_MAGE,
  493. JOB_BABY_ARCHER,
  494. JOB_BABY_ACOLYTE,
  495. JOB_BABY_MERCHANT,
  496. JOB_BABY_THIEF,
  497. JOB_BABY_KNIGHT,
  498. JOB_BABY_PRIEST,
  499. JOB_BABY_WIZARD,
  500. JOB_BABY_BLACKSMITH,
  501. JOB_BABY_HUNTER,
  502. JOB_BABY_ASSASSIN,
  503. JOB_BABY_KNIGHT2,
  504. JOB_BABY_CRUSADER,
  505. JOB_BABY_MONK,
  506. JOB_BABY_SAGE,
  507. JOB_BABY_ROGUE,
  508. JOB_BABY_ALCHEMIST,
  509. JOB_BABY_BARD,
  510. JOB_BABY_DANCER,
  511. JOB_BABY_CRUSADER2,
  512. JOB_SUPER_BABY,
  513. JOB_TAEKWON,
  514. JOB_STAR_GLADIATOR,
  515. JOB_STAR_GLADIATOR2,
  516. JOB_SOUL_LINKER,
  517. JOB_MAX,
  518. };
  519. enum {
  520. SEX_FEMALE = 0,
  521. SEX_MALE,
  522. SEX_SERVER
  523. };
  524. // sanity checks...
  525. #if MAX_ZENY > INT_MAX
  526. #error MAX_ZENY is too big
  527. #endif
  528. #endif /* _MMO_H_ */