public List <Event> SetSpecialEvents() { List <Event> events = new List <Event>(); Event tSecurity = new TownSecurity(); events.Add(tSecurity); Event diseaseFall = new DiseaseFall(); events.Add(diseaseFall); Event traitor = new Traitor(); events.Add(traitor); Event mercenaries = new Mercenaries(); events.Add(mercenaries); Event spy = new Spy(); events.Add(spy); Event boss = new BossEncounter(); events.Add(boss); return(events); }
public static void RemoveGPSFromEncounter(BossEncounter encounter) { foreach (var player in MES_SessionCore.PlayerList) { if (player.IsBot == true || player.Character == null) { continue; } if (encounter.PlayersInEncounter.Contains(player.IdentityId) == true) { var sendData = MyAPIGateway.Utilities.SerializeToBinary <string>("MESBossGPSRemove\nNa\nNa"); bool sendStatus = MyAPIGateway.Multiplayer.SendMessageTo(8877, sendData, player.SteamUserId); } } }
// Use this for initialization void Start() { // try to get asteroid list from Hostile encounter HostileEncounter h = (HostileEncounter)GameObject.Find("Main Camera").GetComponent("HostileEncounter"); if (h != null) { asteroids = h.asteroids; asteroid_type = h.asteroid_type; } // If this is a Boss Encounter get list from BossEncounter else { BossEncounter b = (BossEncounter)GameObject.Find("Main Camera").GetComponent("BossEncounter"); asteroids = b.asteroids; asteroid_type = b.asteroid_type; } // Get asteroids physical body asteroid = GetComponent <Rigidbody2D>(); }
public static void entRoomSearch(int choice) { switch(choice) { case 1: { // Chamber - FINAL BATTLE(S) Console.Clear(); WriteLine("You approach the large metal door; upon closer inspection, you see that the door is very thick and made of iron.\nAnd it’s a good thing because you hear a bellow from the other side of the door that is not remotely human.\nDespite that, you decide to open the door."); WriteLine("Press 'Enter' to continue."); Console.ReadLine(); Console.Clear(); WriteLine("You see a very large room, mostly empty - basically a chamber. Most of the walls are stone.\nIn front of the far wall is a table, possibly an altar, covered by some kind of dark purple cloth, trimmed in silver.\nOn that table are some leather-bound books and a couple of silver candle holders; there are tall, twin lit candles in each holder."); WriteLine("Press 'Enter' to continue."); Console.ReadLine(); Console.Clear(); WriteLine("You notice chalk or charcoal sketches on the left and right walls, on the inside of the door, and a very large drawing in front of the table.\nThese appear to be some form of Protection glyphs that you may have seen in a pamphlet earlier. \nThey consist of a triangle, small circles drawn around the points of the triangle, and a large circle surrounding the triangle-circle figure. The one on the floor is drawn in black and white chalk, is about 10-12 feet in diameter, and surrounds a monstrosity."); WriteLine("Press 'Enter' to continue."); Console.ReadLine(); Console.Clear(); WriteLine("Inside the floor glyph, in front of the table, stands a gaunt, humanoid figure, well over 7 feet tall. The tattered remains of pants and shoes cling to the lower body of the figure.\nThe upper body is lean muscle, covered by a sleek, grey coat of fur. The head… it LOOKS vaguely like a wolf, if a slightly feminine face was put on a wolf head and muzzle, and the jaws were about three times too wide and long."); WriteLine("Press 'Enter' to continue."); Console.ReadLine(); Console.Clear(); WriteLine("THIS is the source of the strange occurrences in this house."); WriteLine("This is a Loup-Garou!"); // more code WriteLine("Press 'Enter' to continue."); Console.ReadLine(); BossEncounter.battleNoLocket(); } break; case 2: Console.WriteLine("There are bottles of various liquors behind the bar but nothing else of interest."); WriteLine("Press 'Enter' to continue."); Console.ReadLine(); Console.Clear(); Basement.entertainmentRoom(); break; case 3: // bathroom2 WriteLine("This bathroom is surprisngly intact, compare to other parts of the house. You don't find anything of interest."); WriteLine("Press 'Enter' to continue."); Console.ReadLine(); Console.Clear(); Basement.entertainmentRoom(); // link back to Ent. Room break; case 4: { WriteLine("You take a closer look at the safe. Under the numerical keypad, there is a hand-written strip of paper: 'You only get 3 chances'."); WriteLine("Do you try to enter the code?"); WriteLine("1. Yes, 2. No"); int safeOpen = Int32.Parse(ReadLine()); safe(safeOpen); break; } case 5: Basement.stairs(); break; default: break; } }
public static string AttemptSpawn(Vector3D startCoords) { if (Settings.General.UseMaxNpcGrids == true) { var totalNPCs = NPCWatcher.ActiveNPCs.Count; if (totalNPCs >= Settings.General.MaxGlobalNpcGrids) { return("Spawning Aborted. Max Global NPCs Limit Reached."); } } if (NPCWatcher.ActiveNpcTypeLimitReachedForArea("BossEncounter", startCoords, Settings.BossEncounters.MaxShipsPerArea, Settings.BossEncounters.AreaSize) == true) { return("Too Many Boss Encounter Grids in Player Area"); } var spawnCoords = Vector3D.Zero; if (GetInitialSpawnCoords(startCoords, out spawnCoords) == false) { return("Could Not Find Valid Coords For Boss Encounter Signal Generation."); } var spawnGroupList = GetBossEncounters(startCoords, spawnCoords); if (Settings.General.UseModIdSelectionForSpawning == true) { spawnGroupList = SpawnResources.SelectSpawnGroupSublist(SpawnGroupSublists, EligibleSpawnsByModId); } if (spawnGroupList.Count == 0) { return("No Eligible Spawn Groups Could Be Found To Spawn Near Player."); } var spawnGroup = spawnGroupList[SpawnResources.rnd.Next(0, spawnGroupList.Count)]; var bossEncounter = new BossEncounter(); bossEncounter.SpawnGroup = spawnGroup; bossEncounter.SpawnGroupName = spawnGroup.SpawnGroupName; bossEncounter.Position = spawnCoords; foreach (var player in MES_SessionCore.PlayerList) { if (player.IsBot == true || player.Character == null || IsPlayerInBossEncounter(player.IdentityId) == true) { continue; } if (Vector3D.Distance(player.GetPosition(), spawnCoords) < Settings.BossEncounters.PlayersWithinDistance) { bossEncounter.PlayersInEncounter.Add(player.IdentityId); } else { continue; } if (spawnGroup.BossCustomAnnounceEnable == true) { MyVisualScriptLogicProvider.SendChatMessage(spawnGroup.BossCustomAnnounceMessage, spawnGroup.BossCustomAnnounceAuthor, player.IdentityId, "Red"); } /* * var syncData = new SyncData(); * syncData.Instruction = "MESBossGPSCreate"; * syncData.GpsName = spawnGroup.BossCustomGPSLabel; * syncData.GpsCoords = spawnCoords; * var sendData = MyAPIGateway.Utilities.SerializeToBinary<SyncData>(syncData); * bool sendStatus = MyAPIGateway.Multiplayer.SendMessageTo(8877, sendData, player.SteamUserId); */ } bossEncounter.CreateGpsForPlayers(); NPCWatcher.BossEncounters.Add(bossEncounter); try { if (NPCWatcher.BossEncounters.Count > 0) { BossEncounter[] encounterArray = NPCWatcher.BossEncounters.ToArray(); var byteArray = MyAPIGateway.Utilities.SerializeToBinary <BossEncounter[]>(encounterArray); var storedBossData = Convert.ToBase64String(byteArray); MyAPIGateway.Utilities.SetVariable <string>("MES-ActiveBossEncounters", storedBossData); } else { MyAPIGateway.Utilities.SetVariable <string>("MES-ActiveBossEncounters", ""); } } catch (Exception e) { Logger.AddMsg("Something went wrong while getting Boss Encounter Data from Storage."); Logger.AddMsg(e.ToString(), true); } Logger.SkipNextMessage = false; return("Boss Encounter GPS Created with Spawngroup: " + spawnGroup.SpawnGroup.Id.SubtypeName); }
public static bool SpawnBossEncounter(BossEncounter encounter) { MyPlanet planet = SpawnResources.GetNearestPlanet(encounter.Position); var inGravity = SpawnResources.IsPositionInGravity(encounter.Position, planet); for (int i = 0; i < Settings.BossEncounters.PathCalculationAttempts; i++) { bool gotMatrix = false; var tempMatrix = MatrixD.CreateWorld(Vector3D.Zero, Vector3D.Forward, Vector3D.Up); if (inGravity == false) { var randDir = Vector3D.Normalize(MyUtils.GetRandomVector3D()); var randDist = (double)SpawnResources.rnd.Next((int)Settings.BossEncounters.MinSpawnDistFromCoords, (int)Settings.BossEncounters.MaxSpawnDistFromCoords); var spawnCoords = randDir * randDist + encounter.Position; if (SpawnResources.IsPositionInGravity(spawnCoords, planet) == true) { randDir *= -1; spawnCoords = randDir * randDist + encounter.Position; if (SpawnResources.IsPositionInGravity(spawnCoords, planet) == true) { continue; } } var forwardDir = Vector3D.Normalize(encounter.Position - spawnCoords); var upDir = Vector3D.CalculatePerpendicularVector(forwardDir); tempMatrix = MatrixD.CreateWorld(spawnCoords, forwardDir, upDir); gotMatrix = true; } else { var planetEntity = planet as IMyEntity; var upDir = Vector3D.Normalize(encounter.Position - planetEntity.GetPosition()); var randDir = SpawnResources.GetRandomCompassDirection(encounter.Position, planet); var randDist = (double)SpawnResources.rnd.Next((int)Settings.BossEncounters.MinSpawnDistFromCoords, (int)Settings.BossEncounters.MaxSpawnDistFromCoords); var roughCoords = randDir * randDist + encounter.Position; var surfaceCoords = SpawnResources.GetNearestSurfacePoint(roughCoords, planet); var spawnCoords = upDir * Settings.BossEncounters.MinPlanetAltitude + surfaceCoords; tempMatrix = MatrixD.CreateWorld(spawnCoords, randDir * -1, upDir); gotMatrix = true; } if (gotMatrix == false) { continue; } bool badCoords = false; foreach (var prefab in encounter.SpawnGroup.SpawnGroup.Prefabs) { var offsetCoords = Vector3D.Transform((Vector3D)prefab.Position, tempMatrix); foreach (var entity in SpawnResources.EntityList) { if (Vector3D.Distance(offsetCoords, entity.GetPosition()) < Settings.BossEncounters.MinSignalDistFromOtherEntities) { badCoords = true; break; } } if (badCoords == false) { if (SpawnResources.IsPositionInSafeZone(offsetCoords) == true) { badCoords = true; break; } } if (SpawnResources.IsPositionInGravity(offsetCoords, planet) == true) { if (SpawnResources.GetDistanceFromSurface(offsetCoords, planet) < Settings.BossEncounters.MinPlanetAltitude / 4) { badCoords = true; break; } } } if (badCoords == true) { continue; } //Spawn the things! Logger.SkipNextMessage = false; Logger.AddMsg("Boss Encounter SpawnGroup " + encounter.SpawnGroup.SpawnGroup.Id.SubtypeName + " Now Spawning."); foreach (var prefab in encounter.SpawnGroup.SpawnGroup.Prefabs) { var options = SpawnGroupManager.CreateSpawningOptions(encounter.SpawnGroup, prefab); var spawnPosition = Vector3D.Transform((Vector3D)prefab.Position, tempMatrix); var speedL = prefab.Speed * (Vector3)tempMatrix.Forward; var speedA = Vector3.Zero; var gridList = new List <IMyCubeGrid>(); long gridOwner = 0; //Speed Management if (Settings.SpaceCargoShips.UseMinimumSpeed == true && prefab.Speed < Settings.SpaceCargoShips.MinimumSpeed) { speedL = Settings.SpaceCargoShips.MinimumSpeed * (Vector3)tempMatrix.Forward; } if (Settings.SpaceCargoShips.UseSpeedOverride == true) { speedL = Settings.SpaceCargoShips.SpeedOverride * (Vector3)tempMatrix.Forward; } if (NPCWatcher.NPCFactionTagToFounder.ContainsKey(encounter.SpawnGroup.FactionOwner) == true) { gridOwner = NPCWatcher.NPCFactionTagToFounder[encounter.SpawnGroup.FactionOwner]; } else { Logger.AddMsg("Could Not Find Faction Founder For: " + encounter.SpawnGroup.FactionOwner); } //Grid Manipulation GridBuilderManipulation.ProcessPrefabForManipulation(prefab.SubtypeId, encounter.SpawnGroup, "BossEncounter", prefab.Behaviour); try{ MyAPIGateway.PrefabManager.SpawnPrefab(gridList, prefab.SubtypeId, spawnPosition, tempMatrix.Forward, tempMatrix.Up, speedL, speedA, prefab.BeaconText, options, gridOwner); }catch (Exception exc) { } var pendingNPC = new ActiveNPC(); pendingNPC.SpawnGroup = encounter.SpawnGroup; pendingNPC.SpawnGroupName = encounter.SpawnGroup.SpawnGroupName; pendingNPC.InitialFaction = encounter.SpawnGroup.FactionOwner; pendingNPC.faction = MyAPIGateway.Session.Factions.TryGetFactionByTag(pendingNPC.InitialFaction); pendingNPC.Name = prefab.SubtypeId; pendingNPC.GridName = MyDefinitionManager.Static.GetPrefabDefinition(prefab.SubtypeId).CubeGrids[0].DisplayName; pendingNPC.StartCoords = spawnPosition; pendingNPC.CurrentCoords = spawnPosition; pendingNPC.EndCoords = spawnPosition; pendingNPC.SpawnType = "BossEncounter"; pendingNPC.CleanupIgnore = encounter.SpawnGroup.IgnoreCleanupRules; pendingNPC.ForceStaticGrid = encounter.SpawnGroup.ForceStaticGrid; pendingNPC.KeenAiName = prefab.Behaviour; pendingNPC.KeenAiTriggerDistance = prefab.BehaviourActivationDistance; if (encounter.SpawnGroup.RandomizeWeapons == true) { pendingNPC.ReplenishedSystems = false; pendingNPC.ReplacedWeapons = true; } else if ((MES_SessionCore.NPCWeaponUpgradesModDetected == true || Settings.General.EnableGlobalNPCWeaponRandomizer == true) && encounter.SpawnGroup.IgnoreWeaponRandomizerMod == false) { pendingNPC.ReplenishedSystems = false; pendingNPC.ReplacedWeapons = true; } else if (encounter.SpawnGroup.ReplenishSystems == true) { pendingNPC.ReplenishedSystems = false; } if (inGravity == true) { pendingNPC.Planet = planet; } NPCWatcher.PendingNPCs.Add(pendingNPC); } return(true); } Logger.AddMsg("Could Not Find Safe Area To Spawn Boss Encounter"); return(false); }