viewing paste Unknown #1612 | 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
// replace clif_calc_walkdelay with this!
static int clif_calc_walkdelay(struct block_list *bl,int delay, int type, int damage, int div_)
{
    if (type == 4 || type == 9 || damage <=0)
        return 0;
    
    if (bl->type == BL_PC) 
    {
        if (battle_config.pc_walk_delay_rate != 100)
            delay = delay*battle_config.pc_walk_delay_rate/100;
    } 
    //else if (bl->type == BL_MOB && status_get_mode(bl)&MD_BOSS)
    //{
    //  delay = delay * 10/100;
    //}
    else if (battle_config.walk_delay_rate != 100)
        delay = delay*battle_config.walk_delay_rate/100;
    
    if (div_ > 1) //Multi-hit skills mean higher delays.
        delay += battle_config.multihit_delay*(div_-1);
 
    if (bl->type == BL_PC)
    {
        TBL_PC *sd = BL_CAST(BL_PC, bl);
        nullpo_retr(delay>0?delay:1, sd);
 
        sd->hit_tick = gettick();
    }
    return delay>0?delay:1; //Return 1 to specify there should be no noticeable delay, but you should stop walking.
}
 
 
// this is for server-side skill delays to prevent no-delay shit
// these numbers are chosen based off testing done by goodgamersro and proro staff, investigating it myself felt like a waste of time
static int skill_min_delay(struct map_session_data *sd, int skill_id)
{
    int min = battle_config.min_skill_delay_limit?battle_config.min_skill_delay_limit:200; //the 200 is arbitrarily chosen
    int minimum_min = min;
    static int instance = 0;
    unsigned int time = gettick();
 
 
    switch(skill_id)
    {
        case AL_HEAL:
        case MG_FIREBOLT:
        case MG_COLDBOLT:
        case MG_LIGHTNINGBOLT:
        case MG_SOULSTRIKE:
        case WZ_EARTHSPIKE: 
        case WZ_JUPITEL:
        case AS_GRIMTOOTH:
        case CR_SHIELDCHARGE:
        case CR_SHIELDBOOMERANG:
        case PA_SHIELDCHAIN:
        case SN_FALCONASSAULT:
        case WS_CARTTERMINATION:
            min = 192;
            break;
 
        case SM_BASH:
        case PA_PRESSURE:
        case AC_DOUBLE:
        case SN_SHARPSHOOTING:
        case NJ_HYOUSENSOU:
        case NJ_KAMAITACHI:
        case NJ_BAKUENRYU:
            min = 224;
            break;
        case CR_DEVOTION:
        case SA_DISPEL:
        case AL_BLESSING:
            min = 312;
            break;
        case HW_GANBANTEIN:
        case SA_LANDPROTECTOR:
            min = 480;
            break;
        case WZ_HEAVENDRIVE:
            min = 512;
            break;
        case PR_STRECOVERY:
        case PR_LEXAETERNA:
        case HT_DETECTING:
        case SL_KAUPE:
        case SL_KAITE:
            min = 544;
            break;
        case AC_SHOWER:
            min = 768;
            break;
    }
 
 
 
    if ( min > minimum_min && DIFF_TICK(time, sd->hit_tick) < minimum_min*5 ) // that is, you've been hit between now ~600 ms ago
        min = minimum_min;
 
 
    return max(min, minimum_min);
}
 
 
// add this to pc_authok around the other timers
 
    sd->hit_tick = last_tick; //probably not necessary but do it anyways
    
// add this to struct map_session_data (pc.h)
 
    unsigned int hit_tick;
Viewed 705 times, submitted by Guest.