public game_err_code add_player(int sid, IBaseUnit player) { long cur_tm_s = Utility.time(); IMapUnit pl = player.get_pack_data(); group_map enter_gp_map = null; //::g_debug( "======>> add_player() " ); if (this.gpmap_maxply > 0) { if (cid2gpid.ContainsKey(pl.cid)) { //先判断 是否已有分配 var gp_map = this.gp_maps[this.cid2gpid[pl.cid] - 1]; if (gp_map.fin) {//已结束 return game_err_code.LEVEL_LVL_IS_FINISH; } if (gp_map.plycnt < this.gpmap_maxply) { enter_gp_map = gp_map; } } if (enter_gp_map == null) { for (int i = this.gp_maps.Count; i > 0; --i) {//优先 后创建的 var gp_map = this.gp_maps[i - 1]; if (gp_map.plycnt < this.gpmap_maxply) { enter_gp_map = gp_map; break; } } } if (enter_gp_map == null) { enter_gp_map = new group_map(this.gp_maps.Count + 1); var ret_code = this._create_group_map(enter_gp_map); if (ret_code != game_err_code.RES_OK) { return ret_code; } this.gp_maps.push(enter_gp_map); //sys.trace(sys.SLT_DETAIL, " this.gp_maps.len =["+this.gp_maps.len()+"]\n"); } } //sys.trace(sys.SLT_DETAIL, "pl.lmpid["+pl.lmpid+"]\n"); //if(pl.lmpid == 0) //{ // pl.lx = pl.x; // pl.ly = pl.y; // pl.lmpid = pl.map_id; // pl.map_id = born_map_conf.id; // pl.x = sys.rand(born_map_conf.born[0].x, born_map_conf.born[0].width); // pl.y = sys.rand(born_map_conf.born[0].y, born_map_conf.born[0].height); //} var pl_clanid = 0; //::g_dump("======>>sgplayersbyside:", this.sgplayersbyside ); if (this.sgplayersbyside.Count > 0) { // 需要记录助攻 player.kp_asist_rec = true; // 分阵营 var toj_sideid = 0; if (sgplayerside_bycid.ContainsKey(pl.cid)) { // 已经分配过的用户 toj_sideid = this.sgplayerside_bycid[pl.cid]; } else { if (this.plyside > 0) { // 玩家进入固定阵营 if (!sgplayersbyside.ContainsKey(this.plyside)) { Utility.trace_err("lvl ltpid[" + ltpid + "] pvp plyside[" + plyside + "] not in side config!\n"); return game_err_code.CONFIG_ERR; } toj_sideid = this.plyside; } //else if (this.cltwar) //{ // // 帮派领地争夺战,守城的一边,其余攻城的一边 // pl_clanid = clanmgr.get_pl_clanid(pl.cid); // if (pl_clanid == this.cltwar.owner_clanid) // { // // 领地拥有者帮派,防守方 // toj_sideid = this.cltwar.defside; // } // else // { // // 非领地拥有者帮派,进攻方 // toj_sideid = this.cltwar.atkside; // } //} //else if (this.clcqwar) //{ // // 帮派奴役战,攻打的一边,其余守的一边 // pl_clanid = clanmgr.get_pl_clanid(pl.cid); // if (pl_clanid == this.clcqwar.atk_clanid) // { // // 进攻方帮派,进攻方 // toj_sideid = this.clcqwar.atkside; // } // else // { // // 非进攻方帮派,防守方 // toj_sideid = this.clcqwar.defside; // } //} //else if (!ignore_clan && ("clan" in this.lvl_conf)) //{ // // 按帮派分阵营 // local clanid = clanmgr.get_pl_clanid(pl.cid); // local min_plycnt = 65536; // if (clanid in this.clanside) // { // toj_sideid = this.clanside[clanid]; // min_plycnt = this.sgplayersbyside[toj_sideid].len(); // } // else if (this.clansideid_ary.len() > 0) // { // toj_sideid = this.clansideid_ary.pop(); // this.clanside[clanid] < -toj_sideid; // min_plycnt = this.sgplayersbyside[toj_sideid].len(); // } // //sys.trace(sys.SLT_DETAIL, "toj_sideid["+toj_sideid+"] min_plycnt["+min_plycnt+"]\n"); // //// 在帮派中,搜索同一帮派队友信息 // //foreach(sideid, plys in this.sgplayersbyside) // //{ // // foreach(ply in plys) // // { // // if("clanid" in ply.pinfo && ply.pinfo.clanid == clanid) // // { // // toj_sideid = sideid; // // break; // // } // // } // // if(toj_sideid != 0) // // { // // break; // // } // //} // if (toj_sideid == 0) // { // // 按人数多寡分配 // foreach (sideid, plys in this.sgplayersbyside) // { // if (plys.len() < min_plycnt) // { // toj_sideid = sideid; // min_plycnt = plys.len(); // } // } // } // if (toj_sideid > 0 && min_plycnt <= 0) // { // // 没有人的阵营,新分配给加入角色所在帮派 // local clan_mgr = global_data_mgrs.clan; // clan_mgr.lock_data(clanid, server_const.GLOBAL_DATA_LOCK_TM); // 锁定数据对象,注意,所有跳出函数代码分支必须要有unlock // local clan_db_data = _get_clan_data(clanid); // if (clan_db_data.len() > 0) // { // // 目标帮派存在 // local clan_db_info = clan_db_data[0].get_data(); // local sideclan_info = { sideid = toj_sideid, clanlvl = clan_db_info.lvl, clname = clan_db_info.clname }; // this.sideclan[clanid] < -sideclan_info; // // 通知客户端新加入帮派 // // send lvl_side_info msg // this.broad_cast_msg(247, { sideclan =[sideclan_info]}); // } // clan_mgr.unlock_data(clanid); // 解锁 // } // } //else if (this.camp_side.len() > 0) //{ // // 按世界阵营分阵营 // if (pl.camp in this.camp_side) //{ // toj_sideid = this.camp_side[pl.camp]; // } //else //{ // sys.trace(sys.SLT_ERR, "lvl tpid[" + lvl_conf.tpid + "] add ply cid[" + pl.cid + "] camp[" + pl.camp + "] side not exist!\n"); // } //} //else //{ // if (!ignore_team) // { // local tid = team.get_ply_teamid(pl.cid); // if (tid != 0) // { // // 在队伍中,搜索同一队伍队友信息 // foreach (sideid, plys in this.sgplayersbyside) // { // foreach (ply in plys) // { // if ("teamid" in ply.pinfo && ply.pinfo.teamid == tid) // { // toj_sideid = sideid; // break; // } // } // if (toj_sideid != 0) // { // break; // } // } // } // } // if (toj_sideid == 0) // { // // 按人数多寡分配 // local min_plycnt = 65536; // foreach (sideid, plys in this.sgplayersbyside) // { // if (plys.len() < min_plycnt) // { // toj_sideid = sideid; // min_plycnt = plys.len(); // } // } // } //} } if (toj_sideid == 0) { Utility.trace_err("sg_level instance id [" + llid + "] tpid[" + lvl_conf.tpid + "] without side!\n"); return game_err_code.CONFIG_ERR; } this.sgplayerside_bycid[pl.cid] = toj_sideid; var toj_side_plys = this.sgplayersbyside[toj_sideid]; toj_side_plys[pl.cid] = player; pl.lvlsideid = toj_sideid; var side_conf = this.sides_conf[toj_sideid]; var born = side_conf.born; pl.map_id = born.mpid; pl.x = Utility.random_section(born.x, born.w); pl.y = Utility.random_section(born.y, born.h); // 发送自己阵营消息 //::send_rpc(pl.sid, 247, { lvlsideid = pl.lvlsideid}); } else { //::g_dump("======>>地图重生点:", born_map_conf ); //::g_dump("======>>pinfo:", pl ); pl.map_id = born_map_conf.mpid; pl.x = Utility.random_section(born_map_conf.x, born_map_conf.w); pl.y = Utility.random_section(born_map_conf.y, born_map_conf.h); } //sys.trace(sys.SLT_DETAIL, "pl.lmpid["+pl.lmpid+"]\n"); // 判断角色ghost状态 if (ghost_cnt > 0) { if (!this.ghost_players.ContainsKey(pl.cid)) { this.ghost_players[pl.cid] = ghost_cnt; } else { if (this.ghost_players[pl.cid] <= 0) { pl.ghost = true; } } } if (this.cur_round > 0 && this.cur_round != 1) { // 错过第一回合,进入即成为ghost this.ghost_players[pl.cid] = 0; pl.ghost = true; } if (this.rounds_conf.Count > 0) { if (!this.round_plys.ContainsKey(pl.cid)) { // 首次进入玩家,从第一回合开始 this.round_plys[pl.cid] = new round_player() { cid = pl.cid, rnd = 1 }; } } //if (this.kumiteply) //{ // local found = false; // foreach (kpl in this.kumiteply) // { // if (kpl.cid == pl.cid) // { // found = true; // break; // } // } // if (!found) // { // // 新加入角色,添加到车轮战队列中 // local kpl = { cid = pl.cid, name = pl.name, lvl = pl.level, stat = lvl_kumite_state.LKS_WAIT, pt = 0, combpt = pl.combpt }; // this.kumiteply.push(kpl); // // 广播车轮战队列变化消息 // // send lvl_side_info msg // this.broad_cast_msg(247, { kumiteply =[kpl]}); // // 车轮战除当前战斗角色之外所有角色都是ghost // this.ghost_players[pl.cid] < -0; // } // if (this.ghost_players[pl.cid] <= 0) // { // player.pinfo.ghost = true; // } //} // 判断dota地图 //if (this.dota) //{ // this.dota.plys[player.pinfo.cid] < -player; // player.pinfo.dota = { data ={ hero_tp = (player.pinfo.carr),level = 1,exp = 0,gld = 0}, conf = this.dota.conf}; // player.re_calc_cha_data(); //} //// 计算副本中帮派科技属性加成数据 //if (this.clanmon_aff) //{ // if (pl_clanid > 0) // { // if (!(pl_clanid in this.clanply_att_add)) // { // _calc_clantechply_att(pl_clanid); // } // player.pinfo.clanatt_eff = true; // player.pinfo.clanatts = this.clanply_att_add[pl_clanid]; // player.re_calc_cha_data(); // } //} player.ignore_team = this.ignore_team; player.ignore_clan = this.ignore_clan; if (enter_gp_map != null) { if (!enter_gp_map.maps.ContainsKey(pl.map_id)) { Utility.trace_err("sg_level instance id [" + llid + "] tpid[" + lvl_conf.tpid + "] without map[" + pl.map_id + "]!\n"); return game_err_code.LEVEL_MAP_NOT_IN_LEVEL; } enter_gp_map.maps[pl.map_id].add_player_to_map(this, sid, player); enter_gp_map.plys[pl.cid] = player; enter_gp_map.plycnt++; this.cid2gpid[pl.cid] = enter_gp_map.gpid; //sys.trace(sys.SLT_ERR, "enter_gp_map gpid ["+enter_gp_map.gpid+"] pl.cid[" + pl.cid +"] enter_gp_map.plycnt =["+enter_gp_map.plycnt+"]!\n"); } else { if (!this.maps.ContainsKey(pl.map_id)) { Utility.trace_err("sg_level instance id [" + llid + "] tpid[" + lvl_conf.tpid + "] without map[" + pl.map_id + "]!\n"); return game_err_code.LEVEL_MAP_NOT_IN_LEVEL; } this.maps[pl.map_id].add_player_to_map(this, sid, player); } sgplayers[sid] = player; sgplayersbycid[pl.cid] = player; if (!this.sid_ary.Contains(sid)) { this.sid_ary.Add(sid); } player.in_lvl = this; //if (this.tm_cost) //{ // local lvlentried = player.get_entried_lvl(lvl_conf.tpid); // local diff_lvl = 1; // if (lvlentried) diff_lvl = lvlentried.diff_lvl; // local info = { // stm = cur_tm_s, // last_calc_tm = cur_tm_s, // yb = 0, // gold = 0, // batpt = 0, // diff_lvl = diff_lvl, //}; // this.total_tm_cost[pl.cid] < -info; //} if (this.tm_out > 0) { var tmpinfo = new JoinInfo() { cid = pl.cid, sid = sid, mapid = pl.map_id, join_tm = cur_tm_s }; this.joininfo[pl.cid] = tmpinfo; } // 判断角色复活时间 //if (this.plyrespawn_tm > 0) //{ // if (pl.cid in this.plyrespawn_tms) //{ // local respawn_tm = this.plyrespawn_tms[pl.cid] - cur_tm_s; // if (respawn_tm > 0) // { // // 角色已死亡,尚不能复活 // player.allow_respawn_tm_s = respawn_tm; // // 角色死亡 // pl.hp = 0; // player.respawn_tm = sys.clock_time() + 30000; // 30 秒后安全复活 // pl.isdie = true; // // broad cast die msg // player.broad_cast_zone_msg_and_self(25, { iid = pl.iid}); // // send self_attchange msg // ::send_rpc(pl.sid, 32, { respawn_tms = respawn_tm}); // } // else // { // delete this.plyrespawn_tms[pl.cid]; // } // } //} // if ("enter_lvl" in this.lvl_conf ) //{ // local enter_lvl_conf = this.lvl_conf.enter_lvl[0]; // if ("addmis" in enter_lvl_conf ) // { // foreach (conf in enter_lvl_conf.addmis) // { // _acept_mis(pl.sid, conf, player, false, false); // } // } // if ("addstate" in enter_lvl_conf ) // { // local cur_clock_tm = sys.clock_time(); // local add_states = []; // foreach (stateconf in enter_lvl_conf.addstate) // { // if ("attchk" in stateconf ) // { // local matched = true; // foreach (attchk in stateconf.attchk) // { // if (game_err_code.RES_OK != player.check_att(attchk)) // { // matched = false; // break; // } // } // if (!matched) continue; // } // local can_add = true; // if ("side" in stateconf) // { //指定哪边可添加buff // can_add = false; // foreach (sideid in stateconf.side) // { // if (player.pinfo.lvlsideid == sideid) // { // can_add = true; // break; // } // } // } // if (!can_add) continue; // local state_obj = add_state_to_pl(cur_clock_tm, player, stateconf.state[0], null, 1000, false); // if (state_obj) // { // add_states.push(state_obj); // } // } // if (add_states.len() > 0) // { // _remark_pl_state(player, player.pinfo); // player.broad_cast_zone_msg_and_self(24, { iid = player.pinfo.iid, states = add_states}); // } // } // } // 统计数据 //stastic.add_lvl_ply(llid, sid); return game_err_code.RES_OK; }
public void gp_map_finish(group_map gp_map, long cur_tm_s) { if (gp_map.fin) { return; } gp_map.fin = true; gp_map.close_tm = cur_tm_s + 30; int score = 0; long cost_tm = cur_tm_s - this.start_tm; var win_plys = _get_gp_map_win_plys(gp_map, cur_tm_s); if (win_plys.Count > 0) { if (lvl_conf.score != null && lvl_conf.score.Count > 0) { // 计算得分 foreach (var score_conf in lvl_conf.score) { if (score_conf.tm >= cost_tm && score_conf.score > score) { score = score_conf.score; } } //sys.trace(sys.SLT_DETAIL, "score ["+score+"] upscore["+lvl_conf.upscore+"]\n"); //if(score >= lvl_conf.upscore) //{ // 更新角色关卡得分并升级 //} } } else { } }
public game_err_code _create_group_map(group_map gp_map) { foreach (var mapconf in lvl_conf.level_map) { var map = new grid_map(mapconf.id); //sys.trace(sys.SLT_SYS, "sg_level instance id ["+llid+"] create map[" + lvl_conf.mapid +"]\n"); if (map == null) { Utility.trace_err("sg_level instance id [" + llid + "create gpmap[" + gp_map.gpid + "] create map[" + mapconf.id + "] failed!\n"); return game_err_code.LEVEL_CREATE_MAP_ERROR; } map.worldsvr = this; map.blvlmap = true; //map.init(mapconf.id); gp_map.maps[mapconf.id] = map; // if ("trigger" in mapconf) //{ // map.init_trigger(mapconf.trigger, sys.time() - this.start_tm); // } // if ("path" in mapconf) //{ // map.init_path(mapconf.path); // } // if ("immrespawn" in mapconf ) //{ // map.immrespawn = mapconf.immrespawn == 1; // } // if (("ignore_side" in mapconf) ) //{ // map.ignore_side = mapconf.ignore_side == 1; // } } //sys.trace(sys.SLT_DETAIL, "this.diff_lvl ["+this.diff_lvl+"]\n"); var diff_fin_check = false; var diff_lvl_conf = this.lvl_conf.get_diff_lvl_conf(this.diff_lvl); if (diff_lvl_conf != null) { // 根据diff_lvl等级初始化额外增加的数据,如新增怪物等 // 地图追加配置 if (diff_lvl_conf.level_map.Count > 0) { foreach (var mapconf in diff_lvl_conf.level_map) { if (!gp_map.maps.ContainsKey(mapconf.id)) continue; var map = gp_map.maps[mapconf.id]; map.add_init(mapconf.map_mon, Utility.time() - this.start_tm); } } // 增加地图怪物等级 // if ("mon_lvl_add" in diff_lvl_conf && diff_lvl_conf.mon_lvl_add > 0) //{ // foreach (map in gp_map.maps) // { // foreach (mon in map.map_mons) // { // mon.setlevel(mon.mondata.level + diff_lvl_conf.mon_lvl_add); // } // } // } if (diff_lvl_conf.fin_check != null) { diff_fin_check = true; if (diff_lvl_conf.fin_check.km.Count > 0) { foreach (var km in diff_lvl_conf.fin_check.km) { gp_map.kmfin[km.mid] = new kmfin() { cntleft = km.cnt }; } } if (diff_lvl_conf.fin_check.tm > 0) { gp_map.tmfin = true; } } } if (lvl_conf.fin_check != null) { if (lvl_conf.fin_check.km.Count > 0) { foreach (var km in lvl_conf.fin_check.km) { gp_map.kmfin[km.mid] = new kmfin() { cntleft = km.cnt }; } } if (lvl_conf.fin_check.tm > 0) { gp_map.tmfin = true; } } return game_err_code.RES_OK; }
public Dictionary<int, IBaseUnit> _get_gp_map_win_plys(group_map gp_map, long cur_tm_s) { Dictionary<int, IBaseUnit> win_plys = new Dictionary<int, IBaseUnit>(); if (this.death_pts != null) { // 混战积分模式 // 按积分排序 List<Death_Pt> ply_ary = new List<Death_Pt>(); foreach (var val in this.death_pts.Values) { if (!gp_map.plys.ContainsKey(val.cid)) continue; int idx = 0; for (; idx < ply_ary.Count; ++idx) { if (val.pt >= ply_ary[idx].pt) { break; } } ply_ary.Insert(idx, val); } int i = 0; for (; i < ply_ary.Count && i < this.death_ptconf.wincnt; ++i) { var cid = ply_ary[i].cid; win_plys[cid] = gp_map.plys[cid]; } } else if (gp_map.win >= 0) { if (death_match) { // 死亡模式 if (this.sgplayersbyside.Count > 0 && gp_map.win > 0) { // 分阵营情况下,this.win为胜利方阵营id var win_side_players = this.sgplayersbyside[gp_map.win]; foreach (var ply in win_side_players.Values) { int cid = ply.get_pack_data().cid; if (gp_map.plys.ContainsKey(cid)) { win_plys[cid] = ply; } } } else { // 混战情况下this.win为胜利者角色id if (gp_map.plys.ContainsKey(gp_map.win)) { win_plys[gp_map.win] = gp_map.plys[gp_map.win]; } } } //else if (this.kumiteply) //{ // // 车轮战模式,胜利者角色id // if (gp_map.win in gp_map.plys) //{ // win_plys[gp_map.win] < -gp_map.plys[gp_map.win]; // } //} else { win_plys = gp_map.plys; if (gp_map.win > 0) { // 胜利者有阵营 var win_side_players = this.sgplayersbyside[gp_map.win]; foreach (var ply in win_side_players.Values) { int cid = ply.get_pack_data().cid; if (gp_map.plys.ContainsKey(cid)) { win_plys[cid] = ply; } } } } } return win_plys; }
public void gp_map_close(group_map gp_map) { if (gp_map.closed) return; gp_map.closed = true; List<IBaseUnit> to_remove_ply = new List<IBaseUnit>(); foreach (var ply in gp_map.plys.Values) { to_remove_ply.push(ply); } foreach (var ply in to_remove_ply) { this.remove_player(ply.get_pack_data().sid, false); Level.enter_world(ply.get_pack_data().sid, ply.get_pack_data().line); } foreach (var val in gp_map.maps.Values) { val.fin(); } // fin lvl bool all_gm_closed = true; foreach (var gx in this.gp_maps) { if (!gx.closed) { all_gm_closed = false; break; } } if (all_gm_closed) { this.fin(); } }
public game_err_code init(int llid) { //::g_debug( "====>>> on sg_level init(), llid:" + llid ); //this.service = s; Level_Info linfo = Level.get_lvl_info(llid); //::g_dump( "====>>> 副本信息:", linfo ); if (linfo == null) { this.fin(); Utility.trace_err("lvl init err on linfo is null!"); return game_err_code.INTERNAL_ERR; } ltpid = linfo.ltpid; this.diff_lvl = linfo.diff_lvl; this.creator = linfo.creator; this.lvl_conf = Utility.get_level_conf(ltpid); if (lvl_conf == null) { this.fin(); Utility.trace_err("lvl init err on lvl_conf is null!"); return game_err_code.CONFIG_ERR; } //this.is_score_km = (_get_score_conf("score_awd_km") != null); var diff_lvl_conf = lvl_conf.get_diff_lvl_conf(linfo.diff_lvl); if (null == diff_lvl_conf) { this.fin(); Utility.trace_err("lvl init err on lvl_conf.diff_lvl is null!"); return game_err_code.CONFIG_ERR; } long cur_tm_s = DateTime.Now.ToBinary(); this.start_tm = cur_tm_s; if (this.lvl_conf.lctp == (int)level_checkin_type.LCT_AUTO_CREATE) { // if ("tmchk" in this.lvl_conf ) //{//计算准确开服时间 // local today_near_opntm = get_curr_open_tm(cur_tm_s, this.lvl_conf.tmchk); // if (today_near_opntm != 0) // { // this.start_tm = today_near_opntm; // } // } } this.end_tm = this.start_tm + lvl_conf.tm * 60; if (diff_lvl_conf.born != null) { born_map_conf = diff_lvl_conf.born;//只有 idx=0 的配置生效 } //::g_debug( "====>>副本 ltpid:" + ltpid ); //::g_debug( "====>>副本 diff_lvl:" + linfo.diff_lvl ); //::g_dump( "====>>副本 diff_lvl_conf:", diff_lvl_conf ); //::g_dump( "====>>副本 born_map_conf 初始化出生点:", born_map_conf ); foreach (var mapconf in lvl_conf.level_map) { grid_map map = new grid_map(mapconf.id); //sys.trace(sys.SLT_SYS, "sg_level instance id ["+llid+"] create map[" + lvl_conf.mapid +"]\n"); if (map == null) { Utility.trace_err("sg_level instance id [" + llid + "] create map[" + mapconf.id + "] failed!\n"); this.fin(); return game_err_code.LEVEL_CREATE_MAP_ERROR; } map.worldsvr = this; map.blvlmap = true; //map.init(mapconf.id); this.maps[mapconf.id] = map; if (born_map_conf == null && mapconf.born != null) { var binfo = mapconf.born; born_map_conf = binfo; //::g_dump( "====>>副本 默认 born:", born_map_conf ); } // if ("trigger" in mapconf) //{ // //sys.trace( sys.SLT_DETAIL, "cur_tm_s-this.start_tm=" + cur_tm_s-this.start_tm + "\n"); // map.init_trigger(mapconf.trigger, cur_tm_s - this.start_tm); // } // if ("path" in mapconf) //{ // map.init_path(mapconf.path); // } // if ("skill" in mapconf) //{ // map.add_map_skills(mapconf.skill); // } // if ("immrespawn" in mapconf ) //{ // map.immrespawn = mapconf.immrespawn == 1; // } // if (("ignore_side" in mapconf) ) //{ // map.ignore_side = mapconf.ignore_side == 1; // } //} //sys.trace(sys.SLT_DETAIL, "this.diff_lvl ["+this.diff_lvl+"]\n"); } bool diff_fin_check = false; if (diff_lvl_conf != null) { // 根据diff_lvl等级初始化额外增加的数据,如新增怪物等 if (diff_lvl_conf.level_map.Count > 0) { // 地图追加配置 foreach (var map in diff_lvl_conf.level_map) { if (this.maps.ContainsKey(map.id)) continue; this.maps[map.id].add_init(map.map_mon, Utility.time() - this.start_tm); } } // 增加地图怪物等级 // if ("mon_lvl_add" in diff_lvl_conf && diff_lvl_conf.mon_lvl_add > 0) //{ // foreach (map in this.maps) // { // foreach (mon in map.map_mons) // { // mon.setlevel(mon.mondata.level + diff_lvl_conf.mon_lvl_add); // } // } // } if (diff_lvl_conf.fin_check != null) { diff_fin_check = true; if (diff_lvl_conf.fin_check.km.Count > 0) { foreach (var km in diff_lvl_conf.fin_check.km) { this.kmfin[km.mid] = new kmfin() { cntleft = km.cnt }; } } if (diff_lvl_conf.fin_check.tm > 0) this.tmfin = true; } } if (born_map_conf == null) { Utility.trace_err("sg_level instance id [" + llid + "] tpid[" + lvl_conf.tpid + "] without born map!\n"); this.fin(); return game_err_code.LEVEL_CREATE_NO_BORN_MAP; } if (!diff_fin_check && lvl_conf.fin_check != null) { if (lvl_conf.fin_check.km.Count > 0) { foreach (var km in lvl_conf.fin_check.km) { this.kmfin[km.mid] = new kmfin() { cntleft = km.cnt }; } } if (lvl_conf.fin_check.tm > 0) this.tmfin = true; } if (lvl_conf.gpmap_maxply > 0) { if (this.lvl_conf.gpmap_maxply < this.lvl_conf.maxply) { this.gpmap_maxply = this.lvl_conf.gpmap_maxply; this.gp_maps = new List<SceneTest.group_map>(); this.cid2gpid = new Dictionary<int, int>(); group_map group_map = new group_map() { gpid = 1, maps = this.maps, kmfin = this.kmfin, tmfin = this.tmfin }; gp_maps.Add(group_map); } } this.llid = llid; // if (("no_kp_hexp" in this.lvl_conf) && (this.lvl_conf.no_kp_hexp == 1)) //{ // no_kp_hexp = true; // } var pvp = lvl_conf.pvp; if (pvp != null) { if (pvp.ignore_clan > 0) this.ignore_clan = true; if (pvp.ignore_team > 0) this.ignore_team = true; if (pvp.plyside > 0) this.plyside = pvp.plyside; if (pvp.round != null) { // 有多个回合的pvp副本,初始化回合 foreach (var round in pvp.round) { this.rounds_conf[round.id] = round; } this.cur_round = 1; if (!this.rounds_conf.ContainsKey(this.cur_round)) { Utility.trace_err("sg_level instance id [" + llid + "] tpid[" + lvl_conf.tpid + "] pvp round without round 1!\n"); return game_err_code.CONFIG_ERR; } var res = _init_pvp(this.rounds_conf[this.cur_round], cur_tm_s); // 初始化第一回合配置 if (res != game_err_code.RES_OK) { return res; } this.round_tm = cur_tm_s + (this.rounds_conf[this.cur_round].tm * 60); } else { var res = _init_pvp(pvp, cur_tm_s); if (res != game_err_code.RES_OK) { return res; } } } // if ("dota" in lvl_conf) //{ // // 增加dota类的战场配置解析功能,初始化dota类战场数据 // local dota_conf = get_dota_conf(lvl_conf.dota); // if (!dota_conf) // { // Utility.trace_err("invalid dota_conf[" + lvl_conf.dota + "]\n"); // } // else // { // this.dota = { plys ={ }, conf = dota_conf}; // } // } //if (this.clanmon_aff) //{ // // 帮派怪物加成 // foreach (map in this.maps) // { // foreach (mon in map.map_mons) // { // if (mon.mondata.lvlsideid != this.clanmon_att_add.sideid) // { // continue; // } // if (!("clanmon" in mon.monconf)) // { // continue; // } // if (!(mon.monconf.clanmon in this.clanmon_att_add.atts)) // { // continue; // } // mon.setclanatts(this.clanmon_att_add.atts[mon.monconf.clanmon]); // } // } //} if (lvl_conf.rmv_leave_ply == 1) this.rmv_leave_ply = true; // if ("cltid" in lvl_conf) //{ // this.clter_conf = get_clantrit_conf(lvl_conf.cltid); // } if (lvl_conf.plyrespawn_tm > 0) { this.plyrespawn_tm = lvl_conf.plyrespawn_tm; //this.plyrespawn_tms = { }; } if (lvl_conf.immrespawn == 1) { this.immrespawn = true; } // if ("team_exdrop" in lvl_conf) //{ // this.team_exdrop = lvl_conf.team_exdrop; // } // if ("tm_cost" in lvl_conf ) //{ // this.tm_cost = true; // total_tm_cost = { }; // } if (lvl_conf.tm_out > 0) { this.tm_out = lvl_conf.tm_out; this.joininfo = new Dictionary<int, JoinInfo>(); } var diffs = lvl_conf.diff_lvl; //foreach (var dx in lvl_conf.diff_lvl) //{ // local map_km = { }; // foreach (map in diff_lvl.map) // { // if ("dir_enter" in map) // { // local dir_enter = map.dir_enter[0]; // if ("km" in dir_enter) // { // local km = dir_enter.km[0]; // map_km[map.id] < - { mid = km.mid, mapid = km.mapid}; // } // } // } // map_need_km[diff_lvl.lv] < -map_km; //} // if ("trig_finchk" in lvl_conf ) //{ // this.active_finchk = false; // } this.state = level_state_type.LST_PROCEED; Level.set_lvl_end_tm(llid, end_tm); this.sid_ary = new HashSet<int>(); return game_err_code.RES_OK; }