case GD_EMERGENCYCALL:
case GD_ITEMEMERGENCYCALL:
{
int8 dx[9] = {-1, 1, 0, 0,-1, 1,-1, 1, 0};
int8 dy[9] = { 0, 0, 1,-1, 1,-1,-1, 1, 0};
uint8 j = 0, calls = 0, called = 0;
struct guild *g;
// i don't know if it actually summons in a circle, but oh well. ;P
g = sd?sd->state.gmaster_flag:guild_search(status_get_guild_id(src));
if (!g)
break;
if (skill_id == GD_ITEMEMERGENCYCALL)
switch (skill_lv) {
case 1: calls = 7; break;
case 2: calls = 12; break;
case 3: calls = 20; break;
default: calls = 0; break;
}
clif_skill_nodamage(src,bl,skill_id,skill_lv,1);
for (i = 0; i < g->max_member && (!calls || (calls && called < calls)); i++, j++) {
if (j > 8)
j = 0;
if ((dstsd = g->member[i].sd) != NULL && sd != dstsd && !dstsd->state.autotrade && !pc_isdead(dstsd)) {
if (map[dstsd->bl.m].flag.nowarp && !map_flag_gvg2(dstsd->bl.m))
continue;
if(map_getcell(src->m,src->x+dx[j],src->y+dy[j],CELL_CHKNOREACH))
dx[j] = dy[j] = 0;
pc_setpos(dstsd, map_id2index(src->m), src->x+dx[j], src->y+dy[j], CLR_RESPAWN);
called++;
}
}
if (sd)
guild_block_skill(sd,skill_get_time2(skill_id,skill_lv));
sc_start(&sd->bl,SC_EMERGENCYCALL,100,0,skill_get_time(skill_id, skill_lv));
}
break;