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