map.h 42 KB

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