public SelectedWorldArea(WorldArea worldArea) { Area = worldArea; }
protected void OnCursorActivate(params object[] parameters) { Diagnostics.Assert(this.PlayerControllerRepositoryService != null); if (this.Node != null) { this.Node = null; } if (parameters != null) { this.Node = (parameters.FirstOrDefault((object iterator) => iterator != null && iterator.GetType() == typeof(CreepingNode)) as CreepingNode); } global::Empire empire = (global::Empire)this.PlayerControllerRepositoryService.ActivePlayerController.Empire; if (!CreepingNodeWorldCursor.CheckWhetherCanSelectCreepingNode(empire, this.Node)) { Diagnostics.LogWarning("Cannot select the creeping node..."); return; } base.Focus(this.Node, false); bool flag = false; if (this.Node.Empire.Index == empire.Index) { flag = true; } if (flag) { if (this.ResourceRendererService != null) { this.ResourceRendererService.Clear(); if (this.WorldPositionningService != null) { int fidsiextractionRange = this.Node.NodeDefinition.FIDSIExtractionRange; int index = this.Node.PointOfInterest.Region.Index; for (int i = 0; i < this.Node.ExploitedTiles.Count; i++) { if (this.Node.ExploitedTiles[i].IsValid && (int)this.WorldPositionningService.GetRegionIndex(this.Node.ExploitedTiles[i]) == this.Node.PointOfInterest.Region.Index && this.WorldPositionningService.GetDistrict(this.Node.ExploitedTiles[i]) == null && !this.WorldPositionningService.HasRidge(this.Node.ExploitedTiles[i])) { this.ResourceRendererService.Add(this.Node.ExploitedTiles[i]); } } this.WorldArea = this.ResourceRendererService.FromPositionsToWorldArea(); if (this.WorldArea.WorldPositions.Count == 0) { this.WorldArea = null; flag = false; } } } } else { if (this.ResourceRendererService != null) { this.ResourceRendererService.Clear(); } this.InvalidateFIDS(true); } if (this.WorldArea == null) { this.WorldArea = new WorldArea(new WorldPosition[] { this.Node.WorldPosition }); } this.CreateNodeBoundaryIFN(); if (flag) { this.CreateCreepingNodeHexFidsIFN(); } }
private void Start() { worldArea = GetComponentInParent <WorldArea>(); }
public void CreateScrolls(List <string> _symptoms) { List <string> symptoms = new List <string>(_symptoms); // So we can destructively remove items Vector3[] occupiedPositions = new Vector3[Inventory.MAX_NR_SCROLLS]; int content; int color; Random.InitState(System.DateTime.Now.Millisecond); int i = 0; int whileSaver = 0; // Keep looping until all scrolls haven succesfully has been positioned // (or worse case we fail to do this under 100 attempts, // NB: This scenario is currently unhandled!) while (i < Inventory.MAX_NR_SCROLLS && whileSaver < 100) { whileSaver++; if (whileSaver == 100) { print("Could not place all scrolls"); // For debug, should not happen! But number is adjusted to the current number } // of scroll positions and max number scrolls. Scroll.ScrollInfo info = new Scroll.ScrollInfo(); // Set a random position int areaID = Random.Range(0, worldMan.numberOfWorldAreas); WorldArea worldArea = worldMan.worldAreas[areaID]; if (worldArea.nrScrollPositions == 0) { continue; } GameObject rndPosition = worldArea.scrollPositions[Random.Range(0, worldArea.nrScrollPositions)]; // If position has already been assigned, go back and choose a new one if (System.Array.Exists <Vector3>(occupiedPositions, element => element == rndPosition.transform.position)) { continue; } occupiedPositions[i] = rndPosition.transform.position; // Add random content and random color content = Random.Range(0, Inventory.MAX_NR_SCROLLS - i); color = Random.Range(0, Inventory.MAX_NR_SCROLLS - i); info.content = symptoms[content]; symptoms.RemoveAt(content); info.color = colors[color]; colors.RemoveAt(color); // Add properties to new scroll and add it to the correct WorldArea's list of Interactable:s GameObject newScrollGameObj = Instantiate(orgScroll) as GameObject; Scroll newScroll = newScrollGameObj.GetComponent <Scroll>(); newScroll.info = info; newScroll.transform.position = rndPosition.transform.position; newScroll.transform.rotation = rndPosition.transform.rotation; newScroll.gameObject.transform.SetParent(transform); newScroll.gameObject.SetActive(true); newScroll.gameObject.layer = InteractableManager.INTERACTABLE_LAYER; worldMan.worldAreas[areaID].interactables.AddLast(newScroll); i++; //print("Created scroll " + newScroll + " " + newScroll.info.content + " " + // newScroll.info.color + " " + newScroll.transform.position); } }
public bool AddArea(WorldArea area) { return(_regionBuilder.AddArea(area)); }
public bool RemoveArea(WorldArea area) { return(_regionBuilder.RemoveArea(area)); }
private List<WorldArea> LoadAreas() { var areas = this._xmlDoc.SelectSingleNode("World/Areas"); if (areas == null) throw new InvalidOperationException(); var result = new List<WorldArea>(); XmlNodeList areaList = areas.SelectNodes("Area"); if (areaList == null) throw new InvalidOperationException(); foreach (XmlElement a in areaList) { var wa = new WorldArea(a); if (wa.TileDefinitions.Count != 0) { WorldArea intersectingArea = (from WorldArea r in result where r.Area.Intersects(wa.Area) && r.TileDefinitions.Count != 0 select r).FirstOrDefault(); if (intersectingArea != null) throw new InvalidOperationException(string.Format("The area {0} intersects with another area {1} (this is a problem because there are multiple tile definitions).", wa.Area, intersectingArea.Area)); } result.Add(wa); } return result; }
public LabyrinthTrial GetLabyrinthTrialByArea(WorldArea area) { return(EntriesList.FirstOrDefault(x => x.Area == area)); }
protected override void OnCursorActivate(bool activate, params object[] parameters) { base.OnCursorActivate(activate, parameters); if (activate) { Diagnostics.Assert(this.PlayerControllerRepositoryService != null); if (this.Village != null) { this.Village = null; } if (parameters != null) { this.Village = (parameters.FirstOrDefault((object iterator) => iterator != null && iterator.GetType() == typeof(Village)) as Village); } global::Empire empire = (global::Empire)this.PlayerControllerRepositoryService.ActivePlayerController.Empire; if (!VillageWorldCursor.CheckWhetherCanSelectVillage(empire, this.Village)) { Diagnostics.LogWarning("Cannot select dat village..."); return; } base.Focus(this.Village, false); bool flag = false; if (this.Village.HasBeenConverted && this.Village.Converter.Index == empire.Index) { flag = true; } if (flag) { if (this.ResourceRendererService != null) { this.ResourceRendererService.Clear(); if (this.WorldPositionningService != null) { this.ResourceRendererService.Add(this.Village.WorldPosition); for (int i = 0; i < 6; i++) { WorldPosition neighbourTile = this.WorldPositionningService.GetNeighbourTile(this.Village.WorldPosition, (WorldOrientation)i, 1); if (neighbourTile.IsValid && (int)this.WorldPositionningService.GetRegionIndex(neighbourTile) == this.Village.Region.Index) { this.ResourceRendererService.Add(neighbourTile); } } this.WorldArea = this.ResourceRendererService.FromPositionsToWorldArea(); } } } else { if (this.ResourceRendererService != null) { this.ResourceRendererService.Clear(); } this.InvalidateFIDS(true); } if (this.WorldArea == null) { this.WorldArea = new WorldArea(new WorldPosition[] { this.Village.WorldPosition }); } this.CreateVillageBoundaryIFN(); if (flag) { this.CreateVillageHexFidsIFN(); } } else { if (this.villageBoundaryObject != null) { MeshFilter component = this.villageBoundaryObject.GetComponent <MeshFilter>(); if (component != null) { Mesh mesh = component.mesh; component.mesh = null; UnityEngine.Object.DestroyImmediate(mesh, true); } UnityEngine.Object.DestroyImmediate(this.villageBoundaryObject); this.villageBoundaryObject = null; } if (this.worldEntityHelperContent != null) { this.worldEntityHelperContent.Clear(); this.worldEntityHelperContent = null; } if (this.ResourceRendererService != null) { this.ResourceRendererService.Clear(); } if (this.Village != null) { this.InvalidateFIDS(false); this.Village = null; } this.WorldArea = null; } }
//todo: check scene exists public static bool LoadLevel(string name, bool updatePlayerLevel, bool saveGame = true, WorldArea worldArea = null, Location location = null, bool forceReload = false) { //check we can load //if we can load then: if (updatePlayerLevel && GetObject.PlayerSave != null) { GetObject.PlayerSave.CurrentScene = name; if (worldArea != null) { GetObject.PlayerSave.WorldMap.CurrentWorldAreaID = worldArea.ID; } if (location != null) { GetObject.PlayerSave.WorldMap.CurrentLocationID = location.ID; } } if (location != null) { GetObject.PlayerSave.WorldMap.AddVisitedLocation(location.ID); } if (saveGame) { PlayerSaveLoadManager.Instance.SaveGame(); } GetObject.ClearReferences(); Time.timeScale = 1; var loadedPlayerSave = GetObject.PlayerSave; var saveToLoad = PlayerSaveLoadManager.Instance.RecentSave(); var loadedScene = SceneManager.GetActiveScene().name; if (forceReload || loadedScene != name || (loadedPlayerSave == null || loadedPlayerSave.SaveID != saveToLoad.SaveID)) //check it's the same save { SceneManager.LoadScene(name); return(true); } else { var spawnPosition = GetObject.SpawnPositionTransform.transform.position; var playerSave = GetObject.PlayerSave; if (!string.IsNullOrEmpty(playerSave.WorldMap.CurrentLocationID)) { var newlocation = Rm_RPGHandler.Instance.Customise.WorldMapLocations.First(w => w.ID == playerSave.WorldMap.CurrentWorldAreaID). Locations.First(l => l.ID == playerSave.WorldMap.CurrentLocationID); if (newlocation.UseCustomLocation) { spawnPosition = location.CustomSpawnLocation; } } GetObject.PlayerController.Resume(); GetObject.PlayerMonoGameObject.transform.position = spawnPosition; } return(false); }
private void UpdateTexts(WorldArea area) { areaName.text = area.areaName; tiles.text = string.Join(", ", area.tiles); }
private void GenerateGeometry(WorldPatch patchParent, WorldPosition attackerPosition, WorldArea battleArea, WorldArea attackerDeploymentArea, WorldArea defenderDeploymentArea) { if (this.battleZoneGameObject == null) { this.battleZoneGameObject = new GameObject("BattleArea"); this.battleDeploymentAreaAttacker = this.InstantiateGameObjectFromPrefabNameAndInitMeshFilter("Prefabs/Encounters/ArmyWorldCursorDeploymentArea", this.battleZoneGameObject, false); this.battleDeploymentAreaDefender = this.InstantiateGameObjectFromPrefabNameAndInitMeshFilter("Prefabs/Encounters/ArmyWorldCursorDeploymentArea", this.battleZoneGameObject, false); this.battleAreaBoundary = this.InstantiateGameObjectFromPrefabNameAndInitMeshFilter("Prefabs/Encounters/ArmyWorldCursorEncounterBoundary", this.battleZoneGameObject, false); } this.battleZoneGameObject.transform.parent = patchParent.RootedTransform; this.battleZoneGameObject.transform.localPosition = new Vector3(0f, 0.005f, 0f); if (this.battleAreaBoundary != null) { this.battleAreaBoundary.transform.localPosition = Vector3.zero; WorldAreaHexagonRenderer component = this.battleAreaBoundary.GetComponent <WorldAreaHexagonRenderer>(); component.SetWorldArea(battleArea, attackerPosition, base.GlobalPositionningService); component.SetMaterialSelectionStatus(false, true, true); } if (this.battleDeploymentAreaAttacker != null) { this.battleDeploymentAreaAttacker.transform.localPosition = new Vector3(0f, 0.005f, 0f); WorldAreaHexagonRenderer component2 = this.battleDeploymentAreaAttacker.GetComponent <WorldAreaHexagonRenderer>(); component2.SetWorldArea(attackerDeploymentArea, attackerPosition, base.GlobalPositionningService); Color color = this.WorldArmy.Army.Empire.Color; color.a = this.attackerAlphaValue; component2.SetColor(color); component2.SetMaterialSelectionStatus(false, true, true); } if (this.battleDeploymentAreaDefender != null) { this.battleDeploymentAreaDefender.transform.localPosition = new Vector3(0f, 0.005f, 0f); WorldAreaHexagonRenderer component3 = this.battleDeploymentAreaDefender.GetComponent <WorldAreaHexagonRenderer>(); component3.SetWorldArea(defenderDeploymentArea, attackerPosition, base.GlobalPositionningService); Color color2 = new Color(1f, 0f, 0f, this.defenderAlphaValue); if (this.battleTarget is Garrison) { Garrison garrison = this.battleTarget as Garrison; if (garrison.Empire != null) { color2 = garrison.Empire.Color; Army army = garrison as Army; if (army != null && army.IsPrivateers) { IPlayerControllerRepositoryService service = Services.GetService <IGameService>().Game.Services.GetService <IPlayerControllerRepositoryService>(); if (service.ActivePlayerController != null && service.ActivePlayerController.Empire != null && service.ActivePlayerController.Empire.Index != garrison.Empire.Index) { color2 = global::Game.PrivateersColor; } } color2.a = this.defenderAlphaValue; } } else if (this.battleTarget is District) { color2 = ((District)this.battleTarget).Empire.Color; } component3.SetColor(color2); component3.SetMaterialSelectionStatus(false, true, true); } this.battleZoneGameObject.SetActive(true); this.battleZoneVisible = true; }
private void OnAreaSelectionChanged(WorldArea e) { AreaSelectionChange?.Invoke(this, new SelectedWorldArea(e)); }
public void Update() { BaseItemType BaseItem = gameController.Files.BaseItemTypes.Translate(Entity.Path); string ItemName = BaseItem.BaseName; ClassID = BaseItem.ClassName; MavenDetails mavenDetails = new MavenDetails(); int packSize = 0; int quantity = Entity.GetComponent <Quality>()?.ItemQuality ?? 0; // get and evaluate mods var mapComponent = Entity.GetComponent <Map>() ?? null; Tier = mapComponent?.Tier ?? -1; NeedsPadding = Tier == -1 ? false : true; ZanaMissionType = ObjectiveType.None; Bricked = false; Corrupted = Entity.GetComponent <Base>()?.isCorrupted ?? false; var modsComponent = Entity.GetComponent <Mods>() ?? null; ModCount = modsComponent?.ItemMods.Count() ?? 0; if (modsComponent != null && ModCount > 0) { // add warnings, add quant, add packsize if (modsComponent != null && modsComponent.ItemRarity != ItemRarity.Unique) { foreach (var mod in modsComponent.ItemMods.Where(x => !x.Group.Contains("MapAtlasInfluence"))) { if (ModNameBlacklist.Any(m => mod.RawName.Contains(m))) { ModCount--; continue; } #region Elder Guardian Maven Areas and Regions if (mod.Group.Contains("MapElderContainsBoss")) { ModCount--; switch (mod.Value1) { case 1: mavenDetails.MavenRegion = "The Twisted"; mavenDetails.MavenArea = "The Enslaver"; break; case 2: mavenDetails.MavenRegion = "The Twisted"; mavenDetails.MavenArea = "The Eradicator"; break; case 3: mavenDetails.MavenRegion = "The Twisted"; mavenDetails.MavenArea = "The Constrictor"; break; case 4: mavenDetails.MavenRegion = "The Twisted"; mavenDetails.MavenArea = "The Purifier"; break; } continue; } #endregion quantity += mod.Value1; packSize += mod.Value3; if (WarningDictionary.Where(x => mod.RawName.Contains(x.Key)).Any()) { StyledText warning = WarningDictionary.Where(x => mod.RawName.Contains(x.Key)).FirstOrDefault().Value; if (warning.Bricking) { Bricked = true; } ActiveWarnings.Add(warning); } } } // Check Zana missions if (!modsComponent.ItemMods.Any(x => x.RawName == "MapZanaSubAreaMissionDetails")) { ZanaMod = null; } else if (ZanaMods.TryGetValue(modsComponent.ItemMods. FirstOrDefault(x => x.RawName == "MapZanaSubAreaMissionDetails").Value2, out string modName)) { Vector4 textColor = new Vector4(0.9f, 0.85f, 0.65f, 1f); if (modName.Contains("Elder Guardian")) { ZanaMissionType = ObjectiveType.ElderGuardian; } else if (modName.Contains("Shaper Guardian")) { ZanaMissionType = ObjectiveType.ShaperGuardian; } else if (modName.Contains("Harvest")) { ZanaMissionType = ObjectiveType.Harvest; } else if (modName.Contains("Delirium")) { ZanaMissionType = ObjectiveType.Delirium; } else if (modName.Contains("Blighted Map")) { ZanaMissionType = ObjectiveType.Blighted; } else if (modName.Contains("Blight Encounter")) { ZanaMissionType = ObjectiveType.BlightEncounter; } else if (modName.Contains("Legion")) { ZanaMissionType = ObjectiveType.Legion; } else if (modName.Contains("Metamorph")) { ZanaMissionType = ObjectiveType.Metamorph; } ZanaMod = new StyledText() { Color = textColor, Text = modName }; } else { Vector4 textColor = new Vector4(0.9f, 0.85f, 0.65f, 1f); modName = $"Unknown Zana Mission: {modsComponent.ItemMods.FirstOrDefault(x => x.RawName == "MapZanaSubAreaMissionDetails").Value2}"; ZanaMod = new StyledText() { Color = textColor, Text = modName }; } } ; Quantity = quantity; PackSize = packSize; if (!ClassID.Contains("HeistContract") && !ClassID.Contains("HeistBlueprint") && !ClassID.Contains("AtlasRegionUpgradeItem") && !ClassID.Contains("QuestItem") && !ClassID.Contains("MiscMapItem") && !ClassID.Contains("MapFragment")) { WorldArea area = mapComponent.Area; string mapTrim = Entity.GetComponent <Base>().Name.Replace(" Map", ""); if (modsComponent.ItemRarity == ItemRarity.Unique) { // normal map at inner, 0x18, 0x18 long mapUnique = gameController.IngameState.M.Read <long>(mapComponent.Address + 0x10, 0x10, 0x20); area = gameController.Files.WorldAreas.GetByAddress(mapUnique) ?? area; mapTrim = area.Name; } MapName = $"[T{mapComponent.Tier}] {mapTrim}"; Awakened = AwakenedAreas.Contains(area) ? true : false; Bonus = BonusAreas.Contains(area) ? true : false; Completed = CompletedAreas.Contains(area) ? true : false; mavenDetails.MavenCompletion = MavenAreas.Contains(area) ? true : false; if (AreaRegion.TryGetValue(mapTrim, out string region)) { MapRegion = region; } else { MapRegion = "Unknown Region"; } } if (Entity.Path.Contains("MavenMap")) { mavenDetails.MavenInvitation = true; MapName = ItemName; mavenDetails.MavenRegion = RegionReadable.FirstOrDefault(x => Entity.Path.Contains(x.Key)).Value ?? "Uncharted"; } if (ClassID.Contains("MapFragment")) { MapName = ItemName; NeedsPadding = true; } #region Maven Regions & Areas if (Entity.Path.Contains("BreachFragmentPhysical")) { mavenDetails.MavenRegion = "The Hidden"; mavenDetails.MavenArea = "Uul-Netol's Domain"; } else if (Entity.Path.Contains("BreachFragmentCold")) { mavenDetails.MavenRegion = "The Hidden"; mavenDetails.MavenArea = "Tul's Domain"; } else if (Entity.Path.Contains("BreachFragmentFire")) { mavenDetails.MavenRegion = "The Hidden"; mavenDetails.MavenArea = "Xoph's Domain"; } else if (Entity.Path.Contains("BreachFragmentLightning")) { mavenDetails.MavenRegion = "The Hidden"; mavenDetails.MavenArea = "Esh's Domain"; } else if (Entity.Path.Contains("BreachFragmentChaos")) { mavenDetails.MavenRegion = "The Feared"; mavenDetails.MavenArea = "Chayula's Domain"; } else if (Entity.Path.Contains("CurrencyElderFragment")) { mavenDetails.MavenRegion = "The Feared"; mavenDetails.MavenArea = "Absence of Value and Meaning"; } else if (Entity.Path.Contains("ShaperFragment")) { mavenDetails.MavenRegion = "The Feared"; mavenDetails.MavenArea = "The Shaper's Realm"; } else if (Entity.Path.Contains("VaalFragment2_")) { mavenDetails.MavenRegion = "The Feared"; mavenDetails.MavenArea = "The Alluring Abyss"; } else if (ItemName == "Cortex") { mavenDetails.MavenRegion = "The Feared"; mavenDetails.MavenArea = "Cortex"; } else if (ItemName.Contains("Lair of the Hydra") || ItemName.Contains("Maze of the Minotaur") || ItemName.Contains("Forge of the Phoenix Map") || ItemName.Contains("Pit of the Chimera Map")) { mavenDetails.MavenRegion = "The Formed"; mavenDetails.MavenArea = ItemName.Replace(" Map", ""); } else if (ItemName == "Rewritten Distant Memory" || ItemName == "Augmented Distant Memory" || ItemName == "Altered Distant Memory" || ItemName == "Twisted Distant Memory") { mavenDetails.MavenRegion = "The Forgotten"; mavenDetails.MavenArea = ItemName; } if (mavenDetails.MavenInvitation || mavenDetails.MavenArea != string.Empty) { mavenDetails.MavenUncharted = MavenAreas.Any(x => x.Name == mavenDetails.MavenArea) ? true : false; mavenDetails.MavenBosses = MavenBosses(Entity.Path, mavenDetails.MavenRegion); } #endregion MavenDetails = mavenDetails; if ((MapName ?? string.Empty) != string.Empty && LacksCompletionList.Any(x => MapName.Contains(x))) { LacksCompletion = true; } // evaluate rarity for colouring item name ItemColor = GetRarityColor(modsComponent?.ItemRarity ?? ItemRarity.Normal); }
public void SetBackground(WorldArea area) { currentBackground = areaBackgrounds[area]; }