summaryrefslogtreecommitdiff
path: root/src/map/atcommand.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r--src/map/atcommand.c602
1 files changed, 317 insertions, 285 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 65da7aa24..b6a9e42ee 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -403,17 +403,17 @@ ACMD(mapmove)
mapindex = mapindex_name2id(map_name);
if (mapindex)
- m = map_mapindex2mapid(mapindex);
+ m = iMap->mapindex2mapid(mapindex);
if (!mapindex) { // m < 0 means on different server! [Kevin]
clif->message(fd, msg_txt(1)); // Map not found.
return false;
}
- 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.
+ 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.
clif->message(fd, msg_txt(2));
- if (!map_search_freecell(NULL, m, &x, &y, 10, 10, 1))
+ if (!iMap->search_freecell(NULL, m, &x, &y, 10, 10, 1))
x = y = 0; //Invalid cell, use random spot.
}
if (map[m].flag.nowarpto && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) {
@@ -424,7 +424,7 @@ ACMD(mapmove)
clif->message(fd, msg_txt(248));
return false;
}
- if (pc_setpos(sd, mapindex, x, y, CLR_TELEPORT) != 0) {
+ if (pc->setpos(sd, mapindex, x, y, CLR_TELEPORT) != 0) {
clif->message(fd, msg_txt(1)); // Map not found.
return false;
}
@@ -448,10 +448,10 @@ ACMD(where)
return false;
}
- pl_sd = map_nick2sd(atcmd_player_name);
+ pl_sd = iMap->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))
+ (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))
) {
clif->message(fd, msg_txt(3)); // Character not found.
return false;
@@ -477,7 +477,7 @@ ACMD(jumpto)
return false;
}
- if((pl_sd=map_nick2sd((char *)message)) == NULL && (pl_sd=map_charid2sd(atoi(message))) == NULL)
+ if((pl_sd=iMap->nick2sd((char *)message)) == NULL && (pl_sd=iMap->charid2sd(atoi(message))) == NULL)
{
clif->message(fd, msg_txt(3)); // Character not found.
return false;
@@ -501,7 +501,7 @@ ACMD(jumpto)
return false;
}
- pc_setpos(sd, pl_sd->mapindex, pl_sd->bl.x, pl_sd->bl.y, CLR_TELEPORT);
+ pc->setpos(sd, pl_sd->mapindex, pl_sd->bl.x, pl_sd->bl.y, CLR_TELEPORT);
sprintf(atcmd_output, msg_txt(4), pl_sd->status.name); // Jumped to %s
clif->message(fd, atcmd_output);
@@ -532,14 +532,14 @@ ACMD(jump)
return false;
}
- if ((x || y) && map_getcell(sd->bl.m, x, y, CELL_CHKNOPASS))
- { //This is to prevent the pc_setpos call from printing an error.
+ if ((x || y) && iMap->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 (!map_search_freecell(NULL, sd->bl.m, &x, &y, 10, 10, 1))
+ if (!iMap->search_freecell(NULL, sd->bl.m, &x, &y, 10, 10, 1))
x = y = 0; //Invalid cell, use random spot.
}
- pc_setpos(sd, sd->mapindex, x, y, CLR_TELEPORT);
+ pc->setpos(sd, sd->mapindex, x, y, CLR_TELEPORT);
sprintf(atcmd_output, msg_txt(5), sd->bl.x, sd->bl.y); // Jumped to %d %d
clif->message(fd, atcmd_output);
return true;
@@ -569,7 +569,7 @@ ACMD(who)
nullpo_retr(-1, sd);
if (strstr(command, "map") != NULL) {
- if (sscanf(message, "%15s %23s", map_name, player_name) < 1 || (map_id = map_mapname2mapid(map_name)) < 0)
+ if (sscanf(message, "%15s %23s", map_name, player_name) < 1 || (map_id = iMap->mapname2mapid(map_name)) < 0)
map_id = sd->bl.m;
} else {
sscanf(message, "%23s", player_name);
@@ -580,12 +580,12 @@ ACMD(who)
else if (strstr(command, "3") != NULL)
display_type = 3;
- level = pc_get_group_level(sd);
+ level = pc->get_group_level(sd);
StrBuf->Init(&buf);
iter = mapit_getallusers();
for (pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter)) {
- if (!((pc_has_permission(pl_sd, PC_PERM_HIDE_SESSION) || (pl_sd->sc.option & OPTION_INVISIBLE)) && pc_get_group_level(pl_sd) > level)) { // you can look only lower or same level
+ if (!((pc_has_permission(pl_sd, PC_PERM_HIDE_SESSION) || (pl_sd->sc.option & OPTION_INVISIBLE)) && pc->get_group_level(pl_sd) > level)) { // you can look only lower or same level
if (stristr(pl_sd->status.name, player_name) == NULL // search with no case sensitive
|| (map_id >= 0 && pl_sd->bl.m != map_id))
continue;
@@ -595,7 +595,7 @@ ACMD(who)
if (pc_get_group_id(pl_sd) > 0) // Player title, if exists
StrBuf->Printf(&buf, msg_txt(344), pc_group_id2name(pc_get_group_id(pl_sd))); // "(%s) "
StrBuf->Printf(&buf, msg_txt(347), pl_sd->status.base_level, pl_sd->status.job_level,
- job_name(pl_sd->status.class_)); // "| Lv:%d/%d | Job: %s"
+ pc->job_name(pl_sd->status.class_)); // "| Lv:%d/%d | Job: %s"
break;
}
case 3: {
@@ -608,7 +608,7 @@ ACMD(who)
break;
}
default: {
- struct party_data *p = party_search(pl_sd->status.party_id);
+ struct party_data *p = party->search(pl_sd->status.party_id);
struct guild *g = pl_sd->guild;
StrBuf->Printf(&buf, msg_txt(343), pl_sd->status.name); // "Name: %s "
@@ -674,12 +674,12 @@ ACMD(whogm)
match_text[j] = TOLOWER(match_text[j]);
count = 0;
- level = pc_get_group_level(sd);
+ level = pc->get_group_level(sd);
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) )
{
- pl_level = pc_get_group_level(pl_sd);
+ pl_level = pc->get_group_level(pl_sd);
if (!pl_level)
continue;
@@ -708,10 +708,10 @@ ACMD(whogm)
sprintf(atcmd_output, msg_txt(915), // BLvl: %d | Job: %s (Lvl: %d)
pl_sd->status.base_level,
- job_name(pl_sd->status.class_), pl_sd->status.job_level);
+ pc->job_name(pl_sd->status.class_), pl_sd->status.job_level);
clif->message(fd, atcmd_output);
- p = party_search(pl_sd->status.party_id);
+ p = party->search(pl_sd->status.party_id);
g = pl_sd->guild;
sprintf(atcmd_output,msg_txt(916), // Party: '%s' | Guild: '%s'
@@ -741,7 +741,7 @@ ACMD(save)
{
nullpo_retr(-1, sd);
- pc_setsavepoint(sd, sd->mapindex, sd->bl.x, sd->bl.y);
+ pc->setsavepoint(sd, sd->mapindex, sd->bl.x, sd->bl.y);
if (sd->status.pet_id > 0 && sd->pd)
intif_save_petdata(sd->status.account_id, &sd->pd->pet);
@@ -761,7 +761,7 @@ ACMD(load)
nullpo_retr(-1, sd);
- m = map_mapindex2mapid(sd->status.save_point.map);
+ m = iMap->mapindex2mapid(sd->status.save_point.map);
if (m >= 0 && map[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;
@@ -771,7 +771,7 @@ ACMD(load)
return false;
}
- pc_setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, CLR_OUTSIGHT);
+ pc->setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, CLR_OUTSIGHT);
clif->message(fd, msg_txt(7)); // Warping to save point..
return true;
@@ -885,7 +885,7 @@ ACMD(option)
sd->sc.opt1 = param1;
sd->sc.opt2 = param2;
- pc_setoption(sd, param3);
+ pc->setoption(sd, param3);
clif->message(fd, msg_txt(9)); // Options changed.
@@ -911,10 +911,10 @@ ACMD(hide)
if( map[sd->bl.m].flag.pvp && !map[sd->bl.m].flag.pvp_nocalcrank )
{// register the player for ranking calculations
- sd->pvp_timer = add_timer( gettick() + 200, pc_calc_pvprank_timer, sd->bl.id, 0 );
+ sd->pvp_timer = iTimer->add_timer( iTimer->gettick() + 200, pc->calc_pvprank_timer, sd->bl.id, 0 );
}
//bugreport:2266
- map_foreachinmovearea(clif->insight, &sd->bl, AREA_SIZE, sd->bl.x, sd->bl.y, BL_ALL, &sd->bl);
+ iMap->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;
@@ -925,7 +925,7 @@ ACMD(hide)
if( map[sd->bl.m].flag.pvp && !map[sd->bl.m].flag.pvp_nocalcrank && sd->pvp_timer != INVALID_TIMER )
{// unregister the player for ranking
- delete_timer( sd->pvp_timer, pc_calc_pvprank_timer );
+ iTimer->delete_timer( sd->pvp_timer, pc->calc_pvprank_timer );
sd->pvp_timer = INVALID_TIMER;
}
}
@@ -951,7 +951,7 @@ ACMD(jobchange)
// Normal Jobs
for( i = JOB_NOVICE; i < JOB_MAX_BASIC && !found; i++ ){
- if (strncmpi(message, job_name(i), 16) == 0) {
+ if (strncmpi(message, pc->job_name(i), 16) == 0) {
job = i;
found = true;
}
@@ -959,7 +959,7 @@ ACMD(jobchange)
// High Jobs, Babys and Third
for( i = JOB_NOVICE_HIGH; i < JOB_MAX && !found; i++ ){
- if (strncmpi(message, job_name(i), 16) == 0) {
+ if (strncmpi(message, pc->job_name(i), 16) == 0) {
job = i;
found = true;
}
@@ -982,7 +982,7 @@ ACMD(jobchange)
if (pcdb_checkid(job))
{
- if (pc_jobchange(sd, job, upper) == 0)
+ if (pc->jobchange(sd, job, upper) == 0)
clif->message(fd, msg_txt(12)); // Your job has been changed.
else {
clif->message(fd, msg_txt(155)); // You are unable to change your job.
@@ -1095,7 +1095,7 @@ ACMD(heal)
if ( hp < 0 && sp <= 0 ) {
status_damage(NULL, &sd->bl, -hp, -sp, 0, 0);
- clif->damage(&sd->bl,&sd->bl, gettick(), 0, 0, -hp, 0, 4, 0);
+ clif->damage(&sd->bl,&sd->bl, iTimer->gettick(), 0, 0, -hp, 0, 4, 0);
clif->message(fd, msg_txt(156)); // HP or/and SP modified.
return true;
}
@@ -1106,7 +1106,7 @@ ACMD(heal)
status_heal(&sd->bl, hp, 0, 0);
else {
status_damage(NULL, &sd->bl, -hp, 0, 0, 0);
- clif->damage(&sd->bl,&sd->bl, gettick(), 0, 0, -hp, 0, 4, 0);
+ clif->damage(&sd->bl,&sd->bl, iTimer->gettick(), 0, 0, -hp, 0, 4, 0);
}
}
@@ -1166,7 +1166,7 @@ ACMD(item)
item_tmp.nameid = item_id;
item_tmp.identify = 1;
- if ((flag = pc_additem(sd, &item_tmp, get_count, LOG_TYPE_COMMAND)))
+ if ((flag = pc->additem(sd, &item_tmp, get_count, LOG_TYPE_COMMAND)))
clif->additem(sd, 0, 0, flag);
}
}
@@ -1239,7 +1239,7 @@ ACMD(item2)
item_tmp.card[1] = c2;
item_tmp.card[2] = c3;
item_tmp.card[3] = c4;
- if ((flag = pc_additem(sd, &item_tmp, get_count, LOG_TYPE_COMMAND)))
+ if ((flag = pc->additem(sd, &item_tmp, get_count, LOG_TYPE_COMMAND)))
clif->additem(sd, 0, 0, flag);
}
@@ -1263,7 +1263,7 @@ ACMD(itemreset)
for (i = 0; i < MAX_INVENTORY; i++) {
if (sd->status.inventory[i].amount && sd->status.inventory[i].equip == 0) {
- pc_delitem(sd, i, sd->status.inventory[i].amount, 0, 0, LOG_TYPE_COMMAND);
+ pc->delitem(sd, i, sd->status.inventory[i].amount, 0, 0, LOG_TYPE_COMMAND);
}
}
clif->message(fd, msg_txt(20)); // All of your items have been removed.
@@ -1286,14 +1286,14 @@ ACMD(baselevelup)
}
if (level > 0) {
- if (sd->status.base_level >= pc_maxbaselv(sd)) { // check for max level by Valaris
+ if (sd->status.base_level >= pc->maxbaselv(sd)) { // check for max level by Valaris
clif->message(fd, msg_txt(47)); // Base level can't go any higher.
return false;
} // End Addition
- if ((unsigned int)level > pc_maxbaselv(sd) || (unsigned int)level > pc_maxbaselv(sd) - sd->status.base_level) // fix positiv overflow
- level = pc_maxbaselv(sd) - sd->status.base_level;
+ if ((unsigned int)level > pc->maxbaselv(sd) || (unsigned int)level > pc->maxbaselv(sd) - sd->status.base_level) // fix positiv overflow
+ level = pc->maxbaselv(sd) - sd->status.base_level;
for (i = 0; i < level; i++)
- status_point += pc_gets_status_point(sd->status.base_level + i);
+ status_point += pc->gets_status_point(sd->status.base_level + i);
sd->status.status_point += status_point;
sd->status.base_level += (unsigned int)level;
@@ -1309,9 +1309,9 @@ ACMD(baselevelup)
if ((unsigned int)level >= sd->status.base_level)
level = sd->status.base_level-1;
for (i = 0; i > -level; i--)
- status_point += pc_gets_status_point(sd->status.base_level + i - 1);
+ status_point += pc->gets_status_point(sd->status.base_level + i - 1);
if (sd->status.status_point < status_point)
- pc_resetstate(sd);
+ pc->resetstate(sd);
if (sd->status.status_point < status_point)
sd->status.status_point = 0;
else
@@ -1325,9 +1325,9 @@ ACMD(baselevelup)
clif->updatestatus(sd, SP_BASEEXP);
clif->updatestatus(sd, SP_NEXTBASEEXP);
status_calc_pc(sd, 0);
- pc_baselevelchanged(sd);
+ pc->baselevelchanged(sd);
if(sd->status.party_id)
- party_send_levelup(sd);
+ party->send_levelup(sd);
return true;
}
@@ -1346,12 +1346,12 @@ ACMD(joblevelup)
return false;
}
if (level > 0) {
- if (sd->status.job_level >= pc_maxjoblv(sd)) {
+ if (sd->status.job_level >= pc->maxjoblv(sd)) {
clif->message(fd, msg_txt(23)); // Job level can't go any higher.
return false;
}
- if ((unsigned int)level > pc_maxjoblv(sd) || (unsigned int)level > pc_maxjoblv(sd) - sd->status.job_level) // fix positiv overflow
- level = pc_maxjoblv(sd) - sd->status.job_level;
+ if ((unsigned int)level > pc->maxjoblv(sd) || (unsigned int)level > pc->maxjoblv(sd) - sd->status.job_level) // fix positiv overflow
+ level = pc->maxjoblv(sd) - sd->status.job_level;
sd->status.job_level += (unsigned int)level;
sd->status.skill_point += level;
clif->misceffect(&sd->bl, 1);
@@ -1366,7 +1366,7 @@ ACMD(joblevelup)
level = sd->status.job_level-1;
sd->status.job_level -= (unsigned int)level;
if (sd->status.skill_point < level)
- pc_resetskill(sd,0); //Reset skills since we need to substract more points.
+ pc->resetskill(sd,0); //Reset skills since we need to substract more points.
if (sd->status.skill_point < level)
sd->status.skill_point = 0;
else
@@ -1469,7 +1469,7 @@ static int atcommand_pvpoff_sub(struct block_list *bl,va_list ap)
TBL_PC* sd = (TBL_PC*)bl;
clif->pvpset(sd, 0, 0, 2);
if (sd->pvp_timer != INVALID_TIMER) {
- delete_timer(sd->pvp_timer, pc_calc_pvprank_timer);
+ iTimer->delete_timer(sd->pvp_timer, pc->calc_pvprank_timer);
sd->pvp_timer = INVALID_TIMER;
}
return 0;
@@ -1484,15 +1484,15 @@ ACMD(pvpoff)
return false;
}
- map_zone_change2(sd->bl.m,map[sd->bl.m].prev_zone);
+ iMap->zone_change2(sd->bl.m,map[sd->bl.m].prev_zone);
map[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);
}
- map_foreachinmap(atcommand_pvpoff_sub,sd->bl.m, BL_PC);
- map_foreachinmap(atcommand_stopattack,sd->bl.m, BL_CHAR, 0);
+ iMap->foreachinmap(atcommand_pvpoff_sub,sd->bl.m, BL_PC);
+ iMap->foreachinmap(atcommand_stopattack,sd->bl.m, BL_CHAR, 0);
clif->message(fd, msg_txt(31)); // PvP: Off.
return true;
}
@@ -1504,7 +1504,7 @@ static int atcommand_pvpon_sub(struct block_list *bl,va_list ap)
{
TBL_PC* sd = (TBL_PC*)bl;
if (sd->pvp_timer == INVALID_TIMER) {
- sd->pvp_timer = add_timer(gettick() + 200, pc_calc_pvprank_timer, sd->bl.id, 0);
+ sd->pvp_timer = iTimer->add_timer(iTimer->gettick() + 200, pc->calc_pvprank_timer, sd->bl.id, 0);
sd->pvp_rank = 0;
sd->pvp_lastusers = 0;
sd->pvp_point = 5;
@@ -1523,13 +1523,13 @@ ACMD(pvpon)
return false;
}
- map_zone_change2(sd->bl.m,strdb_get(zone_db, MAP_ZONE_PVP_NAME));
+ iMap->zone_change2(sd->bl.m,strdb_get(zone_db, MAP_ZONE_PVP_NAME));
map[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);
- map_foreachinmap(atcommand_pvpon_sub,sd->bl.m, BL_PC);
+ iMap->foreachinmap(atcommand_pvpon_sub,sd->bl.m, BL_PC);
}
clif->message(fd, msg_txt(32)); // PvP: On.
@@ -1549,11 +1549,11 @@ ACMD(gvgoff)
return false;
}
- map_zone_change2(sd->bl.m,map[sd->bl.m].prev_zone);
+ iMap->zone_change2(sd->bl.m,map[sd->bl.m].prev_zone);
map[sd->bl.m].flag.gvg = 0;
clif->map_property_mapall(sd->bl.m, MAPPROPERTY_NOTHING);
clif->maptypeproperty2(&sd->bl,ALL_SAMEMAP);
- map_foreachinmap(atcommand_stopattack,sd->bl.m, BL_CHAR, 0);
+ iMap->foreachinmap(atcommand_stopattack,sd->bl.m, BL_CHAR, 0);
clif->message(fd, msg_txt(33)); // GvG: Off.
return true;
@@ -1571,7 +1571,7 @@ ACMD(gvgon)
return false;
}
- map_zone_change2(sd->bl.m,strdb_get(zone_db, MAP_ZONE_GVG_NAME));
+ iMap->zone_change2(sd->bl.m,strdb_get(zone_db, MAP_ZONE_GVG_NAME));
map[sd->bl.m].flag.gvg = 1;
clif->map_property_mapall(sd->bl.m, MAPPROPERTY_AGITZONE);
clif->maptypeproperty2(&sd->bl,ALL_SAMEMAP);
@@ -1600,9 +1600,9 @@ ACMD(model)
if (hair_style >= MIN_HAIR_STYLE && hair_style <= MAX_HAIR_STYLE &&
hair_color >= MIN_HAIR_COLOR && hair_color <= MAX_HAIR_COLOR &&
cloth_color >= MIN_CLOTH_COLOR && cloth_color <= MAX_CLOTH_COLOR) {
- pc_changelook(sd, LOOK_HAIR, hair_style);
- pc_changelook(sd, LOOK_HAIR_COLOR, hair_color);
- pc_changelook(sd, LOOK_CLOTHES_COLOR, cloth_color);
+ pc->changelook(sd, LOOK_HAIR, hair_style);
+ pc->changelook(sd, LOOK_HAIR_COLOR, hair_color);
+ pc->changelook(sd, LOOK_CLOTHES_COLOR, cloth_color);
clif->message(fd, msg_txt(36)); // Appearence changed.
} else {
clif->message(fd, msg_txt(37)); // An invalid number was specified.
@@ -1629,7 +1629,7 @@ ACMD(dye)
}
if (cloth_color >= MIN_CLOTH_COLOR && cloth_color <= MAX_CLOTH_COLOR) {
- pc_changelook(sd, LOOK_CLOTHES_COLOR, cloth_color);
+ pc->changelook(sd, LOOK_CLOTHES_COLOR, cloth_color);
clif->message(fd, msg_txt(36)); // Appearence changed.
} else {
clif->message(fd, msg_txt(37)); // An invalid number was specified.
@@ -1656,7 +1656,7 @@ ACMD(hair_style)
}
if (hair_style >= MIN_HAIR_STYLE && hair_style <= MAX_HAIR_STYLE) {
- pc_changelook(sd, LOOK_HAIR, hair_style);
+ pc->changelook(sd, LOOK_HAIR, hair_style);
clif->message(fd, msg_txt(36)); // Appearence changed.
} else {
clif->message(fd, msg_txt(37)); // An invalid number was specified.
@@ -1683,7 +1683,7 @@ ACMD(hair_color)
}
if (hair_color >= MIN_HAIR_COLOR && hair_color <= MAX_HAIR_COLOR) {
- pc_changelook(sd, LOOK_HAIR_COLOR, hair_color);
+ pc->changelook(sd, LOOK_HAIR_COLOR, hair_color);
clif->message(fd, msg_txt(36)); // Appearence changed.
} else {
clif->message(fd, msg_txt(37)); // An invalid number was specified.
@@ -1864,7 +1864,7 @@ ACMD(go)
if (town >= 0 && town < ARRAYLENGTH(data))
{
- m = map_mapname2mapid(data[town].map);
+ m = iMap->mapname2mapid(data[town].map);
if (m >= 0 && map[m].flag.nowarpto && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) {
clif->message(fd, msg_txt(247));
return false;
@@ -1873,7 +1873,7 @@ ACMD(go)
clif->message(fd, msg_txt(248));
return false;
}
- if (pc_setpos(sd, mapindex_name2id(data[town].map), data[town].x, data[town].y, CLR_TELEPORT) == 0) {
+ if (pc->setpos(sd, mapindex_name2id(data[town].map), data[town].x, data[town].y, CLR_TELEPORT) == 0) {
clif->message(fd, msg_txt(0)); // Warped.
} else {
clif->message(fd, msg_txt(1)); // Map not found.
@@ -1964,7 +1964,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++) {
- map_search_freecell(&sd->bl, 0, &mx, &my, range, range, 0);
+ iMap->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;
}
@@ -2016,13 +2016,13 @@ ACMD(killmonster)
if (!message || !*message || sscanf(message, "%15s", map_name) < 1)
map_id = sd->bl.m;
else {
- if ((map_id = map_mapname2mapid(map_name)) < 0)
+ if ((map_id = iMap->mapname2mapid(map_name)) < 0)
map_id = sd->bl.m;
}
drop_flag = strcmp(command+1, "killmonster2");
- map_foreachinmap(atkillmonster_sub, map_id, BL_MOB, -drop_flag);
+ iMap->foreachinmap(atkillmonster_sub, map_id, BL_MOB, -drop_flag);
clif->message(fd, msg_txt(165)); // All monsters killed!
@@ -2085,11 +2085,11 @@ ACMD(refine)
if (sd->status.inventory[i].refine != final_refine) {
sd->status.inventory[i].refine = final_refine;
current_position = sd->status.inventory[i].equip;
- pc_unequipitem(sd, i, 3);
+ pc->unequipitem(sd, i, 3);
clif->refine(fd, 0, i, sd->status.inventory[i].refine);
clif->delitem(sd, i, 1, 3);
clif->additem(sd, i, 1, 0);
- pc_equipitem(sd, i, current_position);
+ pc->equipitem(sd, i, current_position);
clif->misceffect(&sd->bl, 3);
count++;
}
@@ -2155,7 +2155,7 @@ ACMD(produce)
clif->produce_effect(sd, 0, item_id);
clif->misceffect(&sd->bl, 3);
- if ((flag = pc_additem(sd, &tmp_item, 1, LOG_TYPE_COMMAND)))
+ if ((flag = pc->additem(sd, &tmp_item, 1, LOG_TYPE_COMMAND)))
clif->additem(sd, 0, 0, flag);
} else {
sprintf(atcmd_output, msg_txt(169), item_id, item_data->name); // The item (%d: '%s') is not equipable.
@@ -2198,7 +2198,7 @@ ACMD(memo)
return false;
}
- pc_memo(sd, position);
+ pc->memo(sd, position);
return true;
}
@@ -2215,11 +2215,11 @@ ACMD(gat)
for (y = 2; y >= -2; y--) {
sprintf(atcmd_output, "%s (x= %d, y= %d) %02X %02X %02X %02X %02X",
map[sd->bl.m].name, sd->bl.x - 2, sd->bl.y + y,
- 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));
+ 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));
clif->message(fd, atcmd_output);
}
@@ -2361,12 +2361,12 @@ ACMD(zeny)
}
if(zeny > 0){
- if((ret=pc_getzeny(sd,zeny,LOG_TYPE_COMMAND,NULL)) == 1)
+ if((ret=pc->getzeny(sd,zeny,LOG_TYPE_COMMAND,NULL)) == 1)
clif->message(fd, msg_txt(149)); // Unable to increase the number/value.
}
else {
if( sd->status.zeny < -zeny ) zeny = -sd->status.zeny;
- if((ret=pc_payzeny(sd,-zeny,LOG_TYPE_COMMAND,NULL)) == 1)
+ if((ret=pc->payzeny(sd,-zeny,LOG_TYPE_COMMAND,NULL)) == 1)
clif->message(fd, msg_txt(41)); // Unable to decrease the number/value.
}
if(!ret) clif->message(fd, msg_txt(176)); //ret=0 mean cmd success
@@ -2701,13 +2701,13 @@ ACMD(recall) {
return false;
}
- if((pl_sd=map_nick2sd((char *)message)) == NULL && (pl_sd=map_charid2sd(atoi(message))) == NULL)
+ if((pl_sd=iMap->nick2sd((char *)message)) == NULL && (pl_sd=iMap->charid2sd(atoi(message))) == NULL)
{
clif->message(fd, msg_txt(3)); // Character not found.
return false;
}
- if ( pc_get_group_level(sd) < pc_get_group_level(pl_sd) )
+ if ( pc->get_group_level(sd) < pc->get_group_level(pl_sd) )
{
clif->message(fd, msg_txt(81)); // Your GM level doesn't authorize you to preform this action on the specified player.
return false;
@@ -2724,7 +2724,7 @@ ACMD(recall) {
if (pl_sd->bl.m == sd->bl.m && pl_sd->bl.x == sd->bl.x && pl_sd->bl.y == sd->bl.y) {
return false;
}
- pc_setpos(pl_sd, sd->mapindex, sd->bl.x, sd->bl.y, CLR_RESPAWN);
+ pc->setpos(pl_sd, sd->mapindex, sd->bl.x, sd->bl.y, CLR_RESPAWN);
sprintf(atcmd_output, msg_txt(46), pl_sd->status.name); // %s recalled!
clif->message(fd, atcmd_output);
@@ -2838,7 +2838,7 @@ ACMD(char_ban)
tmtime->tm_min = tmtime->tm_min + minute;
tmtime->tm_sec = tmtime->tm_sec + second;
timestamp = mktime(tmtime);
- if( timestamp <= time(NULL) && !pc_can_use_command(sd, "@unban") ) {
+ if( timestamp <= time(NULL) && !pc->can_use_command(sd, "@unban") ) {
clif->message(fd,msg_txt(1023)); // You are not allowed to reduce the length of a ban.
return false;
}
@@ -2898,8 +2898,8 @@ ACMD(night)
{
nullpo_retr(-1, sd);
- if (night_flag != 1) {
- map_night_timer(night_timer_tid, 0, 0, 1);
+ if (iMap->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.
return false;
@@ -2915,8 +2915,8 @@ ACMD(day)
{
nullpo_retr(-1, sd);
- if (night_flag != 0) {
- map_day_timer(day_timer_tid, 0, 0, 1);
+ if (iMap->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.
return false;
@@ -2938,7 +2938,7 @@ ACMD(doom)
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) )
{
- if (pl_sd->fd != fd && pc_get_group_level(sd) >= pc_get_group_level(pl_sd))
+ if (pl_sd->fd != fd && pc->get_group_level(sd) >= pc->get_group_level(pl_sd))
{
status_kill(&pl_sd->bl);
clif->specialeffect(&pl_sd->bl,450,AREA);
@@ -2965,7 +2965,7 @@ ACMD(doommap)
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) )
{
- if (pl_sd->fd != fd && sd->bl.m == pl_sd->bl.m && pc_get_group_level(sd) >= pc_get_group_level(pl_sd))
+ if (pl_sd->fd != fd && sd->bl.m == pl_sd->bl.m && pc->get_group_level(sd) >= pc->get_group_level(pl_sd))
{
status_kill(&pl_sd->bl);
clif->specialeffect(&pl_sd->bl,450,AREA);
@@ -3047,13 +3047,13 @@ ACMD(kick)
return false;
}
- if((pl_sd=map_nick2sd((char *)message)) == NULL && (pl_sd=map_charid2sd(atoi(message))) == NULL)
+ if((pl_sd=iMap->nick2sd((char *)message)) == NULL && (pl_sd=iMap->charid2sd(atoi(message))) == NULL)
{
clif->message(fd, msg_txt(3)); // Character not found.
return false;
}
- if ( pc_get_group_level(sd) < pc_get_group_level(pl_sd) )
+ if ( pc->get_group_level(sd) < pc->get_group_level(pl_sd) )
{
clif->message(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player.
return false;
@@ -3076,7 +3076,7 @@ ACMD(kickall)
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) )
{
- if (pc_get_group_level(sd) >= pc_get_group_level(pl_sd)) { // you can kick only lower or same gm level
+ if (pc->get_group_level(sd) >= pc->get_group_level(pl_sd)) { // you can kick only lower or same gm level
if (sd->status.account_id != pl_sd->status.account_id)
clif->GM_kick(NULL, pl_sd);
}
@@ -3094,7 +3094,7 @@ ACMD(kickall)
ACMD(allskill)
{
nullpo_retr(-1, sd);
- pc_allskillup(sd); // all skills
+ pc->allskillup(sd); // all skills
sd->status.skill_point = 0; // 0 skill points
clif->updatestatus(sd, SP_SKILLPOINT); // update
clif->message(fd, msg_txt(76)); // All skills have been added to your skill tree.
@@ -3134,12 +3134,12 @@ ACMD(questskill)
clif->message(fd, msg_txt(197)); // This skill number doesn't exist or isn't a quest skill.
return false;
}
- if (pc_checkskill2(sd, index) > 0) {
+ if (pc->checkskill2(sd, index) > 0) {
clif->message(fd, msg_txt(196)); // You already have this quest skill.
return false;
}
- pc_skill(sd, skill_id, 1, 0);
+ pc->skill(sd, skill_id, 1, 0);
clif->message(fd, msg_txt(70)); // You have learned the skill.
return true;
@@ -3177,7 +3177,7 @@ ACMD(lostskill)
clif->message(fd, msg_txt(197)); // This skill number doesn't exist or isn't a quest skill.
return false;
}
- if (pc_checkskill2(sd, index) == 0) {
+ if (pc->checkskill2(sd, index) == 0) {
clif->message(fd, msg_txt(201)); // You don't have this quest skill.
return false;
}
@@ -3210,7 +3210,7 @@ ACMD(spiritball)
}
if( sd->spiritball > 0 )
- pc_delspiritball(sd, sd->spiritball, 1);
+ pc->delspiritball(sd, sd->spiritball, 1);
sd->spiritball = number;
clif->spiritball(&sd->bl);
// no message, player can look the difference
@@ -3223,17 +3223,17 @@ ACMD(spiritball)
*------------------------------------------*/
ACMD(party)
{
- char party[NAME_LENGTH];
+ char party_name[NAME_LENGTH];
nullpo_retr(-1, sd);
- memset(party, '\0', sizeof(party));
+ memset(party_name, '\0', sizeof(party_name));
- if (!message || !*message || sscanf(message, "%23[^\n]", party) < 1) {
+ if (!message || !*message || sscanf(message, "%23[^\n]", party_name) < 1) {
clif->message(fd, msg_txt(1029)); // Please enter a party name (usage: @party <party_name>).
return false;
}
- party_create(sd, party, 0, 0);
+ party->create(sd, party_name, 0, 0);
return true;
}
@@ -3299,12 +3299,12 @@ ACMD(breakguild)
ACMD(agitstart)
{
nullpo_retr(-1, sd);
- if (agit_flag == 1) {
+ if (iMap->agit_flag == 1) {
clif->message(fd, msg_txt(73)); // War of Emperium is currently in progress.
return false;
}
- agit_flag = 1;
+ iMap->agit_flag = 1;
guild->agit_start();
clif->message(fd, msg_txt(72)); // War of Emperium has been initiated.
@@ -3317,12 +3317,12 @@ ACMD(agitstart)
ACMD(agitstart2)
{
nullpo_retr(-1, sd);
- if (agit2_flag == 1) {
+ if (iMap->agit2_flag == 1) {
clif->message(fd, msg_txt(404)); // "War of Emperium SE is currently in progress."
return false;
}
- agit2_flag = 1;
+ iMap->agit2_flag = 1;
guild->agit2_start();
clif->message(fd, msg_txt(403)); // "War of Emperium SE has been initiated."
@@ -3335,12 +3335,12 @@ ACMD(agitstart2)
ACMD(agitend)
{
nullpo_retr(-1, sd);
- if (agit_flag == 0) {
+ if (iMap->agit_flag == 0) {
clif->message(fd, msg_txt(75)); // War of Emperium is currently not in progress.
return false;
}
- agit_flag = 0;
+ iMap->agit_flag = 0;
guild->agit_end();
clif->message(fd, msg_txt(74)); // War of Emperium has been ended.
@@ -3353,12 +3353,12 @@ ACMD(agitend)
ACMD(agitend2)
{
nullpo_retr(-1, sd);
- if (agit2_flag == 0) {
+ if (iMap->agit2_flag == 0) {
clif->message(fd, msg_txt(406)); // "War of Emperium SE is currently not in progress."
return false;
}
- agit2_flag = 0;
+ iMap->agit2_flag = 0;
guild->agit2_end();
clif->message(fd, msg_txt(405)); // "War of Emperium SE has been ended."
@@ -3372,7 +3372,7 @@ ACMD(mapexit)
{
nullpo_retr(-1, sd);
- do_shutdown();
+ iMap->do_shutdown();
return true;
}
@@ -3433,7 +3433,7 @@ ACMD(recallall)
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) )
{
- if (sd->status.account_id != pl_sd->status.account_id && pc_get_group_level(sd) >= pc_get_group_level(pl_sd))
+ if (sd->status.account_id != pl_sd->status.account_id && pc->get_group_level(sd) >= pc->get_group_level(pl_sd))
{
if (pl_sd->bl.m == sd->bl.m && pl_sd->bl.x == sd->bl.x && pl_sd->bl.y == sd->bl.y)
continue; // Don't waste time warping the character to the same place.
@@ -3441,10 +3441,10 @@ ACMD(recallall)
count++;
else {
if (pc_isdead(pl_sd)) { //Wake them up
- pc_setstand(pl_sd);
- pc_setrestartvalue(pl_sd,1);
+ pc->setstand(pl_sd);
+ pc->setrestartvalue(pl_sd,1);
}
- pc_setpos(pl_sd, sd->mapindex, sd->bl.x, sd->bl.y, CLR_RESPAWN);
+ pc->setpos(pl_sd, sd->mapindex, sd->bl.x, sd->bl.y, CLR_RESPAWN);
}
}
}
@@ -3498,12 +3498,12 @@ ACMD(guildrecall)
{
if (sd->status.account_id != pl_sd->status.account_id && pl_sd->status.guild_id == g->guild_id)
{
- if (pc_get_group_level(pl_sd) > pc_get_group_level(sd) || (pl_sd->bl.m == sd->bl.m && pl_sd->bl.x == sd->bl.x && pl_sd->bl.y == sd->bl.y))
+ if (pc->get_group_level(pl_sd) > pc->get_group_level(sd) || (pl_sd->bl.m == sd->bl.m && pl_sd->bl.x == sd->bl.x && pl_sd->bl.y == sd->bl.y))
continue; // Skip GMs greater than you... or chars already on the cell
if (pl_sd->bl.m >= 0 && map[pl_sd->bl.m].flag.nowarp && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE))
count++;
else
- pc_setpos(pl_sd, sd->mapindex, sd->bl.x, sd->bl.y, CLR_RESPAWN);
+ pc->setpos(pl_sd, sd->mapindex, sd->bl.x, sd->bl.y, CLR_RESPAWN);
}
}
mapit->free(iter);
@@ -3543,8 +3543,8 @@ ACMD(partyrecall)
return false;
}
- if ((p = party_searchname(party_name)) == NULL && // name first to avoid error when name begin with a number
- (p = party_search(atoi(message))) == NULL)
+ if ((p = party->searchname(party_name)) == NULL && // name first to avoid error when name begin with a number
+ (p = party->search(atoi(message))) == NULL)
{
clif->message(fd, msg_txt(96)); // Incorrect name or ID, or no one from the party is online.
return false;
@@ -3557,12 +3557,12 @@ ACMD(partyrecall)
{
if (sd->status.account_id != pl_sd->status.account_id && pl_sd->status.party_id == p->party.party_id)
{
- if (pc_get_group_level(pl_sd) > pc_get_group_level(sd) || (pl_sd->bl.m == sd->bl.m && pl_sd->bl.x == sd->bl.x && pl_sd->bl.y == sd->bl.y))
+ if (pc->get_group_level(pl_sd) > pc->get_group_level(sd) || (pl_sd->bl.m == sd->bl.m && pl_sd->bl.x == sd->bl.x && pl_sd->bl.y == sd->bl.y))
continue; // Skip GMs greater than you... or chars already on the cell
if (pl_sd->bl.m >= 0 && map[pl_sd->bl.m].flag.nowarp && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE))
count++;
else
- pc_setpos(pl_sd, sd->mapindex, sd->bl.x, sd->bl.y, CLR_RESPAWN);
+ pc->setpos(pl_sd, sd->mapindex, sd->bl.x, sd->bl.y, CLR_RESPAWN);
}
}
mapit->free(iter);
@@ -3634,7 +3634,7 @@ ACMD(reloadatcommand) {
config_destroy(&run_test);
- if (conf_read_file(&run_test, ATCOMMAND_CONF_FILENAME)) {
+ if (conf_read_file(&run_test, iMap->ATCOMMAND_CONF_FILENAME)) {
clif->message(fd, msg_txt(1037)); // Error reading atcommand.conf, reload failed.
return false;
}
@@ -3654,7 +3654,7 @@ ACMD(reloadbattleconf)
struct Battle_Config prev_config;
memcpy(&prev_config, &battle_config, sizeof(prev_config));
- battle->config_read(BATTLE_CONF_FILENAME);
+ battle->config_read(iMap->BATTLE_CONF_FILENAME);
if( prev_config.item_rate_mvp != battle_config.item_rate_mvp
|| prev_config.item_rate_common != battle_config.item_rate_common
@@ -3708,7 +3708,7 @@ ACMD(reloadstatusdb)
*------------------------------------------*/
ACMD(reloadpcdb)
{
- pc_readdb();
+ pc->readdb();
clif->message(fd, msg_txt(257));
return true;
}
@@ -3718,12 +3718,35 @@ ACMD(reloadpcdb)
*------------------------------------------*/
ACMD(reloadscript)
{
+ struct s_mapiterator* iter;
+ struct map_session_data* pl_sd;
+
nullpo_retr(-1, sd);
//atcommand_broadcast( fd, sd, "@broadcast", "Server is reloading scripts..." );
//atcommand_broadcast( fd, sd, "@broadcast", "You will feel a bit of lag at this point !" );
+ iter = mapit_getallusers();
+ for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) ) {
+ if (pl_sd->npc_id || pl_sd->npc_shopid) {
+ if (pl_sd->state.using_fake_npc) {
+ clif->clearunit_single(pl_sd->npc_id, CLR_OUTSIGHT, pl_sd->fd);
+ pl_sd->state.using_fake_npc = 0;
+ }
+ if (pl_sd->state.menu_or_input)
+ pl_sd->state.menu_or_input = 0;
+ if (pl_sd->npc_menu)
+ pl_sd->npc_menu = 0;
+
+ pl_sd->npc_id = 0;
+ pl_sd->npc_shopid = 0;
+ if (pl_sd->st && pl_sd->st->state != END)
+ pl_sd->st->state = END;
+ }
+ }
+ mapit->free(iter);
+
flush_fifos();
- map_reloadnpc(true); // reload config files seeking for npcs
+ iMap->reloadnpc(true); // reload config files seeking for npcs
script_reload();
npc_reload();
@@ -3766,9 +3789,9 @@ ACMD(mapinfo) {
if (mapname[0] == '\0') {
safestrncpy(mapname, mapindex_id2name(sd->mapindex), MAP_NAME_LENGTH);
- m_id = map_mapindex2mapid(sd->mapindex);
+ m_id = iMap->mapindex2mapid(sd->mapindex);
} else {
- m_id = map_mapname2mapid(mapname);
+ m_id = iMap->mapname2mapid(mapname);
}
if (m_id < 0) {
@@ -3786,7 +3809,7 @@ ACMD(mapinfo) {
if( pl_sd->mapindex == m_index ) {
if( pl_sd->state.vending )
vend_num++;
- else if( (cd = (struct chat_data*)map_id2bl(pl_sd->chatID)) != NULL && cd->usersd[0] == pl_sd )
+ else if( (cd = (struct chat_data*)iMap->id2bl(pl_sd->chatID)) != NULL && cd->usersd[0] == pl_sd )
chat_num++;
}
}
@@ -3940,7 +3963,7 @@ ACMD(mapinfo) {
for (i = 0; i < map[m_id].npc_num;)
{
nd = map[m_id].npc[i];
- switch(nd->ud.dir) {
+ switch(nd->dir) {
case 0: strcpy(direction, msg_txt(1101)); break; // North
case 1: strcpy(direction, msg_txt(1102)); break; // North West
case 2: strcpy(direction, msg_txt(1103)); break; // West
@@ -3966,7 +3989,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*)map_id2bl(pl_sd->chatID)) != NULL &&
+ if ((cd = (struct chat_data*)iMap->id2bl(pl_sd->chatID)) != NULL &&
pl_sd->mapindex == m_index &&
cd->usersd[0] == pl_sd)
{
@@ -4001,47 +4024,47 @@ ACMD(mount_peco)
return false;
}
- if( (sd->class_&MAPID_THIRDMASK) == MAPID_RUNE_KNIGHT && pc_checkskill(sd,RK_DRAGONTRAINING) > 0 ) {
+ if( (sd->class_&MAPID_THIRDMASK) == MAPID_RUNE_KNIGHT && pc->checkskill(sd,RK_DRAGONTRAINING) > 0 ) {
if( !(sd->sc.option&OPTION_DRAGON1) ) {
clif->message(sd->fd,msg_txt(1119)); // You have mounted your Dragon.
- pc_setoption(sd, sd->sc.option|OPTION_DRAGON1);
+ pc->setoption(sd, sd->sc.option|OPTION_DRAGON1);
} else {
clif->message(sd->fd,msg_txt(1120)); // You have released your Dragon.
- pc_setoption(sd, sd->sc.option&~OPTION_DRAGON1);
+ pc->setoption(sd, sd->sc.option&~OPTION_DRAGON1);
}
return true;
}
- if( (sd->class_&MAPID_THIRDMASK) == MAPID_RANGER && pc_checkskill(sd,RA_WUGRIDER) > 0 ) {
+ if( (sd->class_&MAPID_THIRDMASK) == MAPID_RANGER && pc->checkskill(sd,RA_WUGRIDER) > 0 ) {
if( !pc_isridingwug(sd) ) {
clif->message(sd->fd,msg_txt(1121)); // You have mounted your Warg.
- pc_setoption(sd, sd->sc.option|OPTION_WUGRIDER);
+ pc->setoption(sd, sd->sc.option|OPTION_WUGRIDER);
} else {
clif->message(sd->fd,msg_txt(1122)); // You have released your Warg.
- pc_setoption(sd, sd->sc.option&~OPTION_WUGRIDER);
+ pc->setoption(sd, sd->sc.option&~OPTION_WUGRIDER);
}
return true;
}
if( (sd->class_&MAPID_THIRDMASK) == MAPID_MECHANIC ) {
if( !pc_ismadogear(sd) ) {
clif->message(sd->fd,msg_txt(1123)); // You have mounted your Mado Gear.
- pc_setoption(sd, sd->sc.option|OPTION_MADOGEAR);
+ pc->setoption(sd, sd->sc.option|OPTION_MADOGEAR);
} else {
clif->message(sd->fd,msg_txt(1124)); // You have released your Mado Gear.
- pc_setoption(sd, sd->sc.option&~OPTION_MADOGEAR);
+ pc->setoption(sd, sd->sc.option&~OPTION_MADOGEAR);
}
return true;
}
if (!pc_isriding(sd)) { // if actually no peco
- if (!pc_checkskill(sd, KN_RIDING)) {
+ if (!pc->checkskill(sd, KN_RIDING)) {
clif->message(fd, msg_txt(213)); // You can not mount a Peco Peco with your current job.
return false;
}
- pc_setoption(sd, sd->sc.option | OPTION_RIDING);
+ pc->setoption(sd, sd->sc.option | OPTION_RIDING);
clif->message(fd, msg_txt(102)); // You have mounted a Peco Peco.
} else {//Dismount
- pc_setoption(sd, sd->sc.option & ~OPTION_RIDING);
+ pc->setoption(sd, sd->sc.option & ~OPTION_RIDING);
clif->message(fd, msg_txt(214)); // You have released your Peco Peco.
}
@@ -4060,7 +4083,7 @@ ACMD(guildspy)
memset(guild_name, '\0', sizeof(guild_name));
memset(atcmd_output, '\0', sizeof(atcmd_output));
- if (!enable_spy)
+ if (!iMap->enable_spy)
{
clif->message(fd, msg_txt(1125)); // The mapserver has spy command support disabled.
return false;
@@ -4101,7 +4124,7 @@ ACMD(partyspy)
memset(party_name, '\0', sizeof(party_name));
memset(atcmd_output, '\0', sizeof(atcmd_output));
- if (!enable_spy)
+ if (!iMap->enable_spy)
{
clif->message(fd, msg_txt(1125)); // The mapserver has spy command support disabled.
return false;
@@ -4112,8 +4135,8 @@ ACMD(partyspy)
return false;
}
- if ((p = party_searchname(party_name)) != NULL || // name first to avoid error when name begin with a number
- (p = party_search(atoi(message))) != NULL) {
+ if ((p = party->searchname(party_name)) != NULL || // name first to avoid error when name begin with a number
+ (p = party->search(atoi(message))) != NULL) {
if (sd->partyspy == p->party.party_id) {
sd->partyspy = 0;
sprintf(atcmd_output, msg_txt(105), p->party.name); // No longer spying on the %s party.
@@ -4175,9 +4198,9 @@ ACMD(nuke)
return false;
}
- 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, gettick(), 0);
+ if ((pl_sd = iMap->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, iTimer->gettick(), 0);
clif->message(fd, msg_txt(109)); // Player has been nuked!
} else {
clif->message(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player.
@@ -4209,7 +4232,7 @@ ACMD(tonpc)
}
if ((nd = npc_name2id(npcname)) != NULL) {
- if (pc_setpos(sd, map_id2index(nd->bl.m), nd->bl.x, nd->bl.y, CLR_TELEPORT) == 0)
+ if (pc->setpos(sd, map_id2index(nd->bl.m), nd->bl.x, nd->bl.y, CLR_TELEPORT) == 0)
clif->message(fd, msg_txt(0)); // Warped.
else
return false;
@@ -4384,31 +4407,31 @@ ACMD(servertime)
clif->message(fd, temp);
if (battle_config.night_duration == 0 && battle_config.day_duration == 0) {
- if (night_flag == 0)
+ if (iMap->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 (night_flag == 1) { // we start with night
- timer_data = get_timer(day_timer_tid);
- sprintf(temp, msg_txt(233), txt_time(DIFF_TICK(timer_data->tick,gettick())/1000)); // Game time: The game is actualy in night for %s.
+ if (iMap->night_flag == 1) { // we start with night
+ timer_data = iTimer->get_timer(pc->day_timer_tid);
+ sprintf(temp, msg_txt(233), txt_time(DIFF_TICK(timer_data->tick,iTimer->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 (night_flag == 0) { // we start with day
- timer_data = get_timer(night_timer_tid);
- sprintf(temp, msg_txt(235), txt_time(DIFF_TICK(timer_data->tick,gettick())/1000)); // Game time: The game is actualy in daylight for %s.
+ if (iMap->night_flag == 0) { // we start with day
+ timer_data = iTimer->get_timer(pc->night_timer_tid);
+ sprintf(temp, msg_txt(235), txt_time(DIFF_TICK(timer_data->tick,iTimer->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 (night_flag == 0) {
- timer_data = get_timer(night_timer_tid);
- timer_data2 = get_timer(day_timer_tid);
- sprintf(temp, msg_txt(235), txt_time(DIFF_TICK(timer_data->tick,gettick())/1000)); // Game time: The game is actualy in daylight for %s.
+ if (iMap->night_flag == 0) {
+ timer_data = iTimer->get_timer(pc->night_timer_tid);
+ timer_data2 = iTimer->get_timer(pc->day_timer_tid);
+ sprintf(temp, msg_txt(235), txt_time(DIFF_TICK(timer_data->tick,iTimer->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.
@@ -4418,9 +4441,9 @@ ACMD(servertime)
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 = get_timer(day_timer_tid);
- timer_data2 = get_timer(night_timer_tid);
- sprintf(temp, msg_txt(233), txt_time(DIFF_TICK(timer_data->tick,gettick()) / 1000)); // Game time: The game is actualy in night for %s.
+ timer_data = iTimer->get_timer(pc->day_timer_tid);
+ timer_data2 = iTimer->get_timer(pc->night_timer_tid);
+ sprintf(temp, msg_txt(233), txt_time(DIFF_TICK(timer_data->tick,iTimer->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.
@@ -4481,12 +4504,12 @@ ACMD(jail)
return false;
}
- if ((pl_sd = map_nick2sd(atcmd_player_name)) == NULL) {
+ if ((pl_sd = iMap->nick2sd(atcmd_player_name)) == NULL) {
clif->message(fd, msg_txt(3)); // Character not found.
return false;
}
- if (pc_get_group_level(sd) < pc_get_group_level(pl_sd))
+ if (pc->get_group_level(sd) < pc->get_group_level(pl_sd))
{ // you can jail only lower or same GM
clif->message(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player.
return false;
@@ -4533,12 +4556,12 @@ ACMD(unjail)
return false;
}
- if ((pl_sd = map_nick2sd(atcmd_player_name)) == NULL) {
+ if ((pl_sd = iMap->nick2sd(atcmd_player_name)) == NULL) {
clif->message(fd, msg_txt(3)); // Character not found.
return false;
}
- if (pc_get_group_level(sd) < pc_get_group_level(pl_sd)) { // you can jail only lower or same GM
+ if (pc->get_group_level(sd) < pc->get_group_level(pl_sd)) { // you can jail only lower or same GM
clif->message(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player.
return false;
@@ -4613,12 +4636,12 @@ ACMD(jailfor)
return false;
}
- if ((pl_sd = map_nick2sd(atcmd_player_name)) == NULL) {
+ if ((pl_sd = iMap->nick2sd(atcmd_player_name)) == NULL) {
clif->message(fd, msg_txt(3)); // Character not found.
return false;
}
- if (pc_get_group_level(pl_sd) > pc_get_group_level(sd)) {
+ if (pc->get_group_level(pl_sd) > pc->get_group_level(sd)) {
clif->message(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player.
return false;
}
@@ -4738,7 +4761,7 @@ ACMD(disguise)
return false;
}
- pc_disguise(sd, id);
+ pc->disguise(sd, id);
clif->message(fd, msg_txt(122)); // Disguise applied.
return true;
@@ -4769,7 +4792,7 @@ ACMD(disguiseall)
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) )
- pc_disguise(pl_sd, mob_id);
+ pc->disguise(pl_sd, mob_id);
mapit->free(iter);
clif->message(fd, msg_txt(122)); // Disguise applied.
@@ -4817,7 +4840,7 @@ ACMD(disguiseguild)
for( i = 0; i < g->max_member; i++ )
if( (pl_sd = g->member[i].sd) && !pc_isriding(pl_sd) )
- pc_disguise(pl_sd, id);
+ pc->disguise(pl_sd, id);
clif->message(fd, msg_txt(122)); // Disguise applied.
return true;
@@ -4831,7 +4854,7 @@ ACMD(undisguise)
{
nullpo_retr(-1, sd);
if (sd->disguise != -1) {
- pc_disguise(sd, -1);
+ pc->disguise(sd, -1);
clif->message(fd, msg_txt(124)); // Undisguise applied.
} else {
clif->message(fd, msg_txt(125)); // You're not disguised.
@@ -4852,7 +4875,7 @@ ACMD(undisguiseall) {
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) )
if( pl_sd->disguise != -1 )
- pc_disguise(pl_sd, -1);
+ pc->disguise(pl_sd, -1);
mapit->free(iter);
clif->message(fd, msg_txt(124)); // Undisguise applied.
@@ -4885,7 +4908,7 @@ ACMD(undisguiseguild)
for(i = 0; i < g->max_member; i++)
if( (pl_sd = g->member[i].sd) && pl_sd->disguise != -1 )
- pc_disguise(pl_sd, -1);
+ pc->disguise(pl_sd, -1);
clif->message(fd, msg_txt(124)); // Undisguise applied.
@@ -4902,11 +4925,11 @@ ACMD(exp)
nullpo_retr(-1, sd);
memset(output, '\0', sizeof(output));
- nextb = pc_nextbaseexp(sd);
+ nextb = pc->nextbaseexp(sd);
if (nextb)
nextb = sd->status.base_exp*100.0/nextb;
- nextj = pc_nextjobexp(sd);
+ nextj = pc->nextjobexp(sd);
if (nextj)
nextj = sd->status.job_exp*100.0/nextj;
@@ -5042,7 +5065,7 @@ ACMD(killable)
clif->message(fd, msg_txt(242));
else {
clif->message(fd, msg_txt(288));
- map_foreachinrange(atcommand_stopattack,&sd->bl, AREA_SIZE, BL_CHAR, sd->bl.id);
+ iMap->foreachinrange(atcommand_stopattack,&sd->bl, AREA_SIZE, BL_CHAR, sd->bl.id);
}
return true;
}
@@ -5101,9 +5124,9 @@ ACMD(npcmove)
x = cap_value(x, 0, map[m].xs-1);
y = cap_value(y, 0, map[m].ys-1);
- map_foreachinrange(clif->outsight, &nd->bl, AREA_SIZE, BL_PC, &nd->bl);
- map_moveblock(&nd->bl, x, y, gettick());
- map_foreachinrange(clif->insight, &nd->bl, AREA_SIZE, BL_PC, &nd->bl);
+ iMap->foreachinrange(clif->outsight, &nd->bl, AREA_SIZE, BL_PC, &nd->bl);
+ iMap->moveblock(&nd->bl, x, y, iTimer->gettick());
+ iMap->foreachinrange(clif->insight, &nd->bl, AREA_SIZE, BL_PC, &nd->bl);
clif->message(fd, msg_txt(1155)); // NPC moved.
return true;
@@ -5158,22 +5181,22 @@ ACMD(follow)
if (sd->followtarget == -1)
return false;
- pc_stop_following (sd);
+ pc->stop_following (sd);
clif->message(fd, msg_txt(1159)); // Follow mode OFF.
return true;
}
- if ( (pl_sd = map_nick2sd((char *)message)) == NULL )
+ if ( (pl_sd = iMap->nick2sd((char *)message)) == NULL )
{
clif->message(fd, msg_txt(3)); // Character not found.
return false;
}
if (sd->followtarget == pl_sd->bl.id) {
- pc_stop_following (sd);
+ pc->stop_following (sd);
clif->message(fd, msg_txt(1159)); // Follow mode OFF.
} else {
- pc_follow(sd, pl_sd->bl.id);
+ pc->follow(sd, pl_sd->bl.id);
clif->message(fd, msg_txt(1160)); // Follow mode ON.
}
@@ -5192,8 +5215,8 @@ ACMD(dropall)
for (i = 0; i < MAX_INVENTORY; i++) {
if (sd->status.inventory[i].amount) {
if(sd->status.inventory[i].equip != 0)
- pc_unequipitem(sd, i, 3);
- pc_dropitem(sd, i, sd->status.inventory[i].amount);
+ pc->unequipitem(sd, i, 3);
+ pc->dropitem(sd, i, sd->status.inventory[i].amount);
}
}
return true;
@@ -5219,7 +5242,7 @@ ACMD(storeall)
for (i = 0; i < MAX_INVENTORY; i++) {
if (sd->status.inventory[i].amount) {
if(sd->status.inventory[i].equip != 0)
- pc_unequipitem(sd, i, 3);
+ pc->unequipitem(sd, i, 3);
storage_storageadd(sd, i, sd->status.inventory[i].amount);
}
}
@@ -5306,7 +5329,7 @@ ACMD(clearcart)
for( i = 0; i < MAX_CART; i++ )
if(sd->status.cart[i].nameid > 0)
- pc_cart_delitem(sd, i, sd->status.cart[i].amount, 1, LOG_TYPE_OTHER);
+ pc->cart_delitem(sd, i, sd->status.cart[i].amount, 1, LOG_TYPE_OTHER);
clif->clearcart(fd);
clif->updatestatus(sd,SP_CARTINFO);
@@ -5382,12 +5405,12 @@ ACMD(useskill)
}
if(!strcmp(target,"self")) pl_sd = sd; //quick keyword
- else if ( (pl_sd = map_nick2sd(target)) == NULL ){
+ else if ( (pl_sd = iMap->nick2sd(target)) == NULL ){
clif->message(fd, msg_txt(3)); // Character not found.
return false;
}
- if ( pc_get_group_level(sd) < pc_get_group_level(pl_sd) )
+ if ( pc->get_group_level(sd) < pc->get_group_level(pl_sd) )
{
clif->message(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player.
return false;
@@ -5426,7 +5449,7 @@ ACMD(displayskill)
return false;
}
status = status_get_status_data(&sd->bl);
- tick = gettick();
+ tick = iTimer->gettick();
clif->skill_damage(&sd->bl,&sd->bl, tick, status->amotion, status->dmotion, 1, 1, skill_id, skill_lv, 5);
clif->skill_nodamage(&sd->bl, &sd->bl, skill_id, skill_lv, 1);
clif->skill_poseffect(&sd->bl, skill_id, skill_lv, sd->bl.x, sd->bl.y, tick);
@@ -5451,16 +5474,16 @@ ACMD(skilltree)
return false;
}
- if ( (pl_sd = map_nick2sd(target)) == NULL )
+ if ( (pl_sd = iMap->nick2sd(target)) == NULL )
{
clif->message(fd, msg_txt(3)); // Character not found.
return false;
}
- c = pc_calc_skilltree_normalize_job(pl_sd);
- c = pc_mapid2jobid(c, pl_sd->status.sex);
+ c = pc->calc_skilltree_normalize_job(pl_sd);
+ c = pc->mapid2jobid(c, pl_sd->status.sex);
- sprintf(atcmd_output, msg_txt(1168), job_name(c), pc_checkskill(pl_sd, NV_BASIC)); // Player is using %s skill tree (%d basic points).
+ sprintf(atcmd_output, msg_txt(1168), pc->job_name(c), pc->checkskill(pl_sd, NV_BASIC)); // Player is using %s skill tree (%d basic points).
clif->message(fd, atcmd_output);
ARR_FIND( 0, MAX_SKILL_TREE, j, skill_tree[c][j].id == 0 || skill_tree[c][j].id == skill_id );
@@ -5475,7 +5498,7 @@ ACMD(skilltree)
meets = 1;
for(j=0;j<MAX_PC_SKILL_REQUIRE;j++)
{
- if( ent->need[j].id && pc_checkskill(sd,ent->need[j].id) < ent->need[j].lv)
+ if( ent->need[j].id && pc->checkskill(sd,ent->need[j].id) < ent->need[j].lv)
{
sprintf(atcmd_output, msg_txt(1170), ent->need[j].lv, skill_db[ent->need[j].id].desc); // Player requires level %d of skill %s.
clif->message(fd, atcmd_output);
@@ -5503,9 +5526,9 @@ void getring (struct map_session_data* sd)
item_tmp.card[2] = sd->status.partner_id;
item_tmp.card[3] = sd->status.partner_id >> 16;
- if((flag = pc_additem(sd,&item_tmp,1,LOG_TYPE_COMMAND))) {
+ if((flag = pc->additem(sd,&item_tmp,1,LOG_TYPE_COMMAND))) {
clif->additem(sd,0,0,flag);
- map_addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ iMap->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
}
@@ -5525,12 +5548,12 @@ ACMD(marry)
return false;
}
- if ((pl_sd = map_nick2sd(player_name)) == NULL) {
+ if ((pl_sd = iMap->nick2sd(player_name)) == NULL) {
clif->message(fd, msg_txt(3));
return false;
}
- if (pc_marriage(sd, pl_sd) == 0) {
+ if (pc->marriage(sd, pl_sd) == 0) {
clif->message(fd, msg_txt(1173)); // They are married... wish them well.
clif->wedding_effect(&pl_sd->bl); //wedding effect and music [Lupus]
getring(sd); // Auto-give named rings (Aru)
@@ -5550,7 +5573,7 @@ ACMD(divorce)
{
nullpo_retr(-1, sd);
- if (pc_divorce(sd) != 0) {
+ if (pc->divorce(sd) != 0) {
sprintf(atcmd_output, msg_txt(1175), sd->status.name); // '%s' is not married.
clif->message(fd, atcmd_output);
return false;
@@ -5647,7 +5670,7 @@ ACMD(changegm)
return false;
}
- if((pl_sd=map_nick2sd((char *) message)) == NULL || pl_sd->status.guild_id != sd->status.guild_id) {
+ if((pl_sd=iMap->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;
}
@@ -5670,7 +5693,7 @@ ACMD(changeleader)
return false;
}
- if (party_changeleader(sd, map_nick2sd((char *) message)))
+ if (party->changeleader(sd, iMap->nick2sd((char *) message)))
return true;
return false;
}
@@ -5686,7 +5709,7 @@ ACMD(partyoption)
char w1[16], w2[16];
nullpo_retr(-1, sd);
- if (sd->status.party_id == 0 || (p = party_search(sd->status.party_id)) == NULL)
+ if (sd->status.party_id == 0 || (p = party->search(sd->status.party_id)) == NULL)
{
clif->message(fd, msg_txt(282));
return false;
@@ -5712,7 +5735,7 @@ ACMD(partyoption)
//Change item share type.
if (option != p->party.item)
- party_changeoption(sd, p->party.exp, option);
+ party->changeoption(sd, p->party.exp, option);
else
clif->message(fd, msg_txt(286));
@@ -6106,14 +6129,14 @@ ACMD(mobsearch)
static int atcommand_cleanfloor_sub(struct block_list *bl, va_list ap)
{
nullpo_ret(bl);
- map_clearflooritem(bl);
+ iMap->clearflooritem(bl);
return 0;
}
ACMD(cleanmap)
{
- map_foreachinmap(atcommand_cleanfloor_sub, sd->bl.m, BL_ITEM);
+ iMap->foreachinmap(atcommand_cleanfloor_sub, sd->bl.m, BL_ITEM);
clif->message(fd, msg_txt(1221)); // All dropped items have been cleaned up.
return true;
}
@@ -6123,13 +6146,13 @@ 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) {
- map_foreachinarea(atcommand_cleanfloor_sub, sd->bl.m, sd->bl.x - (AREA_SIZE * 2), sd->bl.y - (AREA_SIZE * 2), sd->bl.x + (AREA_SIZE * 2), sd->bl.y + (AREA_SIZE * 2), BL_ITEM);
+ iMap->foreachinarea(atcommand_cleanfloor_sub, sd->bl.m, sd->bl.x - (AREA_SIZE * 2), sd->bl.y - (AREA_SIZE * 2), sd->bl.x + (AREA_SIZE * 2), sd->bl.y + (AREA_SIZE * 2), BL_ITEM);
}
else if (sscanf(message, "%d %d %d %d", &x0, &y0, &x1, &y1) == 1) {
- map_foreachinarea(atcommand_cleanfloor_sub, sd->bl.m, sd->bl.x - x0, sd->bl.y - x0, sd->bl.x + x0, sd->bl.y + x0, BL_ITEM);
+ iMap->foreachinarea(atcommand_cleanfloor_sub, sd->bl.m, sd->bl.x - x0, sd->bl.y - x0, sd->bl.x + x0, sd->bl.y + 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);
+ iMap->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.
@@ -6148,7 +6171,7 @@ ACMD(npctalk)
unsigned long color=0;
if (sd->sc.count && //no "chatting" while muted.
- (sd->sc.data[SC_BERSERK] || sd->sc.data[SC__BLOODYLUST] ||
+ (sd->sc.data[SC_BERSERK] || sd->sc.data[SC_DEEP_SLEEP] || sd->sc.data[SC__BLOODYLUST] ||
(sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT)))
return false;
@@ -6187,9 +6210,9 @@ ACMD(pettalk)
nullpo_retr(-1, sd);
if ( battle_config.min_chat_delay ) {
- if( DIFF_TICK(sd->cantalk_tick, gettick()) > 0 )
+ if( DIFF_TICK(sd->cantalk_tick, iTimer->gettick()) > 0 )
return true;
- sd->cantalk_tick = gettick() + battle_config.min_chat_delay;
+ sd->cantalk_tick = iTimer->gettick() + battle_config.min_chat_delay;
}
if(!sd->status.pet_id || !(pd=sd->pd))
@@ -6199,7 +6222,7 @@ ACMD(pettalk)
}
if (sd->sc.count && //no "chatting" while muted.
- (sd->sc.data[SC_BERSERK] || sd->sc.data[SC__BLOODYLUST] ||
+ (sd->sc.data[SC_BERSERK] || sd->sc.data[SC_DEEP_SLEEP] || sd->sc.data[SC__BLOODYLUST] ||
(sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT)))
return false;
@@ -6294,8 +6317,8 @@ ACMD(users)
*------------------------------------------*/
ACMD(reset)
{
- pc_resetstate(sd);
- pc_resetskill(sd,1);
+ pc->resetstate(sd);
+ pc->resetskill(sd,1);
sprintf(atcmd_output, msg_txt(208), sd->status.name); // '%s' skill and stats points reseted!
clif->message(fd, atcmd_output);
return true;
@@ -6310,7 +6333,7 @@ ACMD(summon)
int mob_id = 0;
int duration = 0;
struct mob_data *md;
- unsigned int tick=gettick();
+ unsigned int tick=iTimer->gettick();
nullpo_retr(-1, sd);
@@ -6340,7 +6363,7 @@ ACMD(summon)
md->master_id=sd->bl.id;
md->special_state.ai=1;
- md->deletetimer=add_timer(tick+(duration*60000),mob_timer_delete,md->bl.id,0);
+ md->deletetimer=iTimer->add_timer(tick+(duration*60000),mob_timer_delete,md->bl.id,0);
clif->specialeffect(&md->bl,344,AREA);
mob_spawn(md);
sc_start4(&md->bl, SC_MODECHANGE, 100, 1, 0, MD_AGGRESSIVE, 0, 60000);
@@ -6391,13 +6414,13 @@ ACMD(trade)
return false;
}
- if ( (pl_sd = map_nick2sd((char *)message)) == NULL )
+ if ( (pl_sd = iMap->nick2sd((char *)message)) == NULL )
{
clif->message(fd, msg_txt(3)); // Character not found.
return false;
}
- trade_traderequest(sd, pl_sd);
+ trade->request(sd, pl_sd);
return true;
}
@@ -6438,7 +6461,7 @@ ACMD(unmute)
return false;
}
- if ( (pl_sd = map_nick2sd((char *)message)) == NULL )
+ if ( (pl_sd = iMap->nick2sd((char *)message)) == NULL )
{
clif->message(fd, msg_txt(3)); // Character not found.
return false;
@@ -6465,7 +6488,7 @@ ACMD(uptime)
minute = 60, days = 0, hours = 0, minutes = 0;
nullpo_retr(-1, sd);
- seconds = get_uptime();
+ seconds = iTimer->get_uptime();
days = seconds/day;
seconds -= (seconds/day>0)?(seconds/day)*day:0;
hours = seconds/hour;
@@ -6487,10 +6510,10 @@ ACMD(changesex)
{
int i;
nullpo_retr(-1, sd);
- pc_resetskill(sd,4);
+ pc->resetskill(sd,4);
// to avoid any problem with equipment and invalid sex, equipment is unequiped.
for( i=0; i<EQI_MAX; i++ )
- if( sd->equip_index[i] >= 0 ) pc_unequipitem(sd, sd->equip_index[i], 3);
+ if( sd->equip_index[i] >= 0 ) pc->unequipitem(sd, sd->equip_index[i], 3);
chrif_changesex(sd);
return true;
}
@@ -6509,13 +6532,13 @@ ACMD(mute)
return false;
}
- if ( (pl_sd = map_nick2sd(atcmd_player_name)) == NULL )
+ if ( (pl_sd = iMap->nick2sd(atcmd_player_name)) == NULL )
{
clif->message(fd, msg_txt(3)); // Character not found.
return false;
}
- if ( pc_get_group_level(sd) < pc_get_group_level(pl_sd) )
+ if ( pc->get_group_level(sd) < pc->get_group_level(pl_sd) )
{
clif->message(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player.
return false;
@@ -6601,7 +6624,7 @@ ACMD(misceffect) {
ACMD(mail)
{
nullpo_ret(sd);
- mail_openmail(sd);
+ mail->openmail(sd);
return true;
}
@@ -6867,18 +6890,24 @@ ACMD(hommutate) {
ACMD(makehomun) {
int homunid;
nullpo_retr(-1, sd);
-
- if ( sd->status.hom_id ) {
- clif->message(fd, msg_txt(450));
- return false;
- }
-
+
if (!message || !*message) {
clif->message(fd, msg_txt(1256)); // Please enter a homunculus ID (usage: @makehomun <homunculus id>).
return false;
}
homunid = atoi(message);
+
+ if( homunid == -1 && sd->status.hom_id && !homun_alive(sd->hd) ) {
+ homun->call(sd);
+ return true;
+ }
+
+ if ( sd->status.hom_id ) {
+ clif->message(fd, msg_txt(450));
+ return false;
+ }
+
if( homunid < HM_CLASS_BASE || homunid > HM_CLASS_BASE + MAX_HOMUNCULUS_CLASS - 1 )
{
clif->message(fd, msg_txt(1257)); // Invalid Homunculus ID.
@@ -6953,13 +6982,13 @@ ACMD(homtalk)
nullpo_retr(-1, sd);
if ( battle_config.min_chat_delay ) {
- if( DIFF_TICK(sd->cantalk_tick, gettick()) > 0 )
+ if( DIFF_TICK(sd->cantalk_tick, iTimer->gettick()) > 0 )
return true;
- sd->cantalk_tick = gettick() + battle_config.min_chat_delay;
+ sd->cantalk_tick = iTimer->gettick() + battle_config.min_chat_delay;
}
if (sd->sc.count && //no "chatting" while muted.
- (sd->sc.data[SC_BERSERK] || sd->sc.data[SC__BLOODYLUST] ||
+ (sd->sc.data[SC_BERSERK] || sd->sc.data[SC_DEEP_SLEEP] || sd->sc.data[SC__BLOODYLUST] ||
(sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT)))
return false;
@@ -7234,7 +7263,7 @@ ACMD(whereis)
for (i = 0; i < ARRAYLENGTH(mob->spawn) && mob->spawn[i].qty; i++)
{
- j = map_mapindex2mapid(mob->spawn[i].mapindex);
+ j = iMap->mapindex2mapid(mob->spawn[i].mapindex);
if (j < 0) continue;
snprintf(atcmd_output, sizeof atcmd_output, "%s (%d)", map[j].name, mob->spawn[i].qty);
clif->message(fd, atcmd_output);
@@ -7276,7 +7305,7 @@ static int atcommand_mutearea_sub(struct block_list *bl,va_list ap)
id = va_arg(ap, int);
time = va_arg(ap, int);
- if (id != bl->id && !pc_get_group_level(pl_sd)) {
+ if (id != bl->id && !pc->get_group_level(pl_sd)) {
pl_sd->status.manner -= time;
if (pl_sd->status.manner < 0)
sc_start(&pl_sd->bl,SC_NOCHAT,100,0,0);
@@ -7298,7 +7327,7 @@ ACMD(mutearea)
time = atoi(message);
- map_foreachinarea(atcommand_mutearea_sub,sd->bl.m,
+ 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);
@@ -7342,7 +7371,7 @@ ACMD(me)
memset(atcmd_output, '\0', sizeof(atcmd_output));
if (sd->sc.count && //no "chatting" while muted.
- (sd->sc.data[SC_BERSERK] || sd->sc.data[SC__BLOODYLUST] ||
+ (sd->sc.data[SC_BERSERK] || sd->sc.data[SC_DEEP_SLEEP] || sd->sc.data[SC__BLOODYLUST] ||
(sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT)))
return false;
@@ -7371,7 +7400,7 @@ ACMD(size)
if(sd->state.size) {
sd->state.size = SZ_SMALL;
- pc_setpos(sd, sd->mapindex, sd->bl.x, sd->bl.y, CLR_TELEPORT);
+ pc->setpos(sd, sd->mapindex, sd->bl.x, sd->bl.y, CLR_TELEPORT);
}
sd->state.size = size;
@@ -7398,7 +7427,7 @@ ACMD(sizeall)
if( pl_sd->state.size != size ) {
if( pl_sd->state.size ) {
pl_sd->state.size = SZ_SMALL;
- pc_setpos(pl_sd, pl_sd->mapindex, pl_sd->bl.x, pl_sd->bl.y, CLR_TELEPORT);
+ pc->setpos(pl_sd, pl_sd->mapindex, pl_sd->bl.x, pl_sd->bl.y, CLR_TELEPORT);
}
pl_sd->state.size = size;
@@ -7440,7 +7469,7 @@ ACMD(sizeguild)
if( (pl_sd = g->member[i].sd) && pl_sd->state.size != size ) {
if( pl_sd->state.size ) {
pl_sd->state.size = SZ_SMALL;
- pc_setpos(pl_sd, pl_sd->mapindex, pl_sd->bl.x, pl_sd->bl.y, CLR_TELEPORT);
+ pc->setpos(pl_sd, pl_sd->mapindex, pl_sd->bl.x, pl_sd->bl.y, CLR_TELEPORT);
}
pl_sd->state.size = size;
@@ -7549,19 +7578,19 @@ return true;\
if ( strcmp( flag_name , "gvg" ) == 0 ) {
if( flag && !map[sd->bl.m].flag.gvg )
- map_zone_change2(sd->bl.m,strdb_get(zone_db, MAP_ZONE_GVG_NAME));
+ iMap->zone_change2(sd->bl.m,strdb_get(zone_db, MAP_ZONE_GVG_NAME));
else if ( !flag && map[sd->bl.m].flag.gvg )
- map_zone_change2(sd->bl.m,map[sd->bl.m].prev_zone);
+ iMap->zone_change2(sd->bl.m,map[sd->bl.m].prev_zone);
} else if ( strcmp( flag_name , "pvp" ) == 0 ) {
if( flag && !map[sd->bl.m].flag.pvp )
- map_zone_change2(sd->bl.m,strdb_get(zone_db, MAP_ZONE_PVP_NAME));
+ iMap->zone_change2(sd->bl.m,strdb_get(zone_db, MAP_ZONE_PVP_NAME));
else if ( !flag && map[sd->bl.m].flag.pvp )
- map_zone_change2(sd->bl.m,map[sd->bl.m].prev_zone);
+ iMap->zone_change2(sd->bl.m,map[sd->bl.m].prev_zone);
} else if ( strcmp( flag_name , "battleground" ) == 0 ) {
if( flag && !map[sd->bl.m].flag.battleground )
- map_zone_change2(sd->bl.m,strdb_get(zone_db, MAP_ZONE_BG_NAME));
+ iMap->zone_change2(sd->bl.m,strdb_get(zone_db, MAP_ZONE_BG_NAME));
else if ( !flag && map[sd->bl.m].flag.battleground )
- map_zone_change2(sd->bl.m,map[sd->bl.m].prev_zone);
+ iMap->zone_change2(sd->bl.m,map[sd->bl.m].prev_zone);
}
setflag(autotrade); setflag(allowks); setflag(nomemo); setflag(noteleport);
@@ -7649,7 +7678,7 @@ ACMD(showdelay)
ACMD(invite)
{
unsigned int did = sd->duel_group;
- struct map_session_data *target_sd = map_nick2sd((char *)message);
+ struct map_session_data *target_sd = iMap->nick2sd((char *)message);
if(did == 0) {
// "Duel: @invite without @duel."
@@ -7722,7 +7751,7 @@ ACMD(duel)
duel_create(sd, maxpl);
} else {
struct map_session_data *target_sd;
- target_sd = map_nick2sd((char *)message);
+ target_sd = iMap->nick2sd((char *)message);
if(target_sd != NULL) {
unsigned int newduel;
if((newduel = duel_create(sd, 2)) != -1) {
@@ -7820,13 +7849,13 @@ ACMD(cash)
if( !strcmpi(command+1,"cash") )
{
if( value > 0 ) {
- if( (ret=pc_getcash(sd, value, 0)) >= 0){
+ if( (ret=pc->getcash(sd, value, 0)) >= 0){
sprintf(output, msg_txt(505), ret, sd->cashPoints);
clif->disp_onlyself(sd, output, strlen(output));
}
else clif->message(fd, msg_txt(149)); // Unable to decrease the number/value.
} else {
- if( (ret=pc_paycash(sd, -value, 0)) >= 0){
+ if( (ret=pc->paycash(sd, -value, 0)) >= 0){
sprintf(output, msg_txt(410), ret, sd->cashPoints);
clif->disp_onlyself(sd, output, strlen(output));
}
@@ -7836,13 +7865,13 @@ ACMD(cash)
else
{ // @points
if( value > 0 ) {
- if( (ret=pc_getcash(sd, 0, value)) >= 0){
+ if( (ret=pc->getcash(sd, 0, value)) >= 0){
sprintf(output, msg_txt(506), ret, sd->kafraPoints);
clif->disp_onlyself(sd, output, strlen(output));
}
else clif->message(fd, msg_txt(149)); // Unable to decrease the number/value.
} else {
- if( (ret=pc_paycash(sd, -value, -value)) >= 0){
+ if( (ret=pc->paycash(sd, -value, -value)) >= 0){
sprintf(output, msg_txt(411), ret, sd->kafraPoints);
clif->disp_onlyself(sd, output, strlen(output));
}
@@ -7864,12 +7893,12 @@ ACMD(clone)
return true;
}
- if((pl_sd=map_nick2sd((char *)message)) == NULL && (pl_sd=map_charid2sd(atoi(message))) == NULL) {
+ if((pl_sd=iMap->nick2sd((char *)message)) == NULL && (pl_sd=iMap->charid2sd(atoi(message))) == NULL) {
clif->message(fd, msg_txt(3)); // Character not found.
return true;
}
- if(pc_get_group_level(pl_sd) > pc_get_group_level(sd)) {
+ if(pc->get_group_level(pl_sd) > pc->get_group_level(sd)) {
clif->message(fd, msg_txt(126)); // Cannot clone a player of higher GM level than yourself.
return true;
}
@@ -7893,7 +7922,7 @@ ACMD(clone)
do {
x = sd->bl.x + (rnd() % 10 - 5);
y = sd->bl.y + (rnd() % 10 - 5);
- } while (map_getcell(sd->bl.m,x,y,CELL_CHKNOPASS) && i++ < 10);
+ } while (iMap->getcell(sd->bl.m,x,y,CELL_CHKNOPASS) && i++ < 10);
if (i >= 10) {
x = sd->bl.x;
@@ -7948,7 +7977,7 @@ ACMD(request)
*------------------------------------------*/
ACMD(feelreset)
{
- pc_resetfeel(sd);
+ pc->resetfeel(sd);
clif->message(fd, msg_txt(1324)); // Reset 'Feeling' maps.
return true;
@@ -8020,7 +8049,7 @@ ACMD(resetstat)
{
nullpo_retr(-1, sd);
- pc_resetstate(sd);
+ pc->resetstate(sd);
sprintf(atcmd_output, msg_txt(207), sd->status.name);
clif->message(fd, atcmd_output);
return true;
@@ -8030,7 +8059,7 @@ ACMD(resetskill)
{
nullpo_retr(-1,sd);
- pc_resetskill(sd,1);
+ pc->resetskill(sd,1);
sprintf(atcmd_output, msg_txt(206), sd->status.name);
clif->message(fd, atcmd_output);
return true;
@@ -8252,7 +8281,7 @@ ACMD(stats)
output_table[14].value = sd->change_level_2nd;
output_table[15].value = sd->change_level_3rd;
- sprintf(job_jobname, "Job - %s %s", job_name(sd->status.class_), "(level %d)");
+ sprintf(job_jobname, "Job - %s %s", pc->job_name(sd->status.class_), "(level %d)");
sprintf(output, msg_txt(53), sd->status.name); // '%s' stats:
clif->message(fd, output);
@@ -8292,7 +8321,7 @@ ACMD(delitem)
total = amount;
// delete items
- while( amount && ( idx = pc_search_inventory(sd, nameid) ) != -1 )
+ while( amount && ( idx = pc->search_inventory(sd, nameid) ) != -1 )
{
int delamount = ( amount < sd->status.inventory[idx].amount ) ? amount : sd->status.inventory[idx].amount;
@@ -8300,7 +8329,7 @@ ACMD(delitem)
{// delete pet
intif_delete_petdata(MakeDWord(sd->status.inventory[idx].card[1], sd->status.inventory[idx].card[2]));
}
- pc_delitem(sd, idx, delamount, 0, 0, LOG_TYPE_COMMAND);
+ pc->delitem(sd, idx, delamount, 0, 0, LOG_TYPE_COMMAND);
amount-= delamount;
}
@@ -8466,7 +8495,7 @@ ACMD(accinfo) {
//remove const type
safestrncpy(query, message, NAME_LENGTH);
- intif_request_accinfo( sd->fd, sd->bl.id, pc_get_group_level(sd), query );
+ intif_request_accinfo( sd->fd, sd->bl.id, pc->get_group_level(sd), query );
return true;
}
@@ -8519,7 +8548,7 @@ ACMD(set) {
switch( reg[0] ) {
case '@':
- data->u.str = pc_readregstr(sd, add_str(reg));
+ data->u.str = pc->readregstr(sd, add_str(reg));
break;
case '$':
data->u.str = mapreg_readregstr(add_str(reg));
@@ -8548,7 +8577,7 @@ ACMD(set) {
data->type = C_INT;
switch( reg[0] ) {
case '@':
- data->u.num = pc_readreg(sd, add_str(reg));
+ data->u.num = pc->readreg(sd, add_str(reg));
break;
case '$':
data->u.num = mapreg_readreg(add_str(reg));
@@ -8674,7 +8703,7 @@ sd->status.skill[idx].lv = x?1:0; \
sd->status.skill[idx].flag = x?1:0;
int val = atoi(message);
- bool need_skill = pc_checkskill(sd, MC_PUSHCART) ? false : true;
+ bool need_skill = pc->checkskill(sd, MC_PUSHCART) ? false : true;
unsigned int index = skill->get_index(MC_PUSHCART);
if( !message || !*message || val < 0 || val > MAX_CARTS ) {
@@ -8692,7 +8721,7 @@ sd->status.skill[idx].flag = x?1:0;
MC_CART_MDFY(1,index);
}
- if( pc_setcart(sd, val) ) {
+ if( pc->setcart(sd, val) ) {
if( need_skill ) {
MC_CART_MDFY(0,index);
}
@@ -9017,7 +9046,7 @@ ACMD(channel) {
return false;
}
- if( sub2[0] == '\0' || ( pl_sd = map_nick2sd(sub2) ) == NULL ) {
+ 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;
@@ -9073,7 +9102,7 @@ ACMD(channel) {
return false;
}
- if( sub2[0] == '\0' || ( pl_sd = map_nick2sd(sub2) ) == NULL ) {
+ 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;
@@ -9672,6 +9701,7 @@ void atcommand_basecommands(void) {
safestrncpy(cmd->command, atcommand_base[i].command, sizeof(cmd->command));
cmd->func = atcommand_base[i].func;
cmd->help = NULL;/* start as null dear */
+ cmd->log = true;
strdb_put(atcommand->db, cmd->command, cmd);
}
return;
@@ -9807,7 +9837,7 @@ bool is_atcommand(const int fd, struct map_session_data* sd, const char* message
// 1 = player invoked
if ( type == 1) {
//Commands are disabled on maps flagged as 'nocommand'
- if ( map[sd->bl.m].nocommand && pc_get_group_level(sd) < map[sd->bl.m].nocommand ) {
+ if ( map[sd->bl.m].nocommand && pc->get_group_level(sd) < map[sd->bl.m].nocommand ) {
clif->message(fd, msg_txt(143));
return false;
}
@@ -9842,7 +9872,7 @@ bool is_atcommand(const int fd, struct map_session_data* sd, const char* message
break;
}
- if( !pc_get_group_level(sd) ) {
+ if( !pc->get_group_level(sd) ) {
if( x >= 1 || y >= 1 ) { /* we have command */
info = get_atcommandinfo_byname(atcommand_checkalias(command + 1));
if( !info || info->char_groups[sd->group_pos] == 0 ) /* if we can't use or doesn't exist: don't even display the command failed message */
@@ -9880,15 +9910,15 @@ bool is_atcommand(const int fd, struct map_session_data* sd, const char* message
// 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)))
+ ((*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 = map_nick2sd(charname)) == NULL && (ssd = map_nick2sd(charname2)) == NULL ) {
+ (ssd = iMap->nick2sd(charname)) == NULL && (ssd = iMap->nick2sd(charname2)) == NULL ) {
sprintf(output, msg_txt(1389), command); // %s failed. Player not found.
clif->message(fd, output);
return true;
@@ -9905,7 +9935,7 @@ bool is_atcommand(const int fd, struct map_session_data* sd, const char* message
//Grab the command information and check for the proper GM level required to use it or if the command exists
info = get_atcommandinfo_byname(atcommand_checkalias(command + 1));
if (info == NULL) {
- if( pc_get_group_level(sd) ) { // TODO: remove or replace with proper permission
+ if( pc->get_group_level(sd) ) { // TODO: remove or replace with proper permission
sprintf(output, msg_txt(153), command); // "%s is Unknown Command."
clif->message(fd, output);
atcommand_get_suggestions(sd, command + 1, *message == atcommand->at_symbol);
@@ -9938,7 +9968,7 @@ 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 = map_nick2sd(charname)) == NULL && (ssd = map_nick2sd(charname2)) == NULL ) {
+ (ssd = iMap->nick2sd(charname)) == NULL && (ssd = iMap->nick2sd(charname2)) == NULL ) {
sprintf(output, msg_txt(1389), command); // %s failed. Player not found.
clif->message(fd, output);
return true;
@@ -10088,14 +10118,15 @@ void atcommand_db_load_groups(void) {
cmd->at_groups = aMalloc( pc_group_max * sizeof(char) );
cmd->char_groups = aMalloc( pc_group_max * sizeof(char) );
for(i = 0; i < pc_group_max; i++) {
+ int idx = pc_group_id2idx(atcommand->group_ids[i]);
if( pc_group_can_use_command(atcommand->group_ids[i], cmd->command, COMMAND_ATCOMMAND ) )
- cmd->at_groups[i] = 1;
+ cmd->at_groups[idx] = 1;
else
- cmd->at_groups[i] = 0;
+ cmd->at_groups[idx] = 0;
if( pc_group_can_use_command(atcommand->group_ids[i], cmd->command, COMMAND_CHARCOMMAND ) )
- cmd->char_groups[i] = 1;
+ cmd->char_groups[idx] = 1;
else
- cmd->char_groups[i] = 0;
+ cmd->char_groups[idx] = 0;
}
}
@@ -10150,6 +10181,7 @@ bool atcommand_hp_add(char *name, AtCommandFunc func) {
safestrncpy(cmd->command, name, sizeof(cmd->command));
cmd->func = func;
cmd->help = NULL;/* start as null dear */
+ cmd->log = true;
strdb_put(atcommand->db, cmd->command, cmd);
return true;
@@ -10182,7 +10214,7 @@ void atcommand_doload(void) {
atcommand->db = stridb_alloc(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA, ATCOMMAND_LENGTH);
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(ATCOMMAND_CONF_FILENAME);
+ atcommand_config_read(iMap->ATCOMMAND_CONF_FILENAME);
}
void do_init_atcommand(void) {