viewing paste Unknown #14866 | 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
ACMD(guildskill) {
    unsigned char i;
    unsigned short skill_id, skill_lv;
    struct guild *g;
    const struct {
        char skill[3];
        unsigned short skill_id;
    } guild_skill[] = {
        { "BO", GD_BATTLEORDER,     },
        { "RG", GD_REGENERATION,    },
        { "RS", GD_RESTORE,         },
        { "EC", GD_EMERGENCYCALL,   },
    };
 
    if (!sd->status.guild_id || !(g = sd->guild) || !sd->state.gmaster_flag) {
        clif->message(fd, "Only a Guild Master can use this command.");
        return false;
    }
 
    if (pc_cant_act(sd) || pc_issit(sd) || pc_isdead(sd) ||
        sd->menuskill_id || (&sd->sc && sd->sc.option&OPTION_COSTUME) ||
        DIFF_TICK(timer->gettick(), sd->ud.canact_tick) < 0 ||
        sd->ud.skilltimer != INVALID_TIMER)
    {
        clif->message(fd, "Cannot use this skill in your current state.");
        return false;
    }
 
    for (i = 0; i < ARRAYLENGTH(guild_skill); i++) {
        if (strcmpi(guild_skill[i].skill, message) == 0)
            break;
    }
    if (i >= ARRAYLENGTH(guild_skill)) {
        clif->message(fd, "Invalid guild skill. Usage: @guildskill BO/RG/RS/EC");
        return false;
    }
    skill_id = guild_skill[i].skill_id;
 
    if (!(skill_lv = guild->checkskill(g, skill_id))) {
        clif->skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0);
        return false;
    }
 
    unit->skilluse_id(&sd->bl, sd->bl.id, skill_id, skill_lv);
    return true;
}
Viewed 559 times, submitted by Guest.