summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/atcommand.c489
-rw-r--r--src/map/battle.c246
-rw-r--r--src/map/battleground.c10
-rw-r--r--src/map/buyingstore.c23
-rw-r--r--src/map/chat.c74
-rw-r--r--src/map/chrif.c64
-rw-r--r--src/map/clif.c304
-rw-r--r--src/map/duel.c4
-rw-r--r--src/map/elemental.c22
-rw-r--r--src/map/guild.c151
-rw-r--r--src/map/homunculus.c24
-rw-r--r--src/map/instance.c32
-rw-r--r--src/map/intif.c101
-rw-r--r--src/map/itemdb.c37
-rw-r--r--src/map/log.c2
-rw-r--r--src/map/map.c581
-rw-r--r--src/map/map.h12
-rw-r--r--src/map/mercenary.c24
-rw-r--r--src/map/mob.c282
-rw-r--r--src/map/npc.c372
-rw-r--r--src/map/npc_chat.c8
-rw-r--r--src/map/party.c55
-rw-r--r--src/map/pc.c199
-rw-r--r--src/map/pet.c84
-rw-r--r--src/map/quest.c13
-rw-r--r--src/map/script.c966
-rw-r--r--src/map/searchstore.c2
-rw-r--r--src/map/skill.c1093
-rw-r--r--src/map/status.c224
-rw-r--r--src/map/storage.c29
-rw-r--r--src/map/trade.c42
-rw-r--r--src/map/unit.c227
-rw-r--r--src/map/vending.c8
33 files changed, 2694 insertions, 3110 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 9dbe0ab33..f61a4bd45 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -384,8 +384,7 @@ return false;\
/*==========================================
* @rura, @warp, @mapmove
*------------------------------------------*/
-ACMD(mapmove)
-{
+ACMD(mapmove) {
char map_name[MAP_NAME_LENGTH_EXT];
unsigned short mapindex;
short x = 0, y = 0;
@@ -405,17 +404,17 @@ ACMD(mapmove)
mapindex = mapindex_name2id(map_name);
if (mapindex)
- m = iMap->mapindex2mapid(mapindex);
+ m = map->mapindex2mapid(mapindex);
if (!mapindex || m < 0) { // m < 0 means on different server or that map is disabled! [Kevin]
clif->message(fd, msg_txt(1)); // Map not found.
return false;
}
- if ((x || y) && iMap->getcell(m, x, y, CELL_CHKNOPASS) && pc->get_group_level(sd) < battle_config.gm_ignore_warpable_area)
- { //This is to prevent the pc->setpos call from printing an error.
+ if ((x || y) && map->getcell(m, x, y, CELL_CHKNOPASS) && pc->get_group_level(sd) < battle_config.gm_ignore_warpable_area) {
+ //This is to prevent the pc->setpos call from printing an error.
clif->message(fd, msg_txt(2));
- if (!iMap->search_freecell(NULL, m, &x, &y, 10, 10, 1))
+ if (!map->search_freecell(NULL, m, &x, &y, 10, 10, 1))
x = y = 0; //Invalid cell, use random spot.
}
if (maplist[m].flag.nowarpto && !pc->has_permission(sd, PC_PERM_WARP_ANYWHERE)) {
@@ -438,8 +437,7 @@ ACMD(mapmove)
/*==========================================
* Displays where a character is. Corrected version by Silent. [Skotlex]
*------------------------------------------*/
-ACMD(where)
-{
+ACMD(where) {
struct map_session_data* pl_sd;
nullpo_retr(-1, sd);
@@ -450,7 +448,7 @@ ACMD(where)
return false;
}
- pl_sd = iMap->nick2sd(atcmd_player_name);
+ pl_sd = map->nick2sd(atcmd_player_name);
if (pl_sd == NULL ||
strncmp(pl_sd->status.name, atcmd_player_name, NAME_LENGTH) != 0 ||
(pc->has_permission(pl_sd, PC_PERM_HIDE_SESSION) && pc->get_group_level(pl_sd) > pc->get_group_level(sd) && !pc->has_permission(sd, PC_PERM_WHO_DISPLAY_AID))
@@ -478,7 +476,7 @@ ACMD(jumpto) {
return false;
}
- if((pl_sd=iMap->nick2sd((char *)message)) == NULL && (pl_sd=iMap->charid2sd(atoi(message))) == NULL) {
+ if((pl_sd=map->nick2sd((char *)message)) == NULL && (pl_sd=map->charid2sd(atoi(message))) == NULL) {
clif->message(fd, msg_txt(3)); // Character not found.
return false;
}
@@ -529,10 +527,10 @@ ACMD(jump)
return false;
}
- if ((x || y) && iMap->getcell(sd->bl.m, x, y, CELL_CHKNOPASS))
- { //This is to prevent the pc->setpos call from printing an error.
+ if ((x || y) && map->getcell(sd->bl.m, x, y, CELL_CHKNOPASS)) {
+ //This is to prevent the pc->setpos call from printing an error.
clif->message(fd, msg_txt(2));
- if (!iMap->search_freecell(NULL, sd->bl.m, &x, &y, 10, 10, 1))
+ if (!map->search_freecell(NULL, sd->bl.m, &x, &y, 10, 10, 1))
x = y = 0; //Invalid cell, use random spot.
}
@@ -546,8 +544,7 @@ ACMD(jump)
* Display list of online characters with
* various info.
*------------------------------------------*/
-ACMD(who)
-{
+ACMD(who) {
struct map_session_data *pl_sd = NULL;
struct s_mapiterator *iter = NULL;
char map_name[MAP_NAME_LENGTH_EXT] = "";
@@ -566,7 +563,7 @@ ACMD(who)
nullpo_retr(-1, sd);
if (strstr(command, "map") != NULL) {
- if (sscanf(message, "%15s %23s", map_name, player_name) < 1 || (map_id = iMap->mapname2mapid(map_name)) < 0)
+ if (sscanf(message, "%15s %23s", map_name, player_name) < 1 || (map_id = map->mapname2mapid(map_name)) < 0)
map_id = sd->bl.m;
} else {
sscanf(message, "%23s", player_name);
@@ -757,7 +754,7 @@ ACMD(load) {
nullpo_retr(-1, sd);
- m = iMap->mapindex2mapid(sd->status.save_point.map);
+ m = map->mapindex2mapid(sd->status.save_point.map);
if (m >= 0 && maplist[m].flag.nowarpto && !pc->has_permission(sd, PC_PERM_WARP_ANYWHERE)) {
clif->message(fd, msg_txt(249)); // You are not authorized to warp to your save map.
return false;
@@ -908,7 +905,7 @@ ACMD(hide) {
sd->pvp_timer = timer->add( timer->gettick() + 200, pc->calc_pvprank_timer, sd->bl.id, 0 );
}
//bugreport:2266
- iMap->foreachinmovearea(clif->insight, &sd->bl, AREA_SIZE, sd->bl.x, sd->bl.y, BL_ALL, &sd->bl);
+ map->foreachinmovearea(clif->insight, &sd->bl, AREA_SIZE, sd->bl.x, sd->bl.y, BL_ALL, &sd->bl);
} else {
sd->sc.option |= OPTION_INVISIBLE;
sd->vd.class_ = INVISIBLE_CLASS;
@@ -1476,15 +1473,15 @@ ACMD(pvpoff) {
return false;
}
- iMap->zone_change2(sd->bl.m,maplist[sd->bl.m].prev_zone);
+ map->zone_change2(sd->bl.m,maplist[sd->bl.m].prev_zone);
maplist[sd->bl.m].flag.pvp = 0;
if (!battle_config.pk_mode) {
clif->map_property_mapall(sd->bl.m, MAPPROPERTY_NOTHING);
clif->maptypeproperty2(&sd->bl,ALL_SAMEMAP);
}
- iMap->foreachinmap(atcommand_pvpoff_sub,sd->bl.m, BL_PC);
- iMap->foreachinmap(atcommand_stopattack,sd->bl.m, BL_CHAR, 0);
+ map->foreachinmap(atcommand_pvpoff_sub,sd->bl.m, BL_PC);
+ map->foreachinmap(atcommand_stopattack,sd->bl.m, BL_CHAR, 0);
clif->message(fd, msg_txt(31)); // PvP: Off.
return true;
}
@@ -1514,13 +1511,13 @@ ACMD(pvpon) {
return false;
}
- iMap->zone_change2(sd->bl.m,strdb_get(zone_db, MAP_ZONE_PVP_NAME));
+ map->zone_change2(sd->bl.m,strdb_get(zone_db, MAP_ZONE_PVP_NAME));
maplist[sd->bl.m].flag.pvp = 1;
if (!battle_config.pk_mode) {// display pvp circle and rank
clif->map_property_mapall(sd->bl.m, MAPPROPERTY_FREEPVPZONE);
clif->maptypeproperty2(&sd->bl,ALL_SAMEMAP);
- iMap->foreachinmap(atcommand_pvpon_sub,sd->bl.m, BL_PC);
+ map->foreachinmap(atcommand_pvpon_sub,sd->bl.m, BL_PC);
}
clif->message(fd, msg_txt(32)); // PvP: On.
@@ -1539,11 +1536,11 @@ ACMD(gvgoff) {
return false;
}
- iMap->zone_change2(sd->bl.m,maplist[sd->bl.m].prev_zone);
+ map->zone_change2(sd->bl.m,maplist[sd->bl.m].prev_zone);
maplist[sd->bl.m].flag.gvg = 0;
clif->map_property_mapall(sd->bl.m, MAPPROPERTY_NOTHING);
clif->maptypeproperty2(&sd->bl,ALL_SAMEMAP);
- iMap->foreachinmap(atcommand_stopattack,sd->bl.m, BL_CHAR, 0);
+ map->foreachinmap(atcommand_stopattack,sd->bl.m, BL_CHAR, 0);
clif->message(fd, msg_txt(33)); // GvG: Off.
return true;
@@ -1560,7 +1557,7 @@ ACMD(gvgon) {
return false;
}
- iMap->zone_change2(sd->bl.m,strdb_get(zone_db, MAP_ZONE_GVG_NAME));
+ map->zone_change2(sd->bl.m,strdb_get(zone_db, MAP_ZONE_GVG_NAME));
maplist[sd->bl.m].flag.gvg = 1;
clif->map_property_mapall(sd->bl.m, MAPPROPERTY_AGITZONE);
clif->maptypeproperty2(&sd->bl,ALL_SAMEMAP);
@@ -1852,7 +1849,7 @@ ACMD(go)
}
if (town >= 0 && town < ARRAYLENGTH(data)) {
- m = iMap->mapname2mapid(data[town].map);
+ m = map->mapname2mapid(data[town].map);
if (m >= 0 && maplist[m].flag.nowarpto && !pc->has_permission(sd, PC_PERM_WARP_ANYWHERE)) {
clif->message(fd, msg_txt(247));
return false;
@@ -1952,7 +1949,7 @@ ACMD(monster)
count = 0;
range = (int)sqrt((float)number) +2; // calculation of an odd number (+ 4 area around)
for (i = 0; i < number; i++) {
- iMap->search_freecell(&sd->bl, 0, &mx, &my, range, range, 0);
+ map->search_freecell(&sd->bl, 0, &mx, &my, range, range, 0);
k = mob->once_spawn(sd, sd->bl.m, mx, my, name, mob_id, 1, eventname, size, AI_NONE);
count += (k != 0) ? 1 : 0;
}
@@ -1993,8 +1990,7 @@ static int atkillmonster_sub(struct block_list *bl, va_list ap)
return 1;
}
-ACMD(killmonster)
-{
+ACMD(killmonster) {
int map_id, drop_flag;
char map_name[MAP_NAME_LENGTH_EXT];
nullpo_retr(-1, sd);
@@ -2004,13 +2000,13 @@ ACMD(killmonster)
if (!message || !*message || sscanf(message, "%15s", map_name) < 1)
map_id = sd->bl.m;
else {
- if ((map_id = iMap->mapname2mapid(map_name)) < 0)
+ if ((map_id = map->mapname2mapid(map_name)) < 0)
map_id = sd->bl.m;
}
drop_flag = strcmp(command+1, "killmonster2");
- iMap->foreachinmap(atkillmonster_sub, map_id, BL_MOB, -drop_flag);
+ map->foreachinmap(atkillmonster_sub, map_id, BL_MOB, -drop_flag);
clif->message(fd, msg_txt(165)); // All monsters killed!
@@ -2193,8 +2189,7 @@ ACMD(memo)
/*==========================================
*
*------------------------------------------*/
-ACMD(gat)
-{
+ACMD(gat) {
int y;
nullpo_retr(-1, sd);
@@ -2203,11 +2198,11 @@ ACMD(gat)
for (y = 2; y >= -2; y--) {
sprintf(atcmd_output, "%s (x= %d, y= %d) %02X %02X %02X %02X %02X",
maplist[sd->bl.m].name, sd->bl.x - 2, sd->bl.y + y,
- iMap->getcell(sd->bl.m, sd->bl.x - 2, sd->bl.y + y, CELL_GETTYPE),
- iMap->getcell(sd->bl.m, sd->bl.x - 1, sd->bl.y + y, CELL_GETTYPE),
- iMap->getcell(sd->bl.m, sd->bl.x, sd->bl.y + y, CELL_GETTYPE),
- iMap->getcell(sd->bl.m, sd->bl.x + 1, sd->bl.y + y, CELL_GETTYPE),
- iMap->getcell(sd->bl.m, sd->bl.x + 2, sd->bl.y + y, CELL_GETTYPE));
+ map->getcell(sd->bl.m, sd->bl.x - 2, sd->bl.y + y, CELL_GETTYPE),
+ map->getcell(sd->bl.m, sd->bl.x - 1, sd->bl.y + y, CELL_GETTYPE),
+ map->getcell(sd->bl.m, sd->bl.x, sd->bl.y + y, CELL_GETTYPE),
+ map->getcell(sd->bl.m, sd->bl.x + 1, sd->bl.y + y, CELL_GETTYPE),
+ map->getcell(sd->bl.m, sd->bl.x + 2, sd->bl.y + y, CELL_GETTYPE));
clif->message(fd, atcmd_output);
}
@@ -2687,8 +2682,7 @@ ACMD(recall) {
return false;
}
- if((pl_sd=iMap->nick2sd((char *)message)) == NULL && (pl_sd=iMap->charid2sd(atoi(message))) == NULL)
- {
+ if((pl_sd=map->nick2sd((char *)message)) == NULL && (pl_sd=map->charid2sd(atoi(message))) == NULL) {
clif->message(fd, msg_txt(3)); // Character not found.
return false;
}
@@ -2880,11 +2874,10 @@ ACMD(char_unban)
/*==========================================
*
*------------------------------------------*/
-ACMD(night)
-{
+ACMD(night) {
nullpo_retr(-1, sd);
- if (iMap->night_flag != 1) {
+ if (map->night_flag != 1) {
pc->map_night_timer(pc->night_timer_tid, 0, 0, 1);
} else {
clif->message(fd, msg_txt(89)); // Night mode is already enabled.
@@ -2897,11 +2890,10 @@ ACMD(night)
/*==========================================
*
*------------------------------------------*/
-ACMD(day)
-{
+ACMD(day) {
nullpo_retr(-1, sd);
- if (iMap->night_flag != 0) {
+ if (map->night_flag != 0) {
pc->map_day_timer(pc->day_timer_tid, 0, 0, 1);
} else {
clif->message(fd, msg_txt(90)); // Day mode is already enabled.
@@ -3033,8 +3025,7 @@ ACMD(kick)
return false;
}
- if((pl_sd=iMap->nick2sd((char *)message)) == NULL && (pl_sd=iMap->charid2sd(atoi(message))) == NULL)
- {
+ if((pl_sd=map->nick2sd((char *)message)) == NULL && (pl_sd=map->charid2sd(atoi(message))) == NULL) {
clif->message(fd, msg_txt(3)); // Character not found.
return false;
}
@@ -3282,15 +3273,14 @@ ACMD(breakguild)
/*==========================================
*
*------------------------------------------*/
-ACMD(agitstart)
-{
+ACMD(agitstart) {
nullpo_retr(-1, sd);
- if (iMap->agit_flag == 1) {
+ if (map->agit_flag == 1) {
clif->message(fd, msg_txt(73)); // War of Emperium is currently in progress.
return false;
}
- iMap->agit_flag = 1;
+ map->agit_flag = 1;
guild->agit_start();
clif->message(fd, msg_txt(72)); // War of Emperium has been initiated.
@@ -3300,15 +3290,14 @@ ACMD(agitstart)
/*==========================================
*
*------------------------------------------*/
-ACMD(agitstart2)
-{
+ACMD(agitstart2) {
nullpo_retr(-1, sd);
- if (iMap->agit2_flag == 1) {
+ if (map->agit2_flag == 1) {
clif->message(fd, msg_txt(404)); // "War of Emperium SE is currently in progress."
return false;
}
- iMap->agit2_flag = 1;
+ map->agit2_flag = 1;
guild->agit2_start();
clif->message(fd, msg_txt(403)); // "War of Emperium SE has been initiated."
@@ -3318,15 +3307,14 @@ ACMD(agitstart2)
/*==========================================
*
*------------------------------------------*/
-ACMD(agitend)
-{
+ACMD(agitend) {
nullpo_retr(-1, sd);
- if (iMap->agit_flag == 0) {
+ if (map->agit_flag == 0) {
clif->message(fd, msg_txt(75)); // War of Emperium is currently not in progress.
return false;
}
- iMap->agit_flag = 0;
+ map->agit_flag = 0;
guild->agit_end();
clif->message(fd, msg_txt(74)); // War of Emperium has been ended.
@@ -3336,15 +3324,14 @@ ACMD(agitend)
/*==========================================
*
*------------------------------------------*/
-ACMD(agitend2)
-{
+ACMD(agitend2) {
nullpo_retr(-1, sd);
- if (iMap->agit2_flag == 0) {
+ if (map->agit2_flag == 0) {
clif->message(fd, msg_txt(406)); // "War of Emperium SE is currently not in progress."
return false;
}
- iMap->agit2_flag = 0;
+ map->agit2_flag = 0;
guild->agit2_end();
clif->message(fd, msg_txt(405)); // "War of Emperium SE has been ended."
@@ -3354,11 +3341,10 @@ ACMD(agitend2)
/*==========================================
* @mapexit - shuts down the map server
*------------------------------------------*/
-ACMD(mapexit)
-{
+ACMD(mapexit) {
nullpo_retr(-1, sd);
- iMap->do_shutdown();
+ map->do_shutdown();
return true;
}
@@ -3615,7 +3601,7 @@ ACMD(reloadatcommand) {
config_destroy(&run_test);
- if (conf_read_file(&run_test, iMap->ATCOMMAND_CONF_FILENAME)) {
+ if (conf_read_file(&run_test, map->ATCOMMAND_CONF_FILENAME)) {
clif->message(fd, msg_txt(1037)); // Error reading atcommand.conf, reload failed.
return false;
}
@@ -3635,7 +3621,7 @@ ACMD(reloadbattleconf)
struct Battle_Config prev_config;
memcpy(&prev_config, &battle_config, sizeof(prev_config));
- battle->config_read(iMap->BATTLE_CONF_FILENAME);
+ battle->config_read(map->BATTLE_CONF_FILENAME);
if( prev_config.item_rate_mvp != battle_config.item_rate_mvp
|| prev_config.item_rate_common != battle_config.item_rate_common
@@ -3696,8 +3682,7 @@ ACMD(reloadpcdb)
/*==========================================
* @reloadscript - reloads all scripts (npcs, warps, mob spawns, ...)
*------------------------------------------*/
-ACMD(reloadscript)
-{
+ACMD(reloadscript) {
struct s_mapiterator* iter;
struct map_session_data* pl_sd;
@@ -3726,7 +3711,7 @@ ACMD(reloadscript)
mapit->free(iter);
flush_fifos();
- iMap->reloadnpc(true); // reload config files seeking for npcs
+ map->reloadnpc(true); // reload config files seeking for npcs
script->reload();
npc->reload();
@@ -3769,9 +3754,9 @@ ACMD(mapinfo) {
if (mapname[0] == '\0') {
safestrncpy(mapname, mapindex_id2name(sd->mapindex), MAP_NAME_LENGTH);
- m_id = iMap->mapindex2mapid(sd->mapindex);
+ m_id = map->mapindex2mapid(sd->mapindex);
} else {
- m_id = iMap->mapname2mapid(mapname);
+ m_id = map->mapname2mapid(mapname);
}
if (m_id < 0) {
@@ -3789,7 +3774,7 @@ ACMD(mapinfo) {
if( pl_sd->mapindex == m_index ) {
if( pl_sd->state.vending )
vend_num++;
- else if( (cd = (struct chat_data*)iMap->id2bl(pl_sd->chatID)) != NULL && cd->usersd[0] == pl_sd )
+ else if( (cd = (struct chat_data*)map->id2bl(pl_sd->chatID)) != NULL && cd->usersd[0] == pl_sd )
chat_num++;
}
}
@@ -3968,7 +3953,7 @@ ACMD(mapinfo) {
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) )
{
- if ((cd = (struct chat_data*)iMap->id2bl(pl_sd->chatID)) != NULL &&
+ if ((cd = (struct chat_data*)map->id2bl(pl_sd->chatID)) != NULL &&
pl_sd->mapindex == m_index &&
cd->usersd[0] == pl_sd)
{
@@ -4058,8 +4043,7 @@ ACMD(mount_peco)
/*==========================================
*Spy Commands by Syrus22
*------------------------------------------*/
-ACMD(guildspy)
-{
+ACMD(guildspy) {
char guild_name[NAME_LENGTH];
struct guild *g;
nullpo_retr(-1, sd);
@@ -4067,7 +4051,7 @@ ACMD(guildspy)
memset(guild_name, '\0', sizeof(guild_name));
memset(atcmd_output, '\0', sizeof(atcmd_output));
- if (!iMap->enable_spy)
+ if (!map->enable_spy)
{
clif->message(fd, msg_txt(1125)); // The mapserver has spy command support disabled.
return false;
@@ -4099,8 +4083,7 @@ ACMD(guildspy)
/*==========================================
*
*------------------------------------------*/
-ACMD(partyspy)
-{
+ACMD(partyspy) {
char party_name[NAME_LENGTH];
struct party_data *p;
nullpo_retr(-1, sd);
@@ -4108,7 +4091,7 @@ ACMD(partyspy)
memset(party_name, '\0', sizeof(party_name));
memset(atcmd_output, '\0', sizeof(atcmd_output));
- if (!iMap->enable_spy)
+ if (!map->enable_spy)
{
clif->message(fd, msg_txt(1125)); // The mapserver has spy command support disabled.
return false;
@@ -4170,8 +4153,7 @@ ACMD(repairall)
/*==========================================
* @nuke [Valaris]
*------------------------------------------*/
-ACMD(nuke)
-{
+ACMD(nuke) {
struct map_session_data *pl_sd;
nullpo_retr(-1, sd);
@@ -4182,7 +4164,7 @@ ACMD(nuke)
return false;
}
- if ((pl_sd = iMap->nick2sd(atcmd_player_name)) != NULL) {
+ if ((pl_sd = map->nick2sd(atcmd_player_name)) != NULL) {
if (pc->get_group_level(sd) >= pc->get_group_level(pl_sd)) { // you can kill only lower or same GM level
skill->castend_nodamage_id(&pl_sd->bl, &pl_sd->bl, NPC_SELFDESTRUCTION, 99, timer->gettick(), 0);
clif->message(fd, msg_txt(109)); // Player has been nuked!
@@ -4372,8 +4354,7 @@ char* txt_time(unsigned int duration)
* @time/@date/@serverdate/@servertime: Display the date/time of the server (by [Yor]
* Calculation management of GM modification (@day/@night GM commands) is done
*------------------------------------------*/
-ACMD(servertime)
-{
+ACMD(servertime) {
const struct TimerData * timer_data;
const struct TimerData * timer_data2;
time_t time_server; // variable for number of seconds (used with time() function)
@@ -4390,53 +4371,51 @@ ACMD(servertime)
clif->message(fd, temp);
if (battle_config.night_duration == 0 && battle_config.day_duration == 0) {
- if (iMap->night_flag == 0)
+ if (map->night_flag == 0)
clif->message(fd, msg_txt(231)); // Game time: The game is in permanent daylight.
else
clif->message(fd, msg_txt(232)); // Game time: The game is in permanent night.
- } else if (battle_config.night_duration == 0)
- if (iMap->night_flag == 1) { // we start with night
+ } else if (battle_config.night_duration == 0) {
+ if (map->night_flag == 1) { // we start with night
timer_data = timer->get(pc->day_timer_tid);
sprintf(temp, msg_txt(233), txt_time(DIFF_TICK(timer_data->tick,timer->gettick())/1000)); // Game time: The game is actualy in night for %s.
clif->message(fd, temp);
clif->message(fd, msg_txt(234)); // Game time: After, the game will be in permanent daylight.
} else
clif->message(fd, msg_txt(231)); // Game time: The game is in permanent daylight.
- else if (battle_config.day_duration == 0)
- if (iMap->night_flag == 0) { // we start with day
- timer_data = timer->get(pc->night_timer_tid);
- sprintf(temp, msg_txt(235), txt_time(DIFF_TICK(timer_data->tick,timer->gettick())/1000)); // Game time: The game is actualy in daylight for %s.
- clif->message(fd, temp);
- clif->message(fd, msg_txt(236)); // Game time: After, the game will be in permanent night.
- } else
- clif->message(fd, msg_txt(232)); // Game time: The game is in permanent night.
- else {
- if (iMap->night_flag == 0) {
- timer_data = timer->get(pc->night_timer_tid);
- timer_data2 = timer->get(pc->day_timer_tid);
- sprintf(temp, msg_txt(235), txt_time(DIFF_TICK(timer_data->tick,timer->gettick())/1000)); // Game time: The game is actualy in daylight for %s.
- clif->message(fd, temp);
- if (DIFF_TICK(timer_data->tick, timer_data2->tick) > 0)
- sprintf(temp, msg_txt(237), txt_time(DIFF_TICK(timer_data->interval,DIFF_TICK(timer_data->tick,timer_data2->tick)) / 1000)); // Game time: After, the game will be in night for %s.
- else
- sprintf(temp, msg_txt(237), txt_time(DIFF_TICK(timer_data2->tick,timer_data->tick)/1000)); // Game time: After, the game will be in night for %s.
- clif->message(fd, temp);
- sprintf(temp, msg_txt(238), txt_time(timer_data->interval / 1000)); // Game time: A day cycle has a normal duration of %s.
- clif->message(fd, temp);
- } else {
- timer_data = timer->get(pc->day_timer_tid);
- timer_data2 = timer->get(pc->night_timer_tid);
- sprintf(temp, msg_txt(233), txt_time(DIFF_TICK(timer_data->tick,timer->gettick()) / 1000)); // Game time: The game is actualy in night for %s.
- clif->message(fd, temp);
- if (DIFF_TICK(timer_data->tick,timer_data2->tick) > 0)
- sprintf(temp, msg_txt(239), txt_time((timer_data->interval - DIFF_TICK(timer_data->tick, timer_data2->tick)) / 1000)); // Game time: After, the game will be in daylight for %s.
- else
- sprintf(temp, msg_txt(239), txt_time(DIFF_TICK(timer_data2->tick, timer_data->tick) / 1000)); // Game time: After, the game will be in daylight for %s.
- clif->message(fd, temp);
- sprintf(temp, msg_txt(238), txt_time(timer_data->interval / 1000)); // Game time: A day cycle has a normal duration of %s.
- clif->message(fd, temp);
- }
- }
+ } else if (battle_config.day_duration == 0) {
+ if (map->night_flag == 0) { // we start with day
+ timer_data = timer->get(pc->night_timer_tid);
+ sprintf(temp, msg_txt(235), txt_time(DIFF_TICK(timer_data->tick,timer->gettick())/1000)); // Game time: The game is actualy in daylight for %s.
+ clif->message(fd, temp);
+ clif->message(fd, msg_txt(236)); // Game time: After, the game will be in permanent night.
+ } else
+ clif->message(fd, msg_txt(232)); // Game time: The game is in permanent night.
+ } else {
+ if (map->night_flag == 0) {
+ timer_data = timer->get(pc->night_timer_tid);
+ timer_data2 = timer->get(pc->day_timer_tid);
+ sprintf(temp, msg_txt(235), txt_time(DIFF_TICK(timer_data->tick,timer->gettick())/1000)); // Game time: The game is actualy in daylight for %s.
+ clif->message(fd, temp);
+ if (DIFF_TICK(timer_data->tick, timer_data2->tick) > 0)
+ sprintf(temp, msg_txt(237), txt_time(DIFF_TICK(timer_data->interval,DIFF_TICK(timer_data->tick,timer_data2->tick)) / 1000)); // Game time: After, the game will be in night for %s.
+ else
+ sprintf(temp, msg_txt(237), txt_time(DIFF_TICK(timer_data2->tick,timer_data->tick)/1000)); // Game time: After, the game will be in night for %s.
+ clif->message(fd, temp);
+ } else {
+ timer_data = timer->get(pc->day_timer_tid);
+ timer_data2 = timer->get(pc->night_timer_tid);
+ sprintf(temp, msg_txt(233), txt_time(DIFF_TICK(timer_data->tick,timer->gettick()) / 1000)); // Game time: The game is actualy in night for %s.
+ clif->message(fd, temp);
+ if (DIFF_TICK(timer_data->tick,timer_data2->tick) > 0)
+ sprintf(temp, msg_txt(239), txt_time((timer_data->interval - DIFF_TICK(timer_data->tick, timer_data2->tick)) / 1000)); // Game time: After, the game will be in daylight for %s.
+ else
+ sprintf(temp, msg_txt(239), txt_time(DIFF_TICK(timer_data2->tick, timer_data->tick) / 1000)); // Game time: After, the game will be in daylight for %s.
+ clif->message(fd, temp);
+ }
+ sprintf(temp, msg_txt(238), txt_time(timer_data->interval / 1000)); // Game time: A day cycle has a normal duration of %s.
+ clif->message(fd, temp);
+ }
return true;
}
@@ -4473,8 +4452,7 @@ static void get_jail_time(int jailtime, int* year, int* month, int* day, int* ho
* @jail <char_name> by [Yor]
* Special warp! No check with nowarp and nowarpto flag
*------------------------------------------*/
-ACMD(jail)
-{
+ACMD(jail) {
struct map_session_data *pl_sd;
int x, y;
unsigned short m_index;
@@ -4487,7 +4465,7 @@ ACMD(jail)
return false;
}
- if ((pl_sd = iMap->nick2sd(atcmd_player_name)) == NULL) {
+ if ((pl_sd = map->nick2sd(atcmd_player_name)) == NULL) {
clif->message(fd, msg_txt(3)); // Character not found.
return false;
}
@@ -4528,8 +4506,7 @@ ACMD(jail)
* @unjail/@discharge <char_name> by [Yor]
* Special warp! No check with nowarp and nowarpto flag
*------------------------------------------*/
-ACMD(unjail)
-{
+ACMD(unjail) {
struct map_session_data *pl_sd;
memset(atcmd_player_name, '\0', sizeof(atcmd_player_name));
@@ -4539,7 +4516,7 @@ ACMD(unjail)
return false;
}
- if ((pl_sd = iMap->nick2sd(atcmd_player_name)) == NULL) {
+ if ((pl_sd = map->nick2sd(atcmd_player_name)) == NULL) {
clif->message(fd, msg_txt(3)); // Character not found.
return false;
}
@@ -4563,8 +4540,7 @@ ACMD(unjail)
return true;
}
-ACMD(jailfor)
-{
+ACMD(jailfor) {
struct map_session_data *pl_sd = NULL;
int year, month, day, hour, minute, value;
char * modif_p;
@@ -4619,7 +4595,7 @@ ACMD(jailfor)
return false;
}
- if ((pl_sd = iMap->nick2sd(atcmd_player_name)) == NULL) {
+ if ((pl_sd = map->nick2sd(atcmd_player_name)) == NULL) {
clif->message(fd, msg_txt(3)); // Character not found.
return false;
}
@@ -5039,8 +5015,7 @@ ACMD(killer)
* @killable by MouseJstr
* enable other people killing you
*------------------------------------------*/
-ACMD(killable)
-{
+ACMD(killable) {
nullpo_retr(-1, sd);
sd->state.killable = !sd->state.killable;
@@ -5048,7 +5023,7 @@ ACMD(killable)
clif->message(fd, msg_txt(242));
else {
clif->message(fd, msg_txt(288));
- iMap->foreachinrange(atcommand_stopattack,&sd->bl, AREA_SIZE, BL_CHAR, sd->bl.id);
+ map->foreachinrange(atcommand_stopattack,&sd->bl, AREA_SIZE, BL_CHAR, sd->bl.id);
}
return true;
}
@@ -5079,8 +5054,7 @@ ACMD(skilloff) {
* @npcmove by MouseJstr
* move a npc
*------------------------------------------*/
-ACMD(npcmove)
-{
+ACMD(npcmove) {
int x = 0, y = 0, m;
struct npc_data *nd = 0;
nullpo_retr(-1, sd);
@@ -5091,23 +5065,21 @@ ACMD(npcmove)
return false;
}
- if ((nd = npc->name2id(atcmd_player_name)) == NULL)
- {
+ if ((nd = npc->name2id(atcmd_player_name)) == NULL) {
clif->message(fd, msg_txt(111)); // This NPC doesn't exist.
return false;
}
- if ((m=nd->bl.m) < 0 || nd->bl.prev == NULL)
- {
+ if ((m=nd->bl.m) < 0 || nd->bl.prev == NULL) {
clif->message(fd, msg_txt(1154)); // NPC is not on this map.
return false; //Not on a map.
}
x = cap_value(x, 0, maplist[m].xs-1);
y = cap_value(y, 0, maplist[m].ys-1);
- iMap->foreachinrange(clif->outsight, &nd->bl, AREA_SIZE, BL_PC, &nd->bl);
- iMap->moveblock(&nd->bl, x, y, timer->gettick());
- iMap->foreachinrange(clif->insight, &nd->bl, AREA_SIZE, BL_PC, &nd->bl);
+ map->foreachinrange(clif->outsight, &nd->bl, AREA_SIZE, BL_PC, &nd->bl);
+ map->moveblock(&nd->bl, x, y, timer->gettick());
+ map->foreachinrange(clif->insight, &nd->bl, AREA_SIZE, BL_PC, &nd->bl);
clif->message(fd, msg_txt(1155)); // NPC moved.
return true;
@@ -5153,8 +5125,7 @@ ACMD(addwarp)
* @follow by [MouseJstr]
* Follow a player .. staying no more then 5 spaces away
*------------------------------------------*/
-ACMD(follow)
-{
+ACMD(follow) {
struct map_session_data *pl_sd = NULL;
nullpo_retr(-1, sd);
@@ -5167,7 +5138,7 @@ ACMD(follow)
return true;
}
- if ( (pl_sd = iMap->nick2sd((char *)message)) == NULL )
+ if ( (pl_sd = map->nick2sd((char *)message)) == NULL )
{
clif->message(fd, msg_txt(3)); // Character not found.
return false;
@@ -5371,8 +5342,7 @@ ACMD(skillid) {
* @useskill by [MouseJstr]
* A way of using skills without having to find them in the skills menu
*------------------------------------------*/
-ACMD(useskill)
-{
+ACMD(useskill) {
struct map_session_data *pl_sd = NULL;
struct block_list *bl;
uint16 skill_id;
@@ -5385,8 +5355,9 @@ ACMD(useskill)
return false;
}
- if(!strcmp(target,"self")) pl_sd = sd; //quick keyword
- else if ( (pl_sd = iMap->nick2sd(target)) == NULL ){
+ if(!strcmp(target,"self"))
+ pl_sd = sd; //quick keyword
+ else if ( (pl_sd = map->nick2sd(target)) == NULL ) {
clif->message(fd, msg_txt(3)); // Character not found.
return false;
}
@@ -5439,8 +5410,7 @@ ACMD(displayskill) {
* @skilltree by [MouseJstr]
* prints the skill tree for a player required to get to a skill
*------------------------------------------*/
-ACMD(skilltree)
-{
+ACMD(skilltree) {
struct map_session_data *pl_sd = NULL;
uint16 skill_id;
int meets, j, c=0;
@@ -5453,8 +5423,7 @@ ACMD(skilltree)
return false;
}
- if ( (pl_sd = iMap->nick2sd(target)) == NULL )
- {
+ if ( (pl_sd = map->nick2sd(target)) == NULL ) {
clif->message(fd, msg_txt(3)); // Character not found.
return false;
}
@@ -5492,8 +5461,7 @@ ACMD(skilltree)
}
// Hand a ring with partners name on it to this char
-void getring (struct map_session_data* sd)
-{
+void getring(struct map_session_data* sd) {
int flag, item_id;
struct item item_tmp;
item_id = (sd->status.sex) ? WEDDING_RING_M : WEDDING_RING_F;
@@ -5507,7 +5475,7 @@ void getring (struct map_session_data* sd)
if((flag = pc->additem(sd,&item_tmp,1,LOG_TYPE_COMMAND))) {
clif->additem(sd,0,0,flag);
- iMap->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ map->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
}
@@ -5515,8 +5483,7 @@ void getring (struct map_session_data* sd)
* @marry by [MouseJstr], fixed by Lupus
* Marry two players
*------------------------------------------*/
-ACMD(marry)
-{
+ACMD(marry) {
struct map_session_data *pl_sd = NULL;
char player_name[NAME_LENGTH] = "";
@@ -5527,7 +5494,7 @@ ACMD(marry)
return false;
}
- if ((pl_sd = iMap->nick2sd(player_name)) == NULL) {
+ if ((pl_sd = map->nick2sd(player_name)) == NULL) {
clif->message(fd, msg_txt(3));
return false;
}
@@ -5628,8 +5595,7 @@ ACMD(autotrade) {
* @changegm by durf (changed by Lupus)
* Changes Master of your Guild to a specified guild member
*------------------------------------------*/
-ACMD(changegm)
-{
+ACMD(changegm) {
struct guild *g;
struct map_session_data *pl_sd;
nullpo_retr(-1, sd);
@@ -5649,7 +5615,7 @@ ACMD(changegm)
return false;
}
- if((pl_sd=iMap->nick2sd((char *) message)) == NULL || pl_sd->status.guild_id != sd->status.guild_id) {
+ if((pl_sd=map->nick2sd((char *) message)) == NULL || pl_sd->status.guild_id != sd->status.guild_id) {
clif->message(fd, msg_txt(1184)); // Target character must be online and be a guild member.
return false;
}
@@ -5662,17 +5628,15 @@ ACMD(changegm)
* @changeleader by Skotlex
* Changes the leader of a party.
*------------------------------------------*/
-ACMD(changeleader)
-{
+ACMD(changeleader) {
nullpo_retr(-1, sd);
- if( !message[0] )
- {
+ if( !message[0] ) {
clif->message(fd, msg_txt(1185)); // Usage: @changeleader <party_member_name>
return false;
}
- if (party->changeleader(sd, iMap->nick2sd((char *) message)))
+ if (party->changeleader(sd, map->nick2sd((char *) message)))
return true;
return false;
}
@@ -6096,33 +6060,28 @@ ACMD(mobsearch)
* @cleanmap - cleans items on the ground
* @cleanarea - cleans items on the ground within an specified area
*------------------------------------------*/
-static int atcommand_cleanfloor_sub(struct block_list *bl, va_list ap)
-{
+static int atcommand_cleanfloor_sub(struct block_list *bl, va_list ap) {
nullpo_ret(bl);
- iMap->clearflooritem(bl);
+ map->clearflooritem(bl);
return 0;
}
-ACMD(cleanmap)
-{
- iMap->foreachinmap(atcommand_cleanfloor_sub, sd->bl.m, BL_ITEM);
+ACMD(cleanmap) {
+ map->foreachinmap(atcommand_cleanfloor_sub, sd->bl.m, BL_ITEM);
clif->message(fd, msg_txt(1221)); // All dropped items have been cleaned up.
return true;
}
-ACMD(cleanarea)
-{
+ACMD(cleanarea) {
int x0 = 0, y0 = 0, x1 = 0, y1 = 0;
if (!message || !*message || sscanf(message, "%d %d %d %d", &x0, &y0, &x1, &y1) < 1) {
- iMap->foreachinrange(atcommand_cleanfloor_sub, &sd->bl, AREA_SIZE * 2, BL_ITEM);
- }
- else if (sscanf(message, "%d %d %d %d", &x0, &y0, &x1, &y1) == 1) {
- iMap->foreachinrange(atcommand_cleanfloor_sub, &sd->bl, x0, BL_ITEM);
- }
- else if (sscanf(message, "%d %d %d %d", &x0, &y0, &x1, &y1) == 4) {
- iMap->foreachinarea(atcommand_cleanfloor_sub, sd->bl.m, x0, y0, x1, y1, BL_ITEM);
+ map->foreachinrange(atcommand_cleanfloor_sub, &sd->bl, AREA_SIZE * 2, BL_ITEM);
+ } else if (sscanf(message, "%d %d %d %d", &x0, &y0, &x1, &y1) == 1) {
+ map->foreachinrange(atcommand_cleanfloor_sub, &sd->bl, x0, BL_ITEM);
+ } else if (sscanf(message, "%d %d %d %d", &x0, &y0, &x1, &y1) == 4) {
+ map->foreachinarea(atcommand_cleanfloor_sub, sd->bl.m, x0, y0, x1, y1, BL_ITEM);
}
clif->message(fd, msg_txt(1221)); // All dropped items have been cleaned up.
@@ -6372,8 +6331,7 @@ ACMD(adjgroup)
* @trade by [MouseJstr]
* Open a trade window with a remote player
*------------------------------------------*/
-ACMD(trade)
-{
+ACMD(trade) {
struct map_session_data *pl_sd = NULL;
nullpo_retr(-1, sd);
@@ -6382,8 +6340,7 @@ ACMD(trade)
return false;
}
- if ( (pl_sd = iMap->nick2sd((char *)message)) == NULL )
- {
+ if ( (pl_sd = map->nick2sd((char *)message)) == NULL ) {
clif->message(fd, msg_txt(3)); // Character not found.
return false;
}
@@ -6419,8 +6376,7 @@ ACMD(setbattleflag)
/*==========================================
* @unmute [Valaris]
*------------------------------------------*/
-ACMD(unmute)
-{
+ACMD(unmute) {
struct map_session_data *pl_sd = NULL;
nullpo_retr(-1, sd);
@@ -6429,7 +6385,7 @@ ACMD(unmute)
return false;
}
- if ( (pl_sd = iMap->nick2sd((char *)message)) == NULL )
+ if ( (pl_sd = map->nick2sd((char *)message)) == NULL )
{
clif->message(fd, msg_txt(3)); // Character not found.
return false;
@@ -6489,8 +6445,7 @@ ACMD(changesex)
/*================================================
* @mute - Mutes a player for a set amount of time
*------------------------------------------------*/
-ACMD(mute)
-{
+ACMD(mute) {
struct map_session_data *pl_sd = NULL;
int manner;
nullpo_retr(-1, sd);
@@ -6500,8 +6455,7 @@ ACMD(mute)
return false;
}
- if ( (pl_sd = iMap->nick2sd(atcmd_player_name)) == NULL )
- {
+ if ( (pl_sd = map->nick2sd(atcmd_player_name)) == NULL ) {
clif->message(fd, msg_txt(3)); // Character not found.
return false;
}
@@ -7288,7 +7242,7 @@ ACMD(whereis)
clif->message(fd, atcmd_output);
for (i = 0; i < ARRAYLENGTH(monster->spawn) && monster->spawn[i].qty; i++) {
- j = iMap->mapindex2mapid(monster->spawn[i].mapindex);
+ j = map->mapindex2mapid(monster->spawn[i].mapindex);
if (j < 0) continue;
snprintf(atcmd_output, sizeof atcmd_output, "%s (%d)", maplist[j].name, monster->spawn[i].qty);
clif->message(fd, atcmd_output);
@@ -7340,8 +7294,7 @@ static int atcommand_mutearea_sub(struct block_list *bl,va_list ap)
return 0;
}
-ACMD(mutearea)
-{
+ACMD(mutearea) {
int time;
nullpo_ret(sd);
@@ -7352,9 +7305,9 @@ ACMD(mutearea)
time = atoi(message);
- iMap->foreachinarea(atcommand_mutearea_sub,sd->bl.m,
- sd->bl.x-AREA_SIZE, sd->bl.y-AREA_SIZE,
- sd->bl.x+AREA_SIZE, sd->bl.y+AREA_SIZE, BL_PC, sd->bl.id, time);
+ map->foreachinarea(atcommand_mutearea_sub,sd->bl.m,
+ sd->bl.x-AREA_SIZE, sd->bl.y-AREA_SIZE,
+ sd->bl.x+AREA_SIZE, sd->bl.y+AREA_SIZE, BL_PC, sd->bl.id, time);
return true;
}
@@ -7566,8 +7519,8 @@ ACMD(fakename)
* Ragnarok Resources
*------------------------------------------*/
ACMD(mapflag) {
-#define checkflag( cmd ) if ( maplist[ sd->bl.m ].flag.cmd ) clif->message(sd->fd,#cmd)
-#define setflag( cmd ) do {\
+#define CHECKFLAG( cmd ) do { if ( maplist[ sd->bl.m ].flag.cmd ) clif->message(sd->fd,#cmd); } while(0)
+#define SETFLAG( cmd ) do { \
if ( strcmp( flag_name , #cmd ) == 0 ) { \
maplist[ sd->bl.m ].flag.cmd = flag; \
sprintf(atcmd_output,"[ @mapflag ] %s flag has been set to %s value = %hd",#cmd,flag?"On":"Off",flag); \
@@ -7584,19 +7537,19 @@ ACMD(mapflag) {
if (!message || !*message || (sscanf(message, "%99s %hd", flag_name, &flag) < 1)) {
clif->message(sd->fd,msg_txt(1311)); // Enabled Mapflags in this map:
clif->message(sd->fd,"----------------------------------");
- checkflag(autotrade); checkflag(allowks); checkflag(nomemo); checkflag(noteleport);
- checkflag(noreturn); checkflag(monster_noteleport); checkflag(nosave); checkflag(nobranch);
- checkflag(noexppenalty); checkflag(pvp); checkflag(pvp_noparty); checkflag(pvp_noguild);
- checkflag(pvp_nightmaredrop); checkflag(pvp_nocalcrank); checkflag(gvg_castle); checkflag(gvg);
- checkflag(gvg_dungeon); checkflag(gvg_noparty); checkflag(battleground);checkflag(nozenypenalty);
- checkflag(notrade); checkflag(noskill); checkflag(nowarp); checkflag(nowarpto);
- checkflag(noicewall); checkflag(snow); checkflag(clouds); checkflag(clouds2);
- checkflag(fog); checkflag(fireworks); checkflag(sakura); checkflag(leaves);
- checkflag(nobaseexp);
- checkflag(nojobexp); checkflag(nomobloot); checkflag(nomvploot); checkflag(nightenabled);
- checkflag(nodrop); checkflag(novending); checkflag(loadevent);
- checkflag(nochat); checkflag(partylock); checkflag(guildlock); checkflag(src4instance);
- checkflag(notomb);
+ CHECKFLAG(autotrade); CHECKFLAG(allowks); CHECKFLAG(nomemo); CHECKFLAG(noteleport);
+ CHECKFLAG(noreturn); CHECKFLAG(monster_noteleport); CHECKFLAG(nosave); CHECKFLAG(nobranch);
+ CHECKFLAG(noexppenalty); CHECKFLAG(pvp); CHECKFLAG(pvp_noparty); CHECKFLAG(pvp_noguild);
+ CHECKFLAG(pvp_nightmaredrop); CHECKFLAG(pvp_nocalcrank); CHECKFLAG(gvg_castle); CHECKFLAG(gvg);
+ CHECKFLAG(gvg_dungeon); CHECKFLAG(gvg_noparty); CHECKFLAG(battleground); CHECKFLAG(nozenypenalty);
+ CHECKFLAG(notrade); CHECKFLAG(noskill); CHECKFLAG(nowarp); CHECKFLAG(nowarpto);
+ CHECKFLAG(noicewall); CHECKFLAG(snow); CHECKFLAG(clouds); CHECKFLAG(clouds2);
+ CHECKFLAG(fog); CHECKFLAG(fireworks); CHECKFLAG(sakura); CHECKFLAG(leaves);
+ CHECKFLAG(nobaseexp);
+ CHECKFLAG(nojobexp); CHECKFLAG(nomobloot); CHECKFLAG(nomvploot); CHECKFLAG(nightenabled);
+ CHECKFLAG(nodrop); CHECKFLAG(novending); CHECKFLAG(loadevent);
+ CHECKFLAG(nochat); CHECKFLAG(partylock); CHECKFLAG(guildlock); CHECKFLAG(src4instance);
+ CHECKFLAG(notomb);
clif->message(sd->fd," ");
clif->message(sd->fd,msg_txt(1312)); // Usage: "@mapflag monster_noteleport 1" (0=Off | 1=On)
clif->message(sd->fd,msg_txt(1313)); // Type "@mapflag available" to list the available mapflags.
@@ -7606,34 +7559,34 @@ ACMD(mapflag) {
if ( strcmp( flag_name , "gvg" ) == 0 ) {
if( flag && !maplist[sd->bl.m].flag.gvg )
- iMap->zone_change2(sd->bl.m,strdb_get(zone_db, MAP_ZONE_GVG_NAME));
+ map->zone_change2(sd->bl.m,strdb_get(zone_db, MAP_ZONE_GVG_NAME));
else if ( !flag && maplist[sd->bl.m].flag.gvg )
- iMap->zone_change2(sd->bl.m,maplist[sd->bl.m].prev_zone);
+ map->zone_change2(sd->bl.m,maplist[sd->bl.m].prev_zone);
} else if ( strcmp( flag_name , "pvp" ) == 0 ) {
if( flag && !maplist[sd->bl.m].flag.pvp )
- iMap->zone_change2(sd->bl.m,strdb_get(zone_db, MAP_ZONE_PVP_NAME));
+ map->zone_change2(sd->bl.m,strdb_get(zone_db, MAP_ZONE_PVP_NAME));
else if ( !flag && maplist[sd->bl.m].flag.pvp )
- iMap->zone_change2(sd->bl.m,maplist[sd->bl.m].prev_zone);
+ map->zone_change2(sd->bl.m,maplist[sd->bl.m].prev_zone);
} else if ( strcmp( flag_name , "battleground" ) == 0 ) {
if( flag && !maplist[sd->bl.m].flag.battleground )
- iMap->zone_change2(sd->bl.m,strdb_get(zone_db, MAP_ZONE_BG_NAME));
+ map->zone_change2(sd->bl.m,strdb_get(zone_db, MAP_ZONE_BG_NAME));
else if ( !flag && maplist[sd->bl.m].flag.battleground )
- iMap->zone_change2(sd->bl.m,maplist[sd->bl.m].prev_zone);
- }
-
- setflag(autotrade); setflag(allowks); setflag(nomemo); setflag(noteleport);
- setflag(noreturn); setflag(monster_noteleport);setflag(nosave); setflag(nobranch);
- setflag(noexppenalty); setflag(pvp); setflag(pvp_noparty); setflag(pvp_noguild);
- setflag(pvp_nightmaredrop); setflag(pvp_nocalcrank); setflag(gvg_castle); setflag(gvg);
- setflag(gvg_dungeon); setflag(gvg_noparty); setflag(battleground); setflag(nozenypenalty);
- setflag(notrade); setflag(noskill); setflag(nowarp); setflag(nowarpto);
- setflag(noicewall); setflag(snow); setflag(clouds); setflag(clouds2);
- setflag(fog); setflag(fireworks); setflag(sakura); setflag(leaves);
- setflag(nobaseexp);
- setflag(nojobexp); setflag(nomobloot); setflag(nomvploot); setflag(nightenabled);
- setflag(nodrop); setflag(novending); setflag(loadevent);
- setflag(nochat); setflag(partylock); setflag(guildlock); setflag(src4instance);
- setflag(notomb);
+ map->zone_change2(sd->bl.m,maplist[sd->bl.m].prev_zone);
+ }
+
+ SETFLAG(autotrade); SETFLAG(allowks); SETFLAG(nomemo); SETFLAG(noteleport);
+ SETFLAG(noreturn); SETFLAG(monster_noteleport); SETFLAG(nosave); SETFLAG(nobranch);
+ SETFLAG(noexppenalty); SETFLAG(pvp); SETFLAG(pvp_noparty); SETFLAG(pvp_noguild);
+ SETFLAG(pvp_nightmaredrop); SETFLAG(pvp_nocalcrank); SETFLAG(gvg_castle); SETFLAG(gvg);
+ SETFLAG(gvg_dungeon); SETFLAG(gvg_noparty); SETFLAG(battleground); SETFLAG(nozenypenalty);
+ SETFLAG(notrade); SETFLAG(noskill); SETFLAG(nowarp); SETFLAG(nowarpto);
+ SETFLAG(noicewall); SETFLAG(snow); SETFLAG(clouds); SETFLAG(clouds2);
+ SETFLAG(fog); SETFLAG(fireworks); SETFLAG(sakura); SETFLAG(leaves);
+ SETFLAG(nobaseexp);
+ SETFLAG(nojobexp); SETFLAG(nomobloot); SETFLAG(nomvploot); SETFLAG(nightenabled);
+ SETFLAG(nodrop); SETFLAG(novending); SETFLAG(loadevent);
+ SETFLAG(nochat); SETFLAG(partylock); SETFLAG(guildlock); SETFLAG(src4instance);
+ SETFLAG(notomb);
clif->message(sd->fd,msg_txt(1314)); // Invalid flag name or flag.
clif->message(sd->fd,msg_txt(1312)); // Usage: "@mapflag monster_noteleport 1" (0=Off | 1=On)
@@ -7647,8 +7600,8 @@ ACMD(mapflag) {
clif->message(sd->fd,"nomvploot, nightenabled, nodrop, novending, loadevent, nochat, partylock,");
clif->message(sd->fd,"guildlock, src4instance, notomb");
-#undef checkflag
-#undef setflag
+#undef CHECKFLAG
+#undef SETFLAG
return true;
}
@@ -7706,7 +7659,7 @@ ACMD(showdelay)
*------------------------------------------*/
ACMD(invite) {
unsigned int did = sd->duel_group;
- struct map_session_data *target_sd = iMap->nick2sd((char *)message);
+ struct map_session_data *target_sd = map->nick2sd((char *)message);
if(did == 0) {
// "Duel: @invite without @duel."
@@ -7778,7 +7731,7 @@ ACMD(duel) {
duel->create(sd, maxpl);
} else {
struct map_session_data *target_sd;
- target_sd = iMap->nick2sd((char *)message);
+ target_sd = map->nick2sd((char *)message);
if(target_sd != NULL) {
unsigned int newduel;
if((newduel = duel->create(sd, 2)) != -1) {
@@ -7907,8 +7860,7 @@ ACMD(cash)
}
// @clone/@slaveclone/@evilclone <playername> [Valaris]
-ACMD(clone)
-{
+ACMD(clone) {
int x=0,y=0,flag=0,master=0,i=0;
struct map_session_data *pl_sd=NULL;
@@ -7917,7 +7869,7 @@ ACMD(clone)
return true;
}
- if((pl_sd=iMap->nick2sd((char *)message)) == NULL && (pl_sd=iMap->charid2sd(atoi(message))) == NULL) {
+ if((pl_sd=map->nick2sd((char *)message)) == NULL && (pl_sd=map->charid2sd(atoi(message))) == NULL) {
clif->message(fd, msg_txt(3)); // Character not found.
return true;
}
@@ -7946,7 +7898,7 @@ ACMD(clone)
do {
x = sd->bl.x + (rnd() % 10 - 5);
y = sd->bl.y + (rnd() % 10 - 5);
- } while (iMap->getcell(sd->bl.m,x,y,CELL_CHKNOPASS) && i++ < 10);
+ } while (map->getcell(sd->bl.m,x,y,CELL_CHKNOPASS) && i++ < 10);
if (i >= 10) {
x = sd->bl.x;
@@ -9060,15 +9012,15 @@ ACMD(channel) {
}
if (!message || !*message || sscanf(message, "%s %s %24[^\n]", key, sub1, sub2) < 1) {
- sprintf(atcmd_output, msg_txt(1434), sub2);// Player '%s' was not found
- clif->message(fd, atcmd_output);
- return false;
+ sprintf(atcmd_output, msg_txt(1434), sub2);// Player '%s' was not found
+ clif->message(fd, atcmd_output);
+ return false;
}
- if( sub2[0] == '\0' || ( pl_sd = iMap->nick2sd(sub2) ) == NULL ) {
- sprintf(atcmd_output, msg_txt(1434), sub2);// Player '%s' was not found
- clif->message(fd, atcmd_output);
- return false;
+ if( sub2[0] == '\0' || ( pl_sd = map->nick2sd(sub2) ) == NULL ) {
+ sprintf(atcmd_output, msg_txt(1434), sub2);// Player '%s' was not found
+ clif->message(fd, atcmd_output);
+ return false;
}
if( pc->has_permission(pl_sd, PC_PERM_HCHSYS_ADMIN) ) {
@@ -9121,7 +9073,7 @@ ACMD(channel) {
return false;
}
- if( sub2[0] == '\0' || ( pl_sd = iMap->nick2sd(sub2) ) == NULL ) {
+ if( sub2[0] == '\0' || ( pl_sd = map->nick2sd(sub2) ) == NULL ) {
sprintf(atcmd_output, msg_txt(1434), sub2);// Player '%s' was not found
clif->message(fd, atcmd_output);
return false;
@@ -9942,16 +9894,21 @@ bool is_atcommand(const int fd, struct map_session_data* sd, const char* message
binding = atcommand->get_bind_byname(command);
// Check if the binding isn't NULL and there is a NPC event, level of usage met, et cetera
- if( binding != NULL && binding->npc_event[0] &&
- ((*atcmd_msg == atcommand->at_symbol && pc->get_group_level(sd) >= binding->group_lv) ||
- (*atcmd_msg == atcommand->char_symbol && pc->get_group_level(sd) >= binding->group_lv_char)))
- {
+ if( binding != NULL
+ && binding->npc_event[0]
+ && (
+ (*atcmd_msg == atcommand->at_symbol && pc->get_group_level(sd) >= binding->group_lv)
+ || (*atcmd_msg == atcommand->char_symbol && pc->get_group_level(sd) >= binding->group_lv_char)
+ )
+ ) {
// Check if self or character invoking; if self == character invoked, then self invoke.
bool invokeFlag = ((*atcmd_msg == atcommand->at_symbol) ? 1 : 0);
// Check if the command initiated is a character command
- if (*message == atcommand->char_symbol &&
- (ssd = iMap->nick2sd(charname)) == NULL && (ssd = iMap->nick2sd(charname2)) == NULL ) {
+ if (*message == atcommand->char_symbol
+ && (ssd = map->nick2sd(charname)) == NULL
+ && (ssd = map->nick2sd(charname2)) == NULL
+ ) {
sprintf(output, msg_txt(1389), command); // %s failed. Player not found.
clif->message(fd, output);
return true;
@@ -10000,8 +9957,10 @@ bool is_atcommand(const int fd, struct map_session_data* sd, const char* message
}
// Check if target is valid only if confirmed that player can use command.
- if (*message == atcommand->char_symbol &&
- (ssd = iMap->nick2sd(charname)) == NULL && (ssd = iMap->nick2sd(charname2)) == NULL ) {
+ if (*message == atcommand->char_symbol
+ && (ssd = map->nick2sd(charname)) == NULL
+ && (ssd = map->nick2sd(charname2)) == NULL
+ ) {
sprintf(output, msg_txt(1389), command); // %s failed. Player not found.
clif->message(fd, output);
return true;
@@ -10299,7 +10258,7 @@ void atcommand_doload(void) {
if( atcommand->alias_db == NULL )
atcommand->alias_db = stridb_alloc(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA, ATCOMMAND_LENGTH);
atcommand_basecommands(); //fills initial atcommand_db with known commands
- atcommand_config_read(iMap->ATCOMMAND_CONF_FILENAME);
+ atcommand_config_read(map->ATCOMMAND_CONF_FILENAME);
}
void do_init_atcommand(void) {
diff --git a/src/map/battle.c b/src/map/battle.c
index abbef8c77..64ccfd6c6 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -91,7 +91,7 @@ struct block_list* battle_gettargeted(struct block_list *target) {
nullpo_retr(NULL, target);
memset(bl_list, 0, sizeof(bl_list));
- iMap->foreachinrange(battle->get_targeted_sub, target, AREA_SIZE, BL_CHAR, bl_list, &c, target->id);
+ map->foreachinrange(battle->get_targeted_sub, target, AREA_SIZE, BL_CHAR, bl_list, &c, target->id);
if ( c == 0 )
return NULL;
if( c > 24 )
@@ -147,7 +147,7 @@ struct block_list* battle_getenemy(struct block_list *target, int type, int rang
int c = 0;
memset(bl_list, 0, sizeof(bl_list));
- iMap->foreachinrange(battle->get_enemy_sub, target, range, type, bl_list, &c, target);
+ map->foreachinrange(battle->get_enemy_sub, target, range, type, bl_list, &c, target);
if ( c == 0 )
return NULL;
@@ -189,7 +189,7 @@ struct block_list* battle_getenemyarea(struct block_list *src, int x, int y, int
int c = 0;
memset(bl_list, 0, sizeof(bl_list));
- iMap->foreachinarea(battle->get_enemy_area_sub, src->m, x - range, y - range, x + range, y + range, type, bl_list, &c, src, ignore_id);
+ map->foreachinarea(battle->get_enemy_area_sub, src->m, x - range, y - range, x + range, y + range, type, bl_list, &c, src, ignore_id);
if( c == 0 )
return NULL;
@@ -219,10 +219,10 @@ int battle_delay_damage_sub(int tid, unsigned int tick, int id, intptr_t data) {
if ( dat ) {
struct block_list* src = NULL;
- struct block_list* target = iMap->id2bl(dat->target_id);
+ struct block_list* target = map->id2bl(dat->target_id);
if( !target || status->isdead(target) ) {/* nothing we can do */
- if( dat->src_type == BL_PC && ( src = iMap->id2bl(dat->src_id) ) && --((TBL_PC*)src)->delayed_damage == 0 && ((TBL_PC*)src)->state.hold_recalc ) {
+ if( dat->src_type == BL_PC && ( src = map->id2bl(dat->src_id) ) && --((TBL_PC*)src)->delayed_damage == 0 && ((TBL_PC*)src)->state.hold_recalc ) {
((TBL_PC*)src)->state.hold_recalc = 0;
status_calc_pc(((TBL_PC*)src),0);
}
@@ -230,26 +230,27 @@ int battle_delay_damage_sub(int tid, unsigned int tick, int id, intptr_t data) {
return 0;
}
- src = iMap->id2bl(dat->src_id);
+ src = map->id2bl(dat->src_id);
- if( src && target->m == src->m &&
- (target->type != BL_PC || ((TBL_PC*)target)->invincible_timer == INVALID_TIMER) &&
- check_distance_bl(src, target, dat->distance) ) //Check to see if you haven't teleported. [Skotlex]
- {
- iMap->freeblock_lock();
+ //Check to see if you haven't teleported. [Skotlex]
+ if( src && target->m == src->m
+ && (target->type != BL_PC || ((TBL_PC*)target)->invincible_timer == INVALID_TIMER)
+ && check_distance_bl(src, target, dat->distance)
+ ) {
+ map->freeblock_lock();
status_fix_damage(src, target, dat->damage, dat->delay);
if( dat->attack_type && !status->isdead(target) && dat->additional_effects )
skill->additional_effect(src,target,dat->skill_id,dat->skill_lv,dat->attack_type,dat->dmg_lv,tick);
if( dat->dmg_lv > ATK_BLOCK && dat->attack_type )
skill->counter_additional_effect(src,target,dat->skill_id,dat->skill_lv,dat->attack_type,tick);
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
} else if( !src && dat->skill_id == CR_REFLECTSHIELD ) {
/**
* it was monster reflected damage, and the monster died, we pass the damage to the character as expected
**/
- iMap->freeblock_lock();
+ map->freeblock_lock();
status_fix_damage(target, target, dat->damage, dat->delay);
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
}
if( src && src->type == BL_PC && --((TBL_PC*)src)->delayed_damage == 0 && ((TBL_PC*)src)->state.hold_recalc ) {
@@ -273,13 +274,13 @@ int battle_delay_damage (unsigned int tick, int amotion, struct block_list *src,
damage = 0;
if ( !battle_config.delay_battle_damage || amotion <= 1 ) {
- iMap->freeblock_lock();
+ map->freeblock_lock();
status_fix_damage(src, target, damage, ddelay); // We have to seperate here between reflect damage and others [icescope]
if( attack_type && !status->isdead(target) && additional_effects )
skill->additional_effect(src, target, skill_id, skill_lv, attack_type, dmg_lv, timer->gettick());
if( dmg_lv > ATK_BLOCK && attack_type )
skill->counter_additional_effect(src, target, skill_id, skill_lv, attack_type, timer->gettick());
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return 0;
}
dat = ers_alloc(delay_damage_ers, struct delay_damage);
@@ -354,8 +355,10 @@ int64 battle_attr_fix(struct block_list *src, struct block_list *target, int64 d
struct skill_unit_group *sg;
struct block_list *src;
- if( !su || !su->alive || (sg = su->group) == NULL || !sg || sg->val3 == -1 ||
- (src = iMap->id2bl(sg->src_id)) == NULL || status->isdead(src) )
+ if( !su || !su->alive
+ || (sg = su->group) == NULL || sg->val3 == -1
+ || (src = map->id2bl(sg->src_id)) == NULL || status->isdead(src)
+ )
return 0;
if( sg->unit_id != UNT_FIREWALL ) {
@@ -370,39 +373,39 @@ int64 battle_attr_fix(struct block_list *src, struct block_list *target, int64 d
}
if( tsc && tsc->count ) { //since an atk can only have one type let's optimise this a bit
switch(atk_elem){
- case ELE_FIRE:
- if( tsc->data[SC_SPIDERWEB]) {
- tsc->data[SC_SPIDERWEB]->val1 = 0; // free to move now
- if( tsc->data[SC_SPIDERWEB]->val2-- > 0 )
- damage <<= 1; // double damage
- if( tsc->data[SC_SPIDERWEB]->val2 == 0 )
- status_change_end(target, SC_SPIDERWEB, INVALID_TIMER);
- }
- if( tsc->data[SC_THORNS_TRAP])
- status_change_end(target, SC_THORNS_TRAP, INVALID_TIMER);
- if( tsc->data[SC_FIRE_CLOAK_OPTION])
- damage -= damage * tsc->data[SC_FIRE_CLOAK_OPTION]->val2 / 100;
- if( tsc->data[SC_COLD] && target->type != BL_MOB)
- status_change_end(target, SC_COLD, INVALID_TIMER);
- if( tsc->data[SC_EARTH_INSIGNIA]) damage += damage/2;
- if( tsc->data[SC_VOLCANIC_ASH]) damage += damage/2; //150%
- break;
- case ELE_HOLY:
- if( tsc->data[SC_ORATIO]) ratio += tsc->data[SC_ORATIO]->val1 * 2;
- break;
- case ELE_POISON:
- if( tsc->data[SC_VENOMIMPRESS]) ratio += tsc->data[SC_VENOMIMPRESS]->val2;
- break;
- case ELE_WIND:
- if( tsc->data[SC_COLD] && target->type != BL_MOB) damage += damage/2;
- if( tsc->data[SC_WATER_INSIGNIA]) damage += damage/2;
- break;
- case ELE_WATER:
- if( tsc->data[SC_FIRE_INSIGNIA]) damage += damage/2;
- break;
- case ELE_EARTH:
- if( tsc->data[SC_WIND_INSIGNIA]) damage += damage/2;
- break;
+ case ELE_FIRE:
+ if( tsc->data[SC_SPIDERWEB]) {
+ tsc->data[SC_SPIDERWEB]->val1 = 0; // free to move now
+ if( tsc->data[SC_SPIDERWEB]->val2-- > 0 )
+ damage <<= 1; // double damage
+ if( tsc->data[SC_SPIDERWEB]->val2 == 0 )
+ status_change_end(target, SC_SPIDERWEB, INVALID_TIMER);
+ }
+ if( tsc->data[SC_THORNS_TRAP])
+ status_change_end(target, SC_THORNS_TRAP, INVALID_TIMER);
+ if( tsc->data[SC_FIRE_CLOAK_OPTION])
+ damage -= damage * tsc->data[SC_FIRE_CLOAK_OPTION]->val2 / 100;
+ if( tsc->data[SC_COLD] && target->type != BL_MOB)
+ status_change_end(target, SC_COLD, INVALID_TIMER);
+ if( tsc->data[SC_EARTH_INSIGNIA]) damage += damage/2;
+ if( tsc->data[SC_VOLCANIC_ASH]) damage += damage/2; //150%
+ break;
+ case ELE_HOLY:
+ if( tsc->data[SC_ORATIO]) ratio += tsc->data[SC_ORATIO]->val1 * 2;
+ break;
+ case ELE_POISON:
+ if( tsc->data[SC_VENOMIMPRESS]) ratio += tsc->data[SC_VENOMIMPRESS]->val2;
+ break;
+ case ELE_WIND:
+ if( tsc->data[SC_COLD] && target->type != BL_MOB) damage += damage/2;
+ if( tsc->data[SC_WATER_INSIGNIA]) damage += damage/2;
+ break;
+ case ELE_WATER:
+ if( tsc->data[SC_FIRE_INSIGNIA]) damage += damage/2;
+ break;
+ case ELE_EARTH:
+ if( tsc->data[SC_WIND_INSIGNIA]) damage += damage/2;
+ break;
}
} //end tsc check
if( src && src->type == BL_PC ){
@@ -1574,7 +1577,7 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block
party_foreachsamemap(skill->check_condition_char_sub, sd, 3, &sd->bl, &c, &p_sd, skill_id);
c = ( c > 1 ? rand()%c : 0 );
- if( (psd = iMap->id2sd(p_sd[c])) && pc->checkskill(psd,WL_COMET) > 0 ){
+ if( (psd = map->id2sd(p_sd[c])) && pc->checkskill(psd,WL_COMET) > 0 ){
skillratio = skill_lv * 400; //MATK [{( Skill Level x 400 ) x ( Caster's Base Level / 120 )} + 2500 ] %
RE_LVL_DMOD(120);
skillratio += 2500;
@@ -2536,8 +2539,7 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block
* ATK may be MISS, BLOCKED FAIL, reduc, increase, end status...
* After this we apply bg/gvg reduction
*------------------------------------------*/
-int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damage *d,int64 damage,uint16 skill_id,uint16 skill_lv)
-{
+int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damage *d,int64 damage,uint16 skill_id,uint16 skill_lv) {
struct map_session_data *sd = NULL;
struct status_change *sc;
struct status_change_entry *sce;
@@ -2549,7 +2551,7 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam
return 0;
if( battle_config.ksprotection && mob->ksprotected(src, bl) )
return 0;
- if( iMap->getcell(bl->m, bl->x, bl->y, CELL_CHKMAELSTROM) && skill->get_type(skill_id) != BF_MISC
+ if( map->getcell(bl->m, bl->x, bl->y, CELL_CHKMAELSTROM) && skill->get_type(skill_id) != BF_MISC
&& skill->get_casttype(skill_id) == CAST_GROUND )
return 0;
if (bl->type == BL_PC) {
@@ -2909,7 +2911,7 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam
if(sce->val2>=0)
damage=0;
else
- damage=-sce->val2;
+ damage=-sce->val2;
}
if((--sce->val3)<=0 || (sce->val2<=0) || skill_id == AL_HOLYLIGHT)
status_change_end(bl, SC_KYRIE, INVALID_TIMER);
@@ -2924,7 +2926,7 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam
if( (sce = sc->data[SC_LIGHTNINGWALK]) && flag&BF_LONG && rnd()%100 < sce->val1 ) {
int dx[8]={0,-1,-1,-1,0,1,1,1};
int dy[8]={1,1,0,-1,-1,-1,0,1};
- uint8 dir = iMap->calc_dir(bl, src->x, src->y);
+ uint8 dir = map->calc_dir(bl, src->x, src->y);
if( unit->movepos(bl, src->x-dx[dir], src->y-dy[dir], 1, 1) ) {
clif->slide(bl,src->x-dx[dir],src->y-dy[dir]);
unit->setdir(bl, dir);
@@ -2943,15 +2945,15 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam
if( sd && (sce = sc->data[SC_FORCEOFVANGUARD]) && flag&BF_WEAPON && rnd()%100 < sce->val2 )
pc->addspiritball(sd,skill->get_time(LG_FORCEOFVANGUARD,sce->val1),sce->val3);
if (sc->data[SC_STYLE_CHANGE] && rnd()%2) {
- TBL_HOM *hd = BL_CAST(BL_HOM,bl);
- if (hd) homun->addspiritball(hd, 10); //add a sphere
- }
+ TBL_HOM *hd = BL_CAST(BL_HOM,bl);
+ if (hd) homun->addspiritball(hd, 10); //add a sphere
+ }
if( sc->data[SC__DEADLYINFECT] && damage > 0 && rnd()%100 < 65 + 5 * sc->data[SC__DEADLYINFECT]->val1 )
status->change_spread(bl, src); // Deadly infect attacked side
if( sc && sc->data[SC__SHADOWFORM] ) {
- struct block_list *s_bl = iMap->id2bl(sc->data[SC__SHADOWFORM]->val2);
+ struct block_list *s_bl = map->id2bl(sc->data[SC__SHADOWFORM]->val2);
if( !s_bl || s_bl->m != bl->m ) { // If the shadow form target is not present remove the sc.
status_change_end(bl, SC__SHADOWFORM, INVALID_TIMER);
} else if( status->isdead(s_bl) || !battle->check_target(src,s_bl,BCT_ENEMY)) { // If the shadow form target is dead or not your enemy remove the sc in both.
@@ -5046,7 +5048,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
change = true;
if( change )
sd->state.autocast = 1;
- iMap->foreachinshootrange(battle->damage_area,target,skill->get_splash(LG_REFLECTDAMAGE,1),BL_CHAR,timer->gettick(),target,wd.amotion,sstatus->dmotion,rdamage,tstatus->race);
+ map->foreachinshootrange(battle->damage_area,target,skill->get_splash(LG_REFLECTDAMAGE,1),BL_CHAR,timer->gettick(),target,wd.amotion,sstatus->dmotion,rdamage,tstatus->race);
if( change )
sd->state.autocast = 0;
}
@@ -5212,10 +5214,10 @@ int64 battle_calc_return_damage(struct block_list* bl, struct block_list *src, i
}
}
if( sc->data[SC_DEATHBOUND] && skill_id != WS_CARTTERMINATION && !is_boss(src) ) {
- uint8 dir = iMap->calc_dir(bl,src->x,src->y),
+ uint8 dir = map->calc_dir(bl,src->x,src->y),
t_dir = unit->getdir(bl);
- if( !iMap->check_dir(dir,t_dir) ) {
+ if( !map->check_dir(dir,t_dir) ) {
int64 rd1 = damage * sc->data[SC_DEATHBOUND]->val2 / 100; // Amplify damage.
trdamage += rdamage = rd1 - (*dmg = rd1 * 30 / 100); // not normalized as intended.
clif->skill_damage(src, bl, timer->gettick(), status_get_amotion(src), 0, -3000, 1, RK_DEATHBOUND, sc->data[SC_DEATHBOUND]->val1, 6);
@@ -5312,7 +5314,7 @@ int battle_damage_area( struct block_list *bl, va_list ap) {
if( bl->type == BL_MOB && ((TBL_MOB*)bl)->class_ == MOBID_EMPERIUM )
return 0;
if( bl != src && battle->check_target(src,bl,BCT_ENEMY) > 0 ) {
- iMap->freeblock_lock();
+ map->freeblock_lock();
if( src->type == BL_PC )
battle->drain((TBL_PC*)src, bl, damage, damage, status_get_race(bl), is_boss(bl));
if( amotion )
@@ -5322,7 +5324,7 @@ int battle_damage_area( struct block_list *bl, va_list ap) {
clif->damage(bl,bl,tick,amotion,dmotion,damage,1,ATK_BLOCK,0);
if( !(src && src->type == BL_PC && ((TBL_PC*)src)->state.autocast) )
skill->additional_effect(src, bl, CR_REFLECTSHIELD, 1, BF_WEAPON|BF_SHORT|BF_NORMAL,ATK_DEF,tick);
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
}
return 0;
@@ -5395,19 +5397,17 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
}
}
}
- if (sc && sc->count) {
- if (sc->data[SC_CLOAKING] && !(sc->data[SC_CLOAKING]->val4 & 2))
- status_change_end(src, SC_CLOAKING, INVALID_TIMER);
- else if (sc->data[SC_CLOAKINGEXCEED] && !(sc->data[SC_CLOAKINGEXCEED]->val4 & 2))
- status_change_end(src, SC_CLOAKINGEXCEED, INVALID_TIMER);
- }
- if( tsc && tsc->data[SC_AUTOCOUNTER] && status->check_skilluse(target, src, KN_AUTOCOUNTER, 1) )
- {
- uint8 dir = iMap->calc_dir(target,src->x,src->y);
+ if (sc && sc->count) {
+ if (sc->data[SC_CLOAKING] && !(sc->data[SC_CLOAKING]->val4 & 2))
+ status_change_end(src, SC_CLOAKING, INVALID_TIMER);
+ else if (sc->data[SC_CLOAKINGEXCEED] && !(sc->data[SC_CLOAKINGEXCEED]->val4 & 2))
+ status_change_end(src, SC_CLOAKINGEXCEED, INVALID_TIMER);
+ }
+ if( tsc && tsc->data[SC_AUTOCOUNTER] && status->check_skilluse(target, src, KN_AUTOCOUNTER, 1) ) {
+ uint8 dir = map->calc_dir(target,src->x,src->y);
int t_dir = unit->getdir(target);
int dist = distance_bl(src, target);
- if(dist <= 0 || (!iMap->check_dir(dir,t_dir) && dist <= tstatus->rhw.range+1))
- {
+ if(dist <= 0 || (!map->check_dir(dir,t_dir) && dist <= tstatus->rhw.range+1)) {
uint16 skill_lv = tsc->data[SC_AUTOCOUNTER]->val1;
clif->skillcastcancel(target); //Remove the casting bar. [Skotlex]
clif->damage(src, target, tick, sstatus->amotion, 1, 0, 1, 0, 0); //Display MISS.
@@ -5422,8 +5422,8 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
uint16 skill_lv = tsc->data[SC_BLADESTOP_WAIT]->val1;
int duration = skill->get_time2(MO_BLADESTOP,skill_lv);
status_change_end(target, SC_BLADESTOP_WAIT, INVALID_TIMER);
- if(sc_start4(src, SC_BLADESTOP, 100, sd?pc->checkskill(sd, MO_BLADESTOP):5, 0, 0, target->id, duration))
- { //Target locked.
+ if(sc_start4(src, SC_BLADESTOP, 100, sd?pc->checkskill(sd, MO_BLADESTOP):5, 0, 0, target->id, duration)) {
+ //Target locked.
clif->damage(src, target, tick, sstatus->amotion, 1, 0, 1, 0, 0); //Display MISS.
clif->bladestop(target, src->id, 1);
sc_start4(target, SC_BLADESTOP, 100, skill_lv, 0, 0, src->id, duration);
@@ -5537,13 +5537,13 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
if( su->group && su->group->skill_id == HT_BLASTMINE)
skill->blown(src, target, 3, -1, 0);
}
- iMap->freeblock_lock();
+ map->freeblock_lock();
battle->delay_damage(tick, wd.amotion, src, target, wd.flag, 0, 0, damage, wd.dmg_lv, wd.dmotion, true);
if( tsc ) {
if( tsc->data[SC_DEVOTION] ) {
struct status_change_entry *sce = tsc->data[SC_DEVOTION];
- struct block_list *d_bl = iMap->id2bl(sce->val1);
+ struct block_list *d_bl = map->id2bl(sce->val1);
if( d_bl && (
(d_bl->type == BL_MER && ((TBL_MER*)d_bl)->master && ((TBL_MER*)d_bl)->master->bl.id == target->id) ||
@@ -5562,13 +5562,13 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
skill->attack(BF_MAGIC,&ed->bl,&ed->bl,src,EL_CIRCLE_OF_FIRE,tsc->data[SC_CIRCLE_OF_FIRE_OPTION]->val1,tick,wd.flag);
}
} else if( tsc->data[SC_WATER_SCREEN_OPTION] && tsc->data[SC_WATER_SCREEN_OPTION]->val1 ) {
- struct block_list *e_bl = iMap->id2bl(tsc->data[SC_WATER_SCREEN_OPTION]->val1);
+ struct block_list *e_bl = map->id2bl(tsc->data[SC_WATER_SCREEN_OPTION]->val1);
if( e_bl && !status->isdead(e_bl) ) {
clif->damage(e_bl,e_bl,tick,wd.amotion,wd.dmotion,damage,wd.div_,wd.type,wd.damage2);
status->damage(target,e_bl,damage,0,0,0);
// Just show damage in target.
clif->damage(src, target, tick, wd.amotion, wd.dmotion, damage, wd.div_, wd.type, wd.damage2 );
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return ATK_NONE;
}
}
@@ -5600,28 +5600,30 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
}
}
if (sd) {
- if( wd.flag&BF_SHORT && sc && sc->data[SC__AUTOSHADOWSPELL] && rnd()%100 < sc->data[SC__AUTOSHADOWSPELL]->val3 &&
- sd->status.skill[skill->get_index(sc->data[SC__AUTOSHADOWSPELL]->val1)].id != 0 && sd->status.skill[skill->get_index(sc->data[SC__AUTOSHADOWSPELL]->val1)].flag == SKILL_FLAG_PLAGIARIZED )
- {
- int r_skill = sd->status.skill[skill->get_index(sc->data[SC__AUTOSHADOWSPELL]->val1)].id,
- r_lv = sc->data[SC__AUTOSHADOWSPELL]->val2;
+ if( wd.flag&BF_SHORT && sc
+ && sc->data[SC__AUTOSHADOWSPELL] && rnd()%100 < sc->data[SC__AUTOSHADOWSPELL]->val3
+ && sd->status.skill[skill->get_index(sc->data[SC__AUTOSHADOWSPELL]->val1)].id != 0
+ && sd->status.skill[skill->get_index(sc->data[SC__AUTOSHADOWSPELL]->val1)].flag == SKILL_FLAG_PLAGIARIZED
+ ) {
+ int r_skill = sd->status.skill[skill->get_index(sc->data[SC__AUTOSHADOWSPELL]->val1)].id;
+ int r_lv = sc->data[SC__AUTOSHADOWSPELL]->val2;
if (r_skill != AL_HOLYLIGHT && r_skill != PR_MAGNUS) {
int type;
if( (type = skill->get_casttype(r_skill)) == CAST_GROUND ) {
int maxcount = 0;
- if( !(BL_PC&battle_config.skill_reiteration) &&
- skill->get_unit_flag(r_skill)&UF_NOREITERATION )
- type = -1;
+ if( !(BL_PC&battle_config.skill_reiteration)
+ && skill->get_unit_flag(r_skill)&UF_NOREITERATION )
+ type = -1;
- if( BL_PC&battle_config.skill_nofootset &&
- skill->get_unit_flag(r_skill)&UF_NOFOOTSET )
- type = -1;
+ if( BL_PC&battle_config.skill_nofootset
+ && skill->get_unit_flag(r_skill)&UF_NOFOOTSET )
+ type = -1;
- if( BL_PC&battle_config.land_skill_limit &&
- (maxcount = skill->get_maxcount(r_skill, r_lv)) > 0
- ) {
+ if( BL_PC&battle_config.land_skill_limit
+ && (maxcount = skill->get_maxcount(r_skill, r_lv)) > 0
+ ) {
int v;
for(v=0;v<MAX_SKILLUNITGROUP && sd->ud.skillunit[v] && maxcount;v++) {
if(sd->ud.skillunit[v]->skill_id == r_skill)
@@ -5631,10 +5633,10 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
type = -1;
}
- if( type != CAST_GROUND ){
- clif->skill_fail(sd,r_skill,USESKILL_FAIL_LEVEL,0);
- iMap->freeblock_unlock();
- return wd.dmg_lv;
+ if( type != CAST_GROUND ) {
+ clif->skill_fail(sd,r_skill,USESKILL_FAIL_LEVEL,0);
+ map->freeblock_unlock();
+ return wd.dmg_lv;
}
}
@@ -5667,12 +5669,14 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
}
if (tsc) {
- if (tsc->data[SC_POISONREACT] &&
- (rnd()%100 < tsc->data[SC_POISONREACT]->val3
- || sstatus->def_ele == ELE_POISON) &&
-// check_distance_bl(src, target, tstatus->rhw.range+1) && Doesn't checks range! o.O;
- status->check_skilluse(target, src, TF_POISON, 0)
- ) { //Poison React
+ if (tsc->data[SC_POISONREACT]
+ && ( rnd()%100 < tsc->data[SC_POISONREACT]->val3
+ || sstatus->def_ele == ELE_POISON
+ )
+ /* && check_distance_bl(src, target, tstatus->rhw.range+1) Doesn't check range! o.O; */
+ && status->check_skilluse(target, src, TF_POISON, 0)
+ ) {
+ //Poison React
struct status_change_entry *sce = tsc->data[SC_POISONREACT];
if (sstatus->def_ele == ELE_POISON) {
sce->val2 = 0;
@@ -5685,7 +5689,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
status_change_end(target, SC_POISONREACT, INVALID_TIMER);
}
}
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return wd.dmg_lv;
}
@@ -5707,8 +5711,7 @@ int battle_check_undead(int race,int element)
}
//Returns the upmost level master starting with the given object
-struct block_list* battle_get_master(struct block_list *src)
-{
+struct block_list* battle_get_master(struct block_list *src) {
struct block_list *prev; //Used for infinite loop check (master of yourself?)
do {
prev = src;
@@ -5719,7 +5722,7 @@ struct block_list* battle_get_master(struct block_list *src)
break;
case BL_MOB:
if (((TBL_MOB*)src)->master_id)
- src = iMap->id2bl(((TBL_MOB*)src)->master_id);
+ src = map->id2bl(((TBL_MOB*)src)->master_id);
break;
case BL_HOM:
if (((TBL_HOM*)src)->master)
@@ -5735,7 +5738,7 @@ struct block_list* battle_get_master(struct block_list *src)
break;
case BL_SKILL:
if (((TBL_SKILL*)src)->group && ((TBL_SKILL*)src)->group->src_id)
- src = iMap->id2bl(((TBL_SKILL*)src)->group->src_id);
+ src = map->id2bl(((TBL_SKILL*)src)->group->src_id);
break;
}
} while (src && src != prev);
@@ -5880,8 +5883,7 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
return 0;
} //end switch actual target
- switch( t_bl->type )
- { //Checks on target master
+ switch( t_bl->type ) { //Checks on target master
case BL_PC:
{
struct map_session_data *sd;
@@ -5902,12 +5904,12 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
{
struct mob_data *md = BL_CAST(BL_MOB, t_bl);
- if( !((iMap->agit_flag || iMap->agit2_flag) && maplist[m].flag.gvg_castle) && md->guardian_data && md->guardian_data->guild_id )
+ if( !((map->agit_flag || map->agit2_flag) && maplist[m].flag.gvg_castle) && md->guardian_data && md->guardian_data->guild_id )
return 0; // Disable guardians/emperiums owned by Guilds on non-woe times.
break;
}
default: break; //other type doesn't have slave yet
- } //end switch master target
+ } //end switch master target
switch( src->type ) { //Checks on actual src type
case BL_PET:
@@ -5934,7 +5936,7 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
if (t_bl->type == BL_MOB && ((TBL_MOB*)t_bl)->class_ == MOBID_EMPERIUM && flag&BCT_ENEMY)
return 0; //mercenary may not attack Emperium
break;
- } //end switch actual src
+ } //end switch actual src
switch( s_bl->type ) { //Checks on source master
case BL_PC:
@@ -5962,7 +5964,7 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
case BL_MOB:
{
struct mob_data *md = BL_CAST(BL_MOB, s_bl);
- if( !((iMap->agit_flag || iMap->agit2_flag) && maplist[m].flag.gvg_castle) && md->guardian_data && md->guardian_data->guild_id )
+ if( !((map->agit_flag || map->agit2_flag) && maplist[m].flag.gvg_castle) && md->guardian_data && md->guardian_data->guild_id )
return 0; // Disable guardians/emperium owned by Guilds on non-woe times.
if( !md->special_state.ai )
@@ -5987,7 +5989,7 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
if (t_bl->type != s_bl->type)
state |= BCT_ENEMY;
break;
- } //end switch on src master
+ } //end switch on src master
if( (flag&BCT_ALL) == BCT_ALL )
{ //All actually stands for all attackable chars
@@ -6050,7 +6052,7 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
)
state &= ~BCT_ENEMY;
}
- }//end map_flag_vs chk rivality
+ }//end map_flag_vs chk rivality
else
{ //Non pvp/gvg, check party/guild settings.
if( flag&BCT_PARTY || state&BCT_ENEMY ) {
@@ -6580,7 +6582,7 @@ void Hercules_report(char* date, char *time_c) {
#endif
/* non-define part */
- if( iMap->db_use_sql_item_db || iMap->db_use_sql_mob_db || iMap->db_use_sql_mob_skill_db )
+ if( map->db_use_sql_item_db || map->db_use_sql_mob_db || map->db_use_sql_mob_skill_db )
config |= C_SQL_DBS; //TODO: split this config into three.
if( logs->config.sql_logs )
@@ -6615,7 +6617,7 @@ void Hercules_report(char* date, char *time_c) {
safestrncpy((char*)WBUFP(buf,6 + 12 + 9), timestring, 24);
safestrncpy((char*)WBUFP(buf,6 + 12 + 9 + 24), git[0] != HERC_UNKNOWN_VER ? git : svn[0] != HERC_UNKNOWN_VER ? svn : "Unknown", 41);
- WBUFL(buf,6 + 12 + 9 + 24 + 41) = iMap->getusers();
+ WBUFL(buf,6 + 12 + 9 + 24 + 41) = map->getusers();
WBUFL(buf,6 + 12 + 9 + 24 + 41 + 4) = config;
WBUFL(buf,6 + 12 + 9 + 24 + 41 + 4 + 4) = bd_size;
diff --git a/src/map/battleground.c b/src/map/battleground.c
index 25d942226..160d2f96e 100644
--- a/src/map/battleground.c
+++ b/src/map/battleground.c
@@ -200,7 +200,7 @@ int bg_team_get_id(struct block_list *bl) {
{
struct map_session_data *msd;
struct mob_data *md = (TBL_MOB*)bl;
- if( md->special_state.ai && (msd = iMap->id2sd(md->master_id)) != NULL )
+ if( md->special_state.ai && (msd = map->id2sd(md->master_id)) != NULL )
return msd->bg_id;
return md->bg_id;
}
@@ -448,7 +448,7 @@ void bg_queue_ready_ack (struct bg_arena *arena, struct map_session_data *sd, bo
sd->bg_queue.ready = 1;
for( i = 0; i < queue->size; i++ ) {
- if( queue->item[i] > 0 && ( sd = iMap->id2sd(queue->item[i]) ) ) {
+ if( queue->item[i] > 0 && ( sd = map->id2sd(queue->item[i]) ) ) {
if( sd->bg_queue.ready == 1 )
count++;
}
@@ -488,7 +488,7 @@ void bg_match_over(struct bg_arena *arena, bool canceled) {
for( i = 0; i < queue->size; i++ ) {
struct map_session_data * sd = NULL;
- if( queue->item[i] > 0 && ( sd = iMap->id2sd(queue->item[i]) ) ) {
+ if( queue->item[i] > 0 && ( sd = map->id2sd(queue->item[i]) ) ) {
if( sd->bg_queue.arena ) {
bg->team_leave(sd, 0);
bg->queue_pc_cleanup(sd);
@@ -513,7 +513,7 @@ void bg_begin(struct bg_arena *arena) {
for( i = 0; i < queue->size; i++ ) {
struct map_session_data * sd = NULL;
- if( queue->item[i] > 0 && ( sd = iMap->id2sd(queue->item[i]) ) ) {
+ if( queue->item[i] > 0 && ( sd = map->id2sd(queue->item[i]) ) ) {
if( sd->bg_queue.ready == 1 )
count++;
else
@@ -547,7 +547,7 @@ void bg_queue_pregame(struct bg_arena *arena) {
for( i = 0; i < queue->size; i++ ) {
struct map_session_data * sd = NULL;
- if( queue->item[i] > 0 && ( sd = iMap->id2sd(queue->item[i]) ) ) {
+ if( queue->item[i] > 0 && ( sd = map->id2sd(queue->item[i]) ) ) {
clif->bgqueue_battlebegins(sd,arena->id,SELF);
}
}
diff --git a/src/map/buyingstore.c b/src/map/buyingstore.c
index f943b2a20..fb511505b 100644
--- a/src/map/buyingstore.c
+++ b/src/map/buyingstore.c
@@ -64,8 +64,8 @@ bool buyingstore_setup(struct map_session_data* sd, unsigned char slots)
return false;
}
- if( iMap->getcell(sd->bl.m, sd->bl.x, sd->bl.y, CELL_CHKNOVENDING) )
- {// custom: no vending cells
+ if( map->getcell(sd->bl.m, sd->bl.x, sd->bl.y, CELL_CHKNOVENDING) ) {
+ // custom: no vending cells
clif->message(sd->fd, msg_txt(204)); // "You can't open a shop on this cell."
return false;
}
@@ -119,8 +119,8 @@ void buyingstore_create(struct map_session_data* sd, int zenylimit, unsigned cha
return;
}
- if( iMap->getcell(sd->bl.m, sd->bl.x, sd->bl.y, CELL_CHKNOVENDING) )
- {// custom: no vending cells
+ if( map->getcell(sd->bl.m, sd->bl.x, sd->bl.y, CELL_CHKNOVENDING) ) {
+ // custom: no vending cells
clif->message(sd->fd, msg_txt(204)); // "You can't open a shop on this cell."
return;
}
@@ -227,8 +227,8 @@ void buyingstore_open(struct map_session_data* sd, int account_id)
return;
}
- if( ( pl_sd = iMap->id2sd(account_id) ) == NULL || !pl_sd->state.buyingstore )
- {// not online or not buying
+ if( ( pl_sd = map->id2sd(account_id) ) == NULL || !pl_sd->state.buyingstore ) {
+ // not online or not buying
return;
}
@@ -266,8 +266,8 @@ void buyingstore_trade(struct map_session_data* sd, int account_id, unsigned int
return;
}
- if( ( pl_sd = iMap->id2sd(account_id) ) == NULL || !pl_sd->state.buyingstore || pl_sd->buyer_id != buyer_id )
- {// not online, not buying or not same store
+ if( ( pl_sd = map->id2sd(account_id) ) == NULL || !pl_sd->state.buyingstore || pl_sd->buyer_id != buyer_id ) {
+ // not online, not buying or not same store
clif->buyingstore_trade_failed_seller(sd, BUYINGSTORE_TRADE_SELLER_FAILED, 0);
return;
}
@@ -383,7 +383,7 @@ void buyingstore_trade(struct map_session_data* sd, int account_id, unsigned int
clif->buyingstore_update_item(pl_sd, nameid, amount);
}
- if( iMap->save_settings&128 ) {
+ if( map->save_settings&128 ) {
chrif->save(sd, 0);
chrif->save(pl_sd, 0);
}
@@ -407,9 +407,8 @@ void buyingstore_trade(struct map_session_data* sd, int account_id, unsigned int
buyingstore_close(pl_sd);
// remove auto-trader
- if( pl_sd->state.autotrade )
- {
- iMap->quit(pl_sd);
+ if( pl_sd->state.autotrade ) {
+ map->quit(pl_sd);
}
}
diff --git a/src/map/chat.c b/src/map/chat.c
index 21d49cfc8..3886b69da 100644
--- a/src/map/chat.c
+++ b/src/map/chat.c
@@ -44,20 +44,19 @@ static struct chat_data* chat_createchat(struct block_list* bl, const char* titl
cd->owner = bl;
safestrncpy(cd->npc_event, ev, sizeof(cd->npc_event));
- cd->bl.id = iMap->get_new_object_id();
+ cd->bl.id = map->get_new_object_id();
cd->bl.m = bl->m;
cd->bl.x = bl->x;
cd->bl.y = bl->y;
cd->bl.type = BL_CHAT;
cd->bl.next = cd->bl.prev = NULL;
- if( cd->bl.id == 0 )
- {
+ if( cd->bl.id == 0 ) {
aFree(cd);
cd = NULL;
}
- iMap->addiddb(&cd->bl);
+ map->addiddb(&cd->bl);
if( bl->type != BL_NPC )
cd->kick_list = idb_alloc(DB_OPT_BASE);
@@ -85,8 +84,7 @@ int chat_createpcchat(struct map_session_data* sd, const char* title, const char
return 0; //Can't create chatrooms on this map.
}
- if( iMap->getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKNOCHAT) )
- {
+ if( map->getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKNOCHAT) ) {
clif->message (sd->fd, msg_txt(665));
return 0;
}
@@ -110,12 +108,11 @@ int chat_createpcchat(struct map_session_data* sd, const char* title, const char
/*==========================================
* join an existing chatroom
*------------------------------------------*/
-int chat_joinchat(struct map_session_data* sd, int chatid, const char* pass)
-{
+int chat_joinchat(struct map_session_data* sd, int chatid, const char* pass) {
struct chat_data* cd;
nullpo_ret(sd);
- cd = (struct chat_data*)iMap->id2bl(chatid);
+ cd = (struct chat_data*)map->id2bl(chatid);
if( cd == NULL || cd->bl.type != BL_CHAT || cd->bl.m != sd->bl.m || sd->state.vending || sd->state.buyingstore || sd->chatID || ((cd->owner->type == BL_NPC) ? cd->users+1 : cd->users) >= cd->limit )
{
@@ -167,17 +164,15 @@ int chat_joinchat(struct map_session_data* sd, int chatid, const char* pass)
/*==========================================
* leave a chatroom
*------------------------------------------*/
-int chat_leavechat(struct map_session_data* sd, bool kicked)
-{
+int chat_leavechat(struct map_session_data* sd, bool kicked) {
struct chat_data* cd;
int i;
int leavechar;
nullpo_retr(1, sd);
- cd = (struct chat_data*)iMap->id2bl(sd->chatID);
- if( cd == NULL )
- {
+ cd = (struct chat_data*)map->id2bl(sd->chatID);
+ if( cd == NULL ) {
pc_setchatid(sd, 0);
return 1;
}
@@ -201,15 +196,15 @@ int chat_leavechat(struct map_session_data* sd, bool kicked)
if( cd->users == 0 && cd->owner->type == BL_PC ) { // Delete empty chatroom
struct skill_unit* su;
- struct skill_unit_group* group;
+ struct skill_unit_group* group;
clif->clearchat(cd, 0);
db_destroy(cd->kick_list);
- iMap->deliddb(&cd->bl);
- iMap->delblock(&cd->bl);
- iMap->freeblock(&cd->bl);
+ map->deliddb(&cd->bl);
+ map->delblock(&cd->bl);
+ map->freeblock(&cd->bl);
- su = iMap->find_skill_unit_oncell(&sd->bl, sd->bl.x, sd->bl.y, AL_WARP, NULL, 0);
+ su = map->find_skill_unit_oncell(&sd->bl, sd->bl.x, sd->bl.y, AL_WARP, NULL, 0);
group = (su != NULL) ? su->group : NULL;
if (group != NULL)
skill->unit_onplace(su, &sd->bl, group->tick);
@@ -217,21 +212,20 @@ int chat_leavechat(struct map_session_data* sd, bool kicked)
return 1;
}
- if( leavechar == 0 && cd->owner->type == BL_PC )
- { // Set and announce new owner
+ if( leavechar == 0 && cd->owner->type == BL_PC ) {
+ // Set and announce new owner
cd->owner = (struct block_list*) cd->usersd[0];
clif->changechatowner(cd, cd->usersd[0]);
clif->clearchat(cd, 0);
//Adjust Chat location after owner has been changed.
- iMap->delblock( &cd->bl );
+ map->delblock( &cd->bl );
cd->bl.x=cd->usersd[0]->bl.x;
cd->bl.y=cd->usersd[0]->bl.y;
- iMap->addblock( &cd->bl );
+ map->addblock( &cd->bl );
clif->dispchat(cd,0);
- }
- else
+ } else
clif->dispchat(cd,0); // refresh chatroom
return 0;
@@ -240,15 +234,14 @@ int chat_leavechat(struct map_session_data* sd, bool kicked)
/*==========================================
* change a chatroom's owner
*------------------------------------------*/
-int chat_changechatowner(struct map_session_data* sd, const char* nextownername)
-{
+int chat_changechatowner(struct map_session_data* sd, const char* nextownername) {
struct chat_data* cd;
struct map_session_data* tmpsd;
int i;
nullpo_retr(1, sd);
- cd = (struct chat_data*)iMap->id2bl(sd->chatID);
+ cd = (struct chat_data*)map->id2bl(sd->chatID);
if( cd == NULL || (struct block_list*) sd != cd->owner )
return 1;
@@ -269,10 +262,10 @@ int chat_changechatowner(struct map_session_data* sd, const char* nextownername)
cd->usersd[0] = tmpsd;
// set the new chatroom position
- iMap->delblock( &cd->bl );
+ map->delblock( &cd->bl );
cd->bl.x = cd->owner->x;
cd->bl.y = cd->owner->y;
- iMap->addblock( &cd->bl );
+ map->addblock( &cd->bl );
// and display again
clif->dispchat(cd,0);
@@ -283,13 +276,12 @@ int chat_changechatowner(struct map_session_data* sd, const char* nextownername)
/*==========================================
* change a chatroom's status (title, etc)
*------------------------------------------*/
-int chat_changechatstatus(struct map_session_data* sd, const char* title, const char* pass, int limit, bool pub)
-{
+int chat_changechatstatus(struct map_session_data* sd, const char* title, const char* pass, int limit, bool pub) {
struct chat_data* cd;
nullpo_retr(1, sd);
- cd = (struct chat_data*)iMap->id2bl(sd->chatID);
+ cd = (struct chat_data*)map->id2bl(sd->chatID);
if( cd==NULL || (struct block_list *)sd != cd->owner )
return 1;
@@ -307,14 +299,13 @@ int chat_changechatstatus(struct map_session_data* sd, const char* title, const
/*==========================================
* kick an user from a chatroom
*------------------------------------------*/
-int chat_kickchat(struct map_session_data* sd, const char* kickusername)
-{
+int chat_kickchat(struct map_session_data* sd, const char* kickusername) {
struct chat_data* cd;
int i;
nullpo_retr(1, sd);
- cd = (struct chat_data *)iMap->id2bl(sd->chatID);
+ cd = (struct chat_data *)map->id2bl(sd->chatID);
if( cd==NULL || (struct block_list *)sd != cd->owner )
return -1;
@@ -359,20 +350,19 @@ int chat_createnpcchat(struct npc_data* nd, const char* title, int limit, bool p
}
/// Removes the chatroom from the npc.
-int chat_deletenpcchat(struct npc_data* nd)
-{
+int chat_deletenpcchat(struct npc_data* nd) {
struct chat_data *cd;
nullpo_ret(nd);
- cd = (struct chat_data*)iMap->id2bl(nd->chat_id);
+ cd = (struct chat_data*)map->id2bl(nd->chat_id);
if( cd == NULL )
return 0;
chat->npckickall(cd);
clif->clearchat(cd, 0);
- iMap->deliddb(&cd->bl);
- iMap->delblock(&cd->bl);
- iMap->freeblock(&cd->bl);
+ map->deliddb(&cd->bl);
+ map->delblock(&cd->bl);
+ map->freeblock(&cd->bl);
nd->chat_id = 0;
return 0;
diff --git a/src/map/chrif.c b/src/map/chrif.c
index 7277bfe33..cc0797596 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -60,7 +60,7 @@ struct chrif_interface chrif_s;
//2afd: Incoming, chrif->authok -> 'client authentication ok'
//2afe: Outgoing, send_usercount_tochar -> 'sends player count of this map server to charserver'
//2aff: Outgoing, chrif->send_users_tochar -> 'sends all actual connected character ids to charserver'
-//2b00: Incoming, iMap->setusers -> 'set the actual usercount? PACKET.2B COUNT.L.. ?' (not sure)
+//2b00: Incoming, map->setusers -> 'set the actual usercount? PACKET.2B COUNT.L.. ?' (not sure)
//2b01: Outgoing, chrif->save -> 'charsave of char XY account XY (complete struct)'
//2b02: Outgoing, chrif->charselectreq -> 'player returns from ingame to charserver to select another char.., this packets includes sessid etc' ? (not 100% sure)
//2b03: Incoming, clif_charselectok -> '' (i think its the packet after enterworld?) (not sure)
@@ -362,7 +362,7 @@ int chrif_recvmap(int fd) {
uint16 port = ntohs(RFIFOW(fd,8));
for(i = 10, j = 0; i < RFIFOW(fd,2); i += 4, j++) {
- iMap->setipport(RFIFOW(fd,i), ip, port);
+ map->setipport(RFIFOW(fd,i), ip, port);
}
if (battle_config.etc_log)
@@ -380,7 +380,7 @@ int chrif_removemap(int fd) {
uint16 port = RFIFOW(fd,8);
for(i = 10, j = 0; i < RFIFOW(fd, 2); i += 4, j++)
- iMap->eraseipport(RFIFOW(fd, i), ip, port);
+ map->eraseipport(RFIFOW(fd, i), ip, port);
chrif->other_mapserver_count--;
@@ -499,7 +499,7 @@ static int chrif_reconnect(DBKey key, DBData *data, va_list ap) {
uint32 ip;
uint16 port;
- if( iMap->mapname2ipport(sd->mapindex,&ip,&port) == 0 )
+ if( map->mapname2ipport(sd->mapindex,&ip,&port) == 0 )
chrif->changemapserver(sd, ip, port);
else //too much lag/timeout is the closest explanation for this error.
clif->authfail_fd(sd->fd, 3);
@@ -544,7 +544,7 @@ int chrif_sendmapack(int fd) {
exit(EXIT_FAILURE);
}
- memcpy(iMap->wisp_server_name, RFIFOP(fd,3), NAME_LENGTH);
+ memcpy(map->wisp_server_name, RFIFOP(fd,3), NAME_LENGTH);
chrif_on_ready();
@@ -620,7 +620,7 @@ void chrif_authok(int fd) {
//Check if we don't already have player data in our server
//Causes problems if the currently connected player tries to quit or this data belongs to an already connected player which is trying to re-auth.
- if ( ( sd = iMap->id2sd(account_id) ) != NULL )
+ if ( ( sd = map->id2sd(account_id) ) != NULL )
return;
if ( ( node = chrif->search(account_id) ) == NULL )
@@ -820,7 +820,7 @@ int chrif_changesex(struct map_session_data *sd) {
if (sd->fd)
clif->authfail_fd(sd->fd, 15);
else
- iMap->quit(sd);
+ map->quit(sd);
return 0;
}
@@ -840,7 +840,7 @@ static void chrif_char_ask_name_answer(int acc, const char* player_name, uint16
char action[25];
char output[256];
- sd = iMap->id2sd(acc);
+ sd = map->id2sd(acc);
if( acc < 0 || sd == NULL ) {
ShowError("chrif_char_ask_name_answer failed - player not online.\n");
@@ -876,7 +876,7 @@ int chrif_changedsex(int fd) {
if ( battle_config.etc_log )
ShowNotice("chrif_changedsex %d.\n", acc);
- sd = iMap->id2sd(acc);
+ sd = map->id2sd(acc);
if ( sd ) { //Normally there should not be a char logged on right now!
if ( sd->status.sex == sex )
return 0; //Do nothing? Likely safe.
@@ -916,7 +916,7 @@ int chrif_changedsex(int fd) {
// do same modify in login-server for the account, but no in char-server (it ask again login_id1 to login, and don't remember it)
clif->message(sd->fd, msg_txt(409)); //"Your sex has been changed (need disconnection by the server)..."
set_eof(sd->fd); // forced to disconnect for the change
- iMap->quit(sd); // Remove leftovers (e.g. autotrading) [Paradox924X]
+ map->quit(sd); // Remove leftovers (e.g. autotrading) [Paradox924X]
}
return 0;
}
@@ -946,14 +946,14 @@ int chrif_divorceack(int char_id, int partner_id) {
if( !char_id || !partner_id )
return 0;
- if( ( sd = iMap->charid2sd(char_id) ) != NULL && sd->status.partner_id == partner_id ) {
+ if( ( sd = map->charid2sd(char_id) ) != NULL && sd->status.partner_id == partner_id ) {
sd->status.partner_id = 0;
for(i = 0; i < MAX_INVENTORY; i++)
if (sd->status.inventory[i].nameid == WEDDING_RING_M || sd->status.inventory[i].nameid == WEDDING_RING_F)
pc->delitem(sd, i, 1, 0, 0, LOG_TYPE_OTHER);
}
- if( ( sd = iMap->charid2sd(partner_id) ) != NULL && sd->status.partner_id == char_id ) {
+ if( ( sd = map->charid2sd(partner_id) ) != NULL && sd->status.partner_id == char_id ) {
sd->status.partner_id = 0;
for(i = 0; i < MAX_INVENTORY; i++)
if (sd->status.inventory[i].nameid == WEDDING_RING_M || sd->status.inventory[i].nameid == WEDDING_RING_F)
@@ -969,7 +969,7 @@ int chrif_deadopt(int father_id, int mother_id, int child_id) {
struct map_session_data* sd;
int idx = skill->get_index(WE_CALLBABY);
- if( father_id && ( sd = iMap->charid2sd(father_id) ) != NULL && sd->status.child == child_id ) {
+ if( father_id && ( sd = map->charid2sd(father_id) ) != NULL && sd->status.child == child_id ) {
sd->status.child = 0;
sd->status.skill[idx].id = 0;
sd->status.skill[idx].lv = 0;
@@ -977,7 +977,7 @@ int chrif_deadopt(int father_id, int mother_id, int child_id) {
clif->deleteskill(sd,WE_CALLBABY);
}
- if( mother_id && ( sd = iMap->charid2sd(mother_id) ) != NULL && sd->status.child == child_id ) {
+ if( mother_id && ( sd = map->charid2sd(mother_id) ) != NULL && sd->status.child == child_id ) {
sd->status.child = 0;
sd->status.skill[idx].id = 0;
sd->status.skill[idx].lv = 0;
@@ -1000,7 +1000,7 @@ int chrif_accountban(int fd) {
if ( battle_config.etc_log )
ShowNotice("chrif_accountban %d.\n", acc);
- sd = iMap->id2sd(acc);
+ sd = map->id2sd(acc);
if ( acc < 0 || sd == NULL ) {
ShowError("chrif_accountban failed - player not online.\n");
@@ -1009,13 +1009,13 @@ int chrif_accountban(int fd) {
sd->login_id1++; // change identify, because if player come back in char within the 5 seconds, he can change its characters
if (RFIFOB(fd,6) == 0) { // 0: change of statut, 1: ban
- int ret_status = RFIFOL(fd,7); // status or final date of a banishment
- if(0<ret_status && ret_status<=9)
- clif->message(sd->fd, msg_txt(411+ret_status));
- else if(ret_status==100)
- clif->message(sd->fd, msg_txt(421));
- else
- clif->message(sd->fd, msg_txt(420)); //"Your account has not more authorised."
+ int ret_status = RFIFOL(fd,7); // status or final date of a banishment
+ if(0<ret_status && ret_status<=9)
+ clif->message(sd->fd, msg_txt(411+ret_status));
+ else if(ret_status==100)
+ clif->message(sd->fd, msg_txt(421));
+ else
+ clif->message(sd->fd, msg_txt(420)); //"Your account has not more authorised."
} else if (RFIFOB(fd,6) == 1) { // 0: change of statut, 1: ban
time_t timestamp;
char tmpstr[2048];
@@ -1026,7 +1026,7 @@ int chrif_accountban(int fd) {
}
set_eof(sd->fd); // forced to disconnect for the change
- iMap->quit(sd); // Remove leftovers (e.g. autotrading) [Paradox924X]
+ map->quit(sd); // Remove leftovers (e.g. autotrading) [Paradox924X]
return 0;
}
@@ -1036,7 +1036,7 @@ int chrif_disconnectplayer(int fd) {
struct map_session_data* sd;
int account_id = RFIFOL(fd, 2);
- sd = iMap->id2sd(account_id);
+ sd = map->id2sd(account_id);
if( sd == NULL ) {
struct auth_node* auth = chrif->search(account_id);
@@ -1048,7 +1048,7 @@ int chrif_disconnectplayer(int fd) {
if (!sd->fd) { //No connection
if (sd->state.autotrade)
- iMap->quit(sd); //Remove it.
+ map->quit(sd); //Remove it.
//Else we don't remove it because the char should have a timer to remove the player because it force-quit before,
//and we don't want them kicking their previous instance before the 10 secs penalty time passes. [Skotlex]
return 0;
@@ -1222,7 +1222,7 @@ int chrif_load_scdata(int fd) {
aid = RFIFOL(fd,4); //Player Account ID
cid = RFIFOL(fd,8); //Player Char ID
- sd = iMap->id2sd(aid);
+ sd = map->id2sd(aid);
if ( !sd ) {
ShowError("chrif_load_scdata: Player of AID %d not found!\n", aid);
@@ -1338,8 +1338,8 @@ void chrif_on_disconnect(void) {
ShowWarning("Connection to Char Server lost.\n\n");
chrif->connected = 0;
- chrif->other_mapserver_count = 0; //Reset counter. We receive ALL maps from all map-servers on reconnect.
- iMap->eraseallipport();
+ chrif->other_mapserver_count = 0; //Reset counter. We receive ALL maps from all map-servers on reconnect.
+ map->eraseallipport();
//Attempt to reconnect in a second. [Skotlex]
timer->add(timer->gettick() + 1000, check_connect_char_server, 0, 0);
@@ -1458,11 +1458,11 @@ int chrif_parse(int fd) {
case 0x2af9: chrif_connectack(fd); break;
case 0x2afb: chrif_sendmapack(fd); break;
case 0x2afd: chrif->authok(fd); break;
- case 0x2b00: iMap->setusers(RFIFOL(fd,2)); chrif_keepalive(fd); break;
+ case 0x2b00: map->setusers(RFIFOL(fd,2)); chrif_keepalive(fd); break;
case 0x2b03: clif->charselectok(RFIFOL(fd,2), RFIFOB(fd,6)); break;
case 0x2b04: chrif_recvmap(fd); break;
case 0x2b06: chrif_changemapserverack(RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOL(fd,14), RFIFOW(fd,18), RFIFOW(fd,20), RFIFOW(fd,22), RFIFOL(fd,24), RFIFOW(fd,28)); break;
- case 0x2b09: iMap->addnickdb(RFIFOL(fd,2), (char*)RFIFOP(fd,6)); break;
+ case 0x2b09: map->addnickdb(RFIFOL(fd,2), (char*)RFIFOP(fd,6)); break;
case 0x2b0a: socket_datasync(fd, false); break;
case 0x2b0d: chrif_changedsex(fd); break;
case 0x2b0f: chrif_char_ask_name_answer(RFIFOL(fd,2), (char*)RFIFOP(fd,6), RFIFOW(fd,30), RFIFOW(fd,32)); break;
@@ -1496,7 +1496,7 @@ int send_usercount_tochar(int tid, unsigned int tick, int id, intptr_t data) {
WFIFOHEAD(char_fd,4);
WFIFOW(char_fd,0) = 0x2afe;
- WFIFOW(char_fd,2) = iMap->usercount();
+ WFIFOW(char_fd,2) = map->usercount();
WFIFOSET(char_fd,4);
return 0;
}
@@ -1512,7 +1512,7 @@ int send_users_tochar(void) {
chrif_check(-1);
- users = iMap->usercount();
+ users = map->usercount();
WFIFOHEAD(char_fd, 6+8*users);
WFIFOW(char_fd,0) = 0x2aff;
diff --git a/src/map/clif.c b/src/map/clif.c
index 59b0723fc..1d18559df 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -378,12 +378,12 @@ int clif_send(const void* buf, int len, struct block_list* bl, enum send_target
clif->send (buf, len, bl, SELF);
case AREA_WOC:
case AREA_WOS:
- iMap->foreachinarea(clif->send_sub, bl->m, bl->x-AREA_SIZE, bl->y-AREA_SIZE, bl->x+AREA_SIZE, bl->y+AREA_SIZE,
+ map->foreachinarea(clif->send_sub, bl->m, bl->x-AREA_SIZE, bl->y-AREA_SIZE, bl->x+AREA_SIZE, bl->y+AREA_SIZE,
BL_PC, buf, len, bl, type);
break;
case AREA_CHAT_WOC:
- iMap->foreachinarea(clif->send_sub, bl->m, bl->x-(AREA_SIZE-5), bl->y-(AREA_SIZE-5),
- bl->x+(AREA_SIZE-5), bl->y+(AREA_SIZE-5), BL_PC, buf, len, bl, AREA_WOC);
+ map->foreachinarea(clif->send_sub, bl->m, bl->x-(AREA_SIZE-5), bl->y-(AREA_SIZE-5),
+ bl->x+(AREA_SIZE-5), bl->y+(AREA_SIZE-5), BL_PC, buf, len, bl, AREA_WOC);
break;
case CHAT:
@@ -391,7 +391,7 @@ int clif_send(const void* buf, int len, struct block_list* bl, enum send_target
{
struct chat_data *cd;
if (sd) {
- cd = (struct chat_data*)iMap->id2bl(sd->chatID);
+ cd = (struct chat_data*)map->id2bl(sd->chatID);
} else if (bl->type == BL_CHAT) {
cd = (struct chat_data*)bl;
} else break;
@@ -443,7 +443,7 @@ int clif_send(const void* buf, int len, struct block_list* bl, enum send_target
memcpy(WFIFOP(fd,0), buf, len);
WFIFOSET(fd,len);
}
- if (!iMap->enable_spy) //Skip unnecessary parsing. [Skotlex]
+ if (!map->enable_spy) //Skip unnecessary parsing. [Skotlex]
break;
iter = mapit_getallusers();
@@ -520,7 +520,7 @@ int clif_send(const void* buf, int len, struct block_list* bl, enum send_target
WFIFOSET(fd,len);
}
}
- if (!iMap->enable_spy) //Skip unnecessary parsing. [Skotlex]
+ if (!map->enable_spy) //Skip unnecessary parsing. [Skotlex]
break;
iter = mapit_getallusers();
@@ -569,7 +569,7 @@ int clif_send(const void* buf, int len, struct block_list* bl, enum send_target
for( i = 0; i < queue->size; i++ ) {
struct map_session_data * sd = NULL;
- if( queue->item[i] > 0 && ( sd = iMap->id2sd(queue->item[i]) ) ) {
+ if( queue->item[i] > 0 && ( sd = map->id2sd(queue->item[i]) ) ) {
WFIFOHEAD(sd->fd,len);
memcpy(WFIFOP(sd->fd,0), buf, len);
WFIFOSET(sd->fd,len);
@@ -674,12 +674,11 @@ void clif_authfail_fd(int fd, int type)
/// type:
/// 1 = disconnect, char-select
/// ? = nothing
-void clif_charselectok(int id, uint8 ok)
-{
+void clif_charselectok(int id, uint8 ok) {
struct map_session_data* sd;
int fd;
- if ((sd = iMap->id2sd(id)) == NULL || !sd->fd)
+ if ((sd = map->id2sd(id)) == NULL || !sd->fd)
return;
fd = sd->fd;
@@ -1603,14 +1602,14 @@ void clif_move(struct unit_data *ud)
/*==========================================
- * Delays the iMap->quit of a player after they are disconnected. [Skotlex]
+ * Delays the map->quit of a player after they are disconnected. [Skotlex]
*------------------------------------------*/
int clif_delayquit(int tid, unsigned int tick, int id, intptr_t data) {
struct map_session_data *sd = NULL;
//Remove player from map server
- if ((sd = iMap->id2sd(id)) != NULL && sd->fd == 0) //Should be a disconnected player.
- iMap->quit(sd);
+ if ((sd = map->id2sd(id)) != NULL && sd->fd == 0) //Should be a disconnected player.
+ map->quit(sd);
return 0;
}
@@ -1620,7 +1619,7 @@ int clif_delayquit(int tid, unsigned int tick, int id, intptr_t data) {
void clif_quitsave(int fd,struct map_session_data *sd) {
if (!battle_config.prevent_logout ||
DIFF_TICK(timer->gettick(), sd->canlog_tick) > battle_config.prevent_logout)
- iMap->quit(sd);
+ map->quit(sd);
else if (sd->fd) {
//Disassociate session from player (session is deleted after this function was called)
//And set a timer to make him quit later.
@@ -1914,16 +1913,15 @@ void clif_sendfakenpc(struct map_session_data *sd, int npcid) {
/// WARNING: the 'cancel' button closes other windows besides the dialog window and the menu window.
/// Which suggests their have intertwined behavior. (probably the mouse targeting)
/// TODO investigate behavior of other windows [FlavioJS]
-void clif_scriptmenu(struct map_session_data* sd, int npcid, const char* mes)
-{
+void clif_scriptmenu(struct map_session_data* sd, int npcid, const char* mes) {
int fd = sd->fd;
int slen = strlen(mes) + 9;
struct block_list *bl = NULL;
- if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = iMap->id2bl(npcid)) && (bl->m!=sd->bl.m ||
- bl->x<sd->bl.x-AREA_SIZE-1 || bl->x>sd->bl.x+AREA_SIZE+1 ||
- bl->y<sd->bl.y-AREA_SIZE-1 || bl->y>sd->bl.y+AREA_SIZE+1))))
- clif->sendfakenpc(sd, npcid);
+ if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = map->id2bl(npcid)) && (bl->m!=sd->bl.m ||
+ bl->x<sd->bl.x-AREA_SIZE-1 || bl->x>sd->bl.x+AREA_SIZE+1 ||
+ bl->y<sd->bl.y-AREA_SIZE-1 || bl->y>sd->bl.y+AREA_SIZE+1))))
+ clif->sendfakenpc(sd, npcid);
WFIFOHEAD(fd, slen);
WFIFOW(fd,0)=0xb7;
@@ -1945,17 +1943,16 @@ void clif_scriptmenu(struct map_session_data* sd, int npcid, const char* mes)
/// - if npcid exists in the client:
/// - 0143 <npcid of inputnum window>.L <atoi(text)>.L
/// - close inputnum window
-void clif_scriptinput(struct map_session_data *sd, int npcid)
-{
+void clif_scriptinput(struct map_session_data *sd, int npcid) {
int fd;
struct block_list *bl = NULL;
nullpo_retv(sd);
- if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = iMap->id2bl(npcid)) && (bl->m!=sd->bl.m ||
- bl->x<sd->bl.x-AREA_SIZE-1 || bl->x>sd->bl.x+AREA_SIZE+1 ||
- bl->y<sd->bl.y-AREA_SIZE-1 || bl->y>sd->bl.y+AREA_SIZE+1))))
- clif->sendfakenpc(sd, npcid);
+ if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = map->id2bl(npcid)) && (bl->m!=sd->bl.m ||
+ bl->x<sd->bl.x-AREA_SIZE-1 || bl->x>sd->bl.x+AREA_SIZE+1 ||
+ bl->y<sd->bl.y-AREA_SIZE-1 || bl->y>sd->bl.y+AREA_SIZE+1))))
+ clif->sendfakenpc(sd, npcid);
fd=sd->fd;
WFIFOHEAD(fd, packet_len(0x142));
@@ -1976,17 +1973,16 @@ void clif_scriptinput(struct map_session_data *sd, int npcid)
/// - if npcid is 0 or npcid exists in the client:
/// - 01d5 <packetlen>.W <npcid of inputstr window>.L <text>.?B
/// - close inputstr window
-void clif_scriptinputstr(struct map_session_data *sd, int npcid)
-{
+void clif_scriptinputstr(struct map_session_data *sd, int npcid) {
int fd;
struct block_list *bl = NULL;
nullpo_retv(sd);
- if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = iMap->id2bl(npcid)) && (bl->m!=sd->bl.m ||
- bl->x<sd->bl.x-AREA_SIZE-1 || bl->x>sd->bl.x+AREA_SIZE+1 ||
- bl->y<sd->bl.y-AREA_SIZE-1 || bl->y>sd->bl.y+AREA_SIZE+1))))
- clif->sendfakenpc(sd, npcid);
+ if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = map->id2bl(npcid)) && (bl->m!=sd->bl.m ||
+ bl->x<sd->bl.x-AREA_SIZE-1 || bl->x>sd->bl.x+AREA_SIZE+1 ||
+ bl->y<sd->bl.y-AREA_SIZE-1 || bl->y>sd->bl.y+AREA_SIZE+1))))
+ clif->sendfakenpc(sd, npcid);
fd=sd->fd;
WFIFOHEAD(fd, packet_len(0x1d4));
@@ -2922,7 +2918,7 @@ int clif_hpmeter_sub(struct block_list *bl, va_list ap) {
*------------------------------------------*/
int clif_hpmeter(struct map_session_data *sd) {
nullpo_ret(sd);
- iMap->foreachinarea(clif->hpmeter_sub, sd->bl.m, sd->bl.x-AREA_SIZE, sd->bl.y-AREA_SIZE, sd->bl.x+AREA_SIZE, sd->bl.y+AREA_SIZE, BL_PC, sd);
+ map->foreachinarea(clif->hpmeter_sub, sd->bl.m, sd->bl.x-AREA_SIZE, sd->bl.y-AREA_SIZE, sd->bl.x+AREA_SIZE, sd->bl.y+AREA_SIZE, BL_PC, sd);
return 0;
}
@@ -3975,8 +3971,7 @@ void clif_leavechat(struct chat_data* cd, struct map_session_data* sd, bool flag
/// Opens a trade request window from char 'name'.
/// 00e5 <nick>.24B (ZC_REQ_EXCHANGE_ITEM)
/// 01f4 <nick>.24B <charid>.L <baselvl>.W (ZC_REQ_EXCHANGE_ITEM2)
-void clif_traderequest(struct map_session_data* sd, const char* name)
-{
+void clif_traderequest(struct map_session_data* sd, const char* name) {
int fd = sd->fd;
#if PACKETVER < 6
@@ -3984,8 +3979,8 @@ void clif_traderequest(struct map_session_data* sd, const char* name)
WFIFOW(fd,0) = 0xe5;
safestrncpy((char*)WFIFOP(fd,2), name, NAME_LENGTH);
WFIFOSET(fd,packet_len(0xe5));
-#else
- struct map_session_data* tsd = iMap->id2sd(sd->trade_partner);
+#else // PACKETVER >= 6
+ struct map_session_data* tsd = map->id2sd(sd->trade_partner);
if( !tsd ) return;
WFIFOHEAD(fd,packet_len(0x1f4));
@@ -3994,7 +3989,7 @@ void clif_traderequest(struct map_session_data* sd, const char* name)
WFIFOL(fd,26) = tsd->status.char_id;
WFIFOW(fd,30) = tsd->status.base_level;
WFIFOSET(fd,packet_len(0x1f4));
-#endif
+#endif // PACKETVER < 6
}
@@ -4008,23 +4003,24 @@ void clif_traderequest(struct map_session_data* sd, const char* name)
/// 3 = Accept
/// 4 = Cancel
/// 5 = Busy
-void clif_tradestart(struct map_session_data* sd, uint8 type)
-{
+void clif_tradestart(struct map_session_data* sd, uint8 type) {
int fd = sd->fd;
- struct map_session_data* tsd = iMap->id2sd(sd->trade_partner);
- if( PACKETVER < 6 || !tsd ) {
- WFIFOHEAD(fd,packet_len(0xe7));
- WFIFOW(fd,0) = 0xe7;
- WFIFOB(fd,2) = type;
- WFIFOSET(fd,packet_len(0xe7));
- } else {
+#if PACKETVER >= 6
+ struct map_session_data* tsd = map->id2sd(sd->trade_partner);
+ if( tsd ) {
WFIFOHEAD(fd,packet_len(0x1f5));
WFIFOW(fd,0) = 0x1f5;
WFIFOB(fd,2) = type;
WFIFOL(fd,3) = tsd->status.char_id;
WFIFOW(fd,7) = tsd->status.base_level;
WFIFOSET(fd,packet_len(0x1f5));
+ return;
}
+#endif // PACKETVER >= 6
+ WFIFOHEAD(fd,packet_len(0xe7));
+ WFIFOW(fd,0) = 0xe7;
+ WFIFOB(fd,2) = type;
+ WFIFOSET(fd,packet_len(0xe7));
}
@@ -4273,7 +4269,7 @@ void clif_getareachar_pc(struct map_session_data* sd,struct map_session_data* ds
if( dstsd->chatID ) {
struct chat_data *cd = NULL;
- if( (cd = (struct chat_data*)iMap->id2bl(dstsd->chatID)) && cd->usersd[0]==dstsd)
+ if( (cd = (struct chat_data*)map->id2bl(dstsd->chatID)) && cd->usersd[0]==dstsd)
clif->dispchat(cd,sd->fd);
} else if( dstsd->state.vending )
clif->showvendingboard(&dstsd->bl,dstsd->message,sd->fd);
@@ -4302,7 +4298,7 @@ void clif_getareachar_pc(struct map_session_data* sd,struct map_session_data* ds
ARR_FIND( 0, 5, i, dstsd->devotion[i] > 0 );
if( i < 5 ) clif->devotion(&dstsd->bl, sd);
// display link (dstsd - crusader) to sd
- if( dstsd->sc.data[SC_DEVOTION] && (d_bl = iMap->id2bl(dstsd->sc.data[SC_DEVOTION]->val1)) != NULL )
+ if( dstsd->sc.data[SC_DEVOTION] && (d_bl = map->id2bl(dstsd->sc.data[SC_DEVOTION]->val1)) != NULL )
clif->devotion(d_bl, sd);
}
@@ -4350,7 +4346,7 @@ void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl) {
{
TBL_NPC* nd = (TBL_NPC*)bl;
if( nd->chat_id )
- clif->dispchat((struct chat_data*)iMap->id2bl(nd->chat_id),sd->fd);
+ clif->dispchat((struct chat_data*)map->id2bl(nd->chat_id),sd->fd);
if( nd->size == SZ_BIG )
clif->specialeffect_single(bl,423,sd->fd);
else if( nd->size == SZ_MEDIUM )
@@ -4772,7 +4768,7 @@ int clif_outsight(struct block_list *bl,va_list ap)
clif->clearunit_single(bl->id,CLR_OUTSIGHT,tsd->fd);
if(sd->chatID){
struct chat_data *cd;
- cd=(struct chat_data*)iMap->id2bl(sd->chatID);
+ cd=(struct chat_data*)map->id2bl(sd->chatID);
if(cd->usersd[0]==sd)
clif->dispchat(cd,tsd->fd);
}
@@ -5928,8 +5924,7 @@ void clif_upgrademessage(int fd, int result, int item_id)
/// Whisper is transmitted to the destination player (ZC_WHISPER).
/// 0097 <packet len>.W <nick>.24B <message>.?B
/// 0097 <packet len>.W <nick>.24B <isAdmin>.L <message>.?B (PACKETVER >= 20091104)
-void clif_wis_message(int fd, const char* nick, const char* mes, int mes_len)
-{
+void clif_wis_message(int fd, const char* nick, const char* mes, int mes_len) {
#if PACKETVER < 20091104
WFIFOHEAD(fd, mes_len + NAME_LENGTH + 4);
WFIFOW(fd,0) = 0x97;
@@ -5938,7 +5933,7 @@ void clif_wis_message(int fd, const char* nick, const char* mes, int mes_len)
safestrncpy((char*)WFIFOP(fd,28), mes, mes_len);
WFIFOSET(fd,WFIFOW(fd,2));
#else
- struct map_session_data *ssd = iMap->nick2sd(nick);
+ struct map_session_data *ssd = map->nick2sd(nick);
WFIFOHEAD(fd, mes_len + NAME_LENGTH + 8);
WFIFOW(fd,0) = 0x97;
@@ -6373,7 +6368,7 @@ void clif_vendinglist(struct map_session_data* sd, unsigned int id, struct s_ven
nullpo_retv(sd);
nullpo_retv(vending_items);
- nullpo_retv(vsd=iMap->id2sd(id));
+ nullpo_retv(vsd=map->id2sd(id));
fd = sd->fd;
count = vsd->vend_num;
@@ -8077,28 +8072,22 @@ void clif_wedding_effect(struct block_list *bl)
/// Notifies the client of the name of the partner character (ZC_COUPLENAME).
/// 01e6 <partner name>.24B
-void clif_callpartner(struct map_session_data *sd)
-{
+void clif_callpartner(struct map_session_data *sd) {
unsigned char buf[26];
nullpo_retv(sd);
WBUFW(buf,0) = 0x1e6;
- if( sd->status.partner_id )
- {
+ if( sd->status.partner_id ) {
const char *p;
- if( ( p = iMap->charid2nick(sd->status.partner_id) ) != NULL )
- {
+ if( ( p = map->charid2nick(sd->status.partner_id) ) != NULL ) {
memcpy(WBUFP(buf,2), p, NAME_LENGTH);
- }
- else
- {
+ } else {
WBUFB(buf,2) = 0;
}
- }
- else
- {// Send zero-length name if no partner, to initialize the client buffer.
+ } else {
+ // Send zero-length name if no partner, to initialize the client buffer.
WBUFB(buf,2) = 0;
}
@@ -8204,14 +8193,13 @@ void clif_GM_kickack(struct map_session_data *sd, int id)
}
-void clif_GM_kick(struct map_session_data *sd,struct map_session_data *tsd)
-{
+void clif_GM_kick(struct map_session_data *sd,struct map_session_data *tsd) {
int fd = tsd->fd;
if( fd > 0 )
clif->authfail_fd(fd, 15);
else
- iMap->quit(tsd);
+ map->quit(tsd);
if( sd )
clif->GM_kickack(sd,tsd->status.account_id);
@@ -8516,7 +8504,7 @@ void clif_refresh(struct map_session_data *sd)
}
if( sd->ed )
clif->elemental_info(sd);
- iMap->foreachinrange(clif->getareachar,&sd->bl,AREA_SIZE,BL_ALL,sd);
+ map->foreachinrange(clif->getareachar,&sd->bl,AREA_SIZE,BL_ALL,sd);
clif->weather_check(sd);
if( sd->chatID )
chat->leavechat(sd,0);
@@ -9253,7 +9241,7 @@ void clif_parse_WantToConnection(int fd, struct map_session_data* sd) {
}
//Check for double login.
- bl = iMap->id2bl(account_id);
+ bl = map->id2bl(account_id);
if(bl && bl->type != BL_PC) {
ShowError("clif_parse_WantToConnection: a non-player object already has id %d, please increase the starting account number\n", account_id);
WFIFOHEAD(fd,packet_len(0x6a));
@@ -9375,7 +9363,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) {
}
if( maplist[sd->bl.m].users++ == 0 && battle_config.dynamic_mobs )
- iMap->spawnmobs(sd->bl.m);
+ map->spawnmobs(sd->bl.m);
if( !(sd->sc.option&OPTION_INVISIBLE) ) { // increment the number of pvp players on the map
maplist[sd->bl.m].users_pvp++;
}
@@ -9388,7 +9376,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) {
// reset the callshop flag if the player changes map
sd->state.callshop = 0;
- iMap->addblock(&sd->bl);
+ map->addblock(&sd->bl);
clif->spawn(&sd->bl);
// Party
@@ -9424,7 +9412,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) {
// info about nearby objects
// must use foreachinarea (CIRCULAR_AREA interferes with foreachinrange)
- iMap->foreachinarea(clif->getareachar, sd->bl.m, sd->bl.x-AREA_SIZE, sd->bl.y-AREA_SIZE, sd->bl.x+AREA_SIZE, sd->bl.y+AREA_SIZE, BL_ALL, sd);
+ map->foreachinarea(clif->getareachar, sd->bl.m, sd->bl.x-AREA_SIZE, sd->bl.y-AREA_SIZE, sd->bl.x+AREA_SIZE, sd->bl.y+AREA_SIZE, BL_ALL, sd);
// pet
if( sd->pd ) {
@@ -9432,7 +9420,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) {
clif->message(sd->fd, msg_txt(666));
pet->menu(sd, 3); //Option 3 is return to egg.
} else {
- iMap->addblock(&sd->pd->bl);
+ map->addblock(&sd->pd->bl);
clif->spawn(&sd->pd->bl);
clif->send_petdata(sd,sd->pd,0,0);
clif->send_petstatus(sd);
@@ -9442,7 +9430,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) {
//homunculus [blackhole89]
if( homun_alive(sd->hd) ) {
- iMap->addblock(&sd->hd->bl);
+ map->addblock(&sd->hd->bl);
clif->spawn(&sd->hd->bl);
clif->send_homdata(sd,SP_ACK,0);
clif->hominfo(sd,sd->hd,1);
@@ -9455,7 +9443,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) {
}
if( sd->md ) {
- iMap->addblock(&sd->md->bl);
+ map->addblock(&sd->md->bl);
clif->spawn(&sd->md->bl);
clif->mercenary_info(sd);
clif->mercenary_skillblock(sd);
@@ -9463,7 +9451,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) {
}
if( sd->ed ) {
- iMap->addblock(&sd->ed->bl);
+ map->addblock(&sd->ed->bl);
clif->spawn(&sd->ed->bl);
clif->elemental_info(sd);
clif->elemental_updatestatus(sd,SP_HP);
@@ -9508,13 +9496,13 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) {
if(homun_alive(sd->hd))
homun->init_timers(sd->hd);
- if (iMap->night_flag && maplist[sd->bl.m].flag.nightenabled) {
+ if (map->night_flag && maplist[sd->bl.m].flag.nightenabled) {
sd->state.night = 1;
clif->status_change(&sd->bl, SI_SKE, 1, 0, 0, 0, 0);
}
// Notify everyone that this char logged in [Skotlex].
- iMap->map_foreachpc(clif->friendslist_toggle_sub, sd->status.account_id, sd->status.char_id, 1);
+ map->map_foreachpc(clif->friendslist_toggle_sub, sd->status.account_id, sd->status.char_id, 1);
//Login Event
npc->script_event(sd, NPCE_LOGIN);
@@ -9549,7 +9537,8 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) {
|| maplist[sd->state.pmap].flag.battleground || maplist[sd->bl.m].flag.battleground) )
status_calc_bl(&sd->bl, SCB_FLEE); //Refresh flee penalty
- if( iMap->night_flag && maplist[sd->bl.m].flag.nightenabled ) { //Display night.
+ if( map->night_flag && maplist[sd->bl.m].flag.nightenabled ) {
+ //Display night.
if( !sd->state.night ) {
sd->state.night = 1;
clif->status_change(&sd->bl, SI_SKE, 1, 0, 0, 0, 0);
@@ -9571,7 +9560,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) {
clif->broadcast(&sd->bl, output, strlen(output) + 1, BC_BLUE, SELF);
}
- iMap->iwall_get(sd); // Updates Walls Info on this Map to Client
+ map->iwall_get(sd); // Updates Walls Info on this Map to Client
status_calc_pc(sd, false);/* some conditions are map-dependent so we must recalculate */
sd->state.changemap = false;
@@ -9609,7 +9598,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) {
clif->weather_check(sd);
// For automatic triggering of NPCs after map loading (so you don't need to walk 1 step first)
- if (iMap->getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKNPC))
+ if (map->getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKNPC))
npc->touch_areanpc(sd,sd->bl.m,sd->bl.x,sd->bl.y);
else
sd->areanpc_id = 0;
@@ -9815,8 +9804,7 @@ void clif_parse_QuitGame(int fd, struct map_session_data *sd)
/// 0094 <id>.L (CZ_REQNAME)
/// 0368 <id>.L (CZ_REQNAME2)
/// There are various variants of this packet, some of them have padding between fields.
-void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd)
-{
+void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) {
int id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]);
struct block_list* bl;
//struct status_change *sc;
@@ -9824,7 +9812,7 @@ void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd)
if( id < 0 && -id == sd->bl.id ) // for disguises [Valaris]
id = sd->bl.id;
- bl = iMap->id2bl(id);
+ bl = map->id2bl(id);
if( bl == NULL )
return; // Lagged clients could request names of already gone mobs/players. [Skotlex]
@@ -9842,7 +9830,7 @@ void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd)
sprintf(gm_msg, "Hack on NameRequest: character '%s' (account: %d) requested the name of an invisible target (id: %d).\n", sd->status.name, sd->status.account_id, id);
ShowWarning(gm_msg);
// information is sent to all online GMs
- intif->wis_message_to_gm(iMap->wisp_server_name, battle_config.hack_info_GM_level, gm_msg);
+ intif->wis_message_to_gm(map->wisp_server_name, battle_config.hack_info_GM_level, gm_msg);
return;
}
#endif // 0
@@ -9851,7 +9839,7 @@ void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd)
}
int clif_undisguise_timer(int tid, unsigned int tick, int id, intptr_t data) {
struct map_session_data * sd;
- if( (sd = iMap->id2sd(id)) ) {
+ if( (sd = map->id2sd(id)) ) {
sd->fontcolor_tid = INVALID_TIMER;
if( sd->fontcolor && sd->disguise == sd->status.class_ )
pc->disguise(sd,-1);
@@ -9987,7 +9975,7 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data* sd)
WFIFOSET(fd, WFIFOW(fd,2));
#ifdef PCRE_SUPPORT
// trigger listening npcs
- iMap->foreachinrange(npc_chat->sub, &sd->bl, AREA_SIZE, BL_NPC, text, textlen, &sd->bl);
+ map->foreachinrange(npc_chat->sub, &sd->bl, AREA_SIZE, BL_NPC, text, textlen, &sd->bl);
#endif
// Chat logging type 'O' / Global Chat
@@ -10106,9 +10094,8 @@ void clif_user_count(struct map_session_data* sd, int count) {
/// /w /who (CZ_REQ_USER_COUNT).
/// Request to display amount of currently connected players.
/// 00c1
-void clif_parse_HowManyConnections(int fd, struct map_session_data *sd)
-{
- clif->user_count(sd, iMap->getusers());
+void clif_parse_HowManyConnections(int fd, struct map_session_data *sd) {
+ clif->user_count(sd, map->getusers());
}
@@ -10466,7 +10453,7 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd)
}
// searching destination character
- dstsd = iMap->nick2sd(target);
+ dstsd = map->nick2sd(target);
if (dstsd == NULL || strcmp(dstsd->status.name, target) != 0) {
// player is not on this map-server
@@ -10491,7 +10478,7 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd)
if( dstsd->state.autotrade == 1 ) {
char output[256];
sprintf(output, "%s is in autotrade mode and cannot receive whispered messages.", dstsd->status.name);
- clif->wis_message(fd, iMap->wisp_server_name, output, strlen(output) + 1);
+ clif->wis_message(fd, map->wisp_server_name, output, strlen(output) + 1);
return;
}
@@ -10532,14 +10519,13 @@ void clif_parse_Broadcast(int fd, struct map_session_data* sd) {
/// 009f <id>.L (CZ_ITEM_PICKUP)
/// 0362 <id>.L (CZ_ITEM_PICKUP2)
/// There are various variants of this packet, some of them have padding between fields.
-void clif_parse_TakeItem(int fd, struct map_session_data *sd)
-{
+void clif_parse_TakeItem(int fd, struct map_session_data *sd) {
struct flooritem_data *fitem;
int map_object_id;
map_object_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]);
- fitem = (struct flooritem_data*)iMap->id2bl(map_object_id);
+ fitem = (struct flooritem_data*)map->id2bl(map_object_id);
do {
if (pc_isdead(sd)) {
@@ -10808,7 +10794,7 @@ void clif_parse_NpcClicked(int fd,struct map_session_data *sd)
#endif
return;
}
- if ( pc_cant_act2(sd) || !(bl = iMap->id2bl(RFIFOL(fd,2))) || sd->state.vending )
+ if ( pc_cant_act2(sd) || !(bl = map->id2bl(RFIFOL(fd,2))) || sd->state.vending )
return;
switch (bl->type) {
@@ -11035,11 +11021,10 @@ void clif_noask_sub(struct map_session_data *src, struct map_session_data *targe
/// Request to begin a trade (CZ_REQ_EXCHANGE_ITEM).
/// 00e4 <account id>.L
-void clif_parse_TradeRequest(int fd,struct map_session_data *sd)
-{
+void clif_parse_TradeRequest(int fd,struct map_session_data *sd) {
struct map_session_data *t_sd;
- t_sd = iMap->id2sd(RFIFOL(fd,2));
+ t_sd = map->id2sd(RFIFOL(fd,2));
if(!sd->chatID && pc_cant_act(sd))
return; //You can trade while in a chatroom.
@@ -11672,7 +11657,7 @@ void clif_parse_NpcSelectMenu(int fd,struct map_session_data *sd)
#ifdef SECURE_NPCTIMEOUT
if( sd->npc_idle_timer != INVALID_TIMER ) {
#endif
- TBL_NPC* nd = iMap->id2nd(npc_id);
+ TBL_NPC* nd = map->id2nd(npc_id);
ShowWarning("Invalid menu selection on npc %d:'%s' - got %d, valid range is [%d..%d] (player AID:%d, CID:%d, name:'%s')!\n", npc_id, (nd)?nd->name:"invalid npc id", select, 1, sd->npc_menu, sd->bl.id, sd->status.char_id, sd->status.name);
clif->GM_kick(NULL,sd);
#ifdef SECURE_NPCTIMEOUT
@@ -11828,12 +11813,11 @@ void clif_parse_InsertCard(int fd,struct map_session_data *sd)
/// 0193 <char id>.L (CZ_REQNAME_BYGID)
/// 0369 <char id>.L (CZ_REQNAME_BYGID2)
/// There are various variants of this packet, some of them have padding between fields.
-void clif_parse_SolveCharName(int fd, struct map_session_data *sd)
-{
+void clif_parse_SolveCharName(int fd, struct map_session_data *sd) {
int charid;
charid = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]);
- iMap->reqnickdb(sd, charid);
+ map->reqnickdb(sd, charid);
}
@@ -12061,7 +12045,7 @@ void clif_parse_PartyInvite(int fd, struct map_session_data *sd) {
return;
}
- t_sd = iMap->id2sd(RFIFOL(fd,2));
+ t_sd = map->id2sd(RFIFOL(fd,2));
if(t_sd && t_sd->state.noask) {// @noask [LuzZza]
clif->noask_sub(sd, t_sd, 1);
@@ -12082,7 +12066,7 @@ void clif_parse_PartyInvite2(int fd, struct map_session_data *sd) {
return;
}
- t_sd = iMap->nick2sd(name);
+ t_sd = map->nick2sd(name);
if(t_sd && t_sd->state.noask) { // @noask [LuzZza]
clif->noask_sub(sd, t_sd, 1);
@@ -12198,9 +12182,8 @@ void clif_parse_PartyMessage(int fd, struct map_session_data* sd)
/// Changes Party Leader (CZ_CHANGE_GROUP_MASTER).
/// 07da <account id>.L
-void clif_parse_PartyChangeLeader(int fd, struct map_session_data* sd)
-{
- party->changeleader(sd, iMap->id2sd(RFIFOL(fd,2)));
+void clif_parse_PartyChangeLeader(int fd, struct map_session_data* sd) {
+ party->changeleader(sd, map->id2sd(RFIFOL(fd,2)));
}
#ifndef PARTY_RECRUIT
@@ -12751,7 +12734,7 @@ void clif_parse_OpenVending(int fd, struct map_session_data* sd) {
clif->message (sd->fd, msg_txt(276)); // "You can't open a shop on this map"
return;
}
- if( iMap->getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKNOVENDING) ) {
+ if( map->getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKNOVENDING) ) {
clif->message (sd->fd, msg_txt(204)); // "You can't open a shop on this cell."
return;
}
@@ -12948,9 +12931,8 @@ clif_sub_guild_invite(int fd, struct map_session_data *sd, struct map_session_da
/// Guild invite request (CZ_REQ_JOIN_GUILD).
/// 0168 <account id>.L <inviter account id>.L <inviter char id>.L
-void clif_parse_GuildInvite(int fd,struct map_session_data *sd)
-{
- struct map_session_data *t_sd = iMap->id2sd(RFIFOL(fd,2));
+void clif_parse_GuildInvite(int fd,struct map_session_data *sd) {
+ struct map_session_data *t_sd = map->id2sd(RFIFOL(fd,2));
if (clif_sub_guild_invite(fd, sd, t_sd))
return;
@@ -12958,9 +12940,8 @@ void clif_parse_GuildInvite(int fd,struct map_session_data *sd)
/// Guild invite request (/guildinvite) (CZ_REQ_JOIN_GUILD2).
/// 0916 <char name>.24B
-void clif_parse_GuildInvite2(int fd, struct map_session_data *sd)
-{
- struct map_session_data *t_sd = iMap->nick2sd((char *)RFIFOP(fd, 2));
+void clif_parse_GuildInvite2(int fd, struct map_session_data *sd) {
+ struct map_session_data *t_sd = map->nick2sd((char *)RFIFOP(fd, 2));
if (clif_sub_guild_invite(fd, sd, t_sd))
return;
@@ -13054,7 +13035,7 @@ void clif_parse_GuildRequestAlliance(int fd, struct map_session_data *sd) {
return;
}
- t_sd = iMap->id2sd(RFIFOL(fd,2));
+ t_sd = map->id2sd(RFIFOL(fd,2));
// @noask [LuzZza]
if(t_sd && t_sd->state.noask) {
@@ -13109,7 +13090,7 @@ void clif_parse_GuildOpposition(int fd, struct map_session_data *sd) {
return;
}
- t_sd = iMap->id2sd(RFIFOL(fd,2));
+ t_sd = map->id2sd(RFIFOL(fd,2));
// @noask [LuzZza]
if(t_sd && t_sd->state.noask) {
@@ -13218,13 +13199,12 @@ void clif_parse_ChangePetName(int fd, struct map_session_data *sd)
/// Request to disconnect a character.
/// 00cc <account id>.L
/// NOTE: Also sent when using GM right click menu "(name) force to quit"
-void clif_parse_GMKick(int fd, struct map_session_data *sd)
-{
+void clif_parse_GMKick(int fd, struct map_session_data *sd) {
struct block_list *target;
int tid;
tid = RFIFOL(fd,2);
- target = iMap->id2bl(tid);
+ target = map->id2bl(tid);
if (!target) {
clif->GM_kickack(sd, 0);
return;
@@ -13307,13 +13287,12 @@ void clif_parse_GMShift(int fd, struct map_session_data *sd)
/// /remove (CZ_REMOVE_AID_SSO).
/// Request to warp to a character with given account ID.
/// 0843 <account id>.L
-void clif_parse_GMRemove2(int fd, struct map_session_data* sd)
-{
+void clif_parse_GMRemove2(int fd, struct map_session_data* sd) {
int account_id;
struct map_session_data* pl_sd;
account_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]);
- if( (pl_sd = iMap->id2sd(account_id)) != NULL ) {
+ if( (pl_sd = map->id2sd(account_id)) != NULL ) {
char command[NAME_LENGTH+8];
sprintf(command, "%cjumpto %s", atcommand->at_symbol, pl_sd->status.name);
atcommand->parse(fd, sd, command, 1);
@@ -13344,13 +13323,12 @@ void clif_parse_GMRecall(int fd, struct map_session_data *sd)
/// /recall (CZ_RECALL_SSO).
/// Request to summon a player with given account ID to own position.
/// 0842 <account id>.L
-void clif_parse_GMRecall2(int fd, struct map_session_data* sd)
-{
+void clif_parse_GMRecall2(int fd, struct map_session_data* sd) {
int account_id;
struct map_session_data* pl_sd;
account_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]);
- if( (pl_sd = iMap->id2sd(account_id)) != NULL ) {
+ if( (pl_sd = map->id2sd(account_id)) != NULL ) {
char command[NAME_LENGTH+8];
sprintf(command, "%crecall %s", atcommand->at_symbol, pl_sd->status.name);
atcommand->parse(fd, sd, command, 1);
@@ -13436,8 +13414,7 @@ void clif_parse_GMHide(int fd, struct map_session_data *sd) {
/// 0 = positive points
/// 1 = negative points
/// 2 = self mute (+10 minutes)
-void clif_parse_GMReqNoChat(int fd,struct map_session_data *sd)
-{
+void clif_parse_GMReqNoChat(int fd,struct map_session_data *sd) {
int id, type, value;
struct map_session_data *dstsd;
char command[NAME_LENGTH+15];
@@ -13449,8 +13426,7 @@ void clif_parse_GMReqNoChat(int fd,struct map_session_data *sd)
if( type == 0 )
value = -value;
- if (type == 2)
- {
+ if (type == 2) {
if (!battle_config.client_accept_chatdori)
return;
if (pc->get_group_level(sd) > 0 || sd->bl.id != id)
@@ -13458,27 +13434,21 @@ void clif_parse_GMReqNoChat(int fd,struct map_session_data *sd)
value = battle_config.client_accept_chatdori;
dstsd = sd;
- }
- else
- {
- dstsd = iMap->id2sd(id);
+ } else {
+ dstsd = map->id2sd(id);
if( dstsd == NULL )
return;
}
- if (type == 2 || ( (pc->get_group_level(sd)) > pc->get_group_level(dstsd) && !pc->can_use_command(sd, "@mute")))
- {
+ if (type == 2 || ( (pc->get_group_level(sd)) > pc->get_group_level(dstsd) && !pc->can_use_command(sd, "@mute"))) {
clif->manner_message(sd, 0);
clif->manner_message(dstsd, 5);
- if (dstsd->status.manner < value)
- {
+ if (dstsd->status.manner < value) {
dstsd->status.manner -= value;
sc_start(&dstsd->bl,SC_NOCHAT,100,0,0);
- }
- else
- {
+ } else {
dstsd->status.manner = 0;
status_change_end(&dstsd->bl, SC_NOCHAT, INVALID_TIMER);
}
@@ -13536,8 +13506,7 @@ void clif_parse_GMReqAccountName(int fd, struct map_session_data *sd)
/// type:
/// 0 = not walkable
/// 1 = walkable
-void clif_parse_GMChangeMapType(int fd, struct map_session_data *sd)
-{
+void clif_parse_GMChangeMapType(int fd, struct map_session_data *sd) {
int x,y,type;
if (!pc->has_permission(sd, PC_PERM_USE_CHANGEMAPTYPE))
@@ -13547,7 +13516,7 @@ void clif_parse_GMChangeMapType(int fd, struct map_session_data *sd)
y = RFIFOW(fd,4);
type = RFIFOW(fd,6);
- iMap->setgatcell(sd->bl.m,x,y,type);
+ map->setgatcell(sd->bl.m,x,y,type);
clif->changemapcell(0,sd->bl.m,x,y,type,ALL_SAMEMAP);
//FIXME: once players leave the map, the client 'forgets' this information.
}
@@ -13559,8 +13528,7 @@ void clif_parse_GMChangeMapType(int fd, struct map_session_data *sd)
/// type:
/// 0 = (/ex nick) deny speech from nick
/// 1 = (/in nick) allow speech from nick
-void clif_parse_PMIgnore(int fd, struct map_session_data* sd)
-{
+void clif_parse_PMIgnore(int fd, struct map_session_data* sd) {
char* nick;
uint8 type;
int i;
@@ -13570,7 +13538,7 @@ void clif_parse_PMIgnore(int fd, struct map_session_data* sd)
type = RFIFOB(fd,26);
if( type == 0 ) { // Add name to ignore list (block)
- if (strcmp(iMap->wisp_server_name, nick) == 0) {
+ if (strcmp(map->wisp_server_name, nick) == 0) {
clif->wisexin(sd, type, 1); // fail
return;
}
@@ -13775,7 +13743,7 @@ void clif_friendslist_send(struct map_session_data *sd)
}
for (n = 0; n < i; n++) { //Sending the online players
- if (iMap->charid2sd(sd->status.friends[n].char_id))
+ if (map->charid2sd(sd->status.friends[n].char_id))
clif->friendslist_toggle(sd, sd->status.friends[n].account_id, sd->status.friends[n].char_id, 1);
}
}
@@ -13822,12 +13790,11 @@ void clif_friendlist_req(struct map_session_data* sd, int account_id, int char_i
/// Request to add a player as friend (CZ_ADD_FRIENDS).
/// 0202 <name>.24B
-void clif_parse_FriendsListAdd(int fd, struct map_session_data *sd)
-{
+void clif_parse_FriendsListAdd(int fd, struct map_session_data *sd) {
struct map_session_data *f_sd;
int i;
- f_sd = iMap->nick2sd((char*)RFIFOP(fd,2));
+ f_sd = map->nick2sd((char*)RFIFOP(fd,2));
// ensure that the request player's friend list is not full
ARR_FIND(0, MAX_FRIENDS, i, sd->status.friends[i].char_id == 0);
@@ -13892,7 +13859,7 @@ void clif_parse_FriendsListReply(int fd, struct map_session_data *sd)
return;
}
- f_sd = iMap->id2sd(account_id); //The account id is the same as the bl.id of players.
+ f_sd = map->id2sd(account_id); //The account id is the same as the bl.id of players.
if (f_sd == NULL)
return;
@@ -13957,7 +13924,7 @@ void clif_parse_FriendsListRemove(int fd, struct map_session_data *sd)
}
//remove from friend's list first
- if( (f_sd = iMap->id2sd(account_id)) && f_sd->status.char_id == char_id) {
+ if( (f_sd = map->id2sd(account_id)) && f_sd->status.char_id == char_id) {
for (i = 0; i < MAX_FRIENDS &&
(f_sd->status.friends[i].char_id != sd->status.char_id || f_sd->status.friends[i].account_id != sd->status.account_id); i++);
@@ -14042,7 +14009,7 @@ void clif_ranklist_sub(unsigned char *buf, enum fame_list_type type) {
// Packet size limits this list to 10 elements. [Skotlex]
for( i = 0; i < 10 && i < MAX_FAME_LIST; i++ ) {
if( list[i].id > 0 ) {
- if( strcmp(list[i].name, "-") == 0 && (name = iMap->charid2nick(list[i].id)) != NULL ) {
+ if( strcmp(list[i].name, "-") == 0 && (name = map->charid2nick(list[i].id)) != NULL ) {
strncpy((char *)(WBUFP(buf, 24 * i)), name, NAME_LENGTH);
} else {
strncpy((char *)(WBUFP(buf, 24 * i)), list[i].name, NAME_LENGTH);
@@ -14431,7 +14398,7 @@ void clif_parse_Check(int fd, struct map_session_data *sd)
safestrncpy(charname, (const char*)RFIFOP(fd,packet_db[RFIFOW(fd,0)].pos[0]), sizeof(charname));
- if( ( pl_sd = iMap->nick2sd(charname) ) == NULL || pc->get_group_level(sd) < pc->get_group_level(pl_sd) ) {
+ if( ( pl_sd = map->nick2sd(charname) ) == NULL || pc->get_group_level(sd) < pc->get_group_level(pl_sd) ) {
return;
}
@@ -15356,9 +15323,8 @@ void clif_Adopt_request(struct map_session_data *sd, struct map_session_data *sr
/// Request to adopt a player (CZ_REQ_JOIN_BABY).
/// 01f9 <account id>.L
-void clif_parse_Adopt_request(int fd, struct map_session_data *sd)
-{
- struct map_session_data *tsd = iMap->id2sd(RFIFOL(fd,2)), *p_sd = iMap->charid2sd(sd->status.partner_id);
+void clif_parse_Adopt_request(int fd, struct map_session_data *sd) {
+ struct map_session_data *tsd = map->id2sd(RFIFOL(fd,2)), *p_sd = map->charid2sd(sd->status.partner_id);
if( pc->can_Adopt(sd, p_sd, tsd) ) {
tsd->adopt_invite = sd->status.account_id;
@@ -15372,13 +15338,12 @@ void clif_parse_Adopt_request(int fd, struct map_session_data *sd)
/// answer:
/// 0 = rejected
/// 1 = accepted
-void clif_parse_Adopt_reply(int fd, struct map_session_data *sd)
-{
+void clif_parse_Adopt_reply(int fd, struct map_session_data *sd) {
int p1_id = RFIFOL(fd,2);
int p2_id = RFIFOL(fd,6);
int result = RFIFOL(fd,10);
- struct map_session_data* p1_sd = iMap->id2sd(p1_id);
- struct map_session_data* p2_sd = iMap->id2sd(p2_id);
+ struct map_session_data* p1_sd = map->id2sd(p1_id);
+ struct map_session_data* p2_sd = map->id2sd(p2_id);
int pid = sd->adopt_invite;
sd->adopt_invite = 0;
@@ -15440,10 +15405,9 @@ void clif_bossmapinfo(int fd, struct mob_data *md, short flag)
/// Requesting equip of a player (CZ_EQUIPWIN_MICROSCOPE).
/// 02d6 <account id>.L
-void clif_parse_ViewPlayerEquip(int fd, struct map_session_data* sd)
-{
+void clif_parse_ViewPlayerEquip(int fd, struct map_session_data* sd) {
int charid = RFIFOL(fd, 2);
- struct map_session_data* tsd = iMap->id2sd(charid);
+ struct map_session_data* tsd = map->id2sd(charid);
if (!tsd)
return;
@@ -16066,7 +16030,7 @@ int clif_instance(int instance_id, int type, int flag) {
break;
case IOT_CHAR:
target = SELF;
- sd = iMap->id2sd(instances[instance_id].owner_id);
+ sd = map->id2sd(instances[instance_id].owner_id);
break;
}
@@ -17713,7 +17677,7 @@ int clif_parse(int fd) {
} else {
//Unusual logout (during log on/off/map-changer procedure)
ShowInfo("Player AID:%d/CID:%d logged off.\n", sd->status.account_id, sd->status.char_id);
- iMap->quit(sd);
+ map->quit(sd);
}
} else {
ShowInfo("Closed connection from '"CL_WHITE"%s"CL_RESET"'.\n", ip2str(session[fd]->client_addr, NULL));
diff --git a/src/map/duel.c b/src/map/duel.c
index 1291dd02b..a993ee667 100644
--- a/src/map/duel.c
+++ b/src/map/duel.c
@@ -69,7 +69,7 @@ void duel_showinfo(const unsigned int did, struct map_session_data* sd) {
duel->list[did].members_count + duel->list[did].invites_count);
clif->disp_onlyself(sd, output, strlen(output));
- iMap->map_foreachpc(duel_showinfo_sub, sd, &p);
+ map->map_foreachpc(duel_showinfo_sub, sd, &p);
}
int duel_create(struct map_session_data* sd, const unsigned int maxpl) {
@@ -126,7 +126,7 @@ void duel_leave(const unsigned int did, struct map_session_data* sd) {
duel->list[did].members_count--;
if(duel->list[did].members_count == 0) {
- iMap->map_foreachpc(duel_leave_sub, did);
+ map->map_foreachpc(duel_leave_sub, did);
duel->count--;
}
diff --git a/src/map/elemental.c b/src/map/elemental.c
index e28a64874..09fc6c379 100644
--- a/src/map/elemental.c
+++ b/src/map/elemental.c
@@ -171,7 +171,7 @@ static int elemental_summon_end(int tid, unsigned int tick, int id, intptr_t dat
struct map_session_data *sd;
struct elemental_data *ed;
- if( (sd = iMap->id2sd(id)) == NULL )
+ if( (sd = map->id2sd(id)) == NULL )
return 1;
if( (ed = sd->ed) == NULL )
return 1;
@@ -226,7 +226,7 @@ int elemental_data_received(struct s_elemental *ele, bool flag) {
struct s_elemental_db *db;
int i = elemental_search_index(ele->class_);
- if( (sd = iMap->charid2sd(ele->char_id)) == NULL )
+ if( (sd = map->charid2sd(ele->char_id)) == NULL )
return 0;
if( !flag || i < 0 ) { // Not created - loaded - DB info
@@ -255,7 +255,7 @@ int elemental_data_received(struct s_elemental *ele, bool flag) {
ed->bl.x = ed->ud.to_x;
ed->bl.y = ed->ud.to_y;
- iMap->addiddb(&ed->bl);
+ map->addiddb(&ed->bl);
status_calc_elemental(ed,1);
ed->last_spdrain_time = ed->last_thinktime = timer->gettick();
ed->summon_timer = INVALID_TIMER;
@@ -268,7 +268,7 @@ int elemental_data_received(struct s_elemental *ele, bool flag) {
sd->status.ele_id = ele->elemental_id;
if( ed->bl.prev == NULL && sd->bl.prev != NULL ) {
- iMap->addblock(&ed->bl);
+ map->addblock(&ed->bl);
clif->spawn(&ed->bl);
clif->elemental_info(sd);
clif->elemental_updatestatus(sd,SP_HP);
@@ -704,16 +704,16 @@ static int elemental_ai_sub_timer(struct elemental_data *ed, struct map_session_
return 0; //Already walking to him
if( DIFF_TICK(tick, ed->ud.canmove_tick) < 0 )
return 0; //Can't move yet.
- if( iMap->search_freecell(&ed->bl, sd->bl.m, &x, &y, MIN_ELEDISTANCE, MIN_ELEDISTANCE, 1)
- && unit->walktoxy(&ed->bl, x, y, 0) )
+ if( map->search_freecell(&ed->bl, sd->bl.m, &x, &y, MIN_ELEDISTANCE, MIN_ELEDISTANCE, 1)
+ && unit->walktoxy(&ed->bl, x, y, 0) )
return 0;
}
if( mode == EL_MODE_AGGRESSIVE ) {
- target = iMap->id2bl(ed->ud.target);
+ target = map->id2bl(ed->ud.target);
if( !target )
- iMap->foreachinrange(elemental_ai_sub_timer_activesearch, &ed->bl, view_range, BL_CHAR, ed, &target, status_get_mode(&ed->bl));
+ map->foreachinrange(elemental_ai_sub_timer_activesearch, &ed->bl, view_range, BL_CHAR, ed, &target, status_get_mode(&ed->bl));
if( !target ) { //No targets available.
elemental->unlocktarget(ed);
@@ -752,7 +752,7 @@ static int elemental_ai_sub_foreachclient(struct map_session_data *sd, va_list a
}
static int elemental_ai_timer(int tid, unsigned int tick, int id, intptr_t data) {
- iMap->map_foreachpc(elemental_ai_sub_foreachclient,tick);
+ map->map_foreachpc(elemental_ai_sub_foreachclient,tick);
return 0;
}
@@ -764,7 +764,7 @@ int read_elementaldb(void) {
struct s_elemental_db *db;
struct status_data *estatus;
- sprintf(line, "%s/%s", iMap->db_path, "elemental_db.txt");
+ sprintf(line, "%s/%s", map->db_path, "elemental_db.txt");
memset(elemental->elemental_db,0,sizeof(elemental->elemental_db));
fp = fopen(line, "r");
@@ -855,7 +855,7 @@ int read_elemental_skilldb(void) {
uint16 skill_id, skill_lv;
int skillmode;
- sprintf(line, "%s/%s", iMap->db_path, "elemental_skill_db.txt");
+ sprintf(line, "%s/%s", map->db_path, "elemental_skill_db.txt");
fp = fopen(line, "r");
if( !fp ) {
ShowError("read_elemental_skilldb : can't read elemental_skill_db.txt\n");
diff --git a/src/map/guild.c b/src/map/guild.c
index 253dbcf1c..797b3b370 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -75,16 +75,15 @@ unsigned short guild_flags_count;
/*==========================================
* Retrieves and validates the sd pointer for this guild member [Skotlex]
*------------------------------------------*/
-static TBL_PC* guild_sd_check(int guild_id, int account_id, int char_id)
-{
- TBL_PC* sd = iMap->id2sd(account_id);
+static TBL_PC* guild_sd_check(int guild_id, int account_id, int char_id) {
+ TBL_PC* sd = map->id2sd(account_id);
if (!(sd && sd->status.char_id == char_id))
return NULL;
- if (sd->status.guild_id != guild_id)
- { //If player belongs to a different guild, kick him out.
- intif->guild_leave(guild_id,account_id,char_id,0,"** Guild Mismatch **");
+ if (sd->status.guild_id != guild_id) {
+ //If player belongs to a different guild, kick him out.
+ intif->guild_leave(guild_id,account_id,char_id,0,"** Guild Mismatch **");
return NULL;
}
@@ -168,7 +167,7 @@ static bool guild_read_castledb(char* str[], int columns, int current)
struct guild_castle *gc;
int mapindex = mapindex_name2id(str[1]);
- if (iMap->mapindex2mapid(mapindex) < 0) // Map not found or on another map-server
+ if (map->mapindex2mapid(mapindex) < 0) // Map not found or on another map-server
return false;
CREATE(gc, struct guild_castle, 1);
@@ -401,7 +400,7 @@ int guild_create(struct map_session_data *sd, const char *name)
//Whether or not to create guild
int guild_created(int account_id,int guild_id) {
- struct map_session_data *sd=iMap->id2sd(account_id);
+ struct map_session_data *sd=map->id2sd(account_id);
if(sd==NULL)
return 0;
@@ -554,9 +553,9 @@ int guild_recv_info(struct guild *sg) {
}
before=*sg;
- //Perform the check on the user because the first load
+ //Perform the check on the user because the first load
guild_check_member(sg);
- if ((sd = iMap->nick2sd(sg->master)) != NULL) {
+ if ((sd = map->nick2sd(sg->master)) != NULL) {
//If the guild master is online the first time the guild_info is received,
//that means he was the first to join, so apply guild skill blocking here.
if( battle_config.guild_skill_relog_delay )
@@ -663,7 +662,7 @@ int guild_invite(struct map_session_data *sd, struct map_session_data *tsd) {
if( tsd->status.guild_id > 0
|| tsd->guild_invite > 0
- || ((iMap->agit_flag || iMap->agit2_flag) && maplist[tsd->bl.m].flag.gvg_castle)
+ || ((map->agit_flag || map->agit2_flag) && maplist[tsd->bl.m].flag.gvg_castle)
) {
//Can't invite people inside castles. [Skotlex]
clif->guild_inviteack(sd,0);
@@ -686,8 +685,7 @@ int guild_invite(struct map_session_data *sd, struct map_session_data *tsd) {
/// Guild invitation reply.
/// flag: 0:rejected, 1:accepted
-int guild_reply_invite(struct map_session_data* sd, int guild_id, int flag)
-{
+int guild_reply_invite(struct map_session_data* sd, int guild_id, int flag) {
struct map_session_data* tsd;
nullpo_ret(sd);
@@ -698,10 +696,10 @@ int guild_reply_invite(struct map_session_data* sd, int guild_id, int flag)
// look up the person who sent the invite
//NOTE: this can be NULL because the person might have logged off in the meantime
- tsd = iMap->id2sd(sd->guild_invite_account);
+ tsd = map->id2sd(sd->guild_invite_account);
- if ( sd->status.guild_id > 0 ) // [Paradox924X]
- { // Already in another guild.
+ if ( sd->status.guild_id > 0 ) {
+ // Already in another guild. [Paradox924X]
if ( tsd ) clif->guild_inviteack(tsd,0);
return 0;
}
@@ -788,33 +786,32 @@ void guild_member_joined(struct map_session_data *sd)
/*==========================================
* Add a player to a given guild_id
*----------------------------------------*/
-int guild_member_added(int guild_id,int account_id,int char_id,int flag)
-{
- struct map_session_data *sd= iMap->id2sd(account_id),*sd2;
+int guild_member_added(int guild_id,int account_id,int char_id,int flag) {
+ struct map_session_data *sd = map->id2sd(account_id),*sd2;
struct guild *g;
if( (g=guild->search(guild_id))==NULL )
return 0;
if(sd==NULL || sd->guild_invite==0){
- // cancel if player not present or invalide guild_id invitation
+ // cancel if player not present or invalide guild_id invitation
if (flag == 0) {
ShowError("guild: member added error %d is not online\n",account_id);
- intif->guild_leave(guild_id,account_id,char_id,0,"** Data Error **");
+ intif->guild_leave(guild_id,account_id,char_id,0,"** Data Error **");
}
return 0;
}
- sd2 = iMap->id2sd(sd->guild_invite_account);
+ sd2 = map->id2sd(sd->guild_invite_account);
sd->guild_invite = 0;
sd->guild_invite_account = 0;
- if (flag == 1) { //failure
+ if (flag == 1) { //failure
if( sd2!=NULL )
clif->guild_inviteack(sd2,3);
return 0;
}
- //if all ok add player to guild
+ //if all ok add player to guild
sd->status.guild_id = g->guild_id;
sd->guild_emblem_id = g->emblem_id;
sd->guild = g;
@@ -850,7 +847,7 @@ int guild_leave(struct map_session_data* sd, int guild_id, int account_id, int c
if( sd->status.account_id != account_id
|| sd->status.char_id != char_id
|| sd->status.guild_id != guild_id
- || ((iMap->agit_flag || iMap->agit2_flag) && maplist[sd->bl.m].flag.gvg_castle)
+ || ((map->agit_flag || map->agit2_flag) && maplist[sd->bl.m].flag.gvg_castle)
)
return 0;
@@ -861,8 +858,7 @@ int guild_leave(struct map_session_data* sd, int guild_id, int account_id, int c
/*==========================================
* Request remove a player to a given guild_id
*----------------------------------------*/
-int guild_expulsion(struct map_session_data* sd, int guild_id, int account_id, int char_id, const char* mes)
-{
+int guild_expulsion(struct map_session_data* sd, int guild_id, int account_id, int char_id, const char* mes) {
struct map_session_data *tsd;
struct guild *g;
int i,ps;
@@ -880,10 +876,10 @@ int guild_expulsion(struct map_session_data* sd, int guild_id, int account_id, i
if( (ps=guild->getposition(g,sd))<0 || !(g->position[ps].mode&0x0010) )
return 0; //Expulsion permission
- //Can't leave inside guild castles.
- if ((tsd = iMap->id2sd(account_id))
+ //Can't leave inside guild castles.
+ if ((tsd = map->id2sd(account_id))
&& tsd->status.char_id == char_id
- && ((iMap->agit_flag || iMap->agit2_flag) && maplist[tsd->bl.m].flag.gvg_castle)
+ && ((map->agit_flag || map->agit2_flag) && maplist[tsd->bl.m].flag.gvg_castle)
)
return 0;
@@ -899,7 +895,7 @@ int guild_member_withdraw(int guild_id, int account_id, int char_id, int flag, c
{
int i;
struct guild* g = guild->search(guild_id);
- struct map_session_data* sd = iMap->charid2sd(char_id);
+ struct map_session_data* sd = map->charid2sd(char_id);
struct map_session_data* online_member_sd;
if(g == NULL)
@@ -1005,13 +1001,13 @@ int guild_recv_memberinfoshort(int guild_id,int account_id,int char_id,int onlin
}
if(idx == -1 || c == 0) {
- //Treat char_id who doesn't match guild_id (not found as member)
- struct map_session_data *sd = iMap->id2sd(account_id);
+ //Treat char_id who doesn't match guild_id (not found as member)
+ struct map_session_data *sd = map->id2sd(account_id);
if(sd && sd->status.char_id == char_id) {
sd->status.guild_id=0;
sd->guild_emblem_id=0;
}
- ShowWarning("guild: not found member %d,%d on %d[%s]\n", account_id,char_id,guild_id,g->name);
+ ShowWarning("guild: not found member %d,%d on %d[%s]\n", account_id,char_id,guild_id,g->name);
return 0;
}
@@ -1213,18 +1209,16 @@ int guild_emblem_changed(int len,int guild_id,int emblem_id,const char *data)
if( gc->guild_id != guild_id )
continue;
// update permanent guardians
- for( i = 0; i < ARRAYLENGTH(gc->guardian); ++i )
- {
- TBL_MOB* md = (gc->guardian[i].id ? iMap->id2md(gc->guardian[i].id) : NULL);
+ for( i = 0; i < ARRAYLENGTH(gc->guardian); ++i ) {
+ TBL_MOB* md = (gc->guardian[i].id ? map->id2md(gc->guardian[i].id) : NULL);
if( md == NULL || md->guardian_data == NULL )
continue;
md->guardian_data->emblem_id = emblem_id;
clif->guild_emblem_area(&md->bl);
}
// update temporary guardians
- for( i = 0; i < gc->temp_guardians_max; ++i )
- {
- TBL_MOB* md = (gc->temp_guardians[i] ? iMap->id2md(gc->temp_guardians[i]) : NULL);
+ for( i = 0; i < gc->temp_guardians_max; ++i ) {
+ TBL_MOB* md = (gc->temp_guardians[i] ? map->id2md(gc->temp_guardians[i]) : NULL);
if( md == NULL || md->guardian_data == NULL )
continue;
md->guardian_data->emblem_id = emblem_id;
@@ -1340,9 +1334,8 @@ int guild_skillup(TBL_PC* sd, uint16 skill_id)
/*====================================================
* Notification of guildskill skill_id increase request
*---------------------------------------------------*/
-int guild_skillupack(int guild_id,uint16 skill_id,int account_id)
-{
- struct map_session_data *sd=iMap->id2sd(account_id);
+int guild_skillupack(int guild_id,uint16 skill_id,int account_id) {
+ struct map_session_data *sd=map->id2sd(account_id);
struct guild *g=guild->search(guild_id);
int i;
if(g==NULL)
@@ -1356,7 +1349,7 @@ int guild_skillupack(int guild_id,uint16 skill_id,int account_id)
case GD_GLORYWOUNDS:
case GD_SOULCOLD:
case GD_HAWKEYES:
- guild->aura_refresh(sd,skill_id,g->skill[skill_id-GD_SKILLBASE].lv);
+ guild->aura_refresh(sd,skill_id,g->skill[skill_id-GD_SKILLBASE].lv);
break;
}
}
@@ -1372,8 +1365,8 @@ int guild_skillupack(int guild_id,uint16 skill_id,int account_id)
void guild_guildaura_refresh(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv) {
struct skill_unit_group* group = NULL;
int type = status->skill2sc(skill_id);
- if( !(battle_config.guild_aura&((iMap->agit_flag || iMap->agit2_flag)?2:1)) &&
- !(battle_config.guild_aura&(map_flag_gvg2(sd->bl.m)?8:4)) )
+ if( !(battle_config.guild_aura&((map->agit_flag || map->agit2_flag)?2:1))
+ && !(battle_config.guild_aura&(map_flag_gvg2(sd->bl.m)?8:4)) )
return;
if( !skill_lv )
return;
@@ -1440,15 +1433,15 @@ int guild_check_alliance(int guild_id1, int guild_id2, int flag)
/*====================================================
* Player sd, asking player tsd an alliance between their 2 guilds
*---------------------------------------------------*/
-int guild_reqalliance(struct map_session_data *sd,struct map_session_data *tsd)
-{
+int guild_reqalliance(struct map_session_data *sd,struct map_session_data *tsd) {
struct guild *g[2];
int i;
- if(iMap->agit_flag || iMap->agit2_flag) { // Disable alliance creation during woe [Valaris]
+ if(map->agit_flag || map->agit2_flag) {
+ // Disable alliance creation during woe [Valaris]
clif->message(sd->fd,msg_txt(676)); //"Alliances cannot be made during Guild Wars!"
return 0;
- } // end addition [Valaris]
+ }
nullpo_ret(sd);
@@ -1498,12 +1491,11 @@ int guild_reqalliance(struct map_session_data *sd,struct map_session_data *tsd)
/*====================================================
* Player sd, answer to player tsd (account_id) for an alliance request
*---------------------------------------------------*/
-int guild_reply_reqalliance(struct map_session_data *sd,int account_id,int flag)
-{
+int guild_reply_reqalliance(struct map_session_data *sd,int account_id,int flag) {
struct map_session_data *tsd;
nullpo_ret(sd);
- tsd= iMap->id2sd( account_id );
+ tsd = map->id2sd( account_id );
if (!tsd) { //Character left? Cancel alliance.
clif->guild_allianceack(sd,3);
return 0;
@@ -1559,14 +1551,14 @@ int guild_reply_reqalliance(struct map_session_data *sd,int account_id,int flag)
/*====================================================
* Player sd asking to break alliance with guild guild_id
*---------------------------------------------------*/
-int guild_delalliance(struct map_session_data *sd,int guild_id,int flag)
-{
+int guild_delalliance(struct map_session_data *sd,int guild_id,int flag) {
nullpo_ret(sd);
- if(iMap->agit_flag || iMap->agit2_flag) { // Disable alliance breaking during woe [Valaris]
+ if(map->agit_flag || map->agit2_flag) {
+ // Disable alliance breaking during woe [Valaris]
clif->message(sd->fd,msg_txt(677)); //"Alliances cannot be broken during Guild Wars!"
return 0;
- } // end addition [Valaris]
+ }
intif->guild_alliance( sd->status.guild_id,guild_id,sd->status.account_id,0,flag|8 );
return 0;
@@ -1595,31 +1587,30 @@ int guild_opposition(struct map_session_data *sd,struct map_session_data *tsd)
return 0;
}
- for (i = 0; i < MAX_GUILDALLIANCE; i++) { // checking relations
+ for (i = 0; i < MAX_GUILDALLIANCE; i++) { // checking relations
if(g->alliance[i].guild_id==tsd->status.guild_id){
- if (g->alliance[i].opposition == 1) { // check if not already hostile
+ if (g->alliance[i].opposition == 1) { // check if not already hostile
clif->guild_oppositionack(sd,2);
return 0;
}
- if(iMap->agit_flag || iMap->agit2_flag) // Prevent the changing of alliances to oppositions during WoE.
+ if(map->agit_flag || map->agit2_flag) // Prevent the changing of alliances to oppositions during WoE.
return 0;
//Change alliance to opposition.
- intif->guild_alliance( sd->status.guild_id,tsd->status.guild_id,
- sd->status.account_id,tsd->status.account_id,8 );
+ intif->guild_alliance(sd->status.guild_id,tsd->status.guild_id,
+ sd->status.account_id,tsd->status.account_id,8);
}
}
- // inform other serv
- intif->guild_alliance( sd->status.guild_id,tsd->status.guild_id,
- sd->status.account_id,tsd->status.account_id,1 );
+ // inform other serv
+ intif->guild_alliance(sd->status.guild_id,tsd->status.guild_id,
+ sd->status.account_id,tsd->status.account_id,1);
return 0;
}
/*====================================================
* Notification of a relationship between 2 guilds
*---------------------------------------------------*/
-int guild_allianceack(int guild_id1,int guild_id2,int account_id1,int account_id2,int flag,const char *name1,const char *name2)
-{
+int guild_allianceack(int guild_id1,int guild_id2,int account_id1,int account_id2,int flag,const char *name1,const char *name2) {
struct guild *g[2];
int guild_id[2];
const char *guild_name[2];
@@ -1630,8 +1621,8 @@ int guild_allianceack(int guild_id1,int guild_id2,int account_id1,int account_id
guild_id[1] = guild_id2;
guild_name[0] = name1;
guild_name[1] = name2;
- sd[0] = iMap->id2sd(account_id1);
- sd[1] = iMap->id2sd(account_id2);
+ sd[0] = map->id2sd(account_id1);
+ sd[1] = map->id2sd(account_id2);
g[0]=guild->search(guild_id1);
g[1]=guild->search(guild_id2);
@@ -1641,7 +1632,7 @@ int guild_allianceack(int guild_id1,int guild_id2,int account_id1,int account_id
sd[0]->guild_alliance_account=0;
}
- if (flag & 0x70) { // failure
+ if (flag & 0x70) { // failure
for(i=0;i<2-(flag&1);i++)
if( sd[i]!=NULL )
clif->guild_allianceack(sd[i],((flag>>4)==i+1)?3:4);
@@ -1657,7 +1648,7 @@ int guild_allianceack(int guild_id1,int guild_id2,int account_id1,int account_id
}
}
- if (!(flag & 0x08)) { // new relationship
+ if (!(flag & 0x08)) { // new relationship
for(i=0;i<2-(flag&1);i++) {
if(g[i]!=NULL) {
ARR_FIND( 0, MAX_GUILDALLIANCE, j, g[i]->alliance[j].guild_id == 0 );
@@ -1668,28 +1659,28 @@ int guild_allianceack(int guild_id1,int guild_id2,int account_id1,int account_id
}
}
}
- } else { // remove relationship
+ } else { // remove relationship
for(i=0;i<2-(flag&1);i++) {
if( g[i] != NULL ) {
ARR_FIND( 0, MAX_GUILDALLIANCE, j, g[i]->alliance[j].guild_id == guild_id[1-i] && g[i]->alliance[j].opposition == (flag&1) );
if( j < MAX_GUILDALLIANCE )
g[i]->alliance[j].guild_id = 0;
}
- if (sd[i] != NULL) // notify players
+ if (sd[i] != NULL) // notify players
clif->guild_delalliance(sd[i],guild_id[1-i],(flag&1));
}
}
- if ((flag & 0x0f) == 0) { // alliance notification
+ if ((flag & 0x0f) == 0) { // alliance notification
if( sd[1]!=NULL )
clif->guild_allianceack(sd[1],2);
- } else if ((flag & 0x0f) == 1) { // enemy notification
+ } else if ((flag & 0x0f) == 1) { // enemy notification
if( sd[0]!=NULL )
clif->guild_oppositionack(sd[0],0);
}
- for (i = 0; i < 2 - (flag & 1); i++) { // Retransmission of the relationship list to all members
+ for (i = 0; i < 2 - (flag & 1); i++) { // Retransmission of the relationship list to all members
struct map_session_data *sd;
if(g[i]!=NULL)
for(j=0;j<g[i]->max_member;j++)
@@ -1963,7 +1954,7 @@ int guild_castledatasave(int castle_id, int index, int value)
struct mob_data *gd;
gc->guild_id = value;
for (i = 0; i < MAX_GUARDIANS; i++)
- if (gc->guardian[i].visible && (gd = iMap->id2md(gc->guardian[i].id)) != NULL)
+ if (gc->guardian[i].visible && (gd = map->id2md(gc->guardian[i].id)) != NULL)
mob->guardian_guildchange(gd);
break;
}
@@ -1975,7 +1966,7 @@ int guild_castledatasave(int castle_id, int index, int value)
struct mob_data *gd;
gc->defense = value;
for (i = 0; i < MAX_GUARDIANS; i++)
- if (gc->guardian[i].visible && (gd = iMap->id2md(gc->guardian[i].id)) != NULL)
+ if (gc->guardian[i].visible && (gd = map->id2md(gc->guardian[i].id)) != NULL)
status_calc_mob(gd, 0);
break;
}
@@ -2234,10 +2225,10 @@ void do_init_guild(void) {
guild_flags_count = 0;
- sv->readdb(iMap->db_path, "castle_db.txt", ',', 4, 5, -1, &guild_read_castledb);
+ sv->readdb(map->db_path, "castle_db.txt", ',', 4, 5, -1, &guild_read_castledb);
memset(guild_skill_tree,0,sizeof(guild_skill_tree));
- sv->readdb(iMap->db_path, "guild_skill_tree.txt", ',', 2+MAX_GUILD_SKILL_REQUIRE*2, 2+MAX_GUILD_SKILL_REQUIRE*2, -1, &guild_read_guildskill_tree_db); //guild skill tree [Komurka]
+ sv->readdb(map->db_path, "guild_skill_tree.txt", ',', 2+MAX_GUILD_SKILL_REQUIRE*2, 2+MAX_GUILD_SKILL_REQUIRE*2, -1, &guild_read_guildskill_tree_db); //guild skill tree [Komurka]
timer->add_func_list(guild_payexp_timer,"guild_payexp_timer");
timer->add_func_list(guild_send_xy_timer, "guild_send_xy_timer");
diff --git a/src/map/homunculus.c b/src/map/homunculus.c
index fb954cdec..45e9af2b0 100644
--- a/src/map/homunculus.c
+++ b/src/map/homunculus.c
@@ -404,7 +404,7 @@ bool homunculus_evolve(struct homun_data *hd) {
hom->intimacy = 500;
unit->remove_map(&hd->bl, CLR_OUTSIGHT, ALC_MARK);
- iMap->addblock(&hd->bl);
+ map->addblock(&hd->bl);
clif->spawn(&hd->bl);
clif->emotion(&sd->bl, E_NO1);
@@ -448,7 +448,7 @@ bool homunculus_mutate(struct homun_data *hd, int homun_id) {
}
unit->remove_map(&hd->bl, CLR_OUTSIGHT, ALC_MARK);
- iMap->addblock(&hd->bl);
+ map->addblock(&hd->bl);
clif->spawn(&hd->bl);
clif->emotion(&sd->bl, E_NO1);
@@ -619,7 +619,7 @@ int homunculus_hunger_timer(int tid, unsigned int tick, int id, intptr_t data) {
struct map_session_data *sd;
struct homun_data *hd;
- if(!(sd=iMap->id2sd(id)) || !sd->status.hom_id || !(hd=sd->hd))
+ if(!(sd=map->id2sd(id)) || !sd->status.hom_id || !(hd=sd->hd))
return 1;
if(hd->hungry_timer != tid){
@@ -756,7 +756,7 @@ bool homunculus_create(struct map_session_data *sd, struct s_homunculus *hom) {
hd->bl.x = hd->ud.to_x;
hd->bl.y = hd->ud.to_y;
- iMap->addiddb(&hd->bl);
+ map->addiddb(&hd->bl);
status_calc_homunculus(hd,1);
hd->hungry_timer = INVALID_TIMER;
@@ -790,7 +790,7 @@ bool homunculus_call(struct map_session_data *sd) {
hd->bl.x = sd->bl.x;
hd->bl.y = sd->bl.y;
hd->bl.m = sd->bl.m;
- iMap->addblock(&hd->bl);
+ map->addblock(&hd->bl);
clif->spawn(&hd->bl);
clif->send_homdata(sd,SP_ACK,0);
clif->hominfo(sd,hd,1);
@@ -810,7 +810,7 @@ bool homunculus_recv_data(int account_id, struct s_homunculus *sh, int flag) {
struct map_session_data *sd;
struct homun_data *hd;
- sd = iMap->id2sd(account_id);
+ sd = map->id2sd(account_id);
if(!sd)
return false;
if (sd->status.char_id != sh->char_id) {
@@ -836,7 +836,7 @@ bool homunculus_recv_data(int account_id, struct s_homunculus *sh, int flag) {
if(hd && hd->homunculus.hp && !hd->homunculus.vaporize && hd->bl.prev == NULL && sd->bl.prev != NULL) {
enum homun_type htype = homun->class2type(hd->homunculus.class_);
- iMap->addblock(&hd->bl);
+ map->addblock(&hd->bl);
clif->spawn(&hd->bl);
clif->send_homdata(sd,SP_ACK,0);
clif->hominfo(sd,hd,1);
@@ -921,7 +921,7 @@ bool homunculus_ressurect(struct map_session_data* sd, unsigned char per, short
hd->bl.m = sd->bl.m;
hd->bl.x = x;
hd->bl.y = y;
- iMap->addblock(&hd->bl);
+ map->addblock(&hd->bl);
clif->spawn(&hd->bl);
}
status->revive(&hd->bl, per, 0);
@@ -1129,14 +1129,14 @@ void homunculus_read_db(void) {
if( i > 0 ) {
char filepath[256];
- sprintf(filepath, "%s/%s", iMap->db_path, filename[i]);
+ sprintf(filepath, "%s/%s", map->db_path, filename[i]);
if( !exists(filepath) ) {
continue;
}
}
- sv->readdb(iMap->db_path, filename[i], ',', 50, 50, MAX_HOMUNCULUS_CLASS, homun->read_db_sub);
+ sv->readdb(map->db_path, filename[i], ',', 50, 50, MAX_HOMUNCULUS_CLASS, homun->read_db_sub);
}
}
@@ -1182,7 +1182,7 @@ bool homunculus_read_skill_db_sub(char* split[], int columns, int current) {
void homunculus_skill_db_read(void) {
memset(homun->skill_tree,0,sizeof(homun->skill_tree));
- sv->readdb(iMap->db_path, "homun_skill_tree.txt", ',', 13, 15, -1, homun->read_skill_db_sub);
+ sv->readdb(map->db_path, "homun_skill_tree.txt", ',', 13, 15, -1, homun->read_skill_db_sub);
}
@@ -1196,7 +1196,7 @@ void homunculus_exp_db_read(void) {
memset(homun->exptable,0,sizeof(homun->exptable));
for(i = 0; i < 2; i++) {
- sprintf(line, "%s/%s", iMap->db_path, filename[i]);
+ sprintf(line, "%s/%s", map->db_path, filename[i]);
if( (fp=fopen(line,"r")) == NULL) {
if(i != 0)
continue;
diff --git a/src/map/instance.c b/src/map/instance.c
index 548a34b1d..5ef089fae 100644
--- a/src/map/instance.c
+++ b/src/map/instance.c
@@ -59,7 +59,7 @@ int instance_create(int owner_id, const char *name, enum instance_owner_type typ
case IOT_NONE:
break;
case IOT_CHAR:
- if( ( sd = iMap->id2sd(owner_id) ) == NULL ) {
+ if( ( sd = map->id2sd(owner_id) ) == NULL ) {
ShowError("instance_create: character %d not found for instance '%s'.\n", owner_id, name);
return -2;
}
@@ -142,7 +142,7 @@ int instance_create(int owner_id, const char *name, enum instance_owner_type typ
* Add a map to the instance using src map "name"
*--------------------------------------*/
int instance_add_map(const char *name, int instance_id, bool usebasename, const char *map_name) {
- int16 m = iMap->mapname2mapid(name);
+ int16 m = map->mapname2mapid(name);
int i, im = -1;
size_t num_cell, size;
@@ -165,17 +165,17 @@ int instance_add_map(const char *name, int instance_id, bool usebasename, const
return -4;
}
- ARR_FIND( instance->start_id, iMap->map_num, i, maplist[i].name[0] == 0 ); // Searching for a Free Map
+ ARR_FIND( instance->start_id, map->map_num, i, maplist[i].name[0] == 0 ); // Searching for a Free Map
- if( i < iMap->map_num )
+ if( i < map->map_num )
im = i; // Unused map found (old instance)
else {
- im = iMap->map_num; // Using next map index
- RECREATE(maplist,struct map_data,++iMap->map_num);
+ im = map->map_num; // Using next map index
+ RECREATE(maplist,struct map_data,++map->map_num);
}
if( maplist[m].cell == (struct mapcell *)0xdeadbeaf )
- iMap->cellfromcache(&maplist[m]);
+ map->cellfromcache(&maplist[m]);
memcpy( &maplist[im], &maplist[m], sizeof(struct map_data) ); // Copy source map
if( map_name != NULL ) {
@@ -247,7 +247,7 @@ int instance_add_map(const char *name, int instance_id, bool usebasename, const
RECREATE(instances[instance_id].map, unsigned short, ++instances[instance_id].num_map);
instances[instance_id].map[instances[instance_id].num_map - 1] = im; // Attach to actual instance
- iMap->addmap2db(&maplist[im]);
+ map->addmap2db(&maplist[im]);
return im;
}
@@ -314,7 +314,7 @@ void instance_init(int instance_id) {
return; // nothing to do
for( i = 0; i < instances[instance_id].num_map; i++ )
- iMap->foreachinmap(instance_map_npcsub, maplist[instances[instance_id].map[i]].instance_src_map, BL_NPC, instances[instance_id].map[i]);
+ map->foreachinmap(instance_map_npcsub, maplist[instances[instance_id].map[i]].instance_src_map, BL_NPC, instances[instance_id].map[i]);
instances[instance_id].state = INSTANCE_BUSY;
}
@@ -339,7 +339,7 @@ int instance_cleanup_sub(struct block_list *bl, va_list ap) {
switch(bl->type) {
case BL_PC:
- iMap->quit((struct map_session_data *) bl);
+ map->quit((struct map_session_data *) bl);
break;
case BL_NPC:
npc->unload((struct npc_data *)bl,true);
@@ -351,7 +351,7 @@ int instance_cleanup_sub(struct block_list *bl, va_list ap) {
//There is no need for this, the pet is removed together with the player. [Skotlex]
break;
case BL_ITEM:
- iMap->clearflooritem(bl);
+ map->clearflooritem(bl);
break;
case BL_SKILL:
skill->delunit((struct skill_unit *) bl);
@@ -372,11 +372,11 @@ void instance_del_map(int16 m) {
return;
}
- iMap->map_foreachpc(instance_del_load, m);
- iMap->foreachinmap(instance_cleanup_sub, m, BL_ALL);
+ map->map_foreachpc(instance_del_load, m);
+ map->foreachinmap(instance_cleanup_sub, m, BL_ALL);
if( maplist[m].mob_delete_timer != INVALID_TIMER )
- timer->delete(maplist[m].mob_delete_timer, iMap->removemobs_timer);
+ timer->delete(maplist[m].mob_delete_timer, map->removemobs_timer);
mapindex_removemap(map_id2index(m));
@@ -426,7 +426,7 @@ void instance_del_map(int16 m) {
if( maplist[m].channel )
clif->chsys_delete(maplist[m].channel);
- iMap->removemapdb(&maplist[m]);
+ map->removemapdb(&maplist[m]);
memset(&maplist[m], 0x00, sizeof(maplist[0]));
maplist[m].name[0] = 0;
maplist[m].instance_id = -1;
@@ -469,7 +469,7 @@ void instance_destroy(int instance_id) {
case IOT_NONE:
break;
case IOT_CHAR:
- if( ( sd = iMap->id2sd(instances[instance_id].owner_id) ) == NULL ) {
+ if( ( sd = map->id2sd(instances[instance_id].owner_id) ) == NULL ) {
break;
}
iptr = sd->instance;
diff --git a/src/map/intif.c b/src/map/intif.c
index cae2561a0..097c41edb 100644
--- a/src/map/intif.c
+++ b/src/map/intif.c
@@ -466,7 +466,7 @@ int intif_party_changemap(struct map_session_data *sd,int online) {
if(!sd)
return 0;
- if( (m=iMap->mapindex2mapid(sd->mapindex)) >= 0 && maplist[m].instance_id >= 0 )
+ if( (m=map->mapindex2mapid(sd->mapindex)) >= 0 && maplist[m].instance_id >= 0 )
mapindex = map_id2index(maplist[m].instance_src_map);
else
mapindex = sd->mapindex;
@@ -851,8 +851,7 @@ int intif_homunculus_requestdelete(int homun_id)
// Packets receive from inter server
// Wisp/Page reception // rewritten by [Yor]
-int intif_parse_WisMessage(int fd)
-{
+int intif_parse_WisMessage(int fd) {
struct map_session_data* sd;
char *wisp_source;
char name[NAME_LENGTH];
@@ -861,9 +860,9 @@ int intif_parse_WisMessage(int fd)
id=RFIFOL(fd,4);
safestrncpy(name, (char*)RFIFOP(fd,32), NAME_LENGTH);
- sd = iMap->nick2sd(name);
- if(sd == NULL || strcmp(sd->status.name, name) != 0)
- { //Not found
+ sd = map->nick2sd(name);
+ if(sd == NULL || strcmp(sd->status.name, name) != 0) {
+ //Not found
intif_wis_replay(id,1);
return 0;
}
@@ -895,7 +894,7 @@ int intif_parse_WisEnd(int fd)
if (battle_config.etc_log)
ShowInfo("intif_parse_wisend: player: %s, flag: %d\n", RFIFOP(fd,2), RFIFOB(fd,26)); // flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target
- sd = (struct map_session_data *)iMap->nick2sd((char *) RFIFOP(fd,2));
+ sd = (struct map_session_data *)map->nick2sd((char *) RFIFOP(fd,2));
if (sd != NULL)
clif->wis_end(sd->fd, RFIFOB(fd,26));
@@ -934,7 +933,7 @@ int mapif_parse_WisToGM(int fd)
safestrncpy(Wisp_name, (char*)RFIFOP(fd,4), NAME_LENGTH);
safestrncpy(message, (char*)RFIFOP(fd,32), mes_len);
// information is sent to all online GM
- iMap->map_foreachpc(mapif_parse_WisToGM_sub, permission, Wisp_name, message, mes_len);
+ map->map_foreachpc(mapif_parse_WisToGM_sub, permission, Wisp_name, message, mes_len);
if (message != mbuf)
aFree(message);
@@ -953,7 +952,7 @@ int intif_parse_Registers(int fd)
if (node)
sd = node->sd;
else { //Normally registries should arrive for in log-in chars.
- sd = iMap->id2sd(account_id);
+ sd = map->id2sd(account_id);
if (sd && RFIFOB(fd,12) == 3 && sd->status.char_id != char_id)
sd = NULL; //Character registry from another character.
}
@@ -1005,7 +1004,7 @@ int intif_parse_LoadGuildStorage(int fd)
guild_id = RFIFOL(fd,8);
if(guild_id <= 0)
return 1;
- sd=iMap->id2sd( RFIFOL(fd,4) );
+ sd=map->id2sd( RFIFOL(fd,4) );
if(sd==NULL){
ShowError("intif_parse_LoadGuildStorage: user not found %d\n",RFIFOL(fd,4));
return 1;
@@ -1321,7 +1320,7 @@ int intif_parse_DeletePetOk(int fd)
int intif_parse_ChangeNameOk(int fd)
{
struct map_session_data *sd = NULL;
- if((sd=iMap->id2sd(RFIFOL(fd,2)))==NULL ||
+ if((sd=map->id2sd(RFIFOL(fd,2)))==NULL ||
sd->status.char_id != RFIFOL(fd,6))
return 0;
@@ -1404,7 +1403,7 @@ int intif_parse_questlog(int fd)
{
int char_id = RFIFOL(fd, 4);
int i;
- TBL_PC * sd = iMap->charid2sd(char_id);
+ TBL_PC * sd = map->charid2sd(char_id);
//User not online anymore
if(!sd)
@@ -1438,10 +1437,9 @@ int intif_parse_questlog(int fd)
return 0;
}
-int intif_parse_questsave(int fd)
-{
+int intif_parse_questsave(int fd) {
int cid = RFIFOL(fd, 2);
- TBL_PC *sd = iMap->id2sd(cid);
+ TBL_PC *sd = map->id2sd(cid);
if( !RFIFOB(fd, 6) )
ShowError("intif_parse_questsave: Failed to save quest(s) for character %d!\n", cid);
@@ -1499,7 +1497,7 @@ int intif_parse_Mail_inboxreceived(int fd)
struct map_session_data *sd;
unsigned char flag = RFIFOB(fd,8);
- sd = iMap->charid2sd(RFIFOL(fd,4));
+ sd = map->charid2sd(RFIFOL(fd,4));
if (sd == NULL)
{
@@ -1559,13 +1557,12 @@ int intif_Mail_getattach(int char_id, int mail_id)
return 0;
}
-int intif_parse_Mail_getattach(int fd)
-{
+int intif_parse_Mail_getattach(int fd) {
struct map_session_data *sd;
struct item item;
int zeny = RFIFOL(fd,8);
- sd = iMap->charid2sd( RFIFOL(fd,4) );
+ sd = map->charid2sd( RFIFOL(fd,4) );
if (sd == NULL)
{
@@ -1601,13 +1598,12 @@ int intif_Mail_delete(int char_id, int mail_id)
return 0;
}
-int intif_parse_Mail_delete(int fd)
-{
+int intif_parse_Mail_delete(int fd) {
int char_id = RFIFOL(fd,2);
int mail_id = RFIFOL(fd,6);
bool failed = RFIFOB(fd,10);
- struct map_session_data *sd = iMap->charid2sd(char_id);
+ struct map_session_data *sd = map->charid2sd(char_id);
if (sd == NULL)
{
ShowError("intif_parse_Mail_delete: char not found %d\n", char_id);
@@ -1648,9 +1644,8 @@ int intif_Mail_return(int char_id, int mail_id)
return 0;
}
-int intif_parse_Mail_return(int fd)
-{
- struct map_session_data *sd = iMap->charid2sd(RFIFOL(fd,2));
+int intif_parse_Mail_return(int fd) {
+ struct map_session_data *sd = map->charid2sd(RFIFOL(fd,2));
int mail_id = RFIFOL(fd,6);
short fail = RFIFOB(fd,10);
@@ -1713,23 +1708,20 @@ static void intif_parse_Mail_send(int fd)
fail = (msg.id == 0);
// notify sender
- sd = iMap->charid2sd(msg.send_id);
- if( sd != NULL )
- {
+ sd = map->charid2sd(msg.send_id);
+ if( sd != NULL ) {
if( fail )
mail->deliveryfail(sd, &msg);
- else
- {
+ else {
clif->mail_send(sd->fd, false);
- if( iMap->save_settings&16 )
+ if( map->save_settings&16 )
chrif->save(sd, 0);
}
}
}
-static void intif_parse_Mail_new(int fd)
-{
- struct map_session_data *sd = iMap->charid2sd(RFIFOL(fd,2));
+static void intif_parse_Mail_new(int fd) {
+ struct map_session_data *sd = map->charid2sd(RFIFOL(fd,2));
int mail_id = RFIFOL(fd,6);
const char* sender_name = (char*)RFIFOP(fd,10);
const char* title = (char*)RFIFOP(fd,34);
@@ -1765,9 +1757,8 @@ int intif_Auction_requestlist(int char_id, short type, int price, const char* se
return 0;
}
-static void intif_parse_Auction_results(int fd)
-{
- struct map_session_data *sd = iMap->charid2sd(RFIFOL(fd,4));
+static void intif_parse_Auction_results(int fd) {
+ struct map_session_data *sd = map->charid2sd(RFIFOL(fd,4));
short count = RFIFOW(fd,8);
short pages = RFIFOW(fd,10);
uint8* data = RFIFOP(fd,12);
@@ -1794,25 +1785,22 @@ int intif_Auction_register(struct auction_data *auction)
return 1;
}
-static void intif_parse_Auction_register(int fd)
-{
+static void intif_parse_Auction_register(int fd) {
struct map_session_data *sd;
struct auction_data auction;
- if( RFIFOW(fd,2) - 4 != sizeof(struct auction_data) )
- {
+ if( RFIFOW(fd,2) - 4 != sizeof(struct auction_data) ) {
ShowError("intif_parse_Auction_register: data size error %d %d\n", RFIFOW(fd,2) - 4, sizeof(struct auction_data));
return;
}
memcpy(&auction, RFIFOP(fd,4), sizeof(struct auction_data));
- if( (sd = iMap->charid2sd(auction.seller_id)) == NULL )
+ if( (sd = map->charid2sd(auction.seller_id)) == NULL )
return;
- if( auction.auction_id > 0 )
- {
+ if( auction.auction_id > 0 ) {
clif->auction_message(sd->fd, 1); // Confirmation Packet ??
- if( iMap->save_settings&32 )
+ if( map->save_settings&32 )
chrif->save(sd,0);
}
else
@@ -1840,16 +1828,14 @@ int intif_Auction_cancel(int char_id, unsigned int auction_id)
return 0;
}
-static void intif_parse_Auction_cancel(int fd)
-{
- struct map_session_data *sd = iMap->charid2sd(RFIFOL(fd,2));
+static void intif_parse_Auction_cancel(int fd) {
+ struct map_session_data *sd = map->charid2sd(RFIFOL(fd,2));
int result = RFIFOB(fd,6);
if( sd == NULL )
return;
- switch( result )
- {
+ switch( result ) {
case 0: clif->auction_message(sd->fd, 2); break;
case 1: clif->auction_close(sd->fd, 2); break;
case 2: clif->auction_close(sd->fd, 1); break;
@@ -1871,9 +1857,8 @@ int intif_Auction_close(int char_id, unsigned int auction_id)
return 0;
}
-static void intif_parse_Auction_close(int fd)
-{
- struct map_session_data *sd = iMap->charid2sd(RFIFOL(fd,2));
+static void intif_parse_Auction_close(int fd) {
+ struct map_session_data *sd = map->charid2sd(RFIFOL(fd,2));
unsigned char result = RFIFOB(fd,6);
if( sd == NULL )
@@ -1907,9 +1892,8 @@ int intif_Auction_bid(int char_id, const char* name, unsigned int auction_id, in
return 0;
}
-static void intif_parse_Auction_bid(int fd)
-{
- struct map_session_data *sd = iMap->charid2sd(RFIFOL(fd,2));
+static void intif_parse_Auction_bid(int fd) {
+ struct map_session_data *sd = map->charid2sd(RFIFOL(fd,2));
int bid = RFIFOL(fd,6);
unsigned char result = RFIFOB(fd,10);
@@ -1927,9 +1911,8 @@ static void intif_parse_Auction_bid(int fd)
}
// Used to send 'You have won the auction' and 'You failed to won the auction' messages
-static void intif_parse_Auction_message(int fd)
-{
- struct map_session_data *sd = iMap->charid2sd(RFIFOL(fd,2));
+static void intif_parse_Auction_message(int fd) {
+ struct map_session_data *sd = map->charid2sd(RFIFOL(fd,2));
unsigned char result = RFIFOB(fd,6);
if( sd == NULL )
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index 2398ba04c..ee0eea5ff 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -1382,7 +1382,7 @@ void itemdb_read_combos() {
char filepath[256];
FILE* fp;
- sprintf(filepath, "%s/%s", iMap->db_path, DBPATH"item_combo_db.txt");
+ sprintf(filepath, "%s/%s", map->db_path, DBPATH"item_combo_db.txt");
if ((fp = fopen(filepath, "r")) == NULL) {
ShowError("itemdb_read_combos: File not found \"%s\".\n", filepath);
@@ -1626,7 +1626,7 @@ int itemdb_parse_dbrow(char** str, const char* source, int line, int scriptopt)
id->weight = atoi(str[6]);
#ifdef RENEWAL
- if( iMap->db_use_sql_item_db ) {
+ if( map->db_use_sql_item_db ) {
id->atk = atoi(str[7]);
id->matk = atoi(str[8]);
offset += 1;
@@ -1656,7 +1656,7 @@ int itemdb_parse_dbrow(char** str, const char* source, int line, int scriptopt)
id->wlv = cap_value(atoi(str[15+offset]), REFINE_TYPE_ARMOR, REFINE_TYPE_MAX);
#ifdef RENEWAL
- if( iMap->db_use_sql_item_db ) {
+ if( map->db_use_sql_item_db ) {
id->elv = atoi(str[16+offset]);
id->elvmax = atoi(str[17+offset]);
offset += 1;
@@ -1714,7 +1714,7 @@ int itemdb_readdb(void)
char filepath[256];
FILE* fp;
- sprintf(filepath, "%s/%s", iMap->db_path, filename[fi]);
+ sprintf(filepath, "%s/%s", map->db_path, filename[fi]);
fp = fopen(filepath, "r");
if( fp == NULL ) {
ShowWarning("itemdb_readdb: File not found \"%s\", skipping.\n", filepath);
@@ -1821,12 +1821,12 @@ int itemdb_readdb(void)
int itemdb_read_sqldb(void) {
const char* item_db_name[] = {
- #ifdef RENEWAL
- iMap->item_db_re_db,
- #else
- iMap->item_db_db,
- #endif
- iMap->item_db2_db };
+#ifdef RENEWAL
+ map->item_db_re_db,
+#else // not RENEWAL
+ map->item_db_db,
+#endif // RENEWAL
+ map->item_db2_db };
int fi;
for( fi = 0; fi < ARRAYLENGTH(item_db_name); ++fi ) {
@@ -1889,9 +1889,8 @@ uint64 itemdb_unique_id(int8 flag, int64 value) {
return ++item_uid;
}
int itemdb_uid_load() {
-
char * uid;
- if (SQL_ERROR == SQL->Query(mmysql_handle, "SELECT `value` FROM `%s` WHERE `varname`='unique_id'",iMap->interreg_db))
+ if (SQL_ERROR == SQL->Query(mmysql_handle, "SELECT `value` FROM `%s` WHERE `varname`='unique_id'",map->interreg_db))
Sql_ShowDebug(mmysql_handle);
if( SQL_SUCCESS != SQL->NextRow(mmysql_handle) ) {
@@ -1914,7 +1913,7 @@ void itemdb_read(void) {
int i;
DBData prev;
- if (iMap->db_use_sql_item_db)
+ if (map->db_use_sql_item_db)
itemdb->read_sqldb();
else
itemdb->readdb();
@@ -1933,12 +1932,12 @@ void itemdb_read(void) {
itemdb->read_chains();
itemdb->read_packages();
- sv->readdb(iMap->db_path, "item_avail.txt", ',', 2, 2, -1, itemdb->read_itemavail);
- sv->readdb(iMap->db_path, DBPATH"item_trade.txt", ',', 3, 3, -1, itemdb->read_itemtrade);
- sv->readdb(iMap->db_path, "item_delay.txt", ',', 2, 2, -1, itemdb->read_itemdelay);
- sv->readdb(iMap->db_path, "item_stack.txt", ',', 3, 3, -1, itemdb->read_stack);
- sv->readdb(iMap->db_path, DBPATH"item_buyingstore.txt", ',', 1, 1, -1, itemdb->read_buyingstore);
- sv->readdb(iMap->db_path, "item_nouse.txt", ',', 3, 3, -1, itemdb->read_nouse);
+ sv->readdb(map->db_path, "item_avail.txt", ',', 2, 2, -1, itemdb->read_itemavail);
+ sv->readdb(map->db_path, DBPATH"item_trade.txt", ',', 3, 3, -1, itemdb->read_itemtrade);
+ sv->readdb(map->db_path, "item_delay.txt", ',', 2, 2, -1, itemdb->read_itemdelay);
+ sv->readdb(map->db_path, "item_stack.txt", ',', 3, 3, -1, itemdb->read_stack);
+ sv->readdb(map->db_path, DBPATH"item_buyingstore.txt", ',', 1, 1, -1, itemdb->read_buyingstore);
+ sv->readdb(map->db_path, "item_nouse.txt", ',', 3, 3, -1, itemdb->read_nouse);
itemdb->uid_load();
}
diff --git a/src/map/log.c b/src/map/log.c
index a10549972..929143ba7 100644
--- a/src/map/log.c
+++ b/src/map/log.c
@@ -374,7 +374,7 @@ void log_chat(e_log_chat_type type, int type_id, int src_charid, int src_accid,
return;
}
- if( logs->config.log_chat_woe_disable && ( iMap->agit_flag || iMap->agit2_flag ) ) {
+ if( logs->config.log_chat_woe_disable && ( map->agit_flag || map->agit2_flag ) ) {
// no chat logging during woe
return;
}
diff --git a/src/map/map.c b/src/map/map.c
index 1d679a79e..935492dbd 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -133,7 +133,7 @@ int enable_grf = 0; //To enable/disable reading maps from GRF files, bypassing m
struct eri *map_iterator_ers;
char *map_cache_buffer = NULL; // Has the uncompressed gat data of all maps, so just one allocation has to be made
-struct map_interface iMap_s;
+struct map_interface map_s;
struct map_session_data *cpsd;
@@ -177,7 +177,7 @@ int map_freeblock (struct block_list *bl)
return block_free_lock;
}
/*==========================================
-* Lock blocklist, (prevent iMap->freeblock usage)
+* Lock blocklist, (prevent map->freeblock usage)
*------------------------------------------*/
int map_freeblock_lock (void)
{
@@ -207,12 +207,11 @@ int map_freeblock_unlock (void)
// Timer function to check if there some remaining lock and remove them if so.
// Called each 1s
-int map_freeblock_timer(int tid, unsigned int tick, int id, intptr_t data)
-{
+int map_freeblock_timer(int tid, unsigned int tick, int id, intptr_t data) {
if (block_free_lock > 0) {
ShowError("map_freeblock_timer: block_free_lock(%d) is invalid.\n", block_free_lock);
block_free_lock = 1;
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
}
return 0;
@@ -269,9 +268,8 @@ int map_addblock(struct block_list* bl)
m = bl->m;
x = bl->x;
y = bl->y;
- if( m < 0 || m >= iMap->map_num )
- {
- ShowError("map_addblock: invalid map id (%d), only %d are loaded.\n", m, iMap->map_num);
+ if( m < 0 || m >= map->map_num ) {
+ ShowError("map_addblock: invalid map id (%d), only %d are loaded.\n", m, map->map_num);
return 1;
}
if( x < 0 || x >= maplist[m].xs || y < 0 || y >= maplist[m].ys ) {
@@ -375,13 +373,13 @@ int map_moveblock(struct block_list *bl, int x1, int y1, unsigned int tick)
} else if (bl->type == BL_NPC)
npc->unsetcells((TBL_NPC*)bl);
- if (moveblock) iMap->delblock(bl);
+ if (moveblock) map->delblock(bl);
#ifdef CELL_NOSTACK
else map_delblcell(bl);
#endif
bl->x = x1;
bl->y = y1;
- if (moveblock) iMap->addblock(bl);
+ if (moveblock) map->addblock(bl);
#ifdef CELL_NOSTACK
else map_addblcell(bl);
#endif
@@ -392,7 +390,7 @@ int map_moveblock(struct block_list *bl, int x1, int y1, unsigned int tick)
if( bl->type == BL_PC && ((TBL_PC*)bl)->shadowform_id ) {//Shadow Form Target Moving
struct block_list *d_bl;
- if( (d_bl = iMap->id2bl(((TBL_PC*)bl)->shadowform_id)) == NULL || !check_distance_bl(bl,d_bl,10) ) {
+ if( (d_bl = map->id2bl(((TBL_PC*)bl)->shadowform_id)) == NULL || !check_distance_bl(bl,d_bl,10) ) {
if( d_bl )
status_change_end(d_bl,SC__SHADOWFORM,INVALID_TIMER);
((TBL_PC*)bl)->shadowform_id = 0;
@@ -417,16 +415,17 @@ int map_moveblock(struct block_list *bl, int x1, int y1, unsigned int tick)
if( sc->data[SC__SHADOWFORM] ) {//Shadow Form Caster Moving
struct block_list *d_bl;
- if( (d_bl = iMap->id2bl(sc->data[SC__SHADOWFORM]->val2)) == NULL || !check_distance_bl(bl,d_bl,10) )
+ if( (d_bl = map->id2bl(sc->data[SC__SHADOWFORM]->val2)) == NULL || !check_distance_bl(bl,d_bl,10) )
status_change_end(bl,SC__SHADOWFORM,INVALID_TIMER);
}
if (sc->data[SC_PROPERTYWALK]
- && sc->data[SC_PROPERTYWALK]->val3 < skill->get_maxcount(sc->data[SC_PROPERTYWALK]->val1,sc->data[SC_PROPERTYWALK]->val2)
- && iMap->find_skill_unit_oncell(bl,bl->x,bl->y,SO_ELECTRICWALK,NULL,0) == NULL
- && iMap->find_skill_unit_oncell(bl,bl->x,bl->y,SO_FIREWALK,NULL,0) == NULL
- && skill->unitsetting(bl,sc->data[SC_PROPERTYWALK]->val1,sc->data[SC_PROPERTYWALK]->val2,x0, y0,0)) {
- sc->data[SC_PROPERTYWALK]->val3++;
+ && sc->data[SC_PROPERTYWALK]->val3 < skill->get_maxcount(sc->data[SC_PROPERTYWALK]->val1,sc->data[SC_PROPERTYWALK]->val2)
+ && map->find_skill_unit_oncell(bl,bl->x,bl->y,SO_ELECTRICWALK,NULL,0) == NULL
+ && map->find_skill_unit_oncell(bl,bl->x,bl->y,SO_FIREWALK,NULL,0) == NULL
+ && skill->unitsetting(bl,sc->data[SC_PROPERTYWALK]->val1,sc->data[SC_PROPERTYWALK]->val2,x0, y0,0)
+ ) {
+ sc->data[SC_PROPERTYWALK]->val3++;
}
@@ -519,12 +518,11 @@ struct skill_unit* map_find_skill_unit_oncell(struct block_list* target,int16 x,
* @param args Extra arguments for func
* @return Sum of the values returned by func
*/
-static int bl_vforeach(int (*func)(struct block_list*, va_list), int blockcount, int max, va_list args)
-{
+static int bl_vforeach(int (*func)(struct block_list*, va_list), int blockcount, int max, va_list args) {
int i;
int returnCount = 0;
- iMap->freeblock_lock();
+ map->freeblock_lock();
for (i = blockcount; i < bl_list_count && returnCount < max; i++) {
if (bl_list[i]->prev) { //func() may delete this bl_list[] slot, checking for prev ensures it wasnt queued for deletion.
va_list argscopy;
@@ -533,7 +531,7 @@ static int bl_vforeach(int (*func)(struct block_list*, va_list), int blockcount,
va_end(argscopy);
}
}
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
bl_list_count = blockcount;
@@ -1174,8 +1172,7 @@ int map_get_new_object_id(void)
* Timered function to clear the floor (remove remaining item)
* Called each flooritem_lifetime ms
*------------------------------------------*/
-int map_clearflooritem_timer(int tid, unsigned int tick, int id, intptr_t data)
-{
+int map_clearflooritem_timer(int tid, unsigned int tick, int id, intptr_t data) {
struct flooritem_data* fitem = (struct flooritem_data*)idb_get(id_db, id);
if (fitem == NULL || fitem->bl.type != BL_ITEM || (fitem->cleartimer != tid)) {
@@ -1188,9 +1185,9 @@ int map_clearflooritem_timer(int tid, unsigned int tick, int id, intptr_t data)
intif->delete_petdata(MakeDWord(fitem->item_data.card[1], fitem->item_data.card[2]));
clif->clearflooritem(fitem, 0);
- iMap->deliddb(&fitem->bl);
- iMap->delblock(&fitem->bl);
- iMap->freeblock(&fitem->bl);
+ map->deliddb(&fitem->bl);
+ map->delblock(&fitem->bl);
+ map->freeblock(&fitem->bl);
return 0;
}
@@ -1201,12 +1198,12 @@ void map_clearflooritem(struct block_list *bl) {
struct flooritem_data* fitem = (struct flooritem_data*)bl;
if( fitem->cleartimer )
- timer->delete(fitem->cleartimer,iMap->clearflooritem_timer);
+ timer->delete(fitem->cleartimer,map->clearflooritem_timer);
clif->clearflooritem(fitem, 0);
- iMap->deliddb(&fitem->bl);
- iMap->delblock(&fitem->bl);
- iMap->freeblock(&fitem->bl);
+ map->deliddb(&fitem->bl);
+ map->delblock(&fitem->bl);
+ map->freeblock(&fitem->bl);
}
/*==========================================
@@ -1224,10 +1221,10 @@ int map_searchrandfreecell(int16 m,int16 *x,int16 *y,int stack) {
for(j=-1;j<=1;j++){
if(j+*x<0 || j+*x>=maplist[m].xs)
continue;
- if(iMap->getcell(m,j+*x,i+*y,CELL_CHKNOPASS) && !iMap->getcell(m,j+*x,i+*y,CELL_CHKICEWALL))
+ if(map->getcell(m,j+*x,i+*y,CELL_CHKNOPASS) && !map->getcell(m,j+*x,i+*y,CELL_CHKICEWALL))
continue;
//Avoid item stacking to prevent against exploits. [Skotlex]
- if(stack && iMap->count_oncell(m,j+*x,i+*y, BL_ITEM) > stack)
+ if(stack && map->count_oncell(m,j+*x,i+*y, BL_ITEM) > stack)
continue;
free_cells[free_cell][0] = j+*x;
free_cells[free_cell++][1] = i+*y;
@@ -1284,7 +1281,7 @@ int map_search_freecell(struct block_list *src, int16 m, int16 *x,int16 *y, int1
//No range? Return the target cell then....
*x = bx;
*y = by;
- return iMap->getcell(m,*x,*y,CELL_CHKREACH);
+ return map->getcell(m,*x,*y,CELL_CHKREACH);
}
if (rx >= 0 && ry >= 0) {
@@ -1302,8 +1299,7 @@ int map_search_freecell(struct block_list *src, int16 m, int16 *x,int16 *y, int1
if (*x == bx && *y == by)
continue; //Avoid picking the same target tile.
- if (iMap->getcell(m,*x,*y,CELL_CHKREACH))
- {
+ if (map->getcell(m,*x,*y,CELL_CHKREACH)) {
if(flag&2 && !unit->can_reach_pos(src, *x, *y, 1))
continue;
if(flag&4) {
@@ -1349,7 +1345,7 @@ int map_addflooritem(struct item *item_data,int amount,int16 m,int16 x,int16 y,i
fitem->bl.m=m;
fitem->bl.x=x;
fitem->bl.y=y;
- fitem->bl.id = iMap->get_new_object_id();
+ fitem->bl.id = map->get_new_object_id();
if(fitem->bl.id==0){
aFree(fitem);
return 0;
@@ -1366,10 +1362,10 @@ int map_addflooritem(struct item *item_data,int amount,int16 m,int16 x,int16 y,i
fitem->item_data.amount=amount;
fitem->subx=(r&3)*3+3;
fitem->suby=((r>>2)&3)*3+3;
- fitem->cleartimer=timer->add(timer->gettick()+battle_config.flooritem_lifetime,iMap->clearflooritem_timer,fitem->bl.id,0);
+ fitem->cleartimer=timer->add(timer->gettick()+battle_config.flooritem_lifetime,map->clearflooritem_timer,fitem->bl.id,0);
- iMap->addiddb(&fitem->bl);
- iMap->addblock(&fitem->bl);
+ map->addiddb(&fitem->bl);
+ map->addblock(&fitem->bl);
clif->dropflooritem(fitem);
return fitem->bl.id;
@@ -1393,7 +1389,7 @@ void map_addnickdb(int charid, const char* nick)
struct charid_request* req;
struct map_session_data* sd;
- if( iMap->charid2sd(charid) )
+ if( map->charid2sd(charid) )
return;// already online
p = idb_ensure(nick_db, charid, create_charid2nick);
@@ -1402,7 +1398,7 @@ void map_addnickdb(int charid, const char* nick)
while( p->requests ) {
req = p->requests;
p->requests = req->next;
- sd = iMap->charid2sd(req->charid);
+ sd = map->charid2sd(req->charid);
if( sd )
clif->solved_charname(sd->fd, charid, p->nick);
aFree(req);
@@ -1424,7 +1420,7 @@ void map_delnickdb(int charid, const char* name)
while( p->requests ) {
req = p->requests;
p->requests = req->next;
- sd = iMap->charid2sd(req->charid);
+ sd = map->charid2sd(req->charid);
if( sd )
clif->solved_charname(sd->fd, charid, name);
aFree(req);
@@ -1443,7 +1439,7 @@ void map_reqnickdb(struct map_session_data * sd, int charid)
nullpo_retv(sd);
- tsd = iMap->charid2sd(charid);
+ tsd = map->charid2sd(charid);
if( tsd ) {
clif->solved_charname(sd->fd, charid, tsd->status.name);
return;
@@ -1557,8 +1553,8 @@ int map_quit(struct map_session_data *sd) {
npc->script_event(sd, NPCE_LOGOUT);
//Unit_free handles clearing the player related data,
- //iMap->quit handles extra specific data which is related to quitting normally
- //(changing map-servers invokes unit_free but bypasses iMap->quit)
+ //map->quit handles extra specific data which is related to quitting normally
+ //(changing map-servers invokes unit_free but bypasses map->quit)
if( sd->sc.count ) {
//Status that are not saved...
for(i=0; i < SC_MAX; i++){
@@ -1611,7 +1607,7 @@ int map_quit(struct map_session_data *sd) {
else
pt = &sd->status.save_point;
- if( (m=iMap->mapindex2mapid(pt->map)) >= 0 ) {
+ if( (m=map->mapindex2mapid(pt->map)) >= 0 ) {
sd->bl.m = m;
sd->bl.x = pt->x;
sd->bl.y = pt->y;
@@ -1634,53 +1630,47 @@ int map_quit(struct map_session_data *sd) {
/*==========================================
* Lookup, id to session (player,mob,npc,homon,merc..)
*------------------------------------------*/
-struct map_session_data * map_id2sd(int id)
-{
+struct map_session_data *map_id2sd(int id) {
if (id <= 0) return NULL;
return (struct map_session_data*)idb_get(pc_db,id);
}
-struct mob_data * map_id2md(int id)
-{
+struct mob_data *map_id2md(int id) {
if (id <= 0) return NULL;
return (struct mob_data*)idb_get(mobid_db,id);
}
-struct npc_data * map_id2nd(int id)
-{// just a id2bl lookup because there's no npc_db
- struct block_list* bl = iMap->id2bl(id);
+struct npc_data *map_id2nd(int id) {
+ // just a id2bl lookup because there's no npc_db
+ struct block_list* bl = map->id2bl(id);
return BL_CAST(BL_NPC, bl);
}
-struct homun_data* map_id2hd(int id)
-{
- struct block_list* bl = iMap->id2bl(id);
+struct homun_data *map_id2hd(int id) {
+ struct block_list* bl = map->id2bl(id);
return BL_CAST(BL_HOM, bl);
}
-struct mercenary_data* map_id2mc(int id)
-{
- struct block_list* bl = iMap->id2bl(id);
+struct mercenary_data *map_id2mc(int id) {
+ struct block_list* bl = map->id2bl(id);
return BL_CAST(BL_MER, bl);
}
-struct chat_data* map_id2cd(int id)
-{
- struct block_list* bl = iMap->id2bl(id);
+struct chat_data *map_id2cd(int id) {
+ struct block_list* bl = map->id2bl(id);
return BL_CAST(BL_CHAT, bl);
}
/// Returns the nick of the target charid or NULL if unknown (requests the nick to the char server).
-const char* map_charid2nick(int charid)
-{
+const char *map_charid2nick(int charid) {
struct charid2nick *p;
struct map_session_data* sd;
- sd = iMap->charid2sd(charid);
+ sd = map->charid2sd(charid);
if( sd )
return sd->status.name;// character is online, return it's name
@@ -1757,7 +1747,7 @@ struct block_list * map_id2bl(int id) {
}
/**
-* Same as iMap->id2bl except it only checks for its existence
+* Same as map->id2bl except it only checks for its existence
**/
bool map_blid_exists( int id ) {
return (idb_exists(id_db,id));
@@ -2046,7 +2036,7 @@ bool mapit_exists(struct s_mapiterator* iter) {
bool map_addnpc(int16 m,struct npc_data *nd) {
nullpo_ret(nd);
- if( m < 0 || m >= iMap->map_num )
+ if( m < 0 || m >= map->map_num )
return false;
if( maplist[m].npc_num == MAX_NPC_PER_MAP ) {
@@ -2079,7 +2069,7 @@ void map_spawnmobs(int16 m) {
int i, k=0;
if (maplist[m].mob_delete_timer != INVALID_TIMER) {
//Mobs have not been removed yet [Skotlex]
- timer->delete(maplist[m].mob_delete_timer, iMap->removemobs_timer);
+ timer->delete(maplist[m].mob_delete_timer, map->removemobs_timer);
maplist[m].mob_delete_timer = INVALID_TIMER;
return;
}
@@ -2126,7 +2116,7 @@ int map_removemobs_timer(int tid, unsigned int tick, int id, intptr_t data)
int count;
const int16 m = id;
- if (m < 0 || m >= iMap->map_num) { //Incorrect map id!
+ if (m < 0 || m >= map->map_num) { //Incorrect map id!
ShowError("map_removemobs_timer error: timer %d points to invalid map %d\n",tid, m);
return 0;
}
@@ -2146,12 +2136,11 @@ int map_removemobs_timer(int tid, unsigned int tick, int id, intptr_t data)
return 1;
}
-void map_removemobs(int16 m)
-{
+void map_removemobs(int16 m) {
if (maplist[m].mob_delete_timer != INVALID_TIMER) // should never happen
return; //Mobs are already scheduled for removal
- maplist[m].mob_delete_timer = timer->add(timer->gettick()+battle_config.mob_remove_delay, iMap->removemobs_timer, m, 0);
+ maplist[m].mob_delete_timer = timer->add(timer->gettick()+battle_config.mob_remove_delay, map->removemobs_timer, m, 0);
}
/*==========================================
@@ -2162,7 +2151,7 @@ int16 map_mapname2mapid(const char* name) {
map_index = mapindex_name2id(name);
if (!map_index)
return -1;
- return iMap->mapindex2mapid(map_index);
+ return map->mapindex2mapid(map_index);
}
/*==========================================
@@ -2276,9 +2265,8 @@ int map_random_dir(struct block_list *bl, int16 *x, int16 *y)
xi = bl->x + segment*dirx[j];
segment = (short)sqrt((float)(dist2 - segment*segment)); //The complement of the previously picked segment
yi = bl->y + segment*diry[j];
- } while (
- (iMap->getcell(bl->m,xi,yi,CELL_CHKNOPASS) || !path->search(NULL,bl->m,bl->x,bl->y,xi,yi,1,CELL_CHKNOREACH))
- && (++i)<100 );
+ } while ( (map->getcell(bl->m,xi,yi,CELL_CHKNOPASS) || !path->search(NULL,bl->m,bl->x,bl->y,xi,yi,1,CELL_CHKNOREACH))
+ && (++i)<100 );
if (i < 100) {
*x = xi;
@@ -2351,7 +2339,7 @@ void map_cellfromcache(struct map_data *m) {
* Confirm if celltype in (m,x,y) match the one given in cellchk
*------------------------------------------*/
int map_getcell(int16 m,int16 x,int16 y,cell_chk cellchk) {
- return (m < 0 || m >= iMap->map_num) ? 0 : maplist[m].getcellp(&maplist[m],x,y,cellchk);
+ return (m < 0 || m >= map->map_num) ? 0 : maplist[m].getcellp(&maplist[m],x,y,cellchk);
}
int map_getcellp(struct map_data* m,int16 x,int16 y,cell_chk cellchk) {
@@ -2426,7 +2414,7 @@ int map_getcellp(struct map_data* m,int16 x,int16 y,cell_chk cellchk) {
/* [Ind/Hercules] */
int map_sub_getcellp(struct map_data* m,int16 x,int16 y,cell_chk cellchk) {
- iMap->cellfromcache(m);
+ map->cellfromcache(m);
m->getcellp = map_getcellp;
m->setcell = map_setcell;
return m->getcellp(m,x,y,cellchk);
@@ -2439,7 +2427,7 @@ int map_sub_getcellp(struct map_data* m,int16 x,int16 y,cell_chk cellchk) {
void map_setcell(int16 m, int16 x, int16 y, cell_t cell, bool flag) {
int j;
- if( m < 0 || m >= iMap->map_num || x < 0 || x >= maplist[m].xs || y < 0 || y >= maplist[m].ys )
+ if( m < 0 || m >= map->map_num || x < 0 || x >= maplist[m].xs || y < 0 || y >= maplist[m].ys )
return;
j = x + y*maplist[m].xs;
@@ -2462,10 +2450,10 @@ void map_setcell(int16 m, int16 x, int16 y, cell_t cell, bool flag) {
}
}
void map_sub_setcell(int16 m, int16 x, int16 y, cell_t cell, bool flag) {
- if( m < 0 || m >= iMap->map_num || x < 0 || x >= maplist[m].xs || y < 0 || y >= maplist[m].ys )
+ if( m < 0 || m >= map->map_num || x < 0 || x >= maplist[m].xs || y < 0 || y >= maplist[m].ys )
return;
- iMap->cellfromcache(&maplist[m]);
+ map->cellfromcache(&maplist[m]);
maplist[m].setcell = map_setcell;
maplist[m].getcellp = map_getcellp;
maplist[m].setcell(m,x,y,cell,flag);
@@ -2474,7 +2462,7 @@ void map_setgatcell(int16 m, int16 x, int16 y, int gat) {
int j;
struct mapcell cell;
- if( m < 0 || m >= iMap->map_num || x < 0 || x >= maplist[m].xs || y < 0 || y >= maplist[m].ys )
+ if( m < 0 || m >= map->map_num || x < 0 || x >= maplist[m].xs || y < 0 || y >= maplist[m].ys )
return;
j = x + y*maplist[m].xs;
@@ -2519,7 +2507,7 @@ bool map_iwall_set(int16 m, int16 x, int16 y, int size, int8 dir, bool shootable
if( (iwall = (struct iwall_data *)strdb_get(iwall_db, wall_name)) != NULL )
return false; // Already Exists
- if( iMap->getcell(m, x, y, CELL_CHKNOREACH) )
+ if( map->getcell(m, x, y, CELL_CHKNOREACH) )
return false; // Starting cell problem
CREATE(iwall, struct iwall_data, 1);
@@ -2534,13 +2522,13 @@ bool map_iwall_set(int16 m, int16 x, int16 y, int size, int8 dir, bool shootable
for( i = 0; i < size; i++ ) {
map_iwall_nextxy(x, y, dir, i, &x1, &y1);
- if( iMap->getcell(m, x1, y1, CELL_CHKNOREACH) )
+ if( map->getcell(m, x1, y1, CELL_CHKNOREACH) )
break; // Collision
maplist[m].setcell(m, x1, y1, CELL_WALKABLE, false);
maplist[m].setcell(m, x1, y1, CELL_SHOOTABLE, shootable);
- clif->changemapcell(0, m, x1, y1, iMap->getcell(m, x1, y1, CELL_GETTYPE), ALL_SAMEMAP);
+ clif->changemapcell(0, m, x1, y1, map->getcell(m, x1, y1, CELL_GETTYPE), ALL_SAMEMAP);
}
iwall->size = i;
@@ -2567,7 +2555,7 @@ void map_iwall_get(struct map_session_data *sd) {
for( i = 0; i < iwall->size; i++ ) {
map_iwall_nextxy(iwall->x, iwall->y, iwall->dir, i, &x1, &y1);
- clif->changemapcell(sd->fd, iwall->m, x1, y1, iMap->getcell(iwall->m, x1, y1, CELL_GETTYPE), SELF);
+ clif->changemapcell(sd->fd, iwall->m, x1, y1, map->getcell(iwall->m, x1, y1, CELL_GETTYPE), SELF);
}
}
dbi_destroy(iter);
@@ -2587,7 +2575,7 @@ void map_iwall_remove(const char *wall_name)
maplist[iwall->m].setcell(iwall->m, x1, y1, CELL_SHOOTABLE, true);
maplist[iwall->m].setcell(iwall->m, x1, y1, CELL_WALKABLE, true);
- clif->changemapcell(0, iwall->m, x1, y1, iMap->getcell(iwall->m, x1, y1, CELL_GETTYPE), ALL_SAMEMAP);
+ clif->changemapcell(0, iwall->m, x1, y1, map->getcell(iwall->m, x1, y1, CELL_GETTYPE), ALL_SAMEMAP);
}
maplist[iwall->m].iwall_num--;
@@ -2742,15 +2730,15 @@ int map_readfromcache(struct map_data *m, char *buffer) {
int map_addmap(char* mapname) {
- maplist[iMap->map_num].instance_id = -1;
- mapindex_getmapname(mapname, maplist[iMap->map_num++].name);
+ maplist[map->map_num].instance_id = -1;
+ mapindex_getmapname(mapname, maplist[map->map_num++].name);
return 0;
}
static void map_delmapid(int id) {
ShowNotice("Removing map [ %s ] from maplist"CL_CLL"\n",maplist[id].name);
- memmove(maplist+id, maplist+id+1, sizeof(maplist[0])*(iMap->map_num-id-1));
- iMap->map_num--;
+ memmove(maplist+id, maplist+id+1, sizeof(maplist[0])*(map->map_num-id-1));
+ map->map_num--;
}
int map_delmap(char* mapname) {
@@ -2758,12 +2746,12 @@ int map_delmap(char* mapname) {
char map_name[MAP_NAME_LENGTH];
if (strcmpi(mapname, "all") == 0) {
- iMap->map_num = 0;
+ map->map_num = 0;
return 0;
}
mapindex_getmapname(mapname, map_name);
- for(i = 0; i < iMap->map_num; i++) {
+ for(i = 0; i < map->map_num; i++) {
if (strcmp(maplist[i].name, map_name) == 0) {
map_delmapid(i);
return 1;
@@ -2845,7 +2833,7 @@ void map_clean(int i) {
if(battle_config.dynamic_mobs) { //Dynamic mobs flag by [random]
int j;
if(maplist[i].mob_delete_timer != INVALID_TIMER)
- timer->delete(maplist[i].mob_delete_timer, iMap->removemobs_timer);
+ timer->delete(maplist[i].mob_delete_timer, map->removemobs_timer);
for (j=0; j<MAX_MOB_LIST_PER_MAP; j++)
if (maplist[i].moblist[j]) aFree(maplist[i].moblist[j]);
}
@@ -2889,7 +2877,7 @@ void map_clean(int i) {
void do_final_maps(void) {
int i, v = 0;
- for( i = 0; i < iMap->map_num; i++ ) {
+ for( i = 0; i < map->map_num; i++ ) {
if(maplist[i].cell && maplist[i].cell != (struct mapcell *)0xdeadbeaf ) aFree(maplist[i].cell);
if(maplist[i].block) aFree(maplist[i].block);
@@ -2898,7 +2886,7 @@ void do_final_maps(void) {
if(battle_config.dynamic_mobs) { //Dynamic mobs flag by [random]
int j;
if(maplist[i].mob_delete_timer != INVALID_TIMER)
- timer->delete(maplist[i].mob_delete_timer, iMap->removemobs_timer);
+ timer->delete(maplist[i].mob_delete_timer, map->removemobs_timer);
for (j=0; j<MAX_MOB_LIST_PER_MAP; j++)
if (maplist[i].moblist[j]) aFree(maplist[i].moblist[j]);
}
@@ -2953,7 +2941,7 @@ void do_final_maps(void) {
void map_flags_init(void) {
int i, v = 0;
- for( i = 0; i < iMap->map_num; i++ ) {
+ for( i = 0; i < map->map_num; i++ ) {
// mapflags
memset(&maplist[i].flag, 0, sizeof(maplist[i].flag));
@@ -3109,7 +3097,7 @@ int map_readallmaps (void) {
ShowStatus("Loading maps (using GRF files)...\n");
else {
char mapcachefilepath[254];
- sprintf(mapcachefilepath,"%s/%s%s",iMap->db_path,DBPATH,"map_cache.dat");
+ sprintf(mapcachefilepath,"%s/%s%s",map->db_path,DBPATH,"map_cache.dat");
ShowStatus("Loading maps (using %s as map cache)...\n", mapcachefilepath);
if( (fp = fopen(mapcachefilepath, "rb")) == NULL ) {
ShowFatalError("Unable to open map cache file "CL_WHITE"%s"CL_RESET"\n", mapcachefilepath);
@@ -3124,12 +3112,12 @@ int map_readallmaps (void) {
}
}
- for(i = 0; i < iMap->map_num; i++) {
+ for(i = 0; i < map->map_num; i++) {
size_t size;
// show progress
if(enable_grf)
- ShowStatus("Loading maps [%i/%i]: %s"CL_CLL"\r", i, iMap->map_num, maplist[i].name);
+ ShowStatus("Loading maps [%i/%i]: %s"CL_CLL"\r", i, map->map_num, maplist[i].name);
// try to load the map
if( !
@@ -3158,7 +3146,7 @@ int map_readallmaps (void) {
}
maplist[i].m = i;
- iMap->addmap2db(&maplist[i]);
+ map->addmap2db(&maplist[i]);
memset(maplist[i].moblist, 0, sizeof(maplist[i].moblist)); //Initialize moblist [Skotlex]
maplist[i].mob_delete_timer = INVALID_TIMER; //Initialize timer [Skotlex]
@@ -3175,15 +3163,15 @@ int map_readallmaps (void) {
}
// intialization and configuration-dependent adjustments of mapflags
- iMap->flags_init();
+ map->flags_init();
if( !enable_grf ) {
fclose(fp);
}
// finished map loading
- ShowInfo("Successfully loaded '"CL_WHITE"%d"CL_RESET"' maps."CL_CLL"\n",iMap->map_num);
- instance->start_id = iMap->map_num; // Next Map Index will be instances
+ ShowInfo("Successfully loaded '"CL_WHITE"%d"CL_RESET"' maps."CL_CLL"\n",map->map_num);
+ instance->start_id = map->map_num; // Next Map Index will be instances
if (maps_removed)
ShowNotice("Maps removed: '"CL_WHITE"%d"CL_RESET"'\n",maps_removed);
@@ -3248,35 +3236,35 @@ int map_config_read(char *cfgName) {
clif->setport(atoi(w2));
map_port = (atoi(w2));
} else if (strcmpi(w1, "map") == 0)
- iMap->map_num++;
+ map->map_num++;
else if (strcmpi(w1, "delmap") == 0)
- iMap->map_num--;
+ map->map_num--;
else if (strcmpi(w1, "npc") == 0)
npc->addsrcfile(w2);
else if (strcmpi(w1, "delnpc") == 0)
npc->delsrcfile(w2);
else if (strcmpi(w1, "autosave_time") == 0) {
- iMap->autosave_interval = atoi(w2);
- if (iMap->autosave_interval < 1) //Revert to default saving.
- iMap->autosave_interval = DEFAULT_AUTOSAVE_INTERVAL;
+ map->autosave_interval = atoi(w2);
+ if (map->autosave_interval < 1) //Revert to default saving.
+ map->autosave_interval = DEFAULT_AUTOSAVE_INTERVAL;
else
- iMap->autosave_interval *= 1000; //Pass from sec to ms
+ map->autosave_interval *= 1000; //Pass from sec to ms
} else if (strcmpi(w1, "minsave_time") == 0) {
- iMap->minsave_interval= atoi(w2);
- if (iMap->minsave_interval < 1)
- iMap->minsave_interval = 1;
+ map->minsave_interval= atoi(w2);
+ if (map->minsave_interval < 1)
+ map->minsave_interval = 1;
} else if (strcmpi(w1, "save_settings") == 0)
- iMap->save_settings = atoi(w2);
+ map->save_settings = atoi(w2);
else if (strcmpi(w1, "help_txt") == 0)
- strcpy(iMap->help_txt, w2);
+ strcpy(map->help_txt, w2);
else if (strcmpi(w1, "help2_txt") == 0)
- strcpy(iMap->help2_txt, w2);
+ strcpy(map->help2_txt, w2);
else if (strcmpi(w1, "charhelp_txt") == 0)
- strcpy(iMap->charhelp_txt, w2);
+ strcpy(map->charhelp_txt, w2);
else if(strcmpi(w1,"db_path") == 0)
- safestrncpy(iMap->db_path,w2,255);
+ safestrncpy(map->db_path,w2,255);
else if (strcmpi(w1, "enable_spy") == 0)
- iMap->enable_spy = config_switch(w2);
+ map->enable_spy = config_switch(w2);
else if (strcmpi(w1, "use_grf") == 0)
enable_grf = config_switch(w2);
else if (strcmpi(w1, "console_msg_log") == 0)
@@ -3319,7 +3307,7 @@ int map_config_read_sub(char *cfgName) {
if (strcmpi(w1, "map") == 0)
map_addmap(w2);
else if (strcmpi(w1, "delmap") == 0)
- iMap->delmap(w2);
+ map->delmap(w2);
else if (strcmpi(w1, "import") == 0)
map_config_read_sub(w2);
}
@@ -3395,21 +3383,21 @@ int inter_config_read(char *cfgName) {
continue;
/* table names */
if(strcmpi(w1,"item_db_db")==0)
- strcpy(iMap->item_db_db,w2);
+ strcpy(map->item_db_db,w2);
else if(strcmpi(w1,"mob_db_db")==0)
- strcpy(iMap->mob_db_db,w2);
+ strcpy(map->mob_db_db,w2);
else if(strcmpi(w1,"item_db2_db")==0)
- strcpy(iMap->item_db2_db,w2);
+ strcpy(map->item_db2_db,w2);
else if(strcmpi(w1,"item_db_re_db")==0)
- strcpy(iMap->item_db_re_db,w2);
+ strcpy(map->item_db_re_db,w2);
else if(strcmpi(w1,"mob_db2_db")==0)
- strcpy(iMap->mob_db2_db,w2);
+ strcpy(map->mob_db2_db,w2);
else if(strcmpi(w1,"mob_skill_db_db")==0)
- strcpy(iMap->mob_skill_db_db,w2);
+ strcpy(map->mob_skill_db_db,w2);
else if(strcmpi(w1,"mob_skill_db2_db")==0)
- strcpy(iMap->mob_skill_db2_db,w2);
+ strcpy(map->mob_skill_db2_db,w2);
else if(strcmpi(w1,"interreg_db")==0)
- strcpy(iMap->interreg_db,w2);
+ strcpy(map->interreg_db,w2);
/* map sql stuff */
else if(strcmpi(w1,"map_server_ip")==0)
strcpy(map_server_ip, w2);
@@ -3424,15 +3412,15 @@ int inter_config_read(char *cfgName) {
else if(strcmpi(w1,"default_codepage")==0)
strcpy(default_codepage, w2);
else if(strcmpi(w1,"use_sql_item_db")==0) {
- iMap->db_use_sql_item_db = config_switch(w2);
+ map->db_use_sql_item_db = config_switch(w2);
ShowStatus ("Using item database as SQL: '%s'\n", w2);
}
else if(strcmpi(w1,"use_sql_mob_db")==0) {
- iMap->db_use_sql_mob_db = config_switch(w2);
+ map->db_use_sql_mob_db = config_switch(w2);
ShowStatus ("Using monster database as SQL: '%s'\n", w2);
}
else if(strcmpi(w1,"use_sql_mob_skill_db")==0) {
- iMap->db_use_sql_mob_skill_db = config_switch(w2);
+ map->db_use_sql_mob_skill_db = config_switch(w2);
ShowStatus ("Using monster skill database as SQL: '%s'\n", w2);
}
/* sql log db */
@@ -3512,17 +3500,17 @@ void map_zone_change2(int m, struct map_zone_data *zone) {
maplist[m].prev_zone = maplist[m].zone;
if( maplist[m].zone_mf_count )
- iMap->zone_remove(m);
+ map->zone_remove(m);
- iMap->zone_apply(m,zone,empty,empty,empty);
+ map->zone_apply(m,zone,empty,empty,empty);
}
/* when changing from a mapflag to another during runtime */
void map_zone_change(int m, struct map_zone_data *zone, const char* start, const char* buffer, const char* filepath) {
maplist[m].prev_zone = maplist[m].zone;
if( maplist[m].zone_mf_count )
- iMap->zone_remove(m);
- iMap->zone_apply(m,zone,start,buffer,filepath);
+ map->zone_remove(m);
+ map->zone_apply(m,zone,start,buffer,filepath);
}
/* removes previous mapflags from this map */
void map_zone_remove(int m) {
@@ -4289,7 +4277,7 @@ void map_zone_init(void) {
}
}
- for(j = 0; j < iMap->map_num; j++) {
+ for(j = 0; j < map->map_num; j++) {
if( maplist[j].zone == zone ) {
if( map_zone_mf_cache(j,flag,params) )
break;
@@ -4311,7 +4299,7 @@ void map_zone_init(void) {
break;
}
}
- for(j = 0; j < iMap->map_num; j++) {
+ for(j = 0; j < map->map_num; j++) {
if( maplist[j].zone == zone ) {
if( map_zone_mf_cache(j,flag,params) )
break;
@@ -4844,7 +4832,7 @@ int cleanup_sub(struct block_list *bl, va_list ap) {
switch(bl->type) {
case BL_PC:
- iMap->quit((struct map_session_data *) bl);
+ map->quit((struct map_session_data *) bl);
break;
case BL_NPC:
npc->unload((struct npc_data *)bl,false);
@@ -4856,7 +4844,7 @@ int cleanup_sub(struct block_list *bl, va_list ap) {
//There is no need for this, the pet is removed together with the player. [Skotlex]
break;
case BL_ITEM:
- iMap->clearflooritem(bl);
+ map->clearflooritem(bl);
break;
case BL_SKILL:
skill->delunit((struct skill_unit *) bl);
@@ -4869,9 +4857,8 @@ int cleanup_sub(struct block_list *bl, va_list ap) {
/**
* @see DBApply
*/
-static int cleanup_db_sub(DBKey key, DBData *data, va_list va)
-{
- return iMap->cleanup_sub(DB->data2ptr(data), va);
+static int cleanup_db_sub(DBKey key, DBData *data, va_list va) {
+ return map->cleanup_sub(DB->data2ptr(data), va);
}
/*==========================================
@@ -4891,19 +4878,19 @@ void do_final(void)
//Ladies and babies first.
iter = mapit_getallusers();
for( sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); sd = (TBL_PC*)mapit->next(iter) )
- iMap->quit(sd);
+ map->quit(sd);
mapit->free(iter);
/* prepares npcs for a faster shutdown process */
npc->do_clear_npc();
// remove all objects on maps
- for (i = 0; i < iMap->map_num; i++) {
- ShowStatus("Cleaning up maps [%d/%d]: %s..."CL_CLL"\r", i+1, iMap->map_num, maplist[i].name);
+ for (i = 0; i < map->map_num; i++) {
+ ShowStatus("Cleaning up maps [%d/%d]: %s..."CL_CLL"\r", i+1, map->map_num, maplist[i].name);
if (maplist[i].m >= 0)
- map_foreachinmap(iMap->cleanup_sub, i, BL_ALL);
+ map_foreachinmap(map->cleanup_sub, i, BL_ALL);
}
- ShowStatus("Cleaned up %d maps."CL_CLL"\n", iMap->map_num);
+ ShowStatus("Cleaned up %d maps."CL_CLL"\n", map->map_num);
id_db->foreach(id_db,cleanup_db_sub);
chrif->char_reset_offline();
@@ -4988,7 +4975,7 @@ void do_abort(void)
return;
}
ShowError("Server received crash signal! Attempting to save all online characters!\n");
- iMap->map_foreachpc(map_abort_sub);
+ map->map_foreachpc(map_abort_sub);
chrif->flush_fifo();
}
@@ -5072,7 +5059,7 @@ CPCMD(gm_position) {
return;
}
- if ( (m = iMap->mapname2mapid(map_name) <= 0 ) ) {
+ if ( (m = map->mapname2mapid(map_name) <= 0 ) ) {
ShowError("gm:info '"CL_WHITE"%s"CL_RESET"' is not a known map\n",map_name);
return;
}
@@ -5109,7 +5096,7 @@ void map_cp_defaults(void) {
strcpy(cpsd->status.name, "Hercules Console");
cpsd->bl.x = MAP_DEFAULT_X;
cpsd->bl.y = MAP_DEFAULT_Y;
- cpsd->bl.m = iMap->mapname2mapid(MAP_DEFAULT);
+ cpsd->bl.m = map->mapname2mapid(MAP_DEFAULT);
console->addCommand("gm:info",CPCMD_A(gm_position));
console->addCommand("gm:use",CPCMD_A(gm_use));
@@ -5127,7 +5114,7 @@ void map_hp_symbols(void) {
HPM->share(guild,"guild");
HPM->share(gstorage,"gstorage");
HPM->share(homun,"homun");
- HPM->share(iMap,"iMap");
+ HPM->share(map,"map");
HPM->share(ircbot,"ircbot");
HPM->share(itemdb,"itemdb");
HPM->share(logs,"logs");
@@ -5220,44 +5207,44 @@ int do_init(int argc, char *argv[])
map_defaults();
- iMap->map_num = 0;
-
- sprintf(iMap->db_path ,"db");
- sprintf(iMap->help_txt ,"conf/help.txt");
- sprintf(iMap->help2_txt ,"conf/help2.txt");
- sprintf(iMap->charhelp_txt ,"conf/charhelp.txt");
-
- sprintf(iMap->wisp_server_name ,"Server"); // can be modified in char-server configuration file
-
- iMap->autosave_interval = DEFAULT_AUTOSAVE_INTERVAL;
- iMap->minsave_interval = 100;
- iMap->save_settings = 0xFFFF;
- iMap->agit_flag = 0;
- iMap->agit2_flag = 0;
- iMap->night_flag = 0; // 0=day, 1=night [Yor]
- iMap->enable_spy = 0; //To enable/disable @spy commands, which consume too much cpu time when sending packets. [Skotlex]
-
- iMap->db_use_sql_item_db = 0;
- iMap->db_use_sql_mob_db = 0;
- iMap->db_use_sql_mob_skill_db = 0;
-
- sprintf(iMap->item_db_db, "item_db");
- sprintf(iMap->item_db2_db, "item_db2");
- sprintf(iMap->item_db_re_db, "item_db_re");
- sprintf(iMap->mob_db_db, "mob_db");
- sprintf(iMap->mob_db2_db, "mob_db2");
- sprintf(iMap->mob_skill_db_db, "mob_skill_db");
- sprintf(iMap->mob_skill_db2_db, "mob_skill_db2");
- sprintf(iMap->interreg_db, "interreg");
-
- iMap->INTER_CONF_NAME="conf/inter-server.conf";
- iMap->LOG_CONF_NAME="conf/logs.conf";
- iMap->MAP_CONF_NAME = "conf/map-server.conf";
- iMap->BATTLE_CONF_FILENAME = "conf/battle.conf";
- iMap->ATCOMMAND_CONF_FILENAME = "conf/atcommand.conf";
- iMap->SCRIPT_CONF_NAME = "conf/script.conf";
- iMap->MSG_CONF_NAME = "conf/messages.conf";
- iMap->GRF_PATH_FILENAME = "conf/grf-files.txt";
+ map->map_num = 0;
+
+ sprintf(map->db_path ,"db");
+ sprintf(map->help_txt ,"conf/help.txt");
+ sprintf(map->help2_txt ,"conf/help2.txt");
+ sprintf(map->charhelp_txt ,"conf/charhelp.txt");
+
+ sprintf(map->wisp_server_name ,"Server"); // can be modified in char-server configuration file
+
+ map->autosave_interval = DEFAULT_AUTOSAVE_INTERVAL;
+ map->minsave_interval = 100;
+ map->save_settings = 0xFFFF;
+ map->agit_flag = 0;
+ map->agit2_flag = 0;
+ map->night_flag = 0; // 0=day, 1=night [Yor]
+ map->enable_spy = 0; //To enable/disable @spy commands, which consume too much cpu time when sending packets. [Skotlex]
+
+ map->db_use_sql_item_db = 0;
+ map->db_use_sql_mob_db = 0;
+ map->db_use_sql_mob_skill_db = 0;
+
+ sprintf(map->item_db_db, "item_db");
+ sprintf(map->item_db2_db, "item_db2");
+ sprintf(map->item_db_re_db, "item_db_re");
+ sprintf(map->mob_db_db, "mob_db");
+ sprintf(map->mob_db2_db, "mob_db2");
+ sprintf(map->mob_skill_db_db, "mob_skill_db");
+ sprintf(map->mob_skill_db2_db, "mob_skill_db2");
+ sprintf(map->interreg_db, "interreg");
+
+ map->INTER_CONF_NAME="conf/inter-server.conf";
+ map->LOG_CONF_NAME="conf/logs.conf";
+ map->MAP_CONF_NAME = "conf/map-server.conf";
+ map->BATTLE_CONF_FILENAME = "conf/battle.conf";
+ map->ATCOMMAND_CONF_FILENAME = "conf/atcommand.conf";
+ map->SCRIPT_CONF_NAME = "conf/script.conf";
+ map->MSG_CONF_NAME = "conf/messages.conf";
+ map->GRF_PATH_FILENAME = "conf/grf-files.txt";
rnd_init();
for( i = 1; i < argc ; i++ ) {
@@ -5275,28 +5262,28 @@ int do_init(int argc, char *argv[])
map_versionscreen(true);
} else if( strcmp(arg, "map-config") == 0 ) {
if( map_arg_next_value(arg, i, argc) )
- iMap->MAP_CONF_NAME = argv[++i];
+ map->MAP_CONF_NAME = argv[++i];
} else if( strcmp(arg, "battle-config") == 0 ) {
if( map_arg_next_value(arg, i, argc) )
- iMap->BATTLE_CONF_FILENAME = argv[++i];
+ map->BATTLE_CONF_FILENAME = argv[++i];
} else if( strcmp(arg, "atcommand-config") == 0 ) {
if( map_arg_next_value(arg, i, argc) )
- iMap->ATCOMMAND_CONF_FILENAME = argv[++i];
+ map->ATCOMMAND_CONF_FILENAME = argv[++i];
} else if( strcmp(arg, "script-config") == 0 ) {
if( map_arg_next_value(arg, i, argc) )
- iMap->SCRIPT_CONF_NAME = argv[++i];
+ map->SCRIPT_CONF_NAME = argv[++i];
} else if( strcmp(arg, "msg-config") == 0 ) {
if( map_arg_next_value(arg, i, argc) )
- iMap->MSG_CONF_NAME = argv[++i];
+ map->MSG_CONF_NAME = argv[++i];
} else if( strcmp(arg, "grf-path-file") == 0 ) {
if( map_arg_next_value(arg, i, argc) )
- iMap->GRF_PATH_FILENAME = argv[++i];
+ map->GRF_PATH_FILENAME = argv[++i];
} else if( strcmp(arg, "inter-config") == 0 ) {
if( map_arg_next_value(arg, i, argc) )
- iMap->INTER_CONF_NAME = argv[++i];
+ map->INTER_CONF_NAME = argv[++i];
} else if( strcmp(arg, "log-config") == 0 ) {
if( map_arg_next_value(arg, i, argc) )
- iMap->LOG_CONF_NAME = argv[++i];
+ map->LOG_CONF_NAME = argv[++i];
} else if( strcmp(arg, "run-once") == 0 ) { // close the map-server as soon as its done.. for testing [Celest]
runflag = CORE_ST_STOP;
} else {
@@ -5319,12 +5306,12 @@ int do_init(int argc, char *argv[])
memset(&index2mapid, -1, sizeof(index2mapid));
map_load_defaults();
- map_config_read(iMap->MAP_CONF_NAME);
- CREATE(maplist,struct map_data,iMap->map_num);
- iMap->map_num = 0;
- map_config_read_sub(iMap->MAP_CONF_NAME);
+ map_config_read(map->MAP_CONF_NAME);
+ CREATE(maplist,struct map_data,map->map_num);
+ map->map_num = 0;
+ map_config_read_sub(map->MAP_CONF_NAME);
// loads npcs
- iMap->reloadnpc(false);
+ map->reloadnpc(false);
chrif->checkdefaultlogin();
@@ -5347,14 +5334,14 @@ int do_init(int argc, char *argv[])
chrif->setip(ip_str);
}
- battle->config_read(iMap->BATTLE_CONF_FILENAME);
- atcommand->msg_read(iMap->MSG_CONF_NAME);
- script->config_read(iMap->SCRIPT_CONF_NAME);
- inter_config_read(iMap->INTER_CONF_NAME);
- logs->config_read(iMap->LOG_CONF_NAME);
+ battle->config_read(map->BATTLE_CONF_FILENAME);
+ atcommand->msg_read(map->MSG_CONF_NAME);
+ script->config_read(map->SCRIPT_CONF_NAME);
+ inter_config_read(map->INTER_CONF_NAME);
+ logs->config_read(map->LOG_CONF_NAME);
id_db = idb_alloc(DB_OPT_BASE);
- pc_db = idb_alloc(DB_OPT_BASE); //Added for reliable iMap->id2sd() use. [Skotlex]
+ pc_db = idb_alloc(DB_OPT_BASE); //Added for reliable map->id2sd() use. [Skotlex]
mobid_db = idb_alloc(DB_OPT_BASE); //Added to lower the load of the lazy mob ai. [Skotlex]
bossid_db = idb_alloc(DB_OPT_BASE); // Used for Convex Mirror quick MVP search
map_db = uidb_alloc(DB_OPT_BASE);
@@ -5373,7 +5360,7 @@ int do_init(int argc, char *argv[])
mapindex_init();
if(enable_grf)
- grfio_init(iMap->GRF_PATH_FILENAME);
+ grfio_init(map->GRF_PATH_FILENAME);
map_readallmaps();
@@ -5428,7 +5415,7 @@ int do_init(int argc, char *argv[])
ShowStatus("Server is '"CL_GREEN"ready"CL_RESET"' and listening on port '"CL_WHITE"%d"CL_RESET"'.\n\n", map_port);
if( runflag != CORE_ST_STOP ) {
- shutdown_callback = iMap->do_shutdown;
+ shutdown_callback = map->do_shutdown;
runflag = MAPSERVER_ST_RUNNING;
}
@@ -5445,114 +5432,114 @@ int do_init(int argc, char *argv[])
* created by Susu
*-------------------------------------*/
void map_defaults(void) {
- iMap = &iMap_s;
+ map = &map_s;
/* funcs */
- iMap->zone_init = map_zone_init;
- iMap->zone_remove = map_zone_remove;
- iMap->zone_apply = map_zone_apply;
- iMap->zone_change = map_zone_change;
- iMap->zone_change2 = map_zone_change2;
+ map->zone_init = map_zone_init;
+ map->zone_remove = map_zone_remove;
+ map->zone_apply = map_zone_apply;
+ map->zone_change = map_zone_change;
+ map->zone_change2 = map_zone_change2;
- iMap->getcell = map_getcell;
- iMap->setgatcell = map_setgatcell;
+ map->getcell = map_getcell;
+ map->setgatcell = map_setgatcell;
- iMap->cellfromcache = map_cellfromcache;
+ map->cellfromcache = map_cellfromcache;
// users
- iMap->setusers = map_setusers;
- iMap->getusers = map_getusers;
- iMap->usercount = map_usercount;
+ map->setusers = map_setusers;
+ map->getusers = map_getusers;
+ map->usercount = map_usercount;
// blocklist lock
- iMap->freeblock = map_freeblock;
- iMap->freeblock_lock = map_freeblock_lock;
- iMap->freeblock_unlock = map_freeblock_unlock;
+ map->freeblock = map_freeblock;
+ map->freeblock_lock = map_freeblock_lock;
+ map->freeblock_unlock = map_freeblock_unlock;
// blocklist manipulation
- iMap->addblock = map_addblock;
- iMap->delblock = map_delblock;
- iMap->moveblock = map_moveblock;
+ map->addblock = map_addblock;
+ map->delblock = map_delblock;
+ map->moveblock = map_moveblock;
//blocklist nb in one cell
- iMap->count_oncell = map_count_oncell;
- iMap->find_skill_unit_oncell = map_find_skill_unit_oncell;
+ map->count_oncell = map_count_oncell;
+ map->find_skill_unit_oncell = map_find_skill_unit_oncell;
// search and creation
- iMap->get_new_object_id = map_get_new_object_id;
- iMap->search_freecell = map_search_freecell;
+ map->get_new_object_id = map_get_new_object_id;
+ map->search_freecell = map_search_freecell;
//
- iMap->quit = map_quit;
+ map->quit = map_quit;
// npc
- iMap->addnpc = map_addnpc;
+ map->addnpc = map_addnpc;
// map item
- iMap->clearflooritem_timer = map_clearflooritem_timer;
- iMap->removemobs_timer = map_removemobs_timer;
- iMap->clearflooritem = map_clearflooritem;
- iMap->addflooritem = map_addflooritem;
+ map->clearflooritem_timer = map_clearflooritem_timer;
+ map->removemobs_timer = map_removemobs_timer;
+ map->clearflooritem = map_clearflooritem;
+ map->addflooritem = map_addflooritem;
// player to map session
- iMap->addnickdb = map_addnickdb;
- iMap->delnickdb = map_delnickdb;
- iMap->reqnickdb = map_reqnickdb;
- iMap->charid2nick = map_charid2nick;
- iMap->charid2sd = map_charid2sd;
-
- iMap->map_foreachpc = map_map_foreachpc;
- iMap->map_foreachmob = map_map_foreachmob;
- iMap->map_foreachnpc = map_map_foreachnpc;
- iMap->map_foreachregen = map_map_foreachregen;
- iMap->map_foreachiddb = map_map_foreachiddb;
-
- iMap->foreachinrange = map_foreachinrange;
- iMap->foreachinshootrange = map_foreachinshootrange;
- iMap->foreachinarea = map_foreachinarea;
- iMap->forcountinrange = map_forcountinrange;
- iMap->forcountinarea = map_forcountinarea;
- iMap->foreachinmovearea = map_foreachinmovearea;
- iMap->foreachincell = map_foreachincell;
- iMap->foreachinpath = map_foreachinpath;
- iMap->foreachinmap = map_foreachinmap;
- iMap->foreachininstance = map_foreachininstance;
-
- iMap->id2sd = map_id2sd;
- iMap->id2md = map_id2md;
- iMap->id2nd = map_id2nd;
- iMap->id2hd = map_id2hd;
- iMap->id2mc = map_id2mc;
- iMap->id2cd = map_id2cd;
- iMap->id2bl = map_id2bl;
- iMap->blid_exists = map_blid_exists;
- iMap->mapindex2mapid = map_mapindex2mapid;
- iMap->mapname2mapid = map_mapname2mapid;
- iMap->mapname2ipport = map_mapname2ipport;
- iMap->setipport = map_setipport;
- iMap->eraseipport = map_eraseipport;
- iMap->eraseallipport = map_eraseallipport;
- iMap->addiddb = map_addiddb;
- iMap->deliddb = map_deliddb;
+ map->addnickdb = map_addnickdb;
+ map->delnickdb = map_delnickdb;
+ map->reqnickdb = map_reqnickdb;
+ map->charid2nick = map_charid2nick;
+ map->charid2sd = map_charid2sd;
+
+ map->map_foreachpc = map_map_foreachpc;
+ map->map_foreachmob = map_map_foreachmob;
+ map->map_foreachnpc = map_map_foreachnpc;
+ map->map_foreachregen = map_map_foreachregen;
+ map->map_foreachiddb = map_map_foreachiddb;
+
+ map->foreachinrange = map_foreachinrange;
+ map->foreachinshootrange = map_foreachinshootrange;
+ map->foreachinarea = map_foreachinarea;
+ map->forcountinrange = map_forcountinrange;
+ map->forcountinarea = map_forcountinarea;
+ map->foreachinmovearea = map_foreachinmovearea;
+ map->foreachincell = map_foreachincell;
+ map->foreachinpath = map_foreachinpath;
+ map->foreachinmap = map_foreachinmap;
+ map->foreachininstance = map_foreachininstance;
+
+ map->id2sd = map_id2sd;
+ map->id2md = map_id2md;
+ map->id2nd = map_id2nd;
+ map->id2hd = map_id2hd;
+ map->id2mc = map_id2mc;
+ map->id2cd = map_id2cd;
+ map->id2bl = map_id2bl;
+ map->blid_exists = map_blid_exists;
+ map->mapindex2mapid = map_mapindex2mapid;
+ map->mapname2mapid = map_mapname2mapid;
+ map->mapname2ipport = map_mapname2ipport;
+ map->setipport = map_setipport;
+ map->eraseipport = map_eraseipport;
+ map->eraseallipport = map_eraseallipport;
+ map->addiddb = map_addiddb;
+ map->deliddb = map_deliddb;
/* */
- iMap->nick2sd = map_nick2sd;
- iMap->getmob_boss = map_getmob_boss;
- iMap->id2boss = map_id2boss;
+ map->nick2sd = map_nick2sd;
+ map->getmob_boss = map_getmob_boss;
+ map->id2boss = map_id2boss;
// reload config file looking only for npcs
- iMap->reloadnpc = map_reloadnpc;
+ map->reloadnpc = map_reloadnpc;
- iMap->check_dir = map_check_dir;
- iMap->calc_dir = map_calc_dir;
- iMap->random_dir = map_random_dir; // [Skotlex]
+ map->check_dir = map_check_dir;
+ map->calc_dir = map_calc_dir;
+ map->random_dir = map_random_dir; // [Skotlex]
- iMap->cleanup_sub = cleanup_sub;
+ map->cleanup_sub = cleanup_sub;
- iMap->delmap = map_delmap;
- iMap->flags_init = map_flags_init;
+ map->delmap = map_delmap;
+ map->flags_init = map_flags_init;
- iMap->iwall_set = map_iwall_set;
- iMap->iwall_get = map_iwall_get;
- iMap->iwall_remove = map_iwall_remove;
+ map->iwall_set = map_iwall_set;
+ map->iwall_get = map_iwall_get;
+ map->iwall_remove = map_iwall_remove;
- iMap->addmobtolist = map_addmobtolist; // [Wizputer]
- iMap->spawnmobs = map_spawnmobs; // [Wizputer]
- iMap->removemobs = map_removemobs; // [Wizputer]
- iMap->addmap2db = map_addmap2db;
- iMap->removemapdb = map_removemapdb;
- iMap->clean = map_clean;
+ map->addmobtolist = map_addmobtolist; // [Wizputer]
+ map->spawnmobs = map_spawnmobs; // [Wizputer]
+ map->removemobs = map_removemobs; // [Wizputer]
+ map->addmap2db = map_addmap2db;
+ map->removemapdb = map_removemapdb;
+ map->clean = map_clean;
- iMap->do_shutdown = do_shutdown;
+ map->do_shutdown = do_shutdown;
/* FIXME: temporary until the map.c "Hercules Renewal Phase One" design is complete. [Ind] */
mapit = &mapit_s;
diff --git a/src/map/map.h b/src/map/map.h
index 963234ff3..4b06a065b 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -214,10 +214,10 @@ enum {
#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) (maplist[m].flag.pvp || maplist[m].flag.gvg_dungeon || maplist[m].flag.gvg || ((iMap->agit_flag || iMap->agit2_flag) && maplist[m].flag.gvg_castle) || maplist[m].flag.battleground)
+#define map_flag_vs(m) (maplist[m].flag.pvp || maplist[m].flag.gvg_dungeon || maplist[m].flag.gvg || ((map->agit_flag || map->agit2_flag) && maplist[m].flag.gvg_castle) || maplist[m].flag.battleground)
// Specifies maps that have special GvG/WoE restrictions
-#define map_flag_gvg(m) (maplist[m].flag.gvg || ((iMap->agit_flag || iMap->agit2_flag) && maplist[m].flag.gvg_castle))
-// Specifies if the map is tagged as GvG/WoE (regardless of iMap->agit_flag status)
+#define map_flag_gvg(m) (maplist[m].flag.gvg || ((map->agit_flag || map->agit2_flag) && maplist[m].flag.gvg_castle))
+// Specifies if the map is tagged as GvG/WoE (regardless of map->agit_flag status)
#define map_flag_gvg2(m) (maplist[m].flag.gvg || maplist[m].flag.gvg_castle)
// No Kill Steal Protection
#define map_flag_ks(m) (maplist[m].flag.town || maplist[m].flag.pvp || maplist[m].flag.gvg || maplist[m].flag.battleground)
@@ -432,7 +432,7 @@ typedef enum {
} cell_t;
-// used by iMap->getcell()
+// used by map->getcell()
typedef enum {
CELL_GETTYPE, // retrieves a cell's 'gat' type
@@ -524,7 +524,7 @@ struct map_zone_skill_damage_cap_entry {
#define MAP_ZONE_PK_NAME "PK Mode"
#define MAP_ZONE_MAPFLAG_LENGTH 50
-//TODO place it in iMap
+//TODO place it in the map interface
DBMap *zone_db;/* string => struct map_zone_data */
struct map_zone_data {
@@ -904,7 +904,7 @@ struct map_interface {
void (*do_shutdown) (void);
};
-struct map_interface *iMap;
+struct map_interface *map;
void map_defaults(void);
diff --git a/src/map/mercenary.c b/src/map/mercenary.c
index 881038eb4..a1e2986b2 100644
--- a/src/map/mercenary.c
+++ b/src/map/mercenary.c
@@ -217,12 +217,11 @@ int mercenary_save(struct mercenary_data *md)
return 1;
}
-static int merc_contract_end(int tid, unsigned int tick, int id, intptr_t data)
-{
+static int merc_contract_end(int tid, unsigned int tick, int id, intptr_t data) {
struct map_session_data *sd;
struct mercenary_data *md;
- if( (sd = iMap->id2sd(id)) == NULL )
+ if( (sd = map->id2sd(id)) == NULL )
return 1;
if( (md = sd->md) == NULL )
return 1;
@@ -281,14 +280,13 @@ void merc_contract_init(struct mercenary_data *md)
md->regen.state.block = 0;
}
-int merc_data_received(struct s_mercenary *merc, bool flag)
-{
+int merc_data_received(struct s_mercenary *merc, bool flag) {
struct map_session_data *sd;
struct mercenary_data *md;
struct s_mercenary_db *db;
int i = merc_search_index(merc->class_);
- if( (sd = iMap->charid2sd(merc->char_id)) == NULL )
+ if( (sd = map->charid2sd(merc->char_id)) == NULL )
return 0;
if( !flag || i < 0 )
{ // Not created - loaded - DB info
@@ -318,7 +316,7 @@ int merc_data_received(struct s_mercenary *merc, bool flag)
md->bl.x = md->ud.to_x;
md->bl.y = md->ud.to_y;
- iMap->addiddb(&md->bl);
+ map->addiddb(&md->bl);
status_calc_mercenary(md,1);
md->contract_timer = INVALID_TIMER;
merc_contract_init(md);
@@ -333,9 +331,8 @@ int merc_data_received(struct s_mercenary *merc, bool flag)
mercenary->set_calls(md, 1);
sd->status.mer_id = merc->mercenary_id;
- if( md && md->bl.prev == NULL && sd->bl.prev != NULL )
- {
- iMap->addblock(&md->bl);
+ if( md && md->bl.prev == NULL && sd->bl.prev != NULL ) {
+ map->addblock(&md->bl);
clif->spawn(&md->bl);
clif->mercenary_info(sd);
clif->mercenary_skillblock(sd);
@@ -451,7 +448,7 @@ static bool read_mercenarydb_sub(char* str[], int columns, int current) {
int read_mercenarydb(void) {
memset(mercenary->db,0,sizeof(mercenary->db));
- sv->readdb(iMap->db_path, "mercenary_db.txt", ',', 26, 26, MAX_MERCENARY_CLASS, &read_mercenarydb_sub);
+ sv->readdb(map->db_path, "mercenary_db.txt", ',', 26, 26, MAX_MERCENARY_CLASS, &read_mercenarydb_sub);
return 0;
}
@@ -487,9 +484,8 @@ static bool read_mercenary_skilldb_sub(char* str[], int columns, int current)
return true;
}
-int read_mercenary_skilldb(void)
-{
- sv->readdb(iMap->db_path, "mercenary_skill_db.txt", ',', 3, 3, -1, &read_mercenary_skilldb_sub);
+int read_mercenary_skilldb(void) {
+ sv->readdb(map->db_path, "mercenary_skill_db.txt", ',', 3, 3, -1, &read_mercenary_skilldb_sub);
return 0;
}
diff --git a/src/map/mob.c b/src/map/mob.c
index ff949a3ff..b41f7488f 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -154,8 +154,8 @@ void mvptomb_create(struct mob_data *md, char *killer, time_t time)
else
nd->u.tomb.killer_name[0] = '\0';
- iMap->addnpc(nd->bl.m, nd);
- iMap->addblock(&nd->bl);
+ map->addnpc(nd->bl.m, nd);
+ map->addblock(&nd->bl);
status->set_viewdata(&nd->bl, nd->class_);
clif->spawn(&nd->bl);
@@ -164,14 +164,14 @@ void mvptomb_create(struct mob_data *md, char *killer, time_t time)
void mvptomb_destroy(struct mob_data *md) {
struct npc_data *nd;
- if ( (nd = iMap->id2nd(md->tomb_nid)) ) {
+ if ( (nd = map->id2nd(md->tomb_nid)) ) {
int16 m, i;
m = nd->bl.m;
clif->clearunit_area(&nd->bl,CLR_OUTSIGHT);
- iMap->delblock(&nd->bl);
+ map->delblock(&nd->bl);
ARR_FIND( 0, maplist[m].npc_num, i, maplist[m].npc[i] == nd );
if( !(i == maplist[m].npc_num) ) {
@@ -180,7 +180,7 @@ void mvptomb_destroy(struct mob_data *md) {
maplist[m].npc[maplist[m].npc_num] = NULL;
}
- iMap->deliddb(&nd->bl);
+ map->deliddb(&nd->bl);
aFree(nd);
}
@@ -285,7 +285,7 @@ struct mob_data* mob_spawn_dataset(struct spawn_data *data) {
status->change_init(&md->bl);
unit->dataset(&md->bl);
- iMap->addiddb(&md->bl);
+ map->addiddb(&md->bl);
return md;
}
@@ -356,7 +356,7 @@ bool mob_ksprotected (struct block_list *src, struct block_list *target)
if( !(sd = BL_CAST(BL_PC,s_bl)) )
return false; // Master is not PC
- t_bl = iMap->id2bl(md->target_id);
+ t_bl = map->id2bl(md->target_id);
if( !t_bl || (s_bl = battle->get_master(t_bl)) == NULL )
s_bl = t_bl;
@@ -383,7 +383,7 @@ bool mob_ksprotected (struct block_list *src, struct block_list *target)
(sce->val2 == 3 && sce->val4 && sce->val4 != t_sd->status.guild_id)) )
break;
- if( (pl_sd = iMap->id2sd(sce->val1)) == NULL || pl_sd->bl.m != md->bl.m )
+ if( (pl_sd = map->id2sd(sce->val1)) == NULL || pl_sd->bl.m != md->bl.m )
break;
if( !pl_sd->state.noks )
@@ -439,11 +439,11 @@ struct mob_data *mob_once_spawn_sub(struct block_list *bl, int16 m, int16 x, int
// Locate spot next to player.
if (bl && (x < 0 || y < 0))
- iMap->search_freecell(bl, m, &x, &y, 1, 1, 0);
+ map->search_freecell(bl, m, &x, &y, 1, 1, 0);
// if none found, pick random position on map
- if (x <= 0 || y <= 0 || iMap->getcell(m,x,y,CELL_CHKNOREACH))
- iMap->search_freecell(NULL, m, &x, &y, -1, -1, 1);
+ if (x <= 0 || y <= 0 || map->getcell(m,x,y,CELL_CHKNOREACH))
+ map->search_freecell(NULL, m, &x, &y, -1, -1, 1);
data.x = x;
data.y = y;
@@ -535,7 +535,7 @@ int mob_once_spawn_area(struct map_session_data* sd, int16 m, int16 x0, int16 y0
x = rnd()%(x1-x0+1)+x0;
y = rnd()%(y1-y0+1)+y0;
j++;
- } while (iMap->getcell(m,x,y,CELL_CHKNOPASS) && j < max);
+ } while (map->getcell(m,x,y,CELL_CHKNOPASS) && j < max);
if (j == max)
{// attempt to find an available cell failed
@@ -561,7 +561,7 @@ int mob_once_spawn_area(struct map_session_data* sd, int16 m, int16 x0, int16 y0
*------------------------------------------*/
int mob_spawn_guardian_sub(int tid, unsigned int tick, int id, intptr_t data)
{ //Needed because the guild_data may not be available at guardian spawn time.
- struct block_list* bl = iMap->id2bl(id);
+ struct block_list* bl = map->id2bl(id);
struct mob_data* md;
struct guild* g;
int guardup_lv;
@@ -619,7 +619,7 @@ int mob_spawn_guardian(const char* mapname, short x, short y, const char* mobnam
memset(&data, 0, sizeof(struct spawn_data));
data.num = 1;
- m=iMap->mapname2mapid(mapname);
+ m=map->mapname2mapid(mapname);
if(m<0)
{
@@ -642,7 +642,7 @@ int mob_spawn_guardian(const char* mapname, short x, short y, const char* mobnam
return 0;
}
- if((x<=0 || y<=0) && !iMap->search_freecell(NULL, m, &x, &y, -1,-1, 1)) {
+ if((x<=0 || y<=0) && !map->search_freecell(NULL, m, &x, &y, -1,-1, 1)) {
ShowWarning("mob_spawn_guardian: Couldn't locate a spawn cell for guardian class %d (index %d) at castle map %s\n",class_, guardian, maplist[m].name);
return 0;
}
@@ -665,7 +665,7 @@ int mob_spawn_guardian(const char* mapname, short x, short y, const char* mobnam
if( has_index && gc->guardian[guardian].id )
{ //Check if guardian already exists, refuse to spawn if so.
- struct mob_data *md2 = (TBL_MOB*)iMap->id2bl(gc->guardian[guardian].id);
+ struct mob_data *md2 = (TBL_MOB*)map->id2bl(gc->guardian[guardian].id);
if (md2 && md2->bl.type == BL_MOB
&& md2->guardian_data
&& md2->guardian_data->number == guardian
@@ -716,8 +716,7 @@ int mob_spawn_bg(const char* mapname, short x, short y, const char* mobname, int
struct spawn_data data;
int16 m;
- if( (m = iMap->mapname2mapid(mapname)) < 0 )
- {
+ if( (m = map->mapname2mapid(mapname)) < 0 ) {
ShowWarning("mob_spawn_bg: Map [%s] not found.\n", mapname);
return 0;
}
@@ -732,7 +731,7 @@ int mob_spawn_bg(const char* mapname, short x, short y, const char* mobname, int
}
data.class_ = class_;
- if( (x <= 0 || y <= 0) && !iMap->search_freecell(NULL, m, &x, &y, -1,-1, 1) ) {
+ if( (x <= 0 || y <= 0) && !map->search_freecell(NULL, m, &x, &y, -1,-1, 1) ) {
ShowWarning("mob_spawn_bg: Couldn't locate a spawn cell for guardian class %d (bg_id %d) at map %s\n",class_, bg_id, maplist[m].name);
return 0;
}
@@ -810,9 +809,8 @@ int mob_linksearch(struct block_list *bl,va_list ap)
/*==========================================
* mob spawn with delay (timer function)
*------------------------------------------*/
-int mob_delayspawn(int tid, unsigned int tick, int id, intptr_t data)
-{
- struct block_list* bl = iMap->id2bl(id);
+int mob_delayspawn(int tid, unsigned int tick, int id, intptr_t data) {
+ struct block_list* bl = map->id2bl(id);
struct mob_data* md = BL_CAST(BL_MOB, bl);
if( md )
@@ -904,18 +902,17 @@ int mob_spawn (struct mob_data *md)
md->bl.x = md->spawn->x;
md->bl.y = md->spawn->y;
- if( (md->bl.x == 0 && md->bl.y == 0) || md->spawn->xs || md->spawn->ys )
- { //Monster can be spawned on an area.
- if( !iMap->search_freecell(&md->bl, -1, &md->bl.x, &md->bl.y, md->spawn->xs, md->spawn->ys, battle_config.no_spawn_on_player?4:0) )
- { // retry again later
+ if( (md->bl.x == 0 && md->bl.y == 0) || md->spawn->xs || md->spawn->ys ) {
+ //Monster can be spawned on an area.
+ if( !map->search_freecell(&md->bl, -1, &md->bl.x, &md->bl.y, md->spawn->xs, md->spawn->ys, battle_config.no_spawn_on_player?4:0) ) {
+ // retry again later
if( md->spawn_timer != INVALID_TIMER )
timer->delete(md->spawn_timer, mob->delayspawn);
md->spawn_timer = timer->add(tick+5000,mob->delayspawn,md->bl.id,0);
return 1;
}
- }
- else if( battle_config.no_spawn_on_player > 99 && iMap->foreachinrange(mob->count_sub, &md->bl, AREA_SIZE, BL_PC) )
- { // retry again later (players on sight)
+ } else if( battle_config.no_spawn_on_player > 99 && map->foreachinrange(mob->count_sub, &md->bl, AREA_SIZE, BL_PC) ) {
+ // retry again later (players on sight)
if( md->spawn_timer != INVALID_TIMER )
timer->delete(md->spawn_timer, mob->delayspawn);
md->spawn_timer = timer->add(tick+5000,mob->delayspawn,md->bl.id,0);
@@ -965,7 +962,7 @@ int mob_spawn (struct mob_data *md)
if ( md->tomb_nid )
mob->mvptomb_destroy(md);
- iMap->addblock(&md->bl);
+ map->addblock(&md->bl);
if( maplist[md->bl.m].users )
clif->spawn(&md->bl);
skill->unit_move(&md->bl,tick,1);
@@ -1188,11 +1185,10 @@ int mob_warpchase_sub(struct block_list *bl,va_list ap) {
/*==========================================
* Processing of slave monsters
*------------------------------------------*/
-int mob_ai_sub_hard_slavemob(struct mob_data *md,unsigned int tick)
-{
+int mob_ai_sub_hard_slavemob(struct mob_data *md,unsigned int tick) {
struct block_list *bl;
- bl=iMap->id2bl(md->master_id);
+ bl=map->id2bl(md->master_id);
if (!bl || status->isdead(bl)) {
status_kill(&md->bl);
@@ -1223,12 +1219,12 @@ int mob_ai_sub_hard_slavemob(struct mob_data *md,unsigned int tick)
return 0;
// Approach master if within view range, chase back to Master's area also if standing on top of the master.
- if((md->master_dist>MOB_SLAVEDISTANCE || md->master_dist == 0) &&
- unit->can_move(&md->bl))
- {
+ if( (md->master_dist>MOB_SLAVEDISTANCE || md->master_dist == 0)
+ && unit->can_move(&md->bl)
+ ) {
short x = bl->x, y = bl->y;
mob_stop_attack(md);
- if(iMap->search_freecell(&md->bl, bl->m, &x, &y, MOB_SLAVEDISTANCE, MOB_SLAVEDISTANCE, 1)
+ if(map->search_freecell(&md->bl, bl->m, &x, &y, MOB_SLAVEDISTANCE, MOB_SLAVEDISTANCE, 1)
&& unit->walktoxy(&md->bl, x, y, 0))
return 1;
}
@@ -1247,9 +1243,9 @@ int mob_ai_sub_hard_slavemob(struct mob_data *md,unsigned int tick)
if (ud) {
struct block_list *tbl=NULL;
if (ud->target && ud->state.attack_continue)
- tbl=iMap->id2bl(ud->target);
+ tbl=map->id2bl(ud->target);
else if (ud->skilltarget) {
- tbl = iMap->id2bl(ud->skilltarget);
+ tbl = map->id2bl(ud->skilltarget);
//Required check as skilltarget is not always an enemy. [Skotlex]
if (tbl && battle->check_target(&md->bl, tbl, BCT_ENEMY) <= 0)
tbl = NULL;
@@ -1334,7 +1330,7 @@ int mob_randomwalk(struct mob_data *md,unsigned int tick)
x+=md->bl.x;
y+=md->bl.y;
- if((iMap->getcell(md->bl.m,x,y,CELL_CHKPASS)) && unit->walktoxy(&md->bl,x,y,1)){
+ if((map->getcell(md->bl.m,x,y,CELL_CHKPASS)) && unit->walktoxy(&md->bl,x,y,1)){
break;
}
}
@@ -1372,12 +1368,12 @@ int mob_warpchase(struct mob_data *md, struct block_list *target)
return 0; //No need to do a warp chase.
if (md->ud.walktimer != INVALID_TIMER &&
- iMap->getcell(md->bl.m,md->ud.to_x,md->ud.to_y,CELL_CHKNPC))
+ map->getcell(md->bl.m,md->ud.to_x,md->ud.to_y,CELL_CHKNPC))
return 1; //Already walking to a warp.
//Search for warps within mob's viewing range.
- iMap->foreachinrange (mob->warpchase_sub, &md->bl,
- md->db->range2, BL_NPC, target, &warp, &distance);
+ map->foreachinrange(mob->warpchase_sub, &md->bl,
+ md->db->range2, BL_NPC, target, &warp, &distance);
if (warp && unit->walktobl(&md->bl, &warp->bl, 1, 1))
return 1;
@@ -1424,7 +1420,7 @@ bool mob_ai_sub_hard(struct mob_data *md, unsigned int tick)
if (md->target_id) {
//Check validity of current target. [Skotlex]
- tbl = iMap->id2bl(md->target_id);
+ tbl = map->id2bl(md->target_id);
if (!tbl || tbl->m != md->bl.m
|| (md->ud.attacktimer == INVALID_TIMER && !status->check_skilluse(&md->bl, tbl, 0, 0))
|| (md->ud.walktimer != INVALID_TIMER && !(battle_config.mob_ai&0x1) && !check_distance_bl(&md->bl, tbl, md->min_chase))
@@ -1462,8 +1458,7 @@ bool mob_ai_sub_hard(struct mob_data *md, unsigned int tick)
}
}
else
- if( (abl = iMap->id2bl(md->attacked_id)) && (!tbl || mob->can_changetarget(md, abl, mode)) )
- {
+ if( (abl = map->id2bl(md->attacked_id)) && (!tbl || mob->can_changetarget(md, abl, mode)) ) {
int dist;
if( md->bl.m != abl->m || abl->prev == NULL
|| (dist = distance_bl(&md->bl, abl)) >= MAX_MINCHASE // Attacker longer than visual area
@@ -1517,22 +1512,19 @@ bool mob_ai_sub_hard(struct mob_data *md, unsigned int tick)
return true;
// Scan area for targets
- if (!tbl && mode&MD_LOOTER && md->lootitem && DIFF_TICK(tick, md->ud.canact_tick) > 0 &&
- (md->lootitem_count < LOOTITEM_SIZE || battle_config.monster_loot_type != 1))
- { // Scan area for items to loot, avoid trying to loot if the mob is full and can't consume the items.
- iMap->foreachinrange (mob->ai_sub_hard_lootsearch, &md->bl, view_range, BL_ITEM, md, &tbl);
+ if (!tbl && mode&MD_LOOTER && md->lootitem && DIFF_TICK(tick, md->ud.canact_tick) > 0
+ && (md->lootitem_count < LOOTITEM_SIZE || battle_config.monster_loot_type != 1)
+ ) {
+ // Scan area for items to loot, avoid trying to loot if the mob is full and can't consume the items.
+ map->foreachinrange (mob->ai_sub_hard_lootsearch, &md->bl, view_range, BL_ITEM, md, &tbl);
}
- if ((!tbl && mode&MD_AGGRESSIVE) || md->state.skillstate == MSS_FOLLOW)
- {
- iMap->foreachinrange (mob->ai_sub_hard_activesearch, &md->bl, view_range, DEFAULT_ENEMY_TYPE(md), md, &tbl, mode);
- }
- else
- if (mode&MD_CHANGECHASE && (md->state.skillstate == MSS_RUSH || md->state.skillstate == MSS_FOLLOW))
- {
+ if ((!tbl && mode&MD_AGGRESSIVE) || md->state.skillstate == MSS_FOLLOW) {
+ map->foreachinrange (mob->ai_sub_hard_activesearch, &md->bl, view_range, DEFAULT_ENEMY_TYPE(md), md, &tbl, mode);
+ } else if (mode&MD_CHANGECHASE && (md->state.skillstate == MSS_RUSH || md->state.skillstate == MSS_FOLLOW)) {
int search_size;
search_size = view_range<md->status.rhw.range ? view_range:md->status.rhw.range;
- iMap->foreachinrange (mob->ai_sub_hard_changechase, &md->bl, search_size, DEFAULT_ENEMY_TYPE(md), md, &tbl);
+ map->foreachinrange (mob->ai_sub_hard_changechase, &md->bl, search_size, DEFAULT_ENEMY_TYPE(md), md, &tbl);
}
if (!tbl) { //No targets available.
@@ -1543,7 +1535,7 @@ bool mob_ai_sub_hard(struct mob_data *md, unsigned int tick)
if( md->bg_id && mode&MD_CANATTACK ) {
if( md->ud.walktimer != INVALID_TIMER )
return true;/* we are already moving */
- iMap->foreachinrange (mob->ai_sub_hard_bg_ally, &md->bl, view_range, BL_PC, md, &tbl, mode);
+ map->foreachinrange (mob->ai_sub_hard_bg_ally, &md->bl, view_range, BL_PC, md, &tbl, mode);
if( tbl ) {
if( distance_blxy(&md->bl, tbl->x, tbl->y) <= 3 || unit->walktobl(&md->bl, tbl, 1, 1) )
return true;/* we're moving or close enough don't unlock the target. */
@@ -1603,7 +1595,7 @@ bool mob_ai_sub_hard(struct mob_data *md, unsigned int tick)
unit->set_walkdelay(&md->bl, tick, md->status.amotion, 1);
}
//Clear item.
- iMap->clearflooritem (tbl);
+ map->clearflooritem (tbl);
mob->unlocktarget (md,tick);
return true;
}
@@ -1669,11 +1661,10 @@ int mob_ai_sub_hard_timer(struct block_list *bl,va_list ap)
/*==========================================
* Serious processing for mob in PC field of view (foreachclient)
*------------------------------------------*/
-int mob_ai_sub_foreachclient(struct map_session_data *sd,va_list ap)
-{
+int mob_ai_sub_foreachclient(struct map_session_data *sd,va_list ap) {
unsigned int tick;
tick=va_arg(ap,unsigned int);
- iMap->foreachinrange(mob->ai_sub_hard_timer,&sd->bl, AREA_SIZE+ACTIVE_AI_RANGE, BL_MOB,tick);
+ map->foreachinrange(mob->ai_sub_hard_timer,&sd->bl, AREA_SIZE+ACTIVE_AI_RANGE, BL_MOB,tick);
return 0;
}
@@ -1749,22 +1740,20 @@ int mob_ai_sub_lazy(struct mob_data *md, va_list args)
/*==========================================
* Negligent processing for mob outside PC field of view (interval timer function)
*------------------------------------------*/
-int mob_ai_lazy(int tid, unsigned int tick, int id, intptr_t data)
-{
- iMap->map_foreachmob(mob->ai_sub_lazy,tick);
+int mob_ai_lazy(int tid, unsigned int tick, int id, intptr_t data) {
+ map->map_foreachmob(mob->ai_sub_lazy,tick);
return 0;
}
/*==========================================
* Serious processing for mob in PC field of view (interval timer function)
*------------------------------------------*/
-int mob_ai_hard(int tid, unsigned int tick, int id, intptr_t data)
-{
+int mob_ai_hard(int tid, unsigned int tick, int id, intptr_t data) {
if (battle_config.mob_ai&0x20)
- iMap->map_foreachmob(mob->ai_sub_lazy,tick);
+ map->map_foreachmob(mob->ai_sub_lazy,tick);
else
- iMap->map_foreachpc(mob->ai_sub_foreachclient,tick);
+ map->map_foreachpc(mob->ai_sub_foreachclient,tick);
return 0;
}
@@ -1803,9 +1792,9 @@ int mob_delay_item_drop(int tid, unsigned int tick, int id, intptr_t data)
list=(struct item_drop_list *)data;
ditem = list->item;
while (ditem) {
- iMap->addflooritem(&ditem->item_data,ditem->item_data.amount,
- list->m,list->x,list->y,
- list->first_charid,list->second_charid,list->third_charid,0);
+ map->addflooritem(&ditem->item_data,ditem->item_data.amount,
+ list->m,list->x,list->y,
+ list->first_charid,list->second_charid,list->third_charid,0);
ditem_prev = ditem;
ditem = ditem->next;
ers_free(item_drop_ers, ditem_prev);
@@ -1827,9 +1816,9 @@ void mob_item_drop(struct mob_data *md, struct item_drop_list *dlist, struct ite
//Logs items, dropped by mobs [Lupus]
logs->pick_mob(md, loot?LOG_TYPE_LOOT:LOG_TYPE_PICKDROP_MONSTER, -ditem->item_data.amount, &ditem->item_data, NULL);
- sd = iMap->charid2sd(dlist->first_charid);
- if( sd == NULL ) sd = iMap->charid2sd(dlist->second_charid);
- if( sd == NULL ) sd = iMap->charid2sd(dlist->third_charid);
+ sd = map->charid2sd(dlist->first_charid);
+ if( sd == NULL ) sd = map->charid2sd(dlist->second_charid);
+ if( sd == NULL ) sd = map->charid2sd(dlist->third_charid);
if( sd
&& (drop_rate <= sd->state.autoloot || pc->isautolooting(sd, ditem->item_data.nameid))
@@ -1851,9 +1840,8 @@ void mob_item_drop(struct mob_data *md, struct item_drop_list *dlist, struct ite
dlist->item = ditem;
}
-int mob_timer_delete(int tid, unsigned int tick, int id, intptr_t data)
-{
- struct block_list* bl = iMap->id2bl(id);
+int mob_timer_delete(int tid, unsigned int tick, int id, intptr_t data) {
+ struct block_list* bl = map->id2bl(id);
struct mob_data* md = BL_CAST(BL_MOB, bl);
if( md )
@@ -1890,16 +1878,15 @@ int mob_deleteslave_sub(struct block_list *bl,va_list ap)
/*==========================================
*
*------------------------------------------*/
-int mob_deleteslave(struct mob_data *md)
-{
+int mob_deleteslave(struct mob_data *md) {
nullpo_ret(md);
- iMap->foreachinmap(mob->deleteslave_sub, md->bl.m, BL_MOB,md->bl.id);
+ map->foreachinmap(mob->deleteslave_sub, md->bl.m, BL_MOB,md->bl.id);
return 0;
}
// Mob respawning through KAIZEL or NPC_REBIRTH [Skotlex]
int mob_respawn(int tid, unsigned int tick, int id, intptr_t data) {
- struct block_list *bl = iMap->id2bl(id);
+ struct block_list *bl = map->id2bl(id);
if(!bl) return 0;
status->revive(bl, (uint8)data, 0);
@@ -1961,9 +1948,8 @@ void mob_log_damage(struct mob_data *md, struct block_list *src, int damage)
case BL_MOB:
{
struct mob_data* md2 = (TBL_MOB*)src;
- if( md2->special_state.ai && md2->master_id )
- {
- struct map_session_data* msd = iMap->id2sd(md2->master_id);
+ if( md2->special_state.ai && md2->master_id ) {
+ struct map_session_data* msd = map->id2sd(md2->master_id);
if( msd )
char_id = msd->status.char_id;
}
@@ -2053,7 +2039,7 @@ void mob_damage(struct mob_data *md, struct block_list *src, int damage) {
int i;
for(i = 0; i < DAMAGELOG_SIZE; i++){ // must show hp bar to all char who already hit the mob.
if( md->dmglog[i].id ) {
- struct map_session_data *sd = iMap->charid2sd(md->dmglog[i].id);
+ struct map_session_data *sd = map->charid2sd(md->dmglog[i].id);
if( sd && check_distance_bl(&md->bl, &sd->bl, AREA_SIZE) ) // check if in range
clif->monster_hp_bar(md,sd);
}
@@ -2103,7 +2089,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) {
mob->skill_use(md,tick,-1);
}
- iMap->freeblock_lock();
+ map->freeblock_lock();
memset(pt,0,sizeof(pt));
@@ -2112,9 +2098,8 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) {
// filter out entries not eligible for exp distribution
memset(tmpsd,0,sizeof(tmpsd));
- for(i = 0, count = 0, mvp_damage = 0; i < DAMAGELOG_SIZE && md->dmglog[i].id; i++)
- {
- struct map_session_data* tsd = iMap->charid2sd(md->dmglog[i].id);
+ for(i = 0, count = 0, mvp_damage = 0; i < DAMAGELOG_SIZE && md->dmglog[i].id; i++) {
+ struct map_session_data* tsd = map->charid2sd(md->dmglog[i].id);
if(tsd == NULL)
continue; // skip empty entries
@@ -2516,7 +2501,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) {
if((temp = pc->additem(mvp_sd,&item,1,LOG_TYPE_PICKDROP_PLAYER)) != 0) {
clif->additem(mvp_sd,0,0,temp);
- iMap->addflooritem(&item,1,mvp_sd->bl.m,mvp_sd->bl.x,mvp_sd->bl.y,mvp_sd->status.char_id,(second_sd?second_sd->status.char_id:0),(third_sd?third_sd->status.char_id:0),1);
+ map->addflooritem(&item,1,mvp_sd->bl.m,mvp_sd->bl.x,mvp_sd->bl.y,mvp_sd->status.char_id,(second_sd?second_sd->status.char_id:0),(third_sd?third_sd->status.char_id:0),1);
}
//Logs items, MVP prizes [Lupus]
@@ -2557,7 +2542,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) {
}
if( sd->status.party_id )
- iMap->foreachinrange(quest->update_objective_sub,&md->bl,AREA_SIZE,BL_PC,sd->status.party_id,md->class_);
+ map->foreachinrange(quest->update_objective_sub,&md->bl,AREA_SIZE,BL_PC,sd->status.party_id,md->class_);
else if( sd->avail_quests )
quest->update_objective(sd, md->class_);
@@ -2592,7 +2577,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) {
if( md->can_summon )
mob->deleteslave(md);
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
if( !rebirth ) {
@@ -2634,7 +2619,7 @@ void mob_revive(struct mob_data *md, unsigned int hp)
memset(md->dmglog, 0, sizeof(md->dmglog)); // Reset the damage done on the rebirthed monster, otherwise will grant full exp + damage done. [Valaris]
md->tdmg = 0;
if (!md->bl.prev)
- iMap->addblock(&md->bl);
+ map->addblock(&md->bl);
clif->spawn(&md->bl);
skill->unit_move(&md->bl,tick,1);
mob->skill_use(md, tick, MSC_SPAWN);
@@ -2785,8 +2770,7 @@ void mob_heal(struct mob_data *md,unsigned int heal)
/*==========================================
* Added by RoVeRT
*------------------------------------------*/
-int mob_warpslave_sub(struct block_list *bl,va_list ap)
-{
+int mob_warpslave_sub(struct block_list *bl,va_list ap) {
struct mob_data *md=(struct mob_data *)bl;
struct block_list *master;
short x,y,range=0;
@@ -2796,7 +2780,7 @@ int mob_warpslave_sub(struct block_list *bl,va_list ap)
if(md->master_id!=master->id)
return 0;
- iMap->search_freecell(master, 0, &x, &y, range, range, 0);
+ map->search_freecell(master, 0, &x, &y, range, range, 0);
unit->warp(&md->bl, master->m, x, y,CLR_RESPAWN);
return 1;
}
@@ -2806,12 +2790,11 @@ int mob_warpslave_sub(struct block_list *bl,va_list ap)
* Warps slaves. Range is the area around the master that they can
* appear in randomly.
*------------------------------------------*/
-int mob_warpslave(struct block_list *bl, int range)
-{
+int mob_warpslave(struct block_list *bl, int range) {
if (range < 1)
range = 1; //Min range needed to avoid crashes and stuff. [Skotlex]
- return iMap->foreachinmap(mob->warpslave_sub, bl->m, BL_MOB, bl, range);
+ return map->foreachinmap(mob->warpslave_sub, bl->m, BL_MOB, bl, range);
}
/*==========================================
@@ -2832,9 +2815,8 @@ int mob_countslave_sub(struct block_list *bl,va_list ap)
/*==========================================
* Counts the number of slaves a mob has on the map.
*------------------------------------------*/
-int mob_countslave(struct block_list *bl)
-{
- return iMap->foreachinmap(mob->countslave_sub, bl->m, BL_MOB,bl->id);
+int mob_countslave(struct block_list *bl) {
+ return map->foreachinmap(mob->countslave_sub, bl->m, BL_MOB,bl->id);
}
/*==========================================
@@ -2881,7 +2863,7 @@ int mob_summonslave(struct mob_data *md2,int *value,int amount,uint16 skill_id)
if (mob->db_checkid(data.class_) == 0)
continue;
- if (iMap->search_freecell(&md2->bl, 0, &x, &y, MOB_SLAVEDISTANCE, MOB_SLAVEDISTANCE, 0)) {
+ if (map->search_freecell(&md2->bl, 0, &x, &y, MOB_SLAVEDISTANCE, MOB_SLAVEDISTANCE, 0)) {
data.x = x;
data.y = y;
} else {
@@ -2980,8 +2962,7 @@ int mob_getfriendhprate_sub(struct block_list *bl,va_list ap)
(*fr) = bl;
return 1;
}
-struct block_list *mob_getfriendhprate(struct mob_data *md,int min_rate,int max_rate)
-{
+struct block_list *mob_getfriendhprate(struct mob_data *md,int min_rate,int max_rate) {
struct block_list *fr=NULL;
int type = BL_MOB;
@@ -2990,17 +2971,15 @@ struct block_list *mob_getfriendhprate(struct mob_data *md,int min_rate,int max_
if (md->special_state.ai) //Summoned creatures. [Skotlex]
type = BL_PC;
- iMap->foreachinrange(mob->getfriendhprate_sub, &md->bl, 8, type,md,min_rate,max_rate,&fr);
+ map->foreachinrange(mob->getfriendhprate_sub, &md->bl, 8, type,md,min_rate,max_rate,&fr);
return fr;
}
/*==========================================
* Check hp rate of its master
*------------------------------------------*/
-struct block_list *mob_getmasterhpltmaxrate(struct mob_data *md,int rate)
-{
- if( md && md->master_id > 0 )
- {
- struct block_list *bl = iMap->id2bl(md->master_id);
+struct block_list *mob_getmasterhpltmaxrate(struct mob_data *md,int rate) {
+ if( md && md->master_id > 0 ) {
+ struct block_list *bl = map->id2bl(md->master_id);
if( bl && get_percentage(status_get_hp(bl), status_get_max_hp(bl)) < rate )
return bl;
}
@@ -3042,12 +3021,11 @@ int mob_getfriendstatus_sub(struct block_list *bl,va_list ap)
return 0;
}
-struct mob_data *mob_getfriendstatus(struct mob_data *md,int cond1,int cond2)
-{
+struct mob_data *mob_getfriendstatus(struct mob_data *md,int cond1,int cond2) {
struct mob_data* fr = NULL;
nullpo_ret(md);
- iMap->foreachinrange(mob->getfriendstatus_sub, &md->bl, 8,BL_MOB, md,cond1,cond2,&fr);
+ map->foreachinrange(mob->getfriendstatus_sub, &md->bl, 8,BL_MOB, md,cond1,cond2,&fr);
return fr;
}
@@ -3149,7 +3127,7 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event)
case MSC_MASTERHPLTMAXRATE:
flag = ((fbl = mob->getmasterhpltmaxrate(md, ms[i].cond2)) != NULL); break;
case MSC_MASTERATTACKED:
- flag = (md->master_id > 0 && (fbl=iMap->id2bl(md->master_id)) && unit->counttargeted(fbl) > 0); break;
+ flag = (md->master_id > 0 && (fbl=map->id2bl(md->master_id)) && unit->counttargeted(fbl) > 0); break;
case MSC_ALCHEMIST:
flag = (md->state.alchemist);
break;
@@ -3172,12 +3150,12 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event)
case MST_AROUND6:
case MST_AROUND7:
case MST_AROUND8:
- bl = iMap->id2bl(md->target_id);
+ bl = map->id2bl(md->target_id);
break;
case MST_MASTER:
bl = &md->bl;
if (md->master_id)
- bl = iMap->id2bl(md->master_id);
+ bl = map->id2bl(md->master_id);
if (bl) //Otherwise, fall through.
break;
case MST_FRIEND:
@@ -3196,14 +3174,14 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event)
j = ms[i].target >= MST_AROUND1?
(ms[i].target-MST_AROUND1) +1:
(ms[i].target-MST_AROUND5) +1;
- iMap->search_freecell(&md->bl, md->bl.m, &x, &y, j, j, 3);
+ map->search_freecell(&md->bl, md->bl.m, &x, &y, j, j, 3);
}
md->skill_idx = i;
- iMap->freeblock_lock();
- if( !battle->check_range(&md->bl,bl,skill->get_range2(&md->bl, ms[i].skill_id,ms[i].skill_lv)) ||
- !unit->skilluse_pos2(&md->bl, x, y,ms[i].skill_id, ms[i].skill_lv,ms[i].casttime, ms[i].cancel) )
- {
- iMap->freeblock_unlock();
+ map->freeblock_lock();
+ if( !battle->check_range(&md->bl,bl,skill->get_range2(&md->bl, ms[i].skill_id,ms[i].skill_lv))
+ || !unit->skilluse_pos2(&md->bl, x, y,ms[i].skill_id, ms[i].skill_lv,ms[i].casttime, ms[i].cancel)
+ ) {
+ map->freeblock_unlock();
continue;
}
} else {
@@ -3214,12 +3192,12 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event)
skill->get_range2(&md->bl, ms[i].skill_id, ms[i].skill_lv));
break;
case MST_TARGET:
- bl = iMap->id2bl(md->target_id);
+ bl = map->id2bl(md->target_id);
break;
case MST_MASTER:
bl = &md->bl;
if (md->master_id)
- bl = iMap->id2bl(md->master_id);
+ bl = map->id2bl(md->master_id);
if (bl) //Otherwise, fall through.
break;
case MST_FRIEND:
@@ -3237,11 +3215,11 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event)
if (!bl) continue;
md->skill_idx = i;
- iMap->freeblock_lock();
- if( !battle->check_range(&md->bl,bl,skill->get_range2(&md->bl, ms[i].skill_id,ms[i].skill_lv)) ||
- !unit->skilluse_id2(&md->bl, bl->id,ms[i].skill_id, ms[i].skill_lv,ms[i].casttime, ms[i].cancel) )
- {
- iMap->freeblock_unlock();
+ map->freeblock_lock();
+ if( !battle->check_range(&md->bl,bl,skill->get_range2(&md->bl, ms[i].skill_id,ms[i].skill_lv))
+ || !unit->skilluse_id2(&md->bl, bl->id,ms[i].skill_id, ms[i].skill_lv,ms[i].casttime, ms[i].cancel)
+ ) {
+ map->freeblock_unlock();
continue;
}
}
@@ -3261,7 +3239,7 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event)
md->skilldelay[j]=tick;
} else
md->skilldelay[i]=tick;
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return 1;
}
//No skill was used.
@@ -3891,22 +3869,21 @@ void mob_readdb(void) {
for( fi = 0; fi < ARRAYLENGTH(filename); ++fi ) {
if(fi > 0) {
char filepath[256];
- sprintf(filepath, "%s/%s", iMap->db_path, filename[fi]);
+ sprintf(filepath, "%s/%s", map->db_path, filename[fi]);
if(!exists(filepath)) {
continue;
}
}
- sv->readdb(iMap->db_path, filename[fi], ',', 31+2*MAX_MVP_DROP+2*MAX_MOB_DROP, 31+2*MAX_MVP_DROP+2*MAX_MOB_DROP, -1, mob->readdb_sub);
+ sv->readdb(map->db_path, filename[fi], ',', 31+2*MAX_MVP_DROP+2*MAX_MOB_DROP, 31+2*MAX_MVP_DROP+2*MAX_MOB_DROP, -1, mob->readdb_sub);
}
}
/*==========================================
* mob_db table reading
*------------------------------------------*/
-int mob_read_sqldb(void)
-{
- const char* mob_db_name[] = { iMap->mob_db_db, iMap->mob_db2_db };
+int mob_read_sqldb(void) {
+ const char* mob_db_name[] = { map->mob_db_db, map->mob_db2_db };
int fi;
for( fi = 0; fi < ARRAYLENGTH(mob_db_name); ++fi ) {
@@ -4014,7 +3991,7 @@ int mob_read_randommonster(void)
for( i = 0; i < ARRAYLENGTH(mobfile) && i < MAX_RANDOMMONSTER; i++ ) {
unsigned int count = 0;
mob->db_data[0]->summonper[i] = 1002; // Default fallback value, in case the database does not provide one
- sprintf(line, "%s/%s", iMap->db_path, mobfile[i]);
+ sprintf(line, "%s/%s", map->db_path, mobfile[i]);
fp=fopen(line,"r");
if(fp==NULL){
ShowError("can't read %s\n",line);
@@ -4127,7 +4104,7 @@ void mob_readchatdb(void) {
char line[1024], filepath[256];
int i, tmp=0;
FILE *fp;
- sprintf(filepath, "%s/%s", iMap->db_path, arc);
+ sprintf(filepath, "%s/%s", map->db_path, arc);
fp=fopen(filepath, "r");
if(fp == NULL) {
ShowWarning("mob_readchatdb: File not found \"%s\", skipping.\n", filepath);
@@ -4448,13 +4425,13 @@ void mob_readskilldb(void) {
for( fi = 0; fi < ARRAYLENGTH(filename); ++fi ) {
if(fi > 0) {
char filepath[256];
- sprintf(filepath, "%s/%s", iMap->db_path, filename[fi]);
+ sprintf(filepath, "%s/%s", map->db_path, filename[fi]);
if(!exists(filepath)) {
continue;
}
}
- sv->readdb(iMap->db_path, filename[fi], ',', 19, 19, -1, mob->parse_row_mobskilldb);
+ sv->readdb(map->db_path, filename[fi], ',', 19, 19, -1, mob->parse_row_mobskilldb);
}
}
@@ -4463,9 +4440,8 @@ void mob_readskilldb(void) {
* not overly sure if this is all correct
* seems to work though...
*/
-int mob_read_sqlskilldb(void)
-{
- const char* mob_skill_db_name[] = { iMap->mob_skill_db_db, iMap->mob_skill_db2_db };
+int mob_read_sqlskilldb(void) {
+ const char* mob_skill_db_name[] = { map->mob_skill_db_db, map->mob_skill_db2_db };
int fi;
if( battle_config.mob_skill_rate == 0 ) {
@@ -4568,24 +4544,20 @@ bool mob_readdb_itemratio(char* str[], int columns, int current)
* read all mob-related databases
*/
void mob_load(void) {
- sv->readdb(iMap->db_path, "mob_item_ratio.txt", ',', 2, 2+MAX_ITEMRATIO_MOBS, -1, mob->readdb_itemratio); // must be read before mobdb
+ sv->readdb(map->db_path, "mob_item_ratio.txt", ',', 2, 2+MAX_ITEMRATIO_MOBS, -1, mob->readdb_itemratio); // must be read before mobdb
mob->readchatdb();
- if (iMap->db_use_sql_mob_db)
- {
+ if (map->db_use_sql_mob_db) {
mob->read_sqldb();
}
- if (iMap->db_use_sql_mob_skill_db)
- {
+ if (map->db_use_sql_mob_skill_db) {
mob->read_sqlskilldb();
- }
- else
- {
+ } else {
mob->readdb();
mob->readskilldb();
}
- sv->readdb(iMap->db_path, "mob_avail.txt", ',', 2, 12, -1, mob->readdb_mobavail);
+ sv->readdb(map->db_path, "mob_avail.txt", ',', 2, 12, -1, mob->readdb_mobavail);
mob->read_randommonster();
- sv->readdb(iMap->db_path, DBPATH"mob_race2_db.txt", ',', 2, 20, -1, mob->readdb_race2);
+ sv->readdb(map->db_path, DBPATH"mob_race2_db.txt", ',', 2, 20, -1, mob->readdb_race2);
}
void mob_reload(void) {
diff --git a/src/map/npc.c b/src/map/npc.c
index 024f649d0..eff80efce 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -78,14 +78,14 @@ struct view_data* npc_get_viewdata(int class_)
/// Returns a new npc id that isn't being used in id_db.
/// Fatal error if nothing is available.
int npc_get_new_npc_id(void) {
- if( npc_id >= START_NPC_NUM && !iMap->blid_exists(npc_id) )
+ if( npc_id >= START_NPC_NUM && !map->blid_exists(npc_id) )
return npc_id++;// available
else {// find next id
int base_id = npc_id;
while( base_id != ++npc_id ) {
if( npc_id < START_NPC_NUM )
npc_id = START_NPC_NUM;
- if( !iMap->blid_exists(npc_id) )
+ if( !map->blid_exists(npc_id) )
return npc_id++;// available
}
// full loop, nothing available
@@ -104,12 +104,11 @@ int npc_isnear_sub(struct block_list* bl, va_list args) {
}
bool npc_isnear(struct block_list * bl) {
-
- if( battle_config.min_npc_vendchat_distance > 0 &&
- iMap->foreachinrange(npc->isnear_sub,bl, battle_config.min_npc_vendchat_distance, BL_NPC) )
- return true;
-
- return false;
+ if( battle_config.min_npc_vendchat_distance > 0
+ && map->foreachinrange(npc->isnear_sub,bl, battle_config.min_npc_vendchat_distance, BL_NPC) )
+ return true;
+
+ return false;
}
int npc_ontouch_event(struct map_session_data *sd, struct npc_data *nd)
@@ -197,8 +196,8 @@ int npc_enable(const char* name, int flag)
} else
clif->changeoption(&nd->bl);
- if( flag&3 && (nd->u.scr.xs >= 0 || nd->u.scr.ys >= 0) ) //check if player standing on a OnTouchArea
- iMap->foreachinarea( npc->enable_sub, nd->bl.m, nd->bl.x-nd->u.scr.xs, nd->bl.y-nd->u.scr.ys, nd->bl.x+nd->u.scr.xs, nd->bl.y+nd->u.scr.ys, BL_PC, nd );
+ if( flag&3 && (nd->u.scr.xs >= 0 || nd->u.scr.ys >= 0) ) //check if player standing on a OnTouchArea
+ map->foreachinarea( npc->enable_sub, nd->bl.m, nd->bl.x-nd->u.scr.xs, nd->bl.y-nd->u.scr.ys, nd->bl.x+nd->u.scr.xs, nd->bl.y+nd->u.scr.ys, BL_PC, nd );
return 0;
}
@@ -220,7 +219,7 @@ struct npc_data* npc_name2id(const char* name)
int npc_rr_secure_timeout_timer(int tid, unsigned int tick, int id, intptr_t data) {
struct map_session_data* sd = NULL;
unsigned int timeout = NPC_SECURE_TIMEOUT_NEXT;
- if( (sd = iMap->id2sd(id)) == NULL || !sd->npc_id ) {
+ if( (sd = map->id2sd(id)) == NULL || !sd->npc_id ) {
if( sd ) sd->npc_idle_timer = INVALID_TIMER;
return 0;//Not logged in anymore OR no longer attached to a npc
}
@@ -347,7 +346,7 @@ void npc_event_doall_sub(void *key, void *data, va_list ap)
if(rid) { // a player may only have 1 script running at the same time
char buf[EVENT_NAME_LENGTH];
snprintf(buf, ARRAYLENGTH(buf), "%s::%s", ev->nd->exname, name);
- npc->event_sub(iMap->id2sd(rid), ev, buf);
+ npc->event_sub(map->id2sd(rid), ev, buf);
}
else {
script->run(ev->nd->u.scr.script, ev->pos, rid, ev->nd->bl.id);
@@ -494,23 +493,20 @@ struct timer_event_data {
/*==========================================
* triger 'OnTimerXXXX' events
*------------------------------------------*/
-int npc_timerevent(int tid, unsigned int tick, int id, intptr_t data)
-{
+int npc_timerevent(int tid, unsigned int tick, int id, intptr_t data) {
int old_rid, old_timer;
unsigned int old_tick;
- struct npc_data* nd=(struct npc_data *)iMap->id2bl(id);
+ struct npc_data* nd=(struct npc_data *)map->id2bl(id);
struct npc_timerevent_list *te;
struct timer_event_data *ted = (struct timer_event_data*)data;
struct map_session_data *sd=NULL;
- if( nd == NULL )
- {
+ if( nd == NULL ) {
ShowError("npc_timerevent: NPC not found??\n");
return 0;
}
- if( ted->rid && !(sd = iMap->id2sd(ted->rid)) )
- {
+ if( ted->rid && !(sd = map->id2sd(ted->rid)) ) {
ShowError("npc_timerevent: Attached player not found.\n");
ers_free(npc->timer_event_ers, ted);
return 0;
@@ -522,9 +518,9 @@ int npc_timerevent(int tid, unsigned int tick, int id, intptr_t data)
old_timer = nd->u.scr.timer;
// Set the values of the timer
- nd->u.scr.rid = sd?sd->bl.id:0; //attached rid
- nd->u.scr.timertick = tick; //current time tick
- nd->u.scr.timer = ted->time; //total time from beginning to now
+ nd->u.scr.rid = sd?sd->bl.id:0; //attached rid
+ nd->u.scr.timertick = tick; //current time tick
+ nd->u.scr.timer = ted->time; //total time from beginning to now
// Locate the event
te = nd->u.scr.timer_event + ted->next;
@@ -566,8 +562,7 @@ int npc_timerevent(int tid, unsigned int tick, int id, intptr_t data)
/*==========================================
* Start/Resume NPC timer
*------------------------------------------*/
-int npc_timerevent_start(struct npc_data* nd, int rid)
-{
+int npc_timerevent_start(struct npc_data* nd, int rid) {
int j;
unsigned int tick = timer->gettick();
struct map_session_data *sd = NULL; //Player to whom script is attached.
@@ -577,8 +572,8 @@ int npc_timerevent_start(struct npc_data* nd, int rid)
// Check if there is an OnTimer Event
ARR_FIND( 0, nd->u.scr.timeramount, j, nd->u.scr.timer_event[j].timer > nd->u.scr.timer );
- if( nd->u.scr.rid > 0 && !(sd = iMap->id2sd(nd->u.scr.rid)) )
- { // Failed to attach timer to this player.
+ if( nd->u.scr.rid > 0 && !(sd = map->id2sd(nd->u.scr.rid)) ) {
+ // Failed to attach timer to this player.
ShowError("npc_timerevent_start: Attached player not found!\n");
return 1;
}
@@ -627,8 +622,7 @@ int npc_timerevent_stop(struct npc_data* nd)
nullpo_ret(nd);
- if( nd->u.scr.rid && !(sd = iMap->id2sd(nd->u.scr.rid)) )
- {
+ if( nd->u.scr.rid && !(sd = map->id2sd(nd->u.scr.rid)) ) {
ShowError("npc_timerevent_stop: Attached player not found!\n");
return 1;
}
@@ -673,7 +667,7 @@ void npc_timerevent_quit(struct map_session_data* sd)
}
// Delete timer
- nd = (struct npc_data *)iMap->id2bl(td->id);
+ nd = (struct npc_data *)map->id2bl(td->id);
ted = (struct timer_event_data*)td->data;
timer->delete(sd->npc_timer_id, npc->timerevent);
sd->npc_timer_id = INVALID_TIMER;
@@ -820,14 +814,13 @@ int npc_event(struct map_session_data* sd, const char* eventname, int ontouch)
/*==========================================
* Sub chk then execute area event type
*------------------------------------------*/
-int npc_touch_areanpc_sub(struct block_list *bl, va_list ap)
-{
+int npc_touch_areanpc_sub(struct block_list *bl, va_list ap) {
struct map_session_data *sd;
int pc_id;
char *name;
nullpo_ret(bl);
- nullpo_ret((sd = iMap->id2sd(bl->id)));
+ nullpo_ret((sd = map->id2sd(bl->id)));
pc_id = va_arg(ap,int);
name = va_arg(ap,char*);
@@ -848,9 +841,8 @@ int npc_touch_areanpc_sub(struct block_list *bl, va_list ap)
* Chk if sd is still touching his assigned npc.
* If not, it unsets it and searches for another player in range.
*------------------------------------------*/
-int npc_touchnext_areanpc(struct map_session_data* sd, bool leavemap)
-{
- struct npc_data *nd = iMap->id2nd(sd->touching_id);
+int npc_touchnext_areanpc(struct map_session_data* sd, bool leavemap) {
+ struct npc_data *nd = map->id2nd(sd->touching_id);
short xs, ys;
if( !nd || nd->touching_id != sd->bl.id )
@@ -868,7 +860,7 @@ int npc_touchnext_areanpc(struct map_session_data* sd, bool leavemap)
nd->touching_id = sd->touching_id = 0;
snprintf(name, ARRAYLENGTH(name), "%s::%s", nd->exname, script->config.ontouch_name);
- iMap->forcountinarea(npc->touch_areanpc_sub,nd->bl.m,nd->bl.x - xs,nd->bl.y - ys,nd->bl.x + xs,nd->bl.y + ys,1,BL_PC,sd->bl.id,name);
+ map->forcountinarea(npc->touch_areanpc_sub,nd->bl.m,nd->bl.x - xs,nd->bl.y - ys,nd->bl.x + xs,nd->bl.y + ys,1,BL_PC,sd->bl.id,name);
}
return 0;
}
@@ -993,7 +985,7 @@ int npc_touch_areanpc2(struct mob_data *md)
// In the npc touch area
switch( maplist[m].npc[i]->subtype ) {
case WARP:
- xs = iMap->mapindex2mapid(maplist[m].npc[i]->u.warp.mapindex);
+ xs = map->mapindex2mapid(maplist[m].npc[i]->u.warp.mapindex);
if( m < 0 )
break; // Cannot Warp between map servers
if( unit->warp(&md->bl, xs, maplist[m].npc[i]->u.warp.x, maplist[m].npc[i]->u.warp.y, CLR_OUTSIGHT) == 0 )
@@ -1008,7 +1000,7 @@ int npc_touch_areanpc2(struct mob_data *md)
md->areanpc_id = maplist[m].npc[i]->bl.id;
id = md->bl.id; // Stores Unique ID
script->run(ev->nd->u.scr.script, ev->pos, md->bl.id, ev->nd->bl.id);
- if( iMap->id2md(id) == NULL ) return 1; // Not Warped, but killed
+ if( map->id2md(id) == NULL ) return 1; // Not Warped, but killed
break;
}
@@ -1037,8 +1029,8 @@ int npc_check_areanpc(int flag, int16 m, int16 x, int16 y, int16 range) {
//First check for npc_cells on the range given
i = 0;
for (ys = y0; ys <= y1 && !i; ys++) {
- for(xs = x0; xs <= x1 && !i; xs++){
- if (iMap->getcell(m,xs,ys,CELL_CHKNPC))
+ for(xs = x0; xs <= x1 && !i; xs++) {
+ if (map->getcell(m,xs,ys,CELL_CHKNPC))
i = 1;
}
}
@@ -1191,8 +1183,8 @@ int npc_scriptcont(struct map_session_data* sd, int id, bool closing)
nullpo_retr(1, sd);
if( id != sd->npc_id ){
- TBL_NPC* nd_sd=(TBL_NPC*)iMap->id2bl(sd->npc_id);
- TBL_NPC* nd=(TBL_NPC*)iMap->id2bl(id);
+ TBL_NPC* nd_sd=(TBL_NPC*)map->id2bl(sd->npc_id);
+ TBL_NPC* nd=(TBL_NPC*)map->id2bl(id);
ShowDebug("npc_scriptcont: %s (sd->npc_id=%d) is not %s (id=%d).\n",
nd_sd?(char*)nd_sd->name:"'Unknown NPC'", (int)sd->npc_id,
nd?(char*)nd->name:"'Unknown NPC'", (int)id);
@@ -1200,7 +1192,7 @@ int npc_scriptcont(struct map_session_data* sd, int id, bool closing)
}
if(id != npc->fake_nd->bl.id) { // Not item script
- if ((npc->checknear(sd,iMap->id2bl(id))) == NULL){
+ if ((npc->checknear(sd,map->id2bl(id))) == NULL){
ShowWarning("npc_scriptcont: failed npc->checknear test.\n");
return 1;
}
@@ -1232,13 +1224,12 @@ int npc_scriptcont(struct map_session_data* sd, int id, bool closing)
/*==========================================
* Chk if valid call then open buy or selling list
*------------------------------------------*/
-int npc_buysellsel(struct map_session_data* sd, int id, int type)
-{
+int npc_buysellsel(struct map_session_data* sd, int id, int type) {
struct npc_data *nd;
nullpo_retr(1, sd);
- if ((nd = npc->checknear(sd,iMap->id2bl(id))) == NULL)
+ if ((nd = npc->checknear(sd,map->id2bl(id))) == NULL)
return 1;
if (nd->subtype!=SHOP) {
@@ -1268,83 +1259,77 @@ int npc_buysellsel(struct map_session_data* sd, int id, int type)
/*==========================================
* Cash Shop Buy List
*------------------------------------------*/
-int npc_cashshop_buylist(struct map_session_data *sd, int points, int count, unsigned short* item_list)
-{
- int i, j, nameid, amount, new_, w, vt;
- struct npc_data *nd = (struct npc_data *)iMap->id2bl(sd->npc_shopid);
-
- if( !nd || nd->subtype != CASHSHOP )
- return 1;
-
- if( sd->state.trading )
- return 4;
-
- new_ = 0;
- w = 0;
- vt = 0; // Global Value
-
- // Validating Process ----------------------------------------------------
- for( i = 0; i < count; i++ )
- {
- nameid = item_list[i*2+1];
- amount = item_list[i*2+0];
-
- if( !itemdb->exists(nameid) || amount <= 0 )
- return 5;
-
- ARR_FIND(0,nd->u.shop.count,j,nd->u.shop.shop_item[j].nameid == nameid);
- if( j == nd->u.shop.count || nd->u.shop.shop_item[j].value <= 0 )
- return 5;
-
- if( !itemdb->isstackable(nameid) && amount > 1 )
- {
- ShowWarning("Player %s (%d:%d) sent a hexed packet trying to buy %d of nonstackable item %d!\n", sd->status.name, sd->status.account_id, sd->status.char_id, amount, nameid);
- amount = item_list[i*2+0] = 1;
- }
-
- switch( pc->checkadditem(sd,nameid,amount) )
- {
- case ADDITEM_NEW:
- new_++;
- break;
- case ADDITEM_OVERAMOUNT:
- return 3;
- }
-
- vt += nd->u.shop.shop_item[j].value * amount;
- w += itemdb_weight(nameid) * amount;
- }
-
- if( w + sd->weight > sd->max_weight )
- return 3;
- if( pc->inventoryblank(sd) < new_ )
- return 3;
- if( points > vt ) points = vt;
-
- // Payment Process ----------------------------------------------------
- if( sd->kafraPoints < points || sd->cashPoints < (vt - points) )
- return 6;
- pc->paycash(sd,vt,points);
-
- // Delivery Process ----------------------------------------------------
- for( i = 0; i < count; i++ )
- {
- struct item item_tmp;
-
- nameid = item_list[i*2+1];
- amount = item_list[i*2+0];
-
- memset(&item_tmp,0,sizeof(item_tmp));
-
- if( !pet->create_egg(sd,nameid) )
- {
- item_tmp.nameid = nameid;
- item_tmp.identify = 1;
- pc->additem(sd,&item_tmp,amount,LOG_TYPE_NPC);
- }
- }
-
- return 0;
+int npc_cashshop_buylist(struct map_session_data *sd, int points, int count, unsigned short* item_list) {
+ int i, j, nameid, amount, new_, w, vt;
+ struct npc_data *nd = (struct npc_data *)map->id2bl(sd->npc_shopid);
+
+ if( !nd || nd->subtype != CASHSHOP )
+ return 1;
+
+ if( sd->state.trading )
+ return 4;
+
+ new_ = 0;
+ w = 0;
+ vt = 0; // Global Value
+
+ // Validating Process ----------------------------------------------------
+ for( i = 0; i < count; i++ ) {
+ nameid = item_list[i*2+1];
+ amount = item_list[i*2+0];
+
+ if( !itemdb->exists(nameid) || amount <= 0 )
+ return 5;
+
+ ARR_FIND(0,nd->u.shop.count,j,nd->u.shop.shop_item[j].nameid == nameid);
+ if( j == nd->u.shop.count || nd->u.shop.shop_item[j].value <= 0 )
+ return 5;
+
+ if( !itemdb->isstackable(nameid) && amount > 1 ) {
+ ShowWarning("Player %s (%d:%d) sent a hexed packet trying to buy %d of nonstackable item %d!\n", sd->status.name, sd->status.account_id, sd->status.char_id, amount, nameid);
+ amount = item_list[i*2+0] = 1;
+ }
+
+ switch( pc->checkadditem(sd,nameid,amount) ) {
+ case ADDITEM_NEW:
+ new_++;
+ break;
+ case ADDITEM_OVERAMOUNT:
+ return 3;
+ }
+
+ vt += nd->u.shop.shop_item[j].value * amount;
+ w += itemdb_weight(nameid) * amount;
+ }
+
+ if( w + sd->weight > sd->max_weight )
+ return 3;
+ if( pc->inventoryblank(sd) < new_ )
+ return 3;
+ if( points > vt ) points = vt;
+
+ // Payment Process ----------------------------------------------------
+ if( sd->kafraPoints < points || sd->cashPoints < (vt - points) )
+ return 6;
+ pc->paycash(sd,vt,points);
+
+ // Delivery Process ----------------------------------------------------
+ for( i = 0; i < count; i++ ) {
+ struct item item_tmp;
+
+ nameid = item_list[i*2+1];
+ amount = item_list[i*2+0];
+
+ memset(&item_tmp,0,sizeof(item_tmp));
+
+ if( !pet->create_egg(sd,nameid) ) {
+ item_tmp.nameid = nameid;
+ item_tmp.identify = 1;
+ pc->additem(sd,&item_tmp,amount,LOG_TYPE_NPC);
+ }
+ }
+
+ return 0;
}
//npc_buylist for script-controlled shops.
@@ -1375,9 +1360,8 @@ int npc_buylist_sub(struct map_session_data* sd, int n, unsigned short* item_lis
/*==========================================
* Cash Shop Buy
*------------------------------------------*/
-int npc_cashshop_buy(struct map_session_data *sd, int nameid, int amount, int points)
-{
- struct npc_data *nd = (struct npc_data *)iMap->id2bl(sd->npc_shopid);
+int npc_cashshop_buy(struct map_session_data *sd, int nameid, int amount, int points) {
+ struct npc_data *nd = (struct npc_data *)map->id2bl(sd->npc_shopid);
struct item_data *item;
int i, price, w;
@@ -1458,8 +1442,7 @@ int npc_cashshop_buy(struct map_session_data *sd, int nameid, int amount, int po
///
/// @param item_list 'n' pairs <amount,itemid>
/// @return result code for clif->parse_NpcBuyListSend
-int npc_buylist(struct map_session_data* sd, int n, unsigned short* item_list)
-{
+int npc_buylist(struct map_session_data* sd, int n, unsigned short* item_list) {
struct npc_data* nd;
double z;
int i,j,w,skill_t,new_, idx = skill->get_index(MC_DISCOUNT);
@@ -1467,7 +1450,7 @@ int npc_buylist(struct map_session_data* sd, int n, unsigned short* item_list)
nullpo_retr(3, sd);
nullpo_retr(3, item_list);
- nd = npc->checknear(sd,iMap->id2bl(sd->npc_shopid));
+ nd = npc->checknear(sd,map->id2bl(sd->npc_shopid));
if( nd == NULL )
return 3;
if( nd->subtype != SHOP )
@@ -1631,8 +1614,7 @@ int npc_selllist_sub(struct map_session_data* sd, int n, unsigned short* item_li
///
/// @param item_list 'n' pairs <index,amount>
/// @return result code for clif->parse_NpcSellListSend
-int npc_selllist(struct map_session_data* sd, int n, unsigned short* item_list)
-{
+int npc_selllist(struct map_session_data* sd, int n, unsigned short* item_list) {
double z;
int i,skill_t, idx = skill->get_index(MC_OVERCHARGE);
struct npc_data *nd;
@@ -1640,7 +1622,7 @@ int npc_selllist(struct map_session_data* sd, int n, unsigned short* item_list)
nullpo_retr(1, sd);
nullpo_retr(1, item_list);
- if( ( nd = npc->checknear(sd, iMap->id2bl(sd->npc_shopid)) ) == NULL || nd->subtype != SHOP ) {
+ if( ( nd = npc->checknear(sd, map->id2bl(sd->npc_shopid)) ) == NULL || nd->subtype != SHOP ) {
return 1;
}
@@ -1721,10 +1703,10 @@ int npc_remove_map(struct npc_data* nd) {
if(nd->bl.prev == NULL || nd->bl.m < 0)
return 1; //Not assigned to a map.
- m = nd->bl.m;
+ m = nd->bl.m;
clif->clearunit_area(&nd->bl,CLR_RESPAWN);
npc->unsetcells(nd);
- iMap->delblock(&nd->bl);
+ map->delblock(&nd->bl);
//Remove npc from maplist[].npc list. [Skotlex]
ARR_FIND( 0, maplist[m].npc_num, i, maplist[m].npc[i] == nd );
if( i == maplist[m].npc_num ) return 2; //failed to find it?
@@ -1776,9 +1758,8 @@ int npc_unload_dup_sub(struct npc_data* nd, va_list args)
}
//Removes all npcs that are duplicates of the passed one. [Skotlex]
-void npc_unload_duplicates(struct npc_data* nd)
-{
- iMap->map_foreachnpc(npc->unload_dup_sub,nd->bl.id);
+void npc_unload_duplicates(struct npc_data* nd) {
+ map->map_foreachnpc(npc->unload_dup_sub,nd->bl.id);
}
//Removes an npc from map and db.
@@ -1787,7 +1768,7 @@ int npc_unload(struct npc_data* nd, bool single) {
nullpo_ret(nd);
npc->remove_map(nd);
- iMap->deliddb(&nd->bl);
+ map->deliddb(&nd->bl);
if( single )
strdb_remove(npc->name_db, nd->exname);
@@ -2039,7 +2020,7 @@ struct npc_data* npc_add_warp(char* name, short from_mapid, short from_x, short
CREATE(nd, struct npc_data, 1);
nd->bl.id = npc->get_new_npc_id();
- iMap->addnpc(from_mapid, nd);
+ map->addnpc(from_mapid, nd);
nd->bl.prev = nd->bl.next = NULL;
nd->bl.m = from_mapid;
nd->bl.x = from_x;
@@ -2070,7 +2051,7 @@ struct npc_data* npc_add_warp(char* name, short from_mapid, short from_x, short
nd->bl.type = BL_NPC;
nd->subtype = WARP;
npc->setcells(nd);
- iMap->addblock(&nd->bl);
+ map->addblock(&nd->bl);
status->set_viewdata(&nd->bl, nd->class_);
nd->ud = &npc->base_ud;
if( maplist[nd->bl.m].users )
@@ -2097,7 +2078,7 @@ const char* npc_parse_warp(char* w1, char* w2, char* w3, char* w4, const char* s
return strchr(start,'\n');// skip and continue
}
- m = iMap->mapname2mapid(mapname);
+ m = map->mapname2mapid(mapname);
i = mapindex_name2id(to_mapname);
if( i == 0 )
{
@@ -2113,7 +2094,7 @@ const char* npc_parse_warp(char* w1, char* w2, char* w3, char* w4, const char* s
CREATE(nd, struct npc_data, 1);
nd->bl.id = npc->get_new_npc_id();
- iMap->addnpc(m, nd);
+ map->addnpc(m, nd);
nd->bl.prev = nd->bl.next = NULL;
nd->bl.m = m;
nd->bl.x = x;
@@ -2135,7 +2116,7 @@ const char* npc_parse_warp(char* w1, char* w2, char* w3, char* w4, const char* s
nd->bl.type = BL_NPC;
nd->subtype = WARP;
npc->setcells(nd);
- iMap->addblock(&nd->bl);
+ map->addblock(&nd->bl);
status->set_viewdata(&nd->bl, nd->class_);
nd->ud = &npc->base_ud;
if( maplist[nd->bl.m].users )
@@ -2168,7 +2149,7 @@ const char* npc_parse_shop(char* w1, char* w2, char* w3, char* w4, const char* s
return strchr(start,'\n');// skip and continue
}
- m = iMap->mapname2mapid(mapname);
+ m = map->mapname2mapid(mapname);
}
if( m != -1 && ( x < 0 || x >= maplist[m].xs || y < 0 || y >= maplist[m].ys ) ) {
@@ -2246,15 +2227,15 @@ const char* npc_parse_shop(char* w1, char* w2, char* w3, char* w4, const char* s
nd->bl.type = BL_NPC;
nd->subtype = type;
if( m >= 0 ) {// normal shop npc
- iMap->addnpc(m,nd);
- iMap->addblock(&nd->bl);
+ map->addnpc(m,nd);
+ map->addblock(&nd->bl);
status->set_viewdata(&nd->bl, nd->class_);
nd->ud = &npc->base_ud;
nd->dir = dir;
if( maplist[nd->bl.m].users )
clif->spawn(&nd->bl);
} else {// 'floating' shop?
- iMap->addiddb(&nd->bl);
+ map->addiddb(&nd->bl);
}
strdb_put(npc->name_db, nd->exname, nd);
@@ -2370,15 +2351,12 @@ const char* npc_parse_script(char* w1, char* w2, char* w3, char* w4, const char*
x = 0;
y = 0;
m = -1;
- }
- else
- {// npc in a map
- if( sscanf(w1, "%31[^,],%d,%d,%d", mapname, &x, &y, &dir) != 4 )
- {
+ } else {// npc in a map
+ if( sscanf(w1, "%31[^,],%d,%d,%d", mapname, &x, &y, &dir) != 4 ) {
ShowError("npc_parse_script: Invalid placement format for a script in file '%s', line '%d'. Skipping the rest of file...\n * w1=%s\n * w2=%s\n * w3=%s\n * w4=%s\n", filepath, strline(buffer,start-buffer), w1, w2, w3, w4);
return NULL;// unknown format, don't continue
}
- m = iMap->mapname2mapid(mapname);
+ m = map->mapname2mapid(mapname);
}
script_start = strstr(start,",{");
@@ -2434,19 +2412,19 @@ const char* npc_parse_script(char* w1, char* w2, char* w3, char* w4, const char*
nd->subtype = SCRIPT;
if( m >= 0 ) {
- iMap->addnpc(m, nd);
+ map->addnpc(m, nd);
nd->ud = &npc->base_ud;
nd->dir = dir;
npc->setcells(nd);
- iMap->addblock(&nd->bl);
+ map->addblock(&nd->bl);
if( class_ >= 0 ) {
status->set_viewdata(&nd->bl, nd->class_);
if( maplist[nd->bl.m].users )
clif->spawn(&nd->bl);
}
} else {
- // we skip iMap->addnpc, but still add it to the list of ID's
- iMap->addiddb(&nd->bl);
+ // we skip map->addnpc, but still add it to the list of ID's
+ map->addiddb(&nd->bl);
}
strdb_put(npc->name_db, nd->exname, nd);
@@ -2528,7 +2506,7 @@ const char* npc_parse_duplicate(char* w1, char* w2, char* w3, char* w4, const ch
ShowError("npc_parse_duplicate: Invalid placement format for duplicate in file '%s', line '%d'. Skipping line...\n * w1=%s\n * w2=%s\n * w3=%s\n * w4=%s\n", filepath, strline(buffer,start-buffer), w1, w2, w3, w4);
return end;// next line, try to continue
}
- m = iMap->mapname2mapid(mapname);
+ m = map->mapname2mapid(mapname);
}
if( m != -1 && ( x < 0 || x >= maplist[m].xs || y < 0 || y >= maplist[m].ys ) ) {
@@ -2590,19 +2568,19 @@ const char* npc_parse_duplicate(char* w1, char* w2, char* w3, char* w4, const ch
//Add the npc to its location
if( m >= 0 ) {
- iMap->addnpc(m, nd);
+ map->addnpc(m, nd);
nd->ud = &npc->base_ud;
nd->dir = dir;
npc->setcells(nd);
- iMap->addblock(&nd->bl);
+ map->addblock(&nd->bl);
if( class_ >= 0 ) {
status->set_viewdata(&nd->bl, nd->class_);
if( maplist[nd->bl.m].users )
clif->spawn(&nd->bl);
}
} else {
- // we skip iMap->addnpc, but still add it to the list of ID's
- iMap->addiddb(&nd->bl);
+ // we skip map->addnpc, but still add it to the list of ID's
+ map->addiddb(&nd->bl);
}
strdb_put(npc->name_db, nd->exname, nd);
@@ -2638,7 +2616,7 @@ int npc_duplicate4instance(struct npc_data *snd, int16 m) {
if( snd->subtype == WARP ) { // Adjust destination, if instanced
struct npc_data *wnd = NULL; // New NPC
- int dm = iMap->mapindex2mapid(snd->u.warp.mapindex), im;
+ int dm = map->mapindex2mapid(snd->u.warp.mapindex), im;
if( dm < 0 ) return 1;
if( ( im = instance->mapid2imapid(dm, maplist[m].instance_id) ) == -1 ) {
@@ -2648,7 +2626,7 @@ int npc_duplicate4instance(struct npc_data *snd, int16 m) {
CREATE(wnd, struct npc_data, 1);
wnd->bl.id = npc->get_new_npc_id();
- iMap->addnpc(m, wnd);
+ map->addnpc(m, wnd);
wnd->bl.prev = wnd->bl.next = NULL;
wnd->bl.m = m;
wnd->bl.x = snd->bl.x;
@@ -2665,7 +2643,7 @@ int npc_duplicate4instance(struct npc_data *snd, int16 m) {
wnd->bl.type = BL_NPC;
wnd->subtype = WARP;
npc->setcells(wnd);
- iMap->addblock(&wnd->bl);
+ map->addblock(&wnd->bl);
status->set_viewdata(&wnd->bl, wnd->class_);
wnd->ud = &npc->base_ud;
if( maplist[wnd->bl.m].users )
@@ -2713,7 +2691,7 @@ void npc_setcells(struct npc_data* nd) {
for (i = y-ys; i <= y+ys; i++) {
for (j = x-xs; j <= x+xs; j++) {
- if (iMap->getcell(m, j, i, CELL_CHKNOPASS))
+ if (map->getcell(m, j, i, CELL_CHKNOPASS))
continue;
maplist[m].setcell(m, j, i, CELL_NPC, true);
}
@@ -2745,10 +2723,10 @@ void npc_unsetcells(struct npc_data* nd) {
//Locate max range on which we can locate npc cells
//FIXME: does this really do what it's supposed to do? [ultramage]
- for(x0 = x-xs; x0 > 0 && iMap->getcell(m, x0, y, CELL_CHKNPC); x0--);
- for(x1 = x+xs; x1 < maplist[m].xs-1 && iMap->getcell(m, x1, y, CELL_CHKNPC); x1++);
- for(y0 = y-ys; y0 > 0 && iMap->getcell(m, x, y0, CELL_CHKNPC); y0--);
- for(y1 = y+ys; y1 < maplist[m].ys-1 && iMap->getcell(m, x, y1, CELL_CHKNPC); y1++);
+ for(x0 = x-xs; x0 > 0 && map->getcell(m, x0, y, CELL_CHKNPC); x0--);
+ for(x1 = x+xs; x1 < maplist[m].xs-1 && map->getcell(m, x1, y, CELL_CHKNPC); x1++);
+ for(y0 = y-ys; y0 > 0 && map->getcell(m, x, y0, CELL_CHKNPC); y0--);
+ for(y1 = y+ys; y1 < maplist[m].ys-1 && map->getcell(m, x, y1, CELL_CHKNPC); y1++);
//Erase this npc's cells
for (i = y-ys; i <= y+ys; i++)
@@ -2756,7 +2734,7 @@ void npc_unsetcells(struct npc_data* nd) {
maplist[m].setcell(m, j, i, CELL_NPC, false);
//Re-deploy NPC cells for other nearby npcs.
- iMap->foreachinarea( npc->unsetcells_sub, m, x0, y0, x1, y1, BL_NPC, nd->bl.id );
+ map->foreachinarea( npc->unsetcells_sub, m, x0, y0, x1, y1, BL_NPC, nd->bl.id );
}
void npc_movenpc(struct npc_data* nd, int16 x, int16 y)
@@ -2767,9 +2745,9 @@ void npc_movenpc(struct npc_data* nd, int16 x, int16 y)
x = cap_value(x, 0, maplist[m].xs-1);
y = cap_value(y, 0, maplist[m].ys-1);
- iMap->foreachinrange(clif->outsight, &nd->bl, AREA_SIZE, BL_PC, &nd->bl);
- iMap->moveblock(&nd->bl, x, y, timer->gettick());
- iMap->foreachinrange(clif->insight, &nd->bl, AREA_SIZE, BL_PC, &nd->bl);
+ map->foreachinrange(clif->outsight, &nd->bl, AREA_SIZE, BL_PC, &nd->bl);
+ map->moveblock(&nd->bl, x, y, timer->gettick());
+ map->foreachinrange(clif->insight, &nd->bl, AREA_SIZE, BL_PC, &nd->bl);
}
/// Changes the display name of the npc.
@@ -2948,7 +2926,7 @@ const char* npc_parse_mob(char* w1, char* w2, char* w3, char* w4, const char* st
ShowError("npc_parse_mob: Unknown map '%s' in file '%s', line '%d'.\n", mapname, filepath, strline(buffer,start-buffer));
return strchr(start,'\n');// skip and continue
}
- m = iMap->mapname2mapid(mapname);
+ m = map->mapname2mapid(mapname);
if( m < 0 )//Not loaded on this map-server instance.
return strchr(start,'\n');// skip and continue
mobspawn.m = (unsigned short)m;
@@ -3059,7 +3037,7 @@ const char* npc_parse_mob(char* w1, char* w2, char* w3, char* w4, const char* st
memcpy(data, &mobspawn, sizeof(struct spawn_data));
// spawn / cache the new mobs
- if( battle_config.dynamic_mobs && iMap->addmobtolist(data->m, data) >= 0 ) {
+ if( battle_config.dynamic_mobs && map->addmobtolist(data->m, data) >= 0 ) {
data->state.dynamic = true;
npc_cache_mob += data->num;
@@ -3095,9 +3073,8 @@ const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, const char
ShowError("npc_parse_mapflag: Invalid mapflag definition in file '%s', line '%d'.\n * w1=%s\n * w2=%s\n * w3=%s\n * w4=%s\n", filepath, strline(buffer,start-buffer), w1, w2, w3, w4);
return strchr(start,'\n');// skip and continue
}
- m = iMap->mapname2mapid(mapname);
- if( m < 0 )
- {
+ m = map->mapname2mapid(mapname);
+ if( m < 0 ) {
ShowWarning("npc_parse_mapflag: Unknown map in file '%s', line '%d' : %s\n * w1=%s\n * w2=%s\n * w3=%s\n * w4=%s\n", mapname, filepath, strline(buffer,start-buffer), w1, w2, w3, w4);
return strchr(start,'\n');// skip and continue
}
@@ -3164,7 +3141,7 @@ const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, const char
ShowWarning("npc_parse_mapflag: You can't set PvP and BattleGround flags for the same map! Removing BattleGround flag from %s (file '%s', line '%d').\n", maplist[m].name, filepath, strline(buffer,start-buffer));
}
if( state && (zone = strdb_get(zone_db, MAP_ZONE_PVP_NAME)) && maplist[m].zone != zone ) {
- iMap->zone_change(m,zone,start,buffer,filepath);
+ map->zone_change(m,zone,start,buffer,filepath);
} else if ( !state ) {
maplist[m].zone = &map_zone_pk;
}
@@ -3214,7 +3191,7 @@ const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, const char
ShowWarning("npc_parse_mapflag: You can't set GvG and BattleGround flags for the same map! Removing BattleGround flag from %s (file '%s', line '%d').\n", maplist[m].name, filepath, strline(buffer,start-buffer));
}
if( state && (zone = strdb_get(zone_db, MAP_ZONE_GVG_NAME)) && maplist[m].zone != zone ) {
- iMap->zone_change(m,zone,start,buffer,filepath);
+ map->zone_change(m,zone,start,buffer,filepath);
}
}
else if (!strcmpi(w3,"gvg_noparty"))
@@ -3249,7 +3226,7 @@ const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, const char
}
if( state && (zone = strdb_get(zone_db, MAP_ZONE_BG_NAME)) && maplist[m].zone != zone ) {
- iMap->zone_change(m,zone,start,buffer,filepath);
+ map->zone_change(m,zone,start,buffer,filepath);
}
}
else if (!strcmpi(w3,"noexppenalty"))
@@ -3444,7 +3421,7 @@ const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, const char
if( !(zone = strdb_get(zone_db, w4)) ) {
ShowWarning("npc_parse_mapflag: Invalid zone '%s'! removing flag from %s (file '%s', line '%d').\n", w4, maplist[m].name, filepath, strline(buffer,start-buffer));
} else if( maplist[m].zone != zone ) {
- iMap->zone_change(m,zone,start,buffer,filepath);
+ map->zone_change(m,zone,start,buffer,filepath);
}
} else if ( !strcmpi(w3,"nomapchannelautojoin") ) {
maplist[m].flag.chsysnolocalaj = state;
@@ -3570,9 +3547,9 @@ void npc_parsesrcfile(const char* filepath, bool runOnInit)
p = strchr(p,'\n');// next line
continue;
}
- m = iMap->mapname2mapid(mapname);
- if( m < 0 )
- {// "mapname" is not assigned to this server, we must skip the script info...
+ m = map->mapname2mapid(mapname);
+ if( m < 0 ) {
+ // "mapname" is not assigned to this server, we must skip the script info...
if( strcasecmp(w2,"script") == 0 && count > 3 )
{
if((p = npc->skip_script(p,buffer,filepath)) == NULL)
@@ -3765,7 +3742,7 @@ int npc_reload(void) {
mapit->free(iter);
if(battle_config.dynamic_mobs) {// dynamic check by [random]
- for (m = 0; m < iMap->map_num; m++) {
+ for (m = 0; m < map->map_num; m++) {
for (i = 0; i < MAX_MOB_LIST_PER_MAP; i++) {
if (maplist[m].moblist[i] != NULL) {
aFree(maplist[m].moblist[i]);
@@ -3773,7 +3750,7 @@ int npc_reload(void) {
}
if( maplist[m].mob_delete_timer != INVALID_TIMER )
{ // Mobs were removed anyway,so delete the timer [Inkfish]
- timer->delete(maplist[m].mob_delete_timer, iMap->removemobs_timer);
+ timer->delete(maplist[m].mob_delete_timer, map->removemobs_timer);
maplist[m].mob_delete_timer = INVALID_TIMER;
}
}
@@ -3789,7 +3766,7 @@ int npc_reload(void) {
npc_mob = npc_cache_mob = npc_delay_mob = 0;
// reset mapflags
- iMap->flags_init();
+ map->flags_init();
//TODO: the following code is copy-pasted from do_init_npc(); clean it up
// Reloading npcs now
@@ -3812,7 +3789,7 @@ int npc_reload(void) {
instance->destroy(i);
}
- iMap->zone_init();
+ map->zone_init();
npc->motd = npc->name2id("HerculesMOTD"); /* [Ind/Hercules] */
@@ -3876,24 +3853,23 @@ int do_final_npc(void) {
return 0;
}
-void npc_debug_warps_sub(struct npc_data* nd)
-{
+void npc_debug_warps_sub(struct npc_data* nd) {
int16 m;
if (nd->bl.type != BL_NPC || nd->subtype != WARP || nd->bl.m < 0)
return;
- m = iMap->mapindex2mapid(nd->u.warp.mapindex);
+ m = map->mapindex2mapid(nd->u.warp.mapindex);
if (m < 0) return; //Warps to another map, nothing to do about it.
if (nd->u.warp.x == 0 && nd->u.warp.y == 0) return; // random warp
- if (iMap->getcell(m, nd->u.warp.x, nd->u.warp.y, CELL_CHKNPC)) {
+ if (map->getcell(m, nd->u.warp.x, nd->u.warp.y, CELL_CHKNPC)) {
ShowWarning("Warp %s at %s(%d,%d) warps directly on top of an area npc at %s(%d,%d)\n",
nd->name,
maplist[nd->bl.m].name, nd->bl.x, nd->bl.y,
maplist[m].name, nd->u.warp.x, nd->u.warp.y
);
}
- if (iMap->getcell(m, nd->u.warp.x, nd->u.warp.y, CELL_CHKNOPASS)) {
+ if (map->getcell(m, nd->u.warp.x, nd->u.warp.y, CELL_CHKNOPASS)) {
ShowWarning("Warp %s at %s(%d,%d) warps to a non-walkable tile at %s(%d,%d)\n",
nd->name,
maplist[nd->bl.m].name, nd->bl.x, nd->bl.y,
@@ -3904,7 +3880,7 @@ void npc_debug_warps_sub(struct npc_data* nd)
static void npc_debug_warps(void) {
int16 m, i;
- for (m = 0; m < iMap->map_num; m++)
+ for (m = 0; m < map->map_num; m++)
for (i = 0; i < maplist[m].npc_num; i++)
npc->debug_warps_sub(maplist[m].npc[i]);
}
@@ -3963,7 +3939,7 @@ int do_init_npc(void)
itemdb->name_constants();
- iMap->zone_init();
+ map->zone_init();
npc->motd = npc->name2id("HerculesMOTD"); /* [Ind/Hercules] */
@@ -3993,7 +3969,7 @@ int do_init_npc(void)
strdb_put(npc->name_db, npc->fake_nd->exname, npc->fake_nd);
npc->fake_nd->u.scr.timerid = INVALID_TIMER;
- iMap->addiddb(&npc->fake_nd->bl);
+ map->addiddb(&npc->fake_nd->bl);
// End of initialization
return 0;
diff --git a/src/map/npc_chat.c b/src/map/npc_chat.c
index 848347888..1372fff21 100644
--- a/src/map/npc_chat.c
+++ b/src/map/npc_chat.c
@@ -379,7 +379,7 @@ BUILDIN(defpattern) {
int setid = script_getnum(st,2);
const char* pattern = script_getstr(st,3);
const char* label = script_getstr(st,4);
- struct npc_data* nd = (struct npc_data *)iMap->id2bl(st->oid);
+ struct npc_data* nd = (struct npc_data *)map->id2bl(st->oid);
npc_chat->def_pattern(nd, setid, pattern, label);
@@ -388,7 +388,7 @@ BUILDIN(defpattern) {
BUILDIN(activatepset) {
int setid = script_getnum(st,2);
- struct npc_data* nd = (struct npc_data *)iMap->id2bl(st->oid);
+ struct npc_data* nd = (struct npc_data *)map->id2bl(st->oid);
npc_chat->activate_pcreset(nd, setid);
@@ -397,7 +397,7 @@ BUILDIN(activatepset) {
BUILDIN(deactivatepset) {
int setid = script_getnum(st,2);
- struct npc_data* nd = (struct npc_data *)iMap->id2bl(st->oid);
+ struct npc_data* nd = (struct npc_data *)map->id2bl(st->oid);
npc_chat->deactivate_pcreset(nd, setid);
@@ -406,7 +406,7 @@ BUILDIN(deactivatepset) {
BUILDIN(deletepset) {
int setid = script_getnum(st,2);
- struct npc_data* nd = (struct npc_data *)iMap->id2bl(st->oid);
+ struct npc_data* nd = (struct npc_data *)map->id2bl(st->oid);
npc_chat->delete_pcreset(nd, setid);
diff --git a/src/map/party.c b/src/map/party.c
index 2682cf03b..a4eb38629 100644
--- a/src/map/party.c
+++ b/src/map/party.c
@@ -84,9 +84,8 @@ struct map_session_data* party_getavailablesd(struct party_data *p)
* Retrieves and validates the sd pointer for this party member [Skotlex]
*------------------------------------------*/
-static TBL_PC* party_sd_check(int party_id, int account_id, int char_id)
-{
- TBL_PC* sd = iMap->id2sd(account_id);
+static TBL_PC* party_sd_check(int party_id, int account_id, int char_id) {
+ TBL_PC* sd = map->id2sd(account_id);
if (!(sd && sd->status.char_id == char_id))
return NULL;
@@ -179,13 +178,12 @@ int party_create(struct map_session_data *sd,char *name,int item,int item2)
}
-void party_created(int account_id,int char_id,int fail,int party_id,char *name)
-{
+void party_created(int account_id,int char_id,int fail,int party_id,char *name) {
struct map_session_data *sd;
- sd=iMap->id2sd(account_id);
+ sd=map->id2sd(account_id);
- if (!sd || sd->status.char_id != char_id || !sd->party_creating )
- { //Character logged off before creation ack?
+ if (!sd || sd->status.char_id != char_id || !sd->party_creating ) {
+ //Character logged off before creation ack?
if (!fail) //break up party since player could not be added to it.
intif->party_leave(party_id,account_id,char_id);
return;
@@ -209,13 +207,12 @@ int party_request_info(int party_id, int char_id)
}
/// Invoked (from char-server) when the party info is not found.
-int party_recv_noinfo(int party_id, int char_id)
-{
+int party_recv_noinfo(int party_id, int char_id) {
party->broken(party_id);
- if( char_id != 0 )// requester
- {
+ if( char_id != 0 ) {
+ // requester
struct map_session_data* sd;
- sd = iMap->charid2sd(char_id);
+ sd = map->charid2sd(char_id);
if( sd && sd->status.party_id == party_id )
sd->status.party_id = 0;
}
@@ -329,9 +326,9 @@ int party_recv_info(struct party* sp, int char_id)
}
}
}
- if( char_id != 0 )// requester
- {
- sd = iMap->charid2sd(char_id);
+ if( char_id != 0 ) {
+ // requester
+ sd = map->charid2sd(char_id);
if( sd && sd->status.party_id == sp->party_id && party->getmemberid(p,sd) == -1 )
sd->status.party_id = 0;// was not in the party
}
@@ -400,8 +397,7 @@ int party_invite(struct map_session_data *sd,struct map_session_data *tsd)
return 1;
}
-void party_reply_invite(struct map_session_data *sd,int party_id,int flag)
-{
+void party_reply_invite(struct map_session_data *sd,int party_id,int flag) {
struct map_session_data* tsd;
struct party_member member;
@@ -411,7 +407,7 @@ void party_reply_invite(struct map_session_data *sd,int party_id,int flag)
sd->party_invite_account = 0;
return;
}
- tsd = iMap->id2sd(sd->party_invite_account);
+ tsd = map->id2sd(sd->party_invite_account);
if( flag == 1 && !sd->party_creating && !sd->party_joining )
{// accepted and allowed
@@ -458,9 +454,8 @@ void party_member_joined(struct map_session_data *sd)
/// Invoked (from char-server) when a new member is added to the party.
/// flag: 0-success, 1-failure
-int party_member_added(int party_id,int account_id,int char_id, int flag)
-{
- struct map_session_data *sd = iMap->id2sd(account_id),*sd2;
+int party_member_added(int party_id,int account_id,int char_id, int flag) {
+ struct map_session_data *sd = map->id2sd(account_id),*sd2;
struct party_data *p = party->search(party_id);
int i, j;
@@ -470,7 +465,7 @@ int party_member_added(int party_id,int account_id,int char_id, int flag)
return 0;
}
- sd2 = iMap->id2sd(sd->party_invite_account);
+ sd2 = map->id2sd(sd->party_invite_account);
sd->party_joining = false;
sd->party_invite = 0;
@@ -565,7 +560,7 @@ int party_leave(struct map_session_data *sd)
/// Invoked (from char-server) when a party member leaves the party.
int party_member_withdraw(int party_id, int account_id, int char_id)
{
- struct map_session_data* sd = iMap->id2sd(account_id);
+ struct map_session_data* sd = map->id2sd(account_id);
struct party_data* p = party->search(party_id);
if( p ) {
@@ -634,10 +629,9 @@ int party_changeoption(struct map_session_data *sd,int exp,int item)
return 0;
}
-int party_optionchanged(int party_id,int account_id,int exp,int item,int flag)
-{
+int party_optionchanged(int party_id,int account_id,int exp,int item,int flag) {
struct party_data *p;
- struct map_session_data *sd=iMap->id2sd(account_id);
+ struct map_session_data *sd=map->id2sd(account_id);
if( (p=party->search(party_id))==NULL)
return 0;
@@ -1099,17 +1093,16 @@ int party_foreachsamemap(int (*func)(struct block_list*,va_list),struct map_sess
list[blockcount++]=&psd->bl;
}
- iMap->freeblock_lock();
+ map->freeblock_lock();
- for(i=0;i<blockcount;i++)
- {
+ for(i=0;i<blockcount;i++) {
va_list ap;
va_start(ap, range);
total += func(list[i], ap);
va_end(ap);
}
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return total;
}
diff --git a/src/map/pc.c b/src/map/pc.c
index 9dbb5175a..e88bdb2f1 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -156,11 +156,10 @@ bool pc_should_log_commands(struct map_session_data *sd)
return pc_group_should_log_commands(sd->group);
}
-static int pc_invincible_timer(int tid, unsigned int tick, int id, intptr_t data)
-{
+static int pc_invincible_timer(int tid, unsigned int tick, int id, intptr_t data) {
struct map_session_data *sd;
- if( (sd=(struct map_session_data *)iMap->id2sd(id)) == NULL || sd->bl.type!=BL_PC )
+ if( (sd=(struct map_session_data *)map->id2sd(id)) == NULL || sd->bl.type!=BL_PC )
return 1;
if(sd->invincible_timer != tid){
@@ -195,12 +194,11 @@ void pc_delinvincibletimer(struct map_session_data* sd)
}
}
-static int pc_spiritball_timer(int tid, unsigned int tick, int id, intptr_t data)
-{
+static int pc_spiritball_timer(int tid, unsigned int tick, int id, intptr_t data) {
struct map_session_data *sd;
int i;
- if( (sd=(struct map_session_data *)iMap->id2sd(id)) == NULL || sd->bl.type!=BL_PC )
+ if( (sd=(struct map_session_data *)map->id2sd(id)) == NULL || sd->bl.type!=BL_PC )
return 1;
if( sd->spiritball <= 0 )
@@ -356,9 +354,8 @@ int pc_banding(struct map_session_data *sd, uint16 skill_lv) {
i++;
// Get total HP of all Royal Guards in party.
- for( j = 0; j < i; j++ )
- {
- bsd = iMap->id2sd(b_sd[j]);
+ for( j = 0; j < i; j++ ) {
+ bsd = map->id2sd(b_sd[j]);
if( bsd != NULL )
hp += status_get_hp(&bsd->bl);
}
@@ -367,9 +364,8 @@ int pc_banding(struct map_session_data *sd, uint16 skill_lv) {
hp = hp / i;
// If a Royal Guard have full HP, give more HP to others that haven't full HP.
- for( j = 0; j < i; j++ )
- {
- bsd = iMap->id2sd(b_sd[j]);
+ for( j = 0; j < i; j++ ) {
+ bsd = map->id2sd(b_sd[j]);
if( bsd != NULL && (tmp_hp = hp - status_get_max_hp(&bsd->bl)) > 0 )
{
extra_hp += tmp_hp;
@@ -380,9 +376,8 @@ int pc_banding(struct map_session_data *sd, uint16 skill_lv) {
if( extra_hp > 0 && tmp_qty > 0 )
hp += extra_hp / tmp_qty;
- for( j = 0; j < i; j++ )
- {
- bsd = iMap->id2sd(b_sd[j]);
+ for( j = 0; j < i; j++ ) {
+ bsd = map->id2sd(b_sd[j]);
if( bsd != NULL ) {
status->set_hp(&bsd->bl,hp,0); // Set hp
if( (sc = status->get_sc(&bsd->bl)) != NULL && sc->data[SC_BANDING] ) {
@@ -463,9 +458,8 @@ int pc_setrestartvalue(struct map_session_data *sd,int type) {
/*==========================================
Rental System
*------------------------------------------*/
-static int pc_inventory_rental_end(int tid, unsigned int tick, int id, intptr_t data)
-{
- struct map_session_data *sd = iMap->id2sd(id);
+static int pc_inventory_rental_end(int tid, unsigned int tick, int id, intptr_t data) {
+ struct map_session_data *sd = map->id2sd(id);
if( sd == NULL )
return 0;
if( tid != sd->rental_timer )
@@ -1153,7 +1147,7 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim
if (expiration_time != 0) { // don't display if it's unlimited or unknow value
char tmpstr[1024];
strftime(tmpstr, sizeof(tmpstr) - 1, msg_txt(501), localtime(&expiration_time)); // "Your account time limit is: %d-%m-%Y %H:%M:%S."
- clif->wis_message(sd->fd, iMap->wisp_server_name, tmpstr, strlen(tmpstr)+1);
+ clif->wis_message(sd->fd, map->wisp_server_name, tmpstr, strlen(tmpstr)+1);
}
/**
@@ -1244,7 +1238,7 @@ int pc_reg_received(struct map_session_data *sd)
for(i=0;i<MAX_PC_FEELHATE;i++) { //for now - someone need to make reading from txt/sql
if ((j = pc_readglobalreg(sd,sg_info[i].feel_var))!=0) {
sd->feel_map[i].index = j;
- sd->feel_map[i].m = iMap->mapindex2mapid(j);
+ sd->feel_map[i].m = map->mapindex2mapid(j);
} else {
sd->feel_map[i].index = 0;
sd->feel_map[i].m = -1;
@@ -1294,8 +1288,8 @@ int pc_reg_received(struct map_session_data *sd)
if( sd->status.ele_id > 0 )
intif->elemental_request(sd->status.ele_id, sd->status.char_id);
- iMap->addiddb(&sd->bl);
- iMap->delnickdb(sd->status.char_id, sd->status.name);
+ map->addiddb(&sd->bl);
+ map->delnickdb(sd->status.char_id, sd->status.name);
if (!chrif->auth_finished(sd))
ShowError("pc_reg_received: Failed to properly remove player %d:%d from logging db!\n", sd->status.account_id, sd->status.char_id);
@@ -1757,7 +1751,7 @@ int pc_disguise(struct map_session_data *sd, int class_) {
if (sd->chatID) {
struct chat_data* cd;
nullpo_retr(1, sd);
- cd = (struct chat_data*)iMap->id2bl(sd->chatID);
+ cd = (struct chat_data*)map->id2bl(sd->chatID);
if( cd != NULL || (struct block_list*)sd == cd->owner )
clif->dispchat(cd,0);
}
@@ -2016,9 +2010,8 @@ int pc_exeautobonus(struct map_session_data *sd,struct s_autobonus *autobonus)
return 0;
}
-int pc_endautobonus(int tid, unsigned int tick, int id, intptr_t data)
-{
- struct map_session_data *sd = iMap->id2sd(id);
+int pc_endautobonus(int tid, unsigned int tick, int id, intptr_t data) {
+ struct map_session_data *sd = map->id2sd(id);
struct s_autobonus *autobonus = (struct s_autobonus *)data;
nullpo_ret(sd);
@@ -4055,7 +4048,7 @@ int pc_dropitem(struct map_session_data *sd,int n,int amount)
return 0;
}
- if (!iMap->addflooritem(&sd->status.inventory[n], amount, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 2))
+ if (!map->addflooritem(&sd->status.inventory[n], amount, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 2))
return 0;
pc->delitem(sd, n, amount, 1, 0, LOG_TYPE_PICKDROP_PLAYER);
@@ -4085,9 +4078,8 @@ int pc_takeitem(struct map_session_data *sd,struct flooritem_data *fitem)
if (sd->status.party_id)
p = party->search(sd->status.party_id);
- if(fitem->first_get_charid > 0 && fitem->first_get_charid != sd->status.char_id)
- {
- first_sd = iMap->charid2sd(fitem->first_get_charid);
+ if(fitem->first_get_charid > 0 && fitem->first_get_charid != sd->status.char_id) {
+ first_sd = map->charid2sd(fitem->first_get_charid);
if(DIFF_TICK(tick,fitem->first_get_tick) < 0) {
if (!(p && p->party.item&1 &&
first_sd && first_sd->status.party_id == sd->status.party_id
@@ -4095,9 +4087,8 @@ int pc_takeitem(struct map_session_data *sd,struct flooritem_data *fitem)
return 0;
}
else
- if(fitem->second_get_charid > 0 && fitem->second_get_charid != sd->status.char_id)
- {
- second_sd = iMap->charid2sd(fitem->second_get_charid);
+ if(fitem->second_get_charid > 0 && fitem->second_get_charid != sd->status.char_id) {
+ second_sd = map->charid2sd(fitem->second_get_charid);
if(DIFF_TICK(tick, fitem->second_get_tick) < 0) {
if(!(p && p->party.item&1 &&
((first_sd && first_sd->status.party_id == sd->status.party_id) ||
@@ -4106,9 +4097,8 @@ int pc_takeitem(struct map_session_data *sd,struct flooritem_data *fitem)
return 0;
}
else
- if(fitem->third_get_charid > 0 && fitem->third_get_charid != sd->status.char_id)
- {
- third_sd = iMap->charid2sd(fitem->third_get_charid);
+ if(fitem->third_get_charid > 0 && fitem->third_get_charid != sd->status.char_id) {
+ third_sd = map->charid2sd(fitem->third_get_charid);
if(DIFF_TICK(tick,fitem->third_get_tick) < 0) {
if(!(p && p->party.item&1 &&
((first_sd && first_sd->status.party_id == sd->status.party_id) ||
@@ -4130,7 +4120,7 @@ int pc_takeitem(struct map_session_data *sd,struct flooritem_data *fitem)
//Display pickup animation.
pc_stop_attack(sd);
clif->takeitem(&sd->bl,&fitem->bl);
- iMap->clearflooritem(&fitem->bl);
+ map->clearflooritem(&fitem->bl);
return 1;
}
@@ -4783,7 +4773,7 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y
nullpo_ret(sd);
- if( !mapindex || !mapindex_id2name(mapindex) || ( m = iMap->mapindex2mapid(mapindex) ) == -1 ) {
+ if( !mapindex || !mapindex_id2name(mapindex) || ( m = map->mapindex2mapid(mapindex) ) == -1 ) {
ShowDebug("pc_setpos: Passed mapindex(%d) is invalid!\n", mapindex);
return 1;
}
@@ -4858,7 +4848,7 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y
}
if( maplist[m].cell == (struct mapcell *)0xdeadbeaf )
- iMap->cellfromcache(&maplist[m]);
+ map->cellfromcache(&maplist[m]);
if (sd->sc.count) { // Cancel some map related stuff.
if (sd->sc.data[SC_JAILED])
return 1; //You may not get out!
@@ -4905,7 +4895,7 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y
uint32 ip;
uint16 port;
//if can't find any map-servers, just abort setting position.
- if(!sd->mapindex || iMap->mapname2ipport(mapindex,&ip,&port))
+ if(!sd->mapindex || map->mapname2ipport(mapindex,&ip,&port))
return 2;
if (sd->npc_id)
@@ -4935,10 +4925,10 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y
do {
x=rnd()%(maplist[m].xs-2)+1;
y=rnd()%(maplist[m].ys-2)+1;
- } while(iMap->getcell(m,x,y,CELL_CHKNOPASS));
+ } while(map->getcell(m,x,y,CELL_CHKNOPASS));
}
- if (sd->state.vending && iMap->getcell(m,x,y,CELL_CHKNOVENDING)) {
+ if (sd->state.vending && map->getcell(m,x,y,CELL_CHKNOVENDING)) {
clif->message (sd->fd, msg_txt(204)); // "You can't open a shop on this cell."
vending->close(sd);
}
@@ -5006,7 +4996,7 @@ int pc_randomwarp(struct map_session_data *sd, clr_type type) {
do {
x=rnd()%(maplist[m].xs-2)+1;
y=rnd()%(maplist[m].ys-2)+1;
- } while( iMap->getcell(m,x,y,CELL_CHKNOPASS) && (i++) < 1000 );
+ } while( map->getcell(m,x,y,CELL_CHKNOPASS) && (i++) < 1000 );
if (i < 1000)
return pc->setpos(sd,map_id2index(sd->bl.m),x,y,type);
@@ -5683,7 +5673,7 @@ int pc_follow_timer(int tid, unsigned int tick, int id, intptr_t data) {
struct map_session_data *sd;
struct block_list *tbl;
- sd = iMap->id2sd(id);
+ sd = map->id2sd(id);
nullpo_ret(sd);
if (sd->followtimer != tid) {
@@ -5693,7 +5683,7 @@ int pc_follow_timer(int tid, unsigned int tick, int id, intptr_t data) {
}
sd->followtimer = INVALID_TIMER;
- tbl = iMap->id2bl(sd->followtarget);
+ tbl = map->id2bl(sd->followtarget);
if (tbl == NULL || pc_isdead(sd) || status->isdead(tbl)) {
pc->stop_following(sd);
@@ -5733,9 +5723,8 @@ int pc_stop_following (struct map_session_data *sd)
return 0;
}
-int pc_follow(struct map_session_data *sd,int target_id)
-{
- struct block_list *bl = iMap->id2bl(target_id);
+int pc_follow(struct map_session_data *sd,int target_id) {
+ struct block_list *bl = map->id2bl(target_id);
if (bl == NULL /*|| bl->type != BL_PC*/)
return 1;
if (sd->followtimer != INVALID_TIMER)
@@ -6638,9 +6627,8 @@ void pc_respawn(struct map_session_data* sd, clr_type clrtype)
clif->resurrection(&sd->bl, 1); //If warping fails, send a normal stand up packet.
}
-static int pc_respawn_timer(int tid, unsigned int tick, int id, intptr_t data)
-{
- struct map_session_data *sd = iMap->id2sd(id);
+static int pc_respawn_timer(int tid, unsigned int tick, int id, intptr_t data) {
+ struct map_session_data *sd = map->id2sd(id);
if( sd != NULL )
{
sd->pvp_point=0;
@@ -6690,7 +6678,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) {
for(k = 0; k < 5; k++)
if (sd->devotion[k]){
- struct map_session_data *devsd = iMap->id2sd(sd->devotion[k]);
+ struct map_session_data *devsd = map->id2sd(sd->devotion[k]);
if (devsd)
status_change_end(&devsd->bl, SC_DEVOTION, INVALID_TIMER);
sd->devotion[k] = 0;
@@ -6866,7 +6854,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) {
item_tmp.card[1]=0;
item_tmp.card[2]=GetWord(sd->status.char_id,0); // CharId
item_tmp.card[3]=GetWord(sd->status.char_id,1);
- iMap->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ map->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
// activate Steel body if a super novice dies at 99+% exp [celest]
@@ -7608,7 +7596,7 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper)
if (sd->state.vending)
vending->close(sd);
- iMap->foreachinmap(jobchange_killclone, sd->bl.m, BL_MOB, sd->bl.id);
+ map->foreachinmap(jobchange_killclone, sd->bl.m, BL_MOB, sd->bl.id);
//Remove peco/cart/falcon
i = sd->sc.option;
@@ -8289,9 +8277,8 @@ int pc_setregistry_str(struct map_session_data *sd,const char *reg,const char *v
/*==========================================
* Exec eventtimer for player sd (retrieved from map_session (id))
*------------------------------------------*/
-static int pc_eventtimer(int tid, unsigned int tick, int id, intptr_t data)
-{
- struct map_session_data *sd=iMap->id2sd(id);
+static int pc_eventtimer(int tid, unsigned int tick, int id, intptr_t data) {
+ struct map_session_data *sd=map->id2sd(id);
char *p = (char *)data;
int i;
if(sd==NULL)
@@ -9034,7 +9021,7 @@ int pc_calc_pvprank_sub(struct block_list *bl,va_list ap)
return 0;
}
/*==========================================
- * Calculate new rank beetween all present players (iMap->foreachinarea)
+ * Calculate new rank beetween all present players (map->foreachinarea)
* and display result
*------------------------------------------*/
int pc_calc_pvprank(struct map_session_data *sd) {
@@ -9043,7 +9030,7 @@ int pc_calc_pvprank(struct map_session_data *sd) {
m=&maplist[sd->bl.m];
old=sd->pvp_rank;
sd->pvp_rank=1;
- iMap->foreachinmap(pc_calc_pvprank_sub,sd->bl.m,BL_PC,sd);
+ map->foreachinmap(pc_calc_pvprank_sub,sd->bl.m,BL_PC,sd);
if(old!=sd->pvp_rank || sd->pvp_lastusers!=m->users_pvp)
clif->pvpset(sd,sd->pvp_rank,sd->pvp_lastusers=m->users_pvp,0);
return sd->pvp_rank;
@@ -9051,11 +9038,10 @@ int pc_calc_pvprank(struct map_session_data *sd) {
/*==========================================
* Calculate next sd ranking calculation from config
*------------------------------------------*/
-int pc_calc_pvprank_timer(int tid, unsigned int tick, int id, intptr_t data)
-{
+int pc_calc_pvprank_timer(int tid, unsigned int tick, int id, intptr_t data) {
struct map_session_data *sd;
- sd=iMap->id2sd(id);
+ sd=map->id2sd(id);
if(sd==NULL)
return 0;
sd->pvp_timer = INVALID_TIMER;
@@ -9119,8 +9105,8 @@ int pc_divorce(struct map_session_data *sd)
if( !sd->status.partner_id )
return -1; // Char is not married
- if( (p_sd = iMap->charid2sd(sd->status.partner_id)) == NULL )
- { // Lets char server do the divorce
+ if( (p_sd = map->charid2sd(sd->status.partner_id)) == NULL ) {
+ // Lets char server do the divorce
if( chrif->divorce(sd->status.char_id, sd->status.partner_id) )
return -1; // No char server connected
@@ -9147,11 +9133,10 @@ int pc_divorce(struct map_session_data *sd)
/*==========================================
* Get sd partner charid. (Married partner)
*------------------------------------------*/
-struct map_session_data *pc_get_partner(struct map_session_data *sd)
-{
+struct map_session_data *pc_get_partner(struct map_session_data *sd) {
if (sd && pc->ismarried(sd))
// charid2sd returns NULL if not found
- return iMap->charid2sd(sd->status.partner_id);
+ return map->charid2sd(sd->status.partner_id);
return NULL;
}
@@ -9159,11 +9144,10 @@ struct map_session_data *pc_get_partner(struct map_session_data *sd)
/*==========================================
* Get sd father charid. (Need to be baby)
*------------------------------------------*/
-struct map_session_data *pc_get_father (struct map_session_data *sd)
-{
+struct map_session_data *pc_get_father(struct map_session_data *sd) {
if (sd && sd->class_&JOBL_BABY && sd->status.father > 0)
// charid2sd returns NULL if not found
- return iMap->charid2sd(sd->status.father);
+ return map->charid2sd(sd->status.father);
return NULL;
}
@@ -9171,11 +9155,10 @@ struct map_session_data *pc_get_father (struct map_session_data *sd)
/*==========================================
* Get sd mother charid. (Need to be baby)
*------------------------------------------*/
-struct map_session_data *pc_get_mother (struct map_session_data *sd)
-{
+struct map_session_data *pc_get_mother(struct map_session_data *sd) {
if (sd && sd->class_&JOBL_BABY && sd->status.mother > 0)
// charid2sd returns NULL if not found
- return iMap->charid2sd(sd->status.mother);
+ return map->charid2sd(sd->status.mother);
return NULL;
}
@@ -9183,11 +9166,10 @@ struct map_session_data *pc_get_mother (struct map_session_data *sd)
/*==========================================
* Get sd children charid. (Need to be married)
*------------------------------------------*/
-struct map_session_data *pc_get_child (struct map_session_data *sd)
-{
+struct map_session_data *pc_get_child(struct map_session_data *sd) {
if (sd && pc->ismarried(sd) && sd->status.child > 0)
// charid2sd returns NULL if not found
- return iMap->charid2sd(sd->status.child);
+ return map->charid2sd(sd->status.child);
return NULL;
}
@@ -9303,18 +9285,18 @@ int pc_autosave(int tid, unsigned int tick, int id, intptr_t data)
}
mapit->free(iter);
- interval = iMap->autosave_interval/(iMap->usercount()+1);
- if(interval < iMap->minsave_interval)
- interval = iMap->minsave_interval;
+ interval = map->autosave_interval/(map->usercount()+1);
+ if(interval < map->minsave_interval)
+ interval = map->minsave_interval;
timer->add(timer->gettick()+interval,pc_autosave,0,0);
return 0;
}
static int pc_daynight_timer_sub(struct map_session_data *sd,va_list ap) {
- if (sd->state.night != iMap->night_flag && maplist[sd->bl.m].flag.nightenabled) { //Night/day state does not match.
- clif->status_change(&sd->bl, SI_SKE, iMap->night_flag, 0, 0, 0, 0); //New night effect by dynamix [Skotlex]
- sd->state.night = iMap->night_flag;
+ if (sd->state.night != map->night_flag && maplist[sd->bl.m].flag.nightenabled) { //Night/day state does not match.
+ clif->status_change(&sd->bl, SI_SKE, map->night_flag, 0, 0, 0, 0); //New night effect by dynamix [Skotlex]
+ sd->state.night = map->night_flag;
return 1;
}
return 0;
@@ -9323,18 +9305,17 @@ static int pc_daynight_timer_sub(struct map_session_data *sd,va_list ap) {
* timer to do the day [Yor]
* data: 0 = called by timer, 1 = gmcommand/script
*------------------------------------------------*/
-int map_day_timer(int tid, unsigned int tick, int id, intptr_t data)
-{
+int map_day_timer(int tid, unsigned int tick, int id, intptr_t data) {
char tmp_soutput[1024];
- if (data == 0 && battle_config.day_duration <= 0) // if we want a day
+ if (data == 0 && battle_config.day_duration <= 0) // if we want a day
return 0;
- if (!iMap->night_flag)
+ if (!map->night_flag)
return 0; //Already day.
- iMap->night_flag = 0; // 0=day, 1=night [Yor]
- iMap->map_foreachpc(pc_daynight_timer_sub);
+ map->night_flag = 0; // 0=day, 1=night [Yor]
+ map->map_foreachpc(pc_daynight_timer_sub);
strcpy(tmp_soutput, (data == 0) ? msg_txt(502) : msg_txt(60)); // The day has arrived!
intif->broadcast(tmp_soutput, strlen(tmp_soutput) + 1, BC_DEFAULT);
return 0;
@@ -9344,18 +9325,17 @@ int map_day_timer(int tid, unsigned int tick, int id, intptr_t data)
* timer to do the night [Yor]
* data: 0 = called by timer, 1 = gmcommand/script
*------------------------------------------------*/
-int map_night_timer(int tid, unsigned int tick, int id, intptr_t data)
-{
+int map_night_timer(int tid, unsigned int tick, int id, intptr_t data) {
char tmp_soutput[1024];
- if (data == 0 && battle_config.night_duration <= 0) // if we want a night
+ if (data == 0 && battle_config.night_duration <= 0) // if we want a night
return 0;
- if (iMap->night_flag)
+ if (map->night_flag)
return 0; //Already nigth.
- iMap->night_flag = 1; // 0=day, 1=night [Yor]
- iMap->map_foreachpc(pc_daynight_timer_sub);
+ map->night_flag = 1; // 0=day, 1=night [Yor]
+ map->map_foreachpc(pc_daynight_timer_sub);
strcpy(tmp_soutput, (data == 0) ? msg_txt(503) : msg_txt(59)); // The night has fallen...
intif->broadcast(tmp_soutput, strlen(tmp_soutput) + 1, BC_DEFAULT);
return 0;
@@ -9417,12 +9397,11 @@ bool pc_can_use_command(struct map_session_data *sd, const char *command) {
return atcommand->can_use(sd,command);
}
-static int pc_charm_timer(int tid, unsigned int tick, int id, intptr_t data)
-{
+static int pc_charm_timer(int tid, unsigned int tick, int id, intptr_t data) {
struct map_session_data *sd;
int i, type;
- if( (sd=(struct map_session_data *)iMap->id2sd(id)) == NULL || sd->bl.type!=BL_PC )
+ if( (sd=(struct map_session_data *)map->id2sd(id)) == NULL || sd->bl.type!=BL_PC )
return 1;
ARR_FIND(1, 5, type, sd->charm[type] > 0);
@@ -9907,11 +9886,11 @@ int pc_readdb(void) {
FILE *fp;
char line[24000],*p;
- //reset
+ //reset
memset(exp_table,0,sizeof(exp_table));
memset(max_level,0,sizeof(max_level));
- sprintf(line, "%s/"DBPATH"exp.txt", iMap->db_path);
+ sprintf(line, "%s/"DBPATH"exp.txt", map->db_path);
fp=fopen(line, "r");
if(fp==NULL){
@@ -9989,13 +9968,13 @@ int pc_readdb(void) {
if (!max_level[j][1])
ShowWarning("Class %s (%d) does not has a job exp table.\n", pc->job_name(i), i);
}
- ShowStatus("Done reading '"CL_WHITE"%lu"CL_RESET"' entries in '"CL_WHITE"%s/"DBPATH"%s"CL_RESET"'.\n",count,iMap->db_path,"exp.txt");
+ ShowStatus("Done reading '"CL_WHITE"%lu"CL_RESET"' entries in '"CL_WHITE"%s/"DBPATH"%s"CL_RESET"'.\n",count,map->db_path,"exp.txt");
count = 0;
// Reset and read skilltree
memset(skill_tree,0,sizeof(skill_tree));
pc_read_skill_tree();
#if defined(RENEWAL_DROP) || defined(RENEWAL_EXP)
- sv->readdb(iMap->db_path, "re/level_penalty.txt", ',', 4, 4, -1, &pc_readdb_levelpenalty);
+ sv->readdb(map->db_path, "re/level_penalty.txt", ',', 4, 4, -1, &pc_readdb_levelpenalty);
for( k=1; k < 3; k++ ){ // fill in the blanks
for( j = 0; j < RC_MAX; j++ ){
int tmp = 0;
@@ -10017,7 +9996,7 @@ int pc_readdb(void) {
for(k=0;k<ELE_MAX;k++)
attr_fix_table[i][j][k]=100;
- sprintf(line, "%s/"DBPATH"attr_fix.txt", iMap->db_path);
+ sprintf(line, "%s/"DBPATH"attr_fix.txt", map->db_path);
fp=fopen(line,"r");
if(fp==NULL){
@@ -10061,13 +10040,13 @@ int pc_readdb(void) {
}
}
fclose(fp);
- ShowStatus("Done reading '"CL_WHITE"%lu"CL_RESET"' entries in '"CL_WHITE"%s/"DBPATH"%s"CL_RESET"'.\n",count,iMap->db_path,"attr_fix.txt");
+ ShowStatus("Done reading '"CL_WHITE"%lu"CL_RESET"' entries in '"CL_WHITE"%s/"DBPATH"%s"CL_RESET"'.\n",count,map->db_path,"attr_fix.txt");
count = 0;
- // reset then read statspoint
+ // reset then read statspoint
memset(statp,0,sizeof(statp));
i=1;
- sprintf(line, "%s/"DBPATH"statpoint.txt", iMap->db_path);
+ sprintf(line, "%s/"DBPATH"statpoint.txt", map->db_path);
fp=fopen(line,"r");
if(fp == NULL){
ShowWarning("Can't read '"CL_WHITE"%s"CL_RESET"'... Generating DB.\n",line);
@@ -10088,7 +10067,7 @@ int pc_readdb(void) {
}
fclose(fp);
- ShowStatus("Done reading '"CL_WHITE"%lu"CL_RESET"' entries in '"CL_WHITE"%s/"DBPATH"%s"CL_RESET"'.\n",count,iMap->db_path,"statpoint.txt");
+ ShowStatus("Done reading '"CL_WHITE"%lu"CL_RESET"' entries in '"CL_WHITE"%s/"DBPATH"%s"CL_RESET"'.\n",count,map->db_path,"statpoint.txt");
}
// generate the remaining parts of the db if necessary
k = battle_config.use_statpoint_table; //save setting
@@ -10164,10 +10143,10 @@ int do_init_pc(void) {
timer->add_func_list(pc->endautobonus, "pc->endautobonus");
timer->add_func_list(pc_charm_timer, "pc_charm_timer");
- timer->add(timer->gettick() + iMap->autosave_interval, pc_autosave, 0, 0);
+ timer->add(timer->gettick() + map->autosave_interval, pc_autosave, 0, 0);
// 0=day, 1=night [Yor]
- iMap->night_flag = battle_config.night_at_start ? 1 : 0;
+ map->night_flag = battle_config.night_at_start ? 1 : 0;
if (battle_config.day_duration > 0 && battle_config.night_duration > 0) {
int day_duration = battle_config.day_duration;
@@ -10176,8 +10155,8 @@ int do_init_pc(void) {
timer->add_func_list(pc->map_day_timer, "pc->map_day_timer");
timer->add_func_list(pc->map_night_timer, "pc->map_night_timer");
- pc->day_timer_tid = timer->add_interval(timer->gettick() + (iMap->night_flag ? 0 : day_duration) + night_duration, pc->map_day_timer, 0, 0, day_duration + night_duration);
- pc->night_timer_tid = timer->add_interval(timer->gettick() + day_duration + (iMap->night_flag ? night_duration : 0), pc->map_night_timer, 0, 0, day_duration + night_duration);
+ pc->day_timer_tid = timer->add_interval(timer->gettick() + (map->night_flag ? 0 : day_duration) + night_duration, pc->map_day_timer, 0, 0, day_duration + night_duration);
+ pc->night_timer_tid = timer->add_interval(timer->gettick() + day_duration + (map->night_flag ? night_duration : 0), pc->map_night_timer, 0, 0, day_duration + night_duration);
}
do_init_pc_groups();
diff --git a/src/map/pet.c b/src/map/pet.c
index dd0ed1bb9..811ac9f09 100644
--- a/src/map/pet.c
+++ b/src/map/pet.c
@@ -109,7 +109,7 @@ int pet_attackskill(struct pet_data *pd, int target_id) {
int inf;
struct block_list *bl;
- bl=iMap->id2bl(target_id);
+ bl=map->id2bl(target_id);
if( bl == NULL || pd->bl.m != bl->m || bl->prev == NULL
|| status->isdead(bl) || !check_distance_bl(&pd->bl, bl, pd->db->range3))
return 0;
@@ -186,13 +186,12 @@ int pet_sc_check(struct map_session_data *sd, int type)
return 0;
}
-int pet_hungry(int tid, unsigned int tick, int id, intptr_t data)
-{
+int pet_hungry(int tid, unsigned int tick, int id, intptr_t data) {
struct map_session_data *sd;
struct pet_data *pd;
int interval;
- sd=iMap->id2sd(id);
+ sd=map->id2sd(id);
if(!sd)
return 1;
@@ -300,7 +299,7 @@ int pet_return_egg(struct map_session_data *sd, struct pet_data *pd)
tmp_item.card[3] = pd->pet.rename_flag;
if((flag = pc->additem(sd,&tmp_item,1,LOG_TYPE_OTHER))) {
clif->additem(sd,0,0,flag);
- iMap->addflooritem(&tmp_item,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ map->addflooritem(&tmp_item,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
pd->pet.incuvate = 1;
unit->free(&pd->bl,CLR_OUTSIGHT);
@@ -360,7 +359,7 @@ int pet_data_init(struct map_session_data *sd, struct s_pet *petinfo)
pd->bl.x = pd->ud.to_x;
pd->bl.y = pd->ud.to_y;
- iMap->addiddb(&pd->bl);
+ map->addiddb(&pd->bl);
status_calc_pet(pd,1);
pd->last_thinktime = timer->gettick();
@@ -401,11 +400,11 @@ int pet_birth_process(struct map_session_data *sd, struct s_pet *petinfo)
}
intif->save_petdata(sd->status.account_id,petinfo);
- if (iMap->save_settings&8)
+ if (map->save_settings&8)
chrif->save(sd,0); //is it REALLY Needed to save the char for hatching a pet? [Skotlex]
if(sd->bl.prev != NULL) {
- iMap->addblock(&sd->pd->bl);
+ map->addblock(&sd->pd->bl);
clif->spawn(&sd->pd->bl);
clif->send_petdata(sd,sd->pd, 0,0);
clif->send_petdata(sd,sd->pd, 5,battle_config.pet_hair_style);
@@ -417,11 +416,10 @@ int pet_birth_process(struct map_session_data *sd, struct s_pet *petinfo)
return 0;
}
-int pet_recv_petdata(int account_id,struct s_pet *p,int flag)
-{
+int pet_recv_petdata(int account_id,struct s_pet *p,int flag) {
struct map_session_data *sd;
- sd = iMap->id2sd(account_id);
+ sd = map->id2sd(account_id);
if(sd == NULL)
return 1;
if(flag == 1) {
@@ -446,7 +444,7 @@ int pet_recv_petdata(int account_id,struct s_pet *p,int flag)
} else {
pet->data_init(sd,p);
if(sd->pd && sd->bl.prev != NULL) {
- iMap->addblock(&sd->pd->bl);
+ map->addblock(&sd->pd->bl);
clif->spawn(&sd->pd->bl);
clif->send_petdata(sd,sd->pd,0,0);
clif->send_petdata(sd,sd->pd,5,battle_config.pet_hair_style);
@@ -483,16 +481,15 @@ int pet_catch_process1(struct map_session_data *sd,int target_class)
return 0;
}
-int pet_catch_process2(struct map_session_data* sd, int target_id)
-{
+int pet_catch_process2(struct map_session_data* sd, int target_id) {
struct mob_data* md;
int i = 0, pet_catch_rate = 0;
nullpo_retr(1, sd);
- md = (struct mob_data*)iMap->id2bl(target_id);
- if(!md || md->bl.type != BL_MOB || md->bl.prev == NULL)
- { // Invalid inputs/state, abort capture.
+ md = (struct mob_data*)map->id2bl(target_id);
+ if(!md || md->bl.type != BL_MOB || md->bl.prev == NULL) {
+ // Invalid inputs/state, abort capture.
clif->pet_roulette(sd,0);
sd->catch_target_class = -1;
sd->itemid = sd->itemindex = -1;
@@ -535,8 +532,8 @@ int pet_catch_process2(struct map_session_data* sd, int target_id)
return 0;
}
-int pet_get_egg(int account_id,int pet_id,int flag)
-{ //This function is invoked when a new pet has been created, and at no other time!
+///This function is invoked when a new pet has been created, and at no other time!
+int pet_get_egg(int account_id,int pet_id,int flag) {
struct map_session_data *sd;
struct item tmp_item;
int i=0,ret=0;
@@ -544,7 +541,7 @@ int pet_get_egg(int account_id,int pet_id,int flag)
if(flag)
return 0;
- sd = iMap->id2sd(account_id);
+ sd = map->id2sd(account_id);
if(sd == NULL)
return 0;
@@ -565,7 +562,7 @@ int pet_get_egg(int account_id,int pet_id,int flag)
tmp_item.card[3] = 0; //New pets are not named.
if((ret = pc->additem(sd,&tmp_item,1,LOG_TYPE_PICKDROP_PLAYER))) {
clif->additem(sd,0,0,ret);
- iMap->addflooritem(&tmp_item,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ map->addflooritem(&tmp_item,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
return 1;
@@ -699,7 +696,7 @@ int pet_unequipitem(struct map_session_data *sd, struct pet_data *pd) {
tmp_item.identify = 1;
if((flag = pc->additem(sd,&tmp_item,1,LOG_TYPE_OTHER))) {
clif->additem(sd,0,0,flag);
- iMap->addflooritem(&tmp_item,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ map->addflooritem(&tmp_item,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
if( battle_config.pet_equip_required )
{ // Skotlex: halt support timers if needed
@@ -788,7 +785,7 @@ int pet_randomwalk(struct pet_data *pd,unsigned int tick)
int r=rnd();
x=pd->bl.x+r%(d*2+1)-d;
y=pd->bl.y+r/(d*2+1)%(d*2+1)-d;
- if(iMap->getcell(pd->bl.m,x,y,CELL_CHKPASS) && unit->walktoxy(&pd->bl,x,y,0)){
+ if(map->getcell(pd->bl.m,x,y,CELL_CHKPASS) && unit->walktoxy(&pd->bl,x,y,0)) {
pd->move_fail_count=0;
break;
}
@@ -863,7 +860,7 @@ int pet_ai_sub_hard(struct pet_data *pd, struct map_session_data *sd, unsigned i
}
if (pd->target_id) {
- target= iMap->id2bl(pd->target_id);
+ target= map->id2bl(pd->target_id);
if (!target || pd->bl.m != target->m || status->isdead(target)
|| !check_distance_bl(&pd->bl, target, pd->db->range3)
) {
@@ -874,7 +871,7 @@ int pet_ai_sub_hard(struct pet_data *pd, struct map_session_data *sd, unsigned i
if(!target && pd->loot && pd->msd && pc->has_permission(pd->msd, PC_PERM_TRADE) && pd->loot->count < pd->loot->max && DIFF_TICK(tick,pd->ud.canact_tick)>0) {
//Use half the pet's range of sight.
- iMap->foreachinrange(pet->ai_sub_hard_lootsearch,&pd->bl,
+ map->foreachinrange(pet->ai_sub_hard_lootsearch,&pd->bl,
pd->db->range2/2, BL_ITEM,pd,&target);
}
@@ -918,7 +915,7 @@ int pet_ai_sub_hard(struct pet_data *pd, struct map_session_data *sd, unsigned i
if(pd->loot->count < pd->loot->max){
memcpy(&pd->loot->item[pd->loot->count++],&fitem->item_data,sizeof(pd->loot->item[0]));
pd->loot->weight += itemdb_weight(fitem->item_data.nameid)*fitem->item_data.amount;
- iMap->clearflooritem(target);
+ map->clearflooritem(target);
}
//Target is unlocked regardless of whether it was picked or not.
pet->unlocktarget(pd);
@@ -936,9 +933,8 @@ int pet_ai_sub_foreachclient(struct map_session_data *sd,va_list ap)
return 0;
}
-int pet_ai_hard(int tid, unsigned int tick, int id, intptr_t data)
-{
- iMap->map_foreachpc(pet->ai_sub_foreachclient,tick);
+int pet_ai_hard(int tid, unsigned int tick, int id, intptr_t data) {
+ map->map_foreachpc(pet->ai_sub_foreachclient,tick);
return 0;
}
@@ -970,14 +966,13 @@ int pet_ai_sub_hard_lootsearch(struct block_list *bl,va_list ap)
return 0;
}
-int pet_delay_item_drop(int tid, unsigned int tick, int id, intptr_t data)
-{
+int pet_delay_item_drop(int tid, unsigned int tick, int id, intptr_t data) {
struct item_drop_list *list;
struct item_drop *ditem, *ditem_prev;
list=(struct item_drop_list *)data;
ditem = list->item;
while (ditem) {
- iMap->addflooritem(&ditem->item_data,ditem->item_data.amount,
+ map->addflooritem(&ditem->item_data,ditem->item_data.amount,
list->m,list->x,list->y,
list->first_charid,list->second_charid,list->third_charid,0);
ditem_prev = ditem;
@@ -1039,9 +1034,8 @@ int pet_lootitem_drop(struct pet_data *pd,struct map_session_data *sd)
/*==========================================
* pet bonus giving skills [Valaris] / Rewritten by [Skotlex]
*------------------------------------------*/
-int pet_skill_bonus_timer(int tid, unsigned int tick, int id, intptr_t data)
-{
- struct map_session_data *sd=iMap->id2sd(id);
+int pet_skill_bonus_timer(int tid, unsigned int tick, int id, intptr_t data) {
+ struct map_session_data *sd=map->id2sd(id);
struct pet_data *pd;
int bonus;
int duration = 0;
@@ -1081,9 +1075,8 @@ int pet_skill_bonus_timer(int tid, unsigned int tick, int id, intptr_t data)
/*==========================================
* pet recovery skills [Valaris] / Rewritten by [Skotlex]
*------------------------------------------*/
-int pet_recovery_timer(int tid, unsigned int tick, int id, intptr_t data)
-{
- struct map_session_data *sd=iMap->id2sd(id);
+int pet_recovery_timer(int tid, unsigned int tick, int id, intptr_t data) {
+ struct map_session_data *sd=map->id2sd(id);
struct pet_data *pd;
if(sd==NULL || sd->pd == NULL || sd->pd->recovery == NULL)
@@ -1110,7 +1103,7 @@ int pet_recovery_timer(int tid, unsigned int tick, int id, intptr_t data)
}
int pet_heal_timer(int tid, unsigned int tick, int id, intptr_t data) {
- struct map_session_data *sd=iMap->id2sd(id);
+ struct map_session_data *sd=map->id2sd(id);
struct status_data *st;
struct pet_data *pd;
unsigned int rate = 100;
@@ -1147,7 +1140,7 @@ int pet_heal_timer(int tid, unsigned int tick, int id, intptr_t data) {
* pet support skills [Skotlex]
*------------------------------------------*/
int pet_skill_support_timer(int tid, unsigned int tick, int id, intptr_t data) {
- struct map_session_data *sd=iMap->id2sd(id);
+ struct map_session_data *sd=map->id2sd(id);
struct pet_data *pd;
struct status_data *st;
short rate = 100;
@@ -1218,23 +1211,20 @@ int read_petdb()
memset(pet->db,0,sizeof(pet->db));
j = 0; // entry counter
- for( i = 0; i < ARRAYLENGTH(filename); i++ )
- {
+ for( i = 0; i < ARRAYLENGTH(filename); i++ ) {
char line[1024];
int lines, entries;
- sprintf(line, "%s/%s", iMap->db_path, filename[i]);
+ sprintf(line, "%s/%s", map->db_path, filename[i]);
fp=fopen(line,"r");
- if( fp == NULL )
- {
+ if( fp == NULL ) {
if( i == 0 )
ShowError("can't read %s\n",line);
continue;
}
lines = entries = 0;
- while( fgets(line, sizeof(line), fp) && j < MAX_PET_DB )
- {
+ while( fgets(line, sizeof(line), fp) && j < MAX_PET_DB ) {
char *str[22], *p;
lines++;
diff --git a/src/map/quest.c b/src/map/quest.c
index 40030560a..f40b60c3d 100644
--- a/src/map/quest.c
+++ b/src/map/quest.c
@@ -103,7 +103,7 @@ int quest_add(TBL_PC * sd, int quest_id)
clif->quest_add(sd, &sd->quest_log[i], sd->quest_index[i]);
clif->quest_update_objective(sd, &sd->quest_log[i], sd->quest_index[i]);
- if( iMap->save_settings&64 )
+ if( map->save_settings&64 )
chrif->save(sd,0);
return 0;
@@ -152,7 +152,7 @@ int quest_change(TBL_PC * sd, int qid1, int qid2)
clif->quest_add(sd, &sd->quest_log[i], sd->quest_index[i]);
clif->quest_update_objective(sd, &sd->quest_log[i], sd->quest_index[i]);
- if( iMap->save_settings&64 )
+ if( map->save_settings&64 )
chrif->save(sd,0);
return 0;
@@ -183,7 +183,7 @@ int quest_delete(TBL_PC * sd, int quest_id)
clif->quest_delete(sd, quest_id);
- if( iMap->save_settings&64 )
+ if( map->save_settings&64 )
chrif->save(sd,0);
return 0;
@@ -253,7 +253,7 @@ int quest_update_status(TBL_PC * sd, int quest_id, quest_state qs) {
clif->quest_delete(sd, quest_id);
- if( iMap->save_settings&64 )
+ if( map->save_settings&64 )
chrif->save(sd,0);
return 0;
@@ -297,16 +297,15 @@ int quest_read_db(void) {
int i,j,k = 0;
char *str[20],*p,*np;
- sprintf(line, "%s/quest_db.txt", iMap->db_path);
+ sprintf(line, "%s/quest_db.txt", map->db_path);
if( (fp=fopen(line,"r"))==NULL ){
ShowError("can't read %s\n", line);
return -1;
}
while(fgets(line, sizeof(line), fp)) {
-
if (k == MAX_QUEST_DB) {
- ShowError("quest_read_db: Too many entries specified in %s/quest_db.txt!\n", iMap->db_path);
+ ShowError("quest_read_db: Too many entries specified in %s/quest_db.txt!\n", map->db_path);
break;
}
diff --git a/src/map/script.c b/src/map/script.c
index b940d03e4..992f9da94 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -312,14 +312,13 @@ static void script_dump_stack(struct script_state* st)
#endif
/// Reports on the console the src of a script error.
-static void script_reportsrc(struct script_state *st)
-{
+static void script_reportsrc(struct script_state *st) {
struct block_list* bl;
if( st->oid == 0 )
return; //Can't report source.
- bl = iMap->id2bl(st->oid);
+ bl = map->id2bl(st->oid);
if( bl == NULL )
return;
@@ -1993,13 +1992,12 @@ void script_set_constant_force(const char *name, int value, bool isparameter) {
* Reading constant databases
* const.txt
*------------------------------------------*/
-static void read_constdb(void)
-{
+static void read_constdb(void) {
FILE *fp;
char line[1024],name[1024],val[1024];
int type;
- sprintf(line, "%s/const.txt", iMap->db_path);
+ sprintf(line, "%s/const.txt", map->db_path);
fp=fopen(line, "r");
if(fp==NULL){
ShowError("can't read %s\n", line);
@@ -2290,7 +2288,7 @@ struct script_code* parse_script(const char *src,const char *file,int line,int o
/// If there is no player attached, the script is terminated.
TBL_PC *script_rid2sd(struct script_state *st) {
TBL_PC *sd;
- if( !( sd = iMap->id2sd(st->rid) ) ){
+ if( !( sd = map->id2sd(st->rid) ) ){
ShowError("script_rid2sd: fatal error ! player not attached!\n");
script_reportfunc(st);
script_reportsrc(st);
@@ -3341,7 +3339,7 @@ void script_stop_instances(struct script_code *code) {
int run_script_timer(int tid, unsigned int tick, int id, intptr_t data) {
struct script_state *st = idb_get(script->st_db,(int)data);
if( st ) {
- TBL_PC *sd = iMap->id2sd(st->rid);
+ TBL_PC *sd = map->id2sd(st->rid);
if((sd && sd->status.char_id != id) || (st->rid && !sd)) { //Character mismatch. Cancel execution.
st->rid = 0;
@@ -3359,11 +3357,10 @@ int run_script_timer(int tid, unsigned int tick, int id, intptr_t data) {
///
/// @param st Script state to detach.
/// @param dequeue_event Whether to schedule any queued events, when there was no previous script.
-static void script_detach_state(struct script_state* st, bool dequeue_event)
-{
+static void script_detach_state(struct script_state* st, bool dequeue_event) {
struct map_session_data* sd;
- if(st->rid && (sd = iMap->id2sd(st->rid))!=NULL) {
+ if(st->rid && (sd = map->id2sd(st->rid))!=NULL) {
sd->st = st->bk_st;
sd->npc_id = st->bk_npcid;
sd->state.dialog = 0;
@@ -3401,7 +3398,7 @@ static void script_detach_state(struct script_state* st, bool dequeue_event)
void script_attach_state(struct script_state* st) {
struct map_session_data* sd;
- if(st->rid && (sd = iMap->id2sd(st->rid))!=NULL)
+ if(st->rid && (sd = map->id2sd(st->rid))!=NULL)
{
if(st!=sd->st)
{
@@ -3438,7 +3435,7 @@ void run_script_main(struct script_state *st) {
script->attach_state(st);
- nd = iMap->id2nd(st->oid);
+ nd = map->id2nd(st->oid);
if( nd && nd->bl.m >= 0 )
st->instance_id = maplist[nd->bl.m].instance_id;
else
@@ -3542,7 +3539,7 @@ void run_script_main(struct script_state *st) {
//Restore previous script
script_detach_state(st, false);
//Delay execution
- sd = iMap->id2sd(st->rid); // Get sd since script might have attached someone while running. [Inkfish]
+ sd = map->id2sd(st->rid); // Get sd since script might have attached someone while running. [Inkfish]
st->sleep.charid = sd?sd->status.char_id:0;
st->sleep.timer = timer->add(timer->gettick()+st->sleep.tick,
script->run_timer, st->sleep.charid, (intptr_t)st->id);
@@ -3561,7 +3558,7 @@ void run_script_main(struct script_state *st) {
}
} else {
//Dispose of script.
- if ((sd = iMap->id2sd(st->rid))!=NULL) { //Restore previous stack and save char.
+ if ((sd = map->id2sd(st->rid))!=NULL) { //Restore previous stack and save char.
if(sd->state.using_fake_npc){
clif->clearunit_single(sd->npc_id, CLR_OUTSIGHT, sd->fd);
sd->state.using_fake_npc = 0;
@@ -4102,7 +4099,7 @@ BUILDIN(menu)
* menus beyond this length crash the client (see bugreport:6402)
**/
if( StrBuf->Length(&buf) >= 2047 ) {
- struct npc_data * nd = iMap->id2nd(st->oid);
+ struct npc_data * nd = map->id2nd(st->oid);
char* menu;
CREATE(menu, char, 2048);
safestrncpy(menu, StrBuf->Value(&buf), 2047);
@@ -4207,7 +4204,7 @@ BUILDIN(select)
* menus beyond this length crash the client (see bugreport:6402)
**/
if( StrBuf->Length(&buf) >= 2047 ) {
- struct npc_data * nd = iMap->id2nd(st->oid);
+ struct npc_data * nd = map->id2nd(st->oid);
char* menu;
CREATE(menu, char, 2048);
safestrncpy(menu, StrBuf->Value(&buf), 2047);
@@ -4286,7 +4283,7 @@ BUILDIN(prompt)
* menus beyond this length crash the client (see bugreport:6402)
**/
if( StrBuf->Length(&buf) >= 2047 ) {
- struct npc_data * nd = iMap->id2nd(st->oid);
+ struct npc_data * nd = map->id2nd(st->oid);
char* menu;
CREATE(menu, char, 2048);
safestrncpy(menu, StrBuf->Value(&buf), 2047);
@@ -4611,7 +4608,7 @@ static int buildin_areawarp_sub(struct block_list *bl,va_list ap)
tx = rnd()%(x3-x2+1)+x2;
ty = rnd()%(y3-y2+1)+y2;
j++;
- } while( iMap->getcell(index,tx,ty,CELL_CHKNOPASS) && j < max );
+ } while( map->getcell(index,tx,ty,CELL_CHKNOPASS) && j < max );
pc->setpos((TBL_PC *)bl,index,tx,ty,CLR_OUTSIGHT);
}
@@ -4646,7 +4643,7 @@ BUILDIN(areawarp)
}
}
- if( (m = iMap->mapname2mapid(mapname)) < 0 )
+ if( (m = map->mapname2mapid(mapname)) < 0 )
return true;
if( strcmp(str,"Random") == 0 )
@@ -4654,7 +4651,7 @@ BUILDIN(areawarp)
else if( !(index=mapindex_name2id(str)) )
return true;
- iMap->foreachinarea(buildin_areawarp_sub, m,x0,y0,x1,y1, BL_PC, index,x2,y2,x3,y3);
+ map->foreachinarea(buildin_areawarp_sub, m,x0,y0,x1,y1, BL_PC, index,x2,y2,x3,y3);
return true;
}
@@ -4669,8 +4666,7 @@ static int buildin_areapercentheal_sub(struct block_list *bl,va_list ap)
pc->percentheal((TBL_PC *)bl,hp,sp);
return 0;
}
-BUILDIN(areapercentheal)
-{
+BUILDIN(areapercentheal) {
int hp,sp,m;
const char *mapname;
int x0,y0,x1,y1;
@@ -4683,10 +4679,10 @@ BUILDIN(areapercentheal)
hp=script_getnum(st,7);
sp=script_getnum(st,8);
- if( (m=iMap->mapname2mapid(mapname))< 0)
+ if( (m=map->mapname2mapid(mapname))< 0)
return true;
- iMap->foreachinarea(buildin_areapercentheal_sub,m,x0,y0,x1,y1,BL_PC,hp,sp);
+ map->foreachinarea(buildin_areapercentheal_sub,m,x0,y0,x1,y1,BL_PC,hp,sp);
return true;
}
@@ -4696,8 +4692,7 @@ BUILDIN(areapercentheal)
* another player npc-session.
* Using: warpchar "mapname",x,y,Char_ID;
*------------------------------------------*/
-BUILDIN(warpchar)
-{
+BUILDIN(warpchar) {
int x,y,a;
const char *str;
TBL_PC *sd;
@@ -4707,7 +4702,7 @@ BUILDIN(warpchar)
y=script_getnum(st,4);
a=script_getnum(st,5);
- sd = iMap->charid2sd(a);
+ sd = map->charid2sd(a);
if( sd == NULL )
return true;
@@ -5931,7 +5926,7 @@ BUILDIN(getitem)
it.identify=itemdb->isidentified2(item_data);
if( script_hasdata(st,4) )
- sd=iMap->id2sd(script_getnum(st,4)); // <Account ID>
+ sd=map->id2sd(script_getnum(st,4)); // <Account ID>
else
sd=script_rid2sd(st); // Attached player
@@ -5944,16 +5939,13 @@ BUILDIN(getitem)
else
get_count = amount;
- for (i = 0; i < amount; i += get_count)
- {
+ for (i = 0; i < amount; i += get_count) {
// if not pet egg
- if (!pet->create_egg(sd, nameid))
- {
- if ((flag = pc->additem(sd, &it, get_count, LOG_TYPE_SCRIPT)))
- {
+ if (!pet->create_egg(sd, nameid)) {
+ if ((flag = pc->additem(sd, &it, get_count, LOG_TYPE_SCRIPT))) {
clif->additem(sd, 0, 0, flag);
if( pc->candrop(sd,&it) )
- iMap->addflooritem(&it,get_count,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ map->addflooritem(&it,get_count,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
}
}
@@ -5974,7 +5966,7 @@ BUILDIN(getitem2)
struct script_data *data;
if( script_hasdata(st,11) )
- sd=iMap->id2sd(script_getnum(st,11)); // <Account ID>
+ sd=map->id2sd(script_getnum(st,11)); // <Account ID>
else
sd=script_rid2sd(st); // Attached player
@@ -6042,16 +6034,13 @@ BUILDIN(getitem2)
else
get_count = amount;
- for (i = 0; i < amount; i += get_count)
- {
+ for (i = 0; i < amount; i += get_count) {
// if not pet egg
- if (!pet->create_egg(sd, nameid))
- {
- if ((flag = pc->additem(sd, &item_tmp, get_count, LOG_TYPE_SCRIPT)))
- {
+ if (!pet->create_egg(sd, nameid)) {
+ if ((flag = pc->additem(sd, &item_tmp, get_count, LOG_TYPE_SCRIPT))) {
clif->additem(sd, 0, 0, flag);
if( pc->candrop(sd,&item_tmp) )
- iMap->addflooritem(&item_tmp,get_count,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ map->addflooritem(&item_tmp,get_count,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
}
}
@@ -6161,10 +6150,10 @@ BUILDIN(getnameditem)
data=script_getdata(st,3);
script->get_val(st,data);
- if( data_isstring(data) ) //Char Name
- tsd=iMap->nick2sd(script->conv_str(st,data));
- else //Char Id was given
- tsd=iMap->charid2sd(script->conv_num(st,data));
+ if( data_isstring(data) ) //Char Name
+ tsd=map->nick2sd(script->conv_str(st,data));
+ else //Char Id was given
+ tsd=map->charid2sd(script->conv_num(st,data));
if( tsd == NULL )
{ //Failed
@@ -6251,14 +6240,13 @@ BUILDIN(makeitem)
x =script_getnum(st,5);
y =script_getnum(st,6);
- if(strcmp(mapname,"this")==0)
- {
+ if(strcmp(mapname,"this")==0) {
TBL_PC *sd;
sd = script_rid2sd(st);
if (!sd) return true; //Failed...
m=sd->bl.m;
} else
- m=iMap->mapname2mapid(mapname);
+ m=map->mapname2mapid(mapname);
if( m == -1 ) {
ShowError("makeitem: creating map on unexistent map '%s'!\n", mapname);
@@ -6273,7 +6261,7 @@ BUILDIN(makeitem)
else
item_tmp.identify=itemdb->isidentified2(item_data);
- iMap->addflooritem(&item_tmp,amount,m,x,y,0,0,0,0);
+ map->addflooritem(&item_tmp,amount,m,x,y,0,0,0,0);
return true;
}
@@ -6434,7 +6422,7 @@ BUILDIN(delitem)
if( script_hasdata(st,4) )
{
int account_id = script_getnum(st,4);
- sd = iMap->id2sd(account_id); // <account id>
+ sd = map->id2sd(account_id); // <account id>
if( sd == NULL )
{
ShowError("script:delitem: player not found (AID=%d).\n", account_id);
@@ -6494,18 +6482,15 @@ BUILDIN(delitem)
///
/// delitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>}
/// delitem2 "<Item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>}
-BUILDIN(delitem2)
-{
+BUILDIN(delitem2) {
TBL_PC *sd;
struct item it;
struct script_data *data;
- if( script_hasdata(st,11) )
- {
+ if( script_hasdata(st,11) ) {
int account_id = script_getnum(st,11);
- sd = iMap->id2sd(account_id); // <account id>
- if( sd == NULL )
- {
+ sd = map->id2sd(account_id); // <account id>
+ if( sd == NULL ) {
ShowError("script:delitem2: player not found (AID=%d).\n", account_id);
st->state = END;
return false;
@@ -6591,14 +6576,13 @@ BUILDIN(disableitemuse)
* return the basic stats of sd
* chk pc->readparam for available type
*------------------------------------------*/
-BUILDIN(readparam)
-{
+BUILDIN(readparam) {
int type;
TBL_PC *sd;
type=script_getnum(st,2);
if( script_hasdata(st,3) )
- sd=iMap->nick2sd(script_getstr(st,3));
+ sd=map->nick2sd(script_getstr(st,3));
else
sd=script_rid2sd(st);
@@ -6621,14 +6605,13 @@ BUILDIN(readparam)
* 3 : account_id
* 4 : bg_id
*------------------------------------------*/
-BUILDIN(getcharid)
-{
+BUILDIN(getcharid) {
int num;
TBL_PC *sd;
num = script_getnum(st,2);
if( script_hasdata(st,3) )
- sd=iMap->nick2sd(script_getstr(st,3));
+ sd=map->nick2sd(script_getstr(st,3));
else
sd=script_rid2sd(st);
@@ -6904,13 +6887,12 @@ BUILDIN(strcharinfo)
* 3 : ::str
* 4 : map name
*------------------------------------------*/
-BUILDIN(strnpcinfo)
-{
+BUILDIN(strnpcinfo) {
TBL_NPC* nd;
int num;
char *buf,*name=NULL;
- nd = iMap->id2nd(st->oid);
+ nd = map->id2nd(st->oid);
if (!nd) {
script_pushconststr(st, "");
return true;
@@ -8405,15 +8387,14 @@ BUILDIN(guildgetexp)
/*==========================================
* Changes the guild master of a guild [Skotlex]
*------------------------------------------*/
-BUILDIN(guildchangegm)
-{
+BUILDIN(guildchangegm) {
TBL_PC *sd;
int guild_id;
const char *name;
guild_id = script_getnum(st,2);
name = script_getstr(st,3);
- sd=iMap->nick2sd(name);
+ sd=map->nick2sd(name);
if (!sd)
script_pushint(st,0);
@@ -8479,13 +8460,12 @@ BUILDIN(monster)
return false;
}
- sd = iMap->id2sd(st->rid);
+ sd = map->id2sd(st->rid);
if (sd && strcmp(mapn, "this") == 0)
m = sd->bl.m;
else {
-
- if ( ( m = iMap->mapname2mapid(mapn) ) == -1 ) {
+ if ( ( m = map->mapname2mapid(mapn) ) == -1 ) {
ShowWarning("buildin_monster: Attempted to spawn monster class %d on non-existing map '%s'\n",class_, mapn);
return false;
}
@@ -8579,12 +8559,12 @@ BUILDIN(areamonster)
}
}
- sd = iMap->id2sd(st->rid);
+ sd = map->id2sd(st->rid);
if (sd && strcmp(mapn, "this") == 0)
m = sd->bl.m;
else {
- if ( ( m = iMap->mapname2mapid(mapn) ) == -1 ) {
+ if ( ( m = map->mapname2mapid(mapn) ) == -1 ) {
ShowWarning("buildin_areamonster: Attempted to spawn monster class %d on non-existing map '%s'\n",class_, mapn);
return false;
}
@@ -8637,8 +8617,7 @@ static int buildin_killmonster_sub(struct block_list *bl,va_list ap)
}
return 0;
}
-BUILDIN(killmonster)
-{
+BUILDIN(killmonster) {
const char *mapname,*event;
int16 m,allflag=0;
mapname=script_getstr(st,2);
@@ -8648,7 +8627,7 @@ BUILDIN(killmonster)
else
check_event(st, event);
- if( (m=iMap->mapname2mapid(mapname))<0 )
+ if( (m=map->mapname2mapid(mapname))<0 )
return true;
if( maplist[m].flag.src4instance && st->instance_id >= 0 && (m = instance->mapid2imapid(m, st->instance_id)) < 0 )
@@ -8656,14 +8635,14 @@ BUILDIN(killmonster)
if( script_hasdata(st,4) ) {
if ( script_getnum(st,4) == 1 ) {
- iMap->foreachinmap(buildin_killmonster_sub, m, BL_MOB, event ,allflag);
+ map->foreachinmap(buildin_killmonster_sub, m, BL_MOB, event ,allflag);
return true;
}
}
- iMap->freeblock_lock();
- iMap->foreachinmap(buildin_killmonster_sub_strip, m, BL_MOB, event ,allflag);
- iMap->freeblock_unlock();
+ map->freeblock_lock();
+ map->foreachinmap(buildin_killmonster_sub_strip, m, BL_MOB, event ,allflag);
+ map->freeblock_unlock();
return true;
}
@@ -8683,13 +8662,12 @@ static int buildin_killmonsterall_sub(struct block_list *bl,va_list ap)
status_kill(bl);
return 0;
}
-BUILDIN(killmonsterall)
-{
+BUILDIN(killmonsterall) {
const char *mapname;
int16 m;
mapname=script_getstr(st,2);
- if( (m = iMap->mapname2mapid(mapname))<0 )
+ if( (m = map->mapname2mapid(mapname))<0 )
return true;
if( maplist[m].flag.src4instance && st->instance_id >= 0 && (m = instance->mapid2imapid(m, st->instance_id)) < 0 )
@@ -8697,12 +8675,12 @@ BUILDIN(killmonsterall)
if( script_hasdata(st,3) ) {
if ( script_getnum(st,3) == 1 ) {
- iMap->foreachinmap(buildin_killmonsterall_sub,m,BL_MOB);
+ map->foreachinmap(buildin_killmonsterall_sub,m,BL_MOB);
return true;
}
}
- iMap->foreachinmap(buildin_killmonsterall_sub_strip,m,BL_MOB);
+ map->foreachinmap(buildin_killmonsterall_sub_strip,m,BL_MOB);
return true;
}
@@ -8736,13 +8714,13 @@ BUILDIN(clone) {
check_event(st, event);
- m = iMap->mapname2mapid(mapname);
+ m = map->mapname2mapid(mapname);
if (m < 0) return true;
- sd = iMap->charid2sd(char_id);
+ sd = map->charid2sd(char_id);
if (master_id) {
- msd = iMap->charid2sd(master_id);
+ msd = map->charid2sd(master_id);
if (msd)
master_id = msd->bl.id;
else
@@ -8778,7 +8756,7 @@ BUILDIN(donpcevent)
const char* event = script_getstr(st,2);
check_event(st, event);
if( !npc->event_do(event) ) {
- struct npc_data * nd = iMap->id2nd(st->oid);
+ struct npc_data * nd = map->id2nd(st->oid);
ShowDebug("NPCEvent '%s' not found! (source: %s)\n",event,nd?nd->name:"Unknown");
script_pushint(st, 0);
} else
@@ -8869,19 +8847,16 @@ BUILDIN(initnpctimer)
script->get_val(st,data);
if( data_isstring(data) ) //NPC name
nd = npc->name2id(script->conv_str(st, data));
- else if( data_isint(data) ) //Flag
- {
- nd = (struct npc_data *)iMap->id2bl(st->oid);
+ else if( data_isint(data) ) {
+ //Flag
+ nd = (struct npc_data *)map->id2bl(st->oid);
flag = script->conv_num(st,data);
- }
- else
- {
+ } else {
ShowError("initnpctimer: invalid argument type #1 (needs be int or string)).\n");
return false;
}
- }
- else
- nd = (struct npc_data *)iMap->id2bl(st->oid);
+ } else
+ nd = (struct npc_data *)map->id2bl(st->oid);
if( !nd )
return true;
@@ -8917,19 +8892,16 @@ BUILDIN(startnpctimer)
script->get_val(st,data);
if( data_isstring(data) ) //NPC name
nd = npc->name2id(script->conv_str(st, data));
- else if( data_isint(data) ) //Flag
- {
- nd = (struct npc_data *)iMap->id2bl(st->oid);
+ else if( data_isint(data) ) {
+ //Flag
+ nd = (struct npc_data *)map->id2bl(st->oid);
flag = script->conv_num(st,data);
- }
- else
- {
+ } else {
ShowError("initnpctimer: invalid argument type #1 (needs be int or string)).\n");
return false;
}
- }
- else
- nd=(struct npc_data *)iMap->id2bl(st->oid);
+ } else
+ nd=(struct npc_data *)map->id2bl(st->oid);
if( !nd )
return true;
@@ -8946,8 +8918,7 @@ BUILDIN(startnpctimer)
}
/*==========================================
*------------------------------------------*/
-BUILDIN(stopnpctimer)
-{
+BUILDIN(stopnpctimer) {
struct npc_data *nd;
int flag = 0;
@@ -8963,19 +8934,16 @@ BUILDIN(stopnpctimer)
script->get_val(st,data);
if( data_isstring(data) ) //NPC name
nd = npc->name2id(script->conv_str(st, data));
- else if( data_isint(data) ) //Flag
- {
- nd = (struct npc_data *)iMap->id2bl(st->oid);
+ else if( data_isint(data) ) {
+ //Flag
+ nd = (struct npc_data *)map->id2bl(st->oid);
flag = script->conv_num(st,data);
- }
- else
- {
+ } else {
ShowError("initnpctimer: invalid argument type #1 (needs be int or string)).\n");
return false;
}
- }
- else
- nd=(struct npc_data *)iMap->id2bl(st->oid);
+ } else
+ nd=(struct npc_data *)map->id2bl(st->oid);
if( !nd )
return true;
@@ -8987,8 +8955,7 @@ BUILDIN(stopnpctimer)
}
/*==========================================
*------------------------------------------*/
-BUILDIN(getnpctimer)
-{
+BUILDIN(getnpctimer) {
struct npc_data *nd;
TBL_PC *sd;
int type = script_getnum(st,2);
@@ -8997,7 +8964,7 @@ BUILDIN(getnpctimer)
if( script_hasdata(st,3) )
nd = npc->name2id(script_getstr(st,3));
else
- nd = (struct npc_data *)iMap->id2bl(st->oid);
+ nd = (struct npc_data *)map->id2bl(st->oid);
if( !nd || nd->bl.type != BL_NPC )
{
@@ -9006,15 +8973,12 @@ BUILDIN(getnpctimer)
return false;
}
- switch( type )
- {
+ switch( type ) {
case 0: val = npc->gettimerevent_tick(nd); break;
case 1:
- if( nd->u.scr.rid )
- {
- sd = iMap->id2sd(nd->u.scr.rid);
- if( !sd )
- {
+ if( nd->u.scr.rid ) {
+ sd = map->id2sd(nd->u.scr.rid);
+ if( !sd ) {
ShowError("buildin_getnpctimer: Attached player not found!\n");
break;
}
@@ -9040,10 +9004,9 @@ BUILDIN(setnpctimer)
if( script_hasdata(st,3) )
nd = npc->name2id(script_getstr(st,3));
else
- nd = (struct npc_data *)iMap->id2bl(st->oid);
+ nd = (struct npc_data *)map->id2bl(st->oid);
- if( !nd || nd->bl.type != BL_NPC )
- {
+ if( !nd || nd->bl.type != BL_NPC ) {
script_pushint(st,1);
ShowError("setnpctimer: Invalid NPC.\n");
return false;
@@ -9057,10 +9020,9 @@ BUILDIN(setnpctimer)
/*==========================================
* attaches the player rid to the timer [Celest]
*------------------------------------------*/
-BUILDIN(attachnpctimer)
-{
+BUILDIN(attachnpctimer) {
TBL_PC *sd;
- struct npc_data *nd = (struct npc_data *)iMap->id2bl(st->oid);
+ struct npc_data *nd = (struct npc_data *)map->id2bl(st->oid);
if( !nd || nd->bl.type != BL_NPC )
{
@@ -9070,7 +9032,7 @@ BUILDIN(attachnpctimer)
}
if( script_hasdata(st,2) )
- sd = iMap->nick2sd(script_getstr(st,2));
+ sd = map->nick2sd(script_getstr(st,2));
else
sd = script_rid2sd(st);
@@ -9089,14 +9051,13 @@ BUILDIN(attachnpctimer)
/*==========================================
* detaches a player rid from the timer [Celest]
*------------------------------------------*/
-BUILDIN(detachnpctimer)
-{
+BUILDIN(detachnpctimer) {
struct npc_data *nd;
if( script_hasdata(st,2) )
nd = npc->name2id(script_getstr(st,2));
else
- nd = (struct npc_data *)iMap->id2bl(st->oid);
+ nd = (struct npc_data *)map->id2bl(st->oid);
if( !nd || nd->bl.type != BL_NPC )
{
@@ -9115,9 +9076,8 @@ BUILDIN(detachnpctimer)
* it checks if there is a player attached to the current script. [Skotlex]
* If no, returns 0, if yes, returns the account_id of the attached player.
*------------------------------------------*/
-BUILDIN(playerattached)
-{
- if(st->rid == 0 || iMap->id2sd(st->rid) == NULL)
+BUILDIN(playerattached) {
+ if(st->rid == 0 || map->id2sd(st->rid) == NULL)
script_pushint(st,0);
else
script_pushint(st,st->rid);
@@ -9138,7 +9098,7 @@ BUILDIN(announce) {
if( flag&(BC_TARGET_MASK|BC_SOURCE_MASK) ) {
// Broadcast source or broadcast region defined
send_target target;
- struct block_list *bl = (flag&BC_NPC) ? iMap->id2bl(st->oid) : (struct block_list *)script_rid2sd(st); // If bc_npc flag is set, use NPC as broadcast source
+ struct block_list *bl = (flag&BC_NPC) ? map->id2bl(st->oid) : (struct block_list *)script_rid2sd(st); // If bc_npc flag is set, use NPC as broadcast source
if (bl == NULL)
return true;
@@ -9189,7 +9149,7 @@ BUILDIN(itemeffect) {
struct item_data *item_data;
nullpo_retr( 1, ( sd = script_rid2sd( st ) ) );
- nullpo_retr( 1, ( nd = (TBL_NPC *)iMap->id2bl( sd->npc_id ) ) );
+ nullpo_retr( 1, ( nd = (TBL_NPC *)map->id2bl( sd->npc_id ) ) );
data = script_getdata( st, 2 );
script->get_val( st, data );
@@ -9218,8 +9178,7 @@ BUILDIN(itemeffect) {
return true;
}
-BUILDIN(mapannounce)
-{
+BUILDIN(mapannounce) {
const char *mapname = script_getstr(st,2);
const char *mes = script_getstr(st,3);
int flag = script_getnum(st,4);
@@ -9230,17 +9189,16 @@ BUILDIN(mapannounce)
int fontY = script_hasdata(st,9) ? script_getnum(st,9) : 0; // default fontY
int16 m;
- if ((m = iMap->mapname2mapid(mapname)) < 0)
+ if ((m = map->mapname2mapid(mapname)) < 0)
return true;
- iMap->foreachinmap(buildin_announce_sub, m, BL_PC,
- mes, strlen(mes)+1, flag&BC_COLOR_MASK, fontColor, fontType, fontSize, fontAlign, fontY);
+ map->foreachinmap(buildin_announce_sub, m, BL_PC,
+ mes, strlen(mes)+1, flag&BC_COLOR_MASK, fontColor, fontType, fontSize, fontAlign, fontY);
return true;
}
/*==========================================
*------------------------------------------*/
-BUILDIN(areaannounce)
-{
+BUILDIN(areaannounce) {
const char *mapname = script_getstr(st,2);
int x0 = script_getnum(st,3);
int y0 = script_getnum(st,4);
@@ -9255,11 +9213,11 @@ BUILDIN(areaannounce)
int fontY = script_hasdata(st,13) ? script_getnum(st,13) : 0; // default fontY
int16 m;
- if ((m = iMap->mapname2mapid(mapname)) < 0)
+ if ((m = map->mapname2mapid(mapname)) < 0)
return true;
- iMap->foreachinarea(buildin_announce_sub, m, x0, y0, x1, y1, BL_PC,
- mes, strlen(mes)+1, flag&BC_COLOR_MASK, fontColor, fontType, fontSize, fontAlign, fontY);
+ map->foreachinarea(buildin_announce_sub, m, x0, y0, x1, y1, BL_PC,
+ mes, strlen(mes)+1, flag&BC_COLOR_MASK, fontColor, fontType, fontSize, fontAlign, fontY);
return true;
}
@@ -9276,7 +9234,7 @@ BUILDIN(getusers) {
case 0:
if(flag&0x8) {
// npc
- bl = iMap->id2bl(st->oid);
+ bl = map->id2bl(st->oid);
} else if((sd = script_rid2sd(st))!=NULL) {
// pc
bl = &sd->bl;
@@ -9287,7 +9245,7 @@ BUILDIN(getusers) {
}
break;
case 1:
- val = iMap->getusers();
+ val = map->getusers();
break;
default:
ShowWarning("buildin_getusers: Unknown type %d.\n", flag);
@@ -9339,7 +9297,7 @@ BUILDIN(getmapguildusers)
struct guild *g = NULL;
str=script_getstr(st,2);
gid=script_getnum(st,3);
- if ((m = iMap->mapname2mapid(str)) < 0) { // map id on this server (m == -1 if not in actual map-server)
+ if ((m = map->mapname2mapid(str)) < 0) { // map id on this server (m == -1 if not in actual map-server)
script_pushint(st,-1);
return true;
}
@@ -9362,7 +9320,7 @@ BUILDIN(getmapusers) {
const char *str;
int16 m;
str=script_getstr(st,2);
- if( (m=iMap->mapname2mapid(str))< 0){
+ if( (m=map->mapname2mapid(str))< 0){
script_pushint(st,-1);
return true;
}
@@ -9386,12 +9344,12 @@ BUILDIN(getareausers)
y0=script_getnum(st,4);
x1=script_getnum(st,5);
y1=script_getnum(st,6);
- if( (m=iMap->mapname2mapid(str))< 0){
+ if( (m=map->mapname2mapid(str))< 0){
script_pushint(st,-1);
return true;
}
- iMap->foreachinarea(buildin_getareausers_sub,
- m,x0,y0,x1,y1,BL_PC,&users);
+ map->foreachinarea(buildin_getareausers_sub,
+ m,x0,y0,x1,y1,BL_PC,&users);
script_pushint(st,users);
return true;
}
@@ -9433,12 +9391,12 @@ BUILDIN(getareadropitem)
}else
item=script->conv_num(st,data);
- if( (m=iMap->mapname2mapid(str))< 0){
+ if( (m=map->mapname2mapid(str))< 0){
script_pushint(st,-1);
return true;
}
- iMap->foreachinarea(buildin_getareadropitem_sub,
- m,x0,y0,x1,y1,BL_ITEM,item,&amount);
+ map->foreachinarea(buildin_getareadropitem_sub,
+ m,x0,y0,x1,y1,BL_ITEM,item,&amount);
script_pushint(st,amount);
return true;
}
@@ -9494,9 +9452,9 @@ BUILDIN(sc_start) {
tick = script_getnum(st,3);
val1 = script_getnum(st,4);
if( script_hasdata(st,5) )
- bl = iMap->id2bl(script_getnum(st,5));
+ bl = map->id2bl(script_getnum(st,5));
else
- bl = iMap->id2bl(st->rid);
+ bl = map->id2bl(st->rid);
if( tick == 0 && val1 > 0 && type > SC_NONE && type < SC_MAX && status->sc2skill(type) != 0 ) {
// When there isn't a duration specified, try to get it from the skill_db
@@ -9505,7 +9463,7 @@ BUILDIN(sc_start) {
if( script->potion_flag == 1 && script->potion_target ) {
//skill.c set the flags before running the script, this must be a potion-pitched effect.
- bl = iMap->id2bl(script->potion_target);
+ bl = map->id2bl(script->potion_target);
tick /= 2;// Thrown potions only last half.
val4 = 1;// Mark that this was a thrown sc_effect
}
@@ -9532,9 +9490,9 @@ BUILDIN(sc_start2) {
val1 = script_getnum(st,4);
rate = script_getnum(st,5);
if( script_hasdata(st,6) )
- bl = iMap->id2bl(script_getnum(st,6));
+ bl = map->id2bl(script_getnum(st,6));
else
- bl = iMap->id2bl(st->rid);
+ bl = map->id2bl(st->rid);
if( tick == 0 && val1 > 0 && type > SC_NONE && type < SC_MAX && status->sc2skill(type) != 0 ) {
// When there isn't a duration specified, try to get it from the skill_db
@@ -9543,7 +9501,7 @@ BUILDIN(sc_start2) {
if( script->potion_flag == 1 && script->potion_target ) {
//skill.c set the flags before running the script, this must be a potion-pitched effect.
- bl = iMap->id2bl(script->potion_target);
+ bl = map->id2bl(script->potion_target);
tick /= 2;// Thrown potions only last half.
val4 = 1;// Mark that this was a thrown sc_effect
}
@@ -9573,9 +9531,9 @@ BUILDIN(sc_start4) {
val3 = script_getnum(st,6);
val4 = script_getnum(st,7);
if( script_hasdata(st,8) )
- bl = iMap->id2bl(script_getnum(st,8));
+ bl = map->id2bl(script_getnum(st,8));
else
- bl = iMap->id2bl(st->rid);
+ bl = map->id2bl(st->rid);
if( tick == 0 && val1 > 0 && type > SC_NONE && type < SC_MAX && status->sc2skill(type) != 0 ) {
// When there isn't a duration specified, try to get it from the skill_db
@@ -9584,7 +9542,7 @@ BUILDIN(sc_start4) {
if( script->potion_flag == 1 && script->potion_target ) {
//skill.c set the flags before running the script, this must be a potion-pitched effect.
- bl = iMap->id2bl(script->potion_target);
+ bl = map->id2bl(script->potion_target);
tick /= 2;// Thrown potions only last half.
}
@@ -9603,12 +9561,12 @@ BUILDIN(sc_end) {
type = script_getnum(st, 2);
if (script_hasdata(st, 3))
- bl = iMap->id2bl(script_getnum(st, 3));
+ bl = map->id2bl(script_getnum(st, 3));
else
- bl = iMap->id2bl(st->rid);
+ bl = map->id2bl(st->rid);
if (script->potion_flag == 1 && script->potion_target) //##TODO how does this work [FlavioJS]
- bl = iMap->id2bl(script->potion_target);
+ bl = map->id2bl(script->potion_target);
if (!bl)
return true;
@@ -9650,9 +9608,9 @@ BUILDIN(getscrate) {
type=script_getnum(st,2);
rate=script_getnum(st,3);
if( script_hasdata(st,4) ) //get for the bl assigned
- bl = iMap->id2bl(script_getnum(st,4));
+ bl = map->id2bl(script_getnum(st,4));
else
- bl = iMap->id2bl(st->rid);
+ bl = map->id2bl(st->rid);
if (bl)
rate = status->get_sc_def(bl, (sc_type)type, 10000, 10000, 0);
@@ -9942,7 +9900,7 @@ BUILDIN(changebase) {
int vclass;
if( script_hasdata(st,3) )
- sd=iMap->id2sd(script_getnum(st,3));
+ sd=map->id2sd(script_getnum(st,3));
else
sd=script_rid2sd(st);
@@ -9991,9 +9949,8 @@ BUILDIN(changesex)
/*==========================================
* Works like 'announce' but outputs in the common chat window
*------------------------------------------*/
-BUILDIN(globalmes)
-{
- struct block_list *bl = iMap->id2bl(st->oid);
+BUILDIN(globalmes) {
+ struct block_list *bl = map->id2bl(st->oid);
struct npc_data *nd = (struct npc_data *)bl;
const char *name=NULL,*mes;
@@ -10018,8 +9975,7 @@ BUILDIN(globalmes)
/// Creates a waiting room (chat room) for this npc.
///
/// waitingroom "<title>",<limit>{,"<event>"{,<trigger>{,<zeny>{,<minlvl>{,<maxlvl>}}}}};
-BUILDIN(waitingroom)
-{
+BUILDIN(waitingroom) {
struct npc_data* nd;
int pub = 1;
const char* title = script_getstr(st, 2);
@@ -10030,7 +9986,7 @@ BUILDIN(waitingroom)
int minLvl = script_hasdata(st,7) ? script_getnum(st,7) : 1;
int maxLvl = script_hasdata(st,8) ? script_getnum(st,8) : MAX_LEVEL;
- nd = (struct npc_data *)iMap->id2bl(st->oid);
+ nd = (struct npc_data *)map->id2bl(st->oid);
if( nd != NULL )
chat->createnpcchat(nd, title, limit, pub, trigger, ev, zeny, minLvl, maxLvl);
@@ -10041,13 +9997,12 @@ BUILDIN(waitingroom)
///
/// delwaitingroom "<npc_name>";
/// delwaitingroom;
-BUILDIN(delwaitingroom)
-{
+BUILDIN(delwaitingroom) {
struct npc_data* nd;
if( script_hasdata(st,2) )
nd = npc->name2id(script_getstr(st, 2));
else
- nd = (struct npc_data *)iMap->id2bl(st->oid);
+ nd = (struct npc_data *)map->id2bl(st->oid);
if( nd != NULL )
chat->deletenpcchat(nd);
return true;
@@ -10057,17 +10012,16 @@ BUILDIN(delwaitingroom)
///
/// kickwaitingroomall "<npc_name>";
/// kickwaitingroomall;
-BUILDIN(waitingroomkickall)
-{
+BUILDIN(waitingroomkickall) {
struct npc_data* nd;
struct chat_data* cd;
if( script_hasdata(st,2) )
nd = npc->name2id(script_getstr(st,2));
else
- nd = (struct npc_data *)iMap->id2bl(st->oid);
+ nd = (struct npc_data *)map->id2bl(st->oid);
- if( nd != NULL && (cd=(struct chat_data *)iMap->id2bl(nd->chat_id)) != NULL )
+ if( nd != NULL && (cd=(struct chat_data *)map->id2bl(nd->chat_id)) != NULL )
chat->npckickall(cd);
return true;
}
@@ -10076,17 +10030,16 @@ BUILDIN(waitingroomkickall)
///
/// enablewaitingroomevent "<npc_name>";
/// enablewaitingroomevent;
-BUILDIN(enablewaitingroomevent)
-{
+BUILDIN(enablewaitingroomevent) {
struct npc_data* nd;
struct chat_data* cd;
if( script_hasdata(st,2) )
nd = npc->name2id(script_getstr(st, 2));
else
- nd = (struct npc_data *)iMap->id2bl(st->oid);
+ nd = (struct npc_data *)map->id2bl(st->oid);
- if( nd != NULL && (cd=(struct chat_data *)iMap->id2bl(nd->chat_id)) != NULL )
+ if( nd != NULL && (cd=(struct chat_data *)map->id2bl(nd->chat_id)) != NULL )
chat->enableevent(cd);
return true;
}
@@ -10095,17 +10048,16 @@ BUILDIN(enablewaitingroomevent)
///
/// disablewaitingroomevent "<npc_name>";
/// disablewaitingroomevent;
-BUILDIN(disablewaitingroomevent)
-{
+BUILDIN(disablewaitingroomevent) {
struct npc_data *nd;
struct chat_data *cd;
if( script_hasdata(st,2) )
nd = npc->name2id(script_getstr(st, 2));
else
- nd = (struct npc_data *)iMap->id2bl(st->oid);
+ nd = (struct npc_data *)map->id2bl(st->oid);
- if( nd != NULL && (cd=(struct chat_data *)iMap->id2bl(nd->chat_id)) != NULL )
+ if( nd != NULL && (cd=(struct chat_data *)map->id2bl(nd->chat_id)) != NULL )
chat->disableevent(cd);
return true;
}
@@ -10124,8 +10076,7 @@ BUILDIN(disablewaitingroomevent)
///
/// getwaitingroomstate(<type>,"<npc_name>") -> <info>
/// getwaitingroomstate(<type>) -> <info>
-BUILDIN(getwaitingroomstate)
-{
+BUILDIN(getwaitingroomstate) {
struct npc_data *nd;
struct chat_data *cd;
int type;
@@ -10134,16 +10085,14 @@ BUILDIN(getwaitingroomstate)
if( script_hasdata(st,3) )
nd = npc->name2id(script_getstr(st, 3));
else
- nd = (struct npc_data *)iMap->id2bl(st->oid);
+ nd = (struct npc_data *)map->id2bl(st->oid);
- if( nd == NULL || (cd=(struct chat_data *)iMap->id2bl(nd->chat_id)) == NULL )
- {
+ if( nd == NULL || (cd=(struct chat_data *)map->id2bl(nd->chat_id)) == NULL ) {
script_pushint(st, -1);
return true;
}
- switch(type)
- {
+ switch(type) {
case 0: script_pushint(st, cd->users); break;
case 1: script_pushint(st, cd->limit); break;
case 2: script_pushint(st, cd->trigger&0x7f); break;
@@ -10180,8 +10129,8 @@ BUILDIN(warpwaitingpc) {
struct chat_data* cd;
TBL_PC* sd;
- nd = (struct npc_data *)iMap->id2bl(st->oid);
- if( nd == NULL || (cd=(struct chat_data *)iMap->id2bl(nd->chat_id)) == NULL )
+ nd = (struct npc_data *)map->id2bl(st->oid);
+ if( nd == NULL || (cd=(struct chat_data *)map->id2bl(nd->chat_id)) == NULL )
return true;
map_name = script_getstr(st,2);
@@ -10239,11 +10188,10 @@ void script_detach_rid(struct script_state* st) {
/*==========================================
* Attach sd char id to script and detach current one if any
*------------------------------------------*/
-BUILDIN(attachrid)
-{
+BUILDIN(attachrid) {
int rid = script_getnum(st,2);
- if (iMap->id2sd(rid) != NULL) {
+ if (map->id2sd(rid) != NULL) {
script_detach_rid(st);
st->rid = rid;
@@ -10264,9 +10212,8 @@ BUILDIN(detachrid)
/*==========================================
* Chk if account connected, (and charid from account if specified)
*------------------------------------------*/
-BUILDIN(isloggedin)
-{
- TBL_PC* sd = iMap->id2sd(script_getnum(st,2));
+BUILDIN(isloggedin) {
+ TBL_PC* sd = map->id2sd(script_getnum(st,2));
if (script_hasdata(st,3) && sd &&
sd->status.char_id != script_getnum(st,3))
sd = NULL;
@@ -10278,8 +10225,7 @@ BUILDIN(isloggedin)
/*==========================================
*
*------------------------------------------*/
-BUILDIN(setmapflagnosave)
-{
+BUILDIN(setmapflagnosave) {
int16 m,x,y;
unsigned short mapindex;
const char *str,*str2;
@@ -10288,7 +10234,7 @@ BUILDIN(setmapflagnosave)
str2=script_getstr(st,3);
x=script_getnum(st,4);
y=script_getnum(st,5);
- m = iMap->mapname2mapid(str);
+ m = map->mapname2mapid(str);
mapindex = mapindex_name2id(str2);
if(m >= 0 && mapindex) {
@@ -10309,7 +10255,7 @@ BUILDIN(getmapflag)
str=script_getstr(st,2);
i=script_getnum(st,3);
- m = iMap->mapname2mapid(str);
+ m = map->mapname2mapid(str);
if(m >= 0) {
switch(i) {
case MF_NOMEMO: script_pushint(st,maplist[m].flag.nomemo); break;
@@ -10403,7 +10349,7 @@ BUILDIN(setmapflag) {
val = script_getnum(st, 4);
}
- m = iMap->mapname2mapid(str);
+ m = map->mapname2mapid(str);
if(m >= 0) {
switch(i) {
@@ -10416,7 +10362,7 @@ BUILDIN(setmapflag) {
case MF_PVP:
maplist[m].flag.pvp = 1;
if( !battle_config.pk_mode ) {
- iMap->foreachinmap(script_mapflag_pvp_sub,m,BL_PC);
+ map->foreachinmap(script_mapflag_pvp_sub,m,BL_PC);
}
break;
case MF_PVP_NOPARTY: maplist[m].flag.pvp_noparty = 1; break;
@@ -10491,7 +10437,7 @@ BUILDIN(removemapflag) {
str=script_getstr(st,2);
i=script_getnum(st,3);
- m = iMap->mapname2mapid(str);
+ m = map->mapname2mapid(str);
if(m >= 0) {
switch(i) {
case MF_NOMEMO: maplist[m].flag.nomemo = 0; break;
@@ -10544,7 +10490,7 @@ BUILDIN(removemapflag) {
case MF_NOWARPTO: maplist[m].flag.nowarpto = 0; break;
case MF_NIGHTMAREDROP: maplist[m].flag.pvp_nightmaredrop = 0; break;
case MF_ZONE:
- iMap->zone_change2(m, maplist[m].prev_zone);
+ map->zone_change2(m, maplist[m].prev_zone);
break;
case MF_NOCOMMAND: maplist[m].nocommand = 0; break;
case MF_NODROP: maplist[m].flag.nodrop = 0; break;
@@ -10577,11 +10523,11 @@ BUILDIN(pvpon) {
struct block_list bl;
str = script_getstr(st,2);
- m = iMap->mapname2mapid(str);
+ m = map->mapname2mapid(str);
if( m < 0 || maplist[m].flag.pvp )
return true; // nothing to do
- iMap->zone_change2(m, strdb_get(zone_db, MAP_ZONE_PVP_NAME));
+ map->zone_change2(m, strdb_get(zone_db, MAP_ZONE_PVP_NAME));
maplist[m].flag.pvp = 1;
clif->map_property_mapall(m, MAPPROPERTY_FREEPVPZONE);
bl.type = BL_NUL;
@@ -10627,11 +10573,11 @@ BUILDIN(pvpoff) {
struct block_list bl;
str=script_getstr(st,2);
- m = iMap->mapname2mapid(str);
+ m = map->mapname2mapid(str);
if(m < 0 || !maplist[m].flag.pvp)
return true; //fixed Lupus
- iMap->zone_change2(m, maplist[m].prev_zone);
+ map->zone_change2(m, maplist[m].prev_zone);
maplist[m].flag.pvp = 0;
clif->map_property_mapall(m, MAPPROPERTY_NOTHING);
bl.type = BL_NUL;
@@ -10641,7 +10587,7 @@ BUILDIN(pvpoff) {
if(battle_config.pk_mode) // disable ranking options if pk_mode is on [Valaris]
return true;
- iMap->foreachinmap(buildin_pvpoff_sub, m, BL_PC);
+ map->foreachinmap(buildin_pvpoff_sub, m, BL_PC);
return true;
}
@@ -10650,10 +10596,10 @@ BUILDIN(gvgon) {
const char *str;
str=script_getstr(st,2);
- m = iMap->mapname2mapid(str);
+ m = map->mapname2mapid(str);
if(m >= 0 && !maplist[m].flag.gvg) {
struct block_list bl;
- iMap->zone_change2(m, strdb_get(zone_db, MAP_ZONE_GVG_NAME));
+ map->zone_change2(m, strdb_get(zone_db, MAP_ZONE_GVG_NAME));
maplist[m].flag.gvg = 1;
clif->map_property_mapall(m, MAPPROPERTY_AGITZONE);
bl.type = BL_NUL;
@@ -10668,10 +10614,10 @@ BUILDIN(gvgoff) {
const char *str;
str=script_getstr(st,2);
- m = iMap->mapname2mapid(str);
+ m = map->mapname2mapid(str);
if(m >= 0 && maplist[m].flag.gvg) {
struct block_list bl;
- iMap->zone_change2(m, maplist[m].prev_zone);
+ map->zone_change2(m, maplist[m].prev_zone);
maplist[m].flag.gvg = 0;
clif->map_property_mapall(m, MAPPROPERTY_NOTHING);
bl.type = BL_NUL;
@@ -10686,8 +10632,7 @@ BUILDIN(gvgoff) {
* emotion emotion#, <target: 0 - NPC, 1 - PC>, <NPC/PC name>
*------------------------------------------*/
//Optional second parameter added by [Skotlex]
-BUILDIN(emotion)
-{
+BUILDIN(emotion) {
int type;
int player=0;
@@ -10701,20 +10646,17 @@ BUILDIN(emotion)
if (player) {
TBL_PC *sd = NULL;
if( script_hasdata(st,4) )
- sd = iMap->nick2sd(script_getstr(st,4));
+ sd = map->nick2sd(script_getstr(st,4));
else
sd = script_rid2sd(st);
if (sd)
clif->emotion(&sd->bl,type);
+ } else if( script_hasdata(st,4) ) {
+ TBL_NPC *nd = npc->name2id(script_getstr(st,4));
+ if(nd)
+ clif->emotion(&nd->bl,type);
} else
- if( script_hasdata(st,4) )
- {
- TBL_NPC *nd = npc->name2id(script_getstr(st,4));
- if(nd)
- clif->emotion(&nd->bl,type);
- }
- else
- clif->emotion(iMap->id2bl(st->oid),type);
+ clif->emotion(map->id2bl(st->oid),type);
return true;
}
@@ -10745,52 +10687,47 @@ static int buildin_maprespawnguildid_sub_mob(struct block_list *bl,va_list ap)
return 0;
}
-BUILDIN(maprespawnguildid)
-{
+BUILDIN(maprespawnguildid) {
const char *mapname=script_getstr(st,2);
int g_id=script_getnum(st,3);
int flag=script_getnum(st,4);
- int16 m=iMap->mapname2mapid(mapname);
+ int16 m=map->mapname2mapid(mapname);
if(m == -1)
return true;
//Catch ALL players (in case some are 'between maps' on execution time)
- iMap->map_foreachpc(buildin_maprespawnguildid_sub_pc,m,g_id,flag);
+ map->map_foreachpc(buildin_maprespawnguildid_sub_pc,m,g_id,flag);
if (flag&4) //Remove script mobs.
- iMap->foreachinmap(buildin_maprespawnguildid_sub_mob,m,BL_MOB);
+ map->foreachinmap(buildin_maprespawnguildid_sub_mob,m,BL_MOB);
return true;
}
-BUILDIN(agitstart)
-{
- if(iMap->agit_flag==1) return true; // Agit already Start.
- iMap->agit_flag=1;
+BUILDIN(agitstart) {
+ if(map->agit_flag==1) return true; // Agit already Start.
+ map->agit_flag=1;
guild->agit_start();
return true;
}
-BUILDIN(agitend)
-{
- if(iMap->agit_flag==0) return true; // Agit already End.
- iMap->agit_flag=0;
+BUILDIN(agitend) {
+ if(map->agit_flag==0) return true; // Agit already End.
+ map->agit_flag=0;
guild->agit_end();
return true;
}
-BUILDIN(agitstart2)
-{
- if(iMap->agit2_flag==1) return true; // Agit2 already Start.
- iMap->agit2_flag=1;
+BUILDIN(agitstart2) {
+ if(map->agit2_flag==1) return true; // Agit2 already Start.
+ map->agit2_flag=1;
guild->agit2_start();
return true;
}
-BUILDIN(agitend2)
-{
- if(iMap->agit2_flag==0) return true; // Agit2 already End.
- iMap->agit2_flag=0;
+BUILDIN(agitend2) {
+ if(map->agit2_flag==0) return true; // Agit2 already End.
+ map->agit2_flag=0;
guild->agit2_end();
return true;
}
@@ -10798,32 +10735,29 @@ BUILDIN(agitend2)
/*==========================================
* Returns whether woe is on or off. // choice script
*------------------------------------------*/
-BUILDIN(agitcheck)
-{
- script_pushint(st,iMap->agit_flag);
+BUILDIN(agitcheck) {
+ script_pushint(st,map->agit_flag);
return true;
}
/*==========================================
* Returns whether woese is on or off. // choice script
*------------------------------------------*/
-BUILDIN(agitcheck2)
-{
- script_pushint(st,iMap->agit2_flag);
+BUILDIN(agitcheck2) {
+ script_pushint(st,map->agit2_flag);
return true;
}
/// Sets the guild_id of this npc.
///
/// flagemblem <guild_id>;
-BUILDIN(flagemblem)
-{
+BUILDIN(flagemblem) {
TBL_NPC* nd;
int g_id = script_getnum(st,2);
if(g_id < 0) return true;
- nd = (TBL_NPC*)iMap->id2nd(st->oid);
+ nd = (TBL_NPC*)map->id2nd(st->oid);
if( nd == NULL ) {
ShowError("script:flagemblem: npc %d not found\n", st->oid);
} else if( nd->subtype != SCRIPT ) {
@@ -10994,7 +10928,7 @@ BUILDIN(successremovecards) {
if((flag=pc->additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))){ // get back the cart in inventory
clif->additem(sd,0,0,flag);
- iMap->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ map->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
}
}
@@ -11016,7 +10950,7 @@ BUILDIN(successremovecards) {
pc->delitem(sd,i,1,0,3,LOG_TYPE_SCRIPT);
if((flag=pc->additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))){ //chk if can be spawn in inventory otherwise put on floor
clif->additem(sd,0,0,flag);
- iMap->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ map->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
clif->misceffect(&sd->bl,3);
@@ -11061,7 +10995,7 @@ BUILDIN(failedremovecards) {
if((flag=pc->additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))){
clif->additem(sd,0,0,flag);
- iMap->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ map->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
}
}
@@ -11090,7 +11024,7 @@ BUILDIN(failedremovecards) {
if((flag=pc->additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))){
clif->additem(sd,0,0,flag);
- iMap->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ map->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
}
clif->misceffect(&sd->bl,2);
@@ -11104,8 +11038,8 @@ BUILDIN(failedremovecards) {
* type: 0=everyone, 1=guild, 2=party; [Reddozen]
* improved by [Lance]
* ================================================================*/
-BUILDIN(mapwarp) // Added by RoVeRT
-{
+// Added by RoVeRT
+BUILDIN(mapwarp) {
int x,y,m,check_val=0,check_ID=0,i=0;
struct guild *g = NULL;
struct party_data *p = NULL;
@@ -11121,7 +11055,7 @@ BUILDIN(mapwarp) // Added by RoVeRT
check_ID=script_getnum(st,7);
}
- if((m=iMap->mapname2mapid(mapname))< 0)
+ if((m=map->mapname2mapid(mapname))< 0)
return true;
if(!(index=mapindex_name2id(str)))
@@ -11150,7 +11084,7 @@ BUILDIN(mapwarp) // Added by RoVeRT
}
break;
default:
- iMap->foreachinmap(buildin_areawarp_sub,m,BL_PC,index,x,y,0,0);
+ map->foreachinmap(buildin_areawarp_sub,m,BL_PC,index,x,y,0,0);
break;
}
@@ -11166,8 +11100,8 @@ static int buildin_mobcount_sub(struct block_list *bl,va_list ap) // Added by Ro
return 0;
}
-BUILDIN(mobcount) // Added by RoVeRT
-{
+// Added by RoVeRT
+BUILDIN(mobcount) {
const char *mapname,*event;
int16 m;
mapname=script_getstr(st,2);
@@ -11186,7 +11120,7 @@ BUILDIN(mobcount) // Added by RoVeRT
script_pushint(st,-1);
return true;
}
- } else if( (m = iMap->mapname2mapid(mapname)) < 0 ) {
+ } else if( (m = map->mapname2mapid(mapname)) < 0 ) {
script_pushint(st,-1);
return true;
}
@@ -11196,16 +11130,15 @@ BUILDIN(mobcount) // Added by RoVeRT
return true;
}
- script_pushint(st,iMap->foreachinmap(buildin_mobcount_sub, m, BL_MOB, event));
+ script_pushint(st,map->foreachinmap(buildin_mobcount_sub, m, BL_MOB, event));
return true;
}
-BUILDIN(marriage)
-{
+BUILDIN(marriage) {
const char *partner=script_getstr(st,2);
TBL_PC *sd=script_rid2sd(st);
- TBL_PC *p_sd=iMap->nick2sd(partner);
+ TBL_PC *p_sd=map->nick2sd(partner);
if(sd==NULL || p_sd==NULL || pc->marriage(sd,p_sd) < 0){
script_pushint(st,0);
@@ -11214,13 +11147,12 @@ BUILDIN(marriage)
script_pushint(st,1);
return true;
}
-BUILDIN(wedding_effect)
-{
+BUILDIN(wedding_effect) {
TBL_PC *sd=script_rid2sd(st);
struct block_list *bl;
if(sd==NULL) {
- bl=iMap->id2bl(st->oid);
+ bl=map->id2bl(st->oid);
} else
bl=&sd->bl;
clif->wedding_effect(bl);
@@ -11237,12 +11169,11 @@ BUILDIN(divorce)
return true;
}
-BUILDIN(ispartneron)
-{
+BUILDIN(ispartneron) {
TBL_PC *sd=script_rid2sd(st);
if(sd==NULL || !pc->ismarried(sd) ||
- iMap->charid2sd(sd->status.partner_id) == NULL) {
+ map->charid2sd(sd->status.partner_id) == NULL) {
script_pushint(st,0);
return true;
}
@@ -11308,7 +11239,7 @@ BUILDIN(warppartner)
TBL_PC *p_sd=NULL;
if(sd==NULL || !pc->ismarried(sd) ||
- (p_sd=iMap->charid2sd(sd->status.partner_id)) == NULL) {
+ (p_sd=map->charid2sd(sd->status.partner_id)) == NULL) {
script_pushint(st,0);
return true;
}
@@ -11418,16 +11349,15 @@ BUILDIN(setwall) {
shootable = script_getnum(st,7);
name = script_getstr(st,8);
- if( (m = iMap->mapname2mapid(mapname)) < 0 )
+ if( (m = map->mapname2mapid(mapname)) < 0 )
return true; // Invalid Map
- iMap->iwall_set(m, x, y, size, dir, shootable, name);
+ map->iwall_set(m, x, y, size, dir, shootable, name);
return true;
}
-BUILDIN(delwall)
-{
+BUILDIN(delwall) {
const char *name = script_getstr(st,2);
- iMap->iwall_remove(name);
+ map->iwall_remove(name);
return true;
}
@@ -11439,8 +11369,7 @@ BUILDIN(delwall)
/// 1 - maximum hp
/// 2 - current hp
///
-BUILDIN(guardianinfo)
-{
+BUILDIN(guardianinfo) {
const char* mapname = mapindex_getmapname(script_getstr(st,2),NULL);
int id = script_getnum(st,3);
int type = script_getnum(st,4);
@@ -11448,27 +11377,23 @@ BUILDIN(guardianinfo)
struct guild_castle* gc = guild->mapname2gc(mapname);
struct mob_data* gd;
- if( gc == NULL || id < 0 || id >= MAX_GUARDIANS )
- {
+ if( gc == NULL || id < 0 || id >= MAX_GUARDIANS ) {
script_pushint(st,-1);
return true;
}
if( type == 0 )
script_pushint(st, gc->guardian[id].visible);
+ else if( !gc->guardian[id].visible )
+ script_pushint(st,-1);
+ else if( (gd = map->id2md(gc->guardian[id].id)) == NULL )
+ script_pushint(st,-1);
+ else if( type == 1 )
+ script_pushint(st,gd->status.max_hp);
+ else if( type == 2 )
+ script_pushint(st,gd->status.hp);
else
- if( !gc->guardian[id].visible )
- script_pushint(st,-1);
- else
- if( (gd = iMap->id2md(gc->guardian[id].id)) == NULL )
- script_pushint(st,-1);
- else
- {
- if ( type == 1 ) script_pushint(st,gd->status.max_hp);
- else if( type == 2 ) script_pushint(st,gd->status.hp);
- else
- script_pushint(st,-1);
- }
+ script_pushint(st,-1);
return true;
}
@@ -11819,10 +11744,9 @@ BUILDIN(undisguise)
* Transform a bl to another _class,
* @type unused
*------------------------------------------*/
-BUILDIN(classchange)
-{
+BUILDIN(classchange) {
int _class,type;
- struct block_list *bl=iMap->id2bl(st->oid);
+ struct block_list *bl=map->id2bl(st->oid);
if(bl==NULL) return true;
@@ -11841,7 +11765,7 @@ BUILDIN(misceffect)
type=script_getnum(st,2);
if(st->oid && st->oid != npc->fake_nd->bl.id) {
- struct block_list *bl = iMap->id2bl(st->oid);
+ struct block_list *bl = map->id2bl(st->oid);
if (bl)
clif->specialeffect(bl,type,AREA);
} else{
@@ -11903,28 +11827,26 @@ BUILDIN(playBGMall) {
int y1 = script_getnum(st,7);
int m;
- if ( ( m = iMap->mapname2mapid(mapname) ) == -1 ) {
+ if ( ( m = map->mapname2mapid(mapname) ) == -1 ) {
ShowWarning("playBGMall: Attempted to play song '%s' on non-existent map '%s'\n",name, mapname);
return true;
}
- iMap->foreachinarea(playBGM_sub, m, x0, y0, x1, y1, BL_PC, name);
- }
- else if( script_hasdata(st,3) )
- {// entire map
+ map->foreachinarea(playBGM_sub, m, x0, y0, x1, y1, BL_PC, name);
+ } else if( script_hasdata(st,3) ) {
+ // entire map
const char* mapname = script_getstr(st,3);
int m;
- if ( ( m = iMap->mapname2mapid(mapname) ) == -1 ) {
+ if ( ( m = map->mapname2mapid(mapname) ) == -1 ) {
ShowWarning("playBGMall: Attempted to play song '%s' on non-existent map '%s'\n",name, mapname);
return true;
}
- iMap->foreachinmap(playBGM_sub, m, BL_PC, name);
- }
- else
- {// entire server
- iMap->map_foreachpc(&playBGM_foreachpc_sub, name);
+ map->foreachinmap(playBGM_sub, m, BL_PC, name);
+ } else {
+ // entire server
+ map->map_foreachpc(&playBGM_foreachpc_sub, name);
}
return true;
@@ -11960,20 +11882,19 @@ int soundeffect_sub(struct block_list* bl,va_list ap)
* Play a sound effect (.wav) on multiple clients
* soundeffectall "<filepath>",<type>{,"<map name>"}{,<x0>,<y0>,<x1>,<y1>};
*------------------------------------------*/
-BUILDIN(soundeffectall)
-{
+BUILDIN(soundeffectall) {
struct block_list* bl;
const char* name;
int type;
- bl = (st->rid) ? &(script_rid2sd(st)->bl) : iMap->id2bl(st->oid);
+ bl = (st->rid) ? &(script_rid2sd(st)->bl) : map->id2bl(st->oid);
if (!bl)
return true;
name = script_getstr(st,2);
type = script_getnum(st,3);
- //FIXME: enumerating map squares (iMap->foreach) is slower than enumerating the list of online players (iMap->foreachpc?) [ultramage]
+ //FIXME: enumerating map squares (map->foreach) is slower than enumerating the list of online players (map->foreachpc?) [ultramage]
if(!script_hasdata(st,4)) { // area around
clif->soundeffectall(bl, name, type, AREA);
@@ -11982,12 +11903,12 @@ BUILDIN(soundeffectall)
const char *mapname = script_getstr(st,4);
int m;
- if ( ( m = iMap->mapname2mapid(mapname) ) == -1 ) {
+ if ( ( m = map->mapname2mapid(mapname) ) == -1 ) {
ShowWarning("soundeffectall: Attempted to play song '%s' (type %d) on non-existent map '%s'\n",name,type, mapname);
return true;
}
- iMap->foreachinmap(soundeffect_sub, m, BL_PC, name, type);
+ map->foreachinmap(soundeffect_sub, m, BL_PC, name, type);
} else if(script_hasdata(st,8)) { // specified part of map
const char *mapname = script_getstr(st,4);
int x0 = script_getnum(st,5);
@@ -11996,12 +11917,12 @@ BUILDIN(soundeffectall)
int y1 = script_getnum(st,8);
int m;
- if ( ( m = iMap->mapname2mapid(mapname) ) == -1 ) {
+ if ( ( m = map->mapname2mapid(mapname) ) == -1 ) {
ShowWarning("soundeffectall: Attempted to play song '%s' (type %d) on non-existent map '%s'\n",name,type, mapname);
return true;
}
- iMap->foreachinarea(soundeffect_sub, m, x0, y0, x1, y1, BL_PC, name, type);
+ map->foreachinarea(soundeffect_sub, m, x0, y0, x1, y1, BL_PC, name, type);
} else {
ShowError("buildin_soundeffectall: insufficient arguments for specific area broadcast.\n");
}
@@ -12192,9 +12113,8 @@ BUILDIN(skilleffect)
*------------------------------------------*/
/// npcskilleffect <skill id>,<level>,<x>,<y>
/// npcskilleffect "<skill name>",<level>,<x>,<y>
-BUILDIN(npcskilleffect)
-{
- struct block_list *bl= iMap->id2bl(st->oid);
+BUILDIN(npcskilleffect) {
+ struct block_list *bl= map->id2bl(st->oid);
uint16 skill_id=( script_isstring(st,2) ? skill->name2id(script_getstr(st,2)) : script_getnum(st,2) );
uint16 skill_lv=script_getnum(st,3);
@@ -12210,9 +12130,8 @@ BUILDIN(npcskilleffect)
/*==========================================
* Special effects [Valaris]
*------------------------------------------*/
-BUILDIN(specialeffect)
-{
- struct block_list *bl=iMap->id2bl(st->oid);
+BUILDIN(specialeffect) {
+ struct block_list *bl=map->id2bl(st->oid);
int type = script_getnum(st,2);
enum send_target target = script_hasdata(st,3) ? (send_target)script_getnum(st,3) : AREA;
@@ -12239,14 +12158,13 @@ BUILDIN(specialeffect)
return true;
}
-BUILDIN(specialeffect2)
-{
+BUILDIN(specialeffect2) {
TBL_PC *sd=script_rid2sd(st);
int type = script_getnum(st,2);
enum send_target target = script_hasdata(st,3) ? (send_target)script_getnum(st,3) : AREA;
if( script_hasdata(st,4) )
- sd = iMap->nick2sd(script_getstr(st,4));
+ sd = map->nick2sd(script_getstr(st,4));
if (sd)
clif->specialeffect(&sd->bl, type, target);
@@ -12282,8 +12200,7 @@ BUILDIN(nude)
/*==========================================
* gmcommand [MouseJstr]
*------------------------------------------*/
-BUILDIN(atcommand)
-{
+BUILDIN(atcommand) {
TBL_PC *sd, *dummy_sd = NULL;
int fd;
const char* cmd;
@@ -12298,9 +12215,8 @@ BUILDIN(atcommand)
sd = dummy_sd = pc->get_dummy_sd();
fd = 0;
- if (st->oid)
- {
- struct block_list* bl = iMap->id2bl(st->oid);
+ if (st->oid) {
+ struct block_list* bl = map->id2bl(st->oid);
memcpy(&sd->bl, bl, sizeof(struct block_list));
if (bl->type == BL_NPC)
safestrncpy(sd->status.name, ((TBL_NPC*)bl)->name, NAME_LENGTH);
@@ -12422,29 +12338,23 @@ BUILDIN(gethominfo)
/// Retrieves information about character's mercenary
/// getmercinfo <type>[,<char id>];
-BUILDIN(getmercinfo)
-{
+BUILDIN(getmercinfo) {
int type, char_id;
struct map_session_data* sd;
struct mercenary_data* md;
type = script_getnum(st,2);
- if( script_hasdata(st,3) )
- {
+ if( script_hasdata(st,3) ) {
char_id = script_getnum(st,3);
- if( ( sd = iMap->charid2sd(char_id) ) == NULL )
- {
+ if( ( sd = map->charid2sd(char_id) ) == NULL ) {
ShowError("buildin_getmercinfo: No such character (char_id=%d).\n", char_id);
script_pushnil(st);
return false;
}
- }
- else
- {
- if( ( sd = script_rid2sd(st) ) == NULL )
- {
+ } else {
+ if( ( sd = script_rid2sd(st) ) == NULL ) {
script_pushnil(st);
return true;
}
@@ -12549,15 +12459,14 @@ BUILDIN(movenpc) {
/*==========================================
* message [MouseJstr]
*------------------------------------------*/
-BUILDIN(message)
-{
+BUILDIN(message) {
const char *msg,*player;
TBL_PC *pl_sd = NULL;
player = script_getstr(st,2);
msg = script_getstr(st,3);
- if((pl_sd=iMap->nick2sd((char *) player)) == NULL)
+ if((pl_sd=map->nick2sd((char *) player)) == NULL)
return true;
clif->message(pl_sd->fd, msg);
@@ -12567,12 +12476,11 @@ BUILDIN(message)
/*==========================================
* npctalk (sends message to surrounding area)
*------------------------------------------*/
-BUILDIN(npctalk)
-{
+BUILDIN(npctalk) {
const char* str;
char name[NAME_LENGTH], message[256];
- struct npc_data* nd = (struct npc_data *)iMap->id2bl(st->oid);
+ struct npc_data* nd = (struct npc_data *)map->id2bl(st->oid);
str = script_getstr(st,2);
if(nd)
@@ -12592,7 +12500,7 @@ BUILDIN(npcspeed) {
int speed;
speed = script_getnum(st,2);
- nd = (struct npc_data *)iMap->id2bl(st->oid);
+ nd = (struct npc_data *)map->id2bl(st->oid);
if( nd ) {
unit->bl2ud2(&nd->bl); // ensure nd->ud is safe to edit
@@ -12604,7 +12512,7 @@ BUILDIN(npcspeed) {
}
// make an npc walk to a position [Valaris]
BUILDIN(npcwalkto) {
- struct npc_data *nd=(struct npc_data *)iMap->id2bl(st->oid);
+ struct npc_data *nd=(struct npc_data *)map->id2bl(st->oid);
int x=0,y=0;
x=script_getnum(st,2);
@@ -12624,7 +12532,7 @@ BUILDIN(npcwalkto) {
}
// stop an npc's movement [Valaris]
BUILDIN(npcstop) {
- struct npc_data *nd = (struct npc_data *)iMap->id2bl(st->oid);
+ struct npc_data *nd = (struct npc_data *)map->id2bl(st->oid);
if( nd ) {
unit->bl2ud2(&nd->bl); // ensure nd->ud is safe to edit
@@ -12746,7 +12654,7 @@ BUILDIN(getmapxy)
switch (type){
case 0: //Get Character Position
if( script_hasdata(st,6) )
- sd=iMap->nick2sd(script_getstr(st,6));
+ sd=map->nick2sd(script_getstr(st,6));
else
sd=script_rid2sd(st);
@@ -12761,11 +12669,11 @@ BUILDIN(getmapxy)
if (nd)
bl = &nd->bl;
} else //In case the origin is not an npc?
- bl=iMap->id2bl(st->oid);
+ bl=map->id2bl(st->oid);
break;
case 2: //Get Pet Position
if(script_hasdata(st,6))
- sd=iMap->nick2sd(script_getstr(st,6));
+ sd=map->nick2sd(script_getstr(st,6));
else
sd=script_rid2sd(st);
@@ -12776,7 +12684,7 @@ BUILDIN(getmapxy)
break; //Not supported?
case 4: //Get Homun Position
if(script_hasdata(st,6))
- sd=iMap->nick2sd(script_getstr(st,6));
+ sd=map->nick2sd(script_getstr(st,6));
else
sd=script_rid2sd(st);
@@ -12785,7 +12693,7 @@ BUILDIN(getmapxy)
break;
case 5: //Get Mercenary Position
if(script_hasdata(st,6))
- sd=iMap->nick2sd(script_getstr(st,6));
+ sd=map->nick2sd(script_getstr(st,6));
else
sd=script_rid2sd(st);
@@ -12794,7 +12702,7 @@ BUILDIN(getmapxy)
break;
case 6: //Get Elemental Position
if(script_hasdata(st,6))
- sd=iMap->nick2sd(script_getstr(st,6));
+ sd=map->nick2sd(script_getstr(st,6));
else
sd=script_rid2sd(st);
@@ -12909,15 +12817,13 @@ BUILDIN(summon)
/*==========================================
* Checks whether it is daytime/nighttime
*------------------------------------------*/
-BUILDIN(isnight)
-{
- script_pushint(st,(iMap->night_flag == 1));
+BUILDIN(isnight) {
+ script_pushint(st,(map->night_flag == 1));
return true;
}
-BUILDIN(isday)
-{
- script_pushint(st,(iMap->night_flag == 0));
+BUILDIN(isday) {
+ script_pushint(st,(map->night_flag == 0));
return true;
}
@@ -13113,14 +13019,12 @@ BUILDIN(getrefine) {
/*=======================================================
* Day/Night controls
*-------------------------------------------------------*/
-BUILDIN(night)
-{
- if (iMap->night_flag != 1) pc->map_night_timer(pc->night_timer_tid, 0, 0, 1);
+BUILDIN(night) {
+ if (map->night_flag != 1) pc->map_night_timer(pc->night_timer_tid, 0, 0, 1);
return true;
}
-BUILDIN(day)
-{
- if (iMap->night_flag != 0) pc->map_day_timer(pc->day_timer_tid, 0, 0, 1);
+BUILDIN(day) {
+ if (map->night_flag != 0) pc->map_day_timer(pc->day_timer_tid, 0, 0, 1);
return true;
}
@@ -14467,8 +14371,7 @@ BUILDIN(npcshopdelitem)
}
//Sets a script to attach to a shop npc.
-BUILDIN(npcshopattach)
-{
+BUILDIN(npcshopattach) {
const char* npcname = script_getstr(st,2);
struct npc_data* nd = npc->name2id(npcname);
int flag = 1;
@@ -14483,7 +14386,7 @@ BUILDIN(npcshopattach)
}
if (flag)
- nd->master_nd = ((struct npc_data *)iMap->id2bl(st->oid));
+ nd->master_nd = ((struct npc_data *)map->id2bl(st->oid));
else
nd->master_nd = NULL;
@@ -14617,7 +14520,7 @@ BUILDIN(checkvending) // check vending [Nab4]
TBL_PC *sd = NULL;
if(script_hasdata(st,2))
- sd = iMap->nick2sd(script_getstr(st,2));
+ sd = map->nick2sd(script_getstr(st,2));
else
sd = script_rid2sd(st);
@@ -14630,12 +14533,12 @@ BUILDIN(checkvending) // check vending [Nab4]
}
-BUILDIN(checkchatting) // check chatting [Marka]
-{
+// check chatting [Marka]
+BUILDIN(checkchatting) {
TBL_PC *sd = NULL;
if(script_hasdata(st,2))
- sd = iMap->nick2sd(script_getstr(st,2));
+ sd = map->nick2sd(script_getstr(st,2));
else
sd = script_rid2sd(st);
@@ -14647,12 +14550,11 @@ BUILDIN(checkchatting) // check chatting [Marka]
return true;
}
-BUILDIN(checkidle)
-{
+BUILDIN(checkidle) {
TBL_PC *sd = NULL;
if (script_hasdata(st, 2))
- sd = iMap->nick2sd(script_getstr(st, 2));
+ sd = map->nick2sd(script_getstr(st, 2));
else
sd = script_rid2sd(st);
@@ -14775,12 +14677,10 @@ BUILDIN(axtoi)
}
// [zBuffer] List of player cont commands --->
-BUILDIN(rid2name)
-{
+BUILDIN(rid2name) {
struct block_list *bl = NULL;
int rid = script_getnum(st,2);
- if((bl = iMap->id2bl(rid)))
- {
+ if((bl = map->id2bl(rid))) {
switch(bl->type) {
case BL_MOB: script_pushstrcopy(st,((TBL_MOB*)bl)->name); break;
case BL_PC: script_pushstrcopy(st,((TBL_PC*)bl)->status.name); break;
@@ -14800,8 +14700,7 @@ BUILDIN(rid2name)
return true;
}
-BUILDIN(pcblockmove)
-{
+BUILDIN(pcblockmove) {
int id, flag;
TBL_PC *sd = NULL;
@@ -14809,7 +14708,7 @@ BUILDIN(pcblockmove)
flag = script_getnum(st,3);
if(id)
- sd = iMap->id2sd(id);
+ sd = map->id2sd(id);
else
sd = script_rid2sd(st);
@@ -14819,8 +14718,7 @@ BUILDIN(pcblockmove)
return true;
}
-BUILDIN(pcfollow)
-{
+BUILDIN(pcfollow) {
int id, targetid;
TBL_PC *sd = NULL;
@@ -14829,7 +14727,7 @@ BUILDIN(pcfollow)
targetid = script_getnum(st,3);
if(id)
- sd = iMap->id2sd(id);
+ sd = map->id2sd(id);
else
sd = script_rid2sd(st);
@@ -14848,7 +14746,7 @@ BUILDIN(pcstopfollow)
id = script_getnum(st,2);
if(id)
- sd = iMap->id2sd(id);
+ sd = map->id2sd(id);
else
sd = script_rid2sd(st);
@@ -14869,7 +14767,7 @@ BUILDIN(pcstopfollow)
BUILDIN(unitwalk) {
struct block_list* bl;
- bl = iMap->id2bl(script_getnum(st,2));
+ bl = map->id2bl(script_getnum(st,2));
if( bl == NULL ) {
script_pushint(st, 0);
return true;
@@ -14884,7 +14782,7 @@ BUILDIN(unitwalk) {
script_pushint(st, unit->walktoxy(bl,x,y,0));// We'll use harder calculations.
} else {
int map_id = script_getnum(st,3);
- script_pushint(st, unit->walktobl(bl,iMap->id2bl(map_id),65025,1));
+ script_pushint(st, unit->walktobl(bl,map->id2bl(map_id),65025,1));
}
return true;
@@ -14895,7 +14793,7 @@ BUILDIN(unitwalk) {
/// unitkill <unit_id>;
BUILDIN(unitkill)
{
- struct block_list* bl = iMap->id2bl(script_getnum(st,2));
+ struct block_list* bl = map->id2bl(script_getnum(st,2));
if( bl != NULL )
status_kill(bl);
@@ -14920,14 +14818,14 @@ BUILDIN(unitwarp) {
y = (short)script_getnum(st,5);
if (!unit_id) //Warp the script's runner
- bl = iMap->id2bl(st->rid);
+ bl = map->id2bl(st->rid);
else
- bl = iMap->id2bl(unit_id);
+ bl = map->id2bl(unit_id);
if( strcmp(mapname,"this") == 0 )
mapid = bl?bl->m:-1;
else
- mapid = iMap->mapname2mapid(mapname);
+ mapid = map->mapname2mapid(mapname);
if( mapid >= 0 && bl != NULL ) {
unit->bl2ud2(bl); // ensure ((TBL_NPC*)bl)->ud is safe to edit
@@ -14946,15 +14844,14 @@ BUILDIN(unitwarp) {
///
/// unitattack(<unit_id>,"<target name>"{,<action type>}) -> <bool>
/// unitattack(<unit_id>,<target_id>{,<action type>}) -> <bool>
-BUILDIN(unitattack)
-{
+BUILDIN(unitattack) {
struct block_list* unit_bl;
struct block_list* target_bl = NULL;
struct script_data* data;
int actiontype = 0;
// get unit
- unit_bl = iMap->id2bl(script_getnum(st,2));
+ unit_bl = map->id2bl(script_getnum(st,2));
if( unit_bl == NULL ) {
script_pushint(st, 0);
return true;
@@ -14962,13 +14859,12 @@ BUILDIN(unitattack)
data = script_getdata(st, 3);
script->get_val(st, data);
- if( data_isstring(data) )
- {
- TBL_PC* sd = iMap->nick2sd(script->conv_str(st, data));
+ if( data_isstring(data) ) {
+ TBL_PC* sd = map->nick2sd(script->conv_str(st, data));
if( sd != NULL )
target_bl = &sd->bl;
} else
- target_bl = iMap->id2bl(script->conv_num(st, data));
+ target_bl = map->id2bl(script->conv_num(st, data));
// request the attack
if( target_bl == NULL )
{
@@ -15010,9 +14906,8 @@ BUILDIN(unitstop) {
unit_id = script_getnum(st,2);
- bl = iMap->id2bl(unit_id);
- if( bl != NULL )
- {
+ bl = map->id2bl(unit_id);
+ if( bl != NULL ) {
unit->bl2ud2(bl); // ensure ((TBL_NPC*)bl)->ud is safe to edit
unit->stop_attack(bl);
unit->stop_walking(bl,4);
@@ -15034,7 +14929,7 @@ BUILDIN(unittalk) {
unit_id = script_getnum(st,2);
message = script_getstr(st, 3);
- bl = iMap->id2bl(unit_id);
+ bl = map->id2bl(unit_id);
if( bl != NULL ) {
struct StringBuf sbuf;
StrBuf->Init(&sbuf);
@@ -15053,15 +14948,14 @@ BUILDIN(unittalk) {
/// unitemote <unit_id>,<emotion>;
///
/// @see e_* in const.txt
-BUILDIN(unitemote)
-{
+BUILDIN(unitemote) {
int unit_id;
int emotion;
struct block_list* bl;
unit_id = script_getnum(st,2);
emotion = script_getnum(st,3);
- bl = iMap->id2bl(unit_id);
+ bl = map->id2bl(unit_id);
if( bl != NULL )
clif->emotion(bl, emotion);
@@ -15072,8 +14966,7 @@ BUILDIN(unitemote)
///
/// unitskilluseid <unit_id>,<skill_id>,<skill_lv>{,<target_id>};
/// unitskilluseid <unit_id>,"<skill name>",<skill_lv>{,<target_id>};
-BUILDIN(unitskilluseid)
-{
+BUILDIN(unitskilluseid) {
int unit_id;
uint16 skill_id;
uint16 skill_lv;
@@ -15085,7 +14978,7 @@ BUILDIN(unitskilluseid)
skill_lv = script_getnum(st,4);
target_id = ( script_hasdata(st,5) ? script_getnum(st,5) : unit_id );
- bl = iMap->id2bl(unit_id);
+ bl = map->id2bl(unit_id);
if( bl != NULL ) {
if( bl->type == BL_NPC ) {
@@ -15105,8 +14998,7 @@ BUILDIN(unitskilluseid)
///
/// unitskillusepos <unit_id>,<skill_id>,<skill_lv>,<target_x>,<target_y>;
/// unitskillusepos <unit_id>,"<skill name>",<skill_lv>,<target_x>,<target_y>;
-BUILDIN(unitskillusepos)
-{
+BUILDIN(unitskillusepos) {
int unit_id;
uint16 skill_id;
uint16 skill_lv;
@@ -15120,7 +15012,7 @@ BUILDIN(unitskillusepos)
skill_x = script_getnum(st,5);
skill_y = script_getnum(st,6);
- bl = iMap->id2bl(unit_id);
+ bl = map->id2bl(unit_id);
if( bl != NULL ) {
if( bl->type == BL_NPC ) {
@@ -15170,26 +15062,23 @@ BUILDIN(sleep)
/// Returns if a player is still attached
///
/// sleep2(<mili secconds>) -> <bool>
-BUILDIN(sleep2)
-{
+BUILDIN(sleep2) {
int ticks;
ticks = script_getnum(st,2);
- if( ticks <= 0 )
- {// do nothing
- script_pushint(st, (iMap->id2sd(st->rid)!=NULL));
- }
- else if( !st->sleep.tick )
- {// sleep for the target amount of time
+ if( ticks <= 0 ) {
+ // do nothing
+ script_pushint(st, (map->id2sd(st->rid)!=NULL));
+ } else if( !st->sleep.tick ) {
+ // sleep for the target amount of time
st->state = RERUNLINE;
st->sleep.tick = ticks;
- }
- else
- {// sleep time is over
+ } else {
+ // sleep time is over
st->state = RUN;
st->sleep.tick = 0;
- script_pushint(st, (iMap->id2sd(st->rid)!=NULL));
+ script_pushint(st, (map->id2sd(st->rid)!=NULL));
}
return true;
}
@@ -15211,7 +15100,7 @@ BUILDIN(awake) {
for( tst = dbi_first(iter); dbi_exists(iter); tst = dbi_next(iter) ) {
if( tst->oid == nd->bl.id ) {
- TBL_PC* sd = iMap->id2sd(tst->rid);
+ TBL_PC* sd = map->id2sd(tst->rid);
if( tst->sleep.timer == INVALID_TIMER ) {// already awake ???
continue;
@@ -15284,8 +15173,7 @@ BUILDIN(getvariableofnpc)
/// warpportal <source x>,<source y>,"<target map>",<target x>,<target y>;
///
/// @author blackhole89
-BUILDIN(warpportal)
-{
+BUILDIN(warpportal) {
int spx;
int spy;
unsigned short mapindex;
@@ -15294,7 +15182,7 @@ BUILDIN(warpportal)
struct skill_unit_group* group;
struct block_list* bl;
- bl = iMap->id2bl(st->oid);
+ bl = map->id2bl(st->oid);
if( bl == NULL )
{
ShowError("script:warpportal: npc is needed\n");
@@ -15351,9 +15239,8 @@ BUILDIN(openauction)
/// checkcell("<map name>",<x>,<y>,<type>) -> <bool>
///
/// @see cell_chk* constants in const.txt for the types
-BUILDIN(checkcell)
-{
- int16 m = iMap->mapname2mapid(script_getstr(st,2));
+BUILDIN(checkcell) {
+ int16 m = map->mapname2mapid(script_getstr(st,2));
int16 x = script_getnum(st,3);
int16 y = script_getnum(st,4);
cell_chk type = (cell_chk)script_getnum(st,5);
@@ -15363,7 +15250,7 @@ BUILDIN(checkcell)
return true;
}
- script_pushint(st, iMap->getcell(m, x, y, type));
+ script_pushint(st, map->getcell(m, x, y, type));
return true;
}
@@ -15373,9 +15260,8 @@ BUILDIN(checkcell)
/// setcell "<map name>",<x1>,<y1>,<x2>,<y2>,<type>,<flag>;
///
/// @see cell_* constants in const.txt for the types
-BUILDIN(setcell)
-{
- int16 m = iMap->mapname2mapid(script_getstr(st,2));
+BUILDIN(setcell) {
+ int16 m = map->mapname2mapid(script_getstr(st,2));
int16 x1 = script_getnum(st,3);
int16 y1 = script_getnum(st,4);
int16 x2 = script_getnum(st,5);
@@ -15637,10 +15523,9 @@ BUILDIN(checkquest)
return true;
}
-BUILDIN(showevent)
-{
+BUILDIN(showevent) {
TBL_PC *sd = script_rid2sd(st);
- struct npc_data *nd = iMap->id2nd(st->oid);
+ struct npc_data *nd = map->id2nd(st->oid);
int state, color;
if( sd == NULL || nd == NULL )
@@ -15658,8 +15543,7 @@ BUILDIN(showevent)
/*==========================================
* BattleGround System
*------------------------------------------*/
-BUILDIN(waitingroom2bg)
-{
+BUILDIN(waitingroom2bg) {
struct npc_data *nd;
struct chat_data *cd;
const char *map_name, *ev = "", *dev = "";
@@ -15669,10 +15553,9 @@ BUILDIN(waitingroom2bg)
if( script_hasdata(st,7) )
nd = npc->name2id(script_getstr(st,7));
else
- nd = (struct npc_data *)iMap->id2bl(st->oid);
+ nd = (struct npc_data *)map->id2bl(st->oid);
- if( nd == NULL || (cd = (struct chat_data *)iMap->id2bl(nd->chat_id)) == NULL )
- {
+ if( nd == NULL || (cd = (struct chat_data *)map->id2bl(nd->chat_id)) == NULL ) {
script_pushint(st,0);
return true;
}
@@ -15713,8 +15596,7 @@ BUILDIN(waitingroom2bg)
return true;
}
-BUILDIN(waitingroom2bg_single)
-{
+BUILDIN(waitingroom2bg_single) {
const char* map_name;
struct npc_data *nd;
struct chat_data *cd;
@@ -15730,7 +15612,7 @@ BUILDIN(waitingroom2bg_single)
y = script_getnum(st,5);
nd = npc->name2id(script_getstr(st,6));
- if( nd == NULL || (cd = (struct chat_data *)iMap->id2bl(nd->chat_id)) == NULL || cd->users <= 0 )
+ if( nd == NULL || (cd = (struct chat_data *)map->id2bl(nd->chat_id)) == NULL || cd->users <= 0 )
return true;
if( (sd = cd->usersd[0]) == NULL )
@@ -15793,14 +15675,13 @@ BUILDIN(bg_monster)
return true;
}
-BUILDIN(bg_monster_set_team)
-{
+BUILDIN(bg_monster_set_team) {
struct mob_data *md;
struct block_list *mbl;
int id = script_getnum(st,2),
bg_id = script_getnum(st,3);
- if( (mbl = iMap->id2bl(id)) == NULL || mbl->type != BL_MOB )
+ if( (mbl = map->id2bl(id)) == NULL || mbl->type != BL_MOB )
return true;
md = (TBL_MOB *)mbl;
md->bg_id = bg_id;
@@ -15830,8 +15711,7 @@ BUILDIN(bg_destroy)
return true;
}
-BUILDIN(bg_getareausers)
-{
+BUILDIN(bg_getareausers) {
const char *str;
int16 m, x0, y0, x1, y1;
int bg_id;
@@ -15842,8 +15722,7 @@ BUILDIN(bg_getareausers)
bg_id = script_getnum(st,2);
str = script_getstr(st,3);
- if( (bgd = bg->team_search(bg_id)) == NULL || (m = iMap->mapname2mapid(str)) < 0 )
- {
+ if( (bgd = bg->team_search(bg_id)) == NULL || (m = map->mapname2mapid(str)) < 0 ) {
script_pushint(st,0);
return true;
}
@@ -15871,7 +15750,7 @@ BUILDIN(bg_updatescore) {
int16 m;
str = script_getstr(st,2);
- if( (m = iMap->mapname2mapid(str)) < 0 )
+ if( (m = map->mapname2mapid(str)) < 0 )
return true;
maplist[m].bgscore_lion = script_getnum(st,3);
@@ -15998,7 +15877,7 @@ BUILDIN(instance_detachmap) {
instance_id = st->instance_id;
else return true;
- if( (m = iMap->mapname2mapid(str)) < 0 || (m = instance->map2imap(m,instance_id)) < 0 ) {
+ if( (m = map->mapname2mapid(str)) < 0 || (m = instance->map2imap(m,instance_id)) < 0 ) {
ShowError("buildin_instance_detachmap: Trying to detach invalid map %s\n", str);
return true;
}
@@ -16083,8 +15962,8 @@ BUILDIN(instance_announce) {
return true;
for( i = 0; i < instances[instance_id].num_map; i++ )
- iMap->foreachinmap(buildin_announce_sub, instances[instance_id].map[i], BL_PC,
- mes, strlen(mes)+1, flag&BC_COLOR_MASK, fontColor, fontType, fontSize, fontAlign, fontY);
+ map->foreachinmap(buildin_announce_sub, instances[instance_id].map[i], BL_PC,
+ mes, strlen(mes)+1, flag&BC_COLOR_MASK, fontColor, fontType, fontSize, fontAlign, fontY);
return true;
}
@@ -16121,7 +16000,7 @@ BUILDIN(has_instance) {
str = script_getstr(st, 2);
- if( (m = iMap->mapname2mapid(str)) < 0 ) {
+ if( (m = map->mapname2mapid(str)) < 0 ) {
script_pushconststr(st, "");
return true;
}
@@ -16204,12 +16083,12 @@ BUILDIN(instance_warpall) {
else
return true;
- if( (m = iMap->mapname2mapid(mapn)) < 0 || (maplist[m].flag.src4instance && (m = instance->mapid2imapid(m, instance_id)) < 0) )
+ if( (m = map->mapname2mapid(mapn)) < 0 || (maplist[m].flag.src4instance && (m = instance->mapid2imapid(m, instance_id)) < 0) )
return true;
mapindex = map_id2index(m);
- iMap->foreachininstance(buildin_instance_warpall_sub, instance_id, BL_PC,mapindex,x,y);
+ map->foreachininstance(buildin_instance_warpall_sub, instance_id, BL_PC,mapindex,x,y);
return true;
}
@@ -16252,7 +16131,7 @@ BUILDIN(instance_check_party) {
for( i = 0; i < MAX_PARTY; i++ )
if( (pl_sd = p->data[i].sd) )
- if(iMap->id2bl(pl_sd->bl.id)){
+ if(map->id2bl(pl_sd->bl.id)){
if(pl_sd->status.base_level < min){
script_pushint(st, 0);
return true;
@@ -16308,9 +16187,9 @@ static int buildin_mobuseskill_sub(struct block_list *bl,va_list ap)
// 0:self, 1:target, 2:master, default:random
switch( target )
{
- case 0: tbl = iMap->id2bl(md->bl.id); break;
- case 1: tbl = iMap->id2bl(md->target_id); break;
- case 2: tbl = iMap->id2bl(md->master_id); break;
+ case 0: tbl = map->id2bl(md->bl.id); break;
+ case 1: tbl = map->id2bl(md->target_id); break;
+ case 2: tbl = map->id2bl(md->master_id); break;
default:tbl = battle->get_enemy(&md->bl, DEFAULT_ENEMY_TYPE(md),skill->get_range2(&md->bl, skill_id, skill_lv)); break;
}
@@ -16332,13 +16211,12 @@ static int buildin_mobuseskill_sub(struct block_list *bl,va_list ap)
/*==========================================
* areamobuseskill "Map Name",<x>,<y>,<range>,<Mob ID>,"Skill Name"/<Skill ID>,<Skill Lv>,<Cast Time>,<Cancelable>,<Emotion>,<Target Type>;
*------------------------------------------*/
-BUILDIN(areamobuseskill)
-{
+BUILDIN(areamobuseskill) {
struct block_list center;
int16 m;
int range,mobid,skill_id,skill_lv,casttime,emotion,target,cancel;
- if( (m = iMap->mapname2mapid(script_getstr(st,2))) < 0 ) {
+ if( (m = map->mapname2mapid(script_getstr(st,2))) < 0 ) {
ShowError("areamobuseskill: invalid map name.\n");
return true;
}
@@ -16358,7 +16236,7 @@ BUILDIN(areamobuseskill)
emotion = script_getnum(st,11);
target = script_getnum(st,12);
- iMap->foreachinrange(buildin_mobuseskill_sub, &center, range, BL_MOB, mobid, skill_id, skill_lv, casttime, cancel, emotion, target);
+ map->foreachinrange(buildin_mobuseskill_sub, &center, range, BL_MOB, mobid, skill_id, skill_lv, casttime, cancel, emotion, target);
return true;
}
@@ -16621,20 +16499,17 @@ BUILDIN(getargcount) {
/**
* getcharip(<account ID>/<character ID>/<character name>)
**/
-BUILDIN(getcharip)
-{
+BUILDIN(getcharip) {
struct map_session_data* sd = NULL;
/* check if a character name is specified */
- if( script_hasdata(st, 2) )
- {
+ if( script_hasdata(st, 2) ) {
if (script_isstring(st, 2))
- sd = iMap->nick2sd(script_getstr(st, 2));
- else if (script_isint(st, 2) || script_getnum(st, 2))
- {
+ sd = map->nick2sd(script_getstr(st, 2));
+ else if (script_isint(st, 2) || script_getnum(st, 2)) {
int id;
id = script_getnum(st, 2);
- sd = (iMap->id2sd(id) ? iMap->id2sd(id) : iMap->charid2sd(id));
+ sd = (map->id2sd(id) ? map->id2sd(id) : map->charid2sd(id));
}
}
else
@@ -16703,12 +16578,11 @@ BUILDIN(freeloop) {
return true;
}
-BUILDIN(sit)
-{
+BUILDIN(sit) {
struct map_session_data *sd = NULL;
if (script_hasdata(st, 2))
- sd = iMap->nick2sd(script_getstr(st, 2));
+ sd = map->nick2sd(script_getstr(st, 2));
if (sd == NULL)
sd = script_rid2sd(st);
@@ -16722,12 +16596,11 @@ BUILDIN(sit)
return true;
}
-BUILDIN(stand)
-{
+BUILDIN(stand) {
struct map_session_data *sd = NULL;
if (script_hasdata(st, 2))
- sd = iMap->nick2sd(script_getstr(st, 2));
+ sd = map->nick2sd(script_getstr(st, 2));
if (sd == NULL)
sd = script_rid2sd(st);
@@ -16741,12 +16614,11 @@ BUILDIN(stand)
return true;
}
-BUILDIN(issit)
-{
+BUILDIN(issit) {
struct map_session_data *sd = NULL;
if (script_hasdata(st, 2))
- sd = iMap->nick2sd(script_getstr(st, 2));
+ sd = map->nick2sd(script_getstr(st, 2));
if (sd == NULL)
sd = script_rid2sd(st);
@@ -16853,27 +16725,23 @@ BUILDIN(unbindatcmd) {
return true;
}
-BUILDIN(useatcmd)
-{
+BUILDIN(useatcmd) {
TBL_PC *sd, *dummy_sd = NULL;
int fd;
const char* cmd;
cmd = script_getstr(st,2);
- if( st->rid )
- {
+ if( st->rid ) {
sd = script_rid2sd(st);
fd = sd->fd;
- }
- else
- { // Use a dummy character.
+ } else {
+ // Use a dummy character.
sd = dummy_sd = pc->get_dummy_sd();
fd = 0;
- if( st->oid )
- {
- struct block_list* bl = iMap->id2bl(st->oid);
+ if( st->oid ) {
+ struct block_list* bl = map->id2bl(st->oid);
memcpy(&sd->bl, bl, sizeof(struct block_list));
if( bl->type == BL_NPC )
safestrncpy(sd->status.name, ((TBL_NPC*)bl)->name, NAME_LENGTH);
@@ -16995,7 +16863,7 @@ BUILDIN(getrandgroupitem) {
if ((flag = pc->additem(sd, &it, get_count, LOG_TYPE_SCRIPT))) {
clif->additem(sd, 0, 0, flag);
if( pc->candrop(sd,&it) )
- iMap->addflooritem(&it,get_count,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ map->addflooritem(&it,get_count,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
}
}
@@ -17008,33 +16876,32 @@ BUILDIN(getrandgroupitem) {
/* cleanmap <map_name>;
* cleanarea <map_name>, <x0>, <y0>, <x1>, <y1>; */
-static int atcommand_cleanfloor_sub(struct block_list *bl, va_list ap)
-{
+static int atcommand_cleanfloor_sub(struct block_list *bl, va_list ap) {
nullpo_ret(bl);
- iMap->clearflooritem(bl);
+ map->clearflooritem(bl);
return 0;
}
BUILDIN(cleanmap) {
- const char *mapname;
- int16 m = -1;
- int16 x0 = 0, y0 = 0, x1 = 0, y1 = 0;
+ const char *mapname;
+ int16 m = -1;
+ int16 x0 = 0, y0 = 0, x1 = 0, y1 = 0;
- mapname = script_getstr(st, 2);
- m = iMap->mapname2mapid(mapname);
- if ( m == -1 )
- return false;
+ mapname = script_getstr(st, 2);
+ m = map->mapname2mapid(mapname);
+ if ( m == -1 )
+ return false;
if ((script_lastdata(st) - 2) < 4) {
- iMap->foreachinmap(atcommand_cleanfloor_sub, m, BL_ITEM);
+ map->foreachinmap(atcommand_cleanfloor_sub, m, BL_ITEM);
} else {
x0 = script_getnum(st, 3);
y0 = script_getnum(st, 4);
x1 = script_getnum(st, 5);
y1 = script_getnum(st, 6);
if (x0 > 0 && y0 > 0 && x1 > 0 && y1 > 0) {
- iMap->foreachinarea(atcommand_cleanfloor_sub, m, x0, y0, x1, y1, BL_ITEM);
+ map->foreachinarea(atcommand_cleanfloor_sub, m, x0, y0, x1, y1, BL_ITEM);
} else {
ShowError("cleanarea: invalid coordinate defined!\n");
return false;
@@ -17046,8 +16913,7 @@ BUILDIN(cleanmap) {
/* Cast a skill on the attached player.
* npcskill <skill id>, <skill lvl>, <stat point>, <NPC level>;
* npcskill "<skill name>", <skill lvl>, <stat point>, <NPC level>; */
-BUILDIN(npcskill)
-{
+BUILDIN(npcskill) {
uint16 skill_id;
unsigned short skill_level;
unsigned int stat_point;
@@ -17055,12 +16921,12 @@ BUILDIN(npcskill)
struct npc_data *nd;
struct map_session_data *sd;
- skill_id = script_isstring(st, 2) ? skill->name2id(script_getstr(st, 2)) : script_getnum(st, 2);
- skill_level = script_getnum(st, 3);
- stat_point = script_getnum(st, 4);
- npc_level = script_getnum(st, 5);
- sd = script_rid2sd(st);
- nd = (struct npc_data *)iMap->id2bl(sd->npc_id);
+ skill_id = script_isstring(st, 2) ? skill->name2id(script_getstr(st, 2)) : script_getnum(st, 2);
+ skill_level = script_getnum(st, 3);
+ stat_point = script_getnum(st, 4);
+ npc_level = script_getnum(st, 5);
+ sd = script_rid2sd(st);
+ nd = (struct npc_data *)map->id2bl(sd->npc_id);
if (stat_point > battle_config.max_third_parameter) {
ShowError("npcskill: stat point exceeded maximum of %d.\n",battle_config.max_third_parameter );
@@ -17167,7 +17033,7 @@ bool script_hqueue_add(int idx, int var) {
script->hq[idx].item[i] = var;
script->hq[idx].items++;
- if( var >= START_ACCOUNT_NUM && (sd = iMap->id2sd(var)) ) {
+ if( var >= START_ACCOUNT_NUM && (sd = map->id2sd(var)) ) {
for(i = 0; i < sd->queues_count; i++) {
if( sd->queues[i] == -1 ) {
break;
@@ -17213,7 +17079,7 @@ bool script_hqueue_remove(int idx, int var) {
script->hq[idx].item[i] = -1;
script->hq[idx].items--;
- if( var >= START_ACCOUNT_NUM && (sd = iMap->id2sd(var)) ) {
+ if( var >= START_ACCOUNT_NUM && (sd = map->id2sd(var)) ) {
for(i = 0; i < sd->queues_count; i++) {
if( sd->queues[i] == idx ) {
break;
@@ -17291,7 +17157,7 @@ bool script_hqueue_del(int idx) {
int i;
for(i = 0; i < script->hq[idx].size; i++) {
- if( script->hq[idx].item[i] >= START_ACCOUNT_NUM && (sd = iMap->id2sd(script->hq[idx].item[i])) ) {
+ if( script->hq[idx].item[i] >= START_ACCOUNT_NUM && (sd = map->id2sd(script->hq[idx].item[i])) ) {
int j;
for(j = 0; j < sd->queues_count; j++) {
if( sd->queues[j] == script->hq[idx].item[i] ) {
@@ -17330,7 +17196,7 @@ void script_hqueue_clear(int idx) {
for(i = 0; i < script->hq[idx].size; i++) {
if( script->hq[idx].item[i] > 0 ) {
- if( script->hq[idx].item[i] >= START_ACCOUNT_NUM && (sd = iMap->id2sd(script->hq[idx].item[i])) ) {
+ if( script->hq[idx].item[i] >= START_ACCOUNT_NUM && (sd = map->id2sd(script->hq[idx].item[i])) ) {
for(j = 0; j < sd->queues_count; j++) {
if( sd->queues[j] == idx ) {
break;
@@ -17505,7 +17371,7 @@ BUILDIN(bg_join_team) {
int team_id = script_getnum(st, 2);
if( script_hasdata(st, 3) )
- sd = iMap->id2sd(script_getnum(st, 3));
+ sd = map->id2sd(script_getnum(st, 3));
else
sd = script->rid2sd(st);
diff --git a/src/map/searchstore.c b/src/map/searchstore.c
index c7f4f9fed..6fd6f6aad 100644
--- a/src/map/searchstore.c
+++ b/src/map/searchstore.c
@@ -274,7 +274,7 @@ void searchstore_click(struct map_session_data* sd, int account_id, int store_id
return;
}
- if( ( pl_sd = iMap->id2sd(account_id) ) == NULL ) {// no longer online
+ if( ( pl_sd = map->id2sd(account_id) ) == NULL ) {// no longer online
clif->search_store_info_failed(sd, SSI_FAILED_SSILIST_CLICK_TO_OPEN_STORE);
return;
}
diff --git a/src/map/skill.c b/src/map/skill.c
index 8a5969345..8e83f8bd2 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -569,7 +569,7 @@ int skillnotok (uint16 skill_id, struct map_session_data *sd)
}
break;
case GD_EMERGENCYCALL:
- if( !(battle_config.emergency_call&((iMap->agit_flag || iMap->agit2_flag)?2:1))
+ if( !(battle_config.emergency_call&((map->agit_flag || map->agit2_flag)?2:1))
|| !(battle_config.emergency_call&(maplist[m].flag.gvg || maplist[m].flag.gvg_castle?8:4))
|| (battle_config.emergency_call&16 && maplist[m].flag.nowarpto && !maplist[m].flag.gvg_castle)
) {
@@ -666,7 +666,7 @@ struct s_skill_unit_layout* skill_get_unit_layout (uint16 skill_id, uint16 skill
if (pos != -1) // simple single-definition layout
return &skill_unit_layout[pos];
- dir = (src->x == x && src->y == y) ? 6 : iMap->calc_dir(src,x,y); // 6 - default aegis direction
+ dir = (src->x == x && src->y == y) ? 6 : map->calc_dir(src,x,y); // 6 - default aegis direction
if (skill_id == MG_FIREWALL)
return &skill_unit_layout [firewall_unit_pos + dir];
@@ -1393,9 +1393,9 @@ int skill_additional_effect(struct block_list* src, struct block_list *bl, uint1
break;
}
- if (md && battle_config.summons_trigger_autospells && md->master_id && md->special_state.ai)
- { //Pass heritage to Master for status causing effects. [Skotlex]
- sd = iMap->id2sd(md->master_id);
+ if (md && battle_config.summons_trigger_autospells && md->master_id && md->special_state.ai) {
+ //Pass heritage to Master for status causing effects. [Skotlex]
+ sd = map->id2sd(md->master_id);
src = sd?&sd->bl:src;
}
@@ -2094,7 +2094,7 @@ int skill_blown(struct block_list* src, struct block_list* target, int count, in
}
if (dir == -1) // <optimized>: do the computation here instead of outside
- dir = iMap->calc_dir(target, src->x, src->y); // direction from src to target, reversed
+ dir = map->calc_dir(target, src->x, src->y); // direction from src to target, reversed
if (dir >= 0 && dir < 8)
{ // take the reversed 'direction' and reverse it
@@ -2521,7 +2521,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
break;
}
- iMap->freeblock_lock();
+ map->freeblock_lock();
if(damage > 0 && dmg.flag&BF_SKILL && tsd
&& pc->checkskill(tsd,RG_PLAGIARISM)
@@ -2655,7 +2655,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
dir = rand()%8;
break;
case WL_CRIMSONROCK:
- dir = iMap->calc_dir(bl,skill_area_temp[4],skill_area_temp[5]);
+ dir = map->calc_dir(bl,skill_area_temp[4],skill_area_temp[5]);
break;
}
@@ -2671,7 +2671,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
short dir_x, dir_y;
dir_x = dirx[(dir+4)%8];
dir_y = diry[(dir+4)%8];
- if( iMap->getcell(bl->m, bl->x+dir_x, bl->y+dir_y, CELL_CHKNOPASS) != 0 )
+ if( map->getcell(bl->m, bl->x+dir_x, bl->y+dir_y, CELL_CHKNOPASS) != 0 )
skill->addtimerskill(src, tick + status_get_amotion(src), bl->id, 0, 0, LG_OVERBRAND_PLUSATK, skill_lv, BF_WEAPON, flag );
} else
skill->addtimerskill(src, tick + status_get_amotion(src), bl->id, 0, 0, LG_OVERBRAND_PLUSATK, skill_lv, BF_WEAPON, flag );
@@ -2681,7 +2681,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
short dir_x, dir_y;
dir_x = dirx[(dir+4)%8];
dir_y = diry[(dir+4)%8];
- if( iMap->getcell(bl->m, bl->x+dir_x, bl->y+dir_y, CELL_CHKNOPASS) != 0 )
+ if( map->getcell(bl->m, bl->x+dir_x, bl->y+dir_y, CELL_CHKNOPASS) != 0 )
skill->addtimerskill(src, tick + 300 * ((flag&2) ? 1 : 2), bl->id, 0, 0, skill_id, skill_lv, BF_WEAPON, flag|4);
}
break;
@@ -2707,7 +2707,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
if( sc && sc->data[SC_DEVOTION] && skill_id != PA_PRESSURE ) {
struct status_change_entry *sce = sc->data[SC_DEVOTION];
- struct block_list *d_bl = iMap->id2bl(sce->val1);
+ struct block_list *d_bl = map->id2bl(sce->val1);
if( d_bl && (
(d_bl->type == BL_MER && ((TBL_MER*)d_bl)->master && ((TBL_MER*)d_bl)->master->bl.id == bl->id) ||
@@ -2793,7 +2793,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
skill->addtimerskill(src, tick + dmg.amotion, bl->id, 0, 0, skill_id, skill_lv, BF_MAGIC, flag|2);
}
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return (int)cap_value(damage,INT_MIN,INT_MAX);
}
@@ -2905,7 +2905,7 @@ int skill_check_unit_range (struct block_list *bl, int x, int y, uint16 skill_id
}
range += layout_type;
- return iMap->foreachinarea(skill->check_unit_range_sub,bl->m,x-range,y-range,x+range,y+range,BL_SKILL,skill_id);
+ return map->foreachinarea(skill->check_unit_range_sub,bl->m,x-range,y-range,x+range,y+range,BL_SKILL,skill_id);
}
int skill_check_unit_range2_sub (struct block_list *bl, va_list ap) {
@@ -2952,9 +2952,9 @@ int skill_check_unit_range2 (struct block_list *bl, int x, int y, uint16 skill_i
else
type = BL_PC;
- return iMap->foreachinarea(skill->check_unit_range2_sub, bl->m,
- x - range, y - range, x + range, y + range,
- type, skill_id);
+ return map->foreachinarea(skill->check_unit_range2_sub, bl->m,
+ x - range, y - range, x + range, y + range,
+ type, skill_id);
}
/*==========================================
@@ -3081,7 +3081,7 @@ int skill_area_sub_count (struct block_list *src, struct block_list *target, uin
*
*------------------------------------------*/
int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data) {
- struct block_list *src = iMap->id2bl(id),*target;
+ struct block_list *src = map->id2bl(id),*target;
struct unit_data *ud = unit->bl2ud(src);
struct skill_timerskill *skl;
int range;
@@ -3096,7 +3096,7 @@ int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data) {
if(src->prev == NULL)
break; // Source not on Map
if(skl->target_id) {
- target = iMap->id2bl(skl->target_id);
+ target = map->id2bl(skl->target_id);
if( ( skl->skill_id == RG_INTIMIDATE || skl->skill_id == SC_FATALMENACE ) && (!target || target->prev == NULL || !check_distance_bl(src,target,AREA_SIZE)) )
target = src; //Required since it has to warp.
if(target == NULL)
@@ -3114,7 +3114,7 @@ int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data) {
case RG_INTIMIDATE:
if (unit->warp(src,-1,-1,-1,CLR_TELEPORT) == 0) {
short x,y;
- iMap->search_freecell(src, 0, &x, &y, 1, 1, 0);
+ map->search_freecell(src, 0, &x, &y, 1, 1, 0);
if (target != src && !status->isdead(target))
unit->warp(target, -1, x, y, CLR_TELEPORT);
}
@@ -3122,16 +3122,16 @@ int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data) {
case BA_FROSTJOKER:
case DC_SCREAM:
range= skill->get_splash(skl->skill_id, skl->skill_lv);
- iMap->foreachinarea(skill->frostjoke_scream,skl->map,skl->x-range,skl->y-range,
- skl->x+range,skl->y+range,BL_CHAR,src,skl->skill_id,skl->skill_lv,tick);
+ map->foreachinarea(skill->frostjoke_scream,skl->map,skl->x-range,skl->y-range,
+ skl->x+range,skl->y+range,BL_CHAR,src,skl->skill_id,skl->skill_lv,tick);
break;
case NPC_EARTHQUAKE:
if( skl->type > 1 )
skill->addtimerskill(src,tick+250,src->id,0,0,skl->skill_id,skl->skill_lv,skl->type-1,skl->flag);
- skill_area_temp[0] = iMap->foreachinrange(skill->area_sub, src, skill->get_splash(skl->skill_id, skl->skill_lv), BL_CHAR, src, skl->skill_id, skl->skill_lv, tick, BCT_ENEMY, skill->area_sub_count);
+ skill_area_temp[0] = map->foreachinrange(skill->area_sub, src, skill->get_splash(skl->skill_id, skl->skill_lv), BL_CHAR, src, skl->skill_id, skl->skill_lv, tick, BCT_ENEMY, skill->area_sub_count);
skill_area_temp[1] = src->id;
skill_area_temp[2] = 0;
- iMap->foreachinrange(skill->area_sub, src, skill->get_splash(skl->skill_id, skl->skill_lv), splash_target(src), src, skl->skill_id, skl->skill_lv, tick, skl->flag, skill->castend_damage_id);
+ map->foreachinrange(skill->area_sub, src, skill->get_splash(skl->skill_id, skl->skill_lv), splash_target(src), src, skl->skill_id, skl->skill_lv, tick, skl->flag, skill->castend_damage_id);
break;
case WZ_WATERBALL:
skill->toggle_magicpower(src, skl->skill_id); // only the first hit will be amplify
@@ -3192,7 +3192,7 @@ int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data) {
unit->warp(src, -1, skl->x, skl->y, 3);
else { // Target's Part
short x = skl->x, y = skl->y;
- iMap->search_freecell(NULL, target->m, &x, &y, 2, 2, 1);
+ map->search_freecell(NULL, target->m, &x, &y, 2, 2, 1);
unit->warp(target,-1,x,y,3);
}
break;
@@ -3218,8 +3218,8 @@ int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data) {
skill->attack(BF_WEAPON, src, src, target, skl->skill_id, skl->skill_lv, tick, skl->flag|SD_LEVEL);
break;
case GN_SPORE_EXPLOSION:
- iMap->foreachinrange(skill->area_sub, target, skill->get_splash(skl->skill_id, skl->skill_lv), BL_CHAR,
- src, skl->skill_id, skl->skill_lv, 0, skl->flag|1|BCT_ENEMY, skill->castend_damage_id);
+ map->foreachinrange(skill->area_sub, target, skill->get_splash(skl->skill_id, skl->skill_lv), BL_CHAR,
+ src, skl->skill_id, skl->skill_lv, 0, skl->flag|1|BCT_ENEMY, skill->castend_damage_id);
break;
case SR_FLASHCOMBO_ATK_STEP1:
case SR_FLASHCOMBO_ATK_STEP2:
@@ -3271,14 +3271,15 @@ int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data) {
else if( path->search_long(NULL, src->m, src->x, src->y, skl->x, skl->y, CELL_CHKWALL) )
skill->unitsetting(src,skl->skill_id,skl->skill_lv,skl->x,skl->y,skl->flag);
break;
- case GN_CRAZYWEED_ATK: {
- int dummy = 1, i = skill->get_unit_range(skl->skill_id,skl->skill_lv);
- iMap->foreachinarea(skill->cell_overlap, src->m, skl->x-i, skl->y-i, skl->x+i, skl->y+i, BL_SKILL, skl->skill_id, &dummy, src);
- }
+ case GN_CRAZYWEED_ATK:
+ {
+ int dummy = 1, i = skill->get_unit_range(skl->skill_id,skl->skill_lv);
+ map->foreachinarea(skill->cell_overlap, src->m, skl->x-i, skl->y-i, skl->x+i, skl->y+i, BL_SKILL, skl->skill_id, &dummy, src);
+ }
+ // FIXME: there's no 'break' here. If it was intended, please consider adding a comment (issue #160)
case WL_EARTHSTRAIN:
skill->unitsetting(src,skl->skill_id,skl->skill_lv,skl->x,skl->y,(skl->type<<16)|skl->flag);
break;
-
}
}
} while (0);
@@ -3343,7 +3344,7 @@ int skill_activate_reverbetion( struct block_list *bl, va_list ap) {
if( bl->type != BL_SKILL )
return 0;
if( su->alive && (sg = su->group) && sg->skill_id == WM_REVERBERATION ) {
- iMap->foreachinrange(skill->trap_splash, bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, bl, timer->gettick());
+ map->foreachinrange(skill->trap_splash, bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, bl, timer->gettick());
su->limit=DIFF_TICK(timer->gettick(),sg->tick);
sg->unit_id = UNT_USED_TRAPS;
}
@@ -3401,7 +3402,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
tstatus = status->get_status_data(bl);
- iMap->freeblock_lock();
+ map->freeblock_lock();
switch(skill_id) {
case MER_CRASH:
@@ -3551,12 +3552,12 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
break;
case MO_COMBOFINISH:
- if (!(flag&1) && sc && sc->data[SC_SOULLINK] && sc->data[SC_SOULLINK]->val2 == SL_MONK)
- { //Becomes a splash attack when Soul Linked.
- iMap->foreachinrange(skill->area_sub, bl,
- skill->get_splash(skill_id, skill_lv),splash_target(src),
- src,skill_id,skill_lv,tick, flag|BCT_ENEMY|1,
- skill->castend_damage_id);
+ if (!(flag&1) && sc && sc->data[SC_SOULLINK] && sc->data[SC_SOULLINK]->val2 == SL_MONK) {
+ //Becomes a splash attack when Soul Linked.
+ map->foreachinrange(skill->area_sub, bl,
+ skill->get_splash(skill_id, skill_lv),splash_target(src),
+ src,skill_id,skill_lv,tick, flag|BCT_ENEMY|1,
+ skill->castend_damage_id);
} else
skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag);
break;
@@ -3564,15 +3565,15 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
case TK_STORMKICK: // Taekwon kicks [Dralnu]
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
skill_area_temp[1] = 0;
- iMap->foreachinrange(skill->attack_area, src,
- skill->get_splash(skill_id, skill_lv), splash_target(src),
- BF_WEAPON, src, src, skill_id, skill_lv, tick, flag, BCT_ENEMY);
+ map->foreachinrange(skill->attack_area, src,
+ skill->get_splash(skill_id, skill_lv), splash_target(src),
+ BF_WEAPON, src, src, skill_id, skill_lv, tick, flag, BCT_ENEMY);
break;
case KN_CHARGEATK: {
bool path_exists = path->search_long(NULL, src->m, src->x, src->y, bl->x, bl->y,CELL_CHKWALL);
unsigned int dist = distance_bl(src, bl);
- uint8 dir = iMap->calc_dir(bl, src->x, src->y);
+ uint8 dir = map->calc_dir(bl, src->x, src->y);
// teleport to target (if not on WoE grounds)
if( !map_flag_gvg2(src->m) && !maplist[src->m].flag.battleground && unit->movepos(src, bl->x, bl->y, 0, 1) )
@@ -3599,9 +3600,9 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
//It won't shoot through walls since on castend there has to be a direct
//line of sight between caster and target.
skill_area_temp[1] = bl->id;
- iMap->foreachinpath (skill->attack_area,src->m,src->x,src->y,bl->x,bl->y,
- skill->get_splash(skill_id, skill_lv),skill->get_maxcount(skill_id,skill_lv), splash_target(src),
- skill->get_type(skill_id),src,src,skill_id,skill_lv,tick,flag,BCT_ENEMY);
+ map->foreachinpath(skill->attack_area,src->m,src->x,src->y,bl->x,bl->y,
+ skill->get_splash(skill_id, skill_lv),skill->get_maxcount(skill_id,skill_lv), splash_target(src),
+ skill->get_type(skill_id),src,src,skill_id,skill_lv,tick,flag,BCT_ENEMY);
break;
case NPC_ACIDBREATH:
@@ -3610,9 +3611,9 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
case NPC_ICEBREATH:
case NPC_THUNDERBREATH:
skill_area_temp[1] = bl->id;
- iMap->foreachinpath(skill->attack_area,src->m,src->x,src->y,bl->x,bl->y,
- skill->get_splash(skill_id, skill_lv),skill->get_maxcount(skill_id,skill_lv), splash_target(src),
- skill->get_type(skill_id),src,src,skill_id,skill_lv,tick,flag,BCT_ENEMY);
+ map->foreachinpath(skill->attack_area,src->m,src->x,src->y,bl->x,bl->y,
+ skill->get_splash(skill_id, skill_lv),skill->get_maxcount(skill_id,skill_lv), splash_target(src),
+ skill->get_type(skill_id),src,src,skill_id,skill_lv,tick,flag,BCT_ENEMY);
break;
case MO_INVESTIGATE:
@@ -3622,8 +3623,8 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
case RG_BACKSTAP:
{
- uint8 dir = iMap->calc_dir(src, bl->x, bl->y), t_dir = unit->getdir(bl);
- if ((!check_distance_bl(src, bl, 0) && !iMap->check_dir(dir, t_dir)) || bl->type == BL_SKILL) {
+ uint8 dir = map->calc_dir(src, bl->x, bl->y), t_dir = unit->getdir(bl);
+ if ((!check_distance_bl(src, bl, 0) && !map->check_dir(dir, t_dir)) || bl->type == BL_SKILL) {
status_change_end(src, SC_HIDING, INVALID_TIMER);
skill->attack(BF_WEAPON, src, src, bl, skill_id, skill_lv, tick, flag);
dir = dir < 4 ? dir+4 : dir-4; // change direction [Celest]
@@ -3676,7 +3677,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
status->set_hp(src, 1, 0);
#endif // RENEWAL
}
- dir = iMap->calc_dir(src,bl->x,bl->y);
+ dir = map->calc_dir(src,bl->x,bl->y);
if( dir > 0 && dir < 4) x = -i;
else if( dir > 4 ) x = i;
else x = 0;
@@ -3795,10 +3796,10 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
//SD_LEVEL -> Forced splash damage for Auto Blitz-Beat -> count targets
//special case: Venom Splasher uses a different range for searching than for splashing
if( flag&SD_LEVEL || skill->get_nk(skill_id)&NK_SPLASHSPLIT )
- skill_area_temp[0] = iMap->foreachinrange(skill->area_sub, bl, (skill_id == AS_SPLASHER)?1:skill->get_splash(skill_id, skill_lv), BL_CHAR, src, skill_id, skill_lv, tick, BCT_ENEMY, skill->area_sub_count);
+ skill_area_temp[0] = map->foreachinrange(skill->area_sub, bl, (skill_id == AS_SPLASHER)?1:skill->get_splash(skill_id, skill_lv), BL_CHAR, src, skill_id, skill_lv, tick, BCT_ENEMY, skill->area_sub_count);
// recursive invocation of skill->castend_damage_id() with flag|1
- iMap->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), ( skill_id == WM_REVERBERATION_MELEE || skill_id == WM_REVERBERATION_MAGIC )?BL_CHAR:splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|SD_SPLASH|1, skill->castend_damage_id);
+ map->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), ( skill_id == WM_REVERBERATION_MELEE || skill_id == WM_REVERBERATION_MAGIC )?BL_CHAR:splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|SD_SPLASH|1, skill->castend_damage_id);
}
break;
@@ -3826,13 +3827,13 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
for(i=0;i<c;i++){
if (!skill->blown(src,bl,1,(unit->getdir(src)+4)%8,0x1))
break; //Can't knockback
- skill_area_temp[0] = iMap->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), BL_CHAR, src, skill_id, skill_lv, tick, flag|BCT_ENEMY, skill->area_sub_count);
+ skill_area_temp[0] = map->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), BL_CHAR, src, skill_id, skill_lv, tick, flag|BCT_ENEMY, skill->area_sub_count);
if( skill_area_temp[0] > 1 ) break; // collision
}
clif->blown(bl); //Update target pos.
if (i!=c) { //Splash
skill_area_temp[1] = bl->id;
- iMap->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_damage_id);
+ map->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_damage_id);
}
//Weirdo dual-hit property, two attacks for 500%
skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,0);
@@ -3848,15 +3849,15 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
skill->blown(src,bl,skill_area_temp[2],-1,0);
} else {
int x=bl->x,y=bl->y,i,dir;
- dir = iMap->calc_dir(bl,src->x,src->y);
+ dir = map->calc_dir(bl,src->x,src->y);
skill_area_temp[1] = bl->id;
skill_area_temp[2] = skill->get_blewcount(skill_id,skill_lv);
// all the enemies between the caster and the target are hit, as well as the target
if (skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,0))
skill->blown(src,bl,skill_area_temp[2],-1,0);
for (i=0;i<4;i++) {
- iMap->foreachincell(skill->area_sub,bl->m,x,y,BL_CHAR,
- src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id);
+ map->foreachincell(skill->area_sub,bl->m,x,y,BL_CHAR,src,skill_id,skill_lv,
+ tick,flag|BCT_ENEMY|1,skill->castend_damage_id);
x += dirx[dir];
y += diry[dir];
}
@@ -3868,10 +3869,10 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
{
skill_area_temp[1] = bl->id; //NOTE: This is used in skill->castend_nodamage_id to avoid affecting the target.
if (skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag))
- iMap->foreachinrange(skill->area_sub,bl,
- skill->get_splash(skill_id, skill_lv),BL_CHAR,
- src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,
- skill->castend_nodamage_id);
+ map->foreachinrange(skill->area_sub,bl,
+ skill->get_splash(skill_id, skill_lv),BL_CHAR,
+ src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,
+ skill->castend_nodamage_id);
}
break;
case CH_PALMSTRIKE: // Palm Strike takes effect 1sec after casting. [Skotlex]
@@ -3950,11 +3951,11 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
for( y = src->y - range; y <= src->y + range; ++y )
for( x = src->x - range; x <= src->x + range; ++x ) {
- if( !iMap->find_skill_unit_oncell(src,x,y,SA_LANDPROTECTOR,NULL,1) ) {
- if( src->type != BL_PC || iMap->getcell(src->m,x,y,CELL_CHKWATER) ) // non-players bypass the water requirement
+ if( !map->find_skill_unit_oncell(src,x,y,SA_LANDPROTECTOR,NULL,1) ) {
+ if( src->type != BL_PC || map->getcell(src->m,x,y,CELL_CHKWATER) ) // non-players bypass the water requirement
count++; // natural water cell
- else if( (su = iMap->find_skill_unit_oncell(src,x,y,SA_DELUGE,NULL,1)) != NULL
- || (su = iMap->find_skill_unit_oncell(src,x,y,NJ_SUITON,NULL,1)) != NULL ) {
+ else if( (su = map->find_skill_unit_oncell(src,x,y,SA_DELUGE,NULL,1)) != NULL
+ || (su = map->find_skill_unit_oncell(src,x,y,NJ_SUITON,NULL,1)) != NULL ) {
count++; // skill-induced water cell
skill->delunit(su); // consume cell
}
@@ -4063,7 +4064,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
if( !map_flag_gvg2(src->m) && !maplist[src->m].flag.battleground ) {
//You don't move on GVG grounds.
short x, y;
- iMap->search_freecell(bl, 0, &x, &y, 1, 1, 0);
+ map->search_freecell(bl, 0, &x, &y, 1, 1, 0);
if (unit->movepos(src, x, y, 0, 0))
clif->slide(src,src->x,src->y);
}
@@ -4071,7 +4072,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag);
break;
case RK_PHANTOMTHRUST:
- unit->setdir(src,iMap->calc_dir(src, bl->x, bl->y));
+ unit->setdir(src,map->calc_dir(src, bl->x, bl->y));
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
skill->blown(src,bl,distance_bl(src,bl)-1,unit->getdir(src),0);
@@ -4082,7 +4083,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
case GC_DARKILLUSION:
{
short x, y;
- short dir = iMap->calc_dir(src,bl->x,bl->y);
+ short dir = map->calc_dir(src,bl->x,bl->y);
if( dir > 0 && dir < 4) x = 2;
else if( dir > 4 ) x = -2;
@@ -4258,7 +4259,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
if( sd && pc_isridingwug(sd) ){
short x[8]={0,-1,-1,-1,0,1,1,1};
short y[8]={1,1,0,-1,-1,-1,0,1};
- uint8 dir = iMap->calc_dir(bl, src->x, src->y);
+ uint8 dir = map->calc_dir(bl, src->x, src->y);
if( unit->movepos(src, bl->x+x[dir], bl->y+y[dir], 1, 1) )
{
@@ -4283,39 +4284,33 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag);
status_change_end(bl, SC_CLOAKINGEXCEED, INVALID_TIMER);
}
- }
- else
- {
+ } else {
struct skill_unit *su = BL_CAST(BL_SKILL,bl);
struct skill_unit_group* sg;
- if( su && (sg=su->group) && skill->get_inf2(sg->skill_id)&INF2_TRAP )
- {
- if( !(sg->unit_id == UNT_USED_TRAPS || (sg->unit_id == UNT_ANKLESNARE && sg->val2 != 0 )) )
- {
+ if( su && (sg=su->group) && skill->get_inf2(sg->skill_id)&INF2_TRAP ) {
+ if( !(sg->unit_id == UNT_USED_TRAPS || (sg->unit_id == UNT_ANKLESNARE && sg->val2 != 0 )) ) {
struct item item_tmp;
memset(&item_tmp,0,sizeof(item_tmp));
item_tmp.nameid = sg->item_id?sg->item_id:ITEMID_TRAP;
item_tmp.identify = 1;
if( item_tmp.nameid )
- iMap->addflooritem(&item_tmp,1,bl->m,bl->x,bl->y,0,0,0,0);
+ map->addflooritem(&item_tmp,1,bl->m,bl->x,bl->y,0,0,0,0);
}
skill->delunit(su);
}
}
break;
case NC_INFRAREDSCAN:
- if( flag&1 )
- { //TODO: Need a confirmation if the other type of hidden status is included to be scanned. [Jobbie]
+ if( flag&1 ) {
+ //TODO: Need a confirmation if the other type of hidden status is included to be scanned. [Jobbie]
if( rnd()%100 < 50 )
sc_start(bl, SC_INFRAREDSCAN, 10000, skill_lv, skill->get_time(skill_id, skill_lv));
status_change_end(bl, SC_HIDING, INVALID_TIMER);
status_change_end(bl, SC_CLOAKING, INVALID_TIMER);
status_change_end(bl, SC_CLOAKINGEXCEED, INVALID_TIMER); // Need confirm it.
- }
- else
- {
- iMap->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|SD_SPLASH|1, skill->castend_damage_id);
+ } else {
+ map->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|SD_SPLASH|1, skill->castend_damage_id);
clif->skill_damage(src,src,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6);
if( sd ) pc->overheat(sd,1);
}
@@ -4327,14 +4322,13 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
case SC_FATALMENACE:
if( flag&1 )
skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag);
- else
- {
+ else {
short x, y;
- iMap->search_freecell(src, 0, &x, &y, -1, -1, 0);
+ map->search_freecell(src, 0, &x, &y, -1, -1, 0);
// Destination area
skill_area_temp[4] = x;
skill_area_temp[5] = y;
- iMap->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_damage_id);
+ map->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_damage_id);
skill->addtimerskill(src,tick + 800,src->id,x,y,skill_id,skill_lv,0,flag); // To teleport Self
clif->skill_damage(src,src,tick,status_get_amotion(src),0,-30000,1,skill_id,skill_lv,6);
}
@@ -4399,9 +4393,9 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
status_change_end(bl, SC_HIDING, INVALID_TIMER);
status_change_end(bl, SC_CLOAKINGEXCEED, INVALID_TIMER);
} else{
- iMap->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|SD_SPLASH|1, skill->castend_damage_id);
+ map->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|SD_SPLASH|1, skill->castend_damage_id);
clif->skill_damage(src, src, tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6);
- }
+ }
break;
case SO_POISON_BUSTER:
@@ -4436,7 +4430,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
clif->skill_nodamage(src,battle->get_master(src),skill_id,skill_lv,1);
clif->skill_damage(src, bl, tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6);
if( rnd()%100 < 30 )
- iMap->foreachinrange(skill->area_sub,bl,i,BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id);
+ map->foreachinrange(skill->area_sub,bl,i,BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id);
else
skill->attack(skill->get_type(skill_id),src,src,bl,skill_id,skill_lv,tick,flag);
}
@@ -4459,7 +4453,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
clif->skill_nodamage(src,battle->get_master(src),skill_id,skill_lv,1);
clif->skill_damage(src, src, tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6);
if( rnd()%100 < 30 )
- iMap->foreachinrange(skill->area_sub,bl,i,BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id);
+ map->foreachinrange(skill->area_sub,bl,i,BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id);
else
skill->attack(skill->get_type(skill_id),src,src,bl,skill_id,skill_lv,tick,flag);
}
@@ -4504,7 +4498,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
if(flag & 1)
skill->attack(skill->get_type(skill_id), src, src, bl, skill_id, skill_lv, tick, flag);
else {
- iMap->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag | BCT_ENEMY | SD_SPLASH | 1, skill->castend_damage_id);
+ map->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag | BCT_ENEMY | SD_SPLASH | 1, skill->castend_damage_id);
}
break;
@@ -4532,10 +4526,10 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
skill->attack(BF_WEAPON, src, src, bl, skill_id, skill_lv, tick, SD_LEVEL|flag);
} else {
skill_area_temp[1] = bl->id;
- iMap->foreachinrange(skill->area_sub, bl,
- sd->bonus.splash_range, BL_CHAR,
- src, skill_id, skill_lv, tick, flag | BCT_ENEMY | 1,
- skill->castend_damage_id);
+ map->foreachinrange(skill->area_sub, bl,
+ sd->bonus.splash_range, BL_CHAR,
+ src, skill_id, skill_lv, tick, flag | BCT_ENEMY | 1,
+ skill->castend_damage_id);
flag|=1; //Set flag to 1 so ammo is not double-consumed. [Skotlex]
}
}
@@ -4546,14 +4540,14 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
clif->skill_damage(src, bl, tick, status_get_amotion(src), tstatus->dmotion,
0, abs(skill->get_num(skill_id, skill_lv)),
skill_id, skill_lv, skill->get_hit(skill_id));
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return 1;
}
if( sc && sc->data[SC_CURSEDCIRCLE_ATKER] ) //Should only remove after the skill has been casted.
status_change_end(src,SC_CURSEDCIRCLE_ATKER,INVALID_TIMER);
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
if( sd && !(flag&1) )
{// ensure that the skill last-cast tick is recorded
@@ -4583,7 +4577,7 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data)
struct status_change *sc = NULL;
int inf,inf2,flag = 0;
- src = iMap->id2bl(id);
+ src = map->id2bl(id);
if( src == NULL )
{
ShowDebug("skill_castend_id: src == NULL (tid=%d, id=%d)\n", tid, id);
@@ -4624,7 +4618,7 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data)
if (ud->skilltarget == id)
target = src;
else
- target = iMap->id2bl(ud->skilltarget);
+ target = map->id2bl(ud->skilltarget);
// Use a do so that you can break out of it when the skill fails.
do {
@@ -4644,7 +4638,7 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data)
inf2 = skill->get_splash(ud->skill_id, ud->skill_lv);
ud->skillx = target->x + inf2;
ud->skilly = target->y + inf2;
- if (inf2 && !iMap->random_dir(target, &ud->skillx, &ud->skilly)) {
+ if (inf2 && !map->random_dir(target, &ud->skillx, &ud->skilly)) {
ud->skillx = target->x;
ud->skilly = target->y;
}
@@ -4658,8 +4652,8 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data)
}
if(ud->skill_id == RG_BACKSTAP) {
- uint8 dir = iMap->calc_dir(src,target->x,target->y),t_dir = unit->getdir(target);
- if(check_distance_bl(src, target, 0) || iMap->check_dir(dir,t_dir)) {
+ uint8 dir = map->calc_dir(src,target->x,target->y),t_dir = unit->getdir(target);
+ if(check_distance_bl(src, target, 0) || map->check_dir(dir,t_dir)) {
break;
}
}
@@ -4815,7 +4809,7 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data)
ShowInfo("Type %d, ID %d skill castend id [id =%d, lv=%d, target ID %d]\n",
src->type, src->id, ud->skill_id, ud->skill_lv, target->id);
- iMap->freeblock_lock();
+ map->freeblock_lock();
// SC_MAGICPOWER needs to switch states before any damage is actually dealt
skill->toggle_magicpower(src, ud->skill_id);
@@ -4848,7 +4842,7 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data)
else ud->skill_id = 0; //mobs can't clear this one as it is used for skill condition 'afterskill'
ud->skill_lv = ud->skilltarget = 0;
}
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return 1;
} while(0);
@@ -4867,10 +4861,10 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data)
sc_start(src, SC_EXTREMITYFIST2, 100, ud->skill_lv, skill->get_time(ud->skill_id, ud->skill_lv));
#endif
}
- if (target && target->m == src->m)
- { //Move character to target anyway.
+ if (target && target->m == src->m) {
+ //Move character to target anyway.
int dir, x, y;
- dir = iMap->calc_dir(src,target->x,target->y);
+ dir = map->calc_dir(src,target->x,target->y);
if( dir > 0 && dir < 4) x = -2;
else if( dir > 4 ) x = 2;
else x = 0;
@@ -5011,7 +5005,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
if( sd && !pc->checkskill(sd, RK_RUNEMASTERY) ){
if( status->change_start(&sd->bl, (sc_type)(rnd()%SC_CONFUSION), 1000, 1, 0, 0, 0, skill->get_time2(skill_id,skill_lv),8) ){
skill->consume_requirement(sd,skill_id,skill_lv,2);
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return 0;
}
}
@@ -5032,7 +5026,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
battle->attr_fix(NULL, NULL, 100, i, tstatus->def_ele, tstatus->ele_lv) <= 0)
return 1; //Skills that cause an status should be blocked if the target element blocks its element.
- iMap->freeblock_lock();
+ map->freeblock_lock();
switch(skill_id) {
case HLIF_HEAL: //[orn]
case AL_HEAL:
@@ -5171,8 +5165,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
if (flag&1)
sc_start(bl,type, 23+skill_lv*4 +status->get_lv(src) -status->get_lv(bl), skill_lv,skill->get_time(skill_id,skill_lv));
else {
- iMap->foreachinrange(skill->area_sub, src, skill->get_splash(skill_id, skill_lv), BL_CHAR,
- src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_nodamage_id);
+ map->foreachinrange(skill->area_sub, src, skill->get_splash(skill_id, skill_lv), BL_CHAR,
+ src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_nodamage_id);
clif->skill_nodamage(src, bl, skill_id, skill_lv, 1);
}
break;
@@ -5227,7 +5221,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
if (!target_id)
break;
if (skill->get_casttype(abra_skill_id) == CAST_GROUND) {
- bl = iMap->id2bl(target_id);
+ bl = map->id2bl(target_id);
if (!bl) bl = src;
unit->skilluse_pos(src, bl->x, bl->y, abra_skill_id, abra_skill_lv);
} else
@@ -5331,7 +5325,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
if(sd && dstsd){ //Check they are not another crusader [Skotlex]
if ((dstsd->class_&MAPID_UPPERMASK) == MAPID_CRUSADER) {
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return 1;
}
}
@@ -5343,34 +5337,27 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
{
struct status_change* sc = status->get_sc(src);
- if( sd && dstsd && (dstsd->class_&MAPID_UPPERMASK) == MAPID_BARDDANCER && dstsd->status.sex == sd->status.sex )
- {// Cannot cast on another bard/dancer-type class of the same gender as caster
+ if( sd && dstsd && (dstsd->class_&MAPID_UPPERMASK) == MAPID_BARDDANCER && dstsd->status.sex == sd->status.sex ) {
+ // Cannot cast on another bard/dancer-type class of the same gender as caster
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return 1;
}
- if( sc && tsc )
- {
- if( !sc->data[SC_MARIONETTE_MASTER] && !tsc->data[SC_MARIONETTE] )
- {
+ if( sc && tsc ) {
+ if( !sc->data[SC_MARIONETTE_MASTER] && !tsc->data[SC_MARIONETTE] ) {
sc_start(src,SC_MARIONETTE_MASTER,100,bl->id,skill->get_time(skill_id,skill_lv));
sc_start(bl,SC_MARIONETTE,100,src->id,skill->get_time(skill_id,skill_lv));
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
- }
- else
- if( sc->data[SC_MARIONETTE_MASTER ] && sc->data[SC_MARIONETTE_MASTER ]->val1 == bl->id &&
- tsc->data[SC_MARIONETTE] && tsc->data[SC_MARIONETTE]->val1 == src->id )
- {
+ } else if( sc->data[SC_MARIONETTE_MASTER ] && sc->data[SC_MARIONETTE_MASTER ]->val1 == bl->id
+ && tsc->data[SC_MARIONETTE] && tsc->data[SC_MARIONETTE]->val1 == src->id
+ ) {
status_change_end(src, SC_MARIONETTE_MASTER, INVALID_TIMER);
status_change_end(bl, SC_MARIONETTE, INVALID_TIMER);
- }
- else
- {
+ } else {
if( sd )
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
-
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return 1;
}
}
@@ -5453,8 +5440,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case SM_MAGNUM:
case MS_MAGNUM:
skill_area_temp[1] = 0;
- iMap->foreachinrange(skill->area_sub, src, skill->get_splash(skill_id, skill_lv), BL_SKILL|BL_CHAR,
- src,skill_id,skill_lv,tick, flag|BCT_ENEMY|1, skill->castend_damage_id);
+ map->foreachinrange(skill->area_sub, src, skill->get_splash(skill_id, skill_lv), BL_SKILL|BL_CHAR,
+ src,skill_id,skill_lv,tick, flag|BCT_ENEMY|1, skill->castend_damage_id);
clif->skill_nodamage (src,src,skill_id,skill_lv,1);
// Initiate 10% of your damage becomes fire element.
sc_start4(src,SC_SUB_WEAPONPROPERTY,100,3,20,0,0,skill->get_time2(skill_id, skill_lv));
@@ -5611,20 +5598,19 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv)));
status_change_end(bl, SC_NJ_NEN, INVALID_TIMER);
break;
- /* Was modified to only affect targetted char. [Skotlex]
+#if 0 /* Was modified to only affect targetted char. [Skotlex] */
case HP_ASSUMPTIO:
if (flag&1)
sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv));
- else
- {
- iMap->foreachinrange(skill->area_sub, bl,
- skill->get_splash(skill_id, skill_lv), BL_PC,
- src, skill_id, skill_lv, tick, flag|BCT_ALL|1,
- skill->castend_nodamage_id);
+ else {
+ map->foreachinrange(skill->area_sub, bl,
+ skill->get_splash(skill_id, skill_lv), BL_PC,
+ src, skill_id, skill_lv, tick, flag|BCT_ALL|1,
+ skill->castend_nodamage_id);
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
}
break;
- */
+#endif // 0
case SM_ENDURE:
clif->skill_nodamage(src,bl,skill_id,skill_lv,
sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv)));
@@ -5692,29 +5678,27 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case AC_CONCENTRATION:
{
clif->skill_nodamage(src,bl,skill_id,skill_lv,
- sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv)));
- iMap->foreachinrange( status->change_timer_sub, src,
- skill->get_splash(skill_id, skill_lv), BL_CHAR,
- src,NULL,type,tick);
+ sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv)));
+ map->foreachinrange(status->change_timer_sub, src,
+ skill->get_splash(skill_id, skill_lv), BL_CHAR,
+ src,NULL,type,tick);
}
break;
case SM_PROVOKE:
case SM_SELFPROVOKE:
case MER_PROVOKE:
- if( (tstatus->mode&MD_BOSS) || battle->check_undead(tstatus->race,tstatus->def_ele) )
- {
- iMap->freeblock_unlock();
+ if( (tstatus->mode&MD_BOSS) || battle->check_undead(tstatus->race,tstatus->def_ele) ) {
+ map->freeblock_unlock();
return 1;
}
//TODO: How much does base level affects? Dummy value of 1% per level difference used. [Skotlex]
clif->skill_nodamage(src,bl,skill_id == SM_SELFPROVOKE ? SM_PROVOKE : skill_id,skill_lv,
(i = sc_start(bl,type, skill_id == SM_SELFPROVOKE ? 100:( 50 + 3*skill_lv + status->get_lv(src) - status->get_lv(bl)), skill_lv, skill->get_time(skill_id,skill_lv))));
- if( !i )
- {
+ if( !i ) {
if( sd )
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return 0;
}
unit->skillcastcancel(bl, 2);
@@ -5756,7 +5740,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
{
if( sd )
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return 1;
}
@@ -5768,10 +5752,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
if( i == count )
{
ARR_FIND(0, count, i, sd->devotion[i] == 0 );
- if( i == count )
- { // No free slots, skill Fail
+ if( i == count ) {
+ // No free slots, skill Fail
clif->skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0);
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return 1;
}
}
@@ -5865,10 +5849,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case RG_RAID:
skill_area_temp[1] = 0;
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
- iMap->foreachinrange(skill->area_sub, bl,
- skill->get_splash(skill_id, skill_lv), splash_target(src),
- src,skill_id,skill_lv,tick, flag|BCT_ENEMY|1,
- skill->castend_damage_id);
+ map->foreachinrange(skill->area_sub, bl,
+ skill->get_splash(skill_id, skill_lv), splash_target(src),
+ src,skill_id,skill_lv,tick, flag|BCT_ENEMY|1,
+ skill->castend_damage_id);
status_change_end(src, SC_HIDING, INVALID_TIMER);
break;
@@ -5883,8 +5867,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case KO_HAPPOKUNAI:
skill_area_temp[1] = 0;
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
- i = iMap->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), splash_target(src),
- src, skill_id, skill_lv, tick, flag|BCT_ENEMY|SD_SPLASH|1, skill->castend_damage_id);
+ i = map->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), splash_target(src),
+ src, skill_id, skill_lv, tick, flag|BCT_ENEMY|SD_SPLASH|1, skill->castend_damage_id);
if( !i && ( skill_id == NC_AXETORNADO || skill_id == SR_SKYNETBLOW || skill_id == KO_HAPPOKUNAI ) )
clif->skill_damage(src,src,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6);
break;
@@ -5916,10 +5900,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
//Passive side of the attack.
status_change_end(src, SC_SIGHT, INVALID_TIMER);
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
- iMap->foreachinrange(skill->area_sub,src,
- skill->get_splash(skill_id, skill_lv),BL_CHAR|BL_SKILL,
- src,skill_id,skill_lv,tick, flag|BCT_ENEMY|1,
- skill->castend_damage_id);
+ map->foreachinrange(skill->area_sub,src,
+ skill->get_splash(skill_id, skill_lv),BL_CHAR|BL_SKILL,
+ src,skill_id,skill_lv,tick, flag|BCT_ENEMY|1,
+ skill->castend_damage_id);
break;
case NJ_HYOUSYOURAKU:
@@ -5927,9 +5911,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case WZ_FROSTNOVA:
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
skill_area_temp[1] = 0;
- iMap->foreachinrange(skill->attack_area, src,
- skill->get_splash(skill_id, skill_lv), splash_target(src),
- BF_MAGIC, src, src, skill_id, skill_lv, tick, flag, BCT_ENEMY);
+ map->foreachinrange(skill->attack_area, src,
+ skill->get_splash(skill_id, skill_lv), splash_target(src),
+ BF_MAGIC, src, src, skill_id, skill_lv, tick, flag, BCT_ENEMY);
break;
case HVAN_EXPLOSION: //[orn]
@@ -5939,12 +5923,12 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
i = ((!md || md->special_state.ai == 2) && !map_flag_vs(src->m))?
BCT_ENEMY:BCT_ALL;
clif->skill_nodamage(src, src, skill_id, -1, 1);
- iMap->delblock(src); //Required to prevent chain-self-destructions hitting back.
- iMap->foreachinrange(skill->area_sub, bl,
- skill->get_splash(skill_id, skill_lv), splash_target(src),
- src, skill_id, skill_lv, tick, flag|i,
- skill->castend_damage_id);
- iMap->addblock(src);
+ map->delblock(src); //Required to prevent chain-self-destructions hitting back.
+ map->foreachinrange(skill->area_sub, bl,
+ skill->get_splash(skill_id, skill_lv), splash_target(src),
+ src, skill_id, skill_lv, tick, flag|i,
+ skill->castend_damage_id);
+ map->addblock(src);
status->damage(src, src, sstatus->max_hp,0,0,1);
break;
@@ -6004,7 +5988,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
if( tsce )
{
clif->skill_nodamage(src,bl,skill_id,skill_lv,status_change_end(bl, type, INVALID_TIMER));
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return 0;
}
clif->skill_nodamage(src,bl,skill_id,skill_lv,sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv)));
@@ -6041,24 +6025,22 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case TF_HIDING:
case ST_CHASEWALK:
case KO_YAMIKUMO:
- if (tsce)
- {
+ if (tsce) {
clif->skill_nodamage(src,bl,skill_id,-1,status_change_end(bl, type, INVALID_TIMER)); //Hide skill-scream animation.
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return 0;
} else if( tsc && tsc->option&OPTION_MADOGEAR ) {
//Mado Gear cannot hide
if( sd ) clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return 0;
}
clif->skill_nodamage(src,bl,skill_id,-1,sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv)));
break;
case TK_RUN:
- if (tsce)
- {
+ if (tsce) {
clif->skill_nodamage(src,bl,skill_id,skill_lv,status_change_end(bl, type, INVALID_TIMER));
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return 0;
}
clif->skill_nodamage(src,bl,skill_id,skill_lv,sc_start4(bl,type,100,skill_lv,unit->getdir(bl),0,0,0));
@@ -6076,7 +6058,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
clif->skill_nodamage(src,bl,skill_id,( skill_id == LG_FORCEOFVANGUARD ) ? skill_lv : -1,i);
else if( sd )
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return 0;
}
case RA_CAMOUFLAGE:
@@ -6176,9 +6158,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
else if(sd) {
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
// Level 6-10 doesn't consume a red gem if it fails [celest]
- if (skill_lv > 5)
- { // not to consume items
- iMap->freeblock_unlock();
+ if (skill_lv > 5) {
+ // not to consume items
+ map->freeblock_unlock();
return 0;
}
}
@@ -6297,7 +6279,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
if(sd) {
clif->item_identify_list(sd);
if( sd->menuskill_id != MC_IDENTIFY ) {/* failed, dont consume anything, return */
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return 1;
}
status_zap(src,0,skill_db[skill->get_index(skill_id)].sp[skill_lv]); // consume sp only if succeeded
@@ -6383,7 +6365,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
eflag = pc->additem(sd,&item_tmp,1,LOG_TYPE_PRODUCE);
if(eflag) {
clif->additem(sd,0,0,eflag);
- iMap->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ map->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
}
break;
@@ -6467,11 +6449,12 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
}
case AM_BERSERKPITCHER:
- case AM_POTIONPITCHER: {
+ case AM_POTIONPITCHER:
+ {
int i,sp = 0;
int64 hp = 0;
if( dstmd && dstmd->class_ == MOBID_EMPERIUM ) {
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return 1;
}
if( sd ) {
@@ -6480,18 +6463,18 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
i = pc->search_inventory(sd,skill_db[skill_id].itemid[x]);
if( i < 0 || skill_db[skill_id].itemid[x] <= 0 ) {
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return 1;
}
if(sd->inventory_data[i] == NULL || sd->status.inventory[i].amount < skill_db[skill_id].amount[x]) {
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return 1;
}
if( skill_id == AM_BERSERKPITCHER ) {
if( dstsd && dstsd->status.base_level < (unsigned int)sd->inventory_data[i]->elv ) {
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return 1;
}
}
@@ -6579,9 +6562,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
{
unsigned int equip[] = {EQP_WEAPON, EQP_SHIELD, EQP_ARMOR, EQP_HEAD_TOP};
- if( sd && ( bl->type != BL_PC || ( dstsd && pc->checkequip(dstsd,equip[skill_id - AM_CP_WEAPON]) < 0 ) ) ){
+ if( sd && ( bl->type != BL_PC || ( dstsd && pc->checkequip(dstsd,equip[skill_id - AM_CP_WEAPON]) < 0 ) ) ) {
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
- iMap->freeblock_unlock(); // Don't consume item requirements
+ map->freeblock_unlock(); // Don't consume item requirements
return 0;
}
@@ -6683,9 +6666,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
break;
}
//Affect all targets on splash area.
- iMap->foreachinrange(skill->area_sub, bl, i, BL_CHAR,
- src, skill_id, skill_lv, tick, flag|1,
- skill->castend_damage_id);
+ map->foreachinrange(skill->area_sub, bl, i, BL_CHAR,
+ src, skill_id, skill_lv, tick, flag|1,
+ skill->castend_damage_id);
break;
case TF_BACKSLIDING: //This is the correct implementation as per packet logging information. [Skotlex]
@@ -6709,7 +6692,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
}
clif->skill_nodamage(src,bl,TK_HIGHJUMP,skill_lv,1);
- if(!iMap->count_oncell(src->m,x,y,BL_PC|BL_NPC|BL_MOB) && iMap->getcell(src->m,x,y,CELL_CHKREACH)) {
+ if(!map->count_oncell(src->m,x,y,BL_PC|BL_NPC|BL_MOB) && map->getcell(src->m,x,y,CELL_CHKREACH)) {
clif->slide(src,x,y);
unit->movepos(src, x, y, 1, 0);
}
@@ -6821,8 +6804,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case BS_GREED:
if(sd){
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
- iMap->foreachinrange(skill->greed,bl,
- skill->get_splash(skill_id, skill_lv),BL_ITEM,bl);
+ map->foreachinrange(skill->greed,bl,
+ skill->get_splash(skill_id, skill_lv),BL_ITEM,bl);
}
break;
@@ -6930,7 +6913,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
// not really needed... but adding here anyway ^^
if (md && md->master_id > 0) {
struct block_list *mbl, *tbl;
- if ((mbl = iMap->id2bl(md->master_id)) == NULL ||
+ if ((mbl = map->id2bl(md->master_id)) == NULL ||
(tbl = battle->get_targeted(mbl)) == NULL)
break;
md->state.provoke_flag = tbl->id;
@@ -6941,7 +6924,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case NPC_RUN:
{
const int mask[8][2] = {{0,-1},{1,-1},{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1}};
- uint8 dir = (bl == src)?unit->getdir(src):iMap->calc_dir(src,bl->x,bl->y); //If cast on self, run forward, else run away.
+ uint8 dir = (bl == src)?unit->getdir(src):map->calc_dir(src,bl->x,bl->y); //If cast on self, run forward, else run away.
unit->stop_attack(src);
//Run skillv tiles overriding the can-move check.
if (unit->walktoxy(src, src->x + skill_lv * mask[dir][0], src->y + skill_lv * mask[dir][1], 2) && md)
@@ -7031,7 +7014,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
// if neither was found
if(!f_sd && !m_sd) {
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return 0;
}
status->change_start(bl,SC_STUN,10000,skill_lv,0,0,0,skill->get_time2(skill_id,skill_lv),8);
@@ -7066,37 +7049,32 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
if( su && (sg = su->group) && (src->type == BL_MER || sg->src_id == src->id || map_flag_vs(bl->m)) && (skill->get_inf2(sg->skill_id)&INF2_TRAP) )
{
clif->skill_nodamage(src, bl, skill_id, skill_lv, 1);
- if( sd && !(sg->unit_id == UNT_USED_TRAPS || (sg->unit_id == UNT_ANKLESNARE && sg->val2 != 0 )) )
- { // prevent picking up expired traps
- if( battle_config.skill_removetrap_type )
- { // get back all items used to deploy the trap
- for( i = 0; i < 10; i++ )
- {
- if( skill_db[su->group->skill_id].itemid[i] > 0 )
- {
+ if( sd && !(sg->unit_id == UNT_USED_TRAPS || (sg->unit_id == UNT_ANKLESNARE && sg->val2 != 0 )) ) {
+ // prevent picking up expired traps
+ if( battle_config.skill_removetrap_type ) {
+ // get back all items used to deploy the trap
+ for( i = 0; i < 10; i++ ) {
+ if( skill_db[su->group->skill_id].itemid[i] > 0 ) {
int flag;
struct item item_tmp;
memset(&item_tmp,0,sizeof(item_tmp));
item_tmp.nameid = skill_db[su->group->skill_id].itemid[i];
item_tmp.identify = 1;
- if( item_tmp.nameid && (flag=pc->additem(sd,&item_tmp,skill_db[su->group->skill_id].amount[i],LOG_TYPE_OTHER)) )
- {
+ if( item_tmp.nameid && (flag=pc->additem(sd,&item_tmp,skill_db[su->group->skill_id].amount[i],LOG_TYPE_OTHER)) ) {
clif->additem(sd,0,0,flag);
- iMap->addflooritem(&item_tmp,skill_db[su->group->skill_id].amount[i],sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ map->addflooritem(&item_tmp,skill_db[su->group->skill_id].amount[i],sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
}
}
- }
- else
- { // get back 1 trap
+ } else {
+ // get back 1 trap
struct item item_tmp;
memset(&item_tmp,0,sizeof(item_tmp));
item_tmp.nameid = su->group->item_id?su->group->item_id:ITEMID_TRAP;
item_tmp.identify = 1;
- if( item_tmp.nameid && (flag=pc->additem(sd,&item_tmp,1,LOG_TYPE_OTHER)) )
- {
+ if( item_tmp.nameid && (flag=pc->additem(sd,&item_tmp,1,LOG_TYPE_OTHER)) ) {
clif->additem(sd,0,0,flag);
- iMap->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ map->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
}
}
@@ -7142,16 +7120,14 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
break;
case AS_SPLASHER:
- if(tstatus->mode&MD_BOSS
- /**
- * Renewal dropped the 3/4 hp requirement
- **/
- #ifndef RENEWAL
- || tstatus-> hp > tstatus->max_hp*3/4
- #endif
- ) {
+ if( tstatus->mode&MD_BOSS
+#ifndef RENEWAL
+ /** Renewal dropped the 3/4 hp requirement **/
+ || tstatus-> hp > tstatus->max_hp*3/4
+#endif // RENEWAL
+ ) {
if (sd) clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return 1;
}
clif->skill_nodamage(src,bl,skill_id,skill_lv,
@@ -7164,23 +7140,23 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case PF_MINDBREAKER:
{
if(tstatus->mode&MD_BOSS || battle->check_undead(tstatus->race,tstatus->def_ele) ) {
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return 1;
}
- if (tsce)
- { //HelloKitty2 (?) explained that this silently fails when target is
+ if (tsce) {
+ //HelloKitty2 (?) explained that this silently fails when target is
//already inflicted. [Skotlex]
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return 1;
}
//Has a 55% + skill_lv*5% success chance.
if (!clif->skill_nodamage(src,bl,skill_id,skill_lv,
- sc_start(bl,type,55+5*skill_lv,skill_lv,skill->get_time(skill_id,skill_lv))))
- {
+ sc_start(bl,type,55+5*skill_lv,skill_lv,skill->get_time(skill_id,skill_lv)))
+ ) {
if (sd) clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return 0;
}
@@ -7276,7 +7252,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
}
if( sd && !s ){
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
- iMap->freeblock_unlock(); // Don't consume item requirements
+ map->freeblock_unlock(); // Don't consume item requirements
return 0;
}
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
@@ -7302,15 +7278,14 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
{
int eff, count = -1;
if( tsc && tsc->data[type] ){
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return 0;
}
- if( rnd() % 100 > skill_lv * 8 || (dstmd && ((dstmd->guardian_data && dstmd->class_ == MOBID_EMPERIUM) || mob_is_battleground(dstmd))) )
- {
+ if( rnd() % 100 > skill_lv * 8 || (dstmd && ((dstmd->guardian_data && dstmd->class_ == MOBID_EMPERIUM) || mob_is_battleground(dstmd))) ) {
if( sd )
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return 0;
}
status_zap(src,0,skill_db[skill->get_index(skill_id)].sp[skill_lv]); // consume sp only if succeeded [Inkfish]
@@ -7467,10 +7442,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
sc_start(bl,type,100,skill_lv,skill->get_time(skill_id, skill_lv));
} else if (status->get_guild_id(src)) {
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
- iMap->foreachinrange(skill->area_sub, src,
- skill->get_splash(skill_id, skill_lv), BL_PC,
- src,skill_id,skill_lv,tick, flag|BCT_GUILD|1,
- skill->castend_nodamage_id);
+ map->foreachinrange(skill->area_sub, src,
+ skill->get_splash(skill_id, skill_lv), BL_PC,
+ src,skill_id,skill_lv,tick, flag|BCT_GUILD|1,
+ skill->castend_nodamage_id);
if (sd)
guild->block_skill(sd,skill->get_time2(skill_id,skill_lv));
}
@@ -7481,10 +7456,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
sc_start(bl,type,100,skill_lv,skill->get_time(skill_id, skill_lv));
} else if (status->get_guild_id(src)) {
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
- iMap->foreachinrange(skill->area_sub, src,
- skill->get_splash(skill_id, skill_lv), BL_PC,
- src,skill_id,skill_lv,tick, flag|BCT_GUILD|1,
- skill->castend_nodamage_id);
+ map->foreachinrange(skill->area_sub, src,
+ skill->get_splash(skill_id, skill_lv), BL_PC,
+ src,skill_id,skill_lv,tick, flag|BCT_GUILD|1,
+ skill->castend_nodamage_id);
if (sd)
guild->block_skill(sd,skill->get_time2(skill_id,skill_lv));
}
@@ -7495,10 +7470,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
clif->skill_nodamage(src,bl,AL_HEAL,status_percent_heal(bl,90,90),1);
} else if (status->get_guild_id(src)) {
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
- iMap->foreachinrange(skill->area_sub, src,
- skill->get_splash(skill_id, skill_lv), BL_PC,
- src,skill_id,skill_lv,tick, flag|BCT_GUILD|1,
- skill->castend_nodamage_id);
+ map->foreachinrange(skill->area_sub, src,
+ skill->get_splash(skill_id, skill_lv), BL_PC,
+ src,skill_id,skill_lv,tick, flag|BCT_GUILD|1,
+ skill->castend_nodamage_id);
if (sd)
guild->block_skill(sd,skill->get_time2(skill_id,skill_lv));
}
@@ -7519,7 +7494,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
if ((dstsd = g->member[i].sd) != NULL && sd != dstsd && !dstsd->state.autotrade && !pc_isdead(dstsd)) {
if (maplist[dstsd->bl.m].flag.nowarp && !map_flag_gvg2(dstsd->bl.m))
continue;
- if(iMap->getcell(src->m,src->x+dx[j],src->y+dy[j],CELL_CHKNOREACH))
+ if(map->getcell(src->m,src->x+dx[j],src->y+dy[j],CELL_CHKNOREACH))
dx[j] = dy[j] = 0;
pc->setpos(dstsd, map_id2index(src->m), src->x+dx[j], src->y+dy[j], CLR_RESPAWN);
}
@@ -7601,8 +7576,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
}
//TODO: Shouldn't also players and the like switch targets?
- iMap->foreachinrange(skill->chastle_mob_changetarget,src,
- AREA_SIZE, BL_MOB, bl, src);
+ map->foreachinrange(skill->chastle_mob_changetarget,src,
+ AREA_SIZE, BL_MOB, bl, src);
}
}
// Failed
@@ -7621,7 +7596,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
else if(r<per[i][1]) //Master
bl = battle->get_master(src);
else //Enemy
- bl = iMap->id2bl(battle->get_target(src));
+ bl = map->id2bl(battle->get_target(src));
if (!bl) bl = src;
i = skill->calc_heal(src, bl, skill_id, 1+rnd()%skill_lv, true);
@@ -7685,13 +7660,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
default:
sc_start2(bl,type,100,skill_lv,src->id,skill->get_time2(skill_id,skill_lv));
}
- }else {
+ } else {
skill_area_temp[2] = 0; //For SD_PREAMBLE
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
- iMap->foreachinrange(skill->area_sub, bl,
- skill->get_splash(skill_id, skill_lv),BL_CHAR,
- src,skill_id,skill_lv,tick, flag|BCT_ENEMY|SD_PREAMBLE|1,
- skill->castend_nodamage_id);
+ map->foreachinrange(skill->area_sub, bl,
+ skill->get_splash(skill_id, skill_lv),BL_CHAR,
+ src,skill_id,skill_lv,tick, flag|BCT_ENEMY|SD_PREAMBLE|1,
+ skill->castend_nodamage_id);
}
break;
case NPC_WIDESOULDRAIN:
@@ -7700,10 +7675,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
else {
skill_area_temp[2] = 0; //For SD_PREAMBLE
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
- iMap->foreachinrange(skill->area_sub, bl,
- skill->get_splash(skill_id, skill_lv),BL_CHAR,
- src,skill_id,skill_lv,tick, flag|BCT_ENEMY|SD_PREAMBLE|1,
- skill->castend_nodamage_id);
+ map->foreachinrange(skill->area_sub, bl,
+ skill->get_splash(skill_id, skill_lv),BL_CHAR,
+ src,skill_id,skill_lv,tick, flag|BCT_ENEMY|SD_PREAMBLE|1,
+ skill->castend_nodamage_id);
}
break;
case ALL_PARTYFLEE:
@@ -7738,14 +7713,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case RK_DRAGONHOWLING:
if( flag&1)
sc_start(bl,type,50 + 6 * skill_lv,skill_lv,skill->get_time(skill_id,skill_lv));
- else
- {
+ else {
skill_area_temp[2] = 0;
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
- iMap->foreachinrange(skill->area_sub, src,
- skill->get_splash(skill_id,skill_lv),BL_CHAR,
- src,skill_id,skill_lv,tick,flag|BCT_ENEMY|SD_PREAMBLE|1,
- skill->castend_nodamage_id);
+ map->foreachinrange(skill->area_sub, src,
+ skill->get_splash(skill_id,skill_lv),BL_CHAR,
+ src,skill_id,skill_lv,tick,flag|BCT_ENEMY|SD_PREAMBLE|1,
+ skill->castend_nodamage_id);
}
break;
case RK_IGNITIONBREAK:
@@ -7754,10 +7728,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
i = skill->get_splash(skill_id,skill_lv);
if( skill_id == LG_EARTHDRIVE ) {
int dummy = 1;
- iMap->foreachinarea(skill->cell_overlap, src->m, src->x-i, src->y-i, src->x+i, src->y+i, BL_SKILL, LG_EARTHDRIVE, &dummy, src);
+ map->foreachinarea(skill->cell_overlap, src->m, src->x-i, src->y-i, src->x+i, src->y+i, BL_SKILL, LG_EARTHDRIVE, &dummy, src);
}
- iMap->foreachinrange(skill->area_sub, bl,i,BL_CHAR,
- src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id);
+ map->foreachinrange(skill->area_sub, bl,i,BL_CHAR,
+ src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id);
break;
case RK_STONEHARDSKIN:
if( sd ) {
@@ -7871,7 +7845,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
{
short count = 1;
skill_area_temp[2] = 0;
- iMap->foreachinrange(skill->area_sub,src,skill->get_splash(skill_id,skill_lv),BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|SD_PREAMBLE|SD_SPLASH|1,skill->castend_damage_id);
+ map->foreachinrange(skill->area_sub,src,skill->get_splash(skill_id,skill_lv),BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|SD_PREAMBLE|SD_SPLASH|1,skill->castend_damage_id);
if( tsc && tsc->data[SC_ROLLINGCUTTER] )
{ // Every time the skill is casted the status change is reseted adding a counter.
count += (short)tsc->data[SC_ROLLINGCUTTER]->val1;
@@ -7925,8 +7899,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case GC_PHANTOMMENACE:
clif->skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6);
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
- iMap->foreachinrange(skill->area_sub,src,skill->get_splash(skill_id,skill_lv),BL_CHAR,
- src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id);
+ map->foreachinrange(skill->area_sub,src,skill->get_splash(skill_id,skill_lv),BL_CHAR,
+ src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id);
break;
case GC_HALLUCINATIONWALK:
@@ -7995,9 +7969,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case AB_ORATIO:
if( flag&1 )
sc_start(bl, type, 40 + 5 * skill_lv, skill_lv, skill->get_time(skill_id, skill_lv));
- else
- {
- iMap->foreachinrange(skill->area_sub, src, skill->get_splash(skill_id, skill_lv), BL_CHAR,
+ else {
+ map->foreachinrange(skill->area_sub, src, skill->get_splash(skill_id, skill_lv), BL_CHAR,
src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_nodamage_id);
clif->skill_nodamage(src, bl, skill_id, skill_lv, 1);
}
@@ -8071,12 +8044,12 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
}
break;
}
- iMap->foreachinrange(skill->area_sub, bl, i, BL_CHAR, src, skill_id, skill_lv, tick, flag|1, skill->castend_damage_id);
+ map->foreachinrange(skill->area_sub, bl, i, BL_CHAR, src, skill_id, skill_lv, tick, flag|1, skill->castend_damage_id);
break;
case AB_SILENTIUM:
// Should the level of Lex Divina be equivalent to the level of Silentium or should the highest level learned be used? [LimitLine]
- iMap->foreachinrange(skill->area_sub, src, skill->get_splash(skill_id, skill_lv), BL_CHAR,
+ map->foreachinrange(skill->area_sub, src, skill->get_splash(skill_id, skill_lv), BL_CHAR,
src, PR_LEXDIVINA, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_nodamage_id);
clif->skill_nodamage(src, bl, skill_id, skill_lv, 1);
break;
@@ -8086,9 +8059,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case WL_STASIS:
if( flag&1 )
sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv));
- else
- {
- iMap->foreachinrange(skill->area_sub,src,skill->get_splash(skill_id, skill_lv),BL_CHAR,src,skill_id,skill_lv,tick,(map_flag_vs(src->m)?BCT_ALL:BCT_ENEMY|BCT_SELF)|flag|1,skill->castend_nodamage_id);
+ else {
+ map->foreachinrange(skill->area_sub,src,skill->get_splash(skill_id, skill_lv),BL_CHAR,src,skill_id,skill_lv,tick,(map_flag_vs(src->m)?BCT_ALL:BCT_ENEMY|BCT_SELF)|flag|1,skill->castend_nodamage_id);
clif->skill_nodamage(src, bl, skill_id, skill_lv, 1);
}
break;
@@ -8115,12 +8087,12 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case WL_FROSTMISTY:
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
- iMap->foreachinrange(skill->area_sub,bl,skill->get_splash(skill_id,skill_lv),BL_CHAR|BL_SKILL,src,skill_id,skill_lv,tick,flag|BCT_ENEMY,skill->castend_damage_id);
+ map->foreachinrange(skill->area_sub,bl,skill->get_splash(skill_id,skill_lv),BL_CHAR|BL_SKILL,src,skill_id,skill_lv,tick,flag|BCT_ENEMY,skill->castend_damage_id);
break;
case WL_JACKFROST:
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
- iMap->foreachinshootrange(skill->area_sub,bl,skill->get_splash(skill_id,skill_lv),BL_CHAR|BL_SKILL,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id);
+ map->foreachinshootrange(skill->area_sub,bl,skill->get_splash(skill_id,skill_lv),BL_CHAR|BL_SKILL,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id);
break;
case WL_MARSHOFABYSS:
@@ -8140,7 +8112,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
int rate = 45 + 5 * skill_lv;
if( rnd()%100 < rate ){
clif->skill_nodamage(src, bl, skill_id, skill_lv, 1);
- iMap->foreachinrange(skill->area_sub,bl,skill->get_splash(skill_id,skill_lv),BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill_castend_nodamage_id);
+ map->foreachinrange(skill->area_sub,bl,skill->get_splash(skill_id,skill_lv),BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill_castend_nodamage_id);
}else if( sd ) // Failure on Rate
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
}
@@ -8211,7 +8183,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case RA_WUGDASH:
if( tsce ) {
clif->skill_nodamage(src,bl,skill_id,skill_lv,status_change_end(bl, type, INVALID_TIMER));
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return 0;
}
if( sd && pc_isridingwug(sd) ) {
@@ -8223,7 +8195,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case RA_SENSITIVEKEEN:
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
clif->skill_damage(src,src,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6);
- iMap->foreachinrange(skill->area_sub,src,skill->get_splash(skill_id,skill_lv),BL_CHAR|BL_SKILL,src,skill_id,skill_lv,tick,flag|BCT_ENEMY,skill->castend_damage_id);
+ map->foreachinrange(skill->area_sub,src,skill->get_splash(skill_id,skill_lv),BL_CHAR|BL_SKILL,src,skill_id,skill_lv,tick,flag|BCT_ENEMY,skill->castend_damage_id);
break;
/**
* Mechanic
@@ -8258,7 +8230,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case NC_MAGNETICFIELD:
if( (i = sc_start2(bl,type,100,skill_lv,src->id,skill->get_time(skill_id,skill_lv))) )
{
- iMap->foreachinrange(skill->area_sub,src,skill->get_splash(skill_id,skill_lv),splash_target(src),src,skill_id,skill_lv,tick,flag|BCT_ENEMY|SD_SPLASH|1,skill->castend_damage_id);;
+ map->foreachinrange(skill->area_sub,src,skill->get_splash(skill_id,skill_lv),splash_target(src),src,skill_id,skill_lv,tick,flag|BCT_ENEMY|SD_SPLASH|1,skill->castend_damage_id);;
clif->skill_damage(src,src,tick,status_get_amotion(src),0,-30000,1,skill_id,skill_lv,6);
if (sd) pc->overheat(sd,1);
}
@@ -8286,7 +8258,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case NC_DISJOINT:
{
if( bl->type != BL_MOB ) break;
- md = iMap->id2md(bl->id);
+ md = map->id2md(bl->id);
if( md && md->class_ >= MOBID_SILVERSNIPER && md->class_ <= MOBID_MAGICDECOY_WIND )
status_kill(bl);
clif->skill_nodamage(src, bl, skill_id, skill_lv, 1);
@@ -8330,8 +8302,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
}
} else {
clif->skill_nodamage(src, bl, skill_id, 0, 1);
- iMap->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), BL_CHAR,
- src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_nodamage_id);
+ map->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), BL_CHAR,
+ src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_nodamage_id);
}
break;
@@ -8369,7 +8341,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case LG_TRAMPLE:
clif->skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6);
- iMap->foreachinrange(skill->destroy_trap,bl,skill->get_splash(skill_id,skill_lv),BL_SKILL,tick);
+ map->foreachinrange(skill->destroy_trap,bl,skill->get_splash(skill_id,skill_lv),BL_SKILL,tick);
break;
case LG_REFLECTDAMAGE:
@@ -8390,40 +8362,39 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
int val, brate;
switch( skill_lv ) {
case 1:
- {
- struct item_data *shield_data = sd->inventory_data[sd->equip_index[EQI_HAND_L]];
- if( !shield_data || shield_data->type != IT_ARMOR ) { // No shield?
- clif->skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0);
+ {
+ struct item_data *shield_data = sd->inventory_data[sd->equip_index[EQI_HAND_L]];
+ if( !shield_data || shield_data->type != IT_ARMOR ) { // No shield?
+ clif->skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0);
+ break;
+ }
+ brate = shield_data->def * 10;
+ if( rate < 50 )
+ opt = 1;
+ else if( rate < 75 )
+ opt = 2;
+ else
+ opt = 3;
+
+ switch( opt ) {
+ case 1:
+ sc_start(bl,SC_SHIELDSPELL_DEF,100,opt,-1);
+ clif->skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6);
+ if( rate < brate )
+ map->foreachinrange(skill->area_sub,src,skill->get_splash(skill_id,skill_lv),BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id);
+ status_change_end(bl,SC_SHIELDSPELL_DEF,INVALID_TIMER);
+ break;
+ case 2:
+ val = shield_data->def / 10; // % Reflected damage.
+ sc_start2(bl,SC_SHIELDSPELL_DEF,brate,opt,val,shield_data->def * 1000);
+ break;
+ case 3:
+ val = shield_data->def; // Attack increase.
+ sc_start2(bl,SC_SHIELDSPELL_DEF,brate,opt,val,shield_data->def * 3000);
break;
- }
- brate = shield_data->def * 10;
- if( rate < 50 )
- opt = 1;
- else if( rate < 75 )
- opt = 2;
- else
- opt = 3;
-
- switch( opt ) {
- case 1:
- sc_start(bl,SC_SHIELDSPELL_DEF,100,opt,-1);
- clif->skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6);
- if( rate < brate )
- iMap->foreachinrange(skill->area_sub,src,skill->get_splash(skill_id,skill_lv),BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id);
- status_change_end(bl,SC_SHIELDSPELL_DEF,INVALID_TIMER);
- break;
- case 2:
- val = shield_data->def / 10; // % Reflected damage.
- sc_start2(bl,SC_SHIELDSPELL_DEF,brate,opt,val,shield_data->def * 1000);
- break;
- case 3:
- val = shield_data->def; // Attack increase.
- sc_start2(bl,SC_SHIELDSPELL_DEF,brate,opt,val,shield_data->def * 3000);
- break;
- }
}
+ }
break;
-
case 2:
brate = sd->bonus.shieldmdef * 20;
if( rate < 30 )
@@ -8437,14 +8408,14 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
sc_start(bl,SC_SHIELDSPELL_MDEF,100,opt,-1);
clif->skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6);
if( rate < brate )
- iMap->foreachinrange(skill->area_sub,src,skill->get_splash(skill_id,skill_lv),BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|2,skill->castend_damage_id);
+ map->foreachinrange(skill->area_sub,src,skill->get_splash(skill_id,skill_lv),BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|2,skill->castend_damage_id);
status_change_end(bl,SC_SHIELDSPELL_MDEF,INVALID_TIMER);
break;
case 2:
sc_start(bl,SC_SHIELDSPELL_MDEF,100,opt,-1);
clif->skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6);
if( rate < brate )
- iMap->foreachinrange(skill->area_sub,src,skill->get_splash(skill_id,skill_lv),BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_nodamage_id);
+ map->foreachinrange(skill->area_sub,src,skill->get_splash(skill_id,skill_lv),BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_nodamage_id);
break;
case 3:
if( sc_start(bl,SC_SHIELDSPELL_MDEF,brate,opt,sd->bonus.shieldmdef * 30000) )
@@ -8498,7 +8469,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv));
else {
skill_area_temp[2] = 0;
- iMap->foreachinrange(skill->area_sub,bl,skill->get_splash(skill_id,skill_lv),BL_PC,src,skill_id,skill_lv,tick,flag|SD_PREAMBLE|BCT_PARTY|BCT_SELF|1,skill->castend_nodamage_id);
+ map->foreachinrange(skill->area_sub,bl,skill->get_splash(skill_id,skill_lv),BL_PC,src,skill_id,skill_lv,tick,flag|SD_PREAMBLE|BCT_PARTY|BCT_SELF|1,skill->castend_nodamage_id);
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
}
break;
@@ -8526,7 +8497,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
skill_area_temp[2] = 0;
if( !map_flag_vs(src->m) && !map_flag_gvg(src->m) )
flag |= BCT_GUILD;
- iMap->foreachinrange(skill->area_sub,bl,skill->get_splash(skill_id,skill_lv),BL_PC,src,skill_id,skill_lv,tick,flag|SD_PREAMBLE|BCT_PARTY|BCT_SELF|1,skill->castend_nodamage_id);
+ map->foreachinrange(skill->area_sub,bl,skill->get_splash(skill_id,skill_lv),BL_PC,src,skill_id,skill_lv,tick,flag|SD_PREAMBLE|BCT_PARTY|BCT_SELF|1,skill->castend_nodamage_id);
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
}
break;
@@ -8548,13 +8519,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
mob->unlocktarget((TBL_MOB*)bl,timer->gettick());
unit->stop_attack(bl);
clif->bladestop(src, bl->id, 1);
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return 1;
}
} else {
int count = 0;
clif->skill_damage(src, bl, tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6);
- count = iMap->forcountinrange(skill->area_sub, src, skill->get_splash(skill_id,skill_lv), (sd)?sd->spiritball_old:15, // Assume 15 spiritballs in non-charactors
+ count = map->forcountinrange(skill->area_sub, src, skill->get_splash(skill_id,skill_lv), (sd)?sd->spiritball_old:15, // Assume 15 spiritballs in non-charactors
BL_CHAR, src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_nodamage_id);
if( sd ) pc->delspiritball(sd, count, 0);
clif->skill_nodamage(src, src, skill_id, skill_lv,
@@ -8584,7 +8555,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
clif->skill_nodamage(src, bl, skill_id, skill_lv, i ? 1:0);
} else {
clif->skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6);
- iMap->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|BCT_SELF|SD_SPLASH|1, skill->castend_nodamage_id);
+ map->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|BCT_SELF|SD_SPLASH|1, skill->castend_nodamage_id);
}
break;
@@ -8690,7 +8661,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
if( flag&1 ) {
sc_start2(bl,type,(skill_id==WM_VOICEOFSIREN)?20+10*skill_lv:100,skill_lv,(skill_id==WM_VOICEOFSIREN)?src->id:0,skill->get_time(skill_id,skill_lv));
} else {
- iMap->foreachinrange(skill->area_sub, src, skill->get_splash(skill_id,skill_lv),(skill_id==WM_VOICEOFSIREN)?BL_CHAR|BL_SKILL:BL_PC, src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_nodamage_id);
+ map->foreachinrange(skill->area_sub, src, skill->get_splash(skill_id,skill_lv),(skill_id==WM_VOICEOFSIREN)?BL_CHAR|BL_SKILL:BL_PC, src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_nodamage_id);
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
}
break;
@@ -8720,12 +8691,12 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
clif->skill_fail(sd,skill_id,USESKILL_FAIL_NEED_HELPER,0);
break;
}
- if( iMap->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id,skill_lv),
+ if( map->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id,skill_lv),
BL_PC, src, skill_id, skill_lv, tick, BCT_ENEMY, skill->area_sub_count) > 7 )
flag |= 2;
else
flag |= 1;
- iMap->foreachinrange(skill->area_sub, src, skill->get_splash(skill_id,skill_lv),BL_PC, src, skill_id, skill_lv, tick, flag|BCT_ENEMY|BCT_SELF, skill->castend_nodamage_id);
+ map->foreachinrange(skill->area_sub, src, skill->get_splash(skill_id,skill_lv),BL_PC, src, skill_id, skill_lv, tick, flag|BCT_ENEMY|BCT_SELF, skill->castend_nodamage_id);
clif->skill_nodamage(src, bl, skill_id, skill_lv,
sc_start(src,SC_STOP,100,skill_lv,skill->get_time2(skill_id,skill_lv)));
if( flag&2 ) // Dealed here to prevent conflicts
@@ -8760,7 +8731,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
} else { // These affect to all targets arround the caster.
uint16 lv = skill_lv;
skill_area_temp[0] = (sd) ? skill->check_pc_partner(sd,skill_id,&lv,skill->get_splash(skill_id,skill_lv),1) : 50; // 50% chance in non BL_PC (clones).
- iMap->foreachinrange(skill->area_sub, src, skill->get_splash(skill_id,skill_lv),BL_PC, src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_nodamage_id);
+ map->foreachinrange(skill->area_sub, src, skill->get_splash(skill_id,skill_lv),BL_PC, src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_nodamage_id);
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
}
break;
@@ -8799,7 +8770,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
if (!target_id)
break;
if (skill->get_casttype(improv_skill_id) == CAST_GROUND) {
- bl = iMap->id2bl(target_id);
+ bl = map->id2bl(target_id);
if (!bl) bl = src;
unit->skilluse_pos(src, bl->x, bl->y, improv_skill_id, improv_skill_lv);
} else
@@ -8830,10 +8801,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
mapindex = mapindex_name2id(MAP_MORA);
}
- if(!mapindex)
- { //Given map not found?
+ if(!mapindex) {
+ //Given map not found?
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return 0;
}
pc->setpos(sd, mapindex, x, y, CLR_TELEPORT);
@@ -8869,8 +8840,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
sc_start(bl,type,rate,skill_lv,skill->get_time(skill_id,skill_lv));
}else {
clif->skill_nodamage(src, bl, skill_id, skill_lv, 1);
- iMap->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), BL_CHAR,
- src, skill_id, skill_lv, tick, flag|BCT_ALL|1, skill->castend_nodamage_id);
+ map->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), BL_CHAR,
+ src, skill_id, skill_lv, tick, flag|BCT_ALL|1, skill->castend_nodamage_id);
}
break;
@@ -8998,8 +8969,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
sc_start(bl, type, 25 + 10 * skill_lv, skill_lv, skill->get_time(skill_id, skill_lv))) )
status_zap(bl, 0, status_get_max_sp(bl) * (25 + 5 * skill_lv) / 100);
} else
- iMap->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), BL_CHAR,
- src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_nodamage_id);
+ map->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), BL_CHAR,
+ src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_nodamage_id);
break;
case GN_SLINGITEM:
@@ -9015,7 +8986,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
if( itemdb_is_GNbomb(ammo_id) ) {
if(battle->check_target(src,bl,BCT_ENEMY) > 0) {// Only attack if the target is an enemy.
if( ammo_id == 13263 )
- iMap->foreachincell(skill->area_sub,bl->m,bl->x,bl->y,BL_CHAR,src,GN_SLINGITEM_RANGEMELEEATK,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id);
+ map->foreachincell(skill->area_sub,bl->m,bl->x,bl->y,BL_CHAR,src,GN_SLINGITEM_RANGEMELEEATK,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id);
else
skill->attack(BF_WEAPON,src,src,bl,GN_SLINGITEM_RANGEMELEEATK,skill_lv,tick,flag);
} else //Otherwise, it fails, shows animation and removes items.
@@ -9234,9 +9205,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
clif->skill_damage(src,src,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6);
sc_start(src, SC_STOP, 100, skill_lv, skill->get_time(skill_id, skill_lv));
}
- }else{
+ } else {
skill_area_temp[2] = 0;
- iMap->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|SD_SPLASH|1, skill->castend_nodamage_id);
+ map->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|SD_SPLASH|1, skill->castend_nodamage_id);
}
break;
@@ -9317,7 +9288,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
struct mob_data *md;
int i, dummy = 0;
- i = iMap->foreachinmap(skill->check_condition_mob_master_sub ,hd->bl.m, BL_MOB, hd->bl.id, summons[skill_lv-1], skill_id, &dummy);
+ i = map->foreachinmap(skill->check_condition_mob_master_sub ,hd->bl.m, BL_MOB, hd->bl.id, summons[skill_lv-1], skill_id, &dummy);
if(i >= qty[skill_lv-1])
break;
@@ -9339,7 +9310,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
default:
ShowWarning("skill_castend_nodamage_id: Unknown skill used:%d\n",skill_id);
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return 1;
}
@@ -9365,16 +9336,15 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
skill->consume_requirement(sd,skill_id,skill_lv,2);
}
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return 0;
}
/*==========================================
*
*------------------------------------------*/
-int skill_castend_pos(int tid, unsigned int tick, int id, intptr_t data)
-{
- struct block_list* src = iMap->id2bl(id);
+int skill_castend_pos(int tid, unsigned int tick, int id, intptr_t data) {
+ struct block_list* src = map->id2bl(id);
int maxcount;
struct map_session_data *sd;
struct unit_data *ud = unit->bl2ud(src);
@@ -9501,7 +9471,7 @@ int skill_castend_pos(int tid, unsigned int tick, int id, intptr_t data)
// }
unit->set_walkdelay(src, tick, battle_config.default_walk_delay+skill->get_walkdelay(ud->skill_id, ud->skill_lv), 1);
status_change_end(src,SC_CAMOUFLAGE, INVALID_TIMER);// only normal attack and auto cast skills benefit from its bonuses
- iMap->freeblock_lock();
+ map->freeblock_lock();
skill->castend_pos2(src,ud->skillx,ud->skilly,ud->skill_id,ud->skill_lv,tick,0);
if( sd && sd->skillitem != AL_WARP ) // Warp-Portal thru items will clear data in skill_castend_map. [Inkfish]
@@ -9513,7 +9483,7 @@ int skill_castend_pos(int tid, unsigned int tick, int id, intptr_t data)
ud->skill_lv = ud->skillx = ud->skilly = 0;
}
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return 1;
} while(0);
@@ -9718,38 +9688,38 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
case PR_BENEDICTIO:
skill_area_temp[1] = src->id;
i = skill->get_splash(skill_id, skill_lv);
- iMap->foreachinarea(skill->area_sub,
- src->m, x-i, y-i, x+i, y+i, BL_PC,
- src, skill_id, skill_lv, tick, flag|BCT_ALL|1,
- skill->castend_nodamage_id);
- iMap->foreachinarea(skill->area_sub,
- src->m, x-i, y-i, x+i, y+i, BL_CHAR,
- src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1,
- skill->castend_damage_id);
+ map->foreachinarea(skill->area_sub,
+ src->m, x-i, y-i, x+i, y+i, BL_PC,
+ src, skill_id, skill_lv, tick, flag|BCT_ALL|1,
+ skill->castend_nodamage_id);
+ map->foreachinarea(skill->area_sub,
+ src->m, x-i, y-i, x+i, y+i, BL_CHAR,
+ src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1,
+ skill->castend_damage_id);
break;
case BS_HAMMERFALL:
i = skill->get_splash(skill_id, skill_lv);
- iMap->foreachinarea (skill->area_sub,
- src->m, x-i, y-i, x+i, y+i, BL_CHAR,
- src, skill_id, skill_lv, tick, flag|BCT_ENEMY|2,
- skill->castend_nodamage_id);
+ map->foreachinarea(skill->area_sub,
+ src->m, x-i, y-i, x+i, y+i, BL_CHAR,
+ src, skill_id, skill_lv, tick, flag|BCT_ENEMY|2,
+ skill->castend_nodamage_id);
break;
case HT_DETECTING:
i = skill->get_splash(skill_id, skill_lv);
- iMap->foreachinarea( status->change_timer_sub,
- src->m, x-i, y-i, x+i,y+i,BL_CHAR,
- src,NULL,SC_SIGHT,tick);
+ map->foreachinarea(status->change_timer_sub,
+ src->m, x-i, y-i, x+i,y+i,BL_CHAR,
+ src,NULL,SC_SIGHT,tick);
if(battle_config.traps_setting&1)
- iMap->foreachinarea( skill_reveal_trap,
- src->m, x-i, y-i, x+i,y+i,BL_SKILL);
+ map->foreachinarea(skill_reveal_trap,
+ src->m, x-i, y-i, x+i,y+i,BL_SKILL);
break;
case SR_RIDEINLIGHTNING:
i = skill->get_splash(skill_id, skill_lv);
- iMap->foreachinarea(skill->area_sub, src->m, x-i, y-i, x+i, y+i, BL_CHAR,
- src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_damage_id);
+ map->foreachinarea(skill->area_sub, src->m, x-i, y-i, x+i, y+i, BL_CHAR,
+ src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_damage_id);
break;
case SA_VOLCANO:
@@ -9889,7 +9859,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
if( sc->data[SC_BASILICA] )
status_change_end(src, SC_BASILICA, INVALID_TIMER); // Cancel Basilica
else { // Create Basilica. Start SC on caster. Unit timer start SC on others.
- if( iMap->foreachinrange(skill_count_wos, src, 2, BL_MOB|BL_PC, src) ) {
+ if( map->foreachinrange(skill_count_wos, src, 2, BL_MOB|BL_PC, src) ) {
if( sd )
clif->skill_fail(sd,skill_id,USESKILL_FAIL,0);
return 1;
@@ -9910,7 +9880,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
break;
case RG_CLEANER: // [Valaris]
i = skill->get_splash(skill_id, skill_lv);
- iMap->foreachinarea(skill->graffitiremover,src->m,x-i,y-i,x+i,y+i,BL_SKILL);
+ map->foreachinarea(skill->graffitiremover,src->m,x-i,y-i,x+i,y+i,BL_SKILL);
break;
case SO_WARMER:
@@ -10020,10 +9990,10 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
if(script->potion_hp > 0 || script->potion_sp > 0) {
i = skill->get_splash(skill_id, skill_lv);
- iMap->foreachinarea(skill->area_sub,
- src->m,x-i,y-i,x+i,y+i,BL_CHAR,
- src,skill_id,skill_lv,tick,flag|BCT_PARTY|BCT_GUILD|1,
- skill->castend_nodamage_id);
+ map->foreachinarea(skill->area_sub,
+ src->m,x-i,y-i,x+i,y+i,BL_CHAR,
+ src,skill_id,skill_lv,tick,flag|BCT_PARTY|BCT_GUILD|1,
+ skill->castend_nodamage_id);
}
} else {
int i = skill_lv%11 - 1;
@@ -10042,10 +10012,10 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
if(script->potion_hp > 0 || script->potion_sp > 0) {
i = skill->get_splash(skill_id, skill_lv);
- iMap->foreachinarea(skill->area_sub,
- src->m,x-i,y-i,x+i,y+i,BL_CHAR,
- src,skill_id,skill_lv,tick,flag|BCT_PARTY|BCT_GUILD|1,
- skill->castend_nodamage_id);
+ map->foreachinarea(skill->area_sub,
+ src->m,x-i,y-i,x+i,y+i,BL_CHAR,
+ src,skill_id,skill_lv,tick,flag|BCT_PARTY|BCT_GUILD|1,
+ skill->castend_nodamage_id);
}
}
break;
@@ -10055,7 +10025,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
int dummy = 1;
clif->skill_poseffect(src,skill_id,skill_lv,x,y,tick);
i = skill->get_splash(skill_id, skill_lv);
- iMap->foreachinarea(skill->cell_overlap, src->m, x-i, y-i, x+i, y+i, BL_SKILL, HW_GANBANTEIN, &dummy, src);
+ map->foreachinarea(skill->cell_overlap, src->m, x-i, y-i, x+i, y+i, BL_SKILL, HW_GANBANTEIN, &dummy, src);
} else {
if (sd) clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
return 1;
@@ -10071,8 +10041,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
// Plant Cultivation [Celest]
case CR_CULTIVATION:
if (sd) {
- if( iMap->count_oncell(src->m,x,y,BL_CHAR) > 0 )
- {
+ if( map->count_oncell(src->m,x,y,BL_CHAR) > 0 ) {
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
return 1;
}
@@ -10138,14 +10107,14 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
case RK_DRAGONBREATH:
case RK_DRAGONBREATH_WATER:
i = skill->get_splash(skill_id,skill_lv);
- iMap->foreachinarea(skill->area_sub,src->m,x-i,y-i,x+i,y+i,splash_target(src),
- src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id);
+ map->foreachinarea(skill->area_sub,src->m,x-i,y-i,x+i,y+i,splash_target(src),
+ src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id);
break;
case SO_ARRULLO:
i = skill->get_splash(skill_id,skill_lv);
- iMap->foreachinarea(skill->area_sub,src->m,x-i,y-i,x+i,y+i,splash_target(src),
- src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_nodamage_id);
+ map->foreachinarea(skill->area_sub,src->m,x-i,y-i,x+i,y+i,splash_target(src),
+ src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_nodamage_id);
break;
/**
* Guilotine Cross
@@ -10166,13 +10135,13 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
case AB_EPICLESIS:
if( (sg = skill->unitsetting(src, skill_id, skill_lv, x, y, 0)) ) {
i = sg->unit->range;
- iMap->foreachinarea(skill->area_sub, src->m, x - i, y - i, x + i, y + i, BL_CHAR, src, ALL_RESURRECTION, 1, tick, flag|BCT_NOENEMY|1,skill->castend_nodamage_id);
+ map->foreachinarea(skill->area_sub, src->m, x - i, y - i, x + i, y + i, BL_CHAR, src, ALL_RESURRECTION, 1, tick, flag|BCT_NOENEMY|1,skill->castend_nodamage_id);
}
break;
case WL_EARTHSTRAIN:
{
- int i, wave = skill_lv + 4, dir = iMap->calc_dir(src,x,y);
+ int i, wave = skill_lv + 4, dir = map->calc_dir(src,x,y);
int sx = x = src->x, sy = y = src->y; // Store first caster's location to avoid glitch on unit setting
for( i = 1; i <= wave; i++ )
@@ -10192,7 +10161,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
**/
case RA_DETONATOR:
i = skill->get_splash(skill_id, skill_lv);
- iMap->foreachinarea(skill->detonator, src->m, x-i, y-i, x+i, y+i, BL_SKILL, src);
+ map->foreachinarea(skill->detonator, src->m, x-i, y-i, x+i, y+i, BL_SKILL, src);
clif->skill_damage(src, src, tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6);
break;
/**
@@ -10246,10 +10215,10 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
int width;//according to data from irowiki it actually is a square
for( width = 0; width < 7; width++ )
for( i = 0; i < 7; i++ )
- iMap->foreachincell(skill->area_sub, src->m, x-2+i, y-2+width, splash_target(src), src, LG_OVERBRAND_BRANDISH, skill_lv, tick, flag|BCT_ENEMY,skill->castend_damage_id);
+ map->foreachincell(skill->area_sub, src->m, x-2+i, y-2+width, splash_target(src), src, LG_OVERBRAND_BRANDISH, skill_lv, tick, flag|BCT_ENEMY,skill->castend_damage_id);
for( width = 0; width < 7; width++ )
for( i = 0; i < 7; i++ )
- iMap->foreachincell(skill->area_sub, src->m, x-2+i, y-2+width, splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY,skill->castend_damage_id);
+ map->foreachincell(skill->area_sub, src->m, x-2+i, y-2+width, splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY,skill->castend_damage_id);
}
break;
@@ -10266,7 +10235,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
case LG_RAYOFGENESIS:
if( status->charge(src,status_get_max_hp(src)*3*skill_lv / 100,0) ) {
i = skill->get_splash(skill_id,skill_lv);
- iMap->foreachinarea(skill->area_sub,src->m,x-i,y-i,x+i,y+i,splash_target(src),
+ map->foreachinarea(skill->area_sub,src->m,x-i,y-i,x+i,y+i,splash_target(src),
src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id);
} else if( sd )
clif->skill_fail(sd,skill_id,USESKILL_FAIL,0);
@@ -10274,13 +10243,13 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
case WM_DOMINION_IMPULSE:
i = skill->get_splash(skill_id, skill_lv);
- iMap->foreachinarea( skill->activate_reverberation,
+ map->foreachinarea( skill->activate_reverberation,
src->m, x-i, y-i, x+i,y+i,BL_SKILL);
break;
case WM_GREAT_ECHO:
flag|=1; // Should counsume 1 item per skill usage.
- iMap->foreachinrange(skill->area_sub, src, skill->get_splash(skill_id,skill_lv),splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY, skill->castend_damage_id);
+ map->foreachinrange(skill->area_sub, src, skill->get_splash(skill_id,skill_lv),splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY, skill->castend_damage_id);
break;
case GN_CRAZYWEED: {
int area = skill->get_splash(GN_CRAZYWEED_ATK, skill_lv);
@@ -10312,10 +10281,10 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
clif->changetraplook(&ud->skillunit[i]->unit->bl, UNT_FIRE_EXPANSION_TEAR_GAS);
break;
case 5:
- iMap->foreachinarea(skill->area_sub, src->m,
- ud->skillunit[i]->unit->bl.x - 3, ud->skillunit[i]->unit->bl.y - 3,
- ud->skillunit[i]->unit->bl.x + 3, ud->skillunit[i]->unit->bl.y + 3, BL_CHAR,
- src, CR_ACIDDEMONSTRATION, sd ? pc->checkskill(sd, CR_ACIDDEMONSTRATION) : skill_lv, tick, flag|BCT_ENEMY|1|SD_LEVEL, skill->castend_damage_id);
+ map->foreachinarea(skill->area_sub, src->m,
+ ud->skillunit[i]->unit->bl.x - 3, ud->skillunit[i]->unit->bl.y - 3,
+ ud->skillunit[i]->unit->bl.x + 3, ud->skillunit[i]->unit->bl.y + 3, BL_CHAR,
+ src, CR_ACIDDEMONSTRATION, sd ? pc->checkskill(sd, CR_ACIDDEMONSTRATION) : skill_lv, tick, flag|BCT_ENEMY|1|SD_LEVEL, skill->castend_damage_id);
skill->delunit(ud->skillunit[i]->unit);
break;
default:
@@ -10403,7 +10372,7 @@ int skill_dance_overlap(struct skill_unit* su, int flag) {
su->val2 &= ~UF_ENSEMBLE;
}
- return iMap->foreachincell(skill->dance_overlap_sub, su->bl.m,su->bl.x,su->bl.y,BL_SKILL, su,flag);
+ return map->foreachincell(skill->dance_overlap_sub, su->bl.m,su->bl.x,su->bl.y,BL_SKILL, su,flag);
}
/*==========================================
@@ -10466,7 +10435,7 @@ int skill_icewall_block(struct block_list *bl,va_list ap) {
nullpo_ret(bl);
nullpo_ret(md);
- if( !md->target_id || ( target = iMap->id2bl(md->target_id) ) == NULL )
+ if( !md->target_id || ( target = map->id2bl(md->target_id) ) == NULL )
return 0;
if( path->search_long(NULL,bl->m,bl->x,bl->y,target->x,target->y,CELL_CHKICEWALL) )
@@ -10543,7 +10512,7 @@ struct skill_unit_group* skill_unitsetting(struct block_list *src, uint16 skill_
{ //Warp Portal morphing to active mode, extract relevant data from src. [Skotlex]
if( src->type != BL_SKILL ) return NULL;
group = ((TBL_SKILL*)src)->group;
- src = iMap->id2bl(group->src_id);
+ src = map->id2bl(group->src_id);
if( !src ) return NULL;
val2 = group->val2; //Copy the (x,y) position you warp to
val3 = group->val3; //as well as the mapindex to warp to.
@@ -10559,7 +10528,7 @@ struct skill_unit_group* skill_unitsetting(struct block_list *src, uint16 skill_
break;
case WZ_FIREPILLAR:
- if( iMap->getcell(src->m, x, y, CELL_CHKLANDPROTECTOR) )
+ if( map->getcell(src->m, x, y, CELL_CHKLANDPROTECTOR) )
return NULL;
if((flag&1)!=0)
limit=1000;
@@ -10798,8 +10767,8 @@ struct skill_unit_group* skill_unitsetting(struct block_list *src, uint16 skill_
case WM_REVERBERATION:
interval = limit;
val2 = 1;
- case WM_POEMOFNETHERWORLD: // Can't be placed on top of Land Protector.
- if( iMap->getcell(src->m, x, y, CELL_CHKLANDPROTECTOR) )
+ case WM_POEMOFNETHERWORLD: // Can't be placed on top of Land Protector.
+ if( map->getcell(src->m, x, y, CELL_CHKLANDPROTECTOR) )
return NULL;
break;
case SO_CLOUD_KILL:
@@ -10874,7 +10843,7 @@ struct skill_unit_group* skill_unitsetting(struct block_list *src, uint16 skill_
int val2 = 0;
int alive = 1;
- if( !group->state.song_dance && !iMap->getcell(src->m,ux,uy,CELL_CHKREACH) )
+ if( !group->state.song_dance && !map->getcell(src->m,ux,uy,CELL_CHKREACH) )
continue; // don't place skill units on walls (except for songs/dances/encores)
if( battle_config.skill_wall_check && skill->get_unit_flag(skill_id)&UF_PATHCHECK && !path->search_long(NULL,src->m,ux,uy,x,y,CELL_CHKWALL) )
continue; // no path between cell and center of casting.
@@ -10886,7 +10855,7 @@ struct skill_unit_group* skill_unitsetting(struct block_list *src, uint16 skill_
break;
case WZ_ICEWALL:
val1 = (skill_lv <= 1) ? 500 : 200 + 200*skill_lv;
- val2 = iMap->getcell(src->m, ux, uy, CELL_GETTYPE);
+ val2 = map->getcell(src->m, ux, uy, CELL_GETTYPE);
break;
case HT_LANDMINE:
case MA_LANDMINE:
@@ -10938,11 +10907,11 @@ struct skill_unit_group* skill_unitsetting(struct block_list *src, uint16 skill_
if (skill->get_unit_flag(skill_id) & UF_RANGEDSINGLEUNIT && i == (layout->count / 2))
val2 |= UF_RANGEDSINGLEUNIT; // center.
- if( sd && iMap->getcell(src->m, ux, uy, CELL_CHKMAELSTROM) ) //Does not recover SP from monster skills
- iMap->foreachincell(skill->maelstrom_suction,src->m,ux,uy,BL_SKILL,skill_id,skill_lv);
+ if( sd && map->getcell(src->m, ux, uy, CELL_CHKMAELSTROM) ) //Does not recover SP from monster skills
+ map->foreachincell(skill->maelstrom_suction,src->m,ux,uy,BL_SKILL,skill_id,skill_lv);
if( range <= 0 )
- iMap->foreachincell(skill->cell_overlap,src->m,ux,uy,BL_SKILL,skill_id, &alive, src);
+ map->foreachincell(skill->cell_overlap,src->m,ux,uy,BL_SKILL,skill_id, &alive, src);
if( !alive )
continue;
@@ -10958,10 +10927,11 @@ struct skill_unit_group* skill_unitsetting(struct block_list *src, uint16 skill_
// execute on all targets standing on this cell
if (range==0 && active_flag)
- iMap->foreachincell(skill->unit_effect,su->bl.m,su->bl.x,su->bl.y,group->bl_flag,&su->bl,timer->gettick(),1);
+ map->foreachincell(skill->unit_effect,su->bl.m,su->bl.x,su->bl.y,group->bl_flag,&su->bl,timer->gettick(),1);
}
- if (!group->alive_count) { //No cells? Something that was blocked completely by Land Protector?
+ if (!group->alive_count) {
+ //No cells? Something that was blocked completely by Land Protector?
skill->del_unitgroup(group,ALC_MARK);
return NULL;
}
@@ -10969,7 +10939,7 @@ struct skill_unit_group* skill_unitsetting(struct block_list *src, uint16 skill_
//success, unit created.
switch( skill_id ) {
case WZ_ICEWALL:
- iMap->foreachinrange(skill->icewall_block, src, AREA_SIZE, BL_MOB);
+ map->foreachinrange(skill->icewall_block, src, AREA_SIZE, BL_MOB);
break;
case NJ_TATAMIGAESHI: //Store number of tiles.
group->val1 = group->alive_count;
@@ -10997,11 +10967,11 @@ int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, unsigned
return 0;
nullpo_ret(sg=src->group);
- nullpo_ret(ss=iMap->id2bl(sg->src_id));
+ nullpo_ret(ss=map->id2bl(sg->src_id));
- if( skill->get_type(sg->skill_id) == BF_MAGIC && iMap->getcell(bl->m, bl->x, bl->y, CELL_CHKLANDPROTECTOR) && sg->skill_id != SA_LANDPROTECTOR )
+ if( skill->get_type(sg->skill_id) == BF_MAGIC && map->getcell(bl->m, bl->x, bl->y, CELL_CHKLANDPROTECTOR) && sg->skill_id != SA_LANDPROTECTOR )
return 0; //AoE skills are ineffective. [Skotlex]
- if( iMap->getcell(bl->m, bl->x, bl->y, CELL_CHKMAELSTROM) )
+ if( map->getcell(bl->m, bl->x, bl->y, CELL_CHKMAELSTROM) )
return 0;
sc = status->get_sc(bl);
@@ -11023,7 +10993,7 @@ int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, unsigned
const struct TimerData* td = sc->data[type]?timer->get(sc->data[type]->timer):NULL;
if( td )
sec = DIFF_TICK(td->tick, tick);
- iMap->moveblock(bl, src->bl.x, src->bl.y, tick);
+ map->moveblock(bl, src->bl.x, src->bl.y, tick);
clif->fixpos(bl);
sg->val2 = bl->id;
}
@@ -11065,7 +11035,7 @@ int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, unsigned
if( --count <= 0 )
skill->del_unitgroup(sg,ALC_MARK);
- if ( iMap->mapindex2mapid(sg->val3) == sd->bl.m && x == sd->bl.x && y == sd->bl.y )
+ if ( map->mapindex2mapid(sg->val3) == sd->bl.m && x == sd->bl.x && y == sd->bl.y )
working = 1;/* we break it because officials break it, lovely stuff. */
sg->val1 = (count<<16)|working;
@@ -11073,7 +11043,7 @@ int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, unsigned
pc->setpos(sd,m,x,y,CLR_TELEPORT);
}
} else if(bl->type == BL_MOB && battle_config.mob_warp&2) {
- int16 m = iMap->mapindex2mapid(sg->val3);
+ int16 m = map->mapindex2mapid(sg->val3);
if (m < 0) break; //Map not available on this map-server.
unit->warp(bl,m,sg->val2>>16,sg->val2&0xffff,CLR_TELEPORT);
}
@@ -11211,7 +11181,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
return 0;
nullpo_ret(sg=src->group);
- nullpo_ret(ss=iMap->id2bl(sg->src_id));
+ nullpo_ret(ss=map->id2bl(sg->src_id));
tsd = BL_CAST(BL_PC, bl);
tsc = status->get_sc(bl);
@@ -11243,7 +11213,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
ts->tick = tick+sg->interval;
if ((skill_id==CR_GRANDCROSS || skill_id==NPC_GRANDDARKNESS) && !battle_config.gx_allhit)
- ts->tick += sg->interval*(iMap->count_oncell(bl->m,bl->x,bl->y,BL_CHAR)-1);
+ ts->tick += sg->interval*(map->count_oncell(bl->m,bl->x,bl->y,BL_CHAR)-1);
}
switch (sg->unit_id) {
@@ -11419,12 +11389,12 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
if( status_get_mode(bl)&MD_BOSS )
break;
if( status->change_start(bl,type,10000,sg->skill_lv,sg->group_id,0,0,skill->get_time2(sg->skill_id, sg->skill_lv), 8) ) {
- iMap->moveblock(bl, src->bl.x, src->bl.y, tick);
+ map->moveblock(bl, src->bl.x, src->bl.y, tick);
clif->fixpos(bl);
}
- iMap->foreachinrange(skill->trap_splash, &src->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, &src->bl, tick);
+ map->foreachinrange(skill->trap_splash, &src->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, &src->bl, tick);
sg->unit_id = UNT_USED_TRAPS; //Changed ID so it does not invoke a for each in area again.
}
break;
@@ -11455,9 +11425,9 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
case UNT_FIREPILLAR_ACTIVE:
case UNT_CLAYMORETRAP:
if( sg->unit_id == UNT_FIRINGTRAP || sg->unit_id == UNT_ICEBOUNDTRAP || sg->unit_id == UNT_CLAYMORETRAP )
- iMap->foreachinrange(skill->trap_splash,&src->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag|BL_SKILL|~BCT_SELF, &src->bl,tick);
+ map->foreachinrange(skill->trap_splash,&src->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag|BL_SKILL|~BCT_SELF, &src->bl,tick);
else
- iMap->foreachinrange(skill->trap_splash,&src->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, &src->bl,tick);
+ map->foreachinrange(skill->trap_splash,&src->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, &src->bl,tick);
if (sg->unit_id != UNT_FIREPILLAR_ACTIVE)
clif->changetraplook(&src->bl, sg->unit_id==UNT_LANDMINE?UNT_FIREPILLAR_ACTIVE:UNT_USED_TRAPS);
sg->limit=DIFF_TICK(tick,sg->tick)+1500 +
@@ -11644,9 +11614,9 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
case UNT_GROUNDDRIFT_POISON:
case UNT_GROUNDDRIFT_WATER:
case UNT_GROUNDDRIFT_FIRE:
- iMap->foreachinrange(skill->trap_splash,&src->bl,
- skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag,
- &src->bl,tick);
+ map->foreachinrange(skill->trap_splash,&src->bl,
+ skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag,
+ &src->bl,tick);
sg->unit_id = UNT_USED_TRAPS;
//clif->changetraplook(&src->bl, UNT_FIREPILLAR_ACTIVE);
sg->limit=DIFF_TICK(tick,sg->tick)+1500;
@@ -11701,7 +11671,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
case UNT_REVERBERATION:
clif->changetraplook(&src->bl,UNT_USED_TRAPS);
- iMap->foreachinrange(skill->trap_splash,&src->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, &src->bl,tick);
+ map->foreachinrange(skill->trap_splash,&src->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, &src->bl,tick);
sg->limit = DIFF_TICK(tick,sg->tick)+1000;
sg->unit_id = UNT_USED_TRAPS;
break;
@@ -11727,7 +11697,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
const struct TimerData* td = tsc->data[type]?timer->get(tsc->data[type]->timer):NULL;
if( td )
sec = DIFF_TICK(td->tick, tick);
- ///iMap->moveblock(bl, src->bl.x, src->bl.y, tick); // in official server it doesn't behave like this. [malufett]
+ ///map->moveblock(bl, src->bl.x, src->bl.y, tick); // in official server it doesn't behave like this. [malufett]
clif->fixpos(bl);
sg->val2 = bl->id;
} else
@@ -11937,16 +11907,16 @@ int skill_unit_onout (struct skill_unit *src, struct block_list *bl, unsigned in
status_change_end(bl, type, INVALID_TIMER);
break;
- case UNT_SPIDERWEB: {
- struct block_list *target = iMap->id2bl(sg->val2);
- if (target && target==bl)
- {
- if (sce && sce->val3 == sg->group_id)
- status_change_end(bl, type, INVALID_TIMER);
- sg->limit = DIFF_TICK(tick,sg->tick)+1000;
- }
- break;
+ case UNT_SPIDERWEB:
+ {
+ struct block_list *target = map->id2bl(sg->val2);
+ if (target && target==bl) {
+ if (sce && sce->val3 == sg->group_id)
+ status_change_end(bl, type, INVALID_TIMER);
+ sg->limit = DIFF_TICK(tick,sg->tick)+1000;
}
+ }
+ break;
}
return sg->skill_id;
}
@@ -12168,7 +12138,7 @@ int skill_check_condition_char_sub (struct block_list *bl, va_list ap) {
switch(skill_id) {
case PR_BENEDICTIO: {
- uint8 dir = iMap->calc_dir(&sd->bl,tsd->bl.x,tsd->bl.y);
+ uint8 dir = map->calc_dir(&sd->bl,tsd->bl.x,tsd->bl.y);
dir = (unit->getdir(&sd->bl) + dir)%8; //This adjusts dir to account for the direction the sd is facing.
if ((tsd->class_&MAPID_BASEMASK) == MAPID_ACOLYTE && (dir == 2 || dir == 6) //Must be standing to the left/right of Priest.
&& sd->status.sp >= 10)
@@ -12233,26 +12203,26 @@ int skill_check_pc_partner (struct map_session_data *sd, uint16 skill_id, uint16
switch (skill_id) {
case PR_BENEDICTIO:
for (i = 0; i < c; i++) {
- if ((tsd = iMap->id2sd(p_sd[i])) != NULL)
+ if ((tsd = map->id2sd(p_sd[i])) != NULL)
status->charge(&tsd->bl, 0, 10);
}
return c;
case AB_ADORAMUS:
- if( c > 0 && (tsd = iMap->id2sd(p_sd[0])) != NULL ) {
+ if( c > 0 && (tsd = map->id2sd(p_sd[0])) != NULL ) {
i = 2 * (*skill_lv);
status->charge(&tsd->bl, 0, i);
}
break;
case WM_GREAT_ECHO:
for( i = 0; i < c; i++ ) {
- if( (tsd = iMap->id2sd(p_sd[i])) != NULL )
+ if( (tsd = map->id2sd(p_sd[i])) != NULL )
status_zap(&tsd->bl,0,skill->get_sp(skill_id,*skill_lv)/c);
}
break;
default: //Warning: Assuming Ensemble skills here (for speed)
if( is_chorus )
break;//Chorus skills are not to be parsed as ensambles
- if (c > 0 && sd->sc.data[SC_DANCING] && (tsd = iMap->id2sd(p_sd[0])) != NULL) {
+ if (c > 0 && sd->sc.data[SC_DANCING] && (tsd = map->id2sd(p_sd[0])) != NULL) {
sd->sc.data[SC_DANCING]->val4 = tsd->bl.id;
sc_start4(&tsd->bl,SC_DANCING,100,skill_id,sd->sc.data[SC_DANCING]->val2,*skill_lv,sd->bl.id,skill->get_time(skill_id,*skill_lv)+1000);
clif->skill_nodamage(&tsd->bl, &sd->bl, skill_id, *skill_lv, 1);
@@ -12269,7 +12239,7 @@ int skill_check_pc_partner (struct map_session_data *sd, uint16 skill_id, uint16
if( is_chorus )
i = party_foreachsamemap(skill->check_condition_char_sub,sd,AREA_SIZE,&sd->bl, &c, &p_sd, skill_id, *skill_lv);
else
- i = iMap->foreachinrange(skill->check_condition_char_sub, &sd->bl, range, BL_PC, &sd->bl, &c, &p_sd, skill_id);
+ i = map->foreachinrange(skill->check_condition_char_sub, &sd->bl, range, BL_PC, &sd->bl, &c, &p_sd, skill_id);
if ( skill_id != PR_BENEDICTIO && skill_id != AB_ADORAMUS && skill_id != WL_COMET ) //Apply the average lv to encore skills.
*skill_lv = (i+(*skill_lv))/(c+1); //I know c should be one, but this shows how it could be used for the average of n partners.
@@ -12656,7 +12626,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id
for (i=0;i<size*size;i++) {
x = sd->bl.x+(i%size-range);
y = sd->bl.y+(i/size-range);
- if (iMap->getcell(sd->bl.m,x,y,CELL_CHKWALL)) {
+ if (map->getcell(sd->bl.m,x,y,CELL_CHKWALL)) {
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
return 0;
}
@@ -12947,13 +12917,13 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id
break;
case SR_CURSEDCIRCLE:
if (map_flag_gvg2(sd->bl.m)) {
- if (iMap->foreachinrange(mob->count_sub, &sd->bl, skill->get_splash(skill_id, skill_lv), BL_MOB,
- MOBID_EMPERIUM, MOBID_GUARIDAN_STONE1, MOBID_GUARIDAN_STONE2)) {
- char output[128];
- sprintf(output, "You're too close to a stone or emperium to do this skill");
- clif->colormes(sd->fd, COLOR_RED, output);
- return 0;
- }
+ if (map->foreachinrange(mob->count_sub, &sd->bl, skill->get_splash(skill_id, skill_lv), BL_MOB,
+ MOBID_EMPERIUM, MOBID_GUARIDAN_STONE1, MOBID_GUARIDAN_STONE2)) {
+ char output[128];
+ sprintf(output, "You're too close to a stone or emperium to do this skill");
+ clif->colormes(sd->fd, COLOR_RED, output);
+ return 0;
+ }
}
if( sd->spiritball > 0 )
sd->spiritball_old = require.spiritball = sd->spiritball;
@@ -13110,7 +13080,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id
case ST_WATER:
if (sc && (sc->data[SC_DELUGE] || sc->data[SC_NJ_SUITON]))
break;
- if (iMap->getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKWATER))
+ if (map->getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKWATER))
break;
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
return 0;
@@ -13291,10 +13261,11 @@ int skill_check_condition_castend(struct map_session_data* sd, uint16 skill_id,
int maxcount = (skill_id==AM_CANNIBALIZE)? 6-skill_lv : skill->get_maxcount(skill_id,skill_lv);
int mob_class = (skill_id==AM_CANNIBALIZE)? summons[skill_lv-1] :1142;
if(battle_config.land_skill_limit && maxcount>0 && (battle_config.land_skill_limit&BL_PC)) {
- i = iMap->foreachinmap(skill->check_condition_mob_master_sub ,sd->bl.m, BL_MOB, sd->bl.id, mob_class, skill_id, &c);
- if(c >= maxcount ||
- (skill_id==AM_CANNIBALIZE && c != i && battle_config.summon_flora&2))
- { //Fails when: exceed max limit. There are other plant types already out.
+ i = map->foreachinmap(skill->check_condition_mob_master_sub ,sd->bl.m, BL_MOB, sd->bl.id, mob_class, skill_id, &c);
+ if( c >= maxcount
+ || (skill_id==AM_CANNIBALIZE && c != i && battle_config.summon_flora&2)
+ ) {
+ //Fails when: exceed max limit. There are other plant types already out.
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
return 0;
}
@@ -13312,9 +13283,9 @@ int skill_check_condition_castend(struct map_session_data* sd, uint16 skill_id,
if( battle_config.land_skill_limit && maxcount > 0 && ( battle_config.land_skill_limit&BL_PC ) ) {
if( skill_id == NC_MAGICDECOY ) {
for( j = mob_class; j <= 2046; j++ )
- iMap->foreachinmap(skill->check_condition_mob_master_sub, sd->bl.m, BL_MOB, sd->bl.id, j, skill_id, &c);
+ map->foreachinmap(skill->check_condition_mob_master_sub, sd->bl.m, BL_MOB, sd->bl.id, j, skill_id, &c);
} else
- iMap->foreachinmap(skill->check_condition_mob_master_sub, sd->bl.m, BL_MOB, sd->bl.id, mob_class, skill_id, &c);
+ map->foreachinmap(skill->check_condition_mob_master_sub, sd->bl.m, BL_MOB, sd->bl.id, mob_class, skill_id, &c);
if( c >= maxcount ) {
clif->skill_fail(sd , skill_id, USESKILL_FAIL_LEVEL, 0);
return 0;
@@ -13324,7 +13295,7 @@ int skill_check_condition_castend(struct map_session_data* sd, uint16 skill_id,
break;
case KO_ZANZOU: {
int c = 0;
- i = iMap->foreachinmap(skill->check_condition_mob_master_sub, sd->bl.m, BL_MOB, sd->bl.id, 2308, skill_id, &c);
+ i = map->foreachinmap(skill->check_condition_mob_master_sub, sd->bl.m, BL_MOB, sd->bl.id, 2308, skill_id, &c);
if( c >= skill->get_maxcount(skill_id,skill_lv) || c != i) {
clif->skill_fail(sd , skill_id, USESKILL_FAIL_LEVEL, 0);
return 0;
@@ -14208,7 +14179,7 @@ void skill_brandishspear_dir (struct square* tc, uint8 dir, int are) {
void skill_brandishspear(struct block_list* src, struct block_list* bl, uint16 skill_id, uint16 skill_lv, unsigned int tick, int flag)
{
int c,n=4;
- uint8 dir = iMap->calc_dir(src,bl->x,bl->y);
+ uint8 dir = map->calc_dir(src,bl->x,bl->y);
struct square tc;
int x=bl->x,y=bl->y;
skill->brandishspear_first(&tc,dir,x,y);
@@ -14217,10 +14188,10 @@ void skill_brandishspear(struct block_list* src, struct block_list* bl, uint16 s
if(skill_lv > 9){
for(c=1;c<4;c++){
- iMap->foreachincell(skill->area_sub,
- bl->m,tc.val1[c],tc.val2[c],BL_CHAR,
- src,skill_id,skill_lv,tick, flag|BCT_ENEMY|n,
- skill->castend_damage_id);
+ map->foreachincell(skill->area_sub,
+ bl->m,tc.val1[c],tc.val2[c],BL_CHAR,
+ src,skill_id,skill_lv,tick, flag|BCT_ENEMY|n,
+ skill->castend_damage_id);
}
}
if(skill_lv > 6){
@@ -14233,11 +14204,11 @@ void skill_brandishspear(struct block_list* src, struct block_list* bl, uint16 s
if(skill_lv > 3){
for(c=0;c<5;c++){
- iMap->foreachincell(skill->area_sub,
- bl->m,tc.val1[c],tc.val2[c],BL_CHAR,
- src,skill_id,skill_lv,tick, flag|BCT_ENEMY|n,
- skill->castend_damage_id);
- if(skill_lv > 6 && n==3 && c==4){
+ map->foreachincell(skill->area_sub,
+ bl->m,tc.val1[c],tc.val2[c],BL_CHAR,
+ src,skill_id,skill_lv,tick, flag|BCT_ENEMY|n,
+ skill->castend_damage_id);
+ if(skill_lv > 6 && n==3 && c==4) {
skill_brandishspear_dir(&tc,dir,-1);
n--;c=-1;
}
@@ -14245,7 +14216,7 @@ void skill_brandishspear(struct block_list* src, struct block_list* bl, uint16 s
}
for(c=0;c<10;c++){
if(c==0||c==5) skill->brandishspear_dir(&tc,dir,-1);
- iMap->foreachincell(skill->area_sub,
+ map->foreachincell(skill->area_sub,
bl->m,tc.val1[c%5],tc.val2[c%5],BL_CHAR,
src,skill_id,skill_lv,tick, flag|BCT_ENEMY|1,
skill->castend_damage_id);
@@ -14263,7 +14234,7 @@ void skill_repairweapon (struct map_session_data *sd, int idx) {
nullpo_retv(sd);
- if ( !( target_sd = iMap->id2sd(sd->menuskill_val) ) ) //Failed....
+ if ( !( target_sd = map->id2sd(sd->menuskill_val) ) ) //Failed....
return;
if( idx == 0xFFFF ) // No item selected ('Cancel' clicked)
@@ -14531,11 +14502,11 @@ int skill_sit (struct map_session_data *sd, int type)
if (!flag) return 0;
if(type) {
- if (iMap->foreachinrange(skill->sit_count,&sd->bl, range, BL_PC, flag) > 1)
- iMap->foreachinrange(skill->sit_in,&sd->bl, range, BL_PC, flag);
+ if (map->foreachinrange(skill->sit_count,&sd->bl, range, BL_PC, flag) > 1)
+ map->foreachinrange(skill->sit_in,&sd->bl, range, BL_PC, flag);
} else {
- if (iMap->foreachinrange(skill->sit_count,&sd->bl, range, BL_PC, flag) < 2)
- iMap->foreachinrange(skill->sit_out,&sd->bl, range, BL_PC, flag);
+ if (map->foreachinrange(skill->sit_count,&sd->bl, range, BL_PC, flag) < 2)
+ map->foreachinrange(skill->sit_out,&sd->bl, range, BL_PC, flag);
}
return 0;
}
@@ -14751,11 +14722,11 @@ int skill_detonator(struct block_list *bl, va_list ap) {
case UNT_CLAYMORETRAP:
case UNT_FIRINGTRAP:
case UNT_ICEBOUNDTRAP:
- iMap->foreachinrange(skill->trap_splash,bl,skill->get_splash(su->group->skill_id,su->group->skill_lv),su->group->bl_flag|BL_SKILL|~BCT_SELF,bl,su->group->tick);
+ map->foreachinrange(skill->trap_splash,bl,skill->get_splash(su->group->skill_id,su->group->skill_lv),su->group->bl_flag|BL_SKILL|~BCT_SELF,bl,su->group->tick);
break;
default:
- iMap->foreachinrange(skill->trap_splash,bl,skill->get_splash(su->group->skill_id,su->group->skill_lv),su->group->bl_flag,bl,su->group->tick);
- }
+ map->foreachinrange(skill->trap_splash,bl,skill->get_splash(su->group->skill_id,su->group->skill_lv),su->group->bl_flag,bl,su->group->tick);
+ }
clif->changetraplook(bl, UNT_USED_TRAPS);
su->group->limit = DIFF_TICK(timer->gettick(),su->group->tick) +
(unit_id == UNT_TALKIEBOX ? 5000 : (unit_id == UNT_CLUSTERBOMB || unit_id == UNT_ICEBOUNDTRAP? 2500 : (unit_id == UNT_FIRINGTRAP ? 0 : 1500)) );
@@ -14908,7 +14879,7 @@ int skill_trap_splash (struct block_list *bl, va_list ap) {
return 0;
nullpo_ret(sg = su->group);
- nullpo_ret(ss = iMap->id2bl(sg->src_id));
+ nullpo_ret(ss = map->id2bl(sg->src_id));
if(battle->check_target(src,bl,sg->target_flag) <= 0)
return 0;
@@ -15008,7 +14979,7 @@ int skill_maelstrom_suction(struct block_list *bl, va_list ap) {
if( su->group->skill_id == SC_MAELSTROM ) {
struct block_list *src;
- if( (src = iMap->id2bl(su->group->src_id)) ) {
+ if( (src = map->id2bl(su->group->src_id)) ) {
int sp = su->group->skill_lv * skill_lv;
if( src->type == BL_PC )
sp += ((TBL_PC*)src)->status.job_level / 5;
@@ -15045,10 +15016,11 @@ bool skill_check_cloaking(struct block_list *bl, struct status_change_entry *sce
bool wall = true;
if( (bl->type == BL_PC && battle_config.pc_cloak_check_type&1)
- || (bl->type != BL_PC && battle_config.monster_cloak_check_type&1) )
- { //Check for walls.
+ || (bl->type != BL_PC && battle_config.monster_cloak_check_type&1)
+ ) {
+ //Check for walls.
int i;
- ARR_FIND( 0, 8, i, iMap->getcell(bl->m, bl->x+dx[i], bl->y+dy[i], CELL_CHKNOPASS) != 0 );
+ ARR_FIND( 0, 8, i, map->getcell(bl->m, bl->x+dx[i], bl->y+dy[i], CELL_CHKNOPASS) != 0 );
if( i == 8 )
wall = false;
}
@@ -15079,7 +15051,7 @@ bool skill_check_camouflage(struct block_list *bl, struct status_change_entry *s
if( bl->type == BL_PC ) { //Check for walls.
int i;
- ARR_FIND( 0, 8, i, iMap->getcell(bl->m, bl->x+dx[i], bl->y+dy[i], CELL_CHKNOPASS) != 0 );
+ ARR_FIND( 0, 8, i, map->getcell(bl->m, bl->x+dx[i], bl->y+dy[i], CELL_CHKNOPASS) != 0 );
if( i == 8 )
wall = false;
}
@@ -15108,13 +15080,13 @@ struct skill_unit *skill_initunit (struct skill_unit_group *group, int idx, int
nullpo_retr(NULL, group->unit); // crash-protection against poor coding
nullpo_retr(NULL, su=&group->unit[idx]);
- if( iMap->getcell(iMap->id2bl(group->src_id)->m, x, y, CELL_CHKMAELSTROM) )
+ if( map->getcell(map->id2bl(group->src_id)->m, x, y, CELL_CHKMAELSTROM) )
return su;
if(!su->alive)
group->alive_count++;
- su->bl.id=iMap->get_new_object_id();
+ su->bl.id=map->get_new_object_id();
su->bl.type=BL_SKILL;
su->bl.m=group->map;
su->bl.x=x;
@@ -15125,13 +15097,13 @@ struct skill_unit *skill_initunit (struct skill_unit_group *group, int idx, int
su->val2=val2;
idb_put(skillunit_db, su->bl.id, su);
- iMap->addiddb(&su->bl);
- iMap->addblock(&su->bl);
+ map->addiddb(&su->bl);
+ map->addblock(&su->bl);
// perform oninit actions
switch (group->skill_id) {
case WZ_ICEWALL:
- iMap->setgatcell(su->bl.m,su->bl.x,su->bl.y,5);
+ map->setgatcell(su->bl.m,su->bl.x,su->bl.y,5);
clif->changemapcell(0,su->bl.m,su->bl.x,su->bl.y,5,AREA);
skill->unitsetmapcell(su,WZ_ICEWALL,group->skill_lv,CELL_ICEWALL,true);
maplist[su->bl.m].icewall_num++;
@@ -15174,18 +15146,19 @@ int skill_delunit (struct skill_unit* su) {
// invoke onout event
if( !su->range )
- iMap->foreachincell(skill->unit_effect,su->bl.m,su->bl.x,su->bl.y,group->bl_flag,&su->bl,timer->gettick(),4);
+ map->foreachincell(skill->unit_effect,su->bl.m,su->bl.x,su->bl.y,group->bl_flag,&su->bl,timer->gettick(),4);
// perform ondelete actions
switch (group->skill_id) {
- case HT_ANKLESNARE: {
- struct block_list* target = iMap->id2bl(group->val2);
- if( target )
- status_change_end(target, SC_ANKLESNARE, INVALID_TIMER);
- }
+ case HT_ANKLESNARE:
+ {
+ struct block_list* target = map->id2bl(group->val2);
+ if( target )
+ status_change_end(target, SC_ANKLESNARE, INVALID_TIMER);
+ }
break;
case WZ_ICEWALL:
- iMap->setgatcell(su->bl.m,su->bl.x,su->bl.y,su->val2);
+ map->setgatcell(su->bl.m,su->bl.x,su->bl.y,su->val2);
clif->changemapcell(0,su->bl.m,su->bl.x,su->bl.y,su->val2,ALL_SAMEMAP); // hack to avoid clientside cell bug
skill->unitsetmapcell(su,WZ_ICEWALL,group->skill_lv,CELL_ICEWALL,false);
maplist[su->bl.m].icewall_num--;
@@ -15197,7 +15170,7 @@ int skill_delunit (struct skill_unit* su) {
skill->unitsetmapcell(su,HP_BASILICA,group->skill_lv,CELL_BASILICA,false);
break;
case RA_ELECTRICSHOCKER: {
- struct block_list* target = iMap->id2bl(group->val2);
+ struct block_list* target = map->id2bl(group->val2);
if( target )
status_change_end(target, SC_ELECTRICSHOCKER, INVALID_TIMER);
}
@@ -15207,7 +15180,7 @@ int skill_delunit (struct skill_unit* su) {
break;
case SC_MANHOLE: // Note : Removing the unit don't remove the status (official info)
if( group->val2 ) { // Someone Traped
- struct status_change *tsc = status->get_sc( iMap->id2bl(group->val2));
+ struct status_change *tsc = status->get_sc(map->id2bl(group->val2));
if( tsc && tsc->data[SC__MANHOLE] )
tsc->data[SC__MANHOLE]->val4 = 0; // Remove the Unit ID
}
@@ -15217,8 +15190,8 @@ int skill_delunit (struct skill_unit* su) {
clif->skill_delunit(su);
su->group=NULL;
- iMap->delblock(&su->bl); // don't free yet
- iMap->deliddb(&su->bl);
+ map->delblock(&su->bl); // don't free yet
+ map->deliddb(&su->bl);
idb_remove(skillunit_db, su->bl.id);
if(--group->alive_count==0)
skill->del_unitgroup(group,ALC_MARK);
@@ -15320,19 +15293,17 @@ struct skill_unit_group* skill_initunitgroup (struct block_list* src, int count,
/*==========================================
*
*------------------------------------------*/
-int skill_delunitgroup(struct skill_unit_group *group, const char* file, int line, const char* func)
-{
+int skill_delunitgroup(struct skill_unit_group *group, const char* file, int line, const char* func) {
struct block_list* src;
struct unit_data *ud;
int i,j;
- if( group == NULL )
- {
+ if( group == NULL ) {
ShowDebug("skill_delunitgroup: group is NULL (source=%s:%d, %s)! Please report this! (#3504)\n", file, line, func);
return 0;
}
- src=iMap->id2bl(group->src_id);
+ src=map->id2bl(group->src_id);
ud = unit->bl2ud(src);
if(!src || !ud) {
ShowError("skill_delunitgroup: Group's source not found! (src_id: %d skill_id: %d)\n", group->src_id, group->skill_id);
@@ -15433,7 +15404,7 @@ int skill_delunitgroup(struct skill_unit_group *group, const char* file, int lin
}
idb_remove(group_db, group->group_id);
- iMap->freeblock(&group->unit->bl); // schedules deallocation of whole array (HACK)
+ map->freeblock(&group->unit->bl); // schedules deallocation of whole array (HACK)
group->unit=NULL;
group->group_id=0;
group->unit_count=0;
@@ -15519,7 +15490,7 @@ int skill_unit_timer_sub_onplace (struct block_list* bl, va_list ap) {
nullpo_ret(group);
- if( !(skill->get_inf2(group->skill_id)&(INF2_SONG_DANCE|INF2_TRAP|INF2_NOLP)) && iMap->getcell(bl->m, bl->x, bl->y, CELL_CHKLANDPROTECTOR) )
+ if( !(skill->get_inf2(group->skill_id)&(INF2_SONG_DANCE|INF2_TRAP|INF2_NOLP)) && map->getcell(bl->m, bl->x, bl->y, CELL_CHKLANDPROTECTOR) )
return 0; //AoE skills are ineffective. [Skotlex]
if( battle->check_target(&su->bl,bl,group->target_flag) <= 0 )
@@ -15591,13 +15562,13 @@ int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) {
{
struct block_list* src;
- if( su->val1 > 0 && (src = iMap->id2bl(group->src_id)) != NULL && src->type == BL_PC ) {
+ if( su->val1 > 0 && (src = map->id2bl(group->src_id)) != NULL && src->type == BL_PC ) {
// revert unit back into a trap
struct item item_tmp;
memset(&item_tmp,0,sizeof(item_tmp));
item_tmp.nameid = group->item_id?group->item_id:ITEMID_TRAP;
item_tmp.identify = 1;
- iMap->addflooritem(&item_tmp,1,bl->m,bl->x,bl->y,0,0,0,0);
+ map->addflooritem(&item_tmp,1,bl->m,bl->x,bl->y,0,0,0,0);
}
skill->delunit(su);
}
@@ -15611,20 +15582,20 @@ int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) {
group->limit = skill->get_time(group->skill_id,group->skill_lv);
su->limit = skill->get_time(group->skill_id,group->skill_lv);
// apply effect to all units standing on it
- iMap->foreachincell(skill->unit_effect,su->bl.m,su->bl.x,su->bl.y,group->bl_flag,&su->bl,timer->gettick(),1);
+ map->foreachincell(skill->unit_effect,su->bl.m,su->bl.x,su->bl.y,group->bl_flag,&su->bl,timer->gettick(),1);
break;
case UNT_CALLFAMILY:
{
struct map_session_data *sd = NULL;
if(group->val1) {
- sd = iMap->charid2sd(group->val1);
+ sd = map->charid2sd(group->val1);
group->val1 = 0;
if (sd && !maplist[sd->bl.m].flag.nowarp)
pc->setpos(sd,map_id2index(su->bl.m),su->bl.x,su->bl.y,CLR_TELEPORT);
}
if(group->val2) {
- sd = iMap->charid2sd(group->val2);
+ sd = map->charid2sd(group->val2);
group->val2 = 0;
if (sd && !maplist[sd->bl.m].flag.nowarp)
pc->setpos(sd,map_id2index(su->bl.m),su->bl.x,su->bl.y,CLR_TELEPORT);
@@ -15639,23 +15610,23 @@ int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) {
break;
}
clif->changetraplook(bl,UNT_USED_TRAPS);
- iMap->foreachinrange(skill->trap_splash, bl, skill->get_splash(group->skill_id, group->skill_lv), group->bl_flag, bl, tick);
+ map->foreachinrange(skill->trap_splash, bl, skill->get_splash(group->skill_id, group->skill_lv), group->bl_flag, bl, tick);
group->limit = DIFF_TICK(tick,group->tick)+1000;
su->limit = DIFF_TICK(tick,group->tick)+1000;
group->unit_id = UNT_USED_TRAPS;
break;
case UNT_FEINTBOMB: {
- struct block_list *src = iMap->id2bl(group->src_id);
+ struct block_list *src = map->id2bl(group->src_id);
if( src )
- iMap->foreachinrange(skill->area_sub, &group->unit->bl, su->range, splash_target(src), src, SC_FEINTBOMB, group->skill_lv, tick, BCT_ENEMY|SD_ANIMATION|1, skill->castend_damage_id);
+ map->foreachinrange(skill->area_sub, &group->unit->bl, su->range, splash_target(src), src, SC_FEINTBOMB, group->skill_lv, tick, BCT_ENEMY|SD_ANIMATION|1, skill->castend_damage_id);
skill->delunit(su);
break;
}
case UNT_BANDING:
{
- struct block_list *src = iMap->id2bl(group->src_id);
+ struct block_list *src = map->id2bl(group->src_id);
struct status_change *sc;
if( !src || (sc = status->get_sc(src)) == NULL || !sc->data[SC_BANDING] ) {
skill->delunit(su);
@@ -15701,7 +15672,7 @@ int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) {
case UNT_REVERBERATION:
if( su->val1 <= 0 ) {
clif->changetraplook(bl,UNT_USED_TRAPS);
- iMap->foreachinrange(skill->trap_splash, bl, skill->get_splash(group->skill_id, group->skill_lv), group->bl_flag, bl, tick);
+ map->foreachinrange(skill->trap_splash, bl, skill->get_splash(group->skill_id, group->skill_lv), group->bl_flag, bl, tick);
group->limit = DIFF_TICK(tick,group->tick)+1000;
su->limit = DIFF_TICK(tick,group->tick)+1000;
group->unit_id = UNT_USED_TRAPS;
@@ -15724,9 +15695,9 @@ int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) {
if( su->range >= 0 && group->interval != -1 ) {
if( battle_config.skill_wall_check )
- iMap->foreachinshootrange(skill->unit_timer_sub_onplace, bl, su->range, group->bl_flag, bl,tick);
+ map->foreachinshootrange(skill->unit_timer_sub_onplace, bl, su->range, group->bl_flag, bl,tick);
else
- iMap->foreachinrange(skill->unit_timer_sub_onplace, bl, su->range, group->bl_flag, bl,tick);
+ map->foreachinrange(skill->unit_timer_sub_onplace, bl, su->range, group->bl_flag, bl,tick);
if(su->range == -1) //Unit disabled, but it should not be deleted yet.
group->unit_id = UNT_USED_TRAPS;
@@ -15748,11 +15719,11 @@ int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) {
* Executes on all skill units every SKILLUNITTIMER_INTERVAL miliseconds.
*------------------------------------------*/
int skill_unit_timer(int tid, unsigned int tick, int id, intptr_t data) {
- iMap->freeblock_lock();
+ map->freeblock_lock();
skillunit_db->foreach(skillunit_db, skill->unit_timer_sub, tick);
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return 0;
}
@@ -15868,7 +15839,7 @@ int skill_unit_move (struct block_list *bl, unsigned int tick, int flag) {
memset(skill_unit_temp, 0, sizeof(skill_unit_temp));
}
- iMap->foreachincell(skill->unit_move_sub,bl->m,bl->x,bl->y,BL_SKILL,bl,tick,flag);
+ map->foreachincell(skill->unit_move_sub,bl->m,bl->x,bl->y,BL_SKILL,bl,tick,flag);
if( flag&2 && flag&1 ) { //Onplace, check any skill units you have left.
int i;
@@ -15934,13 +15905,13 @@ int skill_unit_move_unit_group (struct skill_unit_group *group, int16 m, int16 d
if (!(m_flag[i]&0x2)) {
if (group->state.song_dance&0x1) //Cancel dissonance effect.
skill->dance_overlap(su1, 0);
- iMap->foreachincell(skill->unit_effect,su1->bl.m,su1->bl.x,su1->bl.y,group->bl_flag,&su1->bl,tick,4);
+ map->foreachincell(skill->unit_effect,su1->bl.m,su1->bl.x,su1->bl.y,group->bl_flag,&su1->bl,tick,4);
}
//Move Cell using "smart" criteria (avoid useless moving around)
switch(m_flag[i]) {
case 0:
//Cell moves independently, safely move it.
- iMap->moveblock(&su1->bl, su1->bl.x+dx, su1->bl.y+dy, tick);
+ map->moveblock(&su1->bl, su1->bl.x+dx, su1->bl.y+dy, tick);
break;
case 1:
//Cell moves unto another cell, look for a replacement cell that won't collide
@@ -15950,7 +15921,7 @@ int skill_unit_move_unit_group (struct skill_unit_group *group, int16 m, int16 d
continue;
//Move to where this cell would had moved.
su2 = &group->unit[j];
- iMap->moveblock(&su1->bl, su2->bl.x+dx, su2->bl.y+dy, tick);
+ map->moveblock(&su1->bl, su2->bl.x+dx, su2->bl.y+dy, tick);
j++; //Skip this cell as we have used it.
break;
}
@@ -15963,7 +15934,7 @@ int skill_unit_move_unit_group (struct skill_unit_group *group, int16 m, int16 d
if (group->state.song_dance&0x1) //Check for dissonance effect.
skill->dance_overlap(su1, 1);
clif->skill_setunit(su1);
- iMap->foreachincell(skill->unit_effect,su1->bl.m,su1->bl.x,su1->bl.y,group->bl_flag,&su1->bl,tick,1);
+ map->foreachincell(skill->unit_effect,su1->bl.m,su1->bl.x,su1->bl.y,group->bl_flag,&su1->bl,tick,1);
}
}
aFree(m_flag);
@@ -16529,7 +16500,7 @@ int skill_produce_mix(struct map_session_data *sd, uint16 skill_id, int nameid,
tmp_item.amount = qty * skill_changematerial_db[i].qty[j];
if((flag = pc->additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_PRODUCE))) {
clif->additem(sd,0,0,flag);
- iMap->addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ map->addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
k++;
}
@@ -16543,7 +16514,7 @@ int skill_produce_mix(struct map_session_data *sd, uint16 skill_id, int nameid,
} else if (tmp_item.amount) { //Success
if((flag = pc->additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_PRODUCE))) {
clif->additem(sd,0,0,flag);
- iMap->addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ map->addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
if( skill_id == GN_MIX_COOKING || skill_id == GN_MAKEBOMB || skill_id == GN_S_PHARMACY )
clif->msg_skill(sd,skill_id,0x627);
@@ -16595,7 +16566,7 @@ int skill_produce_mix(struct map_session_data *sd, uint16 skill_id, int nameid,
tmp_item.identify = 1;
if( pc->additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_PRODUCE) ) {
clif->additem(sd,0,0,flag);
- iMap->addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ map->addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
clif->msg_skill(sd,skill_id,0x628);
}
@@ -16652,7 +16623,7 @@ int skill_arrow_create (struct map_session_data *sd, int nameid)
continue;
if((flag = pc->additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_PRODUCE))) {
clif->additem(sd,0,0,flag);
- iMap->addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ map->addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
}
@@ -16880,7 +16851,7 @@ int skill_elementalanalysis(struct map_session_data* sd, int n, uint16 skill_lv,
if( tmp_item.amount ) {
if( (flag = pc->additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_CONSUME)) ) {
clif->additem(sd,0,0,flag);
- iMap->addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ map->addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
}
@@ -16951,7 +16922,7 @@ int skill_destroy_trap( struct block_list *bl, va_list ap ) {
case UNT_CLAYMORETRAP:
case UNT_FIRINGTRAP:
case UNT_ICEBOUNDTRAP:
- iMap->foreachinrange(skill->trap_splash,&su->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag|BL_SKILL|~BCT_SELF, &su->bl,tick);
+ map->foreachinrange(skill->trap_splash,&su->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag|BL_SKILL|~BCT_SELF, &su->bl,tick);
break;
case UNT_LANDMINE:
case UNT_BLASTMINE:
@@ -16960,7 +16931,7 @@ int skill_destroy_trap( struct block_list *bl, va_list ap ) {
case UNT_FLASHER:
case UNT_FREEZINGTRAP:
case UNT_CLUSTERBOMB:
- iMap->foreachinrange(skill->trap_splash,&su->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, &su->bl,tick);
+ map->foreachinrange(skill->trap_splash,&su->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, &su->bl,tick);
break;
}
// Traps aren't recovered.
@@ -16972,7 +16943,7 @@ int skill_destroy_trap( struct block_list *bl, va_list ap ) {
*
*------------------------------------------*/
int skill_blockpc_end(int tid, unsigned int tick, int id, intptr_t data) {
- struct map_session_data *sd = iMap->id2sd(id);
+ struct map_session_data *sd = map->id2sd(id);
struct skill_cd * cd = NULL;
if (data <= 0 || data >= MAX_SKILL)
@@ -17081,7 +17052,7 @@ int skill_blockpc_start_(struct map_session_data *sd, uint16 skill_id, int tick,
}
int skill_blockhomun_end(int tid, unsigned int tick, int id, intptr_t data) { //[orn]
- struct homun_data *hd = (TBL_HOM*) iMap->id2bl(id);
+ struct homun_data *hd = (TBL_HOM*)map->id2bl(id);
if (data <= 0 || data >= MAX_SKILL)
return 0;
if (hd) hd->blockskill[data] = 0;
@@ -17106,7 +17077,7 @@ int skill_blockhomun_start(struct homun_data *hd, uint16 skill_id, int tick) { /
}
int skill_blockmerc_end(int tid, unsigned int tick, int id, intptr_t data) {//[orn]
- struct mercenary_data *md = (TBL_MER*)iMap->id2bl(id);
+ struct mercenary_data *md = (TBL_MER*)map->id2bl(id);
if( data <= 0 || data >= MAX_SKILL )
return 0;
if( md ) md->blockskill[data] = 0;
@@ -18024,27 +17995,27 @@ void skill_readdb(void) {
safestrncpy(skill_db[0].name, "UNKNOWN_SKILL", sizeof(skill_db[0].name));
safestrncpy(skill_db[0].desc, "Unknown Skill", sizeof(skill_db[0].desc));
- sv->readdb(iMap->db_path, DBPATH"skill_db.txt" , ',', 17, 17, MAX_SKILL_DB, skill->parse_row_skilldb);
- sv->readdb(iMap->db_path, DBPATH"skill_require_db.txt" , ',', 32, 32, MAX_SKILL_DB, skill->parse_row_requiredb);
+ sv->readdb(map->db_path, DBPATH"skill_db.txt", ',', 17, 17, MAX_SKILL_DB, skill->parse_row_skilldb);
+ sv->readdb(map->db_path, DBPATH"skill_require_db.txt", ',', 32, 32, MAX_SKILL_DB, skill->parse_row_requiredb);
#ifdef RENEWAL_CAST
- sv->readdb(iMap->db_path, "re/skill_cast_db.txt" , ',', 8, 8, MAX_SKILL_DB, skill->parse_row_castdb);
+ sv->readdb(map->db_path, "re/skill_cast_db.txt", ',', 8, 8, MAX_SKILL_DB, skill->parse_row_castdb);
#else
- sv->readdb(iMap->db_path, "pre-re/skill_cast_db.txt" , ',', 7, 7, MAX_SKILL_DB, skill->parse_row_castdb);
+ sv->readdb(map->db_path, "pre-re/skill_cast_db.txt", ',', 7, 7, MAX_SKILL_DB, skill->parse_row_castdb);
#endif
- sv->readdb(iMap->db_path, DBPATH"skill_castnodex_db.txt", ',', 2, 3, MAX_SKILL_DB, skill->parse_row_castnodexdb);
- sv->readdb(iMap->db_path, DBPATH"skill_unit_db.txt" , ',', 8, 8, MAX_SKILL_DB, skill->parse_row_unitdb);
+ sv->readdb(map->db_path, DBPATH"skill_castnodex_db.txt", ',', 2, 3, MAX_SKILL_DB, skill->parse_row_castnodexdb);
+ sv->readdb(map->db_path, DBPATH"skill_unit_db.txt", ',', 8, 8, MAX_SKILL_DB, skill->parse_row_unitdb);
skill->init_unit_layout();
- sv->readdb(iMap->db_path, "produce_db.txt" , ',', 4, 4+2*MAX_PRODUCE_RESOURCE, MAX_SKILL_PRODUCE_DB, skill->parse_row_producedb);
- sv->readdb(iMap->db_path, "create_arrow_db.txt" , ',', 1+2, 1+2*MAX_ARROW_RESOURCE, MAX_SKILL_ARROW_DB, skill->parse_row_createarrowdb);
- sv->readdb(iMap->db_path, "abra_db.txt" , ',', 4, 4, MAX_SKILL_ABRA_DB, skill->parse_row_abradb);
+ sv->readdb(map->db_path, "produce_db.txt", ',', 4, 4+2*MAX_PRODUCE_RESOURCE, MAX_SKILL_PRODUCE_DB, skill->parse_row_producedb);
+ sv->readdb(map->db_path, "create_arrow_db.txt", ',', 1+2, 1+2*MAX_ARROW_RESOURCE, MAX_SKILL_ARROW_DB, skill->parse_row_createarrowdb);
+ sv->readdb(map->db_path, "abra_db.txt", ',', 4, 4, MAX_SKILL_ABRA_DB, skill->parse_row_abradb);
//Warlock
- sv->readdb(iMap->db_path, "spellbook_db.txt" , ',', 3, 3, MAX_SKILL_SPELLBOOK_DB, skill->parse_row_spellbookdb);
+ sv->readdb(map->db_path, "spellbook_db.txt", ',', 3, 3, MAX_SKILL_SPELLBOOK_DB, skill->parse_row_spellbookdb);
//Guillotine Cross
- sv->readdb(iMap->db_path, "magicmushroom_db.txt" , ',', 1, 1, MAX_SKILL_MAGICMUSHROOM_DB, skill->parse_row_magicmushroomdb);
- sv->readdb(iMap->db_path, "skill_reproduce_db.txt", ',', 1, 1, MAX_SKILL_DB, skill->parse_row_reproducedb);
- sv->readdb(iMap->db_path, "skill_improvise_db.txt" , ',', 2, 2, MAX_SKILL_IMPROVISE_DB, skill->parse_row_improvisedb);
- sv->readdb(iMap->db_path, "skill_changematerial_db.txt" , ',', 4, 4+2*5, MAX_SKILL_PRODUCE_DB, skill->parse_row_changematerialdb);
+ sv->readdb(map->db_path, "magicmushroom_db.txt", ',', 1, 1, MAX_SKILL_MAGICMUSHROOM_DB, skill->parse_row_magicmushroomdb);
+ sv->readdb(map->db_path, "skill_reproduce_db.txt", ',', 1, 1, MAX_SKILL_DB, skill->parse_row_reproducedb);
+ sv->readdb(map->db_path, "skill_improvise_db.txt", ',', 2, 2, MAX_SKILL_IMPROVISE_DB, skill->parse_row_improvisedb);
+ sv->readdb(map->db_path, "skill_changematerial_db.txt", ',', 4, 4+2*5, MAX_SKILL_PRODUCE_DB, skill->parse_row_changematerialdb);
}
void skill_reload (void) {
diff --git a/src/map/status.c b/src/map/status.c
index 501448cc7..9ad1c2205 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -1592,7 +1592,7 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, uin
break;
case AL_TELEPORT:
//Should fail when used on top of Land Protector [Skotlex]
- if (src && iMap->getcell(src->m, src->x, src->y, CELL_CHKLANDPROTECTOR)
+ if (src && map->getcell(src->m, src->x, src->y, CELL_CHKLANDPROTECTOR)
&& !(st->mode&MD_BOSS)
&& (src->type != BL_PC || ((TBL_PC*)src)->skillitem != skill_id))
return 0;
@@ -1623,7 +1623,7 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, uin
if (sc->data[SC_DC_WINKCHARM] && target && !flag) { //Prevents skill usage
if( unit->bl2ud(src) && (unit->bl2ud(src))->walktimer == INVALID_TIMER )
- unit->walktobl(src, iMap->id2bl(sc->data[SC_DC_WINKCHARM]->val2), 3, 1);
+ unit->walktobl(src, map->id2bl(sc->data[SC_DC_WINKCHARM]->val2), 3, 1);
clif->emotion(src, E_LV);
return 0;
}
@@ -2064,7 +2064,7 @@ int status_calc_mob_(struct mob_data* md, bool first) {
memcpy(mstatus, &md->db->status, sizeof(struct status_data));
if (flag&(8|16))
- mbl = iMap->id2bl(md->master_id);
+ mbl = map->id2bl(md->master_id);
if (flag&8 && mbl) {
struct status_data *mstatus = status->get_base_status(mbl);
@@ -5860,7 +5860,7 @@ int status_get_party_id(struct block_list *bl) {
struct mob_data *md=(TBL_MOB*)bl;
if( md->master_id > 0 ) {
struct map_session_data *msd;
- if (md->special_state.ai && (msd = iMap->id2sd(md->master_id)) != NULL)
+ if (md->special_state.ai && (msd = map->id2sd(md->master_id)) != NULL)
return msd->status.party_id;
return -md->master_id;
}
@@ -5898,7 +5898,7 @@ int status_get_guild_id(struct block_list *bl) {
struct mob_data *md = (struct mob_data *)bl;
if (md->guardian_data) //Guardian's guild [Skotlex]
return md->guardian_data->guild_id;
- if (md->special_state.ai && (msd = iMap->id2sd(md->master_id)) != NULL)
+ if (md->special_state.ai && (msd = map->id2sd(md->master_id)) != NULL)
return msd->status.guild_id; //Alchemist's mobs [Skotlex]
}
break;
@@ -5938,7 +5938,7 @@ int status_get_emblem_id(struct block_list *bl) {
struct mob_data *md = (struct mob_data *)bl;
if (md->guardian_data) //Guardian's guild [Skotlex]
return md->guardian_data->emblem_id;
- if (md->special_state.ai && (msd = iMap->id2sd(md->master_id)) != NULL)
+ if (md->special_state.ai && (msd = map->id2sd(md->master_id)) != NULL)
return msd->guild_emblem_id; //Alchemist's mobs [Skotlex]
}
break;
@@ -7291,7 +7291,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
if( sd ) {
int i;
for( i = 0; i < 5; i++ ) {
- if( sd->devotion[i] && (tsd = iMap->id2sd(sd->devotion[i])) )
+ if( sd->devotion[i] && (tsd = map->id2sd(sd->devotion[i])) )
status->change_start(&tsd->bl, type, 10000, val1, val2, val3, val4, tick, 1);
}
} else if( bl->type == BL_MER && ((TBL_MER*)bl)->devotion_flag && (tsd = ((TBL_MER*)bl)->master) )
@@ -7379,7 +7379,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
if( sd ) {
int i;
for( i = 0; i < 5; i++ ) {
- if( sd->devotion[i] && (tsd = iMap->id2sd(sd->devotion[i])) )
+ if( sd->devotion[i] && (tsd = map->id2sd(sd->devotion[i])) )
status->change_start(&tsd->bl, type, 10000, val1, val2, 0, 0, tick, 1);
}
} else if( bl->type == BL_MER && ((TBL_MER*)bl)->devotion_flag && (tsd = ((TBL_MER*)bl)->master) )
@@ -7518,7 +7518,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
if (st->hp - diff < st->max_hp>>2)
diff = st->hp - (st->max_hp>>2);
if( val2 && bl->type == BL_MOB ) {
- struct block_list* src = iMap->id2bl(val2);
+ struct block_list* src = map->id2bl(val2);
if( src )
mob->log_damage((TBL_MOB*)bl,src,diff);
}
@@ -7556,11 +7556,10 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
tick_time = val2 * 1000; // [GodLesZ] tick time
break;
case SC_CASH_BOSS_ALARM:
- if( sd != NULL )
- {
- struct mob_data *boss_md = iMap->getmob_boss(bl->m); // Search for Boss on this Map
- if( boss_md == NULL || boss_md->bl.prev == NULL )
- { // No MVP on this map - MVP is dead
+ if( sd != NULL ) {
+ struct mob_data *boss_md = map->getmob_boss(bl->m); // Search for Boss on this Map
+ if( boss_md == NULL || boss_md->bl.prev == NULL ) {
+ // No MVP on this map - MVP is dead
clif->bossmapinfo(sd->fd, boss_md, 1);
return 0; // No need to start SC
}
@@ -7635,7 +7634,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
if( bl->type&(BL_PC|BL_MER) ) {
if( sd ) {
for( i = 0; i < 5; i++ ) {
- if( sd->devotion[i] && (tsd = iMap->id2sd(sd->devotion[i])) )
+ if( sd->devotion[i] && (tsd = map->id2sd(sd->devotion[i])) )
status->change_start(&tsd->bl, type, 10000, val1, val2, 0, 0, tick, 1);
}
}
@@ -7656,7 +7655,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
int i;
for (i = 0; i < 5; i++) {
//See if there are devoted characters, and pass the status to them. [Skotlex]
- if (sd->devotion[i] && (tsd = iMap->id2sd(sd->devotion[i])))
+ if (sd->devotion[i] && (tsd = map->id2sd(sd->devotion[i])))
status->change_start(&tsd->bl,type,10000,val1,5+val1*5,val3,val4,tick,1);
}
}
@@ -7727,7 +7726,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
{
int stat,max_stat;
// fetch caster information
- struct block_list *pbl = iMap->id2bl(val1);
+ struct block_list *pbl = map->id2bl(val1);
struct status_change *psc = pbl ? status->get_sc(pbl) : NULL;
struct status_change_entry *psce = psc ? psc->data[SC_MARIONETTE_MASTER] : NULL;
// fetch target's stats
@@ -7776,7 +7775,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
struct block_list *d_bl;
struct status_change *d_sc;
- if( (d_bl = iMap->id2bl(val1)) && (d_sc = status->get_sc(d_bl)) && d_sc->count ) {
+ if( (d_bl = map->id2bl(val1)) && (d_sc = status->get_sc(d_bl)) && d_sc->count ) {
// Inherits Status From Source
const enum sc_type types[] = { SC_AUTOGUARD, SC_DEFENDER, SC_REFLECTSHIELD, SC_ENDURE };
enum sc_type type2;
@@ -7793,7 +7792,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
case SC_COMA: //Coma. Sends a char to 1HP. If val2, do not zap sp
if( val3 && bl->type == BL_MOB ) {
- struct block_list* src = iMap->id2bl(val3);
+ struct block_list* src = map->id2bl(val3);
if( src )
mob->log_damage((TBL_MOB*)bl,src,st->hp - 1);
}
@@ -7802,7 +7801,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
break;
case SC_RG_CCONFINE_S:
{
- struct block_list *src = val2 ? iMap->id2bl(val2) : NULL;
+ struct block_list *src = val2 ? map->id2bl(val2) : NULL;
struct status_change *sc2 = src ? status->get_sc(src) : NULL;
struct status_change_entry *sce2 = sc2 ? sc2->data[SC_RG_CCONFINE_M] : NULL;
if (src && sc2) {
@@ -8257,7 +8256,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
tick = -1;
break;
case SC__SHADOWFORM: {
- struct map_session_data * s_sd = iMap->id2sd(val2);
+ struct map_session_data * s_sd = map->id2sd(val2);
if( s_sd )
s_sd->shadowform_id = bl->id;
val4 = tick / 1000;
@@ -8335,14 +8334,14 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
tick_time = 1000; // [GodLesZ] tick time
break;
case SC_BLOOD_SUCKER:
- {
- struct block_list *src = iMap->id2bl(val2);
- val3 = 1;
- if(src)
- val3 = 200 + 100 * val1 + status_get_int(src);
- val4 = tick / 1000;
- tick_time = 1000; // [GodLesZ] tick time
- }
+ {
+ struct block_list *src = map->id2bl(val2);
+ val3 = 1;
+ if(src)
+ val3 = 200 + 100 * val1 + status_get_int(src);
+ val4 = tick / 1000;
+ tick_time = 1000; // [GodLesZ] tick time
+ }
break;
case SC_VACUUM_EXTREME:
tick -= (st->str / 20) * 1000;
@@ -8499,22 +8498,22 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
tick_time = 5000; // [GodLesZ] tick time
break;
case SC_GENTLETOUCH_CHANGE:
- {// take note there is no def increase as skill desc says. [malufett]
- struct block_list * src;
- val3 = st->agi * val1 / 60; // ASPD increase: [(Target AGI x Skill Level) / 60] %
- if( (src = iMap->id2bl(val2)) ){
- val4 = ( 200/status_get_int(src) ) * val1;// MDEF decrease: MDEF [(200 / Caster INT) x Skill Level]
- val2 = ( status_get_dex(src)/4 + status_get_str(src)/2 ) * val1 / 5; // ATK increase: ATK [{(Caster DEX / 4) + (Caster STR / 2)} x Skill Level / 5]
- }
+ {// take note there is no def increase as skill desc says. [malufett]
+ struct block_list * src;
+ val3 = st->agi * val1 / 60; // ASPD increase: [(Target AGI x Skill Level) / 60] %
+ if( (src = map->id2bl(val2)) ){
+ val4 = ( 200/status_get_int(src) ) * val1;// MDEF decrease: MDEF [(200 / Caster INT) x Skill Level]
+ val2 = ( status_get_dex(src)/4 + status_get_str(src)/2 ) * val1 / 5; // ATK increase: ATK [{(Caster DEX / 4) + (Caster STR / 2)} x Skill Level / 5]
}
+ }
break;
case SC_GENTLETOUCH_REVITALIZE:
- {// take note there is no vit,aspd,speed increase as skill desc says. [malufett]
- struct block_list * src;
- val3 = val1 * 30 + 150; // Natural HP recovery increase: [(Skill Level x 30) + 50] %
- if( (src = iMap->id2bl(val2)) ) // the stat def is not shown in the status window and it is process differently
- val4 = ( status_get_vit(src)/4 ) * val1; // STAT DEF increase: [(Caster VIT / 4) x Skill Level]
- }
+ {// take note there is no vit,aspd,speed increase as skill desc says. [malufett]
+ struct block_list * src;
+ val3 = val1 * 30 + 150; // Natural HP recovery increase: [(Skill Level x 30) + 50] %
+ if( (src = map->id2bl(val2)) ) // the stat def is not shown in the status window and it is process differently
+ val4 = ( status_get_vit(src)/4 ) * val1; // STAT DEF increase: [(Caster VIT / 4) x Skill Level]
+ }
break;
case SC_PYROTECHNIC_OPTION:
val_flag |= 1|2|4;
@@ -9088,7 +9087,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
}
break;
case SC_CASH_BOSS_ALARM:
- clif->bossmapinfo(sd->fd, iMap->id2boss(sce->val1), 0); // First Message
+ clif->bossmapinfo(sd->fd, map->id2boss(sce->val1), 0); // First Message
break;
case SC_MER_HP:
status_percent_heal(bl, 100, 0); // Recover Full HP
@@ -9327,17 +9326,15 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
case SC_AUTOGUARD:
{
struct map_session_data *tsd;
- if( bl->type == BL_PC )
- { // Clear Status from others
+ if( bl->type == BL_PC ) {
+ // Clear Status from others
int i;
- for( i = 0; i < 5; i++ )
- {
- if( sd->devotion[i] && (tsd = iMap->id2sd(sd->devotion[i])) && tsd->sc.data[type] )
+ for( i = 0; i < 5; i++ ) {
+ if( sd->devotion[i] && (tsd = map->id2sd(sd->devotion[i])) && tsd->sc.data[type] )
status_change_end(&tsd->bl, type, INVALID_TIMER);
}
- }
- else if( bl->type == BL_MER && ((TBL_MER*)bl)->devotion_flag )
- { // Clear Status from Master
+ } else if( bl->type == BL_MER && ((TBL_MER*)bl)->devotion_flag ) {
+ // Clear Status from Master
tsd = ((TBL_MER*)bl)->master;
if( tsd && tsd->sc.data[type] )
status_change_end(&tsd->bl, type, INVALID_TIMER);
@@ -9346,9 +9343,8 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
break;
case SC_DEVOTION:
{
- struct block_list *d_bl = iMap->id2bl(sce->val1);
- if( d_bl )
- {
+ struct block_list *d_bl = map->id2bl(sce->val1);
+ if( d_bl ) {
if( d_bl->type == BL_PC )
((TBL_PC*)d_bl)->devotion[sce->val2] = 0;
else if( d_bl->type == BL_MER )
@@ -9366,7 +9362,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
case SC_BLADESTOP:
if(sce->val4) {
int tid = sce->val4;
- struct block_list *tbl = iMap->id2bl(tid);
+ struct block_list *tbl = map->id2bl(tid);
struct status_change *tsc = status->get_sc(tbl);
sce->val4 = 0;
if(tbl && tsc && tsc->data[SC_BLADESTOP]) {
@@ -9399,7 +9395,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
sd->delunit_prevline = line;
}
- if(sce->val4 && sce->val4 != BCT_SELF && (dsd=iMap->id2sd(sce->val4)))
+ if(sce->val4 && sce->val4 != BCT_SELF && (dsd=map->id2sd(sce->val4)))
{// end status on partner as well
dsc = dsd->sc.data[SC_DANCING];
if(dsc) {
@@ -9446,14 +9442,14 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
break;
case SC_SPLASHER:
{
- struct block_list *src=iMap->id2bl(sce->val3);
+ struct block_list *src=map->id2bl(sce->val3);
if(src && tid != INVALID_TIMER)
skill->castend_damage_id(src, bl, sce->val2, sce->val1, timer->gettick(), SD_LEVEL );
}
break;
case SC_RG_CCONFINE_S:
{
- struct block_list *src = sce->val2 ? iMap->id2bl(sce->val2) : NULL;
+ struct block_list *src = sce->val2 ? map->id2bl(sce->val2) : NULL;
struct status_change *sc2 = src ? status->get_sc(src) : NULL;
if (src && sc2 && sc2->data[SC_RG_CCONFINE_M]) {
//If status was already ended, do nothing.
@@ -9468,7 +9464,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
int range = 1
+skill->get_range2(bl, status->sc2skill(type), sce->val1)
+skill->get_range2(bl, TF_BACKSLIDING, 1); //Since most people use this to escape the hold....
- iMap->foreachinarea(status->change_timer_sub,
+ map->foreachinarea(status->change_timer_sub,
bl->m, bl->x-range, bl->y-range, bl->x+range,bl->y+range,BL_CHAR,bl,sce,type,timer->gettick());
}
break;
@@ -9499,7 +9495,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
if (sce->val1) {
// check for partner and end their marionette status as well
enum sc_type type2 = (type == SC_MARIONETTE_MASTER) ? SC_MARIONETTE : SC_MARIONETTE_MASTER;
- struct block_list *pbl = iMap->id2bl(sce->val1);
+ struct block_list *pbl = map->id2bl(sce->val1);
struct status_change* sc2 = pbl ? status->get_sc(pbl) : NULL;
if (sc2 && sc2->data[type2])
@@ -9575,14 +9571,14 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
break;
// Note: vending/buying is closed by unit_remove_map, no
// need to do it here.
- iMap->quit(sd);
- // Because iMap->quit calls status_change_end with tid -1
+ map->quit(sd);
+ // Because map->quit calls status_change_end with tid -1
// from here it's not neccesary to continue
return 1;
break;
case SC_STOP:
if( sce->val2 ) {
- struct block_list* tbl = iMap->id2bl(sce->val2);
+ struct block_list* tbl = map->id2bl(sce->val2);
sce->val2 = 0;
if( tbl && (sc = status->get_sc(tbl)) && sc->data[SC_STOP] && sc->data[SC_STOP]->val2 == bl->id )
status_change_end(tbl, SC_STOP, INVALID_TIMER);
@@ -9602,7 +9598,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
break;
case SC_WHITEIMPRISON:
{
- struct block_list* src = iMap->id2bl(sce->val2);
+ struct block_list* src = map->id2bl(sce->val2);
if( tid == -1 || !src)
break; // Terminated by Damage
status_fix_damage(src,bl,400*sce->val1,clif->damage(bl,bl,timer->gettick(),0,0,400*sce->val1,0,0,0));
@@ -9621,13 +9617,14 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
case SC_ADORAMUS:
status_change_end(bl, SC_BLIND, INVALID_TIMER);
break;
- case SC__SHADOWFORM: {
- struct map_session_data *s_sd = iMap->id2sd(sce->val2);
- if( !s_sd )
- break;
- s_sd->shadowform_id = 0;
- }
- break;
+ case SC__SHADOWFORM:
+ {
+ struct map_session_data *s_sd = map->id2sd(sce->val2);
+ if( !s_sd )
+ break;
+ s_sd->shadowform_id = 0;
+ }
+ break;
case SC_SITDOWN_FORCE:
if( sd && pc_issit(sd) ) {
pc->setstand(sd);
@@ -9653,7 +9650,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
break;
case SC_CURSEDCIRCLE_ATKER:
if( sce->val2 ) // used the default area size cause there is a chance the caster could knock back and can't clear the target.
- iMap->foreachinrange(status->change_timer_sub, bl, battle_config.area_size,BL_CHAR, bl, sce, SC_CURSEDCIRCLE_TARGET, timer->gettick());
+ map->foreachinrange(status->change_timer_sub, bl, battle_config.area_size,BL_CHAR, bl, sce, SC_CURSEDCIRCLE_TARGET, timer->gettick());
break;
case SC_RAISINGDRAGON:
if( sd && sce->val2 && !pc_isdead(sd) ) {
@@ -9669,7 +9666,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
break;
case SC_CURSEDCIRCLE_TARGET:
{
- struct block_list *src = iMap->id2bl(sce->val2);
+ struct block_list *src = map->id2bl(sce->val2);
struct status_change *sc = status->get_sc(src);
if( sc && sc->data[SC_CURSEDCIRCLE_ATKER] && --(sc->data[SC_CURSEDCIRCLE_ATKER]->val2) == 0 ){
status_change_end(src, SC_CURSEDCIRCLE_ATKER, INVALID_TIMER);
@@ -9679,7 +9676,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
break;
case SC_BLOOD_SUCKER:
if( sce->val2 ){
- struct block_list *src = iMap->id2bl(sce->val2);
+ struct block_list *src = map->id2bl(sce->val2);
if(src) {
struct status_change *sc = status->get_sc(src);
sc->bs_counter--;
@@ -9910,7 +9907,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
if(opt_flag&4) //Out of hiding, invoke on place.
skill->unit_move(bl,timer->gettick(),1);
- if(opt_flag&2 && sd && iMap->getcell(bl->m,bl->x,bl->y,CELL_CHKNPC))
+ if(opt_flag&2 && sd && map->getcell(bl->m,bl->x,bl->y,CELL_CHKNPC))
npc->touch_areanpc(sd,bl->m,bl->x,bl->y); //Trigger on-touch event.
ers_free(sc_data_ers, sce);
@@ -9924,7 +9921,7 @@ int kaahi_heal_timer(int tid, unsigned int tick, int id, intptr_t data) {
struct status_data *st;
int hp;
- if(!( (bl=iMap->id2bl(id))
+ if(!( (bl=map->id2bl(id))
&& (sc=status->get_sc(bl))
&& (sce=sc->data[SC_KAAHI])
))
@@ -9963,7 +9960,7 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) {
struct status_change *sc;
struct status_change_entry *sce;
- bl = iMap->id2bl(id);
+ bl = map->id2bl(id);
if(!bl) {
ShowDebug("status_change_timer: Null pointer id: %d data: %d\n", id, data);
return 0;
@@ -10036,9 +10033,9 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) {
case SC_RUWACH:
case SC_WZ_SIGHTBLASTER:
if(type == SC_WZ_SIGHTBLASTER)
- iMap->foreachinrange(status->change_timer_sub, bl, sce->val3, BL_CHAR|BL_SKILL, bl, sce, type, tick);
+ map->foreachinrange(status->change_timer_sub, bl, sce->val3, BL_CHAR|BL_SKILL, bl, sce, type, tick);
else
- iMap->foreachinrange(status->change_timer_sub, bl, sce->val3, BL_CHAR, bl, sce, type, tick);
+ map->foreachinrange(status->change_timer_sub, bl, sce->val3, BL_CHAR, bl, sce, type, tick);
if( --(sce->val2)>0 ){
sce->val4 += 250; // use for Shadow Form 2 seconds checking.
@@ -10080,16 +10077,16 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) {
if (--(sce->val3) > 0) {
if (!sc->data[SC_SLOWPOISON]) {
if( sce->val2 && bl->type == BL_MOB ) {
- struct block_list* src = iMap->id2bl(sce->val2);
+ struct block_list* src = map->id2bl(sce->val2);
if( src )
mob->log_damage((TBL_MOB*)bl,src,sce->val4);
}
- iMap->freeblock_lock();
+ map->freeblock_lock();
status_zap(bl, sce->val4, 0);
if (sc->data[type]) { // Check if the status still last ( can be dead since then ).
sc_timer_next(1000 + tick, status->change_timer, bl->id, data );
}
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
}
return 0;
}
@@ -10116,20 +10113,20 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) {
case SC_BLOODING:
if (--(sce->val4) >= 0) {
int hp = rnd()%600 + 200;
- struct block_list* src = iMap->id2bl(sce->val2);
+ struct block_list* src = map->id2bl(sce->val2);
if( src && bl && bl->type == BL_MOB ) {
mob->log_damage((TBL_MOB*)bl,src,sd||hp<st->hp?hp:st->hp-1);
}
- iMap->freeblock_lock();
+ map->freeblock_lock();
status_fix_damage(src, bl, sd||hp<st->hp?hp:st->hp-1, 1);
if( sc->data[type] ) {
if( st->hp == 1 ) {
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
break;
}
sc_timer_next(10000 + tick, status->change_timer, bl->id, data);
}
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return 0;
}
break;
@@ -10149,7 +10146,7 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) {
case SC_CASH_BOSS_ALARM:
if( sd && --(sce->val4) >= 0 ) {
- struct mob_data *boss_md = iMap->id2boss(sce->val1);
+ struct mob_data *boss_md = map->id2boss(sce->val1);
if( boss_md && sd->bl.m == boss_md->bl.m ) {
clif->bossmapinfo(sd->fd, boss_md, 1); // Update X - Y on minimap
if (boss_md->bl.prev != NULL) {
@@ -10252,7 +10249,7 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) {
case SC_MARIONETTE_MASTER:
case SC_MARIONETTE:
{
- struct block_list *pbl = iMap->id2bl(sce->val1);
+ struct block_list *pbl = map->id2bl(sce->val1);
if( pbl && check_distance_bl(bl, pbl, 7) ) {
sc_timer_next(1000 + tick, status->change_timer, bl->id, data);
return 0;
@@ -10295,13 +10292,13 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) {
case SC_PYREXIA:
if( --(sce->val4) > 0 ) {
- iMap->freeblock_lock();
+ map->freeblock_lock();
clif->damage(bl,bl,tick,status_get_amotion(bl),status_get_dmotion(bl)+500,100,0,0,0);
status_fix_damage(NULL,bl,100,0);
if( sc->data[type] ) {
sc_timer_next(3000+tick,status->change_timer,bl->id,data);
}
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return 0;
}
break;
@@ -10311,12 +10308,12 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) {
int damage = st->max_hp/100; // {Target VIT x (New Poison Research Skill Level - 3)} + (Target HP/100)
damage += st->vit * (sce->val1 - 3);
unit->skillcastcancel(bl,2);
- iMap->freeblock_lock();
+ map->freeblock_lock();
status->damage(bl, bl, damage, 0, clif->damage(bl,bl,tick,status_get_amotion(bl),status_get_dmotion(bl)+500,damage,1,0,0), 1);
if( sc->data[type] ) {
sc_timer_next(1000 + tick, status->change_timer, bl->id, data );
}
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return 0;
}
break;
@@ -10329,10 +10326,10 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) {
damage = st->hp - 1; // Cannot Kill
if( damage > 0 ) { // 3% Damage each 4 seconds
- iMap->freeblock_lock();
+ map->freeblock_lock();
status_zap(bl,damage,0);
flag = !sc->data[type]; // Killed? Should not
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
}
if( !flag ) { // Random Skill Cast
@@ -10369,13 +10366,13 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) {
case SC_TOXIN:
if( --(sce->val4) > 0 ) {
//Damage is every 10 seconds including 3%sp drain.
- iMap->freeblock_lock();
+ map->freeblock_lock();
clif->damage(bl,bl,tick,status_get_amotion(bl),1,1,0,0,0);
status->damage(NULL, bl, 1, st->max_sp * 3 / 100, 0, 0); //cancel dmg only if cancelable
if( sc->data[type] ) {
sc_timer_next(10000 + tick, status->change_timer, bl->id, data );
}
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return 0;
}
break;
@@ -10416,17 +10413,17 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) {
case SC_BURNING:
if( --(sce->val4) > 0 ) {
- struct block_list *src = iMap->id2bl(sce->val3);
+ struct block_list *src = map->id2bl(sce->val3);
int damage = 1000 + 3 * status_get_max_hp(bl) / 100; // Deals fixed (1000 + 3%*MaxHP)
- iMap->freeblock_lock();
+ map->freeblock_lock();
clif->damage(bl,bl,tick,0,0,damage,1,9,0); //damage is like endure effect with no walk delay
status->damage(src, bl, damage, 0, 0, 1);
if( sc->data[type]){ // Target still lives. [LimitLine]
sc_timer_next(3000 + tick, status->change_timer, bl->id, data);
}
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return 0;
}
break;
@@ -10519,18 +10516,18 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) {
break;
case SC_BLOOD_SUCKER:
if( --(sce->val4) > 0 ) {
- struct block_list *src = iMap->id2bl(sce->val2);
+ struct block_list *src = map->id2bl(sce->val2);
int damage;
if( !src || (src && (status->isdead(src) || src->m != bl->m || distance_bl(src, bl) >= 12)) )
break;
- iMap->freeblock_lock();
+ map->freeblock_lock();
damage = sce->val3;
status->damage(src, bl, damage, 0, clif->damage(bl,bl,tick,st->amotion,st->dmotion+200,damage,1,0,0), 1);
unit->skillcastcancel(bl,1);
if ( sc->data[type] ) {
sc_timer_next(1000 + tick, status->change_timer, bl->id, data);
}
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
status->heal(src, damage*(5 + 5 * sce->val1)/100, 0, 0); // 5 + 5% per level
return 0;
}
@@ -10627,12 +10624,12 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) {
{
int damage = st->max_hp / 100; // Suggestion 1% each second
if( damage >= st->hp ) damage = st->hp - 1; // Do not kill, just keep you with 1 hp minimum
- iMap->freeblock_lock();
+ map->freeblock_lock();
status_fix_damage(NULL,bl,damage,clif->damage(bl,bl,tick,0,0,damage,0,0,0));
if( sc->data[type] ) {
sc_timer_next(1000 + tick, status->change_timer, bl->id, data);
}
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
}
break;
@@ -10644,7 +10641,7 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) {
if( !status->charge(bl,0,14 + (3 * sce->val1)) )
break; // No more SP status should end, and in the next second will end for the other affected players
} else {
- struct block_list *src = iMap->id2bl(sce->val2);
+ struct block_list *src = map->id2bl(sce->val2);
struct status_change *ssc;
if( !src || (ssc = status->get_sc(src)) == NULL || !ssc->data[SC_MAGNETICFIELD] )
break; // Source no more under Magnetic Field
@@ -11294,10 +11291,9 @@ static int status_natural_heal(struct block_list* bl, va_list args) {
}
//Natural heal main timer.
-static int status_natural_heal_timer(int tid, unsigned int tick, int id, intptr_t data)
-{
+static int status_natural_heal_timer(int tid, unsigned int tick, int id, intptr_t data) {
natural_heal_diff_tick = DIFF_TICK(tick,natural_heal_prev_tick);
- iMap->map_foreachregen(status_natural_heal);
+ map->map_foreachregen(status_natural_heal);
natural_heal_prev_tick = tick;
return 0;
}
@@ -11482,14 +11478,14 @@ int status_readdb(void)
#ifdef RENEWAL_ASPD
- sv->readdb(iMap->db_path, "re/job_db1.txt", ',', 6+MAX_WEAPON_TYPE, 6+MAX_WEAPON_TYPE, -1, &status_readdb_job1);
+ sv->readdb(map->db_path, "re/job_db1.txt", ',', 6+MAX_WEAPON_TYPE, 6+MAX_WEAPON_TYPE, -1, &status_readdb_job1);
#else
- sv->readdb(iMap->db_path, "pre-re/job_db1.txt", ',', 5+MAX_WEAPON_TYPE, 5+MAX_WEAPON_TYPE, -1, &status_readdb_job1);
+ sv->readdb(map->db_path, "pre-re/job_db1.txt", ',', 5+MAX_WEAPON_TYPE, 5+MAX_WEAPON_TYPE, -1, &status_readdb_job1);
#endif
- sv->readdb(iMap->db_path, "job_db2.txt", ',', 1, 1+MAX_LEVEL, -1, &status_readdb_job2);
- sv->readdb(iMap->db_path, "size_fix.txt", ',', MAX_WEAPON_TYPE, MAX_WEAPON_TYPE, ARRAYLENGTH(atkmods), &status_readdb_sizefix);
- sv->readdb(iMap->db_path, DBPATH"refine_db.txt", ',', 4+MAX_REFINE, 4+MAX_REFINE, ARRAYLENGTH(refine_info), &status_readdb_refine);
- sv->readdb(iMap->db_path, "sc_config.txt", ',', 2, 2, SC_MAX, &status_readdb_scconfig);
+ sv->readdb(map->db_path, "job_db2.txt", ',', 1, 1+MAX_LEVEL, -1, &status_readdb_job2);
+ sv->readdb(map->db_path, "size_fix.txt", ',', MAX_WEAPON_TYPE, MAX_WEAPON_TYPE, ARRAYLENGTH(atkmods), &status_readdb_sizefix);
+ sv->readdb(map->db_path, DBPATH"refine_db.txt", ',', 4+MAX_REFINE, 4+MAX_REFINE, ARRAYLENGTH(refine_info), &status_readdb_refine);
+ sv->readdb(map->db_path, "sc_config.txt", ',', 2, 2, SC_MAX, &status_readdb_scconfig);
return 0;
}
diff --git a/src/map/storage.c b/src/map/storage.c
index 2fe7607c3..041c2cd72 100644
--- a/src/map/storage.c
+++ b/src/map/storage.c
@@ -321,13 +321,12 @@ int storage_storagegettocart(struct map_session_data* sd, int index, int amount)
/*==========================================
* Modified By Valaris to save upon closing [massdriller]
*------------------------------------------*/
-void storage_storageclose(struct map_session_data* sd)
-{
+void storage_storageclose(struct map_session_data* sd) {
nullpo_retv(sd);
clif->storageclose(sd);
- if( iMap->save_settings&4 )
+ if( map->save_settings&4 )
chrif->save(sd,0); //Invokes the storage saving as well.
sd->state.storage_flag = 0;
@@ -336,11 +335,10 @@ void storage_storageclose(struct map_session_data* sd)
/*==========================================
* When quitting the game.
*------------------------------------------*/
-void storage_storage_quit(struct map_session_data* sd, int flag)
-{
+void storage_storage_quit(struct map_session_data* sd, int flag) {
nullpo_retv(sd);
- if (iMap->save_settings&4)
+ if (map->save_settings&4)
chrif->save(sd, flag); //Invokes the storage saving as well.
sd->state.storage_flag = 0;
@@ -684,17 +682,15 @@ int storage_guild_storagesaved(int guild_id)
}
//Close storage for sd and save it
-int storage_guild_storageclose(struct map_session_data* sd)
-{
+int storage_guild_storageclose(struct map_session_data* sd) {
struct guild_storage *stor;
nullpo_ret(sd);
nullpo_ret(stor=gstorage->id2storage2(sd->status.guild_id));
clif->storageclose(sd);
- if (stor->storage_status)
- {
- if (iMap->save_settings&4)
+ if (stor->storage_status) {
+ if (map->save_settings&4)
chrif->save(sd, 0); //This one also saves the storage. [Skotlex]
else
gstorage->save(sd->status.account_id, sd->status.guild_id,0);
@@ -705,25 +701,24 @@ int storage_guild_storageclose(struct map_session_data* sd)
return 0;
}
-int storage_guild_storage_quit(struct map_session_data* sd, int flag)
-{
+int storage_guild_storage_quit(struct map_session_data* sd, int flag) {
struct guild_storage *stor;
nullpo_ret(sd);
nullpo_ret(stor=gstorage->id2storage2(sd->status.guild_id));
- if(flag)
- { //Only during a guild break flag is 1 (don't save storage)
+ if(flag) {
+ //Only during a guild break flag is 1 (don't save storage)
sd->state.storage_flag = 0;
stor->storage_status = 0;
clif->storageclose(sd);
- if (iMap->save_settings&4)
+ if (map->save_settings&4)
chrif->save(sd,0);
return 0;
}
if(stor->storage_status) {
- if (iMap->save_settings&4)
+ if (map->save_settings&4)
chrif->save(sd,0);
else
gstorage->save(sd->status.account_id,sd->status.guild_id,1);
diff --git a/src/map/trade.c b/src/map/trade.c
index f8df2a6c3..e137f7105 100644
--- a/src/map/trade.c
+++ b/src/map/trade.c
@@ -57,7 +57,7 @@ void trade_traderequest(struct map_session_data *sd, struct map_session_data *ta
}
if ( sd->trade_partner != 0 ) { // If a character tries to trade to another one then cancel the previous one
- struct map_session_data *previous_sd = iMap->id2sd(sd->trade_partner);
+ struct map_session_data *previous_sd = map->id2sd(sd->trade_partner);
if( previous_sd ){
previous_sd->trade_partner = 0;
clif->tradecancelled(previous_sd);
@@ -101,15 +101,14 @@ void trade_traderequest(struct map_session_data *sd, struct map_session_data *ta
* Weird enough, the client should only send 3/4
* and the server is the one that can reply 0~2
*------------------------------------------*/
-void trade_tradeack(struct map_session_data *sd, int type)
-{
+void trade_tradeack(struct map_session_data *sd, int type) {
struct map_session_data *tsd;
nullpo_retv(sd);
if (sd->state.trading || !sd->trade_partner)
return; //Already trading or no partner set.
- if ((tsd = iMap->id2sd(sd->trade_partner)) == NULL) {
+ if ((tsd = map->id2sd(sd->trade_partner)) == NULL) {
clif->tradestart(sd, 1); // character does not exist
sd->trade_partner=0;
return;
@@ -200,12 +199,12 @@ int impossible_trade_check(struct map_session_data *sd)
if (!sd->deal.item[i].amount)
continue;
index = sd->deal.item[i].index;
- if (inventory[index].amount < sd->deal.item[i].amount)
- { // if more than the player have -> hack
+ if (inventory[index].amount < sd->deal.item[i].amount) {
+ // if more than the player have -> hack
sprintf(message_to_gm, msg_txt(538), sd->status.name, sd->status.account_id); // Hack on trade: character '%s' (account: %d) try to trade more items that he has.
- intif->wis_message_to_gm(iMap->wisp_server_name, PC_PERM_RECEIVE_HACK_INFO, message_to_gm);
+ intif->wis_message_to_gm(map->wisp_server_name, PC_PERM_RECEIVE_HACK_INFO, message_to_gm);
sprintf(message_to_gm, msg_txt(539), inventory[index].amount, inventory[index].nameid, sd->deal.item[i].amount); // This player has %d of a kind of item (id: %d), and try to trade %d of them.
- intif->wis_message_to_gm(iMap->wisp_server_name, PC_PERM_RECEIVE_HACK_INFO, message_to_gm);
+ intif->wis_message_to_gm(map->wisp_server_name, PC_PERM_RECEIVE_HACK_INFO, message_to_gm);
// if we block people
if (battle_config.ban_hack_trade < 0) {
chrif->char_ask_name(-1, sd->status.name, 1, 0, 0, 0, 0, 0, 0); // type: 1 - block
@@ -222,7 +221,7 @@ int impossible_trade_check(struct map_session_data *sd)
// message about the ban
strcpy(message_to_gm, msg_txt(508)); // This player hasn't been banned (Ban option is disabled).
- intif->wis_message_to_gm(iMap->wisp_server_name, PC_PERM_RECEIVE_HACK_INFO, message_to_gm);
+ intif->wis_message_to_gm(map->wisp_server_name, PC_PERM_RECEIVE_HACK_INFO, message_to_gm);
return 1;
}
inventory[index].amount -= sd->deal.item[i].amount; // remove item from inventory
@@ -320,8 +319,7 @@ int trade_check(struct map_session_data *sd, struct map_session_data *tsd)
/*==========================================
* Adds an item/qty to the trade window
*------------------------------------------*/
-void trade_tradeadditem(struct map_session_data *sd, short index, short amount)
-{
+void trade_tradeadditem(struct map_session_data *sd, short index, short amount) {
struct map_session_data *target_sd;
struct item *item;
int trade_i, trade_weight;
@@ -331,7 +329,7 @@ void trade_tradeadditem(struct map_session_data *sd, short index, short amount)
if( !sd->state.trading || sd->state.deal_locked > 0 )
return; //Can't add stuff.
- if( (target_sd = iMap->id2sd(sd->trade_partner)) == NULL )
+ if( (target_sd = map->id2sd(sd->trade_partner)) == NULL )
{
trade->cancel(sd);
return;
@@ -415,8 +413,7 @@ void trade_tradeaddzeny(struct map_session_data* sd, int amount)
if( !sd->state.trading || sd->state.deal_locked > 0 )
return; //Can't add stuff.
- if( (target_sd = iMap->id2sd(sd->trade_partner)) == NULL )
- {
+ if( (target_sd = map->id2sd(sd->trade_partner)) == NULL ) {
trade->cancel(sd);
return;
}
@@ -434,14 +431,13 @@ void trade_tradeaddzeny(struct map_session_data* sd, int amount)
/*==========================================
* 'Ok' button on the trade window is pressed.
*------------------------------------------*/
-void trade_tradeok(struct map_session_data *sd)
-{
+void trade_tradeok(struct map_session_data *sd) {
struct map_session_data *target_sd;
if(sd->state.deal_locked || !sd->state.trading)
return;
- if ((target_sd = iMap->id2sd(sd->trade_partner)) == NULL) {
+ if ((target_sd = map->id2sd(sd->trade_partner)) == NULL) {
trade->cancel(sd);
return;
}
@@ -454,12 +450,11 @@ void trade_tradeok(struct map_session_data *sd)
/*==========================================
* 'Cancel' is pressed. (or trade was force-cancelled by the code)
*------------------------------------------*/
-void trade_tradecancel(struct map_session_data *sd)
-{
+void trade_tradecancel(struct map_session_data *sd) {
struct map_session_data *target_sd;
int trade_i;
- target_sd = iMap->id2sd(sd->trade_partner);
+ target_sd = map->id2sd(sd->trade_partner);
if(!sd->state.trading)
{ // Not trade acepted
@@ -513,8 +508,7 @@ void trade_tradecancel(struct map_session_data *sd)
/*==========================================
* lock sd and tsd trade data, execute the trade, clear, then save players
*------------------------------------------*/
-void trade_tradecommit(struct map_session_data *sd)
-{
+void trade_tradecommit(struct map_session_data *sd) {
struct map_session_data *tsd;
int trade_i;
int flag;
@@ -522,7 +516,7 @@ void trade_tradecommit(struct map_session_data *sd)
if (!sd->state.trading || !sd->state.deal_locked) //Locked should be 1 (pressed ok) before you can press trade.
return;
- if ((tsd = iMap->id2sd(sd->trade_partner)) == NULL) {
+ if ((tsd = map->id2sd(sd->trade_partner)) == NULL) {
trade_tradecancel(sd);
return;
}
@@ -603,7 +597,7 @@ void trade_tradecommit(struct map_session_data *sd)
clif->tradecompleted(tsd, 0);
// save both player to avoid crash: they always have no advantage/disadvantage between the 2 players
- if (iMap->save_settings&1)
+ if (map->save_settings&1)
{
chrif->save(sd,0);
chrif->save(tsd,0);
diff --git a/src/map/unit.c b/src/map/unit.c
index e4ea365df..44bb1970c 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -137,8 +137,7 @@ int unit_walktoxy_sub(struct block_list *bl)
return 1;
}
-int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data)
-{
+int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data) {
int i;
int x,y,dx,dy;
uint8 dir;
@@ -148,7 +147,7 @@ int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data)
struct unit_data *ud;
struct mercenary_data *mrd;
- bl = iMap->id2bl(id);
+ bl = map->id2bl(id);
if(bl == NULL)
return 0;
sd = BL_CAST(BL_PC, bl);
@@ -179,29 +178,29 @@ int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data)
dx = dirx[(int)dir];
dy = diry[(int)dir];
- if(iMap->getcell(bl->m,x+dx,y+dy,CELL_CHKNOPASS))
+ if(map->getcell(bl->m,x+dx,y+dy,CELL_CHKNOPASS))
return unit->walktoxy_sub(bl);
//Refresh view for all those we lose sight
- iMap->foreachinmovearea(clif->outsight, bl, AREA_SIZE, dx, dy, sd?BL_ALL:BL_PC, bl);
+ map->foreachinmovearea(clif->outsight, bl, AREA_SIZE, dx, dy, sd?BL_ALL:BL_PC, bl);
x += dx;
y += dy;
- iMap->moveblock(bl, x, y, tick);
+ map->moveblock(bl, x, y, tick);
ud->walk_count++; //walked cell counter, to be used for walk-triggered skills. [Skotlex]
status_change_end(bl, SC_ROLLINGCUTTER, INVALID_TIMER); //If you move, you lose your counters. [malufett]
if (bl->x != x || bl->y != y || ud->walktimer != INVALID_TIMER)
- return 0; //iMap->moveblock has altered the object beyond what we expected (moved/warped it)
+ return 0; //map->moveblock has altered the object beyond what we expected (moved/warped it)
ud->walktimer = -2; // arbitrary non-INVALID_TIMER value to make the clif code send walking packets
- iMap->foreachinmovearea(clif->insight, bl, AREA_SIZE, -dx, -dy, sd?BL_ALL:BL_PC, bl);
+ map->foreachinmovearea(clif->insight, bl, AREA_SIZE, -dx, -dy, sd?BL_ALL:BL_PC, bl);
ud->walktimer = INVALID_TIMER;
if(sd) {
if( sd->touching_id )
npc->touchnext_areanpc(sd,false);
- if(iMap->getcell(bl->m,x,y,CELL_CHKNPC)) {
+ if(map->getcell(bl->m,x,y,CELL_CHKNPC)) {
npc->touch_areanpc(sd,bl->m,x,y);
if (bl->prev == NULL) //Script could have warped char, abort remaining of the function.
return 0;
@@ -227,7 +226,7 @@ int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data)
sd->md->masterteleport_timer = 0;
}
} else if (md) {
- if( iMap->getcell(bl->m,x,y,CELL_CHKNPC) ) {
+ if( map->getcell(bl->m,x,y,CELL_CHKNPC) ) {
if( npc->touch_areanpc2(md) ) return 0; // Warped
} else
md->areanpc_id = 0;
@@ -290,10 +289,9 @@ int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data)
//Keep trying to run.
if ( !(unit->run(bl) || unit->wugdash(bl,sd)) )
ud->state.running = 0;
- }
- else if (ud->target_to) {
+ } else if (ud->target_to) {
//Update target trajectory.
- struct block_list *tbl = iMap->id2bl(ud->target_to);
+ struct block_list *tbl = map->id2bl(ud->target_to);
if (!tbl || !status->check_visibility(bl, tbl)) {
//Cancel chase.
ud->to_x = bl->x;
@@ -303,8 +301,8 @@ int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data)
ud->target_to = 0;
return 0;
}
- if (tbl->m == bl->m && check_distance_bl(bl, tbl, ud->chaserange))
- { //Reached destination.
+ if (tbl->m == bl->m && check_distance_bl(bl, tbl, ud->chaserange)) {
+ //Reached destination.
if (ud->state.attack_continue)
{ //Aegis uses one before every attack, we should
//only need this one for syncing purposes. [Skotlex]
@@ -316,17 +314,16 @@ int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data)
unit->walktobl(bl, tbl, ud->chaserange, ud->state.walk_easy|(ud->state.attack_continue?2:0));
return 0;
}
- }
- else { //Stopped walking. Update to_x and to_y to current location [Skotlex]
+ } else {
+ //Stopped walking. Update to_x and to_y to current location [Skotlex]
ud->to_x = bl->x;
ud->to_y = bl->y;
}
return 0;
}
-int unit_delay_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data)
-{
- struct block_list *bl = iMap->id2bl(id);
+int unit_delay_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data) {
+ struct block_list *bl = map->id2bl(id);
if (!bl || bl->prev == NULL)
return 0;
@@ -363,8 +360,8 @@ int unit_walktoxy( struct block_list *bl, short x, short y, int flag)
return 0;
if (flag&4 && DIFF_TICK(ud->canmove_tick, timer->gettick()) > 0 &&
- DIFF_TICK(ud->canmove_tick, timer->gettick()) < 2000)
- { // Delay walking command. [Skotlex]
+ DIFF_TICK(ud->canmove_tick, timer->gettick()) < 2000) {
+ // Delay walking command. [Skotlex]
timer->add(ud->canmove_tick+1, unit->delay_walktoxy_timer, bl->id, (x<<16)|(y&0xFFFF));
return 1;
}
@@ -379,7 +376,7 @@ int unit_walktoxy( struct block_list *bl, short x, short y, int flag)
sc = status->get_sc(bl);
if (sc && sc->data[SC_CONFUSION]) //Randomize the target position
- iMap->random_dir(bl, &ud->to_x, &ud->to_y);
+ map->random_dir(bl, &ud->to_x, &ud->to_y);
if(ud->walktimer != INVALID_TIMER) {
// When you come to the center of the grid because the change of destination while you're walking right now
@@ -405,17 +402,14 @@ static inline void set_mobstate(struct block_list* bl, int flag)
md->state.skillstate = md->state.aggressive ? MSS_FOLLOW : MSS_RUSH;
}
-int unit_walktobl_sub(int tid, unsigned int tick, int id, intptr_t data)
-{
- struct block_list *bl = iMap->id2bl(id);
+int unit_walktobl_sub(int tid, unsigned int tick, int id, intptr_t data) {
+ struct block_list *bl = map->id2bl(id);
struct unit_data *ud = bl?unit->bl2ud(bl):NULL;
- if (ud && ud->walktimer == INVALID_TIMER && ud->target == data)
- {
+ if (ud && ud->walktimer == INVALID_TIMER && ud->target == data) {
if (DIFF_TICK(ud->canmove_tick, tick) > 0) //Keep waiting?
timer->add(ud->canmove_tick+1, unit->walktobl_sub, id, data);
- else if (unit->can_move(bl))
- {
+ else if (unit->can_move(bl)) {
if (unit->walktoxy_sub(bl))
set_mobstate(bl, ud->state.attack_continue);
}
@@ -454,7 +448,7 @@ int unit_walktobl(struct block_list *bl, struct block_list *tbl, int range, int
sc = status->get_sc(bl);
if (sc && sc->data[SC_CONFUSION]) //Randomize the target position
- iMap->random_dir(bl, &ud->to_x, &ud->to_y);
+ map->random_dir(bl, &ud->to_x, &ud->to_y);
if(ud->walktimer != INVALID_TIMER) {
ud->state.change_walk_target = 1;
@@ -504,13 +498,12 @@ int unit_run(struct block_list *bl) {
// determine destination cell
to_x = bl->x;
to_y = bl->y;
- for(i=0;i<AREA_SIZE;i++)
- {
- if(!iMap->getcell(bl->m,to_x+dir_x,to_y+dir_y,CELL_CHKPASS))
+ for(i=0;i<AREA_SIZE;i++) {
+ if(!map->getcell(bl->m,to_x+dir_x,to_y+dir_y,CELL_CHKPASS))
break;
//if sprinting and there's a PC/Mob/NPC, block the path [Kevin]
- if(sc->data[SC_RUN] && iMap->count_oncell(bl->m, to_x+dir_x, to_y+dir_y, BL_PC|BL_MOB|BL_NPC))
+ if(sc->data[SC_RUN] && map->count_oncell(bl->m, to_x+dir_x, to_y+dir_y, BL_PC|BL_MOB|BL_NPC))
break;
to_x += dir_x;
@@ -576,12 +569,11 @@ int unit_wugdash(struct block_list *bl, struct map_session_data *sd) {
to_x = bl->x;
to_y = bl->y;
- for(i=0;i<AREA_SIZE;i++)
- {
- if(!iMap->getcell(bl->m,to_x+dir_x,to_y+dir_y,CELL_CHKPASS))
+ for(i=0;i<AREA_SIZE;i++) {
+ if(!map->getcell(bl->m,to_x+dir_x,to_y+dir_y,CELL_CHKPASS))
break;
- if(sc->data[SC_WUGDASH] && iMap->count_oncell(bl->m, to_x+dir_x, to_y+dir_y, BL_PC|BL_MOB|BL_NPC))
+ if(sc->data[SC_WUGDASH] && map->count_oncell(bl->m, to_x+dir_x, to_y+dir_y, BL_PC|BL_MOB|BL_NPC))
break;
to_x += dir_x;
@@ -620,17 +612,15 @@ int unit_wugdash(struct block_list *bl, struct map_session_data *sd) {
}
//Makes bl attempt to run dist cells away from target. Uses hard-paths.
-int unit_escape(struct block_list *bl, struct block_list *target, short dist)
-{
- uint8 dir = iMap->calc_dir(target, bl->x, bl->y);
- while( dist > 0 && iMap->getcell(bl->m, bl->x + dist*dirx[dir], bl->y + dist*diry[dir], CELL_CHKNOREACH) )
+int unit_escape(struct block_list *bl, struct block_list *target, short dist) {
+ uint8 dir = map->calc_dir(target, bl->x, bl->y);
+ while( dist > 0 && map->getcell(bl->m, bl->x + dist*dirx[dir], bl->y + dist*diry[dir], CELL_CHKNOREACH) )
dist--;
return ( dist > 0 && unit->walktoxy(bl, bl->x + dist*dirx[dir], bl->y + dist*diry[dir], 0) );
}
//Instant warp function.
-int unit_movepos(struct block_list *bl, short dst_x, short dst_y, int easy, bool checkpath)
-{
+int unit_movepos(struct block_list *bl, short dst_x, short dst_y, int easy, bool checkpath) {
short dx,dy;
uint8 dir;
struct unit_data *ud = NULL;
@@ -645,30 +635,30 @@ int unit_movepos(struct block_list *bl, short dst_x, short dst_y, int easy, bool
unit->stop_walking(bl,1);
unit->stop_attack(bl);
- if( checkpath && (iMap->getcell(bl->m,dst_x,dst_y,CELL_CHKNOPASS) || !path->search(NULL,bl->m,bl->x,bl->y,dst_x,dst_y,easy,CELL_CHKNOREACH)) )
+ if( checkpath && (map->getcell(bl->m,dst_x,dst_y,CELL_CHKNOPASS) || !path->search(NULL,bl->m,bl->x,bl->y,dst_x,dst_y,easy,CELL_CHKNOREACH)) )
return 0; // unreachable
ud->to_x = dst_x;
ud->to_y = dst_y;
- dir = iMap->calc_dir(bl, dst_x, dst_y);
+ dir = map->calc_dir(bl, dst_x, dst_y);
ud->dir = dir;
dx = dst_x - bl->x;
dy = dst_y - bl->y;
- iMap->foreachinmovearea(clif->outsight, bl, AREA_SIZE, dx, dy, sd?BL_ALL:BL_PC, bl);
+ map->foreachinmovearea(clif->outsight, bl, AREA_SIZE, dx, dy, sd?BL_ALL:BL_PC, bl);
- iMap->moveblock(bl, dst_x, dst_y, timer->gettick());
+ map->moveblock(bl, dst_x, dst_y, timer->gettick());
ud->walktimer = -2; // arbitrary non-INVALID_TIMER value to make the clif code send walking packets
- iMap->foreachinmovearea(clif->insight, bl, AREA_SIZE, -dx, -dy, sd?BL_ALL:BL_PC, bl);
+ map->foreachinmovearea(clif->insight, bl, AREA_SIZE, -dx, -dy, sd?BL_ALL:BL_PC, bl);
ud->walktimer = INVALID_TIMER;
if(sd) {
if( sd->touching_id )
npc->touchnext_areanpc(sd,false);
- if(iMap->getcell(bl->m,bl->x,bl->y,CELL_CHKNPC)) {
+ if(map->getcell(bl->m,bl->x,bl->y,CELL_CHKNPC)) {
npc->touch_areanpc(sd,bl->m,bl->x,bl->y);
if (bl->prev == NULL) //Script could have warped char, abort remaining of the function.
return 0;
@@ -749,15 +739,15 @@ int unit_blown(struct block_list* bl, int dx, int dy, int count, int flag)
dy = ny-bl->y;
if(dx || dy) {
- iMap->foreachinmovearea(clif->outsight, bl, AREA_SIZE, dx, dy, bl->type == BL_PC ? BL_ALL : BL_PC, bl);
+ map->foreachinmovearea(clif->outsight, bl, AREA_SIZE, dx, dy, bl->type == BL_PC ? BL_ALL : BL_PC, bl);
if(su) {
skill->unit_move_unit_group(su->group, bl->m, dx, dy);
} else {
- iMap->moveblock(bl, nx, ny, timer->gettick());
+ map->moveblock(bl, nx, ny, timer->gettick());
}
- iMap->foreachinmovearea(clif->insight, bl, AREA_SIZE, -dx, -dy, bl->type == BL_PC ? BL_ALL : BL_PC, bl);
+ map->foreachinmovearea(clif->insight, bl, AREA_SIZE, -dx, -dy, bl->type == BL_PC ? BL_ALL : BL_PC, bl);
if(!(flag&1)) {
clif->blown(bl);
@@ -767,7 +757,7 @@ int unit_blown(struct block_list* bl, int dx, int dy, int count, int flag)
if(sd->touching_id) {
npc->touchnext_areanpc(sd, false);
}
- if(iMap->getcell(bl->m, bl->x, bl->y, CELL_CHKNPC)) {
+ if(map->getcell(bl->m, bl->x, bl->y, CELL_CHKNPC)) {
npc->touch_areanpc(sd, bl->m, bl->x, bl->y);
} else {
sd->areanpc_id = 0;
@@ -815,16 +805,16 @@ int unit_warp(struct block_list *bl,short m,short x,short y,clr_type type)
if (x<0 || y<0) {
//Random map position.
- if (!iMap->search_freecell(NULL, m, &x, &y, -1, -1, 1)) {
+ if (!map->search_freecell(NULL, m, &x, &y, -1, -1, 1)) {
ShowWarning("unit_warp failed. Unit Id:%d/Type:%d, target position map %d (%s) at [%d,%d]\n", bl->id, bl->type, m, maplist[m].name, x, y);
return 2;
}
- } else if (iMap->getcell(m,x,y,CELL_CHKNOREACH)) {
+ } else if (map->getcell(m,x,y,CELL_CHKNOREACH)) {
//Invalid target cell
ShowWarning("unit_warp: Specified non-walkable target cell: %d (%s) at [%d,%d]\n", m, maplist[m].name, x,y);
- if (!iMap->search_freecell(NULL, m, &x, &y, 4, 4, 1)) {
+ if (!map->search_freecell(NULL, m, &x, &y, 4, 4, 1)) {
//Can't find a nearby cell
ShowWarning("unit_warp failed. Unit Id:%d/Type:%d, target position map %d (%s) at [%d,%d]\n", bl->id, bl->type, m, maplist[m].name, x, y);
return 2;
@@ -845,7 +835,7 @@ int unit_warp(struct block_list *bl,short m,short x,short y,clr_type type)
bl->y=ud->to_y=y;
bl->m=m;
- iMap->addblock(bl);
+ map->addblock(bl);
clif->spawn(bl);
skill->unit_move(bl,timer->gettick(),1);
@@ -1014,7 +1004,7 @@ int unit_can_move(struct block_list *bl) {
int unit_resume_running(int tid, unsigned int tick, int id, intptr_t data) {
struct unit_data *ud = (struct unit_data *)data;
- TBL_PC * sd = iMap->id2sd(id);
+ TBL_PC * sd = map->id2sd(id);
if(sd && pc_isridingwug(sd))
clif->skill_nodamage(ud->bl,ud->bl,RA_WUGDASH,ud->skill_lv,
@@ -1124,8 +1114,8 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui
switch(skill_id) { //Check for skills that auto-select target
case MO_CHAINCOMBO:
- if (sc && sc->data[SC_BLADESTOP]){
- if ((target=iMap->id2bl(sc->data[SC_BLADESTOP]->val4)) == NULL)
+ if (sc && sc->data[SC_BLADESTOP]) {
+ if ((target=map->id2bl(sc->data[SC_BLADESTOP]->val4)) == NULL)
return 0;
}
break;
@@ -1133,7 +1123,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui
case WE_FEMALE:
if (!sd->status.partner_id)
return 0;
- target = (struct block_list*)iMap->charid2sd(sd->status.partner_id);
+ target = (struct block_list*)map->charid2sd(sd->status.partner_id);
if (!target) {
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
return 0;
@@ -1156,7 +1146,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui
}
if( !target ) // choose default target
- target = iMap->id2bl(target_id);
+ target = map->id2bl(target_id);
if( !target || src->m != target->m || !src->prev || !target->prev )
return 0;
@@ -1334,7 +1324,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui
case NC_DISJOINT:
if( target->type == BL_PC ){
struct mob_data *md;
- if( (md = iMap->id2md(target->id)) && md->master_id != src->id )
+ if( (md = map->id2md(target->id)) && md->master_id != src->id )
casttime <<= 1;
}
break;
@@ -1474,11 +1464,11 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, ui
* "WHY IS IT HEREE": pneuma cannot be cancelled past this point, the client displays the animation even,
* if we cancel it from nodamage_id, so it has to be here for it to not display the animation.
**/
- if( skill_id == AL_PNEUMA && iMap->getcell(src->m, skill_x, skill_y, CELL_CHKLANDPROTECTOR) ) {
+ if( skill_id == AL_PNEUMA && map->getcell(src->m, skill_x, skill_y, CELL_CHKLANDPROTECTOR) ) {
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
return 0;
}
- if( (skill_id >= SC_MANHOLE && skill_id <= SC_FEINTBOMB) && iMap->getcell(src->m, skill_x, skill_y, CELL_CHKMAELSTROM) ) {
+ if( (skill_id >= SC_MANHOLE && skill_id <= SC_FEINTBOMB) && map->getcell(src->m, skill_x, skill_y, CELL_CHKMAELSTROM) ) {
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
return 0;
}
@@ -1487,8 +1477,8 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, ui
if (!status->check_skilluse(src, NULL, skill_id, 0))
return 0;
- if( iMap->getcell(src->m, skill_x, skill_y, CELL_CHKWALL) )
- {// can't cast ground targeted spells on wall cells
+ if( map->getcell(src->m, skill_x, skill_y, CELL_CHKWALL) ) {
+ // can't cast ground targeted spells on wall cells
if (sd) clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
return 0;
}
@@ -1579,9 +1569,9 @@ int unit_set_target(struct unit_data* ud, int target_id)
nullpo_ret(ud);
if( ud->target != target_id ) {
- if( ud->target && (target = iMap->id2bl(ud->target)) && (ux = unit->bl2ud(target)) && ux->target_count > 0 )
+ if( ud->target && (target = map->id2bl(ud->target)) && (ux = unit->bl2ud(target)) && ux->target_count > 0 )
ux->target_count --;
- if( target_id && (target = iMap->id2bl(target_id)) && (ux = unit->bl2ud(target)) )
+ if( target_id && (target = map->id2bl(target_id)) && (ux = unit->bl2ud(target)) )
ux->target_count ++;
}
@@ -1623,14 +1613,13 @@ int unit_unattackable(struct block_list *bl)
* Attack request
* If type is an ongoing attack
*------------------------------------------*/
-int unit_attack(struct block_list *src,int target_id,int continuous)
-{
+int unit_attack(struct block_list *src,int target_id,int continuous) {
struct block_list *target;
struct unit_data *ud;
nullpo_ret(ud = unit->bl2ud(src));
- target = iMap->id2bl(target_id);
+ target = map->id2bl(target_id);
if( target==NULL || status->isdead(target) ) {
unit->unattackable(src);
return 1;
@@ -1733,9 +1722,9 @@ bool unit_can_reach_bl(struct block_list *bl,struct block_list *tbl, int range,
dx=(dx>0)?1:((dx<0)?-1:0);
dy=(dy>0)?1:((dy<0)?-1:0);
- if (iMap->getcell(tbl->m,tbl->x-dx,tbl->y-dy,CELL_CHKNOPASS))
- { //Look for a suitable cell to place in.
- for(i=0;i<9 && iMap->getcell(tbl->m,tbl->x-dirx[i],tbl->y-diry[i],CELL_CHKNOPASS);i++);
+ if (map->getcell(tbl->m,tbl->x-dx,tbl->y-dy,CELL_CHKNOPASS)) {
+ //Look for a suitable cell to place in.
+ for(i=0;i<9 && map->getcell(tbl->m,tbl->x-dirx[i],tbl->y-diry[i],CELL_CHKNOPASS);i++);
if (i==9) return false; //No valid cells.
dx = dirx[i];
dy = diry[i];
@@ -1826,7 +1815,7 @@ int unit_attack_timer_sub(struct block_list* src, int tid, unsigned int tick)
sd = BL_CAST(BL_PC, src);
md = BL_CAST(BL_MOB, src);
ud->attacktimer = INVALID_TIMER;
- target=iMap->id2bl(ud->target);
+ target=map->id2bl(ud->target);
if( src == NULL || src->prev == NULL || target==NULL || target->prev == NULL )
return 0;
@@ -1877,7 +1866,7 @@ int unit_attack_timer_sub(struct block_list* src, int tid, unsigned int tick)
return 1;
}
if( !battle->check_range(src,target,range) ) {
- //Within range, but no direct line of attack
+ //Within range, but no direct line of attack
if( ud->state.attack_continue ) {
if(ud->chaserange > 2) ud->chaserange-=2;
unit->walktobl(src,target,ud->chaserange,ud->state.walk_easy|2);
@@ -1888,10 +1877,9 @@ int unit_attack_timer_sub(struct block_list* src, int tid, unsigned int tick)
//Non-players use the sync packet on the walk timer. [Skotlex]
if (tid == INVALID_TIMER && sd) clif->fixpos(src);
- if( DIFF_TICK(ud->attackabletime,tick) <= 0 )
- {
+ if( DIFF_TICK(ud->attackabletime,tick) <= 0 ) {
if (battle_config.attack_direction_change && (src->type&battle_config.attack_direction_change)) {
- ud->dir = iMap->calc_dir(src, target->x,target->y );
+ ud->dir = map->calc_dir(src, target->x,target->y );
}
if(ud->walktimer != INVALID_TIMER)
unit->stop_walking(src,1);
@@ -1901,18 +1889,18 @@ int unit_attack_timer_sub(struct block_list* src, int tid, unsigned int tick)
if (sstatus->mode&MD_ASSIST && DIFF_TICK(md->last_linktime, tick) < MIN_MOBLINKTIME)
{ // Link monsters nearby [Skotlex]
md->last_linktime = tick;
- iMap->foreachinrange(mob->linksearch, src, md->db->range2, BL_MOB, md->class_, target, tick);
+ map->foreachinrange(mob->linksearch, src, md->db->range2, BL_MOB, md->class_, target, tick);
}
}
if(src->type == BL_PET && pet->attackskill((TBL_PET*)src, target->id))
return 1;
- iMap->freeblock_lock();
+ map->freeblock_lock();
ud->attacktarget_lv = battle->weapon_attack(src,target,tick,0);
if(sd && sd->status.pet_id > 0 && sd->pd && battle_config.pet_attack_support)
pet->target_check(sd,target,0);
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
/**
* Applied when you're unable to attack (e.g. out of ammo)
* We should stop here otherwise timer keeps on and this happens endlessly
@@ -1935,10 +1923,9 @@ int unit_attack_timer_sub(struct block_list* src, int tid, unsigned int tick)
return 1;
}
-int unit_attack_timer(int tid, unsigned int tick, int id, intptr_t data)
-{
+int unit_attack_timer(int tid, unsigned int tick, int id, intptr_t data) {
struct block_list *bl;
- bl = iMap->id2bl(id);
+ bl = map->id2bl(id);
if(bl && unit->attack_timer_sub(bl, tid, tick) == 0)
unit->unattackable(bl);
return 0;
@@ -2079,7 +2066,7 @@ int unit_remove_map(struct block_list *bl, clr_type clrtype, const char* file, i
if(bl->prev == NULL)
return 0; //Already removed?
- iMap->freeblock_lock();
+ map->freeblock_lock();
unit->set_target(ud, 0);
@@ -2108,8 +2095,7 @@ int unit_remove_map(struct block_list *bl, clr_type clrtype, const char* file, i
status_change_end(bl, SC_RG_CCONFINE_S, INVALID_TIMER);
status_change_end(bl, SC_HIDING, INVALID_TIMER);
// Ensure the bl is a PC; if so, we'll handle the removal of cloaking and cloaking exceed later
- if ( bl->type != BL_PC )
- {
+ if ( bl->type != BL_PC ) {
status_change_end(bl, SC_CLOAKING, INVALID_TIMER);
status_change_end(bl, SC_CLOAKINGEXCEED, INVALID_TIMER);
}
@@ -2135,10 +2121,10 @@ int unit_remove_map(struct block_list *bl, clr_type clrtype, const char* file, i
case BL_PC: {
struct map_session_data *sd = (struct map_session_data*)bl;
- if(sd->shadowform_id){
- struct block_list *d_bl = iMap->id2bl(sd->shadowform_id);
- if( d_bl )
- status_change_end(d_bl,SC__SHADOWFORM,INVALID_TIMER);
+ if(sd->shadowform_id) {
+ struct block_list *d_bl = map->id2bl(sd->shadowform_id);
+ if( d_bl )
+ status_change_end(d_bl,SC__SHADOWFORM,INVALID_TIMER);
}
//Leave/reject all invitations.
if(sd->chatID)
@@ -2204,8 +2190,8 @@ int unit_remove_map(struct block_list *bl, clr_type clrtype, const char* file, i
sd->state.active, sd->state.connect_new, sd->state.rewarp, sd->state.changemap, sd->state.debug_remove_map,
maplist[bl->m].name, maplist[bl->m].users,
sd->debug_file, sd->debug_line, sd->debug_func, file, line, func);
- } else if (--maplist[bl->m].users == 0 && battle_config.dynamic_mobs) //[Skotlex]
- iMap->removemobs(bl->m);
+ } else if (--maplist[bl->m].users == 0 && battle_config.dynamic_mobs) //[Skotlex]
+ map->removemobs(bl->m);
if( !(sd->sc.option&OPTION_INVISIBLE) ) {
// decrement the number of active pvp players on the map
--maplist[bl->m].users_pvp;
@@ -2234,12 +2220,12 @@ int unit_remove_map(struct block_list *bl, clr_type clrtype, const char* file, i
}
case BL_PET: {
struct pet_data *pd = (struct pet_data*)bl;
- if( pd->pet.intimate <= 0 && !(pd->msd && !pd->msd->state.active) )
- { //If logging out, this is deleted on unit->free
+ if( pd->pet.intimate <= 0 && !(pd->msd && !pd->msd->state.active) ) {
+ //If logging out, this is deleted on unit->free
clif->clearunit_area(bl,clrtype);
- iMap->delblock(bl);
+ map->delblock(bl);
unit->free(bl,CLR_OUTSIGHT);
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return 0;
}
@@ -2248,13 +2234,13 @@ int unit_remove_map(struct block_list *bl, clr_type clrtype, const char* file, i
case BL_HOM: {
struct homun_data *hd = (struct homun_data *)bl;
ud->canact_tick = ud->canmove_tick; //It appears HOM do reset the can-act tick.
- if( !hd->homunculus.intimacy && !(hd->master && !hd->master->state.active) )
- { //If logging out, this is deleted on unit->free
+ if( !hd->homunculus.intimacy && !(hd->master && !hd->master->state.active) ) {
+ //If logging out, this is deleted on unit->free
clif->emotion(bl, E_SOB);
clif->clearunit_area(bl,clrtype);
- iMap->delblock(bl);
+ map->delblock(bl);
unit->free(bl,CLR_OUTSIGHT);
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return 0;
}
break;
@@ -2262,12 +2248,11 @@ int unit_remove_map(struct block_list *bl, clr_type clrtype, const char* file, i
case BL_MER: {
struct mercenary_data *md = (struct mercenary_data *)bl;
ud->canact_tick = ud->canmove_tick;
- if( mercenary->get_lifetime(md) <= 0 && !(md->master && !md->master->state.active) )
- {
+ if( mercenary->get_lifetime(md) <= 0 && !(md->master && !md->master->state.active) ) {
clif->clearunit_area(bl,clrtype);
- iMap->delblock(bl);
+ map->delblock(bl);
unit->free(bl,CLR_OUTSIGHT);
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return 0;
}
break;
@@ -2275,12 +2260,11 @@ int unit_remove_map(struct block_list *bl, clr_type clrtype, const char* file, i
case BL_ELEM: {
struct elemental_data *ed = (struct elemental_data *)bl;
ud->canact_tick = ud->canmove_tick;
- if( elemental->get_lifetime(ed) <= 0 && !(ed->master && !ed->master->state.active) )
- {
+ if( elemental->get_lifetime(ed) <= 0 && !(ed->master && !ed->master->state.active) ) {
clif->clearunit_area(bl,clrtype);
- iMap->delblock(bl);
+ map->delblock(bl);
unit->free(bl,0);
- iMap->freeblock_unlock();
+ map->freeblock_unlock();
return 0;
}
break;
@@ -2292,8 +2276,8 @@ int unit_remove_map(struct block_list *bl, clr_type clrtype, const char* file, i
**/
if( bl->type != BL_MOB || !status->isdead(bl) )
clif->clearunit_area(bl,clrtype);
- iMap->delblock(bl);
- iMap->freeblock_unlock();
+ map->delblock(bl);
+ map->freeblock_unlock();
return 1;
}
@@ -2326,12 +2310,11 @@ void unit_free_pc(struct map_session_data *sd)
* Function to free all related resources to the bl
* if unit is on map, it is removed using the clrtype specified
*------------------------------------------*/
-int unit_free(struct block_list *bl, clr_type clrtype)
-{
+int unit_free(struct block_list *bl, clr_type clrtype) {
struct unit_data *ud = unit->bl2ud( bl );
nullpo_ret(ud);
- iMap->freeblock_lock();
+ map->freeblock_lock();
if( bl->prev ) //Players are supposed to logout with a "warp" effect.
unit->remove_map(bl, clrtype, ALC_MARK);
@@ -2357,7 +2340,7 @@ int unit_free(struct block_list *bl, clr_type clrtype)
duel->reject(sd->duel_invite, sd);
// Notify friends that this char logged out. [Skotlex]
- iMap->map_foreachpc(clif->friendslist_toggle_sub, sd->status.account_id, sd->status.char_id, 0);
+ map->map_foreachpc(clif->friendslist_toggle_sub, sd->status.account_id, sd->status.char_id, 0);
party->send_logout(sd);
guild->send_memberinfoshort(sd,0);
pc->cleareventtimer(sd);
@@ -2585,10 +2568,10 @@ int unit_free(struct block_list *bl, clr_type clrtype)
skill->clear_unitgroup(bl);
status->change_clear(bl,1);
- iMap->deliddb(bl);
+ map->deliddb(bl);
if( bl->type != BL_PC ) //Players are handled by map_quit
- iMap->freeblock(bl);
- iMap->freeblock_unlock();
+ map->freeblock(bl);
+ map->freeblock_unlock();
return 0;
}
diff --git a/src/map/vending.c b/src/map/vending.c
index 32e084a87..7d6d02cfb 100644
--- a/src/map/vending.c
+++ b/src/map/vending.c
@@ -48,7 +48,7 @@ void vending_vendinglistreq(struct map_session_data* sd, unsigned int id) {
struct map_session_data* vsd;
nullpo_retv(sd);
- if( (vsd = iMap->id2sd(id)) == NULL )
+ if( (vsd = map->id2sd(id)) == NULL )
return;
if( !vsd->state.vending )
return; // not vending
@@ -71,7 +71,7 @@ void vending_purchasereq(struct map_session_data* sd, int aid, unsigned int uid,
int i, j, cursor, w, new_ = 0, blank, vend_list[MAX_VENDING];
double z;
struct s_vending vend[MAX_VENDING]; // against duplicate packets
- struct map_session_data* vsd = iMap->id2sd(aid);
+ struct map_session_data* vsd = map->id2sd(aid);
nullpo_retv(sd);
if( vsd == NULL || !vsd->state.vending || vsd->bl.id == sd->bl.id )
@@ -199,7 +199,7 @@ void vending_purchasereq(struct map_session_data* sd, int aid, unsigned int uid,
vsd->vend_num = cursor;
//Always save BOTH: buyer and customer
- if( iMap->save_settings&2 ) {
+ if( map->save_settings&2 ) {
chrif->save(sd,0);
chrif->save(vsd,0);
}
@@ -211,7 +211,7 @@ void vending_purchasereq(struct map_session_data* sd, int aid, unsigned int uid,
if( i == vsd->vend_num ) {
//Close Vending (this was automatically done by the client, we have to do it manually for autovenders) [Skotlex]
vending->close(vsd);
- iMap->quit(vsd); //They have no reason to stay around anymore, do they?
+ map->quit(vsd); //They have no reason to stay around anymore, do they?
}
}
}