map.h 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393
  1. // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
  2. // For more information, see LICENCE in the main folder
  3. #ifndef _MAP_H_
  4. #define _MAP_H_
  5. #include <stdarg.h>
  6. #include "../common/mmo.h"
  7. #include "../common/mapindex.h"
  8. #include "../common/db.h"
  9. //Uncomment to enable the Cell Stack Limit mod. (EXPERIMENTAL)
  10. //It's only config is the battle_config cell_stack_limit.
  11. //Only chars affected are those defined in BL_CHAR (mobs and players currently)
  12. //#define CELL_NOSTACK
  13. #define MAX_PC_CLASS 4050
  14. #define PC_CLASS_BASE 0
  15. #define PC_CLASS_BASE2 (PC_CLASS_BASE + 4001)
  16. #define PC_CLASS_BASE3 (PC_CLASS_BASE2 + 22)
  17. #define MAX_NPC_PER_MAP 512
  18. #define BLOCK_SIZE 8
  19. #define AREA_SIZE battle_config.area_size
  20. #define LIFETIME_FLOORITEM 60
  21. #define DAMAGELOG_SIZE 30
  22. #define LOOTITEM_SIZE 10
  23. #define MAX_STATUSCHANGE 250
  24. //Quick defines to know which are the min-max common ailments. [Skotlex]
  25. //Because of the way the headers are included.. these must be replaced for actual values.
  26. //Remember to update as needed! Min is SC_STONE and max is SC_DPOISON currently.
  27. #define SC_COMMON_MIN 0
  28. #define SC_COMMON_MAX 10
  29. #define MAX_SKILL_LEVEL 100
  30. #define MAX_SKILLUNITGROUP 32
  31. #define MAX_MOBSKILLUNITGROUP 8
  32. #define MAX_SKILLUNITGROUPTICKSET 32
  33. #define MAX_SKILLTIMERSKILL 32
  34. #define MAX_MOBSKILLTIMERSKILL 10
  35. #define MAX_MOBSKILL 40
  36. #define MAX_MOB_LIST_PER_MAP 128
  37. #define MAX_EVENTQUEUE 2
  38. #define MAX_EVENTTIMER 32
  39. #define NATURAL_HEAL_INTERVAL 500
  40. #define MAX_FLOORITEM 500000
  41. #define MAX_LEVEL 1000
  42. #define MAX_WALKPATH 32
  43. #define MAX_DROP_PER_MAP 48
  44. #define MAX_IGNORE_LIST 80
  45. #define MAX_VENDING 12
  46. #define MOBID_EMPERIUM 1288
  47. #define MAX_PC_BONUS 10
  48. #define MAX_DUEL 1024
  49. //These mark the ID of the jobs, as expected by the client. [Skotlex]
  50. enum {
  51. JOB_NOVICE,
  52. JOB_SWORDMAN,
  53. JOB_MAGE,
  54. JOB_ARCHER,
  55. JOB_ACOLYTE,
  56. JOB_MERCHANT,
  57. JOB_THIEF,
  58. JOB_KNIGHT,
  59. JOB_PRIEST,
  60. JOB_WIZARD,
  61. JOB_BLACKSMITH,
  62. JOB_HUNTER,
  63. JOB_ASSASSIN,
  64. JOB_KNIGHT2,
  65. JOB_CRUSADER,
  66. JOB_MONK,
  67. JOB_SAGE,
  68. JOB_ROGUE,
  69. JOB_ALCHEMIST,
  70. JOB_BARD,
  71. JOB_DANCER,
  72. JOB_CRUSADER2,
  73. JOB_WEDDING,
  74. JOB_SUPER_NOVICE,
  75. JOB_GUNSLINGER,
  76. JOB_NINJA,
  77. JOB_XMAS,
  78. JOB_NOVICE_HIGH = 4001,
  79. JOB_SWORDMAN_HIGH,
  80. JOB_MAGE_HIGH,
  81. JOB_ARCHER_HIGH,
  82. JOB_ACOLYTE_HIGH,
  83. JOB_MERCHANT_HIGH,
  84. JOB_THIEF_HIGH,
  85. JOB_LORD_KNIGHT,
  86. JOB_HIGH_PRIEST,
  87. JOB_HIGH_WIZARD,
  88. JOB_WHITESMITH,
  89. JOB_SNIPER,
  90. JOB_ASSASSIN_CROSS,
  91. JOB_LORD_KNIGHT2,
  92. JOB_PALADIN,
  93. JOB_CHAMPION,
  94. JOB_PROFESSOR,
  95. JOB_STALKER,
  96. JOB_CREATOR,
  97. JOB_CLOWN,
  98. JOB_GYPSY,
  99. JOB_PALADIN2,
  100. JOB_BABY,
  101. JOB_BABY_SWORDMAN,
  102. JOB_BABY_MAGE,
  103. JOB_BABY_ARCHER,
  104. JOB_BABY_ACOLYTE,
  105. JOB_BABY_MERCHANT,
  106. JOB_BABY_THIEF,
  107. JOB_BABY_KNIGHT,
  108. JOB_BABY_PRIEST,
  109. JOB_BABY_WIZARD,
  110. JOB_BABY_BLACKSMITH,
  111. JOB_BABY_HUNTER,
  112. JOB_BABY_ASSASSIN,
  113. JOB_BABY_KNIGHT2,
  114. JOB_BABY_CRUSADER,
  115. JOB_BABY_MONK,
  116. JOB_BABY_SAGE,
  117. JOB_BABY_ROGUE,
  118. JOB_BABY_ALCHEMIST,
  119. JOB_BABY_BARD,
  120. JOB_BABY_DANCER,
  121. JOB_BABY_CRUSADER2,
  122. JOB_SUPER_BABY,
  123. JOB_TAEKWON,
  124. JOB_STAR_GLADIATOR,
  125. JOB_STAR_GLADIATOR2,
  126. JOB_SOUL_LINKER,
  127. };
  128. //The following system marks a different job ID system used by the map server,
  129. //which makes a lot more sense than the normal one. [Skotlex]
  130. //
  131. //These marks the "level" of the job.
  132. #define JOBL_2_1 0x100 //256
  133. #define JOBL_2_2 0x200 //512
  134. #define JOBL_2 0x300
  135. #define JOBL_UPPER 0x1000 //4096
  136. #define JOBL_BABY 0x2000 //8192
  137. //for filtering and quick checking.
  138. #define MAPID_UPPERMASK 0x0fff
  139. #define MAPID_BASEMASK 0x00ff
  140. //First Jobs
  141. //Note the oddity of the novice:
  142. //Super Novices are considered the 2-1 version of the novice! Novices are considered a first class type, too...
  143. enum {
  144. MAPID_NOVICE = 0x0,
  145. MAPID_SWORDMAN,
  146. MAPID_MAGE,
  147. MAPID_ARCHER,
  148. MAPID_ACOLYTE,
  149. MAPID_MERCHANT,
  150. MAPID_THIEF,
  151. MAPID_TAEKWON,
  152. MAPID_WEDDING,
  153. MAPID_XMAS, // [Valaris]
  154. //2_1 classes
  155. MAPID_SUPER_NOVICE = JOBL_2_1|0x0,
  156. MAPID_KNIGHT,
  157. MAPID_WIZARD,
  158. MAPID_HUNTER,
  159. MAPID_PRIEST,
  160. MAPID_BLACKSMITH,
  161. MAPID_ASSASSIN,
  162. MAPID_STAR_GLADIATOR,
  163. //2_2 classes
  164. MAPID_CRUSADER = JOBL_2_2|0x1,
  165. MAPID_SAGE,
  166. MAPID_BARDDANCER,
  167. MAPID_MONK,
  168. MAPID_ALCHEMIST,
  169. MAPID_ROGUE,
  170. MAPID_SOUL_LINKER,
  171. //1-1, advanced
  172. MAPID_NOVICE_HIGH = JOBL_UPPER|0x0,
  173. MAPID_SWORDMAN_HIGH,
  174. MAPID_MAGE_HIGH,
  175. MAPID_ARCHER_HIGH,
  176. MAPID_ACOLYTE_HIGH,
  177. MAPID_MERCHANT_HIGH,
  178. MAPID_THIEF_HIGH,
  179. //2_1 advanced
  180. MAPID_LORD_KNIGHT = JOBL_UPPER|JOBL_2_1|0x1,
  181. MAPID_HIGH_WIZARD,
  182. MAPID_SNIPER,
  183. MAPID_HIGH_PRIEST,
  184. MAPID_WHITESMITH,
  185. MAPID_ASSASSIN_CROSS,
  186. //2_2 advanced
  187. MAPID_PALADIN = JOBL_UPPER|JOBL_2_2|0x1,
  188. MAPID_PROFESSOR,
  189. MAPID_CLOWNGYPSY,
  190. MAPID_CHAMPION,
  191. MAPID_CREATOR,
  192. MAPID_STALKER,
  193. //1-1 baby
  194. MAPID_BABY = JOBL_BABY|0x0,
  195. MAPID_BABY_SWORDMAN,
  196. MAPID_BABY_MAGE,
  197. MAPID_BABY_ARCHER,
  198. MAPID_BABY_ACOLYTE,
  199. MAPID_BABY_MERCHANT,
  200. MAPID_BABY_THIEF,
  201. MAPID_BABY_TAEKWON,
  202. //2_1 baby
  203. MAPID_SUPER_BABY = JOBL_BABY|JOBL_2_1|0x0,
  204. MAPID_BABY_KNIGHT,
  205. MAPID_BABY_WIZARD,
  206. MAPID_BABY_HUNTER,
  207. MAPID_BABY_PRIEST,
  208. MAPID_BABY_BLACKSMITH,
  209. MAPID_BABY_ASSASSIN,
  210. MAPID_BABY_STAR_GLADIATOR,
  211. //2_2 baby
  212. MAPID_BABY_CRUSADER = JOBL_BABY|JOBL_2_2|0x1,
  213. MAPID_BABY_SAGE,
  214. MAPID_BABY_BARDDANCER,
  215. MAPID_BABY_MONK,
  216. MAPID_BABY_ALCHEMIST,
  217. MAPID_BABY_ROGUE,
  218. MAPID_BABY_SOUL_LINKER,
  219. };
  220. //Don't change this, as the client seems to always send/receive 80 characters as it currently is. [Skotlex]
  221. #define MESSAGE_SIZE 80
  222. #define DEFAULT_AUTOSAVE_INTERVAL 60*1000
  223. #define OPTION_SIGHT 0x0001
  224. #define OPTION_HIDE 0x0002
  225. #define OPTION_CLOAK 0x0004
  226. #define OPTION_FALCON 0x0010
  227. #define OPTION_RIDING 0x0020
  228. #define OPTION_INVISIBLE 0x0040
  229. #define OPTION_ORCISH 0x0800
  230. #define OPTION_WEDDING 0x1000
  231. #define OPTION_RUWACH 0x2000
  232. #define OPTION_CHASEWALK 0x4000
  233. #define OPTION_FLYING 0x8000
  234. //TODO: Get these Missing options...
  235. #define OPTION_SIGHTTRASHER 0x0001
  236. //Specifies maps where players may hit each other
  237. #define map_flag_vs(m) (map[m].flag.pvp || map[m].flag.gvg_dungeon || map[m].flag.gvg || (agit_flag && map[m].flag.gvg_castle))
  238. //Specifies maps that have special GvG/WoE restrictions
  239. #define map_flag_gvg(m) (map[m].flag.gvg || (agit_flag && map[m].flag.gvg_castle))
  240. //This stackable implementation does not means a BL can be more than one type at a time, but it's
  241. //meant to make it easier to check for multiple types at a time on invocations such as
  242. // map_foreach* calls [Skotlex]
  243. enum {
  244. BL_NUL = 0x000,
  245. BL_PC = 0x001,
  246. BL_MOB = 0x002,
  247. BL_PET = 0x004,
  248. BL_ITEM = 0x008,
  249. BL_SKILL = 0x010,
  250. BL_NPC = 0x020,
  251. BL_CHAT = 0x040
  252. };
  253. //For common mapforeach calls. Since pets cannot be affected, they aren't included here yet.
  254. #define BL_CHAR (BL_PC|BL_MOB)
  255. #define BL_ALL 0xfff
  256. enum { WARP, SHOP, SCRIPT, MONS };
  257. struct block_list {
  258. struct block_list *next,*prev;
  259. int id;
  260. short m,x,y;
  261. unsigned char type;
  262. unsigned char subtype;
  263. };
  264. struct walkpath_data {
  265. unsigned char path_len,path_pos,path_half;
  266. unsigned char path[MAX_WALKPATH];
  267. };
  268. struct shootpath_data {
  269. int rx,ry,len;
  270. int x[MAX_WALKPATH];
  271. int y[MAX_WALKPATH];
  272. };
  273. struct script_reg {
  274. int index;
  275. int data;
  276. };
  277. struct script_regstr {
  278. int index;
  279. char data[256];
  280. };
  281. struct status_change_entry {
  282. int timer;
  283. int val1,val2,val3,val4;
  284. };
  285. struct status_change {
  286. struct status_change_entry data[MAX_STATUSCHANGE];
  287. short count;
  288. short opt1,opt2,opt3;
  289. short option;
  290. };
  291. struct vending {
  292. short index;
  293. unsigned short amount;
  294. unsigned int value;
  295. };
  296. struct weapon_data {
  297. int atkmods[3];
  298. // all the variables except atkmods get zero'ed in each call of status_calc_pc
  299. // NOTE: if you want to add a non-zeroed variable, you need to update the memset call
  300. // in status_calc_pc as well! All the following are automatically zero'ed. [Skotlex]
  301. int watk;
  302. int watk2;
  303. int atk_ele;
  304. int overrefine;
  305. int star;
  306. int ignore_def_ele;
  307. int ignore_def_race;
  308. int def_ratio_atk_ele;
  309. int def_ratio_atk_race;
  310. int addele[10];
  311. int addrace[12];
  312. int addrace2[12];
  313. int addsize[3];
  314. short ignore_def_mob;
  315. short hp_drain_rate;
  316. short hp_drain_per;
  317. short hp_drain_value;
  318. short sp_drain_rate;
  319. short sp_drain_per;
  320. short sp_drain_value;
  321. short add_damage_classid[MAX_PC_BONUS];
  322. int add_damage_classrate[MAX_PC_BONUS];
  323. int add_damage_class_count;
  324. };
  325. struct skill_unit_group;
  326. struct skill_unit {
  327. struct block_list bl;
  328. struct skill_unit_group *group;
  329. int limit;
  330. int val1,val2;
  331. short alive,range;
  332. };
  333. struct skill_unit_group {
  334. int src_id;
  335. int party_id;
  336. int guild_id;
  337. int map;
  338. int target_flag; //Holds BCT_* flag for battle_check_target
  339. int bl_flag; //Holds BL_* flag for map_foreachin* functions
  340. unsigned int tick;
  341. int limit,interval;
  342. int skill_id,skill_lv;
  343. int val1,val2,val3;
  344. char *valstr;
  345. int unit_id;
  346. int group_id;
  347. int unit_count,alive_count;
  348. struct skill_unit *unit;
  349. };
  350. struct skill_unit_group_tickset {
  351. unsigned int tick;
  352. int id;
  353. };
  354. struct skill_timerskill {
  355. int timer;
  356. int src_id;
  357. int target_id;
  358. int map;
  359. short x,y;
  360. short skill_id,skill_lv;
  361. int type;
  362. int flag;
  363. };
  364. struct npc_data;
  365. struct pet_db;
  366. struct item_data;
  367. struct square;
  368. struct map_session_data {
  369. struct block_list bl;
  370. //NOTE: When deciding to add a flag to state or special_state, take into consideration that state is preserved in
  371. //status_calc_pc, while special_state is recalculated in each call. [Skotlex]
  372. struct {
  373. unsigned auth : 1;
  374. unsigned change_walk_target : 1;
  375. unsigned attack_continue : 1;
  376. unsigned menu_or_input : 1;
  377. unsigned dead_sit : 2;
  378. unsigned skillcastcancel : 1;
  379. unsigned waitingdisconnect : 1;
  380. unsigned lr_flag : 2;
  381. unsigned connect_new : 1;
  382. unsigned arrow_atk : 1;
  383. unsigned attack_type : 3;
  384. unsigned skill_flag : 1;
  385. unsigned gangsterparadise : 1;
  386. unsigned rest : 1;
  387. unsigned storage_flag : 2; //0: closed, 1: Normal Storage open, 2: guild storage open [Skotlex]
  388. unsigned snovice_flag : 4;
  389. // originally by Qamera, adapted by celest
  390. unsigned event_death : 1;
  391. unsigned event_kill : 1;
  392. unsigned event_disconnect : 1;
  393. // Abracadabra bugfix by Aru
  394. unsigned abra_flag : 1;
  395. unsigned autotrade : 1; //By Fantik
  396. unsigned perfect_hiding : 1; // [Valaris]
  397. unsigned reg_dirty : 3; //By Skotlex (marks whether registry variables have been saved or not yet)
  398. unsigned showdelay :1;
  399. unsigned showexp :1;
  400. unsigned showzeny :1;
  401. unsigned mainchat :1; //[LuzZza]
  402. unsigned disguised :1; //[Valaris]
  403. unsigned deal_locked :2;
  404. unsigned party_sent :1;
  405. unsigned guild_sent :1;
  406. unsigned monster_ignore :1; // for monsters to ignore a character [Valaris] [zzo]
  407. unsigned size :2; // for tiny/large types
  408. unsigned night :1; //Holds whether or not the player currently has the SI_NIGHT effect on. [Skotlex]
  409. unsigned finalsave :1; //Signals whether the final save for the char was done or not yet. Meant to prevent exploits and the like. [Skotlex]
  410. unsigned short autoloot;
  411. struct guild *gmaster_flag;
  412. } state;
  413. struct {
  414. unsigned killer : 1;
  415. unsigned killable : 1;
  416. unsigned restart_full_recover : 1;
  417. unsigned no_castcancel : 1;
  418. unsigned no_castcancel2 : 1;
  419. unsigned no_sizefix : 1;
  420. unsigned no_magic_damage : 1;
  421. unsigned no_weapon_damage : 1;
  422. unsigned no_gemstone : 1;
  423. unsigned infinite_endure : 1;
  424. unsigned intravision : 1; // Maya Purple Card effect allowing to see Hiding/Cloaking people [DracoRPG]
  425. } special_state;
  426. int char_id, login_id1, login_id2, sex;
  427. unsigned short class_; //This is the internal job ID used by the map server to simplify comparisons/queries/etc. [Skotlex]
  428. int packet_ver; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 ... 18
  429. struct mmo_charstatus status;
  430. struct registry save_reg;
  431. struct item_data *inventory_data[MAX_INVENTORY];
  432. short equip_index[11];
  433. unsigned int weight,max_weight;
  434. int cart_weight,cart_max_weight,cart_num,cart_max_num;
  435. int fd;
  436. unsigned short mapindex;
  437. short to_x,to_y;
  438. short speed,prev_speed;
  439. unsigned char dir,head_dir;
  440. unsigned int client_tick,server_tick;
  441. struct walkpath_data walkpath;
  442. int walktimer;
  443. int npc_id,areanpc_id,npc_shopid;
  444. int npc_item_flag; //Marks the npc_id with which you can use items during interactions with said npc (see script command enable_itemuse)
  445. int npc_pos;
  446. int npc_menu;
  447. int npc_amount;
  448. struct script_stack *stack;
  449. unsigned char *npc_script,*npc_scriptroot;
  450. int npc_scriptstate;
  451. char npc_str[256];
  452. int npc_timer_id; //For player attached npc timers. [Skotlex]
  453. unsigned int chatID;
  454. time_t idletime;
  455. struct{
  456. char name[NAME_LENGTH];
  457. } ignore[MAX_IGNORE_LIST];
  458. int ignoreAll;
  459. int attacktimer;
  460. int attacktarget;
  461. short attacktarget_lv;
  462. unsigned int attackabletime;
  463. int followtimer; // [MouseJstr]
  464. int followtarget;
  465. time_t emotionlasttime; // to limit flood with emotion packets
  466. int skilltimer;
  467. int skilltarget;
  468. short skillx,skilly;
  469. short skillid,skilllv;
  470. short skillitem,skillitemlv;
  471. short skillid_old,skilllv_old;
  472. short skillid_dance,skilllv_dance;
  473. struct skill_unit_group skillunit[MAX_SKILLUNITGROUP];
  474. struct skill_unit_group_tickset skillunittick[MAX_SKILLUNITGROUPTICKSET];
  475. struct skill_timerskill skilltimerskill[MAX_SKILLTIMERSKILL];
  476. char blockskill[MAX_SKILL]; // [celest]
  477. //unsigned int skillstatictimer[MAX_SKILL];
  478. unsigned short timerskill_count; // [celest]
  479. int cloneskill_id;
  480. int menuskill_id, menuskill_lv;
  481. int invincible_timer;
  482. unsigned int canact_tick;
  483. unsigned int canmove_tick;
  484. unsigned int canlog_tick;
  485. unsigned int canregen_tick;
  486. unsigned int canuseitem_tick; // [Skotlex]
  487. int hp_sub,sp_sub;
  488. int inchealhptick,inchealsptick,inchealspirithptick,inchealspiritsptick;
  489. short view_class;
  490. short weapontype1,weapontype2;
  491. short disguise; // [Valaris]
  492. struct weapon_data right_weapon;
  493. struct weapon_data left_weapon;
  494. int paramc[6],paramcard[6];
  495. // here start arrays to be globally zeroed at the beginning of status_calc_pc()
  496. int paramb[6];
  497. int parame[6];
  498. int subele[10];
  499. int subrace[12];
  500. int subrace2[12];
  501. int subsize[3];
  502. int addeff[SC_COMMON_MAX-SC_COMMON_MIN+1];
  503. int addeff2[SC_COMMON_MAX-SC_COMMON_MIN+1];
  504. int reseff[SC_COMMON_MAX-SC_COMMON_MIN+1];
  505. int weapon_coma_ele[10];
  506. int weapon_coma_race[12];
  507. int weapon_atk[16];
  508. int weapon_atk_rate[16];
  509. int arrow_addele[10];
  510. int arrow_addrace[12];
  511. int arrow_addsize[3];
  512. int arrow_addeff[SC_COMMON_MAX-SC_COMMON_MIN+1];
  513. int arrow_addeff2[SC_COMMON_MAX-SC_COMMON_MIN+1];
  514. int magic_addele[10];
  515. int magic_addrace[12];
  516. int magic_addsize[3];
  517. int critaddrace[12];
  518. int expaddrace[12];
  519. int itemhealrate[7];
  520. int addeff3[SC_COMMON_MAX-SC_COMMON_MIN+1];
  521. short addeff3_type[SC_COMMON_MAX-SC_COMMON_MIN+1];
  522. short sp_gain_race[12];
  523. short unequip_losehp[11];
  524. short unequip_losesp[11];
  525. // zeroed arrays end here.
  526. // zeroed structures start here
  527. struct {
  528. short id, lv, rate;
  529. } autospell[MAX_PC_BONUS], autospell2[MAX_PC_BONUS];
  530. struct { //skillatk raises bonus dmg% of skills, skillblown increases bonus blewcount for some skills.
  531. short id, val;
  532. } skillatk[MAX_PC_BONUS], skillblown[MAX_PC_BONUS];
  533. struct {
  534. short class_, rate;
  535. } add_def[MAX_PC_BONUS], add_mdef[MAX_PC_BONUS],
  536. add_dmg[MAX_PC_BONUS], add_mdmg[MAX_PC_BONUS];
  537. struct {
  538. short id, group;
  539. int race, rate;
  540. } add_drop[MAX_PC_BONUS];
  541. // zeroed structures end here
  542. // zeroed vars start here.
  543. int hit;
  544. int flee, flee2;
  545. int critical;
  546. int aspd;
  547. int def, def2;
  548. int mdef, mdef2;
  549. int def_ele;
  550. int matk1, matk2;
  551. int base_atk;
  552. int arrow_atk,arrow_ele,arrow_cri,arrow_hit,arrow_range;
  553. int nhealhp,nhealsp,nshealhp,nshealsp,nsshealhp,nsshealsp;
  554. int critical_def,double_rate;
  555. int long_attack_atk_rate; //Long range atk rate, not weapon based. [Skotlex]
  556. int near_attack_def_rate,long_attack_def_rate,magic_def_rate,misc_def_rate;
  557. int ignore_mdef_ele;
  558. int ignore_mdef_race;
  559. int perfect_hit;
  560. int perfect_hit_add;
  561. int get_zeny_rate;
  562. int get_zeny_num; //Added Get Zeny Rate [Skotlex]
  563. int double_add_rate;
  564. int short_weapon_damage_return,long_weapon_damage_return;
  565. int magic_damage_return; // AppleGirl Was Here
  566. int random_attack_increase_add,random_attack_increase_per; // [Valaris]
  567. int break_weapon_rate,break_armor_rate;
  568. int crit_atk_rate;
  569. int hp_loss_rate;
  570. int sp_loss_rate;
  571. int classchange; // [Valaris]
  572. unsigned int setitem_hash, setitem_hash2; //Split in 2 because shift operations only work on int ranges. [Skotlex]
  573. short attackrange,attackrange_;
  574. short splash_range, splash_add_range;
  575. short add_steal_rate;
  576. short hp_loss_value;
  577. short sp_loss_value;
  578. short hp_loss_type;
  579. short sp_drain_type;
  580. short sp_gain_value, hp_gain_value;
  581. short sp_vanish_rate;
  582. short sp_vanish_per;
  583. short add_drop_count;
  584. unsigned short unbreakable; // chance to prevent ANY equipment breaking [celest]
  585. unsigned short unbreakable_equip; //100% break resistance on certain equipment
  586. unsigned short unstripable_equip;
  587. short no_regen;
  588. short add_def_count,add_mdef_count;
  589. short add_dmg_count,add_mdmg_count;
  590. // zeroed vars end here.
  591. int amotion,dmotion;
  592. int castrate,delayrate,hprate,sprate,dsprate;
  593. int atk_rate;
  594. int aspd_rate,speed_rate,hprecov_rate,sprecov_rate;
  595. int matk_rate;
  596. int critical_rate,hit_rate,flee_rate,flee2_rate,def_rate,def2_rate,mdef_rate,mdef2_rate;
  597. int speed_add_rate, aspd_add_rate;
  598. int hp_loss_tick;
  599. int sp_loss_tick;
  600. int itemid;
  601. short itemindex; //Used item's index in sd->inventory [Skotlex]
  602. short catch_target_class; // pet catching, stores a pet class to catch (short now) [zzo]
  603. short spiritball, spiritball_old;
  604. int spirit_timer[MAX_SKILL_LEVEL];
  605. int die_counter;
  606. short doridori_counter;
  607. char potion_success_counter;
  608. int reg_num;
  609. struct script_reg *reg;
  610. int regstr_num;
  611. struct script_regstr *regstr;
  612. struct status_change sc;
  613. short mission_mobid; //Stores the target mob_id for TK_MISSION
  614. short mission_count; //Stores the bounty kill count for TK_MISSION
  615. int devotion[5]; //Stores the char IDs of chars devoted to.
  616. int trade_partner;
  617. struct {
  618. struct {
  619. int index, amount;
  620. } item[10];
  621. int zeny, weight;
  622. } deal;
  623. int party_invite,party_invite_account;
  624. short party_x,party_y; // should be short [zzo]
  625. int guild_invite,guild_invite_account;
  626. int guild_emblem_id,guild_alliance,guild_alliance_account;
  627. short guild_x,guild_y; // For guildmate position display. [Skotlex] should be short [zzo]
  628. int guildspy; // [Syrus22]
  629. int partyspy; // [Syrus22]
  630. int vender_id;
  631. int vend_num;
  632. char message[MESSAGE_SIZE];
  633. struct vending vending[MAX_VENDING];
  634. struct s_pet pet;
  635. struct pet_db *petDB;
  636. struct pet_data *pd;
  637. int pet_hungry_timer;
  638. struct{
  639. int m; //-1 - none, other: map index corresponding to map name.
  640. unsigned short index; //map index
  641. }feel_map[3];// 0 - Sun; 1 - Moon; 2 - Stars
  642. short hate_mob[3];
  643. unsigned int pvp_timer;
  644. short pvp_point;
  645. unsigned short pvp_rank, pvp_lastusers;
  646. unsigned short pvp_won, pvp_lost;
  647. char eventqueue[MAX_EVENTQUEUE][50];
  648. int eventtimer[MAX_EVENTTIMER];
  649. unsigned short eventcount; // [celest]
  650. unsigned char change_level; // [celest]
  651. char fakename[NAME_LENGTH]; // fake names [Valaris]
  652. #ifndef TXT_ONLY
  653. int mail_counter; // mail counter for mail system [Valaris]
  654. #endif
  655. int duel_group; // duel vars [LuzZza]
  656. int duel_invite;
  657. char away_message[128]; // [LuzZza]
  658. };
  659. struct {
  660. int members_count;
  661. int invites_count;
  662. int max_players_limit;
  663. } duel_list[MAX_DUEL];
  664. int duel_count;
  665. struct npc_timerevent_list {
  666. int timer,pos;
  667. };
  668. struct npc_label_list {
  669. char name[NAME_LENGTH];
  670. int pos;
  671. };
  672. struct npc_item_list {
  673. unsigned int nameid,value;
  674. };
  675. struct npc_data {
  676. struct block_list bl;
  677. short n;
  678. short class_,dir;
  679. short speed;
  680. unsigned char name[NAME_LENGTH];
  681. unsigned char exname[NAME_LENGTH];
  682. int chat_id;
  683. short flag;
  684. int walktimer; // [Valaris]
  685. short to_x,to_y; // [Valaris]
  686. struct walkpath_data walkpath;
  687. unsigned int next_walktime;
  688. unsigned int canmove_tick;
  689. struct status_change sc; //They can't have status changes, but.. they want the visual opt values.
  690. struct { // [Valaris]
  691. unsigned state : 8;
  692. unsigned change_walk_target : 1;
  693. unsigned walk_easy : 1;
  694. } state;
  695. char eventqueue[MAX_EVENTQUEUE][50];
  696. int eventtimer[MAX_EVENTTIMER];
  697. short arenaflag;
  698. void *chatdb;
  699. union {
  700. struct {
  701. unsigned char *script;
  702. short xs,ys;
  703. int guild_id;
  704. int timer,timerid,timeramount,rid;
  705. unsigned int timertick;
  706. struct npc_timerevent_list *timer_event;
  707. int label_list_num;
  708. struct npc_label_list *label_list;
  709. int src_id;
  710. } scr;
  711. struct npc_item_list shop_item[1];
  712. struct {
  713. short xs,ys;
  714. short x,y;
  715. unsigned short mapindex;
  716. } warp;
  717. } u;
  718. //Do NOT place anything afterwards... shop data NPC will override any variables from here and on! [Skotlex]
  719. };
  720. //For quick linking to a guardian's info. [Skotlex]
  721. struct guardian_data {
  722. int number; //0-MAX_GUARDIANS-1 = Guardians. MAX_GUARDIANS = Emperium.
  723. int guild_id;
  724. int emblem_id;
  725. int guardup_lv; //Level of GD_GUARDUP skill.
  726. char guild_name[NAME_LENGTH];
  727. struct guild_castle* castle;
  728. };
  729. struct mob_data {
  730. struct block_list bl;
  731. struct mob_db *db; //For quick data access (saves doing mob_db(md->class_) all the time) [Skotlex]
  732. char name[NAME_LENGTH];
  733. struct {
  734. unsigned size : 2; //Small/Big monsters.
  735. unsigned cached : 1; //Cached mobs for dynamic mob unloading [Skotlex]
  736. unsigned ai : 3; //Special ai for summoned monsters.
  737. } special_state; //Special mob information that does not needs to be zero'ed on mob respawn.
  738. struct {
  739. unsigned state : 8;
  740. unsigned skillstate : 8;
  741. unsigned aggressive : 1; //Signals whether the mob AI is in aggressive mode or reactive mode. [Skotlex]
  742. unsigned targettype : 1;
  743. unsigned steal_flag : 1;
  744. unsigned steal_coin_flag : 1;
  745. unsigned skillcastcancel : 1;
  746. unsigned change_walk_target : 1;
  747. unsigned walk_easy : 1;
  748. unsigned soul_change_flag : 1; // Celest
  749. unsigned alchemist: 1;
  750. int provoke_flag; // Celest
  751. } state;
  752. struct status_change sc;
  753. struct walkpath_data walkpath;
  754. struct guardian_data* guardian_data;
  755. struct item *lootitem;
  756. struct {
  757. int id;
  758. int dmg;
  759. } dmglog[DAMAGELOG_SIZE];
  760. short n;
  761. short base_class,class_,dir,mode;
  762. short m,x0,y0,xs,ys;
  763. short to_x,to_y;
  764. short target_dir;
  765. short speed;
  766. short attacked_count;
  767. short target_lv;
  768. unsigned short level;
  769. unsigned long tdmg; //Stores total damage given to the mob, for exp calculations. [Skotlex]
  770. int timer;
  771. int hp, max_hp;
  772. int target_id,attacked_id;
  773. int spawndelay1,spawndelay2;
  774. unsigned int attackabletime, canmove_tick, next_walktime;
  775. unsigned int last_deadtime,last_spawntime,last_thinktime,last_linktime;
  776. short move_fail_count;
  777. short lootitem_count;
  778. short min_chase;
  779. int deletetimer;
  780. int skilltimer;
  781. int skilltarget;
  782. int def_ele;
  783. int master_id,master_dist;
  784. short skillx,skilly,skillid,skilllv,skillidx;
  785. unsigned int skilldelay[MAX_MOBSKILL];
  786. struct skill_timerskill skilltimerskill[MAX_MOBSKILLTIMERSKILL];
  787. struct skill_unit_group skillunit[MAX_MOBSKILLUNITGROUP];
  788. struct skill_unit_group_tickset skillunittick[MAX_SKILLUNITGROUPTICKSET];
  789. char npc_event[50];
  790. };
  791. struct pet_data {
  792. struct block_list bl;
  793. short n;
  794. short class_,dir;
  795. struct mob_db *db;
  796. short speed;
  797. char name[NAME_LENGTH];
  798. struct {
  799. unsigned state : 8 ;
  800. unsigned skillstate : 8 ;
  801. unsigned change_walk_target : 1 ;
  802. unsigned casting_flag :1 ;//Skotlex: Used to identify when we are casting.
  803. short skillbonus;
  804. } state;
  805. int timer;
  806. short to_x,to_y;
  807. short equip;
  808. struct walkpath_data walkpath;
  809. int target_id;
  810. short target_lv;
  811. int move_fail_count;
  812. unsigned int attackabletime,next_walktime,last_thinktime;
  813. short rate_fix; //Support rate as modified by intimacy (1000 = 100%) [Skotlex]
  814. struct pet_status { //Pet Status data
  815. short level;
  816. short atk1,atk2;
  817. short str,agi,vit,int_,dex,luk;
  818. } *status; //[Skotlex]
  819. struct pet_recovery { //Stat recovery
  820. unsigned short type; //Status Change id
  821. unsigned short delay; //How long before curing (secs).
  822. int timer;
  823. } *recovery; //[Valaris] / Reimplemented by [Skotlex]
  824. struct pet_bonus {
  825. unsigned short type; //bStr, bVit?
  826. unsigned short val; //Qty
  827. unsigned short duration; //in secs
  828. unsigned short delay; //Time before recasting (secs)
  829. int timer;
  830. } *bonus; //[Valaris] / Reimplemented by [Skotlex]
  831. struct pet_skill_attack { //Attack Skill
  832. unsigned short id;
  833. unsigned short lv;
  834. unsigned short div_; //0 = Normal skill. >0 = Fixed damage (lv), fixed div_.
  835. unsigned short rate; //Base chance of skill ocurrance (10 = 10% of attacks)
  836. unsigned short bonusrate; //How being 100% loyal affects cast rate (10 = At 1000 intimacy->rate+10%
  837. } *a_skill; //[Skotlex]
  838. struct pet_skill_support { //Support Skill
  839. unsigned short id;
  840. unsigned short lv;
  841. unsigned short hp; //Max HP% for skill to trigger (50 -> 50% for Magnificat)
  842. unsigned short sp; //Max SP% for skill to trigger (100 = no check)
  843. unsigned short delay; //Time (secs) between being able to recast.
  844. int timer;
  845. } *s_skill; //[Skotlex]
  846. struct pet_loot {
  847. struct item *item;
  848. unsigned short count;
  849. unsigned short weight;
  850. unsigned short max;
  851. int timer;
  852. } *loot; //[Valaris] / Rewritten by [Skotlex]
  853. struct skill_timerskill skilltimerskill[MAX_MOBSKILLTIMERSKILL]; // [Valaris]
  854. struct skill_unit_group skillunit[MAX_MOBSKILLUNITGROUP]; // [Valaris]
  855. struct skill_unit_group_tickset skillunittick[MAX_SKILLUNITGROUPTICKSET]; // [Valaris]
  856. struct map_session_data *msd;
  857. };
  858. enum { MS_IDLE,MS_WALK,MS_ATTACK,MS_DEAD,MS_DELAY };
  859. enum { NONE_ATTACKABLE,ATTACKABLE };
  860. enum { ATK_LUCKY=1,ATK_FLEE,ATK_DEF}; // 囲まれペナルティ計算用
  861. // For equipment breaking/stripping effects
  862. enum {
  863. EQP_WEAPON = 1, // Both weapons
  864. EQP_ARMOR = 2, // Armor
  865. EQP_SHIELD = 4, // Shield
  866. EQP_HELM = 8, // Top-head headgear
  867. };
  868. // Mob List Held in memory for Dynamic Mobs [Wizputer]
  869. struct mob_list {
  870. int m,x,y,xs,ys,class_,num,delay1,delay2,level;
  871. char mobname[NAME_LENGTH],eventname[NAME_LENGTH];
  872. };
  873. struct map_data {
  874. char name[MAP_NAME_LENGTH];
  875. unsigned short index; //Index is the map index used by the mapindex* functions.
  876. unsigned char *gat; // NULLなら下のmap_data_other_serverとして扱う
  877. unsigned char *cell; //Contains temporary cell data that is set/unset on tiles.
  878. #ifdef CELL_NOSTACK
  879. unsigned char *cell_bl; //Holds amount of bls in any given cell.
  880. #endif
  881. char *alias; // [MouseJstr]
  882. struct block_list **block;
  883. struct block_list **block_mob;
  884. int *block_count,*block_mob_count;
  885. int m;
  886. short xs,ys;
  887. short bxs,bys;
  888. int npc_num;
  889. int users;
  890. struct {
  891. unsigned alias : 1;
  892. unsigned nomemo : 1;
  893. unsigned noteleport : 1;
  894. unsigned noreturn : 1;
  895. unsigned monster_noteleport : 1;
  896. unsigned nosave : 1;
  897. unsigned nobranch : 1;
  898. unsigned nopenalty : 1;
  899. unsigned pvp : 1;
  900. unsigned pvp_noparty : 1;
  901. unsigned pvp_noguild : 1;
  902. unsigned pvp_nightmaredrop :1;
  903. unsigned pvp_nocalcrank : 1;
  904. unsigned gvg_castle : 1;
  905. unsigned gvg : 1; // Now it identifies gvg versus maps that are active 24/7
  906. unsigned gvg_dungeon : 1; // Celest
  907. unsigned gvg_noparty : 1;
  908. unsigned nozenypenalty : 1;
  909. unsigned notrade : 1;
  910. unsigned noskill : 1;
  911. unsigned nowarp : 1;
  912. unsigned nowarpto : 1;
  913. unsigned nopvp : 1; // [Valaris]
  914. unsigned noicewall : 1; // [Valaris]
  915. unsigned snow : 1; // [Valaris]
  916. unsigned clouds : 1;
  917. unsigned clouds2 : 1; // [Valaris]
  918. unsigned fog : 1; // [Valaris]
  919. unsigned fireworks : 1;
  920. unsigned sakura : 1; // [Valaris]
  921. unsigned leaves : 1; // [Valaris]
  922. unsigned rain : 1; // [Valaris]
  923. unsigned indoors : 1; // celest
  924. unsigned nogo : 1; // [Valaris]
  925. unsigned nobaseexp : 1; // [Lorky] added by Lupus
  926. unsigned nojobexp : 1; // [Lorky]
  927. unsigned nomobloot : 1; // [Lorky]
  928. unsigned nomvploot : 1; // [Lorky]
  929. unsigned nightenabled :1; //For night display. [Skotlex]
  930. unsigned restricted : 1; // [Komurka]
  931. } flag;
  932. struct point save;
  933. struct npc_data *npc[MAX_NPC_PER_MAP];
  934. struct {
  935. int drop_id;
  936. int drop_type;
  937. int drop_per;
  938. } drop_list[MAX_DROP_PER_MAP];
  939. struct mob_list *moblist[MAX_MOB_LIST_PER_MAP]; // [Wizputer]
  940. int mob_delete_timer; // [Skotlex]
  941. int zone; // [Komurka]
  942. };
  943. struct map_data_other_server {
  944. char name[MAP_NAME_LENGTH];
  945. unsigned short index; //Index is the map index used by the mapindex* functions.
  946. unsigned char *gat; // NULL固定にして判断
  947. unsigned long ip;
  948. unsigned int port;
  949. };
  950. struct flooritem_data {
  951. struct block_list bl;
  952. unsigned char subx,suby;
  953. int cleartimer;
  954. int first_get_id,second_get_id,third_get_id;
  955. unsigned int first_get_tick,second_get_tick,third_get_tick;
  956. struct item item_data;
  957. };
  958. enum {
  959. SP_SPEED,SP_BASEEXP,SP_JOBEXP,SP_KARMA,SP_MANNER,SP_HP,SP_MAXHP,SP_SP, // 0-7
  960. SP_MAXSP,SP_STATUSPOINT,SP_0a,SP_BASELEVEL,SP_SKILLPOINT,SP_STR,SP_AGI,SP_VIT, // 8-15
  961. SP_INT,SP_DEX,SP_LUK,SP_CLASS,SP_ZENY,SP_SEX,SP_NEXTBASEEXP,SP_NEXTJOBEXP, // 16-23
  962. SP_WEIGHT,SP_MAXWEIGHT,SP_1a,SP_1b,SP_1c,SP_1d,SP_1e,SP_1f, // 24-31
  963. SP_USTR,SP_UAGI,SP_UVIT,SP_UINT,SP_UDEX,SP_ULUK,SP_26,SP_27, // 32-39
  964. SP_28,SP_ATK1,SP_ATK2,SP_MATK1,SP_MATK2,SP_DEF1,SP_DEF2,SP_MDEF1, // 40-47
  965. SP_MDEF2,SP_HIT,SP_FLEE1,SP_FLEE2,SP_CRITICAL,SP_ASPD,SP_36,SP_JOBLEVEL, // 48-55
  966. SP_UPPER,SP_PARTNER,SP_CART,SP_FAME,SP_UNBREAKABLE, //56-60
  967. SP_CARTINFO=99, // 99
  968. SP_BASEJOB=119, // 100+19 - celest
  969. SP_BASECLASS=120, //Hmm.. why 100+19? I just use the next one... [Skotlex]
  970. // original 1000-
  971. SP_ATTACKRANGE=1000, SP_ATKELE,SP_DEFELE, // 1000-1002
  972. SP_CASTRATE, SP_MAXHPRATE, SP_MAXSPRATE, SP_SPRATE, // 1003-1006
  973. SP_ADDELE, SP_ADDRACE, SP_ADDSIZE, SP_SUBELE, SP_SUBRACE, // 1007-1011
  974. SP_ADDEFF, SP_RESEFF, // 1012-1013
  975. SP_BASE_ATK,SP_ASPD_RATE,SP_HP_RECOV_RATE,SP_SP_RECOV_RATE,SP_SPEED_RATE, // 1014-1018
  976. SP_CRITICAL_DEF,SP_NEAR_ATK_DEF,SP_LONG_ATK_DEF, // 1019-1021
  977. SP_DOUBLE_RATE, SP_DOUBLE_ADD_RATE, SP_MATK, SP_MATK_RATE, // 1022-1025
  978. SP_IGNORE_DEF_ELE,SP_IGNORE_DEF_RACE, // 1026-1027
  979. SP_ATK_RATE,SP_SPEED_ADDRATE,SP_ASPD_ADDRATE, // 1028-1030
  980. SP_MAGIC_ATK_DEF,SP_MISC_ATK_DEF, // 1031-1032
  981. SP_IGNORE_MDEF_ELE,SP_IGNORE_MDEF_RACE, // 1033-1034
  982. SP_MAGIC_ADDELE,SP_MAGIC_ADDRACE,SP_MAGIC_ADDSIZE, // 1035-1037
  983. SP_PERFECT_HIT_RATE,SP_PERFECT_HIT_ADD_RATE,SP_CRITICAL_RATE,SP_GET_ZENY_NUM,SP_ADD_GET_ZENY_NUM, // 1038-1042
  984. SP_ADD_DAMAGE_CLASS,SP_ADD_MAGIC_DAMAGE_CLASS,SP_ADD_DEF_CLASS,SP_ADD_MDEF_CLASS, // 1043-1046
  985. SP_ADD_MONSTER_DROP_ITEM,SP_DEF_RATIO_ATK_ELE,SP_DEF_RATIO_ATK_RACE,SP_ADD_SPEED, // 1047-1050
  986. SP_HIT_RATE,SP_FLEE_RATE,SP_FLEE2_RATE,SP_DEF_RATE,SP_DEF2_RATE,SP_MDEF_RATE,SP_MDEF2_RATE, // 1051-1057
  987. SP_SPLASH_RANGE,SP_SPLASH_ADD_RANGE,SP_AUTOSPELL,SP_HP_DRAIN_RATE,SP_SP_DRAIN_RATE, // 1058-1062
  988. SP_SHORT_WEAPON_DAMAGE_RETURN,SP_LONG_WEAPON_DAMAGE_RETURN,SP_WEAPON_COMA_ELE,SP_WEAPON_COMA_RACE, // 1063-1066
  989. SP_ADDEFF2,SP_BREAK_WEAPON_RATE,SP_BREAK_ARMOR_RATE,SP_ADD_STEAL_RATE, // 1067-1070
  990. SP_MAGIC_DAMAGE_RETURN,SP_RANDOM_ATTACK_INCREASE,SP_ALL_STATS,SP_AGI_VIT,SP_AGI_DEX_STR,SP_PERFECT_HIDE, // 1071-1076
  991. SP_DISGUISE,SP_CLASSCHANGE, // 1077-1078
  992. SP_HP_DRAIN_VALUE,SP_SP_DRAIN_VALUE, // 1079-1080
  993. SP_WEAPON_ATK,SP_WEAPON_ATK_RATE, // 1081-1082
  994. SP_DELAYRATE, // 1083
  995. SP_RESTART_FULL_RECOVER=2000,SP_NO_CASTCANCEL,SP_NO_SIZEFIX,SP_NO_MAGIC_DAMAGE,SP_NO_WEAPON_DAMAGE,SP_NO_GEMSTONE, // 2000-2005
  996. SP_NO_CASTCANCEL2,SP_INFINITE_ENDURE,SP_UNBREAKABLE_WEAPON,SP_UNBREAKABLE_ARMOR, SP_UNBREAKABLE_HELM, // 2006-2010
  997. SP_UNBREAKABLE_SHIELD, SP_LONG_ATK_RATE, // 2011-2012
  998. SP_CRIT_ATK_RATE, SP_CRITICAL_ADDRACE, SP_NO_REGEN, SP_ADDEFF_WHENHIT, SP_AUTOSPELL_WHENHIT, // 2013-2017
  999. SP_SKILL_ATK, SP_UNSTRIPABLE, SP_ADD_DAMAGE_BY_CLASS, // 2018-2020
  1000. SP_SP_GAIN_VALUE, SP_IGNORE_DEF_MOB, SP_HP_LOSS_RATE, SP_ADDRACE2, SP_HP_GAIN_VALUE, // 2021-2025
  1001. SP_SUBSIZE, SP_DAMAGE_WHEN_UNEQUIP, SP_ADD_ITEM_HEAL_RATE, SP_LOSESP_WHEN_UNEQUIP, SP_EXP_ADDRACE, // 2026-2030
  1002. SP_SP_GAIN_RACE, SP_SUBRACE2, SP_ADDEFF_WHENHIT_SHORT, // 2031-2033
  1003. SP_UNSTRIPABLE_WEAPON,SP_UNSTRIPABLE_ARMOR,SP_UNSTRIPABLE_HELM,SP_UNSTRIPABLE_SHIELD, // 2034-2037
  1004. SP_INTRAVISION, SP_ADD_MONSTER_DROP_ITEMGROUP, SP_SP_LOSS_RATE, // 2038-2040
  1005. SP_ADD_SKILL_BLOW, SP_SP_VANISH_RATE //2041
  1006. };
  1007. enum {
  1008. LOOK_BASE,LOOK_HAIR,LOOK_WEAPON,LOOK_HEAD_BOTTOM,LOOK_HEAD_TOP,LOOK_HEAD_MID,LOOK_HAIR_COLOR,LOOK_CLOTHES_COLOR,LOOK_SHIELD,LOOK_SHOES
  1009. };
  1010. // CELLs for non-permanent cell-based effects (Pneuma, Basilica, Npcs, etc)
  1011. #define CELL_NPC 0x1
  1012. #define CELL_REGEN 0x2
  1013. #define CELL_PNEUMA 0x4
  1014. #define CELL_SAFETYWALL 0x8
  1015. #define CELL_LANDPROTECTOR 0x10
  1016. #define CELL_BASILICA 0x20
  1017. #define CELL_MOONLIT 0x40
  1018. #define CELL_ICEWALL 0x80
  1019. /*
  1020. * map_getcell()で使用されるフラグ
  1021. */
  1022. typedef enum {
  1023. CELL_CHKWALL=0, // 壁(セルタイプ1)
  1024. CELL_CHKWATER, // 水場(セルタイプ3)
  1025. CELL_CHKGROUND, // 地面障害物(セルタイプ5)
  1026. CELL_CHKPASS, // 通過可能(セルタイプ1,5以外)
  1027. CELL_CHKNOPASS, // 通過不可(セルタイプ1,5)
  1028. CELL_GETTYPE, // セルタイプを返す
  1029. CELL_GETCELLTYPE,
  1030. CELL_CHKNPC=0x10, // タッチタイプのNPC(セルタイプ0x80フラグ)
  1031. CELL_CHKREGEN, // cells that improve regeneration
  1032. CELL_CHKPNEUMA,
  1033. CELL_CHKSAFETYWALL,
  1034. CELL_CHKBASILICA, // バジリカ(セルタイプ0x40フラグ)
  1035. CELL_CHKLANDPROTECTOR,
  1036. CELL_CHKMOONLIT,
  1037. CELL_CHKICEWALL,
  1038. CELL_CHKSTACK,
  1039. } cell_t;
  1040. // map_setcell()で使用されるフラグ
  1041. enum {
  1042. CELL_SETNPC=0x10, // タッチタイプのNPCをセット
  1043. CELL_CLRNPC,
  1044. CELL_SETBASILICA, // バジリカをセット
  1045. CELL_CLRBASILICA, // バジリカをクリア
  1046. CELL_SETREGEN, // set regen cell
  1047. CELL_SETLANDPROTECTOR, //Set/Clear Magnetic Earth
  1048. CELL_CLRLANDPROTECTOR,
  1049. CELL_SETPNEUMA,
  1050. CELL_CLRPNEUMA,
  1051. CELL_SETSAFETYWALL,
  1052. CELL_CLRSAFETYWALL,
  1053. CELL_SETMOONLIT,
  1054. CELL_CLRMOONLIT,
  1055. CELL_SETICEWALL,
  1056. CELL_CLRICEWALL,
  1057. };
  1058. struct chat_data {
  1059. struct block_list bl;
  1060. unsigned char pass[8]; /* password */
  1061. unsigned char title[61]; /* room title MAX 60 */
  1062. unsigned char limit; /* join limit */
  1063. unsigned char trigger;
  1064. unsigned char users; /* current users */
  1065. unsigned char pub; /* room attribute */
  1066. struct map_session_data *usersd[20];
  1067. struct block_list *owner_;
  1068. struct block_list **owner;
  1069. char npc_event[50];
  1070. };
  1071. extern struct map_data map[];
  1072. extern int map_num;
  1073. extern int autosave_interval;
  1074. extern int agit_flag;
  1075. extern int night_flag; // 0=day, 1=night [Yor]
  1076. extern int kick_on_disconnect; //To allow inter-server reconnections without kicking players out [Skotlex]
  1077. extern int enable_spy; //Determines if @spy commands are active.
  1078. extern char db_path[256];
  1079. // gat?ヨァ
  1080. int map_getcell(int,int,int,cell_t);
  1081. int map_getcellp(struct map_data*,int,int,cell_t);
  1082. void map_setcell(int,int,int,int);
  1083. extern int map_read_flag; // 0: grfォユォ。ォ、ォ・1: ォュォ罩テォキォ・2: ォュォ罩テォキォ・?�)
  1084. enum {
  1085. READ_FROM_GAT, READ_FROM_AFM,
  1086. READ_FROM_BITMAP, CREATE_BITMAP,
  1087. READ_FROM_BITMAP_COMPRESSED, CREATE_BITMAP_COMPRESSED
  1088. };
  1089. extern char motd_txt[];
  1090. extern char help_txt[];
  1091. extern char help2_txt[];
  1092. extern char charhelp_txt[];
  1093. extern char talkie_mes[];
  1094. extern char wisp_server_name[];
  1095. // 鯖全体情報
  1096. void map_setusers(int);
  1097. int map_getusers(void);
  1098. // block削除関連
  1099. int map_freeblock(struct block_list *bl);
  1100. int map_freeblock_lock(void);
  1101. int map_freeblock_unlock(void);
  1102. // block関連
  1103. int map_addblock_sub(struct block_list *, int);
  1104. int map_delblock_sub(struct block_list *, int);
  1105. #define map_addblock(bl) map_addblock_sub(bl,1)
  1106. #define map_delblock(bl) map_delblock_sub(bl,1)
  1107. int map_moveblock(struct block_list *, int, int, unsigned int);
  1108. int map_foreachinrange(int (*)(struct block_list*,va_list),struct block_list *,int,int,...);
  1109. int map_foreachinarea(int (*)(struct block_list*,va_list),int,int,int,int,int,int,...);
  1110. // -- moonsoul (added map_foreachincell)
  1111. int map_foreachincell(int (*)(struct block_list*,va_list),int,int,int,int,...);
  1112. int map_foreachinmovearea(int (*)(struct block_list*,va_list),int,int,int,int,int,int,int,int,...);
  1113. int map_foreachinpath(int (*func)(struct block_list*,va_list),int m,int x0,int y0,int x1,int y1,int range,int type,...); // Celest
  1114. int map_foreachinmap(int (*)(struct block_list*,va_list),int,int,...);
  1115. int map_countnearpc(int,int,int);
  1116. //block関連に追加
  1117. int map_count_oncell(int m,int x,int y,int type);
  1118. struct skill_unit *map_find_skill_unit_oncell(struct block_list *,int x,int y,int skill_id,struct skill_unit *);
  1119. // 一時的object関連
  1120. int map_addobject(struct block_list *);
  1121. int map_delobject(int);
  1122. int map_delobjectnofree(int id);
  1123. void map_foreachobject(int (*)(struct block_list*,va_list),int,...);
  1124. //
  1125. int map_quit(struct map_session_data *);
  1126. // npc
  1127. int map_addnpc(int,struct npc_data *);
  1128. // 床アイテム関連
  1129. int map_clearflooritem_timer(int,unsigned int,int,int);
  1130. int map_removemobs_timer(int,unsigned int,int,int);
  1131. #define map_clearflooritem(id) map_clearflooritem_timer(0,0,id,1)
  1132. int map_addflooritem(struct item *,int,int,int,int,struct map_session_data *,struct map_session_data *,struct map_session_data *,int);
  1133. // キャラid=>キャラ名 変換関連
  1134. void map_addchariddb(int charid,char *name);
  1135. void map_delchariddb(int charid);
  1136. int map_reqchariddb(struct map_session_data * sd,int charid);
  1137. char * map_charid2nick(int);
  1138. struct map_session_data * map_charid2sd(int);
  1139. struct map_session_data * map_id2sd(int);
  1140. struct block_list * map_id2bl(int);
  1141. int map_mapindex2mapid(unsigned short mapindex);
  1142. int map_mapname2mapid(char*);
  1143. int map_mapname2ipport(unsigned short,int*,int*);
  1144. int map_setipport(unsigned short map,unsigned long ip,int port);
  1145. int map_eraseipport(unsigned short map,unsigned long ip,int port);
  1146. int map_eraseallipport(void);
  1147. void map_addiddb(struct block_list *);
  1148. void map_deliddb(struct block_list *bl);
  1149. struct map_session_data** map_getallusers(int *users);
  1150. int map_foreachiddb(int (*)(DBKey,void*,va_list),...);
  1151. void map_addnickdb(struct map_session_data *);
  1152. struct map_session_data * map_nick2sd(char*);
  1153. int compare_item(struct item *a, struct item *b);
  1154. // その他
  1155. int map_check_dir(int s_dir,int t_dir);
  1156. int map_calc_dir( struct block_list *src,int x,int y);
  1157. int map_random_dir(struct block_list *bl, short *x, short *y); // [Skotlex]
  1158. // Water functions...
  1159. //
  1160. int map_setwaterheight(int m, char *mapname, int height);
  1161. int map_waterheight(char *mapname);
  1162. // path.cより
  1163. int path_search(struct walkpath_data*,int,int,int,int,int,int);
  1164. int path_search_long(struct shootpath_data *,int,int,int,int,int);
  1165. int path_blownpos(int m,int x0,int y0,int dx,int dy,int count);
  1166. // distance related functions [Skotlex]
  1167. #define check_distance_bl(bl1, bl2, distance) check_distance((bl1)->x - (bl2)->x, (bl1)->y - (bl2)->y, distance)
  1168. #define check_distance_blxy(bl, x1, y1, distance) check_distance((bl)->x-(x1), (bl)->y-(y1), distance)
  1169. #define check_distance_xy(x0, y0, x1, y1, distance) check_distance((x0)-(x1), (y0)-(y1), distance)
  1170. int check_distance(int dx, int dy, int distance);
  1171. #define distance_bl(bl1, bl2) distance((bl1)->x - (bl2)->x, (bl1)->y - (bl2)->y)
  1172. #define distance_blxy(bl, x1, y1) distance((bl)->x-(x1), (bl)->y-(y1))
  1173. #define distance_xy(x0, y0, x1, y1) distance((x0)-(x1), (y0)-(y1))
  1174. unsigned int distance(int dx, int dy);
  1175. int cleanup_sub(struct block_list *bl, va_list ap);
  1176. void map_helpscreen(int flag); // [Valaris]
  1177. int map_delmap(char *mapname);
  1178. struct mob_list* map_addmobtolist(unsigned short m); // [Wizputer]
  1179. void map_spawnmobs(int); // [Wizputer]
  1180. void map_removemobs(int); // [Wizputer]
  1181. //Added for own save method
  1182. int charsql_db_init(int method);
  1183. extern char *INTER_CONF_NAME;
  1184. extern char *LOG_CONF_NAME;
  1185. extern char *MAP_CONF_NAME;
  1186. extern char *BATTLE_CONF_FILENAME;
  1187. extern char *ATCOMMAND_CONF_FILENAME;
  1188. extern char *CHARCOMMAND_CONF_FILENAME;
  1189. extern char *SCRIPT_CONF_NAME;
  1190. extern char *MSG_CONF_NAME;
  1191. extern char *GRF_PATH_FILENAME;
  1192. extern int charsave_method; //needed ..
  1193. #ifndef TXT_ONLY
  1194. // MySQL
  1195. #ifdef __WIN32
  1196. #include <my_global.h>
  1197. #include <my_sys.h>
  1198. #endif
  1199. #include <mysql.h>
  1200. extern char tmp_sql[65535];
  1201. extern int db_use_sqldbs;
  1202. extern MYSQL mmysql_handle;
  1203. extern MYSQL_RES* sql_res ;
  1204. extern MYSQL_ROW sql_row ;
  1205. extern MYSQL lmysql_handle;
  1206. extern MYSQL_RES* lsql_res ;
  1207. extern MYSQL_ROW lsql_row ;
  1208. extern MYSQL charsql_handle;
  1209. extern MYSQL_RES* charsql_res;
  1210. extern MYSQL_ROW charsql_row;
  1211. extern MYSQL logmysql_handle;
  1212. extern MYSQL_RES* logsql_res ;
  1213. extern MYSQL_ROW logsql_row ;
  1214. extern int mail_server_enable;
  1215. extern MYSQL mail_handle;
  1216. extern MYSQL_RES* mail_res ;
  1217. extern MYSQL_ROW mail_row ;
  1218. extern char item_db_db[32];
  1219. extern char item_db2_db[32];
  1220. extern char mob_db_db[32];
  1221. extern char mob_db2_db[32];
  1222. extern char login_db[32];
  1223. extern char login_db_level[32];
  1224. extern char login_db_account_id[32];
  1225. extern char gm_db[32];
  1226. extern char gm_db_level[32];
  1227. extern char gm_db_account_id[32];
  1228. extern int read_gm_interval;
  1229. extern char char_db[32];
  1230. #ifdef MAPREGSQL
  1231. // [zBuffer] SQL Mapreg
  1232. extern MYSQL mapregsql_handle;
  1233. extern MYSQL_RES* mapregsql_res ;
  1234. extern MYSQL_ROW mapregsql_row;
  1235. #endif
  1236. extern char mail_db[32];
  1237. #endif /* not TXT_ONLY */
  1238. extern int lowest_gm_level;
  1239. extern char main_chat_nick[16];
  1240. #endif