public PveInfo[] GetAllPveInfos() { List<PveInfo> infos = new List<PveInfo>(); SqlDataReader reader = null; try { db.GetReader(ref reader, "SP_PveInfos_All"); while (reader.Read()) { PveInfo info = new PveInfo { ID = (int)reader["Id"], Name = (reader["Name"] == null) ? "" : reader["Name"].ToString(), Type = (int)reader["Type"], LevelLimits = (int)reader["LevelLimits"], SimpleTemplateIds = (reader["SimpleTemplateIds"] == null) ? "" : reader["SimpleTemplateIds"].ToString(), NormalTemplateIds = (reader["NormalTemplateIds"] == null) ? "" : reader["NormalTemplateIds"].ToString(), HardTemplateIds = (reader["HardTemplateIds"] == null) ? "" : reader["HardTemplateIds"].ToString(), TerrorTemplateIds = (reader["TerrorTemplateIds"] == null) ? "" : reader["TerrorTemplateIds"].ToString(), Pic = (reader["Pic"] == null) ? "" : reader["Pic"].ToString(), Description = (reader["Description"] == null) ? "" : reader["Description"].ToString(), Ordering = (int)reader["Ordering"], AdviceTips = (reader["AdviceTips"] == null) ? "" : reader["AdviceTips"].ToString(), SimpleGameScript = reader["SimpleGameScript"] as string, NormalGameScript = reader["NormalGameScript"] as string, HardGameScript = reader["HardGameScript"] as string, TerrorGameScript = reader["TerrorGameScript"] as string }; infos.Add(info); } } catch (Exception e) { if (log.IsErrorEnabled) log.Error("GetAllMap", e); } finally { if (reader != null && !reader.IsClosed) reader.Close(); } return infos.ToArray(); }
public PVEGame(int id, int roomId, PveInfo info, List<IGamePlayer> players, Map map, eRoomType roomType, eGameType gameType, int timeType, eHardLevel hardLevel) : base(id, roomId, map, roomType, gameType, timeType) { PlayersXY = new List<Point>(); foreach (IGamePlayer player in players) { Player fp = new Player(player, PhysicalId++, this, 1); //fp.Reset(); fp.Direction = m_random.Next(0, 1) == 0 ? 1 : -1; AddPlayer(player, fp); } m_info = info; BeginPlayersCount = players.Count; TotalKillCount = 0; TotalNpcGrade = 0; TotalNpcExperience = 0; TotalHurt = 0; m_IsBossType = ""; WantTryAgain = 0; SessionId = 0; m_gameOverResources = new List<string>(); Misssions = new Dictionary<int, MissionInfo>(); m_mapHistoryIds = new List<int>(); m_hardLevel = hardLevel; string script = GetScript(info, hardLevel); m_gameAI = ScriptMgr.CreateInstance(script) as APVEGameControl; if (m_gameAI == null) { log.ErrorFormat("Can't create game ai :{0}", script); m_gameAI = SimplePVEGameControl.Simple; } m_gameAI.Game = this; m_gameAI.OnCreated(); m_missionAI = SimpleMissionControl.Simple; beginTime = DateTime.Now; m_bossCardCount = 0; }
public PveInfo[] GetAllPveInfos() { List<PveInfo> infos = new List<PveInfo>(); SqlDataReader reader = null; try { db.GetReader(ref reader, "SP_PveInfos_All"); while (reader.Read()) { PveInfo info = new PveInfo(); info.ID = (int)reader["Id"]; info.Name = reader["Name"] == null ? "" : reader["Name"].ToString(); info.Type = (int)reader["Type"]; info.LevelLimits = (int)reader["LevelLimits"]; info.SimpleTemplateIds = reader["SimpleTemplateIds"] == null ? "" : reader["SimpleTemplateIds"].ToString(); info.NormalTemplateIds = reader["NormalTemplateIds"] == null ? "" : reader["NormalTemplateIds"].ToString(); info.HardTemplateIds = reader["HardTemplateIds"] == null ? "" : reader["HardTemplateIds"].ToString(); info.TerrorTemplateIds = reader["TerrorTemplateIds"] == null ? "" : reader["TerrorTemplateIds"].ToString(); info.Pic = reader["Pic"] == null ? "" : reader["Pic"].ToString(); info.Description = reader["Description"] == null ? "" : reader["Description"].ToString(); info.SimpleGameScript = reader["SimpleGameScript"] as string; info.NormalGameScript = reader["NormalGameScript"] as string; info.HardGameScript = reader["HardGameScript"] as string; info.TerrorGameScript = reader["TerrorGameScript"] as string; infos.Add(info); } } catch (Exception e) { if (log.IsErrorEnabled) log.Error("GetAllMap", e); } finally { if (reader != null && !reader.IsClosed) reader.Close(); } return infos.ToArray(); }
public static XElement CreatePveInfo(PveInfo m) { return new XElement("Item", new XAttribute("ID", m.ID), new XAttribute("Name", m.Name == null ? "" : m.Name), new XAttribute("Type", m.Type), new XAttribute("LevelLimits", m.LevelLimits), //LevelLimits="14" new XAttribute("SimpleTemplateIds", m.SimpleTemplateIds == null ? "" : m.SimpleTemplateIds), new XAttribute("NormalTemplateIds", m.NormalTemplateIds == null ? "" : m.NormalTemplateIds), new XAttribute("HardTemplateIds", m.HardTemplateIds == null ? "" : m.HardTemplateIds), new XAttribute("TerrorTemplateIds", m.TerrorTemplateIds == null ? "" : m.TerrorTemplateIds), new XAttribute("Pic", m.Pic == null ? "" : m.Pic), new XAttribute("Description", m.Description == null ? "" : m.Description), new XAttribute("Ordering", m.Ordering), new XAttribute("AdviceTips", m.AdviceTips == null ? "" : m.AdviceTips)); //Ordering="3" //AdviceTips="14-16|16-18|18-23|23" /> }
private string GetScript(PveInfo pveInfo, eHardLevel hardLevel) { string script = string.Empty; switch (hardLevel) { case eHardLevel.Simple: script = pveInfo.SimpleGameScript; break; case eHardLevel.Normal: script = pveInfo.NormalGameScript; break; case eHardLevel.Hard: script = pveInfo.HardGameScript; break; case eHardLevel.Terror: script = pveInfo.TerrorGameScript; break; default: script = pveInfo.SimpleGameScript; break; } return script; }