Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Timer function for revealing/hiding mini map positions.
- * Also handles player AFK mechanic.
- * @see DBApply
- * @see hBG_send_xy_timer
- * @param data battleground data pointer.
- * @return int
- */
- int hBG_send_xy_timer_sub(union DBKey key, struct DBData *data, va_list ap)
- {
- struct battleground_data *bgd = DB->data2ptr(data);
- struct hBG_data *hBGd = getFromBGDATA(bgd, 0);
- char output[128];
- int i, m, idle_announce = hBG_config_get("battle_configuration/hBG_idle_announce"),
- idle_autokick = hBG_config_get("battle_configuration/hBG_idle_autokick");
- nullpo_ret(bgd);
- nullpo_ret(hBGd);
- m = map->mapindex2mapid(bgd->mapindex);
- hBGd->reveal_flag = !hBGd->reveal_flag; // Switch
- for (i = 0; i < MAX_BG_MEMBERS; i++) {
- struct map_session_data *sd = bgd->members[i].sd;
- struct hBG_map_session_data *hBGsd = NULL;
- if (sd == NULL || (hBGsd = getFromMSD(sd, 1)) == NULL)
- continue;
- if (idle_autokick && DIFF_TICK(sockt->last_tick, sd->idletime) >= idle_autokick
- && hBGd->g && map->list[sd->bl.m].flag.battleground)
- {
- sprintf(output, "[Battlegrounds] %s has been kicked for being AFK.", sd->status.name);
- clif->broadcast2(&sd->bl, output, (int)strlen(output)+1, hBGd->color, 0x190, 20, 0, 0, BG);
- hBG_team_leave(sd,3);
- clif->message(sd->fd, "You have been kicked from the battleground because of your AFK status.");
- pc->setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, 3);
- continue;
- } else if (sd->bl.x != bgd->members[i].x || sd->bl.y != bgd->members[i].y) { // xy update
- bgd->members[i].x = sd->bl.x;
- bgd->members[i].y = sd->bl.y;
- clif->bg_xy(sd);
- }
- if (hBGd->reveal_pos && hBGd->reveal_flag && sd->bl.m == m)
- map->foreachinmap(hBG_reveal_pos, m, BL_PC, sd, 1, hBGd->color);
- // Message for AFK Idling
- if (idle_announce && DIFF_TICK(sockt->last_tick, sd->idletime) >= idle_announce && !hBGsd->state.afk && hBGd->g)
- { // Set AFK status and announce to the team.
- hBGsd->state.afk = 1;
- sprintf(output, "%s : %s seems to be away. AFK Warning - Can be kicked out with @reportafk.", hBGd->g->name, sd->status.name);
- hBG_send_chat_message(bgd, sd->bl.id, sd->status.name, output, (int)strlen(output) + 1);
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement