1 | // Copyright (c) Athena Dev Teams - Licensed under GNU GPL |
---|
2 | // For more information, see LICENCE in the main folder |
---|
3 | |
---|
4 | #ifndef _MAP_H_ |
---|
5 | #define _MAP_H_ |
---|
6 | |
---|
7 | #ifndef _CBASETYPES_H_ |
---|
8 | #include "../common/cbasetypes.h" |
---|
9 | #endif |
---|
10 | #include "../common/mmo.h" |
---|
11 | #include "../common/mapindex.h" |
---|
12 | #include "../common/db.h" |
---|
13 | |
---|
14 | #include <stdarg.h> |
---|
15 | |
---|
16 | struct npc_data; |
---|
17 | struct item_data; |
---|
18 | |
---|
19 | //Uncomment to enable the Cell Stack Limit mod. |
---|
20 | //It's only config is the battle_config cell_stack_limit. |
---|
21 | //Only chars affected are those defined in BL_CHAR (mobs and players currently) |
---|
22 | //#define CELL_NOSTACK |
---|
23 | |
---|
24 | //Uncomment to enable circular area checks. |
---|
25 | //By default, all range checks in Aegis are of Square shapes, so a weapon range |
---|
26 | // of 10 allows you to attack from anywhere within a 21x21 area. |
---|
27 | //Enabling this changes such checks to circular checks, which is more realistic, |
---|
28 | // but is not the official behaviour. |
---|
29 | //#define CIRCULAR_AREA |
---|
30 | |
---|
31 | #define MAX_NPC_PER_MAP 512 |
---|
32 | #define BLOCK_SIZE 8 |
---|
33 | #define AREA_SIZE battle_config.area_size |
---|
34 | #define DAMAGELOG_SIZE 30 |
---|
35 | #define LOOTITEM_SIZE 10 |
---|
36 | #define MAX_MOBSKILL 40 |
---|
37 | #define MAX_MOB_LIST_PER_MAP 128 |
---|
38 | #define MAX_EVENTQUEUE 2 |
---|
39 | #define MAX_EVENTTIMER 32 |
---|
40 | #define NATURAL_HEAL_INTERVAL 500 |
---|
41 | #define MAX_FLOORITEM 500000 |
---|
42 | #define MAX_LEVEL 99 |
---|
43 | #define MAX_DROP_PER_MAP 48 |
---|
44 | #define MAX_IGNORE_LIST 20 // official is 14 |
---|
45 | #define MAX_VENDING 12 |
---|
46 | #define MOBID_EMPERIUM 1288 |
---|
47 | |
---|
48 | //The following system marks a different job ID system used by the map server, |
---|
49 | //which makes a lot more sense than the normal one. [Skotlex] |
---|
50 | // |
---|
51 | //These marks the "level" of the job. |
---|
52 | #define JOBL_2_1 0x100 //256 |
---|
53 | #define JOBL_2_2 0x200 //512 |
---|
54 | #define JOBL_2 0x300 |
---|
55 | |
---|
56 | #define JOBL_UPPER 0x1000 //4096 |
---|
57 | #define JOBL_BABY 0x2000 //8192 |
---|
58 | |
---|
59 | //for filtering and quick checking. |
---|
60 | #define MAPID_UPPERMASK 0x0fff |
---|
61 | #define MAPID_BASEMASK 0x00ff |
---|
62 | //First Jobs |
---|
63 | //Note the oddity of the novice: |
---|
64 | //Super Novices are considered the 2-1 version of the novice! Novices are considered a first class type, too... |
---|
65 | enum { |
---|
66 | MAPID_NOVICE = 0x0, |
---|
67 | MAPID_SWORDMAN, |
---|
68 | MAPID_MAGE, |
---|
69 | MAPID_ARCHER, |
---|
70 | MAPID_ACOLYTE, |
---|
71 | MAPID_MERCHANT, |
---|
72 | MAPID_THIEF, |
---|
73 | MAPID_TAEKWON, |
---|
74 | MAPID_WEDDING, |
---|
75 | MAPID_GUNSLINGER, |
---|
76 | MAPID_NINJA, |
---|
77 | MAPID_XMAS, |
---|
78 | MAPID_SUMMER, |
---|
79 | //Bit masking is used here? |
---|
80 | MAPID_ADEPT = 0x0E, // Adept [Brain] |
---|
81 | //2_1 classes |
---|
82 | MAPID_SUPER_NOVICE = JOBL_2_1|0x0, |
---|
83 | MAPID_KNIGHT, |
---|
84 | MAPID_WIZARD, |
---|
85 | MAPID_HUNTER, |
---|
86 | MAPID_PRIEST, |
---|
87 | MAPID_BLACKSMITH, |
---|
88 | MAPID_ASSASSIN, |
---|
89 | MAPID_STAR_GLADIATOR, |
---|
90 | //and here and down there |
---|
91 | MAPID_NECROMANCER = JOBL_2_1|0x0E, // Necromancer [Brain] |
---|
92 | //2_2 classes |
---|
93 | MAPID_CRUSADER = JOBL_2_2|0x1, |
---|
94 | MAPID_SAGE, |
---|
95 | MAPID_BARDDANCER, |
---|
96 | MAPID_MONK, |
---|
97 | MAPID_ALCHEMIST, |
---|
98 | MAPID_ROGUE, |
---|
99 | MAPID_SOUL_LINKER, |
---|
100 | //see. why are the bitmasks like this? Xray thing? |
---|
101 | MAPID_WARLOCK = JOBL_2_2|0x0E, // Warlock [Flavio] |
---|
102 | //1-1, advanced |
---|
103 | MAPID_NOVICE_HIGH = JOBL_UPPER|0x0, |
---|
104 | MAPID_SWORDMAN_HIGH, |
---|
105 | MAPID_MAGE_HIGH, |
---|
106 | MAPID_ARCHER_HIGH, |
---|
107 | MAPID_ACOLYTE_HIGH, |
---|
108 | MAPID_MERCHANT_HIGH, |
---|
109 | MAPID_THIEF_HIGH, |
---|
110 | //2_1 advanced |
---|
111 | MAPID_LORD_KNIGHT = JOBL_UPPER|JOBL_2_1|0x1, |
---|
112 | MAPID_HIGH_WIZARD, |
---|
113 | MAPID_SNIPER, |
---|
114 | MAPID_HIGH_PRIEST, |
---|
115 | MAPID_WHITESMITH, |
---|
116 | MAPID_ASSASSIN_CROSS, |
---|
117 | //2_2 advanced |
---|
118 | MAPID_PALADIN = JOBL_UPPER|JOBL_2_2|0x1, |
---|
119 | MAPID_PROFESSOR, |
---|
120 | MAPID_CLOWNGYPSY, |
---|
121 | MAPID_CHAMPION, |
---|
122 | MAPID_CREATOR, |
---|
123 | MAPID_STALKER, |
---|
124 | //1-1 baby |
---|
125 | MAPID_BABY = JOBL_BABY|0x0, |
---|
126 | MAPID_BABY_SWORDMAN, |
---|
127 | MAPID_BABY_MAGE, |
---|
128 | MAPID_BABY_ARCHER, |
---|
129 | MAPID_BABY_ACOLYTE, |
---|
130 | MAPID_BABY_MERCHANT, |
---|
131 | MAPID_BABY_THIEF, |
---|
132 | MAPID_BABY_TAEKWON, |
---|
133 | //2_1 baby |
---|
134 | MAPID_SUPER_BABY = JOBL_BABY|JOBL_2_1|0x0, |
---|
135 | MAPID_BABY_KNIGHT, |
---|
136 | MAPID_BABY_WIZARD, |
---|
137 | MAPID_BABY_HUNTER, |
---|
138 | MAPID_BABY_PRIEST, |
---|
139 | MAPID_BABY_BLACKSMITH, |
---|
140 | MAPID_BABY_ASSASSIN, |
---|
141 | MAPID_BABY_STAR_GLADIATOR, |
---|
142 | //2_2 baby |
---|
143 | MAPID_BABY_CRUSADER = JOBL_BABY|JOBL_2_2|0x1, |
---|
144 | MAPID_BABY_SAGE, |
---|
145 | MAPID_BABY_BARDDANCER, |
---|
146 | MAPID_BABY_MONK, |
---|
147 | MAPID_BABY_ALCHEMIST, |
---|
148 | MAPID_BABY_ROGUE, |
---|
149 | MAPID_BABY_SOUL_LINKER, |
---|
150 | }; |
---|
151 | |
---|
152 | //Max size for inputs to Graffiti, Talkie Box and Vending text prompts |
---|
153 | #define MESSAGE_SIZE (79 + 1) |
---|
154 | //String length you can write in the 'talking box' |
---|
155 | #define CHATBOX_SIZE (70 + 1) |
---|
156 | //Chatroom-related string sizes |
---|
157 | #define CHATROOM_TITLE_SIZE (36 + 1) |
---|
158 | #define CHATROOM_PASS_SIZE (8 + 1) |
---|
159 | //Max allowed chat text length |
---|
160 | #define CHAT_SIZE_MAX (255 + 1) |
---|
161 | |
---|
162 | #define DEFAULT_AUTOSAVE_INTERVAL 5*60*1000 |
---|
163 | |
---|
164 | //Specifies maps where players may hit each other |
---|
165 | #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)) |
---|
166 | //Specifies maps that have special GvG/WoE restrictions |
---|
167 | #define map_flag_gvg(m) (map[m].flag.gvg || (agit_flag && map[m].flag.gvg_castle)) |
---|
168 | //Specifies if the map is tagged as GvG/WoE (regardless of agit_flag status) |
---|
169 | #define map_flag_gvg2(m) (map[m].flag.gvg || map[m].flag.gvg_castle) |
---|
170 | // No Kill Steal Protection |
---|
171 | #define map_flag_ks(m) (map[m].flag.town || map[m].flag.pvp || map[m].flag.gvg) |
---|
172 | |
---|
173 | //This stackable implementation does not means a BL can be more than one type at a time, but it's |
---|
174 | //meant to make it easier to check for multiple types at a time on invocations such as map_foreach* calls [Skotlex] |
---|
175 | enum bl_type { |
---|
176 | BL_NUL = 0x000, |
---|
177 | BL_PC = 0x001, |
---|
178 | BL_MOB = 0x002, |
---|
179 | BL_PET = 0x004, |
---|
180 | BL_HOM = 0x008, |
---|
181 | BL_ITEM = 0x010, |
---|
182 | BL_SKILL = 0x020, |
---|
183 | BL_NPC = 0x040, |
---|
184 | BL_CHAT = 0x080, |
---|
185 | |
---|
186 | BL_ALL = 0xFFF, |
---|
187 | }; |
---|
188 | |
---|
189 | //For common mapforeach calls. Since pets cannot be affected, they aren't included here yet. |
---|
190 | #define BL_CHAR (BL_PC|BL_MOB|BL_HOM) |
---|
191 | |
---|
192 | enum npc_subtype { WARP, SHOP, SCRIPT, CASHSHOP }; |
---|
193 | |
---|
194 | enum { |
---|
195 | RC_FORMLESS=0, |
---|
196 | RC_UNDEAD, |
---|
197 | RC_BRUTE, |
---|
198 | RC_PLANT, |
---|
199 | RC_INSECT, |
---|
200 | RC_FISH, |
---|
201 | RC_DEMON, |
---|
202 | RC_DEMIHUMAN, |
---|
203 | RC_ANGEL, |
---|
204 | RC_DRAGON, |
---|
205 | RC_BOSS, |
---|
206 | RC_NONBOSS, |
---|
207 | RC_MAX |
---|
208 | }; |
---|
209 | |
---|
210 | enum { |
---|
211 | ELE_NEUTRAL=0, |
---|
212 | ELE_WATER, |
---|
213 | ELE_EARTH, |
---|
214 | ELE_FIRE, |
---|
215 | ELE_WIND, |
---|
216 | ELE_POISON, |
---|
217 | ELE_HOLY, |
---|
218 | ELE_DARK, |
---|
219 | ELE_GHOST, |
---|
220 | ELE_UNDEAD, |
---|
221 | ELE_MAX |
---|
222 | }; |
---|
223 | |
---|
224 | enum auto_trigger_flag { |
---|
225 | ATF_SELF=0x01, |
---|
226 | ATF_TARGET=0x02, |
---|
227 | ATF_SHORT=0x04, |
---|
228 | ATF_LONG=0x08 |
---|
229 | }; |
---|
230 | |
---|
231 | struct block_list { |
---|
232 | struct block_list *next,*prev; |
---|
233 | int id; |
---|
234 | short m,x,y; |
---|
235 | enum bl_type type; |
---|
236 | }; |
---|
237 | |
---|
238 | |
---|
239 | // Mob List Held in memory for Dynamic Mobs [Wizputer] |
---|
240 | // Expanded to specify all mob-related spawn data by [Skotlex] |
---|
241 | struct spawn_data { |
---|
242 | short class_; //Class, used because a mob can change it's class |
---|
243 | unsigned short m,x,y; //Spawn information (map, point, spawn-area around point) |
---|
244 | signed short xs,ys; |
---|
245 | unsigned short num; //Number of mobs using this structure |
---|
246 | unsigned short active; //Number of mobs that are already spawned (for mob_remove_damaged: no) |
---|
247 | unsigned int level; //Custom level. |
---|
248 | unsigned int delay1,delay2; //Min delay before respawning after spawn/death |
---|
249 | struct { |
---|
250 | unsigned size :2; //Holds if mob has to be tiny/large |
---|
251 | unsigned ai :2; //Holds if mob is special ai. |
---|
252 | unsigned dynamic :1; //Whether this data is indexed by a map's dynamic mob list |
---|
253 | } state; |
---|
254 | char name[NAME_LENGTH],eventname[50]; //Name/event |
---|
255 | }; |
---|
256 | |
---|
257 | |
---|
258 | |
---|
259 | |
---|
260 | struct flooritem_data { |
---|
261 | struct block_list bl; |
---|
262 | unsigned char subx,suby; |
---|
263 | int cleartimer; |
---|
264 | int first_get_charid,second_get_charid,third_get_charid; |
---|
265 | unsigned int first_get_tick,second_get_tick,third_get_tick; |
---|
266 | struct item item_data; |
---|
267 | }; |
---|
268 | |
---|
269 | enum _sp { |
---|
270 | SP_SPEED,SP_BASEEXP,SP_JOBEXP,SP_KARMA,SP_MANNER,SP_HP,SP_MAXHP,SP_SP, // 0-7 |
---|
271 | SP_MAXSP,SP_STATUSPOINT,SP_0a,SP_BASELEVEL,SP_SKILLPOINT,SP_STR,SP_AGI,SP_VIT, // 8-15 |
---|
272 | SP_INT,SP_DEX,SP_LUK,SP_CLASS,SP_ZENY,SP_SEX,SP_NEXTBASEEXP,SP_NEXTJOBEXP, // 16-23 |
---|
273 | SP_WEIGHT,SP_MAXWEIGHT,SP_1a,SP_1b,SP_1c,SP_1d,SP_1e,SP_1f, // 24-31 |
---|
274 | SP_USTR,SP_UAGI,SP_UVIT,SP_UINT,SP_UDEX,SP_ULUK,SP_26,SP_27, // 32-39 |
---|
275 | SP_28,SP_ATK1,SP_ATK2,SP_MATK1,SP_MATK2,SP_DEF1,SP_DEF2,SP_MDEF1, // 40-47 |
---|
276 | SP_MDEF2,SP_HIT,SP_FLEE1,SP_FLEE2,SP_CRITICAL,SP_ASPD,SP_36,SP_JOBLEVEL, // 48-55 |
---|
277 | SP_UPPER,SP_PARTNER,SP_CART,SP_FAME,SP_UNBREAKABLE, //56-60 |
---|
278 | SP_CARTINFO=99, // 99 |
---|
279 | |
---|
280 | SP_BASEJOB=119, // 100+19 - celest |
---|
281 | SP_BASECLASS=120, //Hmm.. why 100+19? I just use the next one... [Skotlex] |
---|
282 | |
---|
283 | // original 1000- |
---|
284 | SP_ATTACKRANGE=1000, SP_ATKELE,SP_DEFELE, // 1000-1002 |
---|
285 | SP_CASTRATE, SP_MAXHPRATE, SP_MAXSPRATE, SP_SPRATE, // 1003-1006 |
---|
286 | SP_ADDELE, SP_ADDRACE, SP_ADDSIZE, SP_SUBELE, SP_SUBRACE, // 1007-1011 |
---|
287 | SP_ADDEFF, SP_RESEFF, // 1012-1013 |
---|
288 | SP_BASE_ATK,SP_ASPD_RATE,SP_HP_RECOV_RATE,SP_SP_RECOV_RATE,SP_SPEED_RATE, // 1014-1018 |
---|
289 | SP_CRITICAL_DEF,SP_NEAR_ATK_DEF,SP_LONG_ATK_DEF, // 1019-1021 |
---|
290 | SP_DOUBLE_RATE, SP_DOUBLE_ADD_RATE, SP_SKILL_HEAL, SP_MATK_RATE, // 1022-1025 |
---|
291 | SP_IGNORE_DEF_ELE,SP_IGNORE_DEF_RACE, // 1026-1027 |
---|
292 | SP_ATK_RATE,SP_SPEED_ADDRATE,SP_SP_REGEN_RATE, // 1028-1030 |
---|
293 | SP_MAGIC_ATK_DEF,SP_MISC_ATK_DEF, // 1031-1032 |
---|
294 | SP_IGNORE_MDEF_ELE,SP_IGNORE_MDEF_RACE, // 1033-1034 |
---|
295 | SP_MAGIC_ADDELE,SP_MAGIC_ADDRACE,SP_MAGIC_ADDSIZE, // 1035-1037 |
---|
296 | SP_PERFECT_HIT_RATE,SP_PERFECT_HIT_ADD_RATE,SP_CRITICAL_RATE,SP_GET_ZENY_NUM,SP_ADD_GET_ZENY_NUM, // 1038-1042 |
---|
297 | SP_ADD_DAMAGE_CLASS,SP_ADD_MAGIC_DAMAGE_CLASS,SP_ADD_DEF_CLASS,SP_ADD_MDEF_CLASS, // 1043-1046 |
---|
298 | SP_ADD_MONSTER_DROP_ITEM,SP_DEF_RATIO_ATK_ELE,SP_DEF_RATIO_ATK_RACE,SP_FREE3, // 1047-1050 |
---|
299 | SP_HIT_RATE,SP_FLEE_RATE,SP_FLEE2_RATE,SP_DEF_RATE,SP_DEF2_RATE,SP_MDEF_RATE,SP_MDEF2_RATE, // 1051-1057 |
---|
300 | SP_SPLASH_RANGE,SP_SPLASH_ADD_RANGE,SP_AUTOSPELL,SP_HP_DRAIN_RATE,SP_SP_DRAIN_RATE, // 1058-1062 |
---|
301 | SP_SHORT_WEAPON_DAMAGE_RETURN,SP_LONG_WEAPON_DAMAGE_RETURN,SP_WEAPON_COMA_ELE,SP_WEAPON_COMA_RACE, // 1063-1066 |
---|
302 | SP_ADDEFF2,SP_BREAK_WEAPON_RATE,SP_BREAK_ARMOR_RATE,SP_ADD_STEAL_RATE, // 1067-1070 |
---|
303 | SP_MAGIC_DAMAGE_RETURN,SP_RANDOM_ATTACK_INCREASE,SP_ALL_STATS,SP_AGI_VIT,SP_AGI_DEX_STR,SP_PERFECT_HIDE, // 1071-1076 |
---|
304 | SP_NO_KNOCKBACK,SP_CLASSCHANGE, // 1077-1078 |
---|
305 | SP_HP_DRAIN_VALUE,SP_SP_DRAIN_VALUE, // 1079-1080 |
---|
306 | SP_WEAPON_ATK,SP_WEAPON_ATK_RATE, // 1081-1082 |
---|
307 | SP_DELAYRATE,SP_HP_DRAIN_RATE_RACE,SP_SP_DRAIN_RATE_RACE, // 1083-1085 |
---|
308 | SP_IGNORE_MDEF_RATE, //1086 |
---|
309 | |
---|
310 | SP_RESTART_FULL_RECOVER=2000,SP_NO_CASTCANCEL,SP_NO_SIZEFIX,SP_NO_MAGIC_DAMAGE,SP_NO_WEAPON_DAMAGE,SP_NO_GEMSTONE, // 2000-2005 |
---|
311 | SP_NO_CASTCANCEL2,SP_NO_MISC_DAMAGE,SP_UNBREAKABLE_WEAPON,SP_UNBREAKABLE_ARMOR, SP_UNBREAKABLE_HELM, // 2006-2010 |
---|
312 | SP_UNBREAKABLE_SHIELD, SP_LONG_ATK_RATE, // 2011-2012 |
---|
313 | |
---|
314 | SP_CRIT_ATK_RATE, SP_CRITICAL_ADDRACE, SP_NO_REGEN, SP_ADDEFF_WHENHIT, SP_AUTOSPELL_WHENHIT, // 2013-2017 |
---|
315 | SP_SKILL_ATK, SP_UNSTRIPABLE, SP_FREE, // 2018-2020 |
---|
316 | SP_SP_GAIN_VALUE, SP_HP_REGEN_RATE, SP_HP_LOSS_RATE, SP_ADDRACE2, SP_HP_GAIN_VALUE, // 2021-2025 |
---|
317 | SP_SUBSIZE, SP_HP_DRAIN_VALUE_RACE, SP_ADD_ITEM_HEAL_RATE, SP_SP_DRAIN_VALUE_RACE, SP_EXP_ADDRACE, // 2026-2030 |
---|
318 | SP_SP_GAIN_RACE, SP_SUBRACE2, SP_FREE2, // 2031-2033 |
---|
319 | SP_UNSTRIPABLE_WEAPON,SP_UNSTRIPABLE_ARMOR,SP_UNSTRIPABLE_HELM,SP_UNSTRIPABLE_SHIELD, // 2034-2037 |
---|
320 | SP_INTRAVISION, SP_ADD_MONSTER_DROP_ITEMGROUP, SP_SP_LOSS_RATE, // 2038-2040 |
---|
321 | SP_ADD_SKILL_BLOW, SP_SP_VANISH_RATE //2041 |
---|
322 | //Before adding new bonuses, reuse the currently free slots: |
---|
323 | //2020 (SP_FREE) (previously SP_ADD_DAMAGE_BY_CLASS) |
---|
324 | //2033 (SP_FREE2) (previously SP_ADDEFF_WHENHIT_SHORT) |
---|
325 | //1050 (SP_FREE3) (previously SP_ADD_SPEED) |
---|
326 | }; |
---|
327 | |
---|
328 | enum _look { |
---|
329 | LOOK_BASE, |
---|
330 | LOOK_HAIR, |
---|
331 | LOOK_WEAPON, |
---|
332 | LOOK_HEAD_BOTTOM, |
---|
333 | LOOK_HEAD_TOP, |
---|
334 | LOOK_HEAD_MID, |
---|
335 | LOOK_HAIR_COLOR, |
---|
336 | LOOK_CLOTHES_COLOR, |
---|
337 | LOOK_SHIELD, |
---|
338 | LOOK_SHOES |
---|
339 | }; |
---|
340 | |
---|
341 | // used by map_setcell() |
---|
342 | typedef enum { |
---|
343 | CELL_WALKABLE, |
---|
344 | CELL_SHOOTABLE, |
---|
345 | CELL_WATER, |
---|
346 | |
---|
347 | CELL_NPC, |
---|
348 | CELL_BASILICA, |
---|
349 | CELL_LANDPROTECTOR, |
---|
350 | CELL_NOVENDING, |
---|
351 | CELL_NOCHAT, |
---|
352 | } cell_t; |
---|
353 | |
---|
354 | // used by map_getcell() |
---|
355 | typedef enum { |
---|
356 | CELL_GETTYPE, // retrieves a cell's 'gat' type |
---|
357 | |
---|
358 | CELL_CHKWALL, // wall (gat type 1) |
---|
359 | CELL_CHKWATER, // water (gat type 3) |
---|
360 | CELL_CHKCLIFF, // cliff/gap (gat type 5) |
---|
361 | |
---|
362 | CELL_CHKPASS, // passable cell (gat type non-1/5) |
---|
363 | CELL_CHKREACH, // Same as PASS, but ignores the cell-stacking mod. |
---|
364 | CELL_CHKNOPASS, // non-passable cell (gat types 1 and 5) |
---|
365 | CELL_CHKNOREACH, // Same as NOPASS, but ignores the cell-stacking mod. |
---|
366 | CELL_CHKSTACK, // whether cell is full (reached cell stacking limit) |
---|
367 | |
---|
368 | CELL_CHKNPC, |
---|
369 | CELL_CHKBASILICA, |
---|
370 | CELL_CHKLANDPROTECTOR, |
---|
371 | CELL_CHKNOVENDING, |
---|
372 | CELL_CHKNOCHAT, |
---|
373 | } cell_chk; |
---|
374 | |
---|
375 | struct mapcell |
---|
376 | { |
---|
377 | // terrain flags |
---|
378 | unsigned char |
---|
379 | walkable : 1, |
---|
380 | shootable : 1, |
---|
381 | water : 1; |
---|
382 | |
---|
383 | // dynamic flags |
---|
384 | unsigned char |
---|
385 | npc : 1, |
---|
386 | basilica : 1, |
---|
387 | landprotector : 1, |
---|
388 | novending : 1, |
---|
389 | nochat : 1; |
---|
390 | |
---|
391 | #ifdef CELL_NOSTACK |
---|
392 | unsigned char cell_bl; //Holds amount of bls in this cell. |
---|
393 | #endif |
---|
394 | }; |
---|
395 | |
---|
396 | struct barricade_data { |
---|
397 | char npc_event[50]; |
---|
398 | short m, x, y, count, amount, dir; |
---|
399 | |
---|
400 | bool killable, shootable, walkable; |
---|
401 | }; |
---|
402 | |
---|
403 | struct map_data { |
---|
404 | char name[MAP_NAME_LENGTH]; |
---|
405 | unsigned short index; // The map index used by the mapindex* functions. |
---|
406 | struct mapcell* cell; // Holds the information of each map cell (NULL if the map is not on this map-server). |
---|
407 | struct block_list **block; |
---|
408 | struct block_list **block_mob; |
---|
409 | int m; |
---|
410 | short xs,ys; // map dimensions (in cells) |
---|
411 | short bxs,bys; // map dimensions (in blocks) |
---|
412 | int npc_num; |
---|
413 | int users; |
---|
414 | int barricade_num; |
---|
415 | struct map_flag { |
---|
416 | unsigned town : 1; // [Suggestion to protect Mail System] |
---|
417 | unsigned autotrade : 1; |
---|
418 | unsigned allowks : 1; // [Kill Steal Protection] |
---|
419 | unsigned nomemo : 1; |
---|
420 | unsigned noteleport : 1; |
---|
421 | unsigned noreturn : 1; |
---|
422 | unsigned monster_noteleport : 1; |
---|
423 | unsigned nosave : 1; |
---|
424 | unsigned nobranch : 1; |
---|
425 | unsigned noexppenalty : 1; |
---|
426 | unsigned pvp : 1; |
---|
427 | unsigned pvp_noparty : 1; |
---|
428 | unsigned pvp_noguild : 1; |
---|
429 | unsigned pvp_nightmaredrop :1; |
---|
430 | unsigned pvp_nocalcrank : 1; |
---|
431 | unsigned gvg_castle : 1; |
---|
432 | unsigned gvg : 1; // Now it identifies gvg versus maps that are active 24/7 |
---|
433 | unsigned gvg_dungeon : 1; // Celest |
---|
434 | unsigned gvg_noparty : 1; |
---|
435 | unsigned nozenypenalty : 1; |
---|
436 | unsigned notrade : 1; |
---|
437 | unsigned noskill : 1; |
---|
438 | unsigned nowarp : 1; |
---|
439 | unsigned nowarpto : 1; |
---|
440 | unsigned noicewall : 1; // [Valaris] |
---|
441 | unsigned snow : 1; // [Valaris] |
---|
442 | unsigned clouds : 1; |
---|
443 | unsigned clouds2 : 1; // [Valaris] |
---|
444 | unsigned fog : 1; // [Valaris] |
---|
445 | unsigned fireworks : 1; |
---|
446 | unsigned sakura : 1; // [Valaris] |
---|
447 | unsigned leaves : 1; // [Valaris] |
---|
448 | unsigned rain : 1; // [Valaris] |
---|
449 | unsigned indoors : 1; // celest |
---|
450 | unsigned nogo : 1; // [Valaris] |
---|
451 | unsigned nobaseexp : 1; // [Lorky] added by Lupus |
---|
452 | unsigned nojobexp : 1; // [Lorky] |
---|
453 | unsigned nomobloot : 1; // [Lorky] |
---|
454 | unsigned nomvploot : 1; // [Lorky] |
---|
455 | unsigned nightenabled :1; //For night display. [Skotlex] |
---|
456 | unsigned restricted : 1; // [Komurka] |
---|
457 | unsigned nodrop : 1; |
---|
458 | unsigned novending : 1; |
---|
459 | unsigned loadevent : 1; |
---|
460 | unsigned nochat :1; |
---|
461 | unsigned partylock :1; |
---|
462 | unsigned guildlock :1; |
---|
463 | } flag; |
---|
464 | struct point save; |
---|
465 | struct npc_data *npc[MAX_NPC_PER_MAP]; |
---|
466 | struct { |
---|
467 | int drop_id; |
---|
468 | int drop_type; |
---|
469 | int drop_per; |
---|
470 | } drop_list[MAX_DROP_PER_MAP]; |
---|
471 | |
---|
472 | struct spawn_data *moblist[MAX_MOB_LIST_PER_MAP]; // [Wizputer] |
---|
473 | int mob_delete_timer; // [Skotlex] |
---|
474 | int zone; // zone number (for item/skill restrictions) |
---|
475 | int jexp; // map experience multiplicator |
---|
476 | int bexp; // map experience multiplicator |
---|
477 | int nocommand; //Blocks @/# commands for non-gms. [Skotlex] |
---|
478 | }; |
---|
479 | |
---|
480 | /// Stores information about a remote map (for multi-mapserver setups). |
---|
481 | /// Beginning of data structure matches 'map_data', to allow typecasting. |
---|
482 | struct map_data_other_server { |
---|
483 | char name[MAP_NAME_LENGTH]; |
---|
484 | unsigned short index; //Index is the map index used by the mapindex* functions. |
---|
485 | struct mapcell* cell; // If this is NULL, the map is not on this map-server |
---|
486 | uint32 ip; |
---|
487 | uint16 port; |
---|
488 | }; |
---|
489 | |
---|
490 | int map_getcell(int,int,int,cell_chk); |
---|
491 | int map_getcellp(struct map_data*,int,int,cell_chk); |
---|
492 | void map_setcell(int m, int x, int y, cell_t cell, bool flag); |
---|
493 | void map_setgatcell(int m, int x, int y, int gat); |
---|
494 | |
---|
495 | extern struct map_data map[]; |
---|
496 | extern int map_num; |
---|
497 | |
---|
498 | extern int autosave_interval; |
---|
499 | extern int minsave_interval; |
---|
500 | extern int save_settings; |
---|
501 | extern int agit_flag; |
---|
502 | extern int night_flag; // 0=day, 1=night [Yor] |
---|
503 | extern int enable_spy; //Determines if @spy commands are active. |
---|
504 | extern char db_path[256]; |
---|
505 | |
---|
506 | extern char motd_txt[]; |
---|
507 | extern char help_txt[]; |
---|
508 | extern char help2_txt[]; |
---|
509 | extern char charhelp_txt[]; |
---|
510 | |
---|
511 | extern char wisp_server_name[]; |
---|
512 | |
---|
513 | // ISÌîñ |
---|
514 | void map_setusers(int); |
---|
515 | int map_getusers(void); |
---|
516 | int map_usercount(void); |
---|
517 | // blockíÖA |
---|
518 | int map_freeblock(struct block_list *bl); |
---|
519 | int map_freeblock_lock(void); |
---|
520 | int map_freeblock_unlock(void); |
---|
521 | // blockÖA |
---|
522 | int map_addblock(struct block_list* bl); |
---|
523 | int map_delblock(struct block_list* bl); |
---|
524 | int map_moveblock(struct block_list *, int, int, unsigned int); |
---|
525 | int map_foreachinrange(int (*func)(struct block_list*,va_list), struct block_list* center, int range, int type, ...); |
---|
526 | int map_foreachinshootrange(int (*func)(struct block_list*,va_list), struct block_list* center, int range, int type, ...); |
---|
527 | int map_foreachinarea(int (*func)(struct block_list*,va_list), int m, int x0, int y0, int x1, int y1, int type, ...); |
---|
528 | int map_foreachinmovearea(int (*func)(struct block_list*,va_list), struct block_list* center, int range, int dx, int dy, int type, ...); |
---|
529 | int map_foreachincell(int (*func)(struct block_list*,va_list), int m, int x, int y, int type, ...); |
---|
530 | int map_foreachinpath(int (*func)(struct block_list*,va_list), int m, int x0, int y0, int x1, int y1, int range, int length, int type, ...); |
---|
531 | int map_foreachinmap(int (*func)(struct block_list*,va_list), int m, int type, ...); |
---|
532 | //blockÖAÉÇÁ |
---|
533 | int map_count_oncell(int m,int x,int y,int type); |
---|
534 | struct skill_unit *map_find_skill_unit_oncell(struct block_list *,int x,int y,int skill_id,struct skill_unit *); |
---|
535 | // êIobjectÖA |
---|
536 | int map_addobject(struct block_list *); |
---|
537 | int map_delobject(int); |
---|
538 | int map_delobjectnofree(int id); |
---|
539 | void map_foreachobject(int (*)(struct block_list*,va_list),int,...); |
---|
540 | int map_search_freecell(struct block_list *src, int m, short *x, short *y, int rx, int ry, int flag); |
---|
541 | // |
---|
542 | int map_quit(struct map_session_data *); |
---|
543 | // npc |
---|
544 | bool map_addnpc(int,struct npc_data *); |
---|
545 | |
---|
546 | // °ACeÖA |
---|
547 | int map_clearflooritem_timer(int tid, unsigned int tick, int id, intptr data); |
---|
548 | int map_removemobs_timer(int tid, unsigned int tick, int id, intptr data); |
---|
549 | #define map_clearflooritem(id) map_clearflooritem_timer(0,0,id,1) |
---|
550 | int map_addflooritem(struct item *item_data,int amount,int m,int x,int y,int first_charid,int second_charid,int third_charid,int flags); |
---|
551 | |
---|
552 | // LidLŒ Ï·ÖA |
---|
553 | void map_addnickdb(int charid, const char* nick); |
---|
554 | void map_delnickdb(int charid, const char* nick); |
---|
555 | void map_reqnickdb(struct map_session_data* sd,int charid); |
---|
556 | const char* map_charid2nick(int charid); |
---|
557 | struct map_session_data* map_charid2sd(int charid); |
---|
558 | |
---|
559 | struct map_session_data * map_id2sd(int id); |
---|
560 | struct mob_data * map_id2md(int id); |
---|
561 | struct npc_data * map_id2nd(int id); |
---|
562 | struct block_list * map_id2bl(int id); |
---|
563 | |
---|
564 | #define map_id2index(id) map[(id)].index |
---|
565 | int map_mapindex2mapid(unsigned short mapindex); |
---|
566 | int map_mapname2mapid(const char* name); |
---|
567 | int map_mapname2ipport(unsigned short name, uint32* ip, uint16* port); |
---|
568 | int map_setipport(unsigned short map, uint32 ip, uint16 port); |
---|
569 | int map_eraseipport(unsigned short map, uint32 ip, uint16 port); |
---|
570 | int map_eraseallipport(void); |
---|
571 | void map_addiddb(struct block_list *); |
---|
572 | void map_deliddb(struct block_list *bl); |
---|
573 | void map_foreachpc(int (*func)(struct map_session_data* sd, va_list args), ...); |
---|
574 | void map_foreachmob(int (*func)(struct mob_data* md, va_list args), ...); |
---|
575 | void map_foreachnpc(int (*func)(struct npc_data* bl, va_list args), ...); |
---|
576 | void map_foreachiddb(int (*func)(struct block_list* bl, va_list args), ...); |
---|
577 | struct map_session_data * map_nick2sd(const char*); |
---|
578 | |
---|
579 | /// Bitfield of flags for the iterator. |
---|
580 | enum e_mapitflags |
---|
581 | { |
---|
582 | MAPIT_NORMAL = 0, |
---|
583 | // MAPIT_PCISPLAYING = 1,// Unneeded as pc_db/id_db will only hold auth'ed, active players. |
---|
584 | }; |
---|
585 | struct s_mapiterator; |
---|
586 | struct s_mapiterator* mapit_alloc(enum e_mapitflags flags, enum bl_type types); |
---|
587 | void mapit_free(struct s_mapiterator* mapit); |
---|
588 | struct block_list* mapit_first(struct s_mapiterator* mapit); |
---|
589 | struct block_list* mapit_last(struct s_mapiterator* mapit); |
---|
590 | struct block_list* mapit_next(struct s_mapiterator* mapit); |
---|
591 | struct block_list* mapit_prev(struct s_mapiterator* mapit); |
---|
592 | bool mapit_exists(struct s_mapiterator* mapit); |
---|
593 | #define mapit_getallusers() mapit_alloc(MAPIT_NORMAL,BL_PC) |
---|
594 | #define mapit_geteachpc() mapit_alloc(MAPIT_NORMAL,BL_PC) |
---|
595 | #define mapit_geteachmob() mapit_alloc(MAPIT_NORMAL,BL_MOB) |
---|
596 | #define mapit_geteachnpc() mapit_alloc(MAPIT_NORMAL,BL_NPC) |
---|
597 | #define mapit_geteachiddb() mapit_alloc(MAPIT_NORMAL,BL_ALL) |
---|
598 | |
---|
599 | // »ÌŒ |
---|
600 | int map_check_dir(int s_dir,int t_dir); |
---|
601 | unsigned char map_calc_dir( struct block_list *src,int x,int y); |
---|
602 | int map_random_dir(struct block_list *bl, short *x, short *y); // [Skotlex] |
---|
603 | |
---|
604 | int cleanup_sub(struct block_list *bl, va_list ap); |
---|
605 | |
---|
606 | void map_helpscreen(int flag); // [Valaris] |
---|
607 | int map_delmap(char* mapname); |
---|
608 | |
---|
609 | int map_addmobtolist(unsigned short m, struct spawn_data *spawn); // [Wizputer] |
---|
610 | void map_spawnmobs(int); // [Wizputer] |
---|
611 | void map_removemobs(int); // [Wizputer] |
---|
612 | void do_reconnect_map(void); //Invoked on map-char reconnection [Skotlex] |
---|
613 | |
---|
614 | extern char *INTER_CONF_NAME; |
---|
615 | extern char *LOG_CONF_NAME; |
---|
616 | extern char *MAP_CONF_NAME; |
---|
617 | extern char *BATTLE_CONF_FILENAME; |
---|
618 | extern char *ATCOMMAND_CONF_FILENAME; |
---|
619 | extern char *CHARCOMMAND_CONF_FILENAME; |
---|
620 | extern char *SCRIPT_CONF_NAME; |
---|
621 | extern char *MSG_CONF_NAME; |
---|
622 | extern char *GRF_PATH_FILENAME; |
---|
623 | |
---|
624 | extern char *map_server_dns; |
---|
625 | |
---|
626 | //Useful typedefs from jA [Skotlex] |
---|
627 | typedef struct map_session_data TBL_PC; |
---|
628 | typedef struct npc_data TBL_NPC; |
---|
629 | typedef struct mob_data TBL_MOB; |
---|
630 | typedef struct flooritem_data TBL_ITEM; |
---|
631 | typedef struct chat_data TBL_CHAT; |
---|
632 | typedef struct skill_unit TBL_SKILL; |
---|
633 | typedef struct pet_data TBL_PET; |
---|
634 | typedef struct homun_data TBL_HOM; |
---|
635 | |
---|
636 | #define BL_CAST(type_, bl) \ |
---|
637 | ( ((bl) == (struct block_list*)NULL || (bl)->type != (type_)) ? (T ## type_ *)NULL : (T ## type_ *)(bl) ) |
---|
638 | |
---|
639 | |
---|
640 | extern int lowest_gm_level; |
---|
641 | extern char main_chat_nick[16]; |
---|
642 | |
---|
643 | #ifndef TXT_ONLY |
---|
644 | |
---|
645 | #include "../common/sql.h" |
---|
646 | |
---|
647 | extern int db_use_sqldbs; |
---|
648 | |
---|
649 | extern Sql* mmysql_handle; |
---|
650 | extern Sql* logmysql_handle; |
---|
651 | |
---|
652 | extern char item_db_db[32]; |
---|
653 | extern char item_db2_db[32]; |
---|
654 | extern char mob_db_db[32]; |
---|
655 | extern char mob_db2_db[32]; |
---|
656 | extern char char_db[32]; |
---|
657 | |
---|
658 | #endif /* not TXT_ONLY */ |
---|
659 | |
---|
660 | #endif /* _MAP_H_ */ |
---|