summaryrefslogtreecommitdiff
path: root/src/map/pc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/pc.c')
-rw-r--r--src/map/pc.c398
1 files changed, 184 insertions, 214 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index 29a59cd69..393caa627 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 )
@@ -314,7 +312,7 @@ static int pc_check_banding( struct block_list *bl, va_list ap ) {
if(pc_isdead(tsd))
return 0;
- sc = iStatus->get_sc(bl);
+ sc = status->get_sc(bl);
if( bl == src )
return 0;
@@ -341,12 +339,12 @@ int pc_banding(struct map_session_data *sd, uint16 skill_lv) {
memset(b_sd, 0, sizeof(b_sd));
i = party_foreachsamemap(pc_check_banding,sd,range,&sd->bl,&c,&b_sd);
- if( c < 1 ) //just recalc status no need to recalc hp
- { // No more Royal Guards in Banding found.
- if( (sc = iStatus->get_sc(&sd->bl)) != NULL && sc->data[SC_BANDING] )
- {
+ if( c < 1 ) {
+ //just recalc status no need to recalc hp
+ if( (sc = status->get_sc(&sd->bl)) != NULL && sc->data[SC_BANDING] ) {
+ // No more Royal Guards in Banding found.
sc->data[SC_BANDING]->val2 = 0; // Reset the counter
- status_calc_bl(&sd->bl, iStatus->sc2scb_flag(SC_BANDING));
+ status_calc_bl(&sd->bl, status->sc2scb_flag(SC_BANDING));
}
return 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,16 +376,13 @@ 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]);
- if( bsd != NULL )
- {
- iStatus->set_hp(&bsd->bl,hp,0); // Set hp
- if( (sc = iStatus->get_sc(&bsd->bl)) != NULL && sc->data[SC_BANDING] )
- {
+ 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] ) {
sc->data[SC_BANDING]->val2 = c; // Set the counter. It doesn't count your self.
- status_calc_bl(&bsd->bl, iStatus->sc2scb_flag(SC_BANDING)); // Set atk and def.
+ status_calc_bl(&bsd->bl, status->sc2scb_flag(SC_BANDING)); // Set atk and def.
}
}
}
@@ -451,10 +444,10 @@ int pc_setrestartvalue(struct map_session_data *sd,int type) {
st = &sd->battle_status;
if (type&1) { //Normal resurrection
- st->hp = 1; //Otherwise iStatus->heal may fail if dead.
- iStatus->heal(&sd->bl, bst->hp, 0, 1);
+ st->hp = 1; //Otherwise status->heal may fail if dead.
+ status->heal(&sd->bl, bst->hp, 0, 1);
if( st->sp < bst->sp )
- iStatus->set_sp(&sd->bl, bst->sp, 1);
+ status->set_sp(&sd->bl, bst->sp, 1);
} else { //Just for saving on the char-server (with values as if respawned)
sd->status.hp = bst->hp;
sd->status.sp = (st->sp < bst->sp) ? bst->sp : st->sp;
@@ -465,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 )
@@ -1072,12 +1064,12 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim
if( sd->status.option & OPTION_INVISIBLE && !pc->can_use_command(sd, "@hide") )
sd->status.option &=~ OPTION_INVISIBLE;
- iStatus->change_init(&sd->bl);
+ status->change_init(&sd->bl);
sd->sc.option = sd->status.option; //This is the actual option used in battle.
//Set here because we need the inventory data for weapon sprite parsing.
- iStatus->set_viewdata(&sd->bl, sd->status.class_);
+ status->set_viewdata(&sd->bl, sd->status.class_);
unit->dataset(&sd->bl);
sd->guild_x = -1;
@@ -1155,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);
}
/**
@@ -1204,7 +1196,7 @@ int pc_set_hate_mob(struct map_session_data *sd, int pos, struct block_list *bl)
return 0;
}
- class_ = iStatus->get_class(bl);
+ class_ = status->get_class(bl);
if (!pcdb_checkid(class_)) {
unsigned int max_hp = status_get_max_hp(bl);
if ((pos == 1 && max_hp < 6000) || (pos == 2 && max_hp < 20000))
@@ -1246,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;
@@ -1296,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);
@@ -1342,7 +1334,7 @@ int pc_calc_skillpoint(struct map_session_data* sd) {
for(i=1;i<MAX_SKILL;i++){
if( (skill_lv = pc->checkskill2(sd,i)) > 0) {
- inf2 = skill_db[i].inf2;
+ inf2 = skill->db[i].inf2;
if((!(inf2&INF2_QUEST_SKILL) || battle_config.quest_skill_learn) &&
!(inf2&(INF2_WEDDING_SKILL|INF2_SPIRIT_SKILL|INF2_GUILD_SKILL)) //Do not count wedding/link skills. [Skotlex]
) {
@@ -1381,7 +1373,7 @@ int pc_calc_skilltree(struct map_session_data *sd)
sd->status.skill[i].id = 0; //First clear skills.
/* permanent skills that must be re-checked */
if( sd->status.skill[i].flag == SKILL_FLAG_PERMANENT ) {
- switch( skill_db[i].nameid ) {
+ switch( skill->db[i].nameid ) {
case NV_TRICKDEAD:
if( (sd->class_&MAPID_BASEMASK) != MAPID_NOVICE ) {
sd->status.skill[i].id = 0;
@@ -1400,19 +1392,19 @@ int pc_calc_skilltree(struct map_session_data *sd)
sd->status.skill[i].flag = SKILL_FLAG_PERMANENT;
}
- if( sd->sc.count && sd->sc.data[SC_SOULLINK] && sd->sc.data[SC_SOULLINK]->val2 == SL_BARDDANCER && skill_db[i].nameid >= DC_HUMMING && skill_db[i].nameid <= DC_SERVICEFORYOU )
+ if( sd->sc.count && sd->sc.data[SC_SOULLINK] && sd->sc.data[SC_SOULLINK]->val2 == SL_BARDDANCER && skill->db[i].nameid >= DC_HUMMING && skill->db[i].nameid <= DC_SERVICEFORYOU )
{ //Enable Bard/Dancer spirit linked skills.
if( sd->status.sex )
{ //Link dancer skills to bard.
if( sd->status.skill[i-8].lv < 10 )
continue;
- sd->status.skill[i].id = skill_db[i].nameid;
+ sd->status.skill[i].id = skill->db[i].nameid;
sd->status.skill[i].lv = sd->status.skill[i-8].lv; // Set the level to the same as the linking skill
sd->status.skill[i].flag = SKILL_FLAG_TEMPORARY; // Tag it as a non-savable, non-uppable, bonus skill
} else { //Link bard skills to dancer.
if( sd->status.skill[i].lv < 10 )
continue;
- sd->status.skill[i-8].id = skill_db[i-8].nameid;
+ sd->status.skill[i-8].id = skill->db[i-8].nameid;
sd->status.skill[i-8].lv = sd->status.skill[i].lv; // Set the level to the same as the linking skill
sd->status.skill[i-8].flag = SKILL_FLAG_TEMPORARY; // Tag it as a non-savable, non-uppable, bonus skill
}
@@ -1421,7 +1413,7 @@ int pc_calc_skilltree(struct map_session_data *sd)
if( pc->has_permission(sd, PC_PERM_ALL_SKILL) ) {
for( i = 0; i < MAX_SKILL; i++ ) {
- switch(skill_db[i].nameid) {
+ switch(skill->db[i].nameid) {
/**
* Dummy skills must be added here otherwise they'll be displayed in the,
* skill tree and since they have no icons they'll give resource errors
@@ -1445,10 +1437,10 @@ int pc_calc_skilltree(struct map_session_data *sd)
default:
break;
}
- if( skill_db[i].inf2&(INF2_NPC_SKILL|INF2_GUILD_SKILL) )
+ if( skill->db[i].inf2&(INF2_NPC_SKILL|INF2_GUILD_SKILL) )
continue; //Only skills you can't have are npc/guild ones
- if( skill_db[i].max > 0 )
- sd->status.skill[i].id = skill_db[i].nameid;
+ if( skill->db[i].max > 0 )
+ sd->status.skill[i].id = skill->db[i].nameid;
}
return 0;
}
@@ -1484,7 +1476,7 @@ int pc_calc_skilltree(struct map_session_data *sd)
}
if( f ) {
int inf2;
- inf2 = skill_db[idx].inf2;
+ inf2 = skill->db[idx].inf2;
if(!sd->status.skill[idx].lv && (
(inf2&INF2_QUEST_SKILL && !battle_config.quest_skill_learn) ||
@@ -1515,7 +1507,7 @@ int pc_calc_skilltree(struct map_session_data *sd)
for( i = 0; i < MAX_SKILL_TREE && (id = skill_tree[c][i].id) > 0; i++ ) {
int idx = skill_tree[c][i].idx;
- if( (skill_db[idx].inf2&(INF2_QUEST_SKILL|INF2_WEDDING_SKILL)) )
+ if( (skill->db[idx].inf2&(INF2_QUEST_SKILL|INF2_WEDDING_SKILL)) )
continue; //Do not include Quest/Wedding skills.
if( sd->status.skill[idx].id == 0 ) {
@@ -1576,7 +1568,7 @@ static void pc_check_skilltree(struct map_session_data *sd, int skill_id)
if( sd->status.job_level < skill_tree[c][i].joblv )
continue;
- j = skill_db[idx].inf2;
+ j = skill->db[idx].inf2;
if( !sd->status.skill[idx].lv && (
(j&INF2_QUEST_SKILL && !battle_config.quest_skill_learn) ||
j&INF2_WEDDING_SKILL ||
@@ -1746,7 +1738,7 @@ int pc_disguise(struct map_session_data *sd, int class_) {
} else
sd->disguise = class_;
- iStatus->set_viewdata(&sd->bl, class_);
+ status->set_viewdata(&sd->bl, class_);
clif->changeoption(&sd->bl);
if (sd->bl.prev != NULL) {
@@ -1759,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);
}
@@ -2018,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);
@@ -3329,7 +3320,7 @@ int pc_bonus3(struct map_session_data *sd,int type,int type2,int type3,int val)
int target = skill->get_inf(type2); //Support or Self (non-auto-target) skills should pick self.
target = target&INF_SUPPORT_SKILL || (target&INF_SELF_SKILL && !(skill->get_inf2(type2)&INF2_NO_TARGET_SELF));
pc_bonus_autospell(sd->autospell, ARRAYLENGTH(sd->autospell),
- target?-type2:type2, type3, val, 0, iStatus->current_equip_card_id);
+ target?-type2:type2, type3, val, 0, status->current_equip_card_id);
}
break;
case SP_AUTOSPELL_WHENHIT:
@@ -3338,7 +3329,7 @@ int pc_bonus3(struct map_session_data *sd,int type,int type2,int type3,int val)
int target = skill->get_inf(type2); //Support or Self (non-auto-target) skills should pick self.
target = target&INF_SUPPORT_SKILL || (target&INF_SELF_SKILL && !(skill->get_inf2(type2)&INF2_NO_TARGET_SELF));
pc_bonus_autospell(sd->autospell2, ARRAYLENGTH(sd->autospell2),
- target?-type2:type2, type3, val, BF_NORMAL|BF_SKILL, iStatus->current_equip_card_id);
+ target?-type2:type2, type3, val, BF_NORMAL|BF_SKILL, status->current_equip_card_id);
}
break;
case SP_SP_DRAIN_RATE:
@@ -3433,28 +3424,26 @@ int pc_bonus3(struct map_session_data *sd,int type,int type2,int type3,int val)
return 0;
}
-int pc_bonus4(struct map_session_data *sd,int type,int type2,int type3,int type4,int val)
-{
+int pc_bonus4(struct map_session_data *sd,int type,int type2,int type3,int type4,int val) {
nullpo_ret(sd);
- switch(type){
+ switch(type) {
case SP_AUTOSPELL:
if(sd->state.lr_flag != 2)
- pc_bonus_autospell(sd->autospell, ARRAYLENGTH(sd->autospell), (val&1?type2:-type2), (val&2?-type3:type3), type4, 0, iStatus->current_equip_card_id);
+ pc_bonus_autospell(sd->autospell, ARRAYLENGTH(sd->autospell), (val&1?type2:-type2), (val&2?-type3:type3), type4, 0, status->current_equip_card_id);
break;
case SP_AUTOSPELL_WHENHIT:
if(sd->state.lr_flag != 2)
- pc_bonus_autospell(sd->autospell2, ARRAYLENGTH(sd->autospell2), (val&1?type2:-type2), (val&2?-type3:type3), type4, BF_NORMAL|BF_SKILL, iStatus->current_equip_card_id);
+ pc_bonus_autospell(sd->autospell2, ARRAYLENGTH(sd->autospell2), (val&1?type2:-type2), (val&2?-type3:type3), type4, BF_NORMAL|BF_SKILL, status->current_equip_card_id);
break;
case SP_AUTOSPELL_ONSKILL:
- if(sd->state.lr_flag != 2)
- {
+ if(sd->state.lr_flag != 2) {
int target = skill->get_inf(type2); //Support or Self (non-auto-target) skills should pick self.
target = target&INF_SUPPORT_SKILL || (target&INF_SELF_SKILL && !(skill->get_inf2(type2)&INF2_NO_TARGET_SELF));
- pc_bonus_autospell_onskill(sd->autospell3, ARRAYLENGTH(sd->autospell3), type2, target?-type3:type3, type4, val, iStatus->current_equip_card_id);
+ pc_bonus_autospell_onskill(sd->autospell3, ARRAYLENGTH(sd->autospell3), type2, target?-type3:type3, type4, val, status->current_equip_card_id);
}
break;
@@ -3475,24 +3464,23 @@ int pc_bonus4(struct map_session_data *sd,int type,int type2,int type3,int type4
return 0;
}
-int pc_bonus5(struct map_session_data *sd,int type,int type2,int type3,int type4,int type5,int val)
-{
+int pc_bonus5(struct map_session_data *sd,int type,int type2,int type3,int type4,int type5,int val) {
nullpo_ret(sd);
switch(type){
case SP_AUTOSPELL:
if(sd->state.lr_flag != 2)
- pc_bonus_autospell(sd->autospell, ARRAYLENGTH(sd->autospell), (val&1?type2:-type2), (val&2?-type3:type3), type4, type5, iStatus->current_equip_card_id);
+ pc_bonus_autospell(sd->autospell, ARRAYLENGTH(sd->autospell), (val&1?type2:-type2), (val&2?-type3:type3), type4, type5, status->current_equip_card_id);
break;
case SP_AUTOSPELL_WHENHIT:
if(sd->state.lr_flag != 2)
- pc_bonus_autospell(sd->autospell2, ARRAYLENGTH(sd->autospell2), (val&1?type2:-type2), (val&2?-type3:type3), type4, type5, iStatus->current_equip_card_id);
+ pc_bonus_autospell(sd->autospell2, ARRAYLENGTH(sd->autospell2), (val&1?type2:-type2), (val&2?-type3:type3), type4, type5, status->current_equip_card_id);
break;
case SP_AUTOSPELL_ONSKILL:
if(sd->state.lr_flag != 2)
- pc_bonus_autospell_onskill(sd->autospell3, ARRAYLENGTH(sd->autospell3), type2, (val&1?-type3:type3), (val&2?-type4:type4), type5, iStatus->current_equip_card_id);
+ pc_bonus_autospell_onskill(sd->autospell3, ARRAYLENGTH(sd->autospell3), type2, (val&1?-type3:type3), (val&2?-type4:type4), type5, status->current_equip_card_id);
break;
default:
@@ -3514,7 +3502,7 @@ int pc_skill(TBL_PC* sd, int id, int level, int flag) {
uint16 index = 0;
nullpo_ret(sd);
- if( !(index = skill->get_index(id)) || skill_db[index].name == NULL) {
+ if( !(index = skill->get_index(id)) || skill->db[index].name == NULL) {
ShowError("pc_skill: Skill with id %d does not exist in the skill database\n", id);
return 0;
}
@@ -3537,7 +3525,7 @@ int pc_skill(TBL_PC* sd, int id, int level, int flag) {
clif->deleteskill(sd,id);
} else
clif->addskill(sd,id);
- if( !skill_db[index].inf ) //Only recalculate for passive skills.
+ if( !skill->db[index].inf ) //Only recalculate for passive skills.
status_calc_pc(sd, 0);
break;
case 1: //Item bonus skill.
@@ -3571,7 +3559,7 @@ int pc_skill(TBL_PC* sd, int id, int level, int flag) {
clif->deleteskill(sd,id);
} else
clif->addskill(sd,id);
- if( !skill_db[index].inf ) //Only recalculate for passive skills.
+ if( !skill->db[index].inf ) //Only recalculate for passive skills.
status_calc_pc(sd, 0);
break;
default: //Unknown flag?
@@ -4060,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);
@@ -4090,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
@@ -4100,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) ||
@@ -4111,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) ||
@@ -4135,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;
}
@@ -4386,7 +4371,7 @@ int pc_useitem(struct map_session_data *sd,int n) {
//perform a skill-use check before going through. [Skotlex]
//resurrection was picked as testing skill, as a non-offensive, generic skill, it will do.
//FIXME: Is this really needed here? It'll be checked in unit.c after all and this prevents skill items using when silenced [Inkfish]
- if( sd->inventory_data[n]->flag.delay_consume && ( sd->ud.skilltimer != INVALID_TIMER /*|| !iStatus->check_skilluse(&sd->bl, &sd->bl, ALL_RESURRECTION, 0)*/ ) )
+ if( sd->inventory_data[n]->flag.delay_consume && ( sd->ud.skilltimer != INVALID_TIMER /*|| !status->check_skilluse(&sd->bl, &sd->bl, ALL_RESURRECTION, 0)*/ ) )
return 0;
if( sd->inventory_data[n]->delay > 0 ) {
@@ -4686,8 +4671,8 @@ int pc_steal_item(struct map_session_data *sd,struct block_list *bl, uint16 skil
if(md->state.steal_flag == UCHAR_MAX || ( md->sc.opt1 && md->sc.opt1 != OPT1_BURNING && md->sc.opt1 != OPT1_CRYSTALIZE ) ) //already stolen from / status change check
return 0;
- sd_status= iStatus->get_status_data(&sd->bl);
- md_status= iStatus->get_status_data(bl);
+ sd_status= status->get_status_data(&sd->bl);
+ md_status= status->get_status_data(bl);
if( md->master_id || md_status->mode&MD_BOSS || mob_is_treasure(md) ||
maplist[bl->m].flag.nomobloot || // check noloot map flag [Lorky]
@@ -4788,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;
}
@@ -4863,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!
@@ -4876,8 +4861,8 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y
if (sd->sc.data[SC_KNOWLEDGE]) {
struct status_change_entry *sce = sd->sc.data[SC_KNOWLEDGE];
if (sce->timer != INVALID_TIMER)
- timer->delete(sce->timer, iStatus->change_timer);
- sce->timer = timer->add(timer->gettick() + skill->get_time(SG_KNOWLEDGE, sce->val1), iStatus->change_timer, sd->bl.id, SC_KNOWLEDGE);
+ timer->delete(sce->timer, status->change_timer);
+ sce->timer = timer->add(timer->gettick() + skill->get_time(SG_KNOWLEDGE, sce->val1), status->change_timer, sd->bl.id, SC_KNOWLEDGE);
}
status_change_end(&sd->bl, SC_PROPERTYWALK, INVALID_TIMER);
status_change_end(&sd->bl, SC_CLOAKING, INVALID_TIMER);
@@ -4910,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)
@@ -4940,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);
}
@@ -5011,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);
@@ -5098,14 +5083,14 @@ int pc_checkskill2(struct map_session_data *sd,uint16 index) {
ShowError("pc_checkskill: Invalid skill index %d (char_id=%d).\n", index, sd->status.char_id);
return 0;
}
- if( skill_db[index].nameid >= GD_SKILLBASE && skill_db[index].nameid < GD_MAX ) {
+ if( skill->db[index].nameid >= GD_SKILLBASE && skill->db[index].nameid < GD_MAX ) {
struct guild *g;
if( sd->status.guild_id>0 && (g=sd->guild)!=NULL)
- return guild->checkskill(g,skill_db[index].nameid);
+ return guild->checkskill(g,skill->db[index].nameid);
return 0;
}
- if(sd->status.skill[index].id == skill_db[index].nameid)
+ if(sd->status.skill[index].id == skill->db[index].nameid)
return (sd->status.skill[index].lv);
return 0;
@@ -5147,12 +5132,12 @@ int pc_checkallowskill(struct map_session_data *sd)
if(!sd->sc.count)
return 0;
- for (i = 0; i < ARRAYLENGTH(scw_list); i++)
- { // Skills requiring specific weapon types
+ for (i = 0; i < ARRAYLENGTH(scw_list); i++) {
+ // Skills requiring specific weapon types
if( scw_list[i] == SC_DANCING && !battle_config.dancing_weaponswitch_fix )
continue;
- if(sd->sc.data[scw_list[i]] &&
- !pc_check_weapontype(sd,skill->get_weapontype(iStatus->sc2skill(scw_list[i]))))
+ if( sd->sc.data[scw_list[i]]
+ && !pc_check_weapontype(sd,skill->get_weapontype(status->sc2skill(scw_list[i]))))
status_change_end(&sd->bl, scw_list[i], INVALID_TIMER);
}
@@ -5688,34 +5673,32 @@ const char* job_name(int class_)
}
}
-int pc_follow_timer(int tid, unsigned int tick, int id, intptr_t data)
-{
+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){
+ if (sd->followtimer != tid) {
ShowError("pc_follow_timer %d != %d\n",sd->followtimer,tid);
sd->followtimer = INVALID_TIMER;
return 0;
}
sd->followtimer = INVALID_TIMER;
- tbl = iMap->id2bl(sd->followtarget);
+ tbl = map->id2bl(sd->followtarget);
- if (tbl == NULL || pc_isdead(sd) || iStatus->isdead(tbl))
- {
+ if (tbl == NULL || pc_isdead(sd) || status->isdead(tbl)) {
pc->stop_following(sd);
return 0;
}
// either player or target is currently detached from map blocks (could be teleporting),
// but still connected to this map, so we'll just increment the timer and check back later
- if (sd->bl.prev != NULL && tbl->prev != NULL &&
- sd->ud.skilltimer == INVALID_TIMER && sd->ud.attacktimer == INVALID_TIMER && sd->ud.walktimer == INVALID_TIMER)
- {
+ if (sd->bl.prev != NULL && tbl->prev != NULL
+ && sd->ud.skilltimer == INVALID_TIMER && sd->ud.attacktimer == INVALID_TIMER && sd->ud.walktimer == INVALID_TIMER
+ ) {
if((sd->bl.m == tbl->m) && unit->can_reach_bl(&sd->bl,tbl, AREA_SIZE, 0, NULL, NULL)) {
if (!check_distance_bl(&sd->bl, tbl, 5))
unit->walktobl(&sd->bl, tbl, 5, 0);
@@ -5744,9 +5727,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)
@@ -5787,16 +5769,16 @@ int pc_checkbaselevelup(struct map_session_data *sd) {
status_percent_heal(&sd->bl,100,100);
if((sd->class_&MAPID_UPPERMASK) == MAPID_SUPER_NOVICE) {
- sc_start(&sd->bl,iStatus->skill2sc(PR_KYRIE),100,1,skill->get_time(PR_KYRIE,1));
- sc_start(&sd->bl,iStatus->skill2sc(PR_IMPOSITIO),100,1,skill->get_time(PR_IMPOSITIO,1));
- sc_start(&sd->bl,iStatus->skill2sc(PR_MAGNIFICAT),100,1,skill->get_time(PR_MAGNIFICAT,1));
- sc_start(&sd->bl,iStatus->skill2sc(PR_GLORIA),100,1,skill->get_time(PR_GLORIA,1));
- sc_start(&sd->bl,iStatus->skill2sc(PR_SUFFRAGIUM),100,1,skill->get_time(PR_SUFFRAGIUM,1));
+ sc_start(&sd->bl,status->skill2sc(PR_KYRIE),100,1,skill->get_time(PR_KYRIE,1));
+ sc_start(&sd->bl,status->skill2sc(PR_IMPOSITIO),100,1,skill->get_time(PR_IMPOSITIO,1));
+ sc_start(&sd->bl,status->skill2sc(PR_MAGNIFICAT),100,1,skill->get_time(PR_MAGNIFICAT,1));
+ sc_start(&sd->bl,status->skill2sc(PR_GLORIA),100,1,skill->get_time(PR_GLORIA,1));
+ sc_start(&sd->bl,status->skill2sc(PR_SUFFRAGIUM),100,1,skill->get_time(PR_SUFFRAGIUM,1));
if (sd->state.snovice_dead_flag)
sd->state.snovice_dead_flag = 0; //Reenable steelbody resurrection on dead.
} else if( (sd->class_&MAPID_BASEMASK) == MAPID_TAEKWON ) {
- sc_start(&sd->bl,iStatus->skill2sc(AL_INCAGI),100,10,600000);
- sc_start(&sd->bl,iStatus->skill2sc(AL_BLESSING),100,10,600000);
+ sc_start(&sd->bl,status->skill2sc(AL_INCAGI),100,10,600000);
+ sc_start(&sd->bl,status->skill2sc(AL_BLESSING),100,10,600000);
}
clif->misceffect(&sd->bl,0);
npc->script_event(sd, NPCE_BASELVUP); //LORDALFA - LVLUPEVENT
@@ -5857,14 +5839,14 @@ int pc_checkjoblevelup(struct map_session_data *sd)
*------------------------------------------*/
static void pc_calcexp(struct map_session_data *sd, unsigned int *base_exp, unsigned int *job_exp, struct block_list *src) {
int bonus = 0;
- struct status_data *st = iStatus->get_status_data(src);
+ struct status_data *st = status->get_status_data(src);
if (sd->expaddrace[st->race])
bonus += sd->expaddrace[st->race];
bonus += sd->expaddrace[st->mode&MD_BOSS?RC_BOSS:RC_NONBOSS];
- if (battle_config.pk_mode &&
- (int)(iStatus->get_lv(src) - sd->status.base_level) >= 20)
+ if (battle_config.pk_mode
+ && (int)(status->get_lv(src) - sd->status.base_level) >= 20)
bonus += 15; // pk_mode additional exp if monster >20 levels [Valaris]
if (sd->sc.data[SC_CASH_PLUSEXP])
@@ -6213,7 +6195,7 @@ int pc_skillup(struct map_session_data *sd,uint16 skill_id) {
{
sd->status.skill[index].lv++;
sd->status.skill_point--;
- if( !skill_db[index].inf )
+ if( !skill->db[index].inf )
status_calc_pc(sd,0); // Only recalculate for passive skills.
else if( sd->status.skill_point == 0 && (sd->class_&MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && pc->famerank(sd->status.char_id, MAPID_TAEKWON) )
pc->calc_skilltree(sd); // Required to grant all TK Ranger skills.
@@ -6260,22 +6242,22 @@ int pc_allskillup(struct map_session_data *sd)
if (pc->has_permission(sd, PC_PERM_ALL_SKILL)) { //Get ALL skills except npc/guild ones. [Skotlex]
//and except SG_DEVIL [Komurka] and MO_TRIPLEATTACK and RG_SNATCHER [ultramage]
for(i=0;i<MAX_SKILL;i++){
- switch( skill_db[i].nameid ) {
+ switch( skill->db[i].nameid ) {
case SG_DEVIL:
case MO_TRIPLEATTACK:
case RG_SNATCHER:
continue;
default:
- if( !(skill_db[i].inf2&(INF2_NPC_SKILL|INF2_GUILD_SKILL)) )
- if ( ( sd->status.skill[i].lv = skill_db[i].max ) )//Nonexistant skills should return a max of 0 anyway.
- sd->status.skill[i].id = skill_db[i].nameid;
+ if( !(skill->db[i].inf2&(INF2_NPC_SKILL|INF2_GUILD_SKILL)) )
+ if ( ( sd->status.skill[i].lv = skill->db[i].max ) )//Nonexistant skills should return a max of 0 anyway.
+ sd->status.skill[i].id = skill->db[i].nameid;
}
}
} else {
int inf2;
for(i=0;i < MAX_SKILL_TREE && (id=skill_tree[pc->class2idx(sd->status.class_)][i].id)>0;i++){
int idx = skill_tree[pc->class2idx(sd->status.class_)][i].idx;
- inf2 = skill_db[idx].inf2;
+ inf2 = skill->db[idx].inf2;
if (
(inf2&INF2_QUEST_SKILL && !battle_config.quest_skill_learn) ||
(inf2&(INF2_WEDDING_SKILL|INF2_SPIRIT_SKILL)) ||
@@ -6503,12 +6485,12 @@ int pc_resetskill(struct map_session_data* sd, int flag)
lv = sd->status.skill[i].lv;
if (lv < 1) continue;
- inf2 = skill_db[i].inf2;
+ inf2 = skill->db[i].inf2;
if( inf2&(INF2_WEDDING_SKILL|INF2_SPIRIT_SKILL) ) //Avoid reseting wedding/linker skills.
continue;
- skill_id = skill_db[i].nameid;
+ skill_id = skill->db[i].nameid;
// Don't reset trick dead if not a novice/baby
if( skill_id == NV_TRICKDEAD && (sd->class_&MAPID_BASEMASK) != MAPID_NOVICE ) {
@@ -6649,9 +6631,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;
@@ -6701,7 +6682,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;
@@ -6877,12 +6858,11 @@ 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]
- if ((sd->class_&MAPID_UPPERMASK) == MAPID_SUPER_NOVICE && !sd->state.snovice_dead_flag)
- {
+ if ((sd->class_&MAPID_UPPERMASK) == MAPID_SUPER_NOVICE && !sd->state.snovice_dead_flag) {
unsigned int next = pc->nextbaseexp(sd);
if( next == 0 ) next = pc->thisbaseexp(sd);
if( get_percentage(sd->status.base_exp,next) >= 99 ) {
@@ -6892,7 +6872,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) {
clif->resurrection(&sd->bl, 1);
if(battle_config.pc_invincible_time)
pc->setinvincibletimer(sd, battle_config.pc_invincible_time);
- sc_start(&sd->bl,iStatus->skill2sc(MO_STEELBODY),100,1,skill->get_time(MO_STEELBODY,1));
+ sc_start(&sd->bl,status->skill2sc(MO_STEELBODY),100,1,skill->get_time(MO_STEELBODY,1));
if(map_flag_gvg2(sd->bl.m))
pc_respawn_timer(INVALID_TIMER, timer->gettick(), sd->bl.id, 0);
return 0;
@@ -7432,7 +7412,7 @@ int pc_itemheal(struct map_session_data *sd,int itemid, int hp,int sp)
#endif
}
- return iStatus->heal(&sd->bl, hp, sp, 1);
+ return status->heal(&sd->bl, hp, sp, 1);
}
/*==========================================
@@ -7564,7 +7544,7 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper)
short id;
for(i = 0; i < MAX_SKILL_TREE && (id = skill_tree[class_][i].id) > 0; i++) {
//Remove status specific to your current tree skills.
- enum sc_type sc = iStatus->skill2sc(id);
+ enum sc_type sc = status->skill2sc(id);
if (sc > SC_COMMON_MAX && sd->sc.data[sc])
status_change_end(&sd->bl, sc, INVALID_TIMER);
}
@@ -7606,7 +7586,7 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper)
if (sd->disguise != -1)
pc->disguise(sd, -1);
- iStatus->set_viewdata(&sd->bl, job);
+ status->set_viewdata(&sd->bl, job);
clif->changelook(&sd->bl,LOOK_BASE,sd->vd.class_); // move sprite update to prevent client crashes with incompatible equipment [Valaris]
if(sd->vd.cloth_color)
clif->changelook(&sd->bl,LOOK_CLOTHES_COLOR,sd->vd.cloth_color);
@@ -7620,7 +7600,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;
@@ -7701,7 +7681,7 @@ int pc_changelook(struct map_session_data *sd,int type,int val)
switch(type){
case LOOK_BASE:
- iStatus->set_viewdata(&sd->bl, val);
+ status->set_viewdata(&sd->bl, val);
clif->changelook(&sd->bl,LOOK_BASE,sd->vd.class_);
clif->changelook(&sd->bl,LOOK_WEAPON,sd->status.weapon);
if (sd->vd.cloth_color)
@@ -7816,9 +7796,9 @@ int pc_setoption(struct map_session_data *sd,int type)
else if( !(type&OPTION_MADOGEAR) && p_type&OPTION_MADOGEAR )
status_calc_pc(sd, 0);
for( i = 0; i < SC_MAX; i++ ){
- if ( !sd->sc.data[i] || !iStatus->get_sc_type(i) )
+ if ( !sd->sc.data[i] || !status->get_sc_type(i) )
continue;
- if ( iStatus->get_sc_type(i)&SC_MADO_NO_RESET )
+ if ( status->get_sc_type(i)&SC_MADO_NO_RESET )
continue;
switch (i) {
case SC_BERSERK:
@@ -7839,7 +7819,7 @@ int pc_setoption(struct map_session_data *sd,int type)
return 0; //Disguises break sprite changes
if (new_look < 0) { //Restore normal look.
- iStatus->set_viewdata(&sd->bl, sd->status.class_);
+ status->set_viewdata(&sd->bl, sd->status.class_);
new_look = sd->vd.class_;
}
@@ -8301,9 +8281,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)
@@ -9046,7 +9025,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) {
@@ -9055,7 +9034,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;
@@ -9063,11 +9042,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;
@@ -9131,8 +9109,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
@@ -9159,11 +9137,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;
}
@@ -9171,11 +9148,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;
}
@@ -9183,11 +9159,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;
}
@@ -9195,11 +9170,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;
}
@@ -9241,8 +9215,7 @@ void pc_bleeding (struct map_session_data *sd, unsigned int diff_tick)
//Character regen. Flag is used to know which types of regen can take place.
//&1: HP regen
//&2: SP regen
-void pc_regen (struct map_session_data *sd, unsigned int diff_tick)
-{
+void pc_regen (struct map_session_data *sd, unsigned int diff_tick) {
int hp = 0, sp = 0;
if (sd->hp_regen.value) {
@@ -9262,7 +9235,7 @@ void pc_regen (struct map_session_data *sd, unsigned int diff_tick)
}
if (hp > 0 || sp > 0)
- iStatus->heal(&sd->bl, hp, sp, 0);
+ status->heal(&sd->bl, hp, sp, 0);
return;
}
@@ -9316,18 +9289,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;
@@ -9336,18 +9309,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;
@@ -9357,18 +9329,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;
@@ -9430,12 +9401,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);
@@ -9921,11 +9891,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){
@@ -10003,13 +9973,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;
@@ -10029,9 +9999,9 @@ int pc_readdb(void) {
for(i=0;i<4;i++)
for(j=0;j<ELE_MAX;j++)
for(k=0;k<ELE_MAX;k++)
- attr_fix_table[i][j][k]=100;
+ battle->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){
@@ -10064,9 +10034,9 @@ int pc_readdb(void) {
for(j=0,p=line;j<n && j<ELE_MAX && p;j++){
while(*p==32 && *p>0)
p++;
- attr_fix_table[lv-1][i][j]=atoi(p);
- if(battle_config.attr_recover == 0 && attr_fix_table[lv-1][i][j] < 0)
- attr_fix_table[lv-1][i][j] = 0;
+ battle->attr_fix_table[lv-1][i][j]=atoi(p);
+ if(battle_config.attr_recover == 0 && battle->attr_fix_table[lv-1][i][j] < 0)
+ battle->attr_fix_table[lv-1][i][j] = 0;
p=strchr(p,',');
if(p) *p++=0;
}
@@ -10075,13 +10045,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);
@@ -10102,7 +10072,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
@@ -10178,10 +10148,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;
@@ -10190,8 +10160,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();