mmo.h 12 KB

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