summaryrefslogtreecommitdiff
path: root/src/map/map.h
diff options
context:
space:
mode:
authorSusu <bruant.bastien@gmail.com>2013-06-07 20:03:32 +0200
committerSusu <bruant.bastien@gmail.com>2013-06-07 20:03:32 +0200
commitd73783f22b2bb881aab74524d153d89a5932a199 (patch)
treefeea3cd428cee18be3da9bf0bee6d4570d9cad02 /src/map/map.h
parentdc7f14c7dc9829061f8902354367bdc8467eb841 (diff)
downloadhercules-d73783f22b2bb881aab74524d153d89a5932a199.tar.gz
hercules-d73783f22b2bb881aab74524d153d89a5932a199.tar.bz2
hercules-d73783f22b2bb881aab74524d153d89a5932a199.tar.xz
hercules-d73783f22b2bb881aab74524d153d89a5932a199.zip
Hercules Renewal Phase One : pc, party, map, timer
Added iPc, iParty, iMap, iTimer to HPM exported interfaces
Diffstat (limited to 'src/map/map.h')
-rw-r--r--src/map/map.h444
1 files changed, 235 insertions, 209 deletions
diff --git a/src/map/map.h b/src/map/map.h
index c8c1aae12..9126f39a7 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -1,32 +1,24 @@
// Copyright (c) Hercules Dev Team, licensed under GNU GPL.
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-
#ifndef _MAP_H_
#define _MAP_H_
-
#include "../common/cbasetypes.h"
#include "../common/core.h" // CORE_ST_LAST
#include "../common/mmo.h"
#include "../common/mapindex.h"
#include "../common/db.h"
-
#include "../config/core.h"
-
#include "atcommand.h"
-
#include <stdarg.h>
-
struct npc_data;
struct item_data;
struct hChSysCh;
-
enum E_MAPSERVER_ST {
MAPSERVER_ST_RUNNING = CORE_ST_LAST,
MAPSERVER_ST_SHUTDOWN,
MAPSERVER_ST_LAST
};
-
#define MAX_NPC_PER_MAP 512
#define AREA_SIZE battle_config.area_size
#define DAMAGELOG_SIZE 30
@@ -42,37 +34,32 @@ enum E_MAPSERVER_ST {
#define MAX_IGNORE_LIST 20 // official is 14
#define MAX_VENDING 12
#define MAX_MAP_SIZE 512*512 // Wasn't there something like this already? Can't find it.. [Shinryo]
-
// Added definitions for WoESE objects. [L0ne_W0lf]
enum MOBID {
- MOBID_EMPERIUM = 1288,
- MOBID_TREAS01 = 1324,
- MOBID_TREAS40 = 1363,
- MOBID_BARRICADE1 = 1905,
- MOBID_BARRICADE2,
- MOBID_GUARIDAN_STONE1,
- MOBID_GUARIDAN_STONE2,
- MOBID_FOOD_STOR,
- MOBID_BLUE_CRYST = 1914,
- MOBID_PINK_CRYST,
- MOBID_TREAS41 = 1938,
- MOBID_TREAS49 = 1946,
- MOBID_SILVERSNIPER = 2042,
- MOBID_MAGICDECOY_WIND = 2046,
+ MOBID_EMPERIUM = 1288,
+ MOBID_TREAS01 = 1324,
+ MOBID_TREAS40 = 1363,
+ MOBID_BARRICADE1 = 1905,
+ MOBID_BARRICADE2,
+ MOBID_GUARIDAN_STONE1,
+ MOBID_GUARIDAN_STONE2,
+ MOBID_FOOD_STOR,
+ MOBID_BLUE_CRYST = 1914,
+ MOBID_PINK_CRYST,
+ MOBID_TREAS41 = 1938,
+ MOBID_TREAS49 = 1946,
+ MOBID_SILVERSNIPER = 2042,
+ MOBID_MAGICDECOY_WIND = 2046,
};
-
// The following system marks a different job ID system used by the map server,
// which makes a lot more sense than the normal one. [Skotlex]
-//
// These marks the "level" of the job.
#define JOBL_2_1 0x100 //256
#define JOBL_2_2 0x200 //512
#define JOBL_2 0x300
-
#define JOBL_UPPER 0x1000 //4096
#define JOBL_BABY 0x2000 //8192
#define JOBL_THIRD 0x4000 //16384
-
// For filtering and quick checking.
#define MAPID_BASEMASK 0x00ff
#define MAPID_UPPERMASK 0x0fff
@@ -81,7 +68,7 @@ enum MOBID {
//Note the oddity of the novice:
//Super Novices are considered the 2-1 version of the novice! Novices are considered a first class type.
enum {
-//Novice And 1-1 Jobs
+ //Novice And 1-1 Jobs
MAPID_NOVICE = 0x0,
MAPID_SWORDMAN,
MAPID_MAGE,
@@ -96,7 +83,7 @@ enum {
MAPID_XMAS,
MAPID_SUMMER,
MAPID_GANGSI,
-//2-1 Jobs
+ //2-1 Jobs
MAPID_SUPER_NOVICE = JOBL_2_1|0x0,
MAPID_KNIGHT,
MAPID_WIZARD,
@@ -107,7 +94,7 @@ enum {
MAPID_STAR_GLADIATOR,
MAPID_KAGEROUOBORO = JOBL_2_1|0x0A,
MAPID_DEATH_KNIGHT = JOBL_2_1|0x0E,
-//2-2 Jobs
+ //2-2 Jobs
MAPID_CRUSADER = JOBL_2_2|0x1,
MAPID_SAGE,
MAPID_BARDDANCER,
@@ -116,7 +103,7 @@ enum {
MAPID_ROGUE,
MAPID_SOUL_LINKER,
MAPID_DARK_COLLECTOR = JOBL_2_2|0x0D,
-//Trans Novice And Trans 1-1 Jobs
+ //Trans Novice And Trans 1-1 Jobs
MAPID_NOVICE_HIGH = JOBL_UPPER|0x0,
MAPID_SWORDMAN_HIGH,
MAPID_MAGE_HIGH,
@@ -124,21 +111,21 @@ enum {
MAPID_ACOLYTE_HIGH,
MAPID_MERCHANT_HIGH,
MAPID_THIEF_HIGH,
-//Trans 2-1 Jobs
+ //Trans 2-1 Jobs
MAPID_LORD_KNIGHT = JOBL_UPPER|JOBL_2_1|0x1,
MAPID_HIGH_WIZARD,
MAPID_SNIPER,
MAPID_HIGH_PRIEST,
MAPID_WHITESMITH,
MAPID_ASSASSIN_CROSS,
-//Trans 2-2 Jobs
+ //Trans 2-2 Jobs
MAPID_PALADIN = JOBL_UPPER|JOBL_2_2|0x1,
MAPID_PROFESSOR,
MAPID_CLOWNGYPSY,
MAPID_CHAMPION,
MAPID_CREATOR,
MAPID_STALKER,
-//Baby Novice And Baby 1-1 Jobs
+ //Baby Novice And Baby 1-1 Jobs
MAPID_BABY = JOBL_BABY|0x0,
MAPID_BABY_SWORDMAN,
MAPID_BABY_MAGE,
@@ -146,7 +133,7 @@ enum {
MAPID_BABY_ACOLYTE,
MAPID_BABY_MERCHANT,
MAPID_BABY_THIEF,
-//Baby 2-1 Jobs
+ //Baby 2-1 Jobs
MAPID_SUPER_BABY = JOBL_BABY|JOBL_2_1|0x0,
MAPID_BABY_KNIGHT,
MAPID_BABY_WIZARD,
@@ -154,14 +141,14 @@ enum {
MAPID_BABY_PRIEST,
MAPID_BABY_BLACKSMITH,
MAPID_BABY_ASSASSIN,
-//Baby 2-2 Jobs
+ //Baby 2-2 Jobs
MAPID_BABY_CRUSADER = JOBL_BABY|JOBL_2_2|0x1,
MAPID_BABY_SAGE,
MAPID_BABY_BARDDANCER,
MAPID_BABY_MONK,
MAPID_BABY_ALCHEMIST,
MAPID_BABY_ROGUE,
-//3-1 Jobs
+ //3-1 Jobs
MAPID_SUPER_NOVICE_E = JOBL_THIRD|JOBL_2_1|0x0,
MAPID_RUNE_KNIGHT,
MAPID_WARLOCK,
@@ -169,28 +156,28 @@ enum {
MAPID_ARCH_BISHOP,
MAPID_MECHANIC,
MAPID_GUILLOTINE_CROSS,
-//3-2 Jobs
+ //3-2 Jobs
MAPID_ROYAL_GUARD = JOBL_THIRD|JOBL_2_2|0x1,
MAPID_SORCERER,
MAPID_MINSTRELWANDERER,
MAPID_SURA,
MAPID_GENETIC,
MAPID_SHADOW_CHASER,
-//Trans 3-1 Jobs
+ //Trans 3-1 Jobs
MAPID_RUNE_KNIGHT_T = JOBL_THIRD|JOBL_UPPER|JOBL_2_1|0x1,
MAPID_WARLOCK_T,
MAPID_RANGER_T,
MAPID_ARCH_BISHOP_T,
MAPID_MECHANIC_T,
MAPID_GUILLOTINE_CROSS_T,
-//Trans 3-2 Jobs
+ //Trans 3-2 Jobs
MAPID_ROYAL_GUARD_T = JOBL_THIRD|JOBL_UPPER|JOBL_2_2|0x1,
MAPID_SORCERER_T,
MAPID_MINSTRELWANDERER_T,
MAPID_SURA_T,
MAPID_GENETIC_T,
MAPID_SHADOW_CHASER_T,
-//Baby 3-1 Jobs
+ //Baby 3-1 Jobs
MAPID_SUPER_BABY_E = JOBL_THIRD|JOBL_BABY|JOBL_2_1|0x0,
MAPID_BABY_RUNE,
MAPID_BABY_WARLOCK,
@@ -198,7 +185,7 @@ enum {
MAPID_BABY_BISHOP,
MAPID_BABY_MECHANIC,
MAPID_BABY_CROSS,
-//Baby 3-2 Jobs
+ //Baby 3-2 Jobs
MAPID_BABY_GUARD = JOBL_THIRD|JOBL_BABY|JOBL_2_2|0x1,
MAPID_BABY_SORCERER,
MAPID_BABY_MINSTRELWANDERER,
@@ -206,7 +193,6 @@ enum {
MAPID_BABY_GENETIC,
MAPID_BABY_CHASER,
};
-
// Max size for inputs to Graffiti, Talkie Box and Vending text prompts
#define MESSAGE_SIZE (79 + 1)
// String length you can write in the 'talking box'
@@ -218,14 +204,12 @@ enum {
#define CHAT_SIZE_MAX (255 + 1)
// 24 for npc name + 24 for label + 2 for a "::" and 1 for EOS
#define EVENT_NAME_LENGTH ( NAME_LENGTH * 2 + 3 )
-
#define DEFAULT_AUTOSAVE_INTERVAL 5*60*1000
-
// Specifies maps where players may hit each other
-#define map_flag_vs(m) (map[m].flag.pvp || map[m].flag.gvg_dungeon || map[m].flag.gvg || ((agit_flag || agit2_flag) && map[m].flag.gvg_castle) || map[m].flag.battleground)
+#define map_flag_vs(m) (map[m].flag.pvp || map[m].flag.gvg_dungeon || map[m].flag.gvg || ((iMap->agit_flag || iMap->agit2_flag) && map[m].flag.gvg_castle) || map[m].flag.battleground)
// Specifies maps that have special GvG/WoE restrictions
-#define map_flag_gvg(m) (map[m].flag.gvg || ((agit_flag || agit2_flag) && map[m].flag.gvg_castle))
-// Specifies if the map is tagged as GvG/WoE (regardless of agit_flag status)
+#define map_flag_gvg(m) (map[m].flag.gvg || ((iMap->agit_flag || iMap->agit2_flag) && map[m].flag.gvg_castle))
+// Specifies if the map is tagged as GvG/WoE (regardless of iMap->agit_flag status)
#define map_flag_gvg2(m) (map[m].flag.gvg || map[m].flag.gvg_castle)
// No Kill Steal Protection
#define map_flag_ks(m) (map[m].flag.town || map[m].flag.pvp || map[m].flag.gvg || map[m].flag.battleground)
@@ -326,8 +310,8 @@ struct spawn_data {
struct {
unsigned int size : 2; //Holds if mob has to be tiny/large
unsigned int ai : 4; //Special ai for summoned monsters.
- //0: Normal mob | 1: Standard summon, attacks mobs
- //2: Alchemist Marine Sphere | 3: Alchemist Summon Flora | 4: Summon Zanzou
+ //0: Normal mob | 1: Standard summon, attacks mobs
+ //2: Alchemist Marine Sphere | 3: Alchemist Summon Flora | 4: Summon Zanzou
unsigned int dynamic : 1; //Whether this data is indexed by a map's dynamic mob list
unsigned int boss : 1; //0: Non-boss monster | 1: Boss monster
} state;
@@ -441,7 +425,7 @@ typedef enum {
} cell_t;
-// used by map_getcell()
+// used by iMap->getcell()
typedef enum {
CELL_GETTYPE, // retrieves a cell's 'gat' type
@@ -469,19 +453,19 @@ struct mapcell
{
// terrain flags
unsigned char
- walkable : 1,
- shootable : 1,
- water : 1;
+walkable : 1,
+shootable : 1,
+water : 1;
// dynamic flags
unsigned char
- npc : 1,
- basilica : 1,
- landprotector : 1,
- novending : 1,
- nochat : 1,
- maelstrom : 1,
- icewall : 1;
+npc : 1,
+basilica : 1,
+landprotector : 1,
+novending : 1,
+nochat : 1,
+maelstrom : 1,
+icewall : 1;
#ifdef CELL_NOSTACK
unsigned char cell_bl; //Holds amount of bls in this cell.
@@ -504,7 +488,7 @@ enum map_zone_skill_subtype {
MZS_NONE = 0x0,
MZS_CLONE = 0x01,
MZS_BOSS = 0x02,
-
+
MZS_ALL = 0xFFF,
};
@@ -547,11 +531,6 @@ struct map_zone_data {
struct map_zone_skill_damage_cap_entry **capped_skills;
int capped_skills_count;
};
-void map_zone_init(void);
-void map_zone_remove(int m);
-void map_zone_apply(int m, struct map_zone_data *zone, const char* start, const char* buffer, const char* filepath);
-void map_zone_change(int m, struct map_zone_data *zone, const char* start, const char* buffer, const char* filepath);
-void map_zone_change2(int m, struct map_zone_data *zone);
struct map_zone_data map_zone_all;/* used as a base on all maps */
struct map_zone_data map_zone_pk;/* used for (pk_mode) */
@@ -638,35 +617,35 @@ struct map_data {
int bexp; // map experience multiplicator
int nocommand; //Blocks @/# commands for non-gms. [Skotlex]
/**
- * Ice wall reference counter for bugreport:3574
- * - since there are a thounsand mobs out there in a lot of maps checking on,
- * - every targetting for icewall on attack path would just be a waste, so,
- * - this counter allows icewall checking be only run when there is a actual ice wall on the map
- **/
+ * Ice wall reference counter for bugreport:3574
+ * - since there are a thounsand mobs out there in a lot of maps checking on,
+ * - every targetting for icewall on attack path would just be a waste, so,
+ * - this counter allows icewall checking be only run when there is a actual ice wall on the map
+ **/
int icewall_num;
// Instance Variables
int instance_id;
int instance_src_map;
-
+
/* adjust_unit_duration mapflag */
struct mapflag_skill_adjust **units;
unsigned short unit_count;
/* adjust_skill_damage mapflag */
struct mapflag_skill_adjust **skills;
unsigned short skill_count;
-
+
/* Hercules nocast db overhaul */
struct map_zone_data *zone;
char **zone_mf;/* used to store this map's zone mapflags that should be re-applied once zone is removed */
unsigned short zone_mf_count;
struct map_zone_data *prev_zone;
-
+
/* Hercules Local Chat */
struct hChSysCh *channel;
-
+
/* invincible_time_inc mapflag */
unsigned int invincible_time_inc;
-
+
/* weapon_damage_rate mapflag */
unsigned short weapon_damage_rate;
/* magic_damage_rate mapflag */
@@ -677,10 +656,10 @@ struct map_data {
unsigned short short_damage_rate;
/* long_damage_rate mapflag */
unsigned short long_damage_rate;
-
+
/* instance unique name */
char *cName;
-
+
/* */
int (*getcellp)(struct map_data* m,int16 x,int16 y,cell_chk cellchk);
void (*setcell) (int16 m, int16 x, int16 y, cell_t cell, bool flag);
@@ -697,112 +676,35 @@ struct map_data_other_server {
uint16 port;
};
-int map_getcell(int16 m,int16 x,int16 y,cell_chk cellchk);
-void map_setgatcell(int16 m, int16 x, int16 y, int gat);
struct map_data *map;
-extern int map_num;
-
-extern int autosave_interval;
-extern int minsave_interval;
-extern int save_settings;
-extern int agit_flag;
-extern int agit2_flag;
-extern int night_flag; // 0=day, 1=night [Yor]
-extern int enable_spy; //Determines if @spy commands are active.
-extern char db_path[256];
-
-extern char help_txt[];
-extern char help2_txt[];
-extern char charhelp_txt[];
-
-extern char wisp_server_name[];
-
-void map_cellfromcache(struct map_data *m);
-
-// users
-void map_setusers(int);
-int map_getusers(void);
-int map_usercount(void);
-
-// blocklist lock
-int map_freeblock(struct block_list *bl);
-int map_freeblock_lock(void);
-int map_freeblock_unlock(void);
-// blocklist manipulation
-int map_addblock(struct block_list* bl);
-int map_delblock(struct block_list* bl);
-int map_moveblock(struct block_list *, int, int, unsigned int);
-int map_foreachinrange(int (*func)(struct block_list*,va_list), struct block_list* center, int16 range, int type, ...);
-int map_foreachinshootrange(int (*func)(struct block_list*,va_list), struct block_list* center, int16 range, int type, ...);
-int map_foreachinarea(int (*func)(struct block_list*,va_list), int16 m, int16 x0, int16 y0, int16 x1, int16 y1, int type, ...);
-int map_forcountinrange(int (*func)(struct block_list*,va_list), struct block_list* center, int16 range, int count, int type, ...);
-int map_forcountinarea(int (*func)(struct block_list*,va_list), int16 m, int16 x0, int16 y0, int16 x1, int16 y1, int count, int type, ...);
-int map_foreachinmovearea(int (*func)(struct block_list*,va_list), struct block_list* center, int16 range, int16 dx, int16 dy, int type, ...);
-int map_foreachincell(int (*func)(struct block_list*,va_list), int16 m, int16 x, int16 y, int type, ...);
-int map_foreachinpath(int (*func)(struct block_list*,va_list), int16 m, int16 x0, int16 y0, int16 x1, int16 y1, int16 range, int length, int type, ...);
-int map_foreachinmap(int (*func)(struct block_list*,va_list), int16 m, int type, ...);
-int map_foreachininstance(int (*func)(struct block_list*,va_list), int16 instance_id, int type,...);
-//blocklist nb in one cell
-int map_count_oncell(int16 m,int16 x,int16 y,int type);
-struct skill_unit *map_find_skill_unit_oncell(struct block_list *,int16 x,int16 y,uint16 skill_id,struct skill_unit *, int flag);
-// search and creation
-int map_get_new_object_id(void);
-int map_search_freecell(struct block_list *src, int16 m, int16 *x, int16 *y, int16 rx, int16 ry, int flag);
+
+
+
+
+
+
+//int map_foreachinrange(int (*func)(struct block_list*,va_list), struct block_list* center, int16 range, int type, ...);
+//int map_foreachinshootrange(int (*func)(struct block_list*,va_list), struct block_list* center, int16 range, int type, ...);
+//int map_foreachinarea(int (*func)(struct block_list*,va_list), int16 m, int16 x0, int16 y0, int16 x1, int16 y1, int type, ...);
+//int map_forcountinrange(int (*func)(struct block_list*,va_list), struct block_list* center, int16 range, int count, int type, ...);
+//int map_forcountinarea(int (*func)(struct block_list*,va_list), int16 m, int16 x0, int16 y0, int16 x1, int16 y1, int count, int type, ...);
+//int map_foreachinmovearea(int (*func)(struct block_list*,va_list), struct block_list* center, int16 range, int16 dx, int16 dy, int type, ...);
+//int map_foreachincell(int (*func)(struct block_list*,va_list), int16 m, int16 x, int16 y, int type, ...);
+//int map_foreachinpath(int (*func)(struct block_list*,va_list), int16 m, int16 x0, int16 y0, int16 x1, int16 y1, int16 range, int length, int type, ...);
+//int map_foreachinmap(int (*func)(struct block_list*,va_list), int16 m, int type, ...);
+//int map_foreachininstance(int (*func)(struct block_list*,va_list), int16 instance_id, int type,...);
//
-int map_quit(struct map_session_data *);
-// npc
-bool map_addnpc(int16 m,struct npc_data *);
-
-// map item
-int map_clearflooritem_timer(int tid, unsigned int tick, int id, intptr_t data);
-int map_removemobs_timer(int tid, unsigned int tick, int id, intptr_t data);
-void map_clearflooritem(struct block_list* bl);
-int map_addflooritem(struct item *item_data,int amount,int16 m,int16 x,int16 y,int first_charid,int second_charid,int third_charid,int flags);
-
-// player to map session
-void map_addnickdb(int charid, const char* nick);
-void map_delnickdb(int charid, const char* nick);
-void map_reqnickdb(struct map_session_data* sd,int charid);
-const char* map_charid2nick(int charid);
-struct map_session_data* map_charid2sd(int charid);
-
-struct map_session_data * map_id2sd(int id);
-struct mob_data * map_id2md(int id);
-struct npc_data * map_id2nd(int id);
-struct homun_data* map_id2hd(int id);
-struct mercenary_data* map_id2mc(int id);
-struct chat_data* map_id2cd(int id);
-struct block_list * map_id2bl(int id);
-bool map_blid_exists( int id );
+
+
+
#define map_id2index(id) map[(id)].index
-int16 map_mapindex2mapid(unsigned short mapindex);
-int16 map_mapname2mapid(const char* name);
-int map_mapname2ipport(unsigned short name, uint32* ip, uint16* port);
-int map_setipport(unsigned short map, uint32 ip, uint16 port);
-int map_eraseipport(unsigned short map, uint32 ip, uint16 port);
-int map_eraseallipport(void);
-void map_addiddb(struct block_list *);
-void map_deliddb(struct block_list *bl);
-/* temporary until the map.c "Hercules Renewal Phase One" design is complete. */
-void (*map_foreachpc) (int (*func)(struct map_session_data* sd, va_list args), ...);
-void (*map_foreachmob) (int (*func)(struct mob_data* md, va_list args), ...);
-void (*map_foreachnpc) (int (*func)(struct npc_data* nd, va_list args), ...);
-void (*map_foreachregen) (int (*func)(struct block_list* bl, va_list args), ...);
-void (*map_foreachiddb) (int (*func)(struct block_list* bl, va_list args), ...);
-/* */
-struct map_session_data * map_nick2sd(const char*);
-struct mob_data * map_getmob_boss(int16 m);
-struct mob_data * map_id2boss(int id);
-
-// reload config file looking only for npcs
-void map_reloadnpc(bool clear);
/// Bitfield of flags for the iterator.
enum e_mapitflags {
MAPIT_NORMAL = 0,
-// MAPIT_PCISPLAYING = 1,// Unneeded as pc_db/id_db will only hold auth'ed, active players.
+ // MAPIT_PCISPLAYING = 1,// Unneeded as pc_db/id_db will only hold auth'ed, active players.
};
struct s_mapiterator;
/* temporary until the map.c "Hercules Renewal Phase One" design is complete. */
@@ -822,35 +724,11 @@ struct mapit_interface *mapit;
#define mapit_geteachnpc() mapit->alloc(MAPIT_NORMAL,BL_NPC)
#define mapit_geteachiddb() mapit->alloc(MAPIT_NORMAL,BL_ALL)
-int map_check_dir(int s_dir,int t_dir);
-uint8 map_calc_dir( struct block_list *src,int16 x,int16 y);
-int map_random_dir(struct block_list *bl, short *x, short *y); // [Skotlex]
-int cleanup_sub(struct block_list *bl, va_list ap);
-int map_delmap(char* mapname);
-void map_flags_init(void);
-bool map_iwall_set(int16 m, int16 x, int16 y, int size, int8 dir, bool shootable, const char* wall_name);
-void map_iwall_get(struct map_session_data *sd);
-void map_iwall_remove(const char *wall_name);
-int map_addmobtolist(unsigned short m, struct spawn_data *spawn); // [Wizputer]
-void map_spawnmobs(int16 m); // [Wizputer]
-void map_removemobs(int16 m); // [Wizputer]
-void do_reconnect_map(void); //Invoked on map-char reconnection [Skotlex]
-void map_addmap2db(struct map_data *m);
-void map_removemapdb(struct map_data *m);
-void map_clean(int i);
-extern char *INTER_CONF_NAME;
-extern char *LOG_CONF_NAME;
-extern char *MAP_CONF_NAME;
-extern char *BATTLE_CONF_FILENAME;
-extern char *ATCOMMAND_CONF_FILENAME;
-extern char *SCRIPT_CONF_NAME;
-extern char *MSG_CONF_NAME;
-extern char *GRF_PATH_FILENAME;
//Useful typedefs from jA [Skotlex]
typedef struct map_session_data TBL_PC;
@@ -869,19 +747,167 @@ typedef struct elemental_data TBL_ELEM;
#include "../common/sql.h"
-extern int db_use_sqldbs;
extern Sql* mmysql_handle;
extern Sql* logmysql_handle;
-extern char item_db_db[32];
-extern char item_db2_db[32];
-extern char item_db_re_db[32];
-extern char mob_db_db[32];
-extern char mob_db2_db[32];
-extern char mob_skill_db_db[32];
-extern char mob_skill_db2_db[32];
-void do_shutdown(void);
+
+/*=====================================
+* Interface : map.h
+* Generated by HerculesInterfaceMaker
+* created by Susu
+*-------------------------------------*/
+struct map_interface {
+
+ /* vars */
+ int map_num;
+
+ int autosave_interval;
+ int minsave_interval;
+ int save_settings;
+ int agit_flag;
+ int agit2_flag;
+ int night_flag; // 0=day, 1=night [Yor]
+ int enable_spy; //Determines if @spy commands are active.
+ char db_path[256];
+
+ char help_txt[256];
+ char help2_txt[256];
+ char charhelp_txt[256];
+
+ char wisp_server_name[NAME_LENGTH];
+
+ char *INTER_CONF_NAME;
+ char *LOG_CONF_NAME;
+ char *MAP_CONF_NAME;
+ char *BATTLE_CONF_FILENAME;
+ char *ATCOMMAND_CONF_FILENAME;
+ char *SCRIPT_CONF_NAME;
+ char *MSG_CONF_NAME;
+ char *GRF_PATH_FILENAME;
+
+ int db_use_sqldbs;
+
+ char item_db_db[32];
+ char item_db2_db[32];
+ char item_db_re_db[32];
+ char mob_db_db[32];
+ char mob_db2_db[32];
+ char mob_skill_db_db[32];
+ char mob_skill_db2_db[32];
+
+ /* funcs */
+ void (*zone_init) (void);
+ void (*zone_remove) (int m);
+ void (*zone_apply) (int m, struct map_zone_data *zone, const char* start, const char* buffer, const char* filepath);
+ void (*zone_change) (int m, struct map_zone_data *zone, const char* start, const char* buffer, const char* filepath);
+ void (*zone_change2) (int m, struct map_zone_data *zone);
+
+ int (*getcell) (int16 m,int16 x,int16 y,cell_chk cellchk);
+ void (*setgatcell) (int16 m, int16 x, int16 y, int gat);
+
+ void (*cellfromcache) (struct map_data *m);
+ // users
+ void (*setusers) (int);
+ int (*getusers) (void);
+ int (*usercount) (void);
+ // blocklist lock
+ int (*freeblock) (struct block_list *bl);
+ int (*freeblock_lock) (void);
+ int (*freeblock_unlock) (void);
+ // blocklist manipulation
+ int (*addblock) (struct block_list* bl);
+ int (*delblock) (struct block_list* bl);
+ int (*moveblock) (struct block_list *, int, int, unsigned int);
+ //blocklist nb in one cell
+ int (*count_oncell) (int16 m,int16 x,int16 y,int type);
+ struct skill_unit * (*find_skill_unit_oncell) (struct block_list *,int16 x,int16 y,uint16 skill_id,struct skill_unit *, int flag);
+ // search and creation
+ int (*get_new_object_id) (void);
+ int (*search_freecell) (struct block_list *src, int16 m, int16 *x, int16 *y, int16 rx, int16 ry, int flag);
+ //
+ int (*quit) (struct map_session_data *);
+ // npc
+ bool (*addnpc) (int16 m,struct npc_data *);
+ // map item
+ int (*clearflooritem_timer) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*removemobs_timer) (int tid, unsigned int tick, int id, intptr_t data);
+ void (*clearflooritem) (struct block_list* bl);
+ int (*addflooritem) (struct item *item_data,int amount,int16 m,int16 x,int16 y,int first_charid,int second_charid,int third_charid,int flags);
+ // player to map session
+ void (*addnickdb) (int charid, const char* nick);
+ void (*delnickdb) (int charid, const char* nick);
+ void (*reqnickdb) (struct map_session_data* sd,int charid);
+ const char* (*charid2nick) (int charid);
+ struct map_session_data* (*charid2sd) (int charid);
+
+ void (*map_foreachpc) (int (*func)(struct map_session_data* sd, va_list args), ...);
+ void (*map_foreachmob) (int (*func)(struct mob_data* md, va_list args), ...);
+ void (*map_foreachnpc) (int (*func)(struct npc_data* nd, va_list args), ...);
+ void (*map_foreachregen) (int (*func)(struct block_list* bl, va_list args), ...);
+ void (*map_foreachiddb) (int (*func)(struct block_list* bl, va_list args), ...);
+
+ int (*foreachinrange) (int (*func)(struct block_list*,va_list), struct block_list* center, int16 range, int type, ...);
+ int (*foreachinshootrange) (int (*func)(struct block_list*,va_list), struct block_list* center, int16 range, int type, ...);
+ int (*foreachinarea) (int (*func)(struct block_list*,va_list), int16 m, int16 x0, int16 y0, int16 x1, int16 y1, int type, ...);
+ int (*forcountinrange) (int (*func)(struct block_list*,va_list), struct block_list* center, int16 range, int count, int type, ...);
+ int (*forcountinarea) (int (*func)(struct block_list*,va_list), int16 m, int16 x0, int16 y0, int16 x1, int16 y1, int count, int type, ...);
+ int (*foreachinmovearea) (int (*func)(struct block_list*,va_list), struct block_list* center, int16 range, int16 dx, int16 dy, int type, ...);
+ int (*foreachincell) (int (*func)(struct block_list*,va_list), int16 m, int16 x, int16 y, int type, ...);
+ int (*foreachinpath) (int (*func)(struct block_list*,va_list), int16 m, int16 x0, int16 y0, int16 x1, int16 y1, int16 range, int length, int type, ...);
+ int (*foreachinmap) (int (*func)(struct block_list*,va_list), int16 m, int type, ...);
+ int (*foreachininstance)(int (*func)(struct block_list*,va_list), int16 instance_id, int type,...);
+
+ struct map_session_data * (*id2sd) (int id);
+ struct mob_data * (*id2md) (int id);
+ struct npc_data * (*id2nd) (int id);
+ struct homun_data* (*id2hd) (int id);
+ struct mercenary_data* (*id2mc) (int id);
+ struct chat_data* (*id2cd) (int id);
+ struct block_list * (*id2bl) (int id);
+ bool (*blid_exists) (int id);
+ int16 (*mapindex2mapid) (unsigned short mapindex);
+ int16 (*mapname2mapid) (const char* name);
+ int (*mapname2ipport) (unsigned short name, uint32* ip, uint16* port);
+ int (*setipport) (unsigned short map, uint32 ip, uint16 port);
+ int (*eraseipport) (unsigned short map, uint32 ip, uint16 port);
+ int (*eraseallipport) (void);
+ void (*addiddb) (struct block_list *);
+ void (*deliddb) (struct block_list *bl);
+ /* */
+ struct map_session_data * (*nick2sd) (const char*);
+ struct mob_data * (*getmob_boss) (int16 m);
+ struct mob_data * (*id2boss) (int id);
+ // reload config file looking only for npcs
+ void (*reloadnpc) (bool clear);
+
+ int (*check_dir) (int s_dir,int t_dir);
+ uint8 (*calc_dir) (struct block_list *src,int16 x,int16 y);
+ int (*random_dir) (struct block_list *bl, short *x, short *y); // [Skotlex]
+
+ int (*cleanup_sub) (struct block_list *bl, va_list ap);
+
+ int (*delmap) (char* mapname);
+ void (*flags_init) (void);
+
+ bool (*iwall_set) (int16 m, int16 x, int16 y, int size, int8 dir, bool shootable, const char* wall_name);
+ void (*iwall_get) (struct map_session_data *sd);
+ void (*iwall_remove) (const char *wall_name);
+
+ int (*addmobtolist) (unsigned short m, struct spawn_data *spawn); // [Wizputer]
+ void (*spawnmobs) (int16 m); // [Wizputer]
+ void (*removemobs) (int16 m); // [Wizputer]
+ void (*do_reconnect_map) (void); //Invoked on map-char reconnection [Skotlex] Note used but still keeping it, just in case
+ void (*addmap2db) (struct map_data *m);
+ void (*removemapdb) (struct map_data *m);
+ void (*clean) (int i);
+
+ void (*do_shutdown) (void);
+} iMap_s;
+
+struct map_interface *iMap;
+
+void map_defaults(void);
#endif /* _MAP_H_ */