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;
}