public void Init(MapStageDifficulty info) { StageInfo = info; MapCreatureInfo creature = StageInfo.Waves[0].Creatures.Find(c => c.CreatureType == eMapCreatureType.Boss); short level = CalculateLevel(creature.Level, StageInfo); m_LevelText.text = level.ToString(); m_ProfileImage.spriteName = string.Format("profile_{0}", creature.CreatureInfo.ID); m_Condition = StageInfo.CheckCondition; bool is_lock = m_Condition != null; m_Level.gameObject.SetActive(!is_lock); m_Lock.gameObject.SetActive(is_lock); m_ToggleAvailable.SetSpriteActive(!is_lock); foreach (UISprite sprite in m_DisableSprite) { if (is_lock) { sprite.color = m_DisableColor; } else { sprite.color = Color.white; } } gameObject.SetActive(true); }
public override void PostDeSpawn() { base.PostDeSpawn(); IncidentDef incidentDef = DefDatabase <IncidentDef> .GetNamed("SolarFlare"); MapConditionDef mapConditionDef = DefDatabase <MapConditionDef> .GetNamed("SolarFlare"); if (incidentDef.mapCondition != mapConditionDef) { incidentDef.mapCondition = mapConditionDef; DefDatabase <IncidentDef> .ResolveAllReferences(); Log.Message("RT_SolarFlareShield: restored MapCondition for SolarFlare."); } MapCondition mapCondition = Find.MapConditionManager.GetActiveCondition( DefDatabase <MapConditionDef> .GetNamed("MapCondition_RTSolarFlare")); if (mapCondition != null) { int ticksToExpire = mapCondition.TicksLeft; mapCondition.duration = mapCondition.TicksPassed - 1; Find.MapConditionManager.RegisterCondition(MapConditionMaker.MakeCondition( MapConditionDefOf.SolarFlare, ticksToExpire)); } }
public string GetNextStoryBoard() { string s = ""; if (OpenedMap != null) { if (OpenedMap.EndIndex >= state) { if (state > Count - 1) { return(s); } FirstEngaged = false; if (Storyboard.GetKey(state).Name == "RelationTrigger") { RelationTrigger rt = (RelationTrigger)Storyboard.GetKey(state); rt.Activate(); return(""); } return(String.Format("{0} - {1}", Storyboard.GetKey(state).Name, Storyboard.GetValue(state))); } else { int index = Conditions.FindIndex(y => y == OpenedMap); OpenedMap = null; state = 0; Conditions[index].Exists = false; Engaged = false; } } return(s); }
public ActionResult Index(MapCondition condition) { var entitys = mapService.Search(condition); var models = new PagedList <MapModel>(entitys.Select(n => n.ToModel()), entitys.Paging); return(View(PluginHelper.GetViewPath(this.GetType(), "Index"), models)); }
public IPagedList <CPMD.Map> Search(MapCondition condition) { var query = repository.TableNoTracking; query = query.Where(t => t.IsDelete == false); query = query.OrderByDescending(t => t.CreateDate); return(new PagedList <CPMD.Map>(query, condition.PageIndex, condition.PageSize)); }
private void FireVisit() { var visitConditionDef = DefDatabase <MapConditionDef> .GetNamed("MTW_AncestralVisit"); MapCondition cond = MapConditionMaker.MakeCondition(visitConditionDef, this.DurationTicks, 0); Find.MapConditionManager.RegisterCondition(cond); }
override public void Init() { m_Info = MapInfoManager.Instance.GetInfoByID(m_MapID); string leftTryCount = Localization.Format("TryCount", (m_Info.TryLimit - MapClearDataManager.Instance.GetMapDailyClearCount(m_Info.IDN, PacketEnums.pe_Difficulty.Normal)), m_Info.TryLimit); m_Title.text = string.Format("{0}({1})", m_Info.Name, leftTryCount); m_Desc.text = m_Info.Description; m_Condition = m_Info.CheckCondition(); m_Toggle.value = m_Condition != null; int clear_rate = MapClearDataManager.Instance.GetTotalClearRate(m_Info.IDN, PacketEnums.pe_Difficulty.Normal); m_Nofity.SetActive(m_Toggle.value == false && clear_rate == 0); if (m_Toggle.value == false) { pd_EventHottime event_info = null; switch (m_Info.ID) { case "1001_event_gold": event_info = EventHottimeManager.Instance.GetInfoByID("training_gold_reward_2x"); break; case "1002_event_exp": event_info = EventHottimeManager.Instance.GetInfoByID("training_exp_reward_2x"); break; //case "1003_event_equip_enchant": // event_info = EventHottimeManager.Instance.GetInfoByID("training_stuff_reward_2x"); // break; //case "1004_event_equip_evolve": // event_info = EventHottimeManager.Instance.GetInfoByID("training_recipe_reward_2x"); // break; case "1005_event_rune": event_info = EventHottimeManager.Instance.GetInfoByID("training_rune_reward_2x"); break; case "1006_event_creature": event_info = EventHottimeManager.Instance.GetInfoByID("training_creature_reward_2x"); break; case "1007_event_tower": break; } m_Event.SetActive(event_info != null); } else { m_Event.SetActive(false); } }
bool CheckCondition() { if (m_StageInfo.Condition != null) { MapCondition condition = m_StageInfo.Condition.CheckCondition(); if (condition != null) { Tooltip.Instance.ShowMessage(condition.Condition); return(false); } } return(true); }
public override void Generate(Map map) { if (map.Biome != Util_CaveBiome.CaveBiomeDef) { // Nothing to do in other biomes. return; } // To avoid starting with standard Clear weather, immediately force to reselect a cave biome weather. map.weatherDecider.StartNextWeather(); MapCondition condition = MapConditionMaker.MakeConditionPermanent(Util_CaveBiome.CaveEnvironmentMapConditionDef); map.mapConditionManager.RegisterCondition(condition); }
public bool AvailableMap(string map_id, pe_Difficulty difficulty = pe_Difficulty.Normal) { MapInfo map_info = MapInfoManager.Instance.GetInfoByID(map_id); if (map_info != null) { MapCondition condition = map_info.CheckCondition(difficulty); if (condition == null) { return(true); } } return(false); }
public override void Generate() { Log.Message("GenStep_CaveInitializeWeather.Generate"); if (Find.Map.Biome != Util_CaveBiome.CaveBiomeDef) { // Nothing to do in other biomes. return; } // To avoid starting with standard Clear weather, immediately force to reselect a cave biome weather. Find.Storyteller.weatherDecider.StartNextWeather(); MapCondition condition = MapConditionMaker.MakeConditionPermanent(Util_CaveBiome.CaveEnvironmentMapConditionDef); Find.MapConditionManager.RegisterCondition(condition); }
override public void Load(XmlNode node) { base.Load(node); Name = node.Attributes["name"].Value; XmlAttribute descAttr = node.Attributes["description"]; if (descAttr != null) { Description = descAttr.Value; } else { Description = ""; } Period = int.Parse(node.Attributes["period"].Value); NeedCreature = int.Parse(node.Attributes["need_creature"].Value); MinGrade = int.Parse(node.Attributes["min_grade"].Value); Conditions = new MapCondition[5]; foreach (XmlNode condition_node in node.SelectNodes("Condition")) { MapCondition condition = new MapCondition(condition_node); Conditions[(int)condition.difficulty] = condition; condition.ContentsOpen = new ContentsOpenInfo(); condition.ContentsOpen.icon_id = "mapicon_" + ID; condition.ContentsOpen.title = Localization.Get("OpenContentsDungeonMain"); //condition.ContentsOpen.message = GetShowName(condition.difficulty); } AvailableTags = new List <string>(); XmlAttribute available_tag_attr = node.Attributes["available_tag"]; if (available_tag_attr != null) { string tags = available_tag_attr.Value; Array.ForEach(tags.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries), tag => AvailableTags.Add(tag)); } DropInfo = new List <RewardLootInfo>(); foreach (XmlNode LootNode in node.SelectNodes("Loot")) { DropInfo.Add(new RewardLootInfo(LootNode, pe_Difficulty.Normal)); } }
private void SolarFlareShieldTick(int tickAmount) { if ((Find.TickManager.TicksGame) % tickAmount == 0) { MapCondition mapCondition = Find.MapConditionManager.GetActiveCondition( DefDatabase <MapConditionDef> .GetNamed("MapCondition_RTSolarFlare")); CompPowerTrader compPowerTrader = parent.TryGetComp <CompPowerTrader>(); if (compPowerTrader != null && compPowerTrader.PowerOn) { if (mapCondition != null) { compPowerTrader.PowerOutput = -shieldingPowerDrain; rotatorAngle += rotatorSpeedActive * tickAmount; Room room = parent.GetRoom(); if (room != null && !room.UsesOutdoorTemperature) { room.Temperature += heatingPerTick; } List <Building_CommsConsole> commsConsoles = Find.ListerBuildings.AllBuildingsColonistOfClass <Building_CommsConsole>().ToList(); foreach (Building_CommsConsole commsConsole in commsConsoles) { CompPowerTrader consoleCompPowerTrader = commsConsole.TryGetComp <CompPowerTrader>(); if (consoleCompPowerTrader != null) { consoleCompPowerTrader.PowerOn = false; } } } else { compPowerTrader.PowerOutput = -parent.def .GetCompProperties <CompProperties_Power>().basePowerConsumption; rotatorAngle += rotatorSpeedIdle * tickAmount; } } else if (mapCondition != null) { int ticksToExpire = mapCondition.TicksLeft; mapCondition.duration = mapCondition.TicksPassed - 1; Find.MapConditionManager.RegisterCondition(MapConditionMaker.MakeCondition( MapConditionDefOf.SolarFlare, ticksToExpire)); } } }
public void AutoEngage() { Engaged = false; if (OpenedMap != null) { return; } foreach (MapCondition item in Conditions) { Player player = (Player)p; if (item.ConditionMet(player.LocX, player.LocY) && item.Exists) { state = item.StartIndex; OpenedMap = item; Engaged = true; FirstEngaged = true; } } }
public Story ReadFromFile(string file) { Story s = new Story(); StreamReader sr = new StreamReader(file); s.p = p; while (!sr.EndOfStream) { string line = sr.ReadLine(); if (line.Trim() == "" || line == null) { continue; } else if (IsEnemy(line)) { string[] data = GetDataFromRow(line, "enemy"); Enemy e = new Enemy(data[0], int.Parse(data[1]), int.Parse(data[2]), bool.Parse(data[3]), int.Parse(data[4]), int.Parse(data[5]), double.Parse(data[6])); s.AddEnemy(e); } else if (IsCharacter(line)) { string[] data = GetDataFromRow(line, "character"); Character n = new Character(data[0], data[1] == "M" ? Gender.MALE : data[1] == "F" ? Gender.FEMALE : Gender.OTHER); s.AddNPC(n); } else if (IsMapCondition(line)) { string[] data = GetConditonData(line); if (HasNoEntity(data)) { bool bracket = true; int startIndex = s.Count; int count = 0; Narrator n = null; Narrator v = s.narrator; MapCondition mc = null; if (s.narrator.LocX > 0) { n = new Narrator(); n.LocX = int.Parse(data[0]); n.LocY = int.Parse(data[1]); } else { v.LocX = int.Parse(data[0]); v.LocY = int.Parse(data[1]); } while (bracket) { string read = sr.ReadLine(); if (read == "map_cond_end") { bracket = false; } else { string[] story = read.Split('-'); if (story[0] == "player") { s.AddStoryBoard(s.p, story[1]); count++; } else if (story[0] == "narr") { s.AddStoryBoard(s.narrator, story[1]); count++; } } } mc = new MapCondition(n ?? v, startIndex, startIndex + count - 1); s.AddMapCondition(mc); } else { string[] charac = data[0].Split(':'); Enemy e = null; Enemy x = null; Character n = null; Character p = null; int lever = -1; if (charac[0] == "enemy") { lever = 0; e = s.GetEnemyByName(charac[1]); if (e.LocX != 0) { x = (Enemy)e.Clone(); x.LocX = int.Parse(data[1]); x.LocY = int.Parse(data[2]); } else { e.LocX = int.Parse(data[1]); e.LocY = int.Parse(data[2]); } } else if (charac[0] == "character") { lever = 1; n = s.GetNpcByName(charac[1]); if (n.LocX != 0) { p = (Character)n.Clone(); p.LocX = int.Parse(data[1]); p.LocY = int.Parse(data[2]); } else { n.LocX = int.Parse(data[1]); n.LocY = int.Parse(data[2]); } } int startIndex = s.Count; bool bracket = true; int count = 0; while (bracket) { string read = sr.ReadLine(); if (read == "map_cond_end") { bracket = false; } else if (read == "engage_battle()") { Battle b = new Battle((Player)s.p, x ?? e); s.AddStoryBoard(b, "Battle"); } else if (read.Contains("relate")) { string cutted = read.Replace("relate", ""); cutted = cutted.Replace("(", ""); cutted = cutted.Replace(")", ""); cutted = cutted.Trim(); string[] data_rel = cutted.Split(','); RelationTrigger rt = new RelationTrigger (data_rel[0] == "F" ? RelationType.FRIENDSHIP : RelationType.ROMANCE, int.Parse(data_rel[1]), n); s.AddStoryBoard(rt, ""); count++; } else { string[] story = read.Split('-'); if (story[0] == "player") { Regex t = new Regex("%[target]*%"); if (t.IsMatch(story[1])) { switch (lever) { case 0: ITalk target = x ?? e; story[1] = Regex.Replace(story[1], "%[target]*%", target.Name); break; case 1: ITalk target2 = p ?? n; story[1] = Regex.Replace(story[1], "%[target]*%", target2.Name); break; } } s.AddStoryBoard(s.p, story[1]); count++; } else if (story[0] == "target") { s.AddStoryBoard(p ?? n, story[1]); count++; } else { s.AddStoryBoard(x ?? e, story[1]); count++; } } } MapCondition mc = null; switch (lever) { case 0: mc = new MapCondition(x ?? e, startIndex, startIndex + count - 1); s.AddMapCondition(mc); break; case 1: mc = new MapCondition(p ?? n, startIndex, startIndex + count - 1); s.AddMapCondition(mc); break; } } } } sr.Close(); s.FormatText(); return(s); }
public void AddMapCondition(MapCondition mc) { Conditions.Add(mc); }
public MapStageInfo(MapInfo mapInfo, XmlNode node) { MapInfo = mapInfo; ID = node.Attributes["id"].Value; var bg_id_attr = node.Attributes["bg_id"]; if (bg_id_attr != null) { BG_ID = bg_id_attr.Value; } else { BG_ID = MapInfo.BG_ID; } if (MapInfo.MapType != "weekly") { Name = node.Attributes["name"].Value; Description = node.Attributes["description"].Value.Replace("\\n", "\n"); Vector3 map_pos = new Vector3(); map_pos.x = float.Parse(node.Attributes["map_x"].Value); map_pos.y = float.Parse(node.Attributes["map_y"].Value); MapPos = map_pos; } var stage_type_attr = node.Attributes["stage_type"]; if (stage_type_attr != null) { StageType = (eStageType)Enum.Parse(typeof(eStageType), stage_type_attr.Value); } Conditions = new MapCondition[5]; foreach (XmlNode condition_node in node.SelectNodes("Condition")) { MapCondition condition = new MapCondition(condition_node); Conditions[(int)condition.difficulty] = condition; condition.ContentsOpen = new ContentsOpenInfo(); condition.ContentsOpen.icon_id = "mapicon_" + ID; switch (MapInfo.MapType) { case "boss": condition.ContentsOpen.title = Localization.Get("OpenContentsDungeonBoss"); condition.ContentsOpen.message = GetShowName(condition.difficulty); break; default: condition.ContentsOpen.title = "invalid"; condition.ContentsOpen.message = "invalid"; break; } } Difficulty = new List <MapStageDifficulty>(); if (MapInfo.MapType == "main" || MapInfo.MapType == "weekly") { foreach (XmlNode difficultyNode in node.SelectNodes("Difficulty")) { Difficulty.Add(new MapStageDifficulty(this, difficultyNode)); } } else { Difficulty.Add(new MapStageDifficulty(this, node)); } DropInfo = new List <RewardLootInfo>(); foreach (XmlNode LootNode in node.SelectNodes("Loot")) { DropInfo.Add(new RewardLootInfo(LootNode, pe_Difficulty.Normal)); } }
override public void Load(XmlNode node) { base.Load(node); Name = node.Attributes["name"].Value; XmlAttribute descAttr = node.Attributes["description"]; if (descAttr != null) { Description = descAttr.Value; } else { Description = ""; } var bg_id_attr = node.Attributes["bg_id"]; if (bg_id_attr != null) { BG_ID = bg_id_attr.Value; } else { BG_ID = ID; } var map_type_attr = node.Attributes["map_type"]; if (map_type_attr != null) { MapType = map_type_attr.Value; } var try_limit_attr = node.Attributes["try_limit"]; if (try_limit_attr != null) { TryLimit = short.Parse(try_limit_attr.Value); } else { TryLimit = -1; } CheckCreature = short.Parse(node.Attributes["check_creature"].Value); CheckRune = short.Parse(node.Attributes["check_rune"].Value); Conditions = new MapCondition[5]; foreach (XmlNode condition_node in node.SelectNodes("Condition")) { MapCondition condition = new MapCondition(condition_node); Conditions[(int)condition.difficulty] = condition; condition.ContentsOpen = new ContentsOpenInfo(); condition.ContentsOpen.icon_id = "mapicon_" + ID; switch (MapType) { case "main": condition.ContentsOpen.title = Localization.Get("OpenContentsDungeonMain"); condition.ContentsOpen.message = GetShowName(condition.difficulty); break; case "event": case "weekly": condition.ContentsOpen.title = Localization.Get("OpenContentsDungeonEvent"); condition.ContentsOpen.message = GetShowName(condition.difficulty); break; default: condition.ContentsOpen.title = "invalid"; condition.ContentsOpen.message = "invalid"; break; } } Stages = new List <MapStageInfo>(); foreach (XmlNode stageNode in node.SelectNodes("Stage")) { Stages.Add(new MapStageInfo(this, stageNode)); } AvailableTags = new List <string>(); XmlAttribute available_tag_attr = node.Attributes["available_tag"]; if (available_tag_attr != null) { string tags = available_tag_attr.Value; Array.ForEach(tags.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries), tag => AvailableTags.Add(tag)); } //Rewards = new List<MapRewardInfo>(); //foreach (XmlNode difficultyNode in node.SelectNodes("RewardDifficulty")) //{ // pe_Difficulty difficulty = (pe_Difficulty)Enum.Parse(typeof(pe_Difficulty), difficultyNode.Attributes["type"].Value); // foreach (XmlNode stageNode in difficultyNode.SelectNodes("Reward")) // { // Rewards.Add(new MapRewardInfo(stageNode, difficulty)); // } //} }