public static Matrix GetBaseEnemyFleetTrans( App app, int skFleetId, Kerberos.Sots.GameStates.StarSystem starSystem, OrbitalObjectInfo[] orbitalObjects) { return(SystemKiller.GetSpawnTransform(app, skFleetId, starSystem, orbitalObjects)); }
public SlaverCombatAI( App game, Player player, bool playerControlled, Kerberos.Sots.GameStates.StarSystem starSystem, Dictionary <int, DiplomacyState> diploStates) : base(game, player, playerControlled, starSystem, diploStates, false) { this.SetAIType(OverallAIType.SLAVER); this.m_SlaverShips = new List <Ship>(); }
public NPCFactionCombatAI( App game, Player player, bool playerControlled, int systemID, Kerberos.Sots.GameStates.StarSystem starSystem, Dictionary <int, DiplomacyState> diploStates) : base(game, player, playerControlled, starSystem, diploStates, false) { this.m_SystemID = systemID; this.m_CombatAIControls = new List <CombatAIController>(); }
public override string[] CloseDialog() { if (this._crits != null) this._crits.Dispose(); this._crits = (GameObjectSet)null; this._starsystem = (Kerberos.Sots.GameStates.StarSystem)null; this._camera = (OrbitCameraController)null; this._sky = (Sky)null; foreach (PlanetWidget planetWidget in this._planetWidgets) planetWidget.Terminate(); foreach (SystemWidget systemWidget in this._systemWidgets) systemWidget.Terminate(); this._systemWidget.Terminate(); return (string[])null; }
public override void Initialize() { this._systemWidget = new SystemWidget(this.App, this.App.UI.Path(this.ID, "starDetailsCard")); StarSystemInfo starSystemInfo = this._app.GameDatabase.GetStarSystemInfo(this._systemID); this._app.UI.SetText(this._app.UI.Path(this.ID, "intel_desc"), this._descriptor); this._app.UI.SetPropertyString(this._app.UI.Path(this.ID, "playerAvatar"), "sprite", Path.GetFileNameWithoutExtension(this._targetPlayer.AvatarAssetPath)); this._app.UI.SetPropertyString(this._app.UI.Path(this.ID, "playerBadge"), "sprite", Path.GetFileNameWithoutExtension(this._targetPlayer.BadgeAssetPath)); this._app.UI.SetVisible(this._app.UI.Path(this.ID, "system_map"), true); this._app.UI.SetVisible(this._app.UI.Path(this.ID, "gameStarSystemViewport"), false); this._app.UI.AddItem(this._app.UI.Path(this.ID, "gameViewportList"), "", 0, App.Localize("@SYSTEMDETAILS_SYS_MAP")); this._app.UI.AddItem(this._app.UI.Path(this.ID, "gameViewportList"), "", 1, "System"); this._app.UI.SetSelection(this._app.UI.Path(this.ID, "gameViewportList"), 0); this._crits = new GameObjectSet(this._app); this._camera = new OrbitCameraController(this._app); this._sky = new Sky(this._app, SkyUsage.InSystem, this._systemID); this._starsystem = new Kerberos.Sots.GameStates.StarSystem(this.App, 1f, this._systemID, Vector3.Zero, true, (CombatSensor)null, false, 0, false, true); this._starsystem.SetAutoDrawEnabled(false); this._starsystem.SetCamera(this._camera); this._starsystem.SetInputEnabled(true); this._starsystem.PostObjectAddObjects((IGameObject)this._sky); foreach (IGameObject state in this._starsystem.Crits.Objects.Where<IGameObject>((Func<IGameObject, bool>)(x => { if (!(x is StellarBody)) return x is StarModel; return true; }))) state.PostSetProp("AutoDrawEnabled", false); this._crits.Add((IEnumerable<IGameObject>)new IGameObject[3] { (IGameObject) this._camera, (IGameObject) this._sky, (IGameObject) this._starsystem }); this._app.UI.Send((object)"SetGameObject", (object)this._app.UI.Path(this.ID, "gameStarSystemViewport"), (object)this._starsystem.ObjectID); this._critsInitialized = false; this._camera.PostSetLook(new Vector3(0.0f, 0.0f, 0.0f)); this._camera.PostSetPosition(new Vector3(0.0f, 100000f, 0.0f)); this._camera.MaxDistance = 500000f; this._camera.MinDistance = 100000f; StarSystemUI.SyncSystemDetailsWidget(this._app, this._app.UI.Path(this.ID, "system_details"), this._systemID, false, true); StarSystemMapUI.Sync(this._app, this._systemID, this._app.UI.Path(this.ID, "system_map"), true); this._currentFilterMode = DialogSystemIntel.PlanetFilterMode.AllPlanets; this._planetWidgets = new List<PlanetWidget>(); this.SetSyncedSystem(starSystemInfo); this._systemWidget.Sync(this._systemID); }
public static Matrix GetSpawnTransform(App app, Kerberos.Sots.GameStates.StarSystem starSystem) { float num1 = 0.0f; float num2 = 5000f; Vector3 vector3 = Vector3.Zero; Vector3 forward = -Vector3.UnitZ; List <StellarBody> stellarBodyList = new List <StellarBody>(); foreach (StellarBody stellarBody in starSystem.GetPlanetsInSystem()) { List <Ship> stationsAroundPlanet = starSystem.GetStationsAroundPlanet(stellarBody.Parameters.OrbitalID); stellarBodyList.Add(stellarBody); foreach (Ship ship in stationsAroundPlanet) { float lengthSquared = ship.Position.LengthSquared; if ((double)lengthSquared > (double)num1) { num1 = lengthSquared; vector3 = ship.Position; num2 = ship.ShipSphere.radius; forward = stellarBody.Parameters.Position - ship.Position; } } } if ((double)num1 <= 0.0) { foreach (StellarBody stellarBody in stellarBodyList) { if (stellarBody.Population > 0.0) { float lengthSquared = stellarBody.Parameters.Position.LengthSquared; if ((double)lengthSquared > (double)num1) { num1 = lengthSquared; vector3 = stellarBody.Parameters.Position; num2 = stellarBody.Parameters.Radius; int orbitalId = stellarBody.Parameters.OrbitalID; forward = -vector3; } } } } double num3 = (double)forward.Normalize(); return(Matrix.CreateWorld(vector3 - forward * (num2 + 20000f), forward, Vector3.UnitY)); }
public static Matrix GetSpawnTransform(App app, Kerberos.Sots.GameStates.StarSystem starSystem) { List <CombatZonePositionInfo> list = starSystem.NeighboringSystems.Select <NeighboringSystemInfo, CombatZonePositionInfo>((Func <NeighboringSystemInfo, CombatZonePositionInfo>)(x => starSystem.GetEnteryZoneForOuterSystem(x.SystemID))).ToList <CombatZonePositionInfo>(); CombatZonePositionInfo zonePositionInfo1 = (CombatZonePositionInfo)null; Vector3 forward = new Vector3(); float num1 = float.MaxValue; List <StellarBody> stellarBodyList = new List <StellarBody>(); foreach (StellarBody stellarBody in starSystem.GetPlanetsInSystem()) { if (stellarBody.Population != 0.0) { foreach (CombatZonePositionInfo zonePositionInfo2 in list) { Vector3 vector3 = stellarBody.Parameters.Position - zonePositionInfo2.Center; float lengthSquared = vector3.LengthSquared; if ((double)lengthSquared < (double)num1) { num1 = lengthSquared; forward = vector3; zonePositionInfo1 = zonePositionInfo2; } } } } if (zonePositionInfo1 == null) { forward.X = (App.GetSafeRandom().CoinToss(0.5) ? -1f : 1f) * App.GetSafeRandom().NextInclusive(0.0001f, 1f); forward.Y = 0.0f; forward.Z = (App.GetSafeRandom().CoinToss(0.5) ? -1f : 1f) * App.GetSafeRandom().NextInclusive(0.0001f, 1f); double num2 = (double)forward.Normalize(); float num3 = App.GetSafeRandom().NextInclusive(10000f, starSystem.GetSystemRadius()); return(Matrix.CreateWorld(forward * num3, -forward, Vector3.UnitY)); } double num4 = (double)forward.Normalize(); return(Matrix.CreateWorld(zonePositionInfo1.Center, forward, Vector3.UnitY)); }
public CombatZoneEnemySpotted(Kerberos.Sots.GameStates.StarSystem starSystem) { this.m_EnemyShips = new Dictionary <Ship, bool>(); this.m_StarSystem = starSystem; }
public static Matrix GetBaseEnemyFleetTrans(App app, Kerberos.Sots.GameStates.StarSystem starSystem) { return(GhostShip.GetSpawnTransform(app, starSystem)); }
public static Matrix GetSpawnTransform( App app, int fleetID, Kerberos.Sots.GameStates.StarSystem starSystem, OrbitalObjectInfo[] orbitalObjects) { DesignInfo designInfo = app.GameDatabase.GetDesignInfo(app.Game.ScriptModules.SystemKiller.SystemKillerDesignId); float val2 = 50000f; if (designInfo != null) { val2 = ((IEnumerable <DesignSectionInfo>)designInfo.DesignSections).Sum <DesignSectionInfo>((Func <DesignSectionInfo, float>)(x => x.ShipSectionAsset.Maneuvering.LinearSpeed)) * 120f; } float num1 = 0.0f; float num2 = 5000f; Vector3 vector3_1 = Vector3.Zero; Vector3 vector3_2 = -Vector3.UnitZ; int num3 = 0; foreach (OrbitalObjectInfo orbitalObject in orbitalObjects) { PlanetInfo planetInfo = app.GameDatabase.GetPlanetInfo(orbitalObject.ID); if (planetInfo != null) { Matrix orbitalTransform = app.GameDatabase.GetOrbitalTransform(orbitalObject.ID); float lengthSquared = orbitalTransform.Position.LengthSquared; if ((double)lengthSquared > (double)num1) { num1 = lengthSquared; vector3_1 = orbitalTransform.Position; vector3_2 = -orbitalTransform.Position; num2 = StarSystemVars.Instance.SizeToRadius(planetInfo.Size) + val2; num3 = orbitalObject.ID; } } } if (num3 == 0) { MoveOrderInfo orderInfoByFleetId = app.GameDatabase.GetMoveOrderInfoByFleetID(fleetID); if (orderInfoByFleetId != null) { Vector3 forward = orderInfoByFleetId.ToCoords - orderInfoByFleetId.FromCoords; forward.Y = 0.0f; if ((double)forward.Normalize() < 1.40129846432482E-45) { forward = -Vector3.UnitZ; } float num4 = 0.0f; if (starSystem != null) { num4 = Math.Min((float)(((double)starSystem.GetBaseOffset() + (double)Kerberos.Sots.GameStates.StarSystem.CombatZoneMapRadii[Math.Max(starSystem.GetFurthestRing() - 1, 1)]) * 5700.0), val2); } return(Matrix.CreateWorld(forward * -num4, forward, Vector3.UnitY)); } float num5 = starSystem != null?starSystem.GetStarRadius() : 5000f; Vector3 position = Vector3.UnitZ * (float)-((double)num5 + (double)val2); return(Matrix.CreateWorld(position, Vector3.Normalize(-position), Vector3.UnitY)); } double num6 = (double)vector3_2.Normalize(); IEnumerable <OrbitalObjectInfo> moons = app.GameDatabase.GetMoons(num3); if (moons.Count <OrbitalObjectInfo>() > 0) { float num4 = 5000f; Vector3 vector3_3 = Vector3.Zero; Vector3 forward = -Vector3.UnitZ; int num5 = 0; float num7 = 0.0f; foreach (OrbitalObjectInfo orbitalObjectInfo in moons) { PlanetInfo planetInfo = app.GameDatabase.GetPlanetInfo(orbitalObjectInfo.ID); if (planetInfo != null) { Matrix orbitalTransform = app.GameDatabase.GetOrbitalTransform(orbitalObjectInfo.ID); float lengthSquared = orbitalTransform.Position.LengthSquared; if ((double)lengthSquared > (double)num7) { num7 = lengthSquared; vector3_3 = orbitalTransform.Position; forward = -orbitalTransform.Position; num4 = StarSystemVars.Instance.SizeToRadius(planetInfo.Size) + val2; num5 = orbitalObjectInfo.ID; } } } if (num5 != 0) { Vector3 vector3_4 = Vector3.Normalize(vector3_3 - vector3_1); if ((double)Vector3.Dot(vector3_4, vector3_2) > 0.0) { double num8 = (double)forward.Normalize(); return(Matrix.CreateWorld(vector3_3 - forward * (num4 + val2), forward, Vector3.UnitY)); } Vector3 v0 = Vector3.Cross(vector3_2, Vector3.UnitY); float num9 = (double)Vector3.Dot(v0, vector3_4) > 0.0 ? 1f : -1f; return(Matrix.CreateWorld(vector3_3 + v0 * ((num4 + val2) * num9), forward, Vector3.UnitY)); } } Vector3 position1 = vector3_1 - vector3_2 * num2; if (starSystem != null) { Vector3 forward = -Vector3.UnitZ; float num4 = -1f; foreach (Ship ship in starSystem.GetStationsAroundPlanet(num3)) { Vector3 v0 = vector3_1 - ship.Maneuvering.Position; double num5 = (double)v0.Normalize(); float num7 = Vector3.Dot(v0, vector3_2); if ((double)num7 > 0.75 && (double)num7 > (double)num4) { num4 = num7; forward = v0; } } if ((double)num4 > 0.0) { Matrix world = Matrix.CreateWorld(Vector3.Zero, forward, Vector3.UnitY); Vector3 vector3_3 = vector3_1 + world.Right * num2; Vector3 vector3_4 = vector3_1 - world.Right * num2; vector3_2 = (double)(position1 - vector3_3).LengthSquared >= (double)(position1 - vector3_4).LengthSquared ? (forward - world.Right) * 0.5f : (forward + world.Right) * 0.5f; double num5 = (double)vector3_2.Normalize(); position1 = vector3_1 - vector3_2 * num2; } } return(Matrix.CreateWorld(position1, vector3_2, Vector3.UnitY)); }