mmo.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539
  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 1100 // Bumped to 1100 for new quest skills, will need to further increase one day... [DracoRPG]
  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 300
  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 29 // increased to include novice castles [Valaris]
  45. #define MAX_GUILDLEVEL 50
  46. #define MAX_GUARDIANS 8 //Local max per castle. [Skotlex]
  47. #define MIN_HAIR_STYLE battle_config.min_hair_style
  48. #define MAX_HAIR_STYLE battle_config.max_hair_style
  49. #define MIN_HAIR_COLOR battle_config.min_hair_color
  50. #define MAX_HAIR_COLOR battle_config.max_hair_color
  51. #define MIN_CLOTH_COLOR battle_config.min_cloth_color
  52. #define MAX_CLOTH_COLOR battle_config.max_cloth_color
  53. // for produce
  54. #define MIN_ATTRIBUTE 0
  55. #define MAX_ATTRIBUTE 4
  56. #define ATTRIBUTE_NORMAL 0
  57. #define MIN_STAR 0
  58. #define MAX_STAR 3
  59. #define MAX_STATUS_TYPE 5
  60. #define WEDDING_RING_M 2634
  61. #define WEDDING_RING_F 2635
  62. //For character names, title names, guilds, maps, etc.
  63. //Includes null-terminator as it is the length of the array.
  64. #define NAME_LENGTH (23 + 1)
  65. //For item names, which tend to have much longer names.
  66. #define ITEM_NAME_LENGTH 50
  67. //For Map Names, which the client considers to be 16 in length including the .gat extension
  68. #define MAP_NAME_LENGTH (11 + 1)
  69. #define MAP_NAME_LENGTH_EXT (MAP_NAME_LENGTH + 4)
  70. #define MAX_FRIENDS 40
  71. #define MAX_MEMOPOINTS 3
  72. //Size of the fame list arrays.
  73. #define MAX_FAME_LIST 10
  74. //These max values can be exceeded and the char/map servers will update them with no problems
  75. //These are just meant to minimize the updating needed between char/map servers as players login.
  76. //Room for initial 10K accounts
  77. #define DEFAULT_MAX_ACCOUNT_ID 2010000
  78. #define START_ACCOUNT_NUM 2000000
  79. #define END_ACCOUNT_NUM 100000000
  80. //Room for initial 100k characters
  81. #define DEFAULT_MAX_CHAR_ID 250000
  82. //Base Homun skill.
  83. #define HM_SKILLBASE 8001
  84. #define MAX_HOMUNSKILL 16
  85. #define MAX_HOMUNCULUS_CLASS 16 //[orn]
  86. #define HM_CLASS_BASE 6001
  87. #define HM_CLASS_MAX (HM_CLASS_BASE+MAX_HOMUNCULUS_CLASS-1)
  88. //Mail System
  89. #define MAIL_MAX_INBOX 30
  90. #define MAIL_TITLE_LENGTH 40
  91. #define MAIL_BODY_LENGTH 200
  92. struct item {
  93. int id;
  94. short nameid;
  95. short amount;
  96. unsigned short equip; // location(s) where item is equipped (using enum equip_pos for bitmasking)
  97. char identify;
  98. char refine;
  99. char attribute;
  100. short card[MAX_SLOTS];
  101. };
  102. struct point {
  103. unsigned short map;
  104. short x,y;
  105. };
  106. struct skill {
  107. unsigned short id,lv,flag;
  108. };
  109. struct global_reg {
  110. char str[32];
  111. char value[256];
  112. };
  113. //Holds array of global registries, used by the char server and converter.
  114. struct accreg {
  115. int account_id, char_id;
  116. int reg_num;
  117. struct global_reg reg[MAX_REG_NUM];
  118. };
  119. //For saving status changes across sessions. [Skotlex]
  120. struct status_change_data {
  121. unsigned short type; //SC_type
  122. int val1, val2, val3, val4, tick; //Remaining duration.
  123. };
  124. struct s_pet {
  125. int account_id;
  126. int char_id;
  127. int pet_id;
  128. short class_;
  129. short level;
  130. short egg_id;//pet egg id
  131. short equip;//pet equip name_id
  132. short intimate;//pet friendly
  133. short hungry;//pet hungry
  134. char name[NAME_LENGTH];
  135. char rename_flag;
  136. char incuvate;
  137. };
  138. struct s_homunculus { //[orn]
  139. char name[NAME_LENGTH];
  140. int hom_id;
  141. int char_id;
  142. short class_;
  143. int hp,max_hp,sp,max_sp;
  144. unsigned int intimacy; //[orn]
  145. short hunger;
  146. struct skill hskill[MAX_HOMUNSKILL]; //albator
  147. short skillpts;
  148. short level;
  149. unsigned int exp;
  150. short rename_flag;
  151. short vaporize; //albator
  152. int str ;
  153. int agi ;
  154. int vit ;
  155. int int_ ;
  156. int dex ;
  157. int luk ;
  158. };
  159. struct s_friend {
  160. int account_id;
  161. int char_id;
  162. char name[NAME_LENGTH];
  163. };
  164. #ifdef HOTKEY_SAVING
  165. struct hotkey {
  166. unsigned int id;
  167. unsigned short lv;
  168. unsigned char type; // 0: item, 1: skill
  169. };
  170. #endif
  171. struct mmo_charstatus {
  172. int char_id;
  173. int account_id;
  174. int partner_id;
  175. int father;
  176. int mother;
  177. int child;
  178. unsigned int base_exp,job_exp;
  179. int zeny;
  180. short class_;
  181. unsigned short status_point,skill_point;
  182. int hp,max_hp,sp,max_sp;
  183. unsigned int option;
  184. short manner;
  185. unsigned char karma;
  186. short hair,hair_color,clothes_color;
  187. int party_id,guild_id,pet_id,hom_id;
  188. int fame;
  189. short weapon; // enum weapon_type
  190. short shield; // view-id
  191. short head_top,head_mid,head_bottom;
  192. char name[NAME_LENGTH];
  193. unsigned int base_level,job_level;
  194. short str,agi,vit,int_,dex,luk;
  195. unsigned char slot,sex;
  196. uint32 mapip;
  197. uint16 mapport;
  198. struct point last_point,save_point,memo_point[MAX_MEMOPOINTS];
  199. struct item inventory[MAX_INVENTORY],cart[MAX_CART];
  200. struct skill skill[MAX_SKILL];
  201. struct s_friend friends[MAX_FRIENDS]; //New friend system [Skotlex]
  202. #ifdef HOTKEY_SAVING
  203. struct hotkey hotkeys[MAX_HOTKEYS];
  204. #endif
  205. bool show_equip;
  206. };
  207. enum mail_status {
  208. MAIL_NEW,
  209. MAIL_UNREAD,
  210. MAIL_READ,
  211. MAIL_DELETED,
  212. MAIL_RETURNED,
  213. MAIL_INVALID,
  214. };
  215. struct mail_message {
  216. unsigned int id;
  217. int send_id;
  218. char send_name[NAME_LENGTH];
  219. int dest_id;
  220. char dest_name[NAME_LENGTH];
  221. char title[MAIL_TITLE_LENGTH];
  222. char body[MAIL_BODY_LENGTH];
  223. enum mail_status status;
  224. unsigned int timestamp; // marks when the message was sent
  225. int zeny;
  226. struct item item;
  227. };
  228. struct mail_data {
  229. short amount;
  230. bool changed, full;
  231. short unchecked, unread;
  232. struct mail_message msg[MAIL_MAX_INBOX];
  233. };
  234. struct registry {
  235. int global_num;
  236. struct global_reg global[GLOBAL_REG_NUM];
  237. int account_num;
  238. struct global_reg account[ACCOUNT_REG_NUM];
  239. int account2_num;
  240. struct global_reg account2[ACCOUNT_REG2_NUM];
  241. };
  242. struct storage {
  243. int dirty;
  244. int account_id;
  245. short storage_status;
  246. short storage_amount;
  247. struct item storage_[MAX_STORAGE];
  248. };
  249. struct guild_storage {
  250. int dirty;
  251. int guild_id;
  252. short storage_status;
  253. short storage_amount;
  254. struct item storage_[MAX_GUILD_STORAGE];
  255. };
  256. struct gm_account {
  257. int account_id;
  258. int level;
  259. };
  260. struct party_member {
  261. int account_id;
  262. int char_id;
  263. char name[NAME_LENGTH];
  264. unsigned short class_;
  265. unsigned short map;
  266. unsigned short lv;
  267. unsigned leader : 1,
  268. online : 1;
  269. };
  270. struct party {
  271. int party_id;
  272. char name[NAME_LENGTH];
  273. unsigned char count; //Count of online characters.
  274. unsigned exp : 1,
  275. item : 2; //&1: Party-Share (round-robin), &2: pickup style: shared.
  276. struct party_member member[MAX_PARTY];
  277. };
  278. struct map_session_data;
  279. struct guild_member {
  280. int account_id, char_id;
  281. short hair,hair_color,gender,class_,lv;
  282. unsigned int exp;
  283. int exp_payper;
  284. short online,position;
  285. char name[NAME_LENGTH];
  286. struct map_session_data *sd;
  287. unsigned char modified;
  288. };
  289. struct guild_position {
  290. char name[NAME_LENGTH];
  291. int mode;
  292. int exp_mode;
  293. unsigned char modified;
  294. };
  295. struct guild_alliance {
  296. int opposition;
  297. int guild_id;
  298. char name[NAME_LENGTH];
  299. };
  300. struct guild_expulsion {
  301. char name[NAME_LENGTH];
  302. char mes[40];
  303. int account_id;
  304. };
  305. struct guild_skill {
  306. int id,lv;
  307. };
  308. struct guild {
  309. int guild_id;
  310. short guild_lv, connect_member, max_member, average_lv;
  311. unsigned int exp,next_exp;
  312. int skill_point;
  313. char name[NAME_LENGTH],master[NAME_LENGTH];
  314. struct guild_member member[MAX_GUILD];
  315. struct guild_position position[MAX_GUILDPOSITION];
  316. char mes1[60],mes2[120];
  317. int emblem_len,emblem_id;
  318. char emblem_data[2048];
  319. struct guild_alliance alliance[MAX_GUILDALLIANCE];
  320. struct guild_expulsion expulsion[MAX_GUILDEXPULSION];
  321. struct guild_skill skill[MAX_GUILDSKILL];
  322. #ifndef TXT_ONLY
  323. unsigned short save_flag;
  324. #endif
  325. };
  326. struct guild_castle {
  327. int castle_id;
  328. int mapindex;
  329. char castle_name[NAME_LENGTH];
  330. char castle_event[NAME_LENGTH];
  331. int guild_id;
  332. int economy;
  333. int defense;
  334. int triggerE;
  335. int triggerD;
  336. int nextTime;
  337. int payTime;
  338. int createTime;
  339. int visibleC;
  340. struct {
  341. unsigned visible : 1;
  342. int id; // object id
  343. } guardian[MAX_GUARDIANS];
  344. };
  345. // for Brandish Spear calculations
  346. struct square {
  347. int val1[5];
  348. int val2[5];
  349. };
  350. struct fame_list {
  351. int id;
  352. int fame;
  353. char name[NAME_LENGTH];
  354. };
  355. enum {
  356. GBI_EXP =1, // ギルドのEXP
  357. GBI_GUILDLV, // ギルドのLv
  358. GBI_SKILLPOINT, // ギルドのスキルポイント
  359. GBI_SKILLLV, // ギルドスキルLv
  360. };
  361. enum {
  362. GMI_POSITION =0, // メンバーの役職変更
  363. GMI_EXP,
  364. GMI_HAIR,
  365. GMI_HAIR_COLOR,
  366. GMI_GENDER,
  367. GMI_CLASS,
  368. GMI_LEVEL,
  369. };
  370. enum {
  371. GD_SKILLBASE=10000,
  372. GD_APPROVAL=10000,
  373. GD_KAFRACONTRACT=10001,
  374. GD_GUARDRESEARCH=10002,
  375. GD_GUARDUP=10003,
  376. GD_EXTENSION=10004,
  377. GD_GLORYGUILD=10005,
  378. GD_LEADERSHIP=10006,
  379. GD_GLORYWOUNDS=10007,
  380. GD_SOULCOLD=10008,
  381. GD_HAWKEYES=10009,
  382. GD_BATTLEORDER=10010,
  383. GD_REGENERATION=10011,
  384. GD_RESTORE=10012,
  385. GD_EMERGENCYCALL=10013,
  386. GD_DEVELOPMENT=10014,
  387. };
  388. //These mark the ID of the jobs, as expected by the client. [Skotlex]
  389. enum {
  390. JOB_NOVICE,
  391. JOB_SWORDMAN,
  392. JOB_MAGE,
  393. JOB_ARCHER,
  394. JOB_ACOLYTE,
  395. JOB_MERCHANT,
  396. JOB_THIEF,
  397. JOB_KNIGHT,
  398. JOB_PRIEST,
  399. JOB_WIZARD,
  400. JOB_BLACKSMITH,
  401. JOB_HUNTER,
  402. JOB_ASSASSIN,
  403. JOB_KNIGHT2,
  404. JOB_CRUSADER,
  405. JOB_MONK,
  406. JOB_SAGE,
  407. JOB_ROGUE,
  408. JOB_ALCHEMIST,
  409. JOB_BARD,
  410. JOB_DANCER,
  411. JOB_CRUSADER2,
  412. JOB_WEDDING,
  413. JOB_SUPER_NOVICE,
  414. JOB_GUNSLINGER,
  415. JOB_NINJA,
  416. JOB_XMAS,
  417. JOB_SUMMER,
  418. JOB_MAX_BASIC,
  419. JOB_NOVICE_HIGH = 4001,
  420. JOB_SWORDMAN_HIGH,
  421. JOB_MAGE_HIGH,
  422. JOB_ARCHER_HIGH,
  423. JOB_ACOLYTE_HIGH,
  424. JOB_MERCHANT_HIGH,
  425. JOB_THIEF_HIGH,
  426. JOB_LORD_KNIGHT,
  427. JOB_HIGH_PRIEST,
  428. JOB_HIGH_WIZARD,
  429. JOB_WHITESMITH,
  430. JOB_SNIPER,
  431. JOB_ASSASSIN_CROSS,
  432. JOB_LORD_KNIGHT2,
  433. JOB_PALADIN,
  434. JOB_CHAMPION,
  435. JOB_PROFESSOR,
  436. JOB_STALKER,
  437. JOB_CREATOR,
  438. JOB_CLOWN,
  439. JOB_GYPSY,
  440. JOB_PALADIN2,
  441. JOB_BABY,
  442. JOB_BABY_SWORDMAN,
  443. JOB_BABY_MAGE,
  444. JOB_BABY_ARCHER,
  445. JOB_BABY_ACOLYTE,
  446. JOB_BABY_MERCHANT,
  447. JOB_BABY_THIEF,
  448. JOB_BABY_KNIGHT,
  449. JOB_BABY_PRIEST,
  450. JOB_BABY_WIZARD,
  451. JOB_BABY_BLACKSMITH,
  452. JOB_BABY_HUNTER,
  453. JOB_BABY_ASSASSIN,
  454. JOB_BABY_KNIGHT2,
  455. JOB_BABY_CRUSADER,
  456. JOB_BABY_MONK,
  457. JOB_BABY_SAGE,
  458. JOB_BABY_ROGUE,
  459. JOB_BABY_ALCHEMIST,
  460. JOB_BABY_BARD,
  461. JOB_BABY_DANCER,
  462. JOB_BABY_CRUSADER2,
  463. JOB_SUPER_BABY,
  464. JOB_TAEKWON,
  465. JOB_STAR_GLADIATOR,
  466. JOB_STAR_GLADIATOR2,
  467. JOB_SOUL_LINKER,
  468. JOB_MAX,
  469. };
  470. // sanity checks...
  471. #if MAX_ZENY > INT_MAX
  472. #error MAX_ZENY is too big
  473. #endif
  474. #endif /* _MMO_H_ */