mmo.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586
  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 1024
  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. enum item_types {
  94. IT_HEALING = 0,
  95. IT_UNKNOWN, //1
  96. IT_USABLE, //2
  97. IT_ETC, //3
  98. IT_WEAPON, //4
  99. IT_ARMOR, //5
  100. IT_CARD, //6
  101. IT_PETEGG, //7
  102. IT_PETARMOR,//8
  103. IT_UNKNOWN2,//9
  104. IT_AMMO, //10
  105. IT_DELAYCONSUME,//11
  106. IT_MAX
  107. };
  108. //Questlog system [Kevin]
  109. typedef enum quest_state { Q_INACTIVE, Q_ACTIVE } quest_state;
  110. struct quest_objective {
  111. char name[NAME_LENGTH];
  112. int count;
  113. };
  114. struct quest {
  115. int quest_id;
  116. quest_state state;
  117. int num_objectives;
  118. int time;
  119. struct quest_objective objectives[MAX_QUEST_OBJECTIVES];
  120. };
  121. struct item {
  122. int id;
  123. short nameid;
  124. short amount;
  125. unsigned short equip; // location(s) where item is equipped (using enum equip_pos for bitmasking)
  126. char identify;
  127. char refine;
  128. char attribute;
  129. short card[MAX_SLOTS];
  130. };
  131. struct point {
  132. unsigned short map;
  133. short x,y;
  134. };
  135. struct s_skill {
  136. unsigned short id,lv,flag;
  137. };
  138. struct global_reg {
  139. char str[32];
  140. char value[256];
  141. };
  142. //Holds array of global registries, used by the char server and converter.
  143. struct accreg {
  144. int account_id, char_id;
  145. int reg_num;
  146. struct global_reg reg[MAX_REG_NUM];
  147. };
  148. //For saving status changes across sessions. [Skotlex]
  149. struct status_change_data {
  150. unsigned short type; //SC_type
  151. int val1, val2, val3, val4, tick; //Remaining duration.
  152. };
  153. struct storage_data {
  154. int storage_amount;
  155. struct item items[MAX_STORAGE];
  156. };
  157. struct guild_storage {
  158. int dirty;
  159. int guild_id;
  160. short storage_status;
  161. short storage_amount;
  162. struct item storage_[MAX_GUILD_STORAGE];
  163. };
  164. struct s_pet {
  165. int account_id;
  166. int char_id;
  167. int pet_id;
  168. short class_;
  169. short level;
  170. short egg_id;//pet egg id
  171. short equip;//pet equip name_id
  172. short intimate;//pet friendly
  173. short hungry;//pet hungry
  174. char name[NAME_LENGTH];
  175. char rename_flag;
  176. char incuvate;
  177. };
  178. struct s_homunculus { //[orn]
  179. char name[NAME_LENGTH];
  180. int hom_id;
  181. int char_id;
  182. short class_;
  183. int hp,max_hp,sp,max_sp;
  184. unsigned int intimacy; //[orn]
  185. short hunger;
  186. struct s_skill hskill[MAX_HOMUNSKILL]; //albator
  187. short skillpts;
  188. short level;
  189. unsigned int exp;
  190. short rename_flag;
  191. short vaporize; //albator
  192. int str ;
  193. int agi ;
  194. int vit ;
  195. int int_ ;
  196. int dex ;
  197. int luk ;
  198. };
  199. struct s_friend {
  200. int account_id;
  201. int char_id;
  202. char name[NAME_LENGTH];
  203. };
  204. #ifdef HOTKEY_SAVING
  205. struct hotkey {
  206. unsigned int id;
  207. unsigned short lv;
  208. unsigned char type; // 0: item, 1: skill
  209. };
  210. #endif
  211. struct mmo_charstatus {
  212. int char_id;
  213. int account_id;
  214. int partner_id;
  215. int father;
  216. int mother;
  217. int child;
  218. unsigned int base_exp,job_exp;
  219. int zeny;
  220. short class_;
  221. unsigned short status_point,skill_point;
  222. int hp,max_hp,sp,max_sp;
  223. unsigned int option;
  224. short manner;
  225. unsigned char karma;
  226. short hair,hair_color,clothes_color;
  227. int party_id,guild_id,pet_id,hom_id;
  228. int fame;
  229. short weapon; // enum weapon_type
  230. short shield; // view-id
  231. short head_top,head_mid,head_bottom;
  232. char name[NAME_LENGTH];
  233. unsigned int base_level,job_level;
  234. short str,agi,vit,int_,dex,luk;
  235. unsigned char slot,sex;
  236. uint32 mapip;
  237. uint16 mapport;
  238. struct point last_point,save_point,memo_point[MAX_MEMOPOINTS];
  239. struct item inventory[MAX_INVENTORY],cart[MAX_CART];
  240. struct storage_data storage;
  241. struct s_skill skill[MAX_SKILL];
  242. struct s_friend friends[MAX_FRIENDS]; //New friend system [Skotlex]
  243. #ifdef HOTKEY_SAVING
  244. struct hotkey hotkeys[MAX_HOTKEYS];
  245. #endif
  246. bool show_equip;
  247. };
  248. typedef enum mail_status {
  249. MAIL_NEW,
  250. MAIL_UNREAD,
  251. MAIL_READ,
  252. } mail_status;
  253. struct mail_message {
  254. unsigned int id;
  255. int send_id;
  256. char send_name[NAME_LENGTH];
  257. int dest_id;
  258. char dest_name[NAME_LENGTH];
  259. char title[MAIL_TITLE_LENGTH];
  260. char body[MAIL_BODY_LENGTH];
  261. mail_status status;
  262. time_t timestamp; // marks when the message was sent
  263. int zeny;
  264. struct item item;
  265. };
  266. struct mail_data {
  267. short amount;
  268. bool changed, full;
  269. short unchecked, unread;
  270. struct mail_message msg[MAIL_MAX_INBOX];
  271. };
  272. struct auction_data {
  273. unsigned int auction_id;
  274. int seller_id;
  275. char seller_name[NAME_LENGTH];
  276. int buyer_id;
  277. char buyer_name[NAME_LENGTH];
  278. struct item item;
  279. // This data is required for searching, as itemdb is not read by char server
  280. char item_name[ITEM_NAME_LENGTH];
  281. short type;
  282. unsigned short hours;
  283. int price, buynow;
  284. time_t timestamp; // auction's end time
  285. int auction_end_timer;
  286. };
  287. struct registry {
  288. int global_num;
  289. struct global_reg global[GLOBAL_REG_NUM];
  290. int account_num;
  291. struct global_reg account[ACCOUNT_REG_NUM];
  292. int account2_num;
  293. struct global_reg account2[ACCOUNT_REG2_NUM];
  294. };
  295. struct party_member {
  296. int account_id;
  297. int char_id;
  298. char name[NAME_LENGTH];
  299. unsigned short class_;
  300. unsigned short map;
  301. unsigned short lv;
  302. unsigned leader : 1,
  303. online : 1;
  304. };
  305. struct party {
  306. int party_id;
  307. char name[NAME_LENGTH];
  308. unsigned char count; //Count of online characters.
  309. unsigned exp : 1,
  310. item : 2; //&1: Party-Share (round-robin), &2: pickup style: shared.
  311. struct party_member member[MAX_PARTY];
  312. };
  313. struct map_session_data;
  314. struct guild_member {
  315. int account_id, char_id;
  316. short hair,hair_color,gender,class_,lv;
  317. unsigned int exp;
  318. int exp_payper;
  319. short online,position;
  320. char name[NAME_LENGTH];
  321. struct map_session_data *sd;
  322. unsigned char modified;
  323. };
  324. struct guild_position {
  325. char name[NAME_LENGTH];
  326. int mode;
  327. int exp_mode;
  328. unsigned char modified;
  329. };
  330. struct guild_alliance {
  331. int opposition;
  332. int guild_id;
  333. char name[NAME_LENGTH];
  334. };
  335. struct guild_expulsion {
  336. char name[NAME_LENGTH];
  337. char mes[40];
  338. int account_id;
  339. };
  340. struct guild_skill {
  341. int id,lv;
  342. };
  343. struct guild {
  344. int guild_id;
  345. short guild_lv, connect_member, max_member, average_lv;
  346. unsigned int exp,next_exp;
  347. int skill_point;
  348. char name[NAME_LENGTH],master[NAME_LENGTH];
  349. struct guild_member member[MAX_GUILD];
  350. struct guild_position position[MAX_GUILDPOSITION];
  351. char mes1[60],mes2[120];
  352. int emblem_len,emblem_id;
  353. char emblem_data[2048];
  354. struct guild_alliance alliance[MAX_GUILDALLIANCE];
  355. struct guild_expulsion expulsion[MAX_GUILDEXPULSION];
  356. struct guild_skill skill[MAX_GUILDSKILL];
  357. unsigned short save_flag; // for TXT saving
  358. };
  359. struct guild_castle {
  360. int castle_id;
  361. int mapindex;
  362. char castle_name[NAME_LENGTH];
  363. char castle_event[NAME_LENGTH];
  364. int guild_id;
  365. int economy;
  366. int defense;
  367. int triggerE;
  368. int triggerD;
  369. int nextTime;
  370. int payTime;
  371. int createTime;
  372. int visibleC;
  373. struct {
  374. unsigned visible : 1;
  375. int id; // object id
  376. } guardian[MAX_GUARDIANS];
  377. int* temp_guardians; // ids of temporary guardians (mobs)
  378. int temp_guardians_max;
  379. };
  380. // for Brandish Spear calculations
  381. struct square {
  382. int val1[5];
  383. int val2[5];
  384. };
  385. struct fame_list {
  386. int id;
  387. int fame;
  388. char name[NAME_LENGTH];
  389. };
  390. enum {
  391. GBI_EXP =1, // ギルドのEXP
  392. GBI_GUILDLV, // ギルドのLv
  393. GBI_SKILLPOINT, // ギルドのスキルポイント
  394. GBI_SKILLLV, // ギルドスキルLv
  395. };
  396. enum {
  397. GMI_POSITION =0, // メンバーの役職変更
  398. GMI_EXP,
  399. GMI_HAIR,
  400. GMI_HAIR_COLOR,
  401. GMI_GENDER,
  402. GMI_CLASS,
  403. GMI_LEVEL,
  404. };
  405. enum {
  406. GD_SKILLBASE=10000,
  407. GD_APPROVAL=10000,
  408. GD_KAFRACONTRACT=10001,
  409. GD_GUARDRESEARCH=10002,
  410. GD_GUARDUP=10003,
  411. GD_EXTENSION=10004,
  412. GD_GLORYGUILD=10005,
  413. GD_LEADERSHIP=10006,
  414. GD_GLORYWOUNDS=10007,
  415. GD_SOULCOLD=10008,
  416. GD_HAWKEYES=10009,
  417. GD_BATTLEORDER=10010,
  418. GD_REGENERATION=10011,
  419. GD_RESTORE=10012,
  420. GD_EMERGENCYCALL=10013,
  421. GD_DEVELOPMENT=10014,
  422. };
  423. //These mark the ID of the jobs, as expected by the client. [Skotlex]
  424. enum {
  425. JOB_NOVICE,
  426. JOB_SWORDMAN,
  427. JOB_MAGE,
  428. JOB_ARCHER,
  429. JOB_ACOLYTE,
  430. JOB_MERCHANT,
  431. JOB_THIEF,
  432. JOB_KNIGHT,
  433. JOB_PRIEST,
  434. JOB_WIZARD,
  435. JOB_BLACKSMITH,
  436. JOB_HUNTER,
  437. JOB_ASSASSIN,
  438. JOB_KNIGHT2,
  439. JOB_CRUSADER,
  440. JOB_MONK,
  441. JOB_SAGE,
  442. JOB_ROGUE,
  443. JOB_ALCHEMIST,
  444. JOB_BARD,
  445. JOB_DANCER,
  446. JOB_CRUSADER2,
  447. JOB_WEDDING,
  448. JOB_SUPER_NOVICE,
  449. JOB_GUNSLINGER,
  450. JOB_NINJA,
  451. JOB_XMAS,
  452. JOB_SUMMER,
  453. JOB_MAX_BASIC,
  454. JOB_NOVICE_HIGH = 4001,
  455. JOB_SWORDMAN_HIGH,
  456. JOB_MAGE_HIGH,
  457. JOB_ARCHER_HIGH,
  458. JOB_ACOLYTE_HIGH,
  459. JOB_MERCHANT_HIGH,
  460. JOB_THIEF_HIGH,
  461. JOB_LORD_KNIGHT,
  462. JOB_HIGH_PRIEST,
  463. JOB_HIGH_WIZARD,
  464. JOB_WHITESMITH,
  465. JOB_SNIPER,
  466. JOB_ASSASSIN_CROSS,
  467. JOB_LORD_KNIGHT2,
  468. JOB_PALADIN,
  469. JOB_CHAMPION,
  470. JOB_PROFESSOR,
  471. JOB_STALKER,
  472. JOB_CREATOR,
  473. JOB_CLOWN,
  474. JOB_GYPSY,
  475. JOB_PALADIN2,
  476. JOB_BABY,
  477. JOB_BABY_SWORDMAN,
  478. JOB_BABY_MAGE,
  479. JOB_BABY_ARCHER,
  480. JOB_BABY_ACOLYTE,
  481. JOB_BABY_MERCHANT,
  482. JOB_BABY_THIEF,
  483. JOB_BABY_KNIGHT,
  484. JOB_BABY_PRIEST,
  485. JOB_BABY_WIZARD,
  486. JOB_BABY_BLACKSMITH,
  487. JOB_BABY_HUNTER,
  488. JOB_BABY_ASSASSIN,
  489. JOB_BABY_KNIGHT2,
  490. JOB_BABY_CRUSADER,
  491. JOB_BABY_MONK,
  492. JOB_BABY_SAGE,
  493. JOB_BABY_ROGUE,
  494. JOB_BABY_ALCHEMIST,
  495. JOB_BABY_BARD,
  496. JOB_BABY_DANCER,
  497. JOB_BABY_CRUSADER2,
  498. JOB_SUPER_BABY,
  499. JOB_TAEKWON,
  500. JOB_STAR_GLADIATOR,
  501. JOB_STAR_GLADIATOR2,
  502. JOB_SOUL_LINKER,
  503. JOB_MAX,
  504. };
  505. // sanity checks...
  506. #if MAX_ZENY > INT_MAX
  507. #error MAX_ZENY is too big
  508. #endif
  509. #endif /* _MMO_H_ */