mmo.h 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  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 <time.h>
  6. #include "utils.h" // _WIN32
  7. #if ! defined(Assert)
  8. #if defined(RELEASE)
  9. #define Assert(EX)
  10. #else
  11. // extern "C" {
  12. #include <assert.h>
  13. // }
  14. #ifndef DEFCPP
  15. #if defined(_WIN32) && !defined(MINGW)
  16. #include <crtdbg.h>
  17. #endif
  18. #endif
  19. #define Assert(EX) assert(EX)
  20. #endif
  21. #endif /* ! defined(Assert) */
  22. #ifdef CYGWIN
  23. // txtやlogなどの書き出すファイルの改行コード
  24. #define RETCODE "\r\n" // (CR/LF:Windows系)
  25. #else
  26. #define RETCODE "\n" // (LF:Unix系)
  27. #endif
  28. #define RET RETCODE
  29. #define FIFOSIZE_SERVERLINK 256*1024
  30. // set to 0 to not check IP of player between each server.
  31. // set to another value if you want to check (1)
  32. #define CMP_AUTHFIFO_IP 1
  33. #define CMP_AUTHFIFO_LOGIN2 1
  34. //Remove/Comment this line to disable sc_data saving. [Skotlex]
  35. #define ENABLE_SC_SAVING
  36. #define MAX_MAP_PER_SERVER 1024
  37. #define MAX_INVENTORY 100
  38. //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]
  39. //Note: The client seems unable to receive data for more than 4 slots due to all related packets having a fixed size.
  40. #define MAX_SLOTS 4
  41. #define MAX_AMOUNT 30000
  42. #define MAX_ZENY 1000000000
  43. #define MAX_FAME 1000000000
  44. #define MAX_CART 100
  45. #define MAX_SKILL 1100 // Bumped to 1100 for new quest skills, will need to further increase one day... [DracoRPG]
  46. #define GLOBAL_REG_NUM 96
  47. #define ACCOUNT_REG_NUM 32
  48. #define ACCOUNT_REG2_NUM 16
  49. //Should hold the max of GLOBAL/ACCOUNT/ACCOUNT2 (needed for some arrays that hold all three)
  50. #define MAX_REG_NUM 96
  51. #define DEFAULT_WALK_SPEED 150
  52. #define MIN_WALK_SPEED 0
  53. #define MAX_WALK_SPEED 1000
  54. #define MAX_STORAGE 300
  55. #define MAX_GUILD_STORAGE 1000
  56. #define MAX_PARTY 12
  57. #define MAX_GUILD 16+10*6 // increased max guild members +6 per 1 extension levels [Lupus]
  58. #define MAX_GUILDPOSITION 20 // increased max guild positions to accomodate for all members [Valaris] (removed) [PoW]
  59. #define MAX_GUILDEXPLUSION 32
  60. #define MAX_GUILDALLIANCE 16
  61. #define MAX_GUILDSKILL 15 // increased max guild skills because of new skills [Sara-chan]
  62. #define MAX_GUILDCASTLE 24 // increased to include novice castles [Valaris]
  63. #define MAX_GUILDLEVEL 50
  64. #define MAX_GUARDIANS 8 //Local max per castle. [Skotlex]
  65. #define MIN_HAIR_STYLE battle_config.min_hair_style
  66. #define MAX_HAIR_STYLE battle_config.max_hair_style
  67. #define MIN_HAIR_COLOR battle_config.min_hair_color
  68. #define MAX_HAIR_COLOR battle_config.max_hair_color
  69. #define MIN_CLOTH_COLOR battle_config.min_cloth_color
  70. #define MAX_CLOTH_COLOR battle_config.max_cloth_color
  71. // for produce
  72. #define MIN_ATTRIBUTE 0
  73. #define MAX_ATTRIBUTE 4
  74. #define ATTRIBUTE_NORMAL 0
  75. #define MIN_STAR 0
  76. #define MAX_STAR 3
  77. #define MIN_PORTAL_MEMO 0
  78. #define MAX_PORTAL_MEMO 2
  79. #define MAX_STATUS_TYPE 5
  80. #define WEDDING_RING_M 2634
  81. #define WEDDING_RING_F 2635
  82. //For character names, title names, guilds, maps, etc.
  83. //Includes null-terminator as it is the length of the array.
  84. #define NAME_LENGTH 24
  85. //For item names, which tend to have much longer names.
  86. #define ITEM_NAME_LENGTH 50
  87. //For Map Names, which the client considers to be 16 in length
  88. #define MAP_NAME_LENGTH 16
  89. #define MAX_FRIENDS 40
  90. #define MAX_MEMOPOINTS 10
  91. //Size of the fame list arrays.
  92. #define MAX_FAME_LIST 10
  93. //These max values can be exceeded and the char/map servers will update them with no problems
  94. //These are just meant to minimize the updating needed between char/map servers as players login.
  95. //Room for initial 10K accounts
  96. #define DEFAULT_MAX_ACCOUNT_ID 2010000
  97. //Room for initial 100k characters
  98. #define DEFAULT_MAX_CHAR_ID 250000
  99. #define CHAR_CONF_NAME "conf/char_athena.conf"
  100. struct item {
  101. int id;
  102. short nameid;
  103. short amount;
  104. unsigned short equip;
  105. char identify;
  106. char refine;
  107. char attribute;
  108. short card[MAX_SLOTS];
  109. };
  110. struct point{
  111. unsigned short map;
  112. short x,y;
  113. };
  114. struct skill {
  115. unsigned short id,lv,flag;
  116. };
  117. struct global_reg {
  118. char str[32];
  119. char value[256]; // [zBuffer]
  120. };
  121. //For saving status changes across sessions. [Skotlex]
  122. struct status_change_data {
  123. unsigned short type; //SC_type
  124. int val1, val2, val3, val4, tick; //Remaining duration.
  125. };
  126. struct s_pet {
  127. int account_id;
  128. int char_id;
  129. int pet_id;
  130. short class_;
  131. short level;
  132. short egg_id;//pet egg id
  133. short equip;//pet equip name_id
  134. short intimate;//pet friendly
  135. short hungry;//pet hungry
  136. char name[NAME_LENGTH];
  137. char rename_flag;
  138. char incuvate;
  139. };
  140. struct friend {
  141. int account_id;
  142. int char_id;
  143. char name[NAME_LENGTH];
  144. };
  145. struct mmo_charstatus {
  146. int char_id;
  147. int account_id;
  148. int partner_id;
  149. int father;
  150. int mother;
  151. int child;
  152. unsigned int base_exp,job_exp;
  153. int zeny;
  154. short class_;
  155. short status_point,skill_point;
  156. int hp,max_hp,sp,max_sp;
  157. short option,manner;
  158. unsigned char karma;
  159. short hair,hair_color,clothes_color;
  160. int party_id,guild_id,pet_id;
  161. int fame;
  162. short weapon,shield;
  163. short head_top,head_mid,head_bottom;
  164. char name[NAME_LENGTH];
  165. unsigned int base_level,job_level;
  166. short str,agi,vit,int_,dex,luk;
  167. unsigned char char_num,sex;
  168. unsigned long mapip;
  169. unsigned int mapport;
  170. struct point last_point,save_point,memo_point[MAX_MEMOPOINTS];
  171. struct item inventory[MAX_INVENTORY],cart[MAX_CART];
  172. struct skill skill[MAX_SKILL];
  173. struct friend friends[MAX_FRIENDS]; //New friend system [Skotlex]
  174. };
  175. struct registry {
  176. int global_num;
  177. struct global_reg global[GLOBAL_REG_NUM];
  178. int account_num;
  179. struct global_reg account[ACCOUNT_REG_NUM];
  180. int account2_num;
  181. struct global_reg account2[ACCOUNT_REG2_NUM];
  182. };
  183. struct storage {
  184. int dirty;
  185. int account_id;
  186. short storage_status;
  187. short storage_amount;
  188. struct item storage_[MAX_STORAGE];
  189. };
  190. struct guild_storage {
  191. int dirty;
  192. int guild_id;
  193. short storage_status;
  194. short storage_amount;
  195. struct item storage_[MAX_GUILD_STORAGE];
  196. };
  197. struct map_session_data;
  198. struct gm_account {
  199. int account_id;
  200. int level;
  201. };
  202. struct party_member {
  203. int account_id;
  204. int char_id;
  205. char name[NAME_LENGTH];
  206. struct map_session_data *sd;
  207. unsigned short map;
  208. unsigned short lv;
  209. unsigned leader : 1,
  210. online : 1;
  211. };
  212. struct party {
  213. int party_id;
  214. char name[NAME_LENGTH];
  215. unsigned exp : 1,
  216. item : 2; //&1: Party-Share (round-robin), &2: pickup style: shared.
  217. short itemc; //For item sharing through round-robin, holds last item receiver.
  218. struct party_member member[MAX_PARTY];
  219. };
  220. struct guild_member {
  221. int account_id, char_id;
  222. short hair,hair_color,gender,class_,lv;
  223. int exp,exp_payper;
  224. short online,position;
  225. int rsv1,rsv2;
  226. char name[NAME_LENGTH];
  227. struct map_session_data *sd;
  228. };
  229. struct guild_position {
  230. char name[NAME_LENGTH];
  231. int mode;
  232. int exp_mode;
  233. };
  234. struct guild_alliance {
  235. int opposition;
  236. int guild_id;
  237. char name[NAME_LENGTH];
  238. };
  239. struct guild_explusion {
  240. char name[NAME_LENGTH];
  241. char mes[40];
  242. char acc[40];
  243. int account_id;
  244. int rsv1,rsv2,rsv3;
  245. };
  246. struct guild_skill {
  247. int id,lv;
  248. };
  249. struct guild {
  250. int guild_id;
  251. short guild_lv, connect_member, max_member, average_lv;
  252. int exp,next_exp,skill_point;
  253. #ifdef TXT_ONLY
  254. //FIXME: Gotta remove this variable completely, but doing so screws up the format of the txt save file...
  255. int castle_id;
  256. #endif
  257. char name[NAME_LENGTH],master[NAME_LENGTH];
  258. struct guild_member member[MAX_GUILD];
  259. struct guild_position position[MAX_GUILDPOSITION];
  260. char mes1[60],mes2[120];
  261. int emblem_len,emblem_id;
  262. char emblem_data[2048];
  263. struct guild_alliance alliance[MAX_GUILDALLIANCE];
  264. struct guild_explusion explusion[MAX_GUILDEXPLUSION];
  265. struct guild_skill skill[MAX_GUILDSKILL];
  266. #ifndef TXT_ONLY
  267. unsigned char save_flag;
  268. #endif
  269. };
  270. struct guild_castle {
  271. int castle_id;
  272. char map_name[MAP_NAME_LENGTH];
  273. char castle_name[NAME_LENGTH];
  274. char castle_event[NAME_LENGTH];
  275. int guild_id;
  276. int economy;
  277. int defense;
  278. int triggerE;
  279. int triggerD;
  280. int nextTime;
  281. int payTime;
  282. int createTime;
  283. int visibleC;
  284. struct {
  285. unsigned visible : 1;
  286. int hp;
  287. int id;
  288. } guardian[MAX_GUARDIANS]; //New simplified structure. [Skotlex]
  289. };
  290. struct square {
  291. int val1[5];
  292. int val2[5];
  293. };
  294. struct fame_list {
  295. int id;
  296. int fame;
  297. char name[NAME_LENGTH];
  298. };
  299. enum {
  300. GBI_EXP =1, // ギルドのEXP
  301. GBI_GUILDLV, // ギルドのLv
  302. GBI_SKILLPOINT, // ギルドのスキルポイント
  303. GBI_SKILLLV, // ギルドスキルLv
  304. };
  305. enum {
  306. GMI_POSITION =0, // メンバーの役職変更
  307. GMI_EXP,
  308. GMI_HAIR,
  309. GMI_HAIR_COLOR,
  310. GMI_GENDER,
  311. GMI_CLASS,
  312. GMI_LEVEL,
  313. };
  314. enum {
  315. GD_SKILLBASE=10000,
  316. GD_APPROVAL=10000,
  317. GD_KAFRACONTRACT=10001,
  318. GD_GUARDIANRESEARCH=10002,
  319. GD_GUARDUP=10003,
  320. GD_EXTENSION=10004,
  321. GD_GLORYGUILD=10005,
  322. GD_LEADERSHIP=10006,
  323. GD_GLORYWOUNDS=10007,
  324. GD_SOULCOLD=10008,
  325. GD_HAWKEYES=10009,
  326. GD_BATTLEORDER=10010,
  327. GD_REGENERATION=10011,
  328. GD_RESTORE=10012,
  329. GD_EMERGENCYCALL=10013,
  330. GD_DEVELOPMENT=10014,
  331. };
  332. #ifndef __WIN32
  333. #ifndef strcmpi
  334. #define strcmpi strcasecmp
  335. #endif
  336. #ifndef stricmp
  337. #define stricmp strcasecmp
  338. #endif
  339. #ifndef strncmpi
  340. #define strncmpi strncasecmp
  341. #endif
  342. #ifndef strnicmp
  343. #define strnicmp strncasecmp
  344. #endif
  345. #else
  346. #define snprintf _snprintf
  347. #define vsnprintf _vsnprintf
  348. #ifndef strncmpi
  349. #define strncmpi strnicmp
  350. #endif
  351. #endif
  352. #endif // _MMO_H_