// ギルド城データ変更要求 int guild_castledatasave(int castle_id,int index,int value) { if( index == 1 ) { //The castle's owner has changed? Update Guardian ownership, too. [Skotlex] struct guild_castle *gc = guild_castle_search(castle_id); int m = -1; if (gc) m = map_mapindex2mapid(gc->mapindex); if (m != -1) map_foreachinmap(mob_guardian_guildchange, m, BL_MOB); //FIXME: why not iterate over gc->guardian[i].id ? } else if( index == 3 ) { // defense invest change -> recalculate guardian hp struct guild_castle* gc = guild_castle_search(castle_id); if( gc ) { int i; struct mob_data* gd; for( i = 0; i < MAX_GUARDIANS; i++ ) if( gc->guardian[i].visible && (gd = map_id2md(gc->guardian[i].id)) != NULL ) status_calc_mob(gd,0); } } return intif_guild_castle_datasave(castle_id,index,value); }
// ギルド城データ変更要求 int guild_castledatasave(int castle_id,int index,int value) { if (index == 1) { //The castle's owner has changed? Update Guardian ownership, too. [Skotlex] struct guild_castle *gc = guild_castle_search(castle_id); int m = -1; if (gc) m = map_mapname2mapid(gc->map_name); if (m != -1) map_foreachinmap(mob_guardian_guildchange, m, BL_MOB); } return intif_guild_castle_datasave(castle_id,index,value); }
/*-------------------------------------- * Init all map on the instance. Npcs are created here *--------------------------------------*/ void instance_init(int instance_id) { int i; if( !instance_is_valid(instance_id) ) return; // nothing to do for( i = 0; i < instance[instance_id].num_map; i++ ) map_foreachinmap(instance_map_npcsub, map[instance[instance_id].map[i]].instance_src_map, BL_NPC, instance[instance_id].map[i]); instance[instance_id].state = INSTANCE_BUSY; ShowInfo("[Instance] Initialized %s.\n", instance[instance_id].name); }
int bg_send_dot_remove(struct map_session_data *sd) { struct battleground_data *bg; int m; if( sd && sd->bg_id && (bg = bg_team_search(sd->bg_id)) != NULL ) { clif_bg_xy_remove(sd); if( bg->reveal_pos && (m = map_mapindex2mapid(bg->mapindex)) == sd->bl.m ) map_foreachinmap(bg_reveal_pos,m,BL_PC,sd,2,0xFFFFFF); } return 0; }
/*-------------------------------------- * Removes a simple instance map *--------------------------------------*/ void instance_del_map(int m) { int i; if( m <= 0 || !map[m].instance_id ) { ShowError("Tried to remove non-existing instance map (%d)\n", m); return; } map_foreachpc(instance_del_load, m); map_foreachinmap(instance_cleanup_sub, m, BL_ALL); if( map[m].mob_delete_timer != INVALID_TIMER ) delete_timer(map[m].mob_delete_timer, map_removemobs_timer); mapindex_removemap( map[m].index ); // Free memory aFree(map[m].cell); aFree(map[m].block); aFree(map[m].block_mob); // Remove from instance for( i = 0; i < instance[map[m].instance_id].num_map; i++ ) { if( instance[map[m].instance_id].map[i] == m ) { instance[map[m].instance_id].num_map--; for( ; i < instance[map[m].instance_id].num_map; i++ ) instance[map[m].instance_id].map[i] = instance[map[m].instance_id].map[i+1]; i = -1; break; } } if( i == instance[map[m].instance_id].num_map ) ShowError("map_instance_del: failed to remove %s from instance list (%s): %d\n", map[m].name, instance[map[m].instance_id].name, m); map_removemapdb(&map[m]); memset(&map[m], 0x00, sizeof(map[0])); /* for it is default and makes it not try to delete a non-existent timer since we did not delete this entry. */ map[m].mob_delete_timer = INVALID_TIMER; }
int bg_send_xy_timer_sub(DBKey key, void *data, va_list ap) { struct battleground_data *bg = (struct battleground_data *)data; struct map_session_data *sd; char output[128]; int i, m; nullpo_ret(bg); m = map_mapindex2mapid(bg->mapindex); bg->reveal_flag = !bg->reveal_flag; // Switch for( i = 0; i < MAX_BG_MEMBERS; i++ ) { if( (sd = bg->members[i].sd) == NULL ) continue; if( battle_config.bg_idle_autokick && DIFF_TICK(last_tick, sd->idletime) >= battle_config.bg_idle_autokick && bg->g ) { sprintf(output, "- AFK [%s] Kicked -", sd->status.name); clif_broadcast2(&sd->bl, output, (int)strlen(output)+1, bg->color, 0x190, 20, 0, 0, BG); bg_team_leave(sd,3); clif_displaymessage(sd->fd, "You have been kicked from 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; } if( sd->bl.x != bg->members[i].x || sd->bl.y != bg->members[i].y ) { // xy update bg->members[i].x = sd->bl.x; bg->members[i].y = sd->bl.y; clif_bg_xy(sd); } if( bg->reveal_pos && bg->reveal_flag && sd->bl.m == m ) // Reveal each 4 seconds map_foreachinmap(bg_reveal_pos,m,BL_PC,sd,1,bg->color); if( battle_config.bg_idle_announce && !sd->state.bg_afk && DIFF_TICK(last_tick, sd->idletime) >= battle_config.bg_idle_announce && bg->g ) { // Idle announces sd->state.bg_afk = 1; sprintf(output, "%s : %s seens to be away. AFK Warning - Can be kicked out with @reportafk", bg->g->name, sd->status.name); clif_bg_message(bg, bg->bg_id, bg->g->name, output, strlen(output) + 1); } } return 0; }