/*==========================================
* Hansip Skill delay check [Kichi]
* it will player who recast same skill below X ms
* official ragnarok let you recast a same skill if the player has enough aspd to do
*------------------------------------------*/
int hs_skill_delay_check (struct map_session_data *sd, uint16 skill_id, uint16 skill_lv,uint16 flag) {
switch (skill_id) {
case AS_SONICBLOW:
case GC_CROSSIMPACT:
case CG_ARROWVULCAN:
if (sd->last_skill = skill_id){
if(( DIFF_TICK(sd->canskill_tick2, gettick()) > 0 ))
sd->state.hs_skill_check_double = 1 ;
else
sd->canskill_tick2 = gettick() + 1500;
}
break;
case RK_DRAGONBREATH:
case RK_DRAGONBREATH_WATER:
if (sd->last_skill = skill_id){
if(( DIFF_TICK(sd->canskill_tick2, gettick()) > 0 ))
sd->state.hs_skill_check_double = 1 ;
else
sd->canskill_tick2 = gettick() + 1000;
}
break;
case AC_DOUBLE:
case AC_SHOWER:
case SM_BASH:
case KN_BOWLINGBASH:
case NJ_KOUENKA:
case NJ_HYOUSENSOU:
case WZ_JUPITEL:
if (sd->last_skill = skill_id)
sd->state.hs_skill_check_double = 1 ;
break;
default:
break;
}
sd->last_skill = skill_id;
return 1;
}
/*==========================================
* Hansip Skill delay penalty [Kichi]
* It will check if the player has been cast 2 times
* As the official client rules, you only able to do cast 2 times and
* you should wait till the act end.
*------------------------------------------*/
int hs_skill_delay_penalty(uint16 skill_id) {
int time = 0;
switch (skill_id) {
case AS_SONICBLOW:
case GC_CROSSIMPACT:
case CG_ARROWVULCAN:
time = 2000;
break;
case RK_DRAGONBREATH:
case RK_DRAGONBREATH_WATER:
time = 1200;
break;
case AC_DOUBLE:
case AC_SHOWER:
case SM_BASH:
case NJ_KOUENKA:
case NJ_HYOUSENSOU:
case WZ_JUPITEL:
time = 350;
break;
case KN_BOWLINGBASH:
time = 490;
break;
default:
time = battle_config.hansip_min_delay;
break;
}
return time;
}
int hs_flood_delay_check (struct map_session_data *sd, uint16 skill_id) {
int64 sum;
char message_to_gm[200];
if (!sd)
return 0;
if (sd->last_skill && sd->last_skill == skill_id){
if (sd->tem_tick_skill2)
sd->tem_tick_skill3 = sd->tem_tick_skill2;
if (sd->tem_tick_skill1)
sd->tem_tick_skill2 = sd->tem_tick_skill1;
if (sd->castskill_tick)
sd->tem_tick_skill1 = gettick()- sd->castskill_tick;//; DIFF_TICK(sd->castskill_tick, gettick());
sum = (sd->tem_tick_skill3 + sd->tem_tick_skill2 + sd->tem_tick_skill1) / 3;
if (sum >= sd->tem_tick_skill3 - 3 && sum <= sd->tem_tick_skill3 + 3)
sd->spam_count = sd->spam_count + 1;
else
sd->spam_count = 0;
if (sd->spam_count > 3){
sprintf(message_to_gm, "[Hansip] : Spam Detected! '%s' probably use third party. Constantly flood %d times, tick %d", sd->status.name, sd->spam_count, sum);
intif_wis_message_to_gm(wisp_server_name, PC_PERM_RECEIVE_HACK_INFO, message_to_gm);
}
if (sd->spam_count >= battle_config.hansip_spam_count && battle_config.hansip_spam_punish)
return 1;
sd->castskill_tick = gettick();
}else{
sd->tem_tick_skill1 = 0;
sd->tem_tick_skill2 = 0;
sd->tem_tick_skill3 = 0;
sd->spam_count = 0;
}
sd->last_skill = skill_id;
return 0;
}