Added support for constants in NPC sprite IDs. (Hercules 124ab2a, e9b4aec)
Fixed some typos in source files. Signed-off-by: Euphy <euphy.raliel@rathena.org>
This commit is contained in:
parent
01314ae5c5
commit
222b773c20
@ -119,7 +119,7 @@ static const char* atcommand_help_string(const char* command)
|
||||
// convert alias to the real command name
|
||||
command = atcommand_checkalias(command);
|
||||
|
||||
// attept to find the first default help command
|
||||
// attempt to find the first default help command
|
||||
info = config_lookup(&atcommand_config, "help");
|
||||
|
||||
if( info == NULL )
|
||||
@ -1317,7 +1317,7 @@ ACMD_FUNC(baselevelup)
|
||||
clif_displaymessage(fd, msg_txt(sd,47)); // Base level can't go any higher.
|
||||
return -1;
|
||||
} // End Addition
|
||||
if ((unsigned int)level > pc_maxbaselv(sd) || (unsigned int)level > pc_maxbaselv(sd) - sd->status.base_level) // fix positiv overflow
|
||||
if ((unsigned int)level > pc_maxbaselv(sd) || (unsigned int)level > pc_maxbaselv(sd) - sd->status.base_level) // fix positive 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);
|
||||
@ -1377,7 +1377,7 @@ ACMD_FUNC(joblevelup)
|
||||
clif_displaymessage(fd, msg_txt(sd,23)); // Job level can't go any higher.
|
||||
return -1;
|
||||
}
|
||||
if ((unsigned int)level > pc_maxjoblv(sd) || (unsigned int)level > pc_maxjoblv(sd) - sd->status.job_level) // fix positiv overflow
|
||||
if ((unsigned int)level > pc_maxjoblv(sd) || (unsigned int)level > pc_maxjoblv(sd) - sd->status.job_level) // fix positive overflow
|
||||
level = pc_maxjoblv(sd) - sd->status.job_level;
|
||||
sd->status.job_level += (unsigned int)level;
|
||||
sd->status.skill_point += level;
|
||||
@ -1389,11 +1389,11 @@ ACMD_FUNC(joblevelup)
|
||||
return -1;
|
||||
}
|
||||
level *=-1;
|
||||
if ((unsigned int)level >= sd->status.job_level) // fix negativ overflow
|
||||
if ((unsigned int)level >= sd->status.job_level) // fix negative overflow
|
||||
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 subtract more points.
|
||||
if (sd->status.skill_point < level)
|
||||
sd->status.skill_point = 0;
|
||||
else
|
||||
@ -1632,7 +1632,7 @@ ACMD_FUNC(model)
|
||||
pc_changelook(sd, LOOK_HAIR, hair_style);
|
||||
pc_changelook(sd, LOOK_HAIR_COLOR, hair_color);
|
||||
pc_changelook(sd, LOOK_CLOTHES_COLOR, cloth_color);
|
||||
clif_displaymessage(fd, msg_txt(sd,36)); // Appearence changed.
|
||||
clif_displaymessage(fd, msg_txt(sd,36)); // Appearance changed.
|
||||
} else {
|
||||
clif_displaymessage(fd, msg_txt(sd,37)); // An invalid number was specified.
|
||||
return -1;
|
||||
@ -1659,7 +1659,7 @@ ACMD_FUNC(dye)
|
||||
|
||||
if (cloth_color >= MIN_CLOTH_COLOR && cloth_color <= MAX_CLOTH_COLOR) {
|
||||
pc_changelook(sd, LOOK_CLOTHES_COLOR, cloth_color);
|
||||
clif_displaymessage(fd, msg_txt(sd,36)); // Appearence changed.
|
||||
clif_displaymessage(fd, msg_txt(sd,36)); // Appearance changed.
|
||||
} else {
|
||||
clif_displaymessage(fd, msg_txt(sd,37)); // An invalid number was specified.
|
||||
return -1;
|
||||
@ -1686,7 +1686,7 @@ ACMD_FUNC(hair_style)
|
||||
|
||||
if (hair_style >= MIN_HAIR_STYLE && hair_style <= MAX_HAIR_STYLE) {
|
||||
pc_changelook(sd, LOOK_HAIR, hair_style);
|
||||
clif_displaymessage(fd, msg_txt(sd,36)); // Appearence changed.
|
||||
clif_displaymessage(fd, msg_txt(sd,36)); // Appearance changed.
|
||||
} else {
|
||||
clif_displaymessage(fd, msg_txt(sd,37)); // An invalid number was specified.
|
||||
return -1;
|
||||
@ -1713,7 +1713,7 @@ ACMD_FUNC(hair_color)
|
||||
|
||||
if (hair_color >= MIN_HAIR_COLOR && hair_color <= MAX_HAIR_COLOR) {
|
||||
pc_changelook(sd, LOOK_HAIR_COLOR, hair_color);
|
||||
clif_displaymessage(fd, msg_txt(sd,36)); // Appearence changed.
|
||||
clif_displaymessage(fd, msg_txt(sd,36)); // Appearance changed.
|
||||
} else {
|
||||
clif_displaymessage(fd, msg_txt(sd,37)); // An invalid number was specified.
|
||||
return -1;
|
||||
@ -2568,9 +2568,9 @@ ACMD_FUNC(guildlevelup) {
|
||||
//}
|
||||
|
||||
added_level = (short)level;
|
||||
if (level > 0 && (level > MAX_GUILDLEVEL || added_level > ((short)MAX_GUILDLEVEL - guild_info->guild_lv))) // fix positiv overflow
|
||||
if (level > 0 && (level > MAX_GUILDLEVEL || added_level > ((short)MAX_GUILDLEVEL - guild_info->guild_lv))) // fix positive overflow
|
||||
added_level = (short)MAX_GUILDLEVEL - guild_info->guild_lv;
|
||||
else if (level < 0 && (level < -MAX_GUILDLEVEL || added_level < (1 - guild_info->guild_lv))) // fix negativ overflow
|
||||
else if (level < 0 && (level < -MAX_GUILDLEVEL || added_level < (1 - guild_info->guild_lv))) // fix negative overflow
|
||||
added_level = 1 - guild_info->guild_lv;
|
||||
|
||||
if (added_level != 0) {
|
||||
@ -3437,7 +3437,7 @@ ACMD_FUNC(recallall)
|
||||
memset(atcmd_output, '\0', sizeof(atcmd_output));
|
||||
|
||||
if (sd->bl.m >= 0 && map[sd->bl.m].flag.nowarpto && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) {
|
||||
clif_displaymessage(fd, msg_txt(sd,1032)); // You are not authorized to warp somenone to your current map.
|
||||
clif_displaymessage(fd, msg_txt(sd,1032)); // You are not authorized to warp someone to your current map.
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -3492,7 +3492,7 @@ ACMD_FUNC(guildrecall)
|
||||
}
|
||||
|
||||
if (sd->bl.m >= 0 && map[sd->bl.m].flag.nowarpto && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) {
|
||||
clif_displaymessage(fd, msg_txt(sd,1032)); // You are not authorized to warp somenone to your current map.
|
||||
clif_displaymessage(fd, msg_txt(sd,1032)); // You are not authorized to warp someone to your current map.
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -3551,7 +3551,7 @@ ACMD_FUNC(partyrecall)
|
||||
}
|
||||
|
||||
if (sd->bl.m >= 0 && map[sd->bl.m].flag.nowarpto && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) {
|
||||
clif_displaymessage(fd, msg_txt(sd,1032)); // You are not authorized to warp somenone to your current map.
|
||||
clif_displaymessage(fd, msg_txt(sd,1032)); // You are not authorized to warp someone to your current map.
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -4472,7 +4472,7 @@ ACMD_FUNC(servertime)
|
||||
} 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(sd,233), txt_time(DIFF_TICK(timer_data->tick,gettick())/1000)); // Game time: The game is actualy in night for %s.
|
||||
sprintf(temp, msg_txt(sd,233), txt_time(DIFF_TICK(timer_data->tick,gettick())/1000)); // Game time: The game is in night for %s.
|
||||
clif_displaymessage(fd, temp);
|
||||
clif_displaymessage(fd, msg_txt(sd,234)); // Game time: After, the game will be in permanent daylight.
|
||||
} else
|
||||
@ -4480,7 +4480,7 @@ ACMD_FUNC(servertime)
|
||||
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(sd,235), txt_time(DIFF_TICK(timer_data->tick,gettick())/1000)); // Game time: The game is actualy in daylight for %s.
|
||||
sprintf(temp, msg_txt(sd,235), txt_time(DIFF_TICK(timer_data->tick,gettick())/1000)); // Game time: The game is in daylight for %s.
|
||||
clif_displaymessage(fd, temp);
|
||||
clif_displaymessage(fd, msg_txt(sd,236)); // Game time: After, the game will be in permanent night.
|
||||
} else
|
||||
@ -4489,7 +4489,7 @@ ACMD_FUNC(servertime)
|
||||
if (night_flag == 0) {
|
||||
timer_data = get_timer(night_timer_tid);
|
||||
timer_data2 = get_timer(day_timer_tid);
|
||||
sprintf(temp, msg_txt(sd,235), txt_time(DIFF_TICK(timer_data->tick,gettick())/1000)); // Game time: The game is actualy in daylight for %s.
|
||||
sprintf(temp, msg_txt(sd,235), txt_time(DIFF_TICK(timer_data->tick,gettick())/1000)); // Game time: The game is in daylight for %s.
|
||||
clif_displaymessage(fd, temp);
|
||||
if (DIFF_TICK(timer_data->tick, timer_data2->tick) > 0)
|
||||
sprintf(temp, msg_txt(sd,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.
|
||||
@ -4501,7 +4501,7 @@ ACMD_FUNC(servertime)
|
||||
} else {
|
||||
timer_data = get_timer(day_timer_tid);
|
||||
timer_data2 = get_timer(night_timer_tid);
|
||||
sprintf(temp, msg_txt(sd,233), txt_time(DIFF_TICK(timer_data->tick,gettick()) / 1000)); // Game time: The game is actualy in night for %s.
|
||||
sprintf(temp, msg_txt(sd,233), txt_time(DIFF_TICK(timer_data->tick,gettick()) / 1000)); // Game time: The game is in night for %s.
|
||||
clif_displaymessage(fd, temp);
|
||||
if (DIFF_TICK(timer_data->tick,timer_data2->tick) > 0)
|
||||
sprintf(temp, msg_txt(sd,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.
|
||||
@ -4782,7 +4782,7 @@ ACMD_FUNC(disguiseall)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((mob_id = mobdb_searchname(message)) == 0) // check name first (to avoid possible name begining by a number)
|
||||
if ((mob_id = mobdb_searchname(message)) == 0) // check name first (to avoid possible name beginning by a number)
|
||||
mob_id = atoi(message);
|
||||
|
||||
if (!mobdb_checkid(mob_id) && !npcdb_checkid(mob_id)) { //if mob or npc...
|
||||
@ -5013,7 +5013,7 @@ ACMD_FUNC(email)
|
||||
}
|
||||
|
||||
chrif_changeemail(sd->status.account_id, actual_email, new_email);
|
||||
clif_displaymessage(fd, msg_txt(sd,148)); // Information sended to login-server via char-server.
|
||||
clif_displaymessage(fd, msg_txt(sd,148)); // Information sent to login-server via char-server.
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -200,7 +200,7 @@ struct block_list* battle_getenemyarea(struct block_list *src, int x, int y, int
|
||||
return bl_list[rnd()%c];
|
||||
}
|
||||
|
||||
// Dammage delayed info
|
||||
// Damage delayed info
|
||||
struct delay_damage {
|
||||
int src_id;
|
||||
int target_id;
|
||||
@ -266,7 +266,7 @@ int battle_delay_damage (unsigned int tick, int amotion, struct block_list *src,
|
||||
|
||||
if ( !battle_config.delay_battle_damage || amotion <= 1 ) {
|
||||
map_freeblock_lock();
|
||||
status_fix_damage(src, target, damage, ddelay); // We have to seperate here between reflect damage and others [icescope]
|
||||
status_fix_damage(src, target, damage, ddelay); // We have to separate here between reflect damage and others [icescope]
|
||||
if( attack_type && !status_isdead(target) && additional_effects )
|
||||
skill_additional_effect(src, target, skill_id, skill_lv, attack_type, dmg_lv, gettick());
|
||||
if( dmg_lv > ATK_BLOCK && attack_type )
|
||||
@ -468,7 +468,7 @@ int battle_calc_cardfix(int attack_type, struct block_list *src, struct block_li
|
||||
|
||||
if( tsd && !(nk&NK_NO_CARDFIX_DEF) )
|
||||
{ // Target cards.
|
||||
cardfix = 1000; //reset var for target
|
||||
cardfix = 1000; //reset var for target
|
||||
t_cf = 0;
|
||||
|
||||
if (!(nk&NK_NO_ELEFIX))
|
||||
@ -878,7 +878,7 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam
|
||||
clif_skill_nodamage(bl, bl, RK_MILLENNIUMSHIELD, 1, 1);
|
||||
sce->val3 -= (int)cap_value(damage,INT_MIN,INT_MAX); // absorb damage
|
||||
d->dmg_lv = ATK_BLOCK;
|
||||
sc_start(src,bl,SC_STUN,15,0,skill_get_time2(RK_MILLENNIUMSHIELD,sce->val1)); // There is a chance to be stuned when one shield is broken.
|
||||
sc_start(src,bl,SC_STUN,15,0,skill_get_time2(RK_MILLENNIUMSHIELD,sce->val1)); // There is a chance to be stunned when one shield is broken.
|
||||
if( sce->val3 <= 0 ) { // Shield Down
|
||||
sce->val2--;
|
||||
if( sce->val2 > 0 ) {
|
||||
@ -1095,7 +1095,7 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam
|
||||
|
||||
if( damage > 0 && ((flag&(BF_WEAPON|BF_SHORT))==(BF_WEAPON|BF_SHORT)) && (sce = sc->data[SC_STONEHARDSKIN]) ) {
|
||||
sce->val2 -= (int)cap_value(damage,INT_MIN,INT_MAX);;
|
||||
if( src->type == BL_MOB ) //using explicite call instead break_equip for duration
|
||||
if( src->type == BL_MOB ) //using explicit call instead break_equip for duration
|
||||
sc_start(src,src, SC_STRIPWEAPON, 30, 0, skill_get_time2(RK_STONEHARDSKIN, sce->val1));
|
||||
else
|
||||
skill_break_equip(src,src, EQP_WEAPON, 3000, BCT_SELF);
|
||||
@ -1111,7 +1111,7 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam
|
||||
}
|
||||
#endif
|
||||
|
||||
//Finally added to remove the status of immobile when aimedbolt is used. [Jobbie]
|
||||
//Finally added to remove the status of immobile when Aimed Bolt is used. [Jobbie]
|
||||
if( skill_id == RA_AIMEDBOLT && (sc->data[SC_BITE] || sc->data[SC_ANKLE] || sc->data[SC_ELECTRICSHOCKER]) ) {
|
||||
status_change_end(bl, SC_BITE, INVALID_TIMER);
|
||||
status_change_end(bl, SC_ANKLE, INVALID_TIMER);
|
||||
@ -1201,8 +1201,8 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam
|
||||
}
|
||||
}
|
||||
if( sc->data[SC_POISONINGWEAPON]
|
||||
&& ((flag&BF_WEAPON) && (!skill_id || skill_id == GC_VENOMPRESSURE)) //chk skill type poison_smoke is a unit
|
||||
&& (damage > 0 && rnd()%100 < sc->data[SC_POISONINGWEAPON]->val3 )) //did some dammage and chance ok (why no additional effect ??
|
||||
&& ((flag&BF_WEAPON) && (!skill_id || skill_id == GC_VENOMPRESSURE)) //check skill type poison_smoke is a unit
|
||||
&& (damage > 0 && rnd()%100 < sc->data[SC_POISONINGWEAPON]->val3 )) //did some damage and chance ok (why no additional effect ??)
|
||||
sc_start(src,bl,(enum sc_type)sc->data[SC_POISONINGWEAPON]->val2,100,sc->data[SC_POISONINGWEAPON]->val1,skill_get_time2(GC_POISONINGWEAPON, 1));
|
||||
if( sc->data[SC__DEADLYINFECT] && damage > 0 && rnd()%100 < 30 + 10 * sc->data[SC__DEADLYINFECT]->val1 )
|
||||
status_change_spread(src, bl);
|
||||
@ -1304,7 +1304,7 @@ int64 battle_calc_bg_damage(struct block_list *src, struct block_list *bl, int64
|
||||
DAMAGE_RATE(battle_config.bg_long_damage_rate)
|
||||
}
|
||||
|
||||
damage = max(damage,1); //min 1 dammage
|
||||
damage = max(damage,1); //min 1 damage
|
||||
return damage;
|
||||
}
|
||||
|
||||
@ -1400,7 +1400,7 @@ int64 battle_addmastery(struct map_session_data *sd,struct block_list *target,in
|
||||
nullpo_ret(sd);
|
||||
|
||||
if((skill = pc_checkskill(sd,AL_DEMONBANE)) > 0 &&
|
||||
target->type == BL_MOB && //This bonus doesnt work against players.
|
||||
target->type == BL_MOB && //This bonus doesn't work against players.
|
||||
(battle_check_undead(status->race,status->def_ele) || status->race==RC_DEMON) )
|
||||
damage += (skill*(int)(3+(sd->status.base_level+1)*0.05)); // submitted by orn
|
||||
//damage += (skill * 3);
|
||||
@ -2107,7 +2107,7 @@ static bool is_attack_hitting(struct Damage wd, struct block_list *src, struct b
|
||||
if(attacker_count >= battle_config.agi_penalty_count) {
|
||||
if (battle_config.agi_penalty_type == 1)
|
||||
flee = (flee * (100 - (attacker_count - (battle_config.agi_penalty_count - 1))*battle_config.agi_penalty_num))/100;
|
||||
else //asume type 2: absolute reduction
|
||||
else //assume type 2: absolute reduction
|
||||
flee -= (attacker_count - (battle_config.agi_penalty_count - 1))*battle_config.agi_penalty_num;
|
||||
if(flee < 1) flee = 1;
|
||||
}
|
||||
@ -2265,7 +2265,7 @@ static bool battle_skill_stacks_masteries_vvs(uint16 skill_id)
|
||||
|
||||
#ifdef RENEWAL
|
||||
/*========================================
|
||||
* Calulate equipment ATK for renewal ATK
|
||||
* Calculate equipment ATK for renewal ATK
|
||||
*----------------------------------------
|
||||
* Credits:
|
||||
* Original coder Skoltex
|
||||
@ -2343,7 +2343,7 @@ static int battle_get_weapon_element(struct Damage wd, struct block_list *src, s
|
||||
element = ELE_NEUTRAL; //forced neutral for monsters
|
||||
break;
|
||||
case RL_H_MINE:
|
||||
if (sd && sd->skill_id_old == RL_FLICKER) //Force RL_H_MINE deals fire damage if ativated by RL_FLICKER
|
||||
if (sd && sd->skill_id_old == RL_FLICKER) //Force RL_H_MINE deals fire damage if activated by RL_FLICKER
|
||||
element = ELE_FIRE;
|
||||
break;
|
||||
case KO_KAIHOU:
|
||||
@ -2780,7 +2780,7 @@ static struct Damage battle_calc_multi_attack(struct Damage wd, struct block_lis
|
||||
}
|
||||
else if( ((sd->weapontype1 == W_REVOLVER && (skill_lv = pc_checkskill(sd,GS_CHAINACTION)) > 0) //Normal Chain Action effect
|
||||
|| (sd && sc->count && sc->data[SC_E_CHAIN] && (skill_lv = sc->data[SC_E_CHAIN]->val2) > 0)) //Chain Action of ETERNAL_CHAIN
|
||||
&& rnd()%100 < 5*skill_lv ) //Sucess rate
|
||||
&& rnd()%100 < 5*skill_lv ) //Success rate
|
||||
{
|
||||
wd.div_ = skill_get_num(GS_CHAINACTION,skill_lv);
|
||||
wd.type = 0x08;
|
||||
@ -3213,7 +3213,7 @@ static int battle_calc_attack_skill_ratio(struct Damage wd, struct block_list *s
|
||||
int dmg = 300; // Base maximum damage at less than 3 cells.
|
||||
i = distance_bl(src,target);
|
||||
if( i > 7 )
|
||||
dmg -= 100; // Greather than 7 cells. (200 damage)
|
||||
dmg -= 100; // Greater than 7 cells. (200 damage)
|
||||
else if( i > 3 )
|
||||
dmg -= 50; // Greater than 3 cells, less than 7. (250 damage)
|
||||
dmg = (dmg * skill_lv) * (100 + (status_get_lv(src) - 100) / 12) / 100;
|
||||
@ -3324,14 +3324,14 @@ static int battle_calc_attack_skill_ratio(struct Damage wd, struct block_list *s
|
||||
case SZ_BIG: skillratio += 200 + 300 * skill_lv; break;// Large
|
||||
}
|
||||
RE_LVL_DMOD(120);
|
||||
//NOTE: Their's some other factors that affects damage, but not sure how exactly. Will recheck one day. [Rytech]
|
||||
//NOTE: There are some other factors that affect damage, but not sure how exactly. Will recheck one day. [Rytech]
|
||||
break;
|
||||
case NC_AXEBOOMERANG:
|
||||
skillratio += (skill_lv * 50) + 150;
|
||||
if( sd ) {
|
||||
short index = sd->equip_index[EQI_HAND_R];
|
||||
if( index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == IT_WEAPON )
|
||||
skillratio += sd->inventory_data[index]->weight / 10;// Weight is divided by 10 since 10 weight in coding make 1 whole actural weight. [Rytech]
|
||||
skillratio += sd->inventory_data[index]->weight / 10;// Weight is divided by 10 since 10 weight in coding make 1 whole actual weight. [Rytech]
|
||||
}
|
||||
RE_LVL_DMOD(100);
|
||||
break;
|
||||
@ -4017,7 +4017,7 @@ struct Damage battle_calc_defense_reduction(struct Damage wd, struct block_list
|
||||
#else
|
||||
vit_def = def2;
|
||||
#endif
|
||||
if( src->type == BL_MOB && (battle_check_undead(sstatus->race,sstatus->def_ele) || sstatus->race==RC_DEMON) && //This bonus already doesnt work vs players
|
||||
if( src->type == BL_MOB && (battle_check_undead(sstatus->race,sstatus->def_ele) || sstatus->race==RC_DEMON) && //This bonus already doesn't work vs players
|
||||
(skill=pc_checkskill(tsd,AL_DP)) > 0 )
|
||||
vit_def += skill*(int)(3 +(tsd->status.base_level+1)*0.04); // submitted by orn
|
||||
if( src->type == BL_MOB && (skill=pc_checkskill(tsd,RA_RANGERMAIN))>0 &&
|
||||
@ -4495,7 +4495,7 @@ static struct Damage initialize_weapon_data(struct block_list *src, struct block
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if we should reflect the dammage and calculate it if so
|
||||
* Check if we should reflect the damage and calculate it if so
|
||||
* @param attack_type : BL_WEAPON,BL_MAGIC or BL_MISC
|
||||
* @param wd : weapon damage
|
||||
* @param src : bl who did the attack
|
||||
@ -5783,7 +5783,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
|
||||
{
|
||||
if (battle_config.agi_penalty_type == 1)
|
||||
flee = (flee * (100 - (attacker_count - (battle_config.agi_penalty_count - 1))*battle_config.agi_penalty_num))/100;
|
||||
else //asume type 2: absolute reduction
|
||||
else //assume type 2: absolute reduction
|
||||
flee -= (attacker_count - (battle_config.agi_penalty_count - 1))*battle_config.agi_penalty_num;
|
||||
if(flee < 1) flee = 1;
|
||||
}
|
||||
@ -5791,7 +5791,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
|
||||
|
||||
hitrate+= sstatus->hit - flee;
|
||||
#ifdef RENEWAL
|
||||
if( sd ) //in Renewal hit bonus from Vultures Eye is not anymore shown in status window
|
||||
if( sd ) //in Renewal hit bonus from Vultures Eye is not shown anymore in status window
|
||||
hitrate += pc_checkskill(sd,AC_VULTURE);
|
||||
#endif
|
||||
hitrate = cap_value(hitrate, battle_config.min_hitrate, battle_config.max_hitrate);
|
||||
@ -5952,7 +5952,7 @@ int64 battle_calc_return_damage(struct block_list* bl, struct block_list *src, i
|
||||
if( distance_bl(src,bl) <= 0 || !map_check_dir(dir,t_dir) ) {
|
||||
int64 rd1 = 0;
|
||||
rd1 = min(damage,status_get_max_hp(bl)) * sc->data[SC_DEATHBOUND]->val2 / 100; // Amplify damage.
|
||||
*dmg = rd1 * 30 / 100; // Received damage = 30% of amplifly damage.
|
||||
*dmg = rd1 * 30 / 100; // Received damage = 30% of amplified damage.
|
||||
clif_skill_damage(src,bl,gettick(), status_get_amotion(src), 0, -30000, 1, RK_DEATHBOUND, sc->data[SC_DEATHBOUND]->val1,6);
|
||||
status_change_end(bl,SC_DEATHBOUND,INVALID_TIMER);
|
||||
rdamage += rd1 * 70 / 100; // Target receives 70% of the amplified damage. [Rytech]
|
||||
@ -6236,7 +6236,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
|
||||
|
||||
/**
|
||||
* We need to calculate the DMG before the hp reduction, because it can kill the source.
|
||||
* For futher information: bugreport:4950
|
||||
* For further information: bugreport:4950
|
||||
**/
|
||||
ret_val = (damage_lv)skill_attack(BF_WEAPON,src,src,target,PA_SACRIFICE,skill_lv,tick,0);
|
||||
|
||||
@ -6714,7 +6714,7 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
|
||||
sd = BL_CAST(BL_PC, t_bl);
|
||||
|
||||
if( sd->state.monster_ignore && flag&BCT_ENEMY )
|
||||
return 0; // Global inminuty only to Attacks
|
||||
return 0; // Global immunity only to Attacks
|
||||
if( sd->status.karma && s_bl->type == BL_PC && ((TBL_PC*)s_bl)->status.karma )
|
||||
state |= BCT_ENEMY; // Characters with bad karma may fight amongst them
|
||||
if( sd->state.killable ) {
|
||||
|
@ -94,7 +94,7 @@ char log_db_pw[32] = "ragnarok";
|
||||
char log_db_db[32] = "log";
|
||||
Sql* logmysql_handle;
|
||||
|
||||
// DBMap declaartion
|
||||
// DBMap declaration
|
||||
static DBMap* id_db=NULL; /// int id -> struct block_list*
|
||||
static DBMap* pc_db=NULL; /// int id -> struct map_session_data*
|
||||
static DBMap* mobid_db=NULL; /// int id -> struct mob_data*
|
||||
@ -249,7 +249,7 @@ int map_freeblock_timer(int tid, unsigned int tick, int id, intptr_t data)
|
||||
//
|
||||
/*==========================================
|
||||
* Handling of map_bl[]
|
||||
* The adresse of bl_heal is set in bl->prev
|
||||
* The address of bl_heal is set in bl->prev
|
||||
*------------------------------------------*/
|
||||
static struct block_list bl_head;
|
||||
|
||||
@ -336,7 +336,7 @@ int map_delblock(struct block_list* bl)
|
||||
// blocklist (2ways chainlist)
|
||||
if (bl->prev == NULL) {
|
||||
if (bl->next != NULL) {
|
||||
// can't delete block (already at the begining of the chain)
|
||||
// can't delete block (already at the beginning of the chain)
|
||||
ShowError("map_delblock error : bl->next!=NULL\n");
|
||||
}
|
||||
return 0;
|
||||
@ -374,7 +374,7 @@ int map_delblock(struct block_list* bl)
|
||||
* @param x1 : new x position
|
||||
* @param y1 : new y position
|
||||
* @param tick : when this was scheduled
|
||||
* @return 0:sucess, 1:fail
|
||||
* @return 0:success, 1:fail
|
||||
*/
|
||||
int map_moveblock(struct block_list *bl, int x1, int y1, unsigned int tick)
|
||||
{
|
||||
@ -596,7 +596,7 @@ int map_foreachinrange(int (*func)(struct block_list*,va_list), struct block_lis
|
||||
map_freeblock_lock();
|
||||
|
||||
for( i = blockcount; i < bl_list_count; i++ )
|
||||
if( bl_list[ i ]->prev ) { //func() may delete this bl_list[] slot, checking for prev ensures it wasnt queued for deletion.
|
||||
if( bl_list[ i ]->prev ) { //func() may delete this bl_list[] slot, checking for prev ensures it wasn't queued for deletion.
|
||||
va_start(ap, type);
|
||||
returnCount += func(bl_list[ i ], ap);
|
||||
va_end(ap);
|
||||
@ -665,7 +665,7 @@ int map_foreachinshootrange(int (*func)(struct block_list*,va_list),struct block
|
||||
map_freeblock_lock();
|
||||
|
||||
for( i = blockcount; i < bl_list_count; i++ )
|
||||
if( bl_list[ i ]->prev ) { //func() may delete this bl_list[] slot, checking for prev ensures it wasnt queued for deletion.
|
||||
if( bl_list[ i ]->prev ) { //func() may delete this bl_list[] slot, checking for prev ensures it wasn't queued for deletion.
|
||||
va_start(ap, type);
|
||||
returnCount += func(bl_list[ i ], ap);
|
||||
va_end(ap);
|
||||
@ -722,7 +722,7 @@ int map_foreachinarea(int (*func)(struct block_list*,va_list), int16 m, int16 x0
|
||||
map_freeblock_lock();
|
||||
|
||||
for( i = blockcount; i < bl_list_count; i++ )
|
||||
if( bl_list[ i ]->prev ) { //func() may delete this bl_list[] slot, checking for prev ensures it wasnt queued for deletion.
|
||||
if( bl_list[ i ]->prev ) { //func() may delete this bl_list[] slot, checking for prev ensures it wasn't queued for deletion.
|
||||
va_start(ap, type);
|
||||
returnCount += func(bl_list[ i ], ap);
|
||||
va_end(ap);
|
||||
@ -785,7 +785,7 @@ int map_forcountinrange(int (*func)(struct block_list*,va_list), struct block_li
|
||||
map_freeblock_lock();
|
||||
|
||||
for( i = blockcount; i < bl_list_count; i++ )
|
||||
if( bl_list[ i ]->prev ) { //func() may delete this bl_list[] slot, checking for prev ensures it wasnt queued for deletion.
|
||||
if( bl_list[ i ]->prev ) { //func() may delete this bl_list[] slot, checking for prev ensures it wasn't queued for deletion.
|
||||
va_start(ap, type);
|
||||
returnCount += func(bl_list[ i ], ap);
|
||||
va_end(ap);
|
||||
@ -839,7 +839,7 @@ int map_forcountinarea(int (*func)(struct block_list*,va_list), int16 m, int16 x
|
||||
map_freeblock_lock();
|
||||
|
||||
for( i = blockcount; i < bl_list_count; i++ )
|
||||
if(bl_list[ i ]->prev) { //func() may delete this bl_list[] slot, checking for prev ensures it wasnt queued for deletion.
|
||||
if(bl_list[ i ]->prev) { //func() may delete this bl_list[] slot, checking for prev ensures it wasn't queued for deletion.
|
||||
va_start(ap, type);
|
||||
returnCount += func(bl_list[ i ], ap);
|
||||
va_end(ap);
|
||||
@ -854,9 +854,8 @@ int map_forcountinarea(int (*func)(struct block_list*,va_list), int16 m, int16 x
|
||||
}
|
||||
|
||||
/*==========================================
|
||||
* For what I get
|
||||
* Move bl and do func* with va_list while moving.
|
||||
* Mouvement is set by dx dy wich are distance in x and y
|
||||
* Movement is set by dx dy which are distance in x and y
|
||||
*------------------------------------------*/
|
||||
int map_foreachinmovearea(int (*func)(struct block_list*,va_list), struct block_list* center, int16 range, int16 dx, int16 dy, int type, ...)
|
||||
{
|
||||
@ -967,7 +966,7 @@ int map_foreachinmovearea(int (*func)(struct block_list*,va_list), struct block_
|
||||
map_freeblock_lock(); // Prohibit the release from memory
|
||||
|
||||
for( i = blockcount; i < bl_list_count; i++ )
|
||||
if( bl_list[ i ]->prev ) { //func() may delete this bl_list[] slot, checking for prev ensures it wasnt queued for deletion.
|
||||
if( bl_list[ i ]->prev ) { //func() may delete this bl_list[] slot, checking for prev ensures it wasn't queued for deletion.
|
||||
va_start(ap, type);
|
||||
returnCount += func(bl_list[ i ], ap);
|
||||
va_end(ap);
|
||||
@ -1011,7 +1010,7 @@ int map_foreachincell(int (*func)(struct block_list*,va_list), int16 m, int16 x,
|
||||
map_freeblock_lock();
|
||||
|
||||
for( i = blockcount; i < bl_list_count; i++ )
|
||||
if( bl_list[ i ]->prev ) { //func() may delete this bl_list[] slot, checking for prev ensures it wasnt queued for deletion.
|
||||
if( bl_list[ i ]->prev ) { //func() may delete this bl_list[] slot, checking for prev ensures it wasn't queued for deletion.
|
||||
va_start(ap, type);
|
||||
returnCount += func(bl_list[ i ], ap);
|
||||
va_end(ap);
|
||||
@ -1048,7 +1047,7 @@ int map_foreachinpath(int (*func)(struct block_list*,va_list),int16 m,int16 x0,i
|
||||
//////////////////////////////////////////////////////////////
|
||||
// Methodology:
|
||||
// My trigonometrics and math are a little rusty... so the approach I am writing
|
||||
// here is basicly do a double for to check for all targets in the square that
|
||||
// here is basically do a double for to check for all targets in the square that
|
||||
// contains the initial and final positions (area range increased to match the
|
||||
// radius given), then for each object to test, calculate the distance to the
|
||||
// path and include it if the range fits and the target is in the line (0<k<1,
|
||||
@ -1190,7 +1189,7 @@ int map_foreachinpath(int (*func)(struct block_list*,va_list),int16 m,int16 x0,i
|
||||
map_freeblock_lock();
|
||||
|
||||
for( i = blockcount; i < bl_list_count; i++ )
|
||||
if( bl_list[ i ]->prev ) { //func() may delete this bl_list[] slot, checking for prev ensures it wasnt queued for deletion.
|
||||
if( bl_list[ i ]->prev ) { //func() may delete this bl_list[] slot, checking for prev ensures it wasn't queued for deletion.
|
||||
va_start(ap, type);
|
||||
returnCount += func(bl_list[ i ], ap);
|
||||
va_end(ap);
|
||||
@ -1232,7 +1231,7 @@ int map_foreachinmap(int (*func)(struct block_list*,va_list), int16 m, int type,
|
||||
map_freeblock_lock();
|
||||
|
||||
for( i = blockcount; i < bl_list_count ; i++ )
|
||||
if( bl_list[ i ]->prev ) { //func() may delete this bl_list[] slot, checking for prev ensures it wasnt queued for deletion.
|
||||
if( bl_list[ i ]->prev ) { //func() may delete this bl_list[] slot, checking for prev ensures it wasn't queued for deletion.
|
||||
va_start(ap, type);
|
||||
returnCount += func(bl_list[ i ], ap);
|
||||
va_end(ap);
|
||||
@ -1500,7 +1499,7 @@ static DBData create_charid2nick(DBKey key, va_list args)
|
||||
return db_ptr2data(p);
|
||||
}
|
||||
|
||||
/// Adds(or replaces) the nick of charid to nick_db and fullfils pending requests.
|
||||
/// Adds(or replaces) the nick of charid to nick_db and fulfils pending requests.
|
||||
/// Does nothing if the character is online.
|
||||
void map_addnickdb(int charid, const char* nick)
|
||||
{
|
||||
@ -1995,7 +1994,7 @@ void map_foreachnpc(int (*func)(struct npc_data* nd, va_list args), ...)
|
||||
}
|
||||
|
||||
/// Applies func to everything in the db.
|
||||
/// Stops iteratin gif func returns -1.
|
||||
/// Stops iterating if func returns -1.
|
||||
void map_foreachregen(int (*func)(struct block_list* bl, va_list args), ...)
|
||||
{
|
||||
DBIterator* iter;
|
||||
@ -3208,7 +3207,7 @@ int map_readallmaps (void)
|
||||
exit(EXIT_FAILURE); //No use launching server if maps can't be read.
|
||||
}
|
||||
|
||||
// Init mapcache data.. [Shinryo]
|
||||
// Init mapcache data. [Shinryo]
|
||||
map_cache_buffer = map_init_mapcache(fp);
|
||||
if(!map_cache_buffer) {
|
||||
ShowFatalError("Failed to initialize mapcache data (%s)..\n", mapcachefilepath);
|
||||
@ -3270,7 +3269,7 @@ int map_readallmaps (void)
|
||||
if( !enable_grf ) {
|
||||
fclose(fp);
|
||||
|
||||
// The cache isn't needed anymore, so free it.. [Shinryo]
|
||||
// The cache isn't needed anymore, so free it. [Shinryo]
|
||||
aFree(map_cache_buffer);
|
||||
}
|
||||
|
||||
|
@ -2160,6 +2160,54 @@ static void npc_parsename(struct npc_data* nd, const char* name, const char* sta
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses NPC view.
|
||||
* Support for using Constants in place of NPC View IDs.
|
||||
*/
|
||||
int npc_parseview(const char* w4, const char* start, const char* buffer, const char* filepath) {
|
||||
int val = -1, i = 0;
|
||||
char viewid[1024]; // Max size of name from const.txt, see read_constdb.
|
||||
|
||||
// Extract view ID / constant
|
||||
while (w4[i] != '\0') {
|
||||
if (ISSPACE(w4[i]) || w4[i] == '/' || w4[i] == ',')
|
||||
break;
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
safestrncpy(viewid, w4, i+=1);
|
||||
|
||||
// Check if view id is not an ID (only numbers).
|
||||
if(!npc_viewisid(viewid)) {
|
||||
// Check if constant exists and get its value.
|
||||
if(!script_get_constant(viewid, &val)) {
|
||||
ShowWarning("npc_parseview: Invalid NPC constant '%s' specified in file '%s', line'%d'. Defaulting to INVISIBLE_CLASS. \n", viewid, filepath, strline(buffer,start-buffer));
|
||||
val = INVISIBLE_CLASS;
|
||||
}
|
||||
} else {
|
||||
// NPC has an ID specified for view id.
|
||||
val = atoi(w4);
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if given view is an ID or constant.
|
||||
*/
|
||||
bool npc_viewisid(const char * viewid)
|
||||
{
|
||||
if(atoi(viewid) != -1) {
|
||||
// Loop through view, looking for non-numeric character.
|
||||
while (*viewid) {
|
||||
if (ISDIGIT(*viewid++) == 0) return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add then display an npc warp on map
|
||||
* @param name : warp unique name
|
||||
@ -2459,7 +2507,7 @@ static const char* npc_parse_shop(char* w1, char* w2, char* w3, char* w4, const
|
||||
nd->bl.y = y;
|
||||
nd->bl.id = npc_get_new_npc_id();
|
||||
npc_parsename(nd, w3, start, buffer, filepath);
|
||||
nd->class_ = m==-1?-1:atoi(w4);
|
||||
nd->class_ = m == -1 ? -1 : npc_parseview(w4, start, buffer, filepath);
|
||||
nd->speed = 200;
|
||||
|
||||
++npc_shop;
|
||||
@ -2620,7 +2668,7 @@ static const char* npc_skip_script(const char* start, const char* buffer, const
|
||||
* @return new index for next parsing
|
||||
*/
|
||||
static const char* npc_parse_script(char* w1, char* w2, char* w3, char* w4, const char* start, const char* buffer, const char* filepath, bool runOnInit) {
|
||||
int x, y, dir = 0, m, xs = 0, ys = 0, class_ = 0; // [Valaris] thanks to fov
|
||||
int x, y, dir = 0, m, xs = 0, ys = 0; // [Valaris] thanks to fov
|
||||
char mapname[32];
|
||||
struct script_code *script;
|
||||
int i;
|
||||
@ -2672,14 +2720,13 @@ static const char* npc_parse_script(char* w1, char* w2, char* w3, char* w4, cons
|
||||
|
||||
CREATE(nd, struct npc_data, 1);
|
||||
|
||||
if( sscanf(w4, "%d,%d,%d", &class_, &xs, &ys) == 3 )
|
||||
if( sscanf(w4, "%*[^,],%d,%d", &xs, &ys) == 2 )
|
||||
{// OnTouch area defined
|
||||
nd->u.scr.xs = xs;
|
||||
nd->u.scr.ys = ys;
|
||||
}
|
||||
else
|
||||
{// no OnTouch area
|
||||
class_ = atoi(w4);
|
||||
nd->u.scr.xs = -1;
|
||||
nd->u.scr.ys = -1;
|
||||
}
|
||||
@ -2690,7 +2737,7 @@ static const char* npc_parse_script(char* w1, char* w2, char* w3, char* w4, cons
|
||||
nd->bl.y = y;
|
||||
npc_parsename(nd, w3, start, buffer, filepath);
|
||||
nd->bl.id = npc_get_new_npc_id();
|
||||
nd->class_ = class_;
|
||||
nd->class_ = m == -1 ? -1 : npc_parseview(w4, start, buffer, filepath);
|
||||
nd->speed = 200;
|
||||
nd->u.scr.script = script;
|
||||
nd->u.scr.label_list = label_list;
|
||||
@ -2709,7 +2756,7 @@ static const char* npc_parse_script(char* w1, char* w2, char* w3, char* w4, cons
|
||||
npc_setcells(nd);
|
||||
if(map_addblock(&nd->bl))
|
||||
return NULL;
|
||||
if( class_ >= 0 )
|
||||
if( nd->class_ >= 0 )
|
||||
{
|
||||
status_set_viewdata(&nd->bl, nd->class_);
|
||||
if( map[nd->bl.m].users )
|
||||
@ -2760,7 +2807,7 @@ static const char* npc_parse_script(char* w1, char* w2, char* w3, char* w4, cons
|
||||
/// npc: <map name>,<x>,<y>,<facing>%TAB%duplicate(<name of target>)%TAB%<NPC Name>%TAB%<sprite id>,<triggerX>,<triggerY>
|
||||
const char* npc_parse_duplicate(char* w1, char* w2, char* w3, char* w4, const char* start, const char* buffer, const char* filepath)
|
||||
{
|
||||
int x, y, dir, m, xs = -1, ys = -1, class_ = 0;
|
||||
int x, y, dir, m, xs = -1, ys = -1;
|
||||
char mapname[32];
|
||||
char srcname[128];
|
||||
int i;
|
||||
@ -2808,9 +2855,8 @@ const char* npc_parse_duplicate(char* w1, char* w2, char* w3, char* w4, const ch
|
||||
}
|
||||
|
||||
if( type == WARP && sscanf(w4, "%d,%d", &xs, &ys) == 2 );// <spanx>,<spany>
|
||||
else if( type == SCRIPT && sscanf(w4, "%d,%d,%d", &class_, &xs, &ys) == 3);// <sprite id>,<triggerX>,<triggerY>
|
||||
else if( type != WARP ) class_ = atoi(w4);// <sprite id>
|
||||
else {
|
||||
else if( type == SCRIPT && sscanf(w4, "%*[^,],%d,%d", &xs, &ys) == 2);// <sprite id>,<triggerX>,<triggerY>
|
||||
else if( type == WARP ) {
|
||||
ShowError("npc_parse_duplicate: Invalid span format for duplicate warp in file '%s', line '%d'. Skipping line...\n * w1=%s\n * w2=%s\n * w3=%s\n * w4=%s\n", filepath, strline(buffer,start-buffer), w1, w2, w3, w4);
|
||||
return end;// next line, try to continue
|
||||
}
|
||||
@ -2823,7 +2869,7 @@ const char* npc_parse_duplicate(char* w1, char* w2, char* w3, char* w4, const ch
|
||||
nd->bl.y = y;
|
||||
npc_parsename(nd, w3, start, buffer, filepath);
|
||||
nd->bl.id = npc_get_new_npc_id();
|
||||
nd->class_ = class_;
|
||||
nd->class_ = m == -1 ? -1 : npc_parseview(w4, start, buffer, filepath);
|
||||
nd->speed = 200;
|
||||
nd->src_id = src_id;
|
||||
nd->bl.type = BL_NPC;
|
||||
@ -2870,7 +2916,7 @@ const char* npc_parse_duplicate(char* w1, char* w2, char* w3, char* w4, const ch
|
||||
npc_setcells(nd);
|
||||
if(map_addblock(&nd->bl))
|
||||
return end;
|
||||
if( class_ >= 0 ) {
|
||||
if( nd->class_ >= 0 ) {
|
||||
status_set_viewdata(&nd->bl, nd->class_);
|
||||
if( map[nd->bl.m].users )
|
||||
clif_spawn(&nd->bl);
|
||||
|
@ -129,6 +129,7 @@ int npc_buysellsel(struct map_session_data* sd, int id, int type);
|
||||
int npc_buylist(struct map_session_data* sd,int n, unsigned short* item_list);
|
||||
int npc_selllist(struct map_session_data* sd, int n, unsigned short* item_list);
|
||||
void npc_parse_mob2(struct spawn_data* mob);
|
||||
bool npc_viewisid(const char * viewid);
|
||||
struct npc_data* npc_add_warp(char* name, short from_mapid, short from_x, short from_y, short xs, short ys, unsigned short to_mapindex, short to_x, short to_y);
|
||||
int npc_globalmessage(const char* name,const char* mes);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user