viewing paste Unknown #13278 | C

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
/*==========================================
* 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;
}
Viewed 821 times, submitted by Guest.