public void AddFactionRelationChange(MyMwcObjectBuilder_FactionEnum faction1, MyMwcObjectBuilder_FactionEnum faction2, float relation) { Debug.Assert(Enum.IsDefined(typeof(MyMwcObjectBuilder_FactionEnum), faction1)); Debug.Assert(Enum.IsDefined(typeof(MyMwcObjectBuilder_FactionEnum), faction2)); int key = (int)faction1 + (int)faction2; m_factionRelationChanges[key] = relation; }
private static bool HasFactionShouts(MyMwcObjectBuilder_FactionEnum faction) { int factionKey = (int)faction; List <MySoundCuesEnum> factionShouts = GetShouts(faction); return(factionShouts != null && factionShouts.Count > 0); }
public MyPlayer() { MaxHealth = Health = DEFAULT_PLAYER_MAX_HEALTH; Statistics = new MyPlayerStatistics(); Faction = MyMwcObjectBuilder_FactionEnum.Rainiers; Medicines = MyMedicine.GetArrayOfAllMedicines(); }
static void MyFactions_OnFactionStatusChanged(MyMwcObjectBuilder_FactionEnum faction1, MyMwcObjectBuilder_FactionEnum faction2, MyFactionRelationEnum previousRelation, bool display, bool save) { if (!display) { return; } MyTextsWrapperEnum relationChangeEnum = MyTextsWrapperEnum.General; MyFactionRelationEnum newRelation = MyFactions.GetFactionsRelation(faction1, faction2); switch (newRelation) { case MyFactionRelationEnum.Friend: relationChangeEnum = MyTextsWrapperEnum.GlobalEventFactionRelationChange_NeutralToFriends; break; case MyFactionRelationEnum.Neutral: if (previousRelation == MyFactionRelationEnum.Friend) { relationChangeEnum = MyTextsWrapperEnum.GlobalEventFactionRelationChange_FriendsToNeutral; } else { relationChangeEnum = MyTextsWrapperEnum.GlobalEventFactionRelationChange_EnemyToNeutral; } break; case MyFactionRelationEnum.Enemy: relationChangeEnum = MyTextsWrapperEnum.GlobalEventFactionRelationChange_NeutralToEnemy; break; } MyHudNotification.AddNotification(new MyHudNotification.MyNotification(relationChangeEnum, 5000, null, new object[] { MyFactionConstants.GetFactionProperties(faction1).Name.ToString(), MyFactionConstants.GetFactionProperties(faction2).Name.ToString() })); }
public MyMwcObjectBuilder_FactionEnum ChooseFaction(MyMwcObjectBuilder_FactionEnum preferredFaction = MyMwcObjectBuilder_FactionEnum.None) { if (IsStory()) { Debug.Assert(IsHost); return(MySession.Static.Player.Faction); } else { m_factions.Clear(); foreach (var k in m_respawnPoints) { m_factions[k.Key] = 0; } foreach (var p in Peers.Players) { if (m_factions.ContainsKey((int)p.Faction)) { m_factions[(int)p.Faction]++; } } if (m_factions.ContainsKey((int)MySession.Static.Player.Faction)) { m_factions[(int)MySession.Static.Player.Faction]++; } m_possibleFactionCache.Clear(); int minFactionCount = int.MaxValue; foreach (var f in m_factions) { if (f.Value < minFactionCount) { m_possibleFactionCache.Clear(); m_possibleFactionCache.Add(f.Key); minFactionCount = f.Value; } else if (f.Value == minFactionCount) { m_possibleFactionCache.Add(f.Key); } } if (m_possibleFactionCache.Contains((int)preferredFaction)) { return(preferredFaction); } else if (m_possibleFactionCache.Count > 0) { return((MyMwcObjectBuilder_FactionEnum)MyMwcUtils.GetRandomItem(m_possibleFactionCache)); } else { return(MyMwcObjectBuilder_FactionEnum.Euroamerican); // Default faction } } }
public MyActorProperties(MyTextsWrapperEnum displayName, MyTexture2D avatarImage, MyTexture2D icon, MyMwcObjectBuilder_FactionEnum faction, string name = null) { Name = name; DisplayName = displayName; AvatarImage = avatarImage; Icon = icon; Faction = faction; }
public MyPlayerRemote(StringBuilder displayName, int userId, byte playerId) : base(displayName, userId) { PlayerId = playerId; UserId = userId; Statistics = new MyPlayerStatistics(); Faction = MyMwcObjectBuilder_FactionEnum.None; }
private static List <MySoundCuesEnum> GetShouts(MyMwcObjectBuilder_FactionEnum faction) { if (m_shouts.ContainsKey((int)faction)) { return(m_shouts[(int)faction]); } return(null); }
public MyMwcObjectBuilder_Drone( MyMwcObjectBuilder_Drone_TypesEnum droneType = MyMwcObjectBuilder_Drone_TypesEnum.DroneUS, MyMwcObjectBuilder_FactionEnum faction = MyMwcObjectBuilder_FactionEnum.None) : this() { DroneType = droneType; Faction = faction; }
public void SendFaction(MyMwcObjectBuilder_FactionEnum faction) { Log("Set faction: " + MyFactionConstants.GetFactionProperties(faction).Name); var factionMsg = new MyEventSetFaction(); factionMsg.Faction = faction; Peers.SendToAll(ref factionMsg, NetDeliveryMethod.ReliableOrdered); }
public MyMwcObjectBuilder_Drone( MyMwcObjectBuilder_Drone_TypesEnum droneType = MyMwcObjectBuilder_Drone_TypesEnum.DroneUS, MyMwcObjectBuilder_FactionEnum faction = MyMwcObjectBuilder_FactionEnum.None) :this() { DroneType = droneType; Faction = faction; }
public void SendSetActorFaction(MyActorEnum actor, MyMwcObjectBuilder_FactionEnum faction) { var msg = new MyEventSetActorFaction(); msg.ActorId = (int)actor; msg.Faction = faction; Peers.SendToAll(ref msg, NetDeliveryMethod.ReliableOrdered); }
public void RequestFaction(MyMwcObjectBuilder_FactionEnum preferredFaction) { Log("Choose faction"); var msg = new MyEventChooseFaction(); msg.PreferredFaction = preferredFaction; Peers.SendHost(ref msg); }
private static void AddActorsShouts(MyMwcObjectBuilder_FactionEnum faction, MySoundCuesEnum shoutCue) { if (!m_shouts.ContainsKey((int)faction)) { m_shouts.Add((int)faction, new List <MySoundCuesEnum>()); } m_shouts[(int)faction].Add(shoutCue); }
void MyFactions_OnFactionStatusChanged(MyMwcObjectBuilder_FactionEnum faction1, MyMwcObjectBuilder_FactionEnum faction2, MyFactionRelationEnum previousRelation, bool display, bool save) { if (!save) { return; } float relation = MyFactions.GetFactionsStatus(faction1, faction2); AddFactionRelationChange(faction1, faction2, relation); }
public MyMwcObjectBuilder_PrefabContainer(int? templateId, MyMwcObjectBuilder_PrefabContainer_TypesEnum containerType, List<MyMwcObjectBuilder_PrefabBase> prefabs, int userOwnerID, MyMwcObjectBuilder_FactionEnum faction, MyMwcObjectBuilder_Inventory inventory) { TemplateId = templateId; ContainerType = containerType; Prefabs = prefabs; UserOwnerID = userOwnerID; Faction = faction; Inventory = inventory; }
public MyMwcObjectBuilder_PrefabContainer(int?templateId, MyMwcObjectBuilder_PrefabContainer_TypesEnum containerType, List <MyMwcObjectBuilder_PrefabBase> prefabs, int userOwnerID, MyMwcObjectBuilder_FactionEnum faction, MyMwcObjectBuilder_Inventory inventory) { TemplateId = templateId; ContainerType = containerType; Prefabs = prefabs; UserOwnerID = userOwnerID; Faction = faction; Inventory = inventory; }
public static void SetActorFaction(MyActorEnum id, MyMwcObjectBuilder_FactionEnum newFaction) { var actorProperties = GetActorProperties(id); if (actorProperties == null) { return; } actorProperties.Faction = newFaction; }
public void SendSetFactionRelation(MyMwcObjectBuilder_FactionEnum factionA, MyMwcObjectBuilder_FactionEnum factionB, float relation) { var msg = new MyEventSetFactionRelation(); msg.FactionA = factionA; msg.FactionB = factionB; msg.Relation = relation; Peers.SendToAll(ref msg, NetDeliveryMethod.ReliableOrdered); }
public void Start(MySmallShipBot bot) { m_bot = bot; m_botFaction = bot.Faction; m_seeDistance = bot.SeeDistance; m_botWorldMatrix = bot.WorldMatrix; m_position = bot.GetPosition(); m_closestEnemy_OnClose = closestEnemy_OnClose; m_closestVisual_OnClose = closestVisual_OnClose; m_bot.OnClose += m_bot_OnClose; }
public void SendSetEntityFaction(MyEntity entity, MyMwcObjectBuilder_FactionEnum faction) { Debug.Assert(entity.EntityId.HasValue, "Entity must have id"); var msg = new MyEventSetEntityFaction(); msg.Faction = faction; msg.EntityId = entity.EntityId.Value.NumericValue; Peers.SendToAll(ref msg, NetDeliveryMethod.ReliableOrdered); }
private static MySoundCuesEnum GetRandomShout(MyMwcObjectBuilder_FactionEnum faction) { int index; List <MySoundCuesEnum> shouts = GetShouts(faction); do { index = MyMwcUtils.GetRandomInt(shouts.Count); } while (m_lastShoutCue.HasValue && shouts.Count > 1 && m_lastShoutCue.Value == shouts[index]); return(shouts[index]); }
public override void OnOkClick(MyGuiControlButton sender) { base.OnOkClick(sender); Debug.Assert(m_radiusSlider.GetValue() > 30 || m_bots.Count <= 1, "Spawnpoint radius is too small, you will probably get failed spawn attempts!"); if (!HasEntity()) { MyMwcObjectBuilder_SpawnPoint builder = MyMwcObjectBuilder_Base.CreateNewObject(MyMwcObjectBuilderTypeEnum.SpawnPoint, null) as MyMwcObjectBuilder_SpawnPoint; builder.BoundingRadius = m_radiusSlider.GetValue(); float cameraDistance = builder.BoundingRadius / (float)Math.Sin(MathHelper.ToRadians(MyCamera.FieldOfViewAngle / 2)) * 1.2f; m_spawnPoint = MyEntities.CreateFromObjectBuilderAndAdd(null, builder, Matrix.CreateWorld(MyCamera.Position + cameraDistance * MyCamera.ForwardVector, Vector3.Forward, Vector3.Up)) as MySpawnPoint; } MyMwcObjectBuilder_FactionEnum shipFaction = (MyMwcObjectBuilder_FactionEnum) Enum.ToObject(typeof(MyMwcObjectBuilder_FactionEnum), m_selectShipFactionCombobox.GetSelectedKey()); List <BotTemplate> templates = new List <BotTemplate>(); foreach (int key in m_bots.Keys) { BotTemplate btmp; m_bots.TryGetValue(key, out btmp); btmp.m_builder.Faction = shipFaction; templates.Add(btmp); } m_spawnPoint.SpawnInGroups = m_spawnInGroupsCheckbox.Checked; m_spawnPoint.LeftToSpawn = GetSpawnCount(); m_spawnPoint.MaxSpawnCount = m_spawnPoint.LeftToSpawn; m_spawnPoint.FirstSpawnTimer = m_firstSpawnTimeSlider.GetValue(); m_spawnPoint.RespawnTimer = m_respawnTimeSlider.GetValue(); m_spawnPoint.Faction = shipFaction; m_spawnPoint.SetWayPointPath(m_waypointPathCombobox.GetSelectedValue().ToString()); m_spawnPoint.PatrolMode = (MyPatrolMode)m_patrolModeCombobox.GetSelectedKey(); m_spawnPoint.ApplyBotTemplates(templates); m_spawnPoint.BoundingSphereRadius = m_radiusSlider.GetValue(); if (m_activeCheckbox.Checked && !m_spawnPoint.IsActive()) { m_spawnPoint.Activate(); } else if (!m_activeCheckbox.Checked && m_spawnPoint.IsActive()) { m_spawnPoint.Deactivate(); } MyGuiManager.CloseAllScreensExcept(MyGuiScreenGamePlay.Static); }
private void SendChatMessage(string message, MyMwcObjectBuilder_FactionEnum? senderFaction) { MyEventChat msg = new MyEventChat(); msg.Message = message; if (senderFaction.HasValue) { Peers.SendToTeam(ref msg, senderFaction.Value, NetDeliveryMethod.ReliableUnordered); } else { Peers.SendToAll(ref msg, NetDeliveryMethod.ReliableUnordered); } }
public static MyGuiHelperBase GetMyGuiSmallShipFactionNationality(MyMwcObjectBuilder_FactionEnum shipFaction) { MyGuiHelperBase ret; if (m_shipFactionNationality.TryGetValue((int)shipFaction, out ret)) { return(ret); } else { return(null); } }
internal MyMwcObjectBuilder_SpawnPoint() : base() { SpawnInGroups = false; SpawnCount = -1; FirstSpawnTimer = 1.0f; RespawnTimer = 1.0f; BoundingRadius = 1.0f; ShipTemplates = new List <MyMwcObjectBuilder_SmallShip_Bot>(); Faction = MyMwcObjectBuilder_FactionEnum.China; WayPointPath = "None"; Activated = true; PatrolMode = MyPatrolMode.CYCLE; }
internal MyMwcObjectBuilder_SpawnPoint() : base() { SpawnInGroups = false; SpawnCount = -1; FirstSpawnTimer = 1.0f; RespawnTimer = 1.0f; BoundingRadius = 1.0f; ShipTemplates = new List<MyMwcObjectBuilder_SmallShip_Bot>(); Faction = MyMwcObjectBuilder_FactionEnum.China; WayPointPath = "None"; Activated = true; PatrolMode = MyPatrolMode.CYCLE; }
public int GetFactionPlayerCount(MyMwcObjectBuilder_FactionEnum faction) { int count = 0; foreach (var p in Peers.Players) { if (p.Faction == faction) { count++; } } if (MySession.Static.Player.Faction == faction) { count++; } return(count); }
public static void MakeEnemy(MyMwcObjectBuilder_FactionEnum shipFaction) { // Order bots to kill player foreach (var bot in MyBotCoordinator.GetBots()) { var relation = MyFactions.GetFactionsRelation(shipFaction, bot.Faction); if (relation == MyFactionRelationEnum.Friend || relation == MyFactionRelationEnum.Neutral) { bot.Attack(MySession.PlayerShip); } } MyScriptWrapper.SetPlayerFaction(MyMwcObjectBuilder_FactionEnum.Freelancers); MyMissions.DisableSaveObjectives(); }
public static MyMwcObjectBuilder_SmallShip_Player CreateDefaultShip(MyMwcObjectBuilder_SmallShip_TypesEnum shipType, MyMwcObjectBuilder_FactionEnum faction, int maxItems) { var result = new MyMwcObjectBuilder_SmallShip_Player(shipType, new MyMwcObjectBuilder_Inventory( new List<MyMwcObjectBuilder_InventoryItem>() { new MyMwcObjectBuilder_InventoryItem(new MyMwcObjectBuilder_SmallShip_Ammo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Missile_Basic), 1000f), new MyMwcObjectBuilder_InventoryItem(new MyMwcObjectBuilder_SmallShip_Ammo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Missile_Basic), 1000f), new MyMwcObjectBuilder_InventoryItem(new MyMwcObjectBuilder_SmallShip_Ammo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Missile_Basic), 1000f), new MyMwcObjectBuilder_InventoryItem(new MyMwcObjectBuilder_SmallShip_Ammo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Autocannon_Basic), 1000f), new MyMwcObjectBuilder_InventoryItem(new MyMwcObjectBuilder_SmallShip_Ammo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Autocannon_Basic), 1000f), new MyMwcObjectBuilder_InventoryItem(new MyMwcObjectBuilder_SmallShip_Ammo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Autocannon_Basic), 1000f), new MyMwcObjectBuilder_InventoryItem(new MyMwcObjectBuilder_SmallShip_Ammo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Sniper_SAPHEI), 1000f), new MyMwcObjectBuilder_InventoryItem(new MyMwcObjectBuilder_SmallShip_Ammo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Sniper_SAPHEI), 1000f), new MyMwcObjectBuilder_InventoryItem(new MyMwcObjectBuilder_SmallShip_Ammo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Sniper_SAPHEI), 1000f), }, maxItems), new List<MyMwcObjectBuilder_SmallShip_Weapon>() { new MyMwcObjectBuilder_SmallShip_Weapon(MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Autocanon) { MountedDescriptor = MyMwcObjectBuilder_SmallShip_Weapon.LEFT_SIDE_MOUNT_DESCRIPTOR }, new MyMwcObjectBuilder_SmallShip_Weapon(MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Autocanon) { MountedDescriptor = MyMwcObjectBuilder_SmallShip_Weapon.RIGHT_SIDE_MOUNT_DESCRIPTOR }, new MyMwcObjectBuilder_SmallShip_Weapon(MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Sniper) { MountedDescriptor = MyMwcObjectBuilder_SmallShip_Weapon.AUTO_MOUNT_DESCRIPTOR }, new MyMwcObjectBuilder_SmallShip_Weapon(MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Missile_Launcher) { MountedDescriptor = MyMwcObjectBuilder_SmallShip_Weapon.AUTO_MOUNT_DESCRIPTOR }, }, new MyMwcObjectBuilder_SmallShip_Engine(MyMwcObjectBuilder_SmallShip_Engine_TypesEnum.PowerCells_3), new List<MyMwcObjectBuilder_AssignmentOfAmmo>() { new MyMwcObjectBuilder_AssignmentOfAmmo(MyMwcObjectBuilder_FireKeyEnum.Primary, MyMwcObjectBuilder_AmmoGroupEnum.Bullet, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Autocannon_Basic), new MyMwcObjectBuilder_AssignmentOfAmmo(MyMwcObjectBuilder_FireKeyEnum.Secondary, MyMwcObjectBuilder_AmmoGroupEnum.Missile, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Missile_Basic), new MyMwcObjectBuilder_AssignmentOfAmmo(MyMwcObjectBuilder_FireKeyEnum.Third, MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherFront, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Mine_Basic), new MyMwcObjectBuilder_AssignmentOfAmmo(MyMwcObjectBuilder_FireKeyEnum.Fourth, MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherBack, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Mine_Smart), new MyMwcObjectBuilder_AssignmentOfAmmo(MyMwcObjectBuilder_FireKeyEnum.Fifth, MyMwcObjectBuilder_AmmoGroupEnum.Bullet, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Autocannon_Basic), }, new MyMwcObjectBuilder_SmallShip_Armor(MyMwcObjectBuilder_SmallShip_Armor_TypesEnum.Advanced), new MyMwcObjectBuilder_SmallShip_Radar(MyMwcObjectBuilder_SmallShip_Radar_TypesEnum.Radar_1), null, 1f, float.MaxValue, float.MaxValue, float.MaxValue, float.MaxValue, true, false, 200, 0); result.Faction = faction; result.PositionAndOrientation = new MyMwcPositionAndOrientation(Matrix.Identity); return result; }
public MyMwcObjectBuilder_SmallShip_Bot(MyMwcObjectBuilder_SmallShip_TypesEnum shipType, MyMwcObjectBuilder_Inventory inventory, List <MyMwcObjectBuilder_SmallShip_Weapon> weapons, MyMwcObjectBuilder_SmallShip_Engine engine, List <MyMwcObjectBuilder_AssignmentOfAmmo> assignmentOfAmmo, MyMwcObjectBuilder_SmallShip_Armor armor, MyMwcObjectBuilder_SmallShip_Radar radar, float?shipMaxHealth, float shipHealthRatio, float armorHealth, float oxygen, float fuel, bool reflectorLight, bool reflectorLongRange, MyMwcObjectBuilder_FactionEnum shipFaction, MyAITemplateEnum aiTemplate, float aggressivity, float seeDistance, float sleepDistance, MyPatrolMode patrolMode, uint?leader, BotBehaviorType idleBehavior, float reflectorShadowDistance, int aiPriority, bool leaderLostEnabled, bool activeAI) : base(shipType, inventory, weapons, engine, assignmentOfAmmo, armor, radar, shipMaxHealth, shipHealthRatio, armorHealth, oxygen, fuel, reflectorLight, reflectorLongRange, reflectorShadowDistance, aiPriority) { Faction = shipFaction; AITemplate = aiTemplate; Aggressivity = aggressivity; SeeDistance = seeDistance; SleepDistance = sleepDistance; PatrolMode = patrolMode; Leader = leader; IdleBehavior = idleBehavior; LeaderLostEnabled = leaderLostEnabled; ActiveAI = activeAI; SlowDown = 1; }
public static void Update() { Debug.Assert(MyFakes.ENABLE_SHOUT); m_detectedEntities.Clear(); m_detectedFactions.Clear(); if (MySession.PlayerShip == null) { return; } if (MyDialogues.CurrentSentence != null && !MyDialogues.IsCurrentCuePausedAndHidden()) { StopShout(); return; } MyRadar.GetDetectedBotsAndLargeWeapons(ref m_detectedEntities); foreach (IMyObjectToDetect detectedObject in m_detectedEntities) { // check if detected object can shout if (CanShout(detectedObject)) { MyMwcObjectBuilder_FactionEnum factionForShout = GetFactionForShout((MyEntity)detectedObject); // we want add only factions which have any shout if (HasFactionShouts(factionForShout)) { // add this faction as detected if (!m_detectedFactions.Contains(factionForShout)) { m_detectedFactions.Add(factionForShout); } } } } UpdateShouts(); }
public void SendToTeam <T>(ref T multiplayerEvent, MyMwcObjectBuilder_FactionEnum senderFaction, NetDeliveryMethod delivery = NetDeliveryMethod.Unreliable, int sequenceChannel = 0, int maxSize = 512) where T : struct, IMyEvent { m_playerConnections.Clear(); foreach (var p in Players) { var connection = p.Connection; if (connection != null && MyFactions.GetFactionsRelation(p.Faction, senderFaction) == MyFactionRelationEnum.Friend) { if (connection is MyRelayedConnection) { m_peer.Send(ref multiplayerEvent, connection, delivery, sequenceChannel, maxSize); } else { m_playerConnections.Add(connection); } } } if (m_playerConnections.Count > 0) { m_peer.SendToAll(ref multiplayerEvent, m_playerConnections, delivery, sequenceChannel); } }
// Read this object from message-in internal override bool Read(BinaryReader binaryReader, EndPoint senderEndPoint, int gameVersion) { if (base.Read(binaryReader, senderEndPoint, gameVersion) == false) return NetworkError(); // Type ushort? type = MyMwcMessageIn.ReadUInt16Ex(binaryReader, senderEndPoint); if (type == null) return NetworkError(); Type = (MyDummyPointType)type.Value; MyMwcLog.IfNetVerbose_AddToLog("Type: " + Type); // Size Vector3? size = MyMwcMessageIn.ReadVector3FloatEx(binaryReader, senderEndPoint); if (size == null) return NetworkError(); Size = size.Value; MyMwcLog.IfNetVerbose_AddToLog("Size: " + Size.ToString()); // Dummy flags int? flagsResult = MyMwcMessageIn.ReadInt32Ex(binaryReader, senderEndPoint); if (!flagsResult.HasValue) return NetworkError(); this.DummyFlags = (MyDummyPointFlags)flagsResult.Value; MyMwcLog.IfNetVerbose_AddToLog("DummyFlags: " + this.DummyFlags); // Dummy flags Color? color = MyMwcMessageIn.ReadColorEx(binaryReader, senderEndPoint); if (!color.HasValue) return NetworkError(); this.Color = color.Value; MyMwcLog.IfNetVerbose_AddToLog("DummyColor: " + this.Color); // Argument Argument = MyMwcMessageIn.ReadFloat(binaryReader); // RespawnPointFaction int? respawnPointFaction = MyMwcMessageIn.ReadInt32Ex(binaryReader, senderEndPoint); if (!respawnPointFaction.HasValue) return NetworkError(); this.RespawnPointFaction = (MyMwcObjectBuilder_FactionEnum)respawnPointFaction.Value; MyMwcLog.IfNetVerbose_AddToLog("RespawnPointFaction: " + this.RespawnPointFaction); return true; }
public MyMwcObjectBuilder_FactionRelationChange(MyMwcObjectBuilder_FactionEnum faction1, MyMwcObjectBuilder_FactionEnum faction2, float relation) { Faction1 = faction1; Faction2 = faction2; Relation = relation; }
public static MyGuiHelperBase GetMyGuiSmallShipFactionNationality(MyMwcObjectBuilder_FactionEnum shipFaction) { MyGuiHelperBase ret; if (m_shipFactionNationality.TryGetValue((int)shipFaction, out ret)) return ret; else return null; }
public override void SetDefaultProperties() { base.SetDefaultProperties(); RespawnPointFaction = MyMwcObjectBuilder_FactionEnum.None; }
// Read this object from message-in internal override bool Read(BinaryReader binaryReader, EndPoint senderEndPoint, int gameVersion) { if (base.Read(binaryReader, senderEndPoint, gameVersion) == false) { return(NetworkError()); } // Type ushort?type = MyMwcMessageIn.ReadUInt16Ex(binaryReader, senderEndPoint); if (type == null) { return(NetworkError()); } Type = (MyDummyPointType)type.Value; MyMwcLog.IfNetVerbose_AddToLog("Type: " + Type); // Size Vector3?size = MyMwcMessageIn.ReadVector3FloatEx(binaryReader, senderEndPoint); if (size == null) { return(NetworkError()); } Size = size.Value; MyMwcLog.IfNetVerbose_AddToLog("Size: " + Size.ToString()); // Dummy flags int?flagsResult = MyMwcMessageIn.ReadInt32Ex(binaryReader, senderEndPoint); if (!flagsResult.HasValue) { return(NetworkError()); } this.DummyFlags = (MyDummyPointFlags)flagsResult.Value; MyMwcLog.IfNetVerbose_AddToLog("DummyFlags: " + this.DummyFlags); // Dummy flags Color?color = MyMwcMessageIn.ReadColorEx(binaryReader, senderEndPoint); if (!color.HasValue) { return(NetworkError()); } this.Color = color.Value; MyMwcLog.IfNetVerbose_AddToLog("DummyColor: " + this.Color); // Argument Argument = MyMwcMessageIn.ReadFloat(binaryReader); // RespawnPointFaction int?respawnPointFaction = MyMwcMessageIn.ReadInt32Ex(binaryReader, senderEndPoint); if (!respawnPointFaction.HasValue) { return(NetworkError()); } this.RespawnPointFaction = (MyMwcObjectBuilder_FactionEnum)respawnPointFaction.Value; MyMwcLog.IfNetVerbose_AddToLog("RespawnPointFaction: " + this.RespawnPointFaction); return(true); }
private void AddPlayer(StringBuilder name, int? ping, int deaths, int kills, byte id, MyMwcObjectBuilder_FactionEnum faction, bool isFaction = false){ if (faction == MyMwcObjectBuilder_FactionEnum.None) // Dont add players without factions return; if (!m_statsTableFactions.ContainsKey(faction)) { m_statsTableFactions.Add(faction, new MyFactionStats(faction)); } if (!isFaction) { m_statsTableFactions[faction] = new MyFactionStats(faction, m_statsTableFactions[faction].Kills+kills, m_statsTableFactions[faction].Deaths+deaths); } m_stats.Add(new MyStatsRow() { Name = isFaction? name : new StringBuilder(" ").Append(name), Ping = ping, Deaths = deaths, Kills = kills, Id = id, Faction = faction, IsFaction = isFaction }); }
private bool GetStats() { if (m_stats == null) { m_stats = new List<MyStatsRow>(); } m_stats.Clear(); if (m_statsTableFactions == null) { m_statsTableFactions = new Dictionary<MyMwcObjectBuilder_FactionEnum, MyFactionStats>(); } m_statsTableFactions.Clear(); m_statsListbox.RemoveAllRows(); //add player first m_playerFaction = MySession.Static.Player.Faction; m_playerId = MyEntityIdentifier.CurrentPlayerId; AddPlayer(MyClientServer.LoggedPlayer.GetDisplayName(), 0, MyClientServer.LoggedPlayer.Statistics.Deaths, MyClientServer.LoggedPlayer.Statistics.PlayersKilled, m_playerId, m_playerFaction); //add other players foreach (MyPlayerRemote player in MyMultiplayerPeers.Static.Players) { AddPlayer(player); } //Debug add random stuff //foreach (MinerWars.AppCode.Game.Entities.MyEntity entity in MinerWars.AppCode.Game.Entities.MyEntities.GetEntities()) //{ // //var bot = entity as MinerWars.AppCode.Game.Entities.MySmallShipBot; // //if (bot != null) // //{ // //AddPlayer(new StringBuilder("Bot"), null, 0, 0, 0, bot.Faction); // //} // AddPlayer(new StringBuilder(entity.GetType().Name), null, 0, 0, 0, entity.Faction); //} //add faction titles if (m_statsTableFactions.Count > 1) // No reason to display just one faction (ie Rainers or Freelancers) { foreach (KeyValuePair<MyMwcObjectBuilder_FactionEnum, MyFactionStats> faction in m_statsTableFactions) { AddPlayer(MyFactionConstants.GetFactionProperties(faction.Value.Faction).Name, null, faction.Value.Deaths, faction.Value.Kills, (byte)faction.Value.Faction, faction.Value.Faction, true); } } // order m_stats.Sort(StatsRowComparer); AddHeaders(); foreach (MyStatsRow row in m_stats) { if (row.IsFaction) m_statsListbox.AddRow(); AddStatRowToListbox(row); } return true; }
// Read this object from message-in internal override bool Read(BinaryReader binaryReader, EndPoint senderEndPoint, int gameVersion) { if (base.Read(binaryReader, senderEndPoint, gameVersion) == false) { return(NetworkError()); } // NumberOfTemplates (why?) int?tempcount = MyMwcMessageIn.ReadInt32Ex(binaryReader, senderEndPoint); if (tempcount == null) { return(NetworkError()); } m_numberOfTemplates = tempcount.Value; MyMwcLog.IfNetVerbose_AddToLog("NumberOfTemplates: " + m_numberOfTemplates); // Bot Templates for (int c = 0; c < m_numberOfTemplates; c++) { MyMwcObjectBuilder_SmallShip_Bot nb = MyMwcObjectBuilder_Base.ReadAndCreateNewObject(binaryReader, senderEndPoint) as MyMwcObjectBuilder_SmallShip_Bot; if (nb == null || nb.Read(binaryReader, senderEndPoint, gameVersion) == false) { return(NetworkError()); } ShipTemplates.Add(nb); } // WayPointPath string pWPP = MyMwcMessageIn.ReadStringEx(binaryReader, senderEndPoint); if (pWPP == null) { return(NetworkError()); } WayPointPath = pWPP; MyMwcLog.IfNetVerbose_AddToLog("WayPointPath: " + WayPointPath); // Faction int?pFaction = MyMwcMessageIn.ReadInt32Ex(binaryReader, senderEndPoint); if (pFaction == null) { return(NetworkError()); } Faction = (MyMwcObjectBuilder_FactionEnum)pFaction.Value; MyMwcLog.IfNetVerbose_AddToLog("Faction: " + Faction); // SpawnInGroups bool?spawnInGroups = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint); if (spawnInGroups == null) { return(NetworkError()); } SpawnInGroups = spawnInGroups.Value; MyMwcLog.IfNetVerbose_AddToLog("SpawnInGroups: " + SpawnInGroups); // SpawnCount int?spawnCount = MyMwcMessageIn.ReadInt32Ex(binaryReader, senderEndPoint); if (spawnCount == null) { return(NetworkError()); } SpawnCount = spawnCount.Value; MyMwcLog.IfNetVerbose_AddToLog("SpawnCount: " + SpawnCount); // FirstSpawnTimer float?firstSpawnTimer = MyMwcMessageIn.ReadFloat(binaryReader); if (firstSpawnTimer == null) { return(NetworkError()); } FirstSpawnTimer = firstSpawnTimer.Value; MyMwcLog.IfNetVerbose_AddToLog("FirstSpawnTimer: " + FirstSpawnTimer); // RespawnTimer float?respawnTimer = MyMwcMessageIn.ReadFloat(binaryReader); if (respawnTimer == null) { return(NetworkError()); } RespawnTimer = respawnTimer.Value; MyMwcLog.IfNetVerbose_AddToLog("RespawnTimer: " + RespawnTimer); // BoundingRadius float?pBR = MyMwcMessageIn.ReadFloat(binaryReader); if (pBR == null) { return(NetworkError()); } BoundingRadius = pBR.Value; MyMwcLog.IfNetVerbose_AddToLog("BoundingRadius: " + BoundingRadius); // Activated bool?activated = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint); if (activated == null) { return(NetworkError()); } Activated = activated.Value; MyMwcLog.IfNetVerbose_AddToLog("Activated: " + Activated); // Patrol mode int?patrolMode = MyMwcMessageIn.ReadByteEx(binaryReader, senderEndPoint); if (patrolMode == null) { return(NetworkError()); } PatrolMode = (MyPatrolMode)patrolMode.Value; MyMwcLog.IfNetVerbose_AddToLog("PatrolMode: " + PatrolMode); return(true); }
public MyMwcObjectBuilder_FalseId(MyMwcObjectBuilder_FactionEnum faction) : this(MyMwcFactionsByIndex.GetFactionIndex(faction)) { }
public void SendChatMessageToTeam(string message, MyMwcObjectBuilder_FactionEnum? senderFaction) { SendChatMessage(message, senderFaction); }
// Read this object from message-in internal override bool Read(BinaryReader binaryReader, EndPoint senderEndPoint, int gameVersion) { if (base.Read(binaryReader, senderEndPoint, gameVersion) == false) return NetworkError(); // TemplateId bool? isTemplateId = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint); if (isTemplateId == null) return NetworkError(); if (isTemplateId.Value) { TemplateId = MyMwcMessageIn.ReadInt32Ex(binaryReader, senderEndPoint); } else { TemplateId = null; } // Container Type MyMwcObjectBuilder_PrefabContainer_TypesEnum? containerType = MyMwcMessageIn.ReadObjectBuilderPrefabContainerTypesEnumEx(binaryReader, senderEndPoint); if (containerType == null) return NetworkError(); ContainerType = containerType.Value; MyMwcLog.IfNetVerbose_AddToLog("ContainerType: " + ContainerType); // Faction Faction = (MyMwcObjectBuilder_FactionEnum)MyMwcMessageIn.ReadInt32Ex(binaryReader, senderEndPoint); // Faction must be defined System.Diagnostics.Debug.Assert(Enum.IsDefined(typeof(MyMwcObjectBuilder_FactionEnum), Faction)); // Prefabs int? countPrefabs = MyMwcMessageIn.ReadInt32Ex(binaryReader, senderEndPoint); if (countPrefabs == null) return NetworkError(); MyMwcLog.IfNetVerbose_AddToLog("countPrefabs: " + countPrefabs); Prefabs = new List<MyMwcObjectBuilder_PrefabBase>(countPrefabs.Value); for (int i = 0; i < countPrefabs; i++) { MyMwcObjectBuilder_PrefabBase prefab = MyMwcObjectBuilder_Base.ReadAndCreateNewObject(binaryReader, senderEndPoint) as MyMwcObjectBuilder_PrefabBase; if (prefab == null) return NetworkError(); if (prefab.Read(binaryReader, senderEndPoint, gameVersion) == false) return NetworkError(); Prefabs.Add(prefab); } // Inventory bool? isInventory = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint); if (isInventory == null) return NetworkError(); if (isInventory.Value) { Inventory = MyMwcObjectBuilder_Base.ReadAndCreateNewObject(binaryReader, senderEndPoint) as MyMwcObjectBuilder_Inventory; if (Inventory == null) return NetworkError(); if (Inventory.Read(binaryReader, senderEndPoint, gameVersion) == false) return NetworkError(); } else { Inventory = null; } bool? hasDisplayName = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint); if (!hasDisplayName.HasValue) return NetworkError(); if (hasDisplayName.Value) { string displayName = MyMwcMessageIn.ReadStringEx(binaryReader, senderEndPoint); if (displayName == null) return NetworkError(); MyMwcLog.IfNetVerbose_AddToLog("DisplayName: " + displayName); DisplayName = displayName; } else { MyMwcLog.IfNetVerbose_AddToLog("DisplayName: " + "null"); DisplayName = null; } // Use Properties bool? hasUseProperties = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint); if (hasUseProperties == null) return NetworkError(); if (hasUseProperties.Value) { UseProperties = MyMwcObjectBuilder_Base.ReadAndCreateNewObject(binaryReader, senderEndPoint) as MyMwcObjectBuilder_EntityUseProperties; if (UseProperties == null) return NetworkError(); if (UseProperties.Read(binaryReader, senderEndPoint, gameVersion) == false) return NetworkError(); } else { UseProperties = null; } // Alarm On bool? alarmOn = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint); if (alarmOn == null) return NetworkError(); AlarmOn = alarmOn.Value; MyMwcLog.IfNetVerbose_AddToLog("AlarmOn: " + AlarmOn); // Refill time bool? refillTime = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint); if (refillTime == null) return NetworkError(); if (refillTime.Value) { RefillTime = MyMwcMessageIn.ReadInt32Ex(binaryReader, senderEndPoint); } else { RefillTime = null; } return true; }
// Read this object from message-in internal override bool Read(BinaryReader binaryReader, EndPoint senderEndPoint, int gameVersion) { if (base.Read(binaryReader, senderEndPoint, gameVersion) == false) return NetworkError(); // NumberOfTemplates (why?) int ?tempcount = MyMwcMessageIn.ReadInt32Ex(binaryReader, senderEndPoint); if (tempcount == null) return NetworkError(); m_numberOfTemplates = tempcount.Value; MyMwcLog.IfNetVerbose_AddToLog("NumberOfTemplates: " + m_numberOfTemplates); // Bot Templates for (int c = 0; c < m_numberOfTemplates; c++) { MyMwcObjectBuilder_SmallShip_Bot nb = MyMwcObjectBuilder_Base.ReadAndCreateNewObject(binaryReader, senderEndPoint) as MyMwcObjectBuilder_SmallShip_Bot; if (nb == null || nb.Read(binaryReader, senderEndPoint, gameVersion) == false) return NetworkError(); ShipTemplates.Add(nb); } // WayPointPath string pWPP = MyMwcMessageIn.ReadStringEx(binaryReader, senderEndPoint); if (pWPP == null) return NetworkError(); WayPointPath = pWPP; MyMwcLog.IfNetVerbose_AddToLog("WayPointPath: " + WayPointPath); // Faction int ?pFaction = MyMwcMessageIn.ReadInt32Ex(binaryReader, senderEndPoint); if (pFaction == null) return NetworkError(); Faction = (MyMwcObjectBuilder_FactionEnum)pFaction.Value; MyMwcLog.IfNetVerbose_AddToLog("Faction: " + Faction); // SpawnInGroups bool? spawnInGroups = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint); if (spawnInGroups == null) return NetworkError(); SpawnInGroups = spawnInGroups.Value; MyMwcLog.IfNetVerbose_AddToLog("SpawnInGroups: " + SpawnInGroups); // SpawnCount int? spawnCount = MyMwcMessageIn.ReadInt32Ex(binaryReader, senderEndPoint); if (spawnCount == null) return NetworkError(); SpawnCount = spawnCount.Value; MyMwcLog.IfNetVerbose_AddToLog("SpawnCount: " + SpawnCount); // FirstSpawnTimer float? firstSpawnTimer = MyMwcMessageIn.ReadFloat(binaryReader); if (firstSpawnTimer == null) return NetworkError(); FirstSpawnTimer = firstSpawnTimer.Value; MyMwcLog.IfNetVerbose_AddToLog("FirstSpawnTimer: " + FirstSpawnTimer); // RespawnTimer float? respawnTimer = MyMwcMessageIn.ReadFloat(binaryReader); if (respawnTimer == null) return NetworkError(); RespawnTimer = respawnTimer.Value; MyMwcLog.IfNetVerbose_AddToLog("RespawnTimer: " + RespawnTimer); // BoundingRadius float? pBR = MyMwcMessageIn.ReadFloat(binaryReader); if (pBR == null) return NetworkError(); BoundingRadius = pBR.Value; MyMwcLog.IfNetVerbose_AddToLog("BoundingRadius: " + BoundingRadius); // Activated bool? activated = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint); if (activated == null) return NetworkError(); Activated = activated.Value; MyMwcLog.IfNetVerbose_AddToLog("Activated: " + Activated); // Patrol mode int? patrolMode = MyMwcMessageIn.ReadByteEx(binaryReader, senderEndPoint); if (patrolMode == null) return NetworkError(); PatrolMode = (MyPatrolMode)patrolMode.Value; MyMwcLog.IfNetVerbose_AddToLog("PatrolMode: " + PatrolMode); return true; }
// Read this object from message-in internal override bool Read(BinaryReader binaryReader, EndPoint senderEndPoint, int gameVersion) { if (base.Read(binaryReader, senderEndPoint, gameVersion) == false) { return(NetworkError()); } // TemplateId bool?isTemplateId = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint); if (isTemplateId == null) { return(NetworkError()); } if (isTemplateId.Value) { TemplateId = MyMwcMessageIn.ReadInt32Ex(binaryReader, senderEndPoint); } else { TemplateId = null; } // Container Type MyMwcObjectBuilder_PrefabContainer_TypesEnum?containerType = MyMwcMessageIn.ReadObjectBuilderPrefabContainerTypesEnumEx(binaryReader, senderEndPoint); if (containerType == null) { return(NetworkError()); } ContainerType = containerType.Value; MyMwcLog.IfNetVerbose_AddToLog("ContainerType: " + ContainerType); // Faction Faction = (MyMwcObjectBuilder_FactionEnum)MyMwcMessageIn.ReadInt32Ex(binaryReader, senderEndPoint); // Faction must be defined System.Diagnostics.Debug.Assert(Enum.IsDefined(typeof(MyMwcObjectBuilder_FactionEnum), Faction)); // Prefabs int?countPrefabs = MyMwcMessageIn.ReadInt32Ex(binaryReader, senderEndPoint); if (countPrefabs == null) { return(NetworkError()); } MyMwcLog.IfNetVerbose_AddToLog("countPrefabs: " + countPrefabs); Prefabs = new List <MyMwcObjectBuilder_PrefabBase>(countPrefabs.Value); for (int i = 0; i < countPrefabs; i++) { MyMwcObjectBuilder_PrefabBase prefab = MyMwcObjectBuilder_Base.ReadAndCreateNewObject(binaryReader, senderEndPoint) as MyMwcObjectBuilder_PrefabBase; if (prefab == null) { return(NetworkError()); } if (prefab.Read(binaryReader, senderEndPoint, gameVersion) == false) { return(NetworkError()); } Prefabs.Add(prefab); } // Inventory bool?isInventory = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint); if (isInventory == null) { return(NetworkError()); } if (isInventory.Value) { Inventory = MyMwcObjectBuilder_Base.ReadAndCreateNewObject(binaryReader, senderEndPoint) as MyMwcObjectBuilder_Inventory; if (Inventory == null) { return(NetworkError()); } if (Inventory.Read(binaryReader, senderEndPoint, gameVersion) == false) { return(NetworkError()); } } else { Inventory = null; } bool?hasDisplayName = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint); if (!hasDisplayName.HasValue) { return(NetworkError()); } if (hasDisplayName.Value) { string displayName = MyMwcMessageIn.ReadStringEx(binaryReader, senderEndPoint); if (displayName == null) { return(NetworkError()); } MyMwcLog.IfNetVerbose_AddToLog("DisplayName: " + displayName); DisplayName = displayName; } else { MyMwcLog.IfNetVerbose_AddToLog("DisplayName: " + "null"); DisplayName = null; } // Use Properties bool?hasUseProperties = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint); if (hasUseProperties == null) { return(NetworkError()); } if (hasUseProperties.Value) { UseProperties = MyMwcObjectBuilder_Base.ReadAndCreateNewObject(binaryReader, senderEndPoint) as MyMwcObjectBuilder_EntityUseProperties; if (UseProperties == null) { return(NetworkError()); } if (UseProperties.Read(binaryReader, senderEndPoint, gameVersion) == false) { return(NetworkError()); } } else { UseProperties = null; } // Alarm On bool?alarmOn = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint); if (alarmOn == null) { return(NetworkError()); } AlarmOn = alarmOn.Value; MyMwcLog.IfNetVerbose_AddToLog("AlarmOn: " + AlarmOn); // Refill time bool?refillTime = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint); if (refillTime == null) { return(NetworkError()); } if (refillTime.Value) { RefillTime = MyMwcMessageIn.ReadInt32Ex(binaryReader, senderEndPoint); } else { RefillTime = null; } return(true); }
public static void SetActorFaction(MyActorEnum id, MyMwcObjectBuilder_FactionEnum newFaction) { var actorProperties = GetActorProperties(id); if (actorProperties == null) return; actorProperties.Faction = newFaction; }
public MyFactionStats(MyMwcObjectBuilder_FactionEnum faction) { Faction = faction; Kills = 0; Deaths = 0; }
public static MyMwcObjectBuilder_SmallShip_Player CreateObjectBuilderWithAllItems(MyMwcObjectBuilder_SmallShip_TypesEnum shipType, MyMwcObjectBuilder_FactionEnum faction, int maxInventoryItems) { List<MyMwcObjectBuilder_SmallShip_Weapon> weapons = new List<MyMwcObjectBuilder_SmallShip_Weapon>(); List<MyMwcObjectBuilder_AssignmentOfAmmo> ammoAssignment = new List<MyMwcObjectBuilder_AssignmentOfAmmo>(); List<MyMwcObjectBuilder_InventoryItem> inventoryItems = new List<MyMwcObjectBuilder_InventoryItem>(); // weapons foreach (MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum weapon in Enum.GetValues(typeof(MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum))) { var weaponBuilder = new MyMwcObjectBuilder_SmallShip_Weapon(weapon); weaponBuilder.SetAutoMount(); weapons.Add(weaponBuilder); // we want have 2x autocanon if (weapon == MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Autocanon) { var autocannonBuilder = new MyMwcObjectBuilder_SmallShip_Weapon(weapon); autocannonBuilder.SetAutoMount(); weapons.Add(autocannonBuilder); } } // ammo assignment ammoAssignment.Add(new MyMwcObjectBuilder_AssignmentOfAmmo(MyMwcObjectBuilder_FireKeyEnum.Primary, MyMwcObjectBuilder_AmmoGroupEnum.Bullet, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Autocannon_Basic)); ammoAssignment.Add(new MyMwcObjectBuilder_AssignmentOfAmmo(MyMwcObjectBuilder_FireKeyEnum.Secondary, MyMwcObjectBuilder_AmmoGroupEnum.Missile, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Missile_Basic)); ammoAssignment.Add(new MyMwcObjectBuilder_AssignmentOfAmmo(MyMwcObjectBuilder_FireKeyEnum.Third, MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherFront, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Mine_Basic)); ammoAssignment.Add(new MyMwcObjectBuilder_AssignmentOfAmmo(MyMwcObjectBuilder_FireKeyEnum.Fourth, MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherBack, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Mine_Smart)); ammoAssignment.Add(new MyMwcObjectBuilder_AssignmentOfAmmo(MyMwcObjectBuilder_FireKeyEnum.Fifth, MyMwcObjectBuilder_AmmoGroupEnum.Bullet, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Autocannon_Basic)); // inventory items // ammo foreach (MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum ammo in Enum.GetValues(typeof(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum))) { inventoryItems.Add(new MyMwcObjectBuilder_InventoryItem(new MyMwcObjectBuilder_SmallShip_Ammo(ammo), 1000f)); } // tools foreach (MyMwcObjectBuilder_SmallShip_Tool_TypesEnum tool in Enum.GetValues(typeof(MyMwcObjectBuilder_SmallShip_Tool_TypesEnum))) { inventoryItems.Add(new MyMwcObjectBuilder_InventoryItem(new MyMwcObjectBuilder_SmallShip_Tool(tool), 1f)); } // radars foreach (MyMwcObjectBuilder_SmallShip_Radar_TypesEnum radar in Enum.GetValues(typeof(MyMwcObjectBuilder_SmallShip_Radar_TypesEnum))) { inventoryItems.Add(new MyMwcObjectBuilder_InventoryItem(new MyMwcObjectBuilder_SmallShip_Radar(radar), 1f)); } // engines foreach (MyMwcObjectBuilder_SmallShip_Engine_TypesEnum engine in Enum.GetValues(typeof(MyMwcObjectBuilder_SmallShip_Engine_TypesEnum))) { if (engine != MyMwcObjectBuilder_SmallShip_Engine_TypesEnum.PowerCells_1) { inventoryItems.Add(new MyMwcObjectBuilder_InventoryItem(new MyMwcObjectBuilder_SmallShip_Engine(engine), 1f)); } } // armors foreach (MyMwcObjectBuilder_SmallShip_Armor_TypesEnum armor in Enum.GetValues(typeof(MyMwcObjectBuilder_SmallShip_Armor_TypesEnum))) { if (armor != MyMwcObjectBuilder_SmallShip_Armor_TypesEnum.Basic) { inventoryItems.Add(new MyMwcObjectBuilder_InventoryItem(new MyMwcObjectBuilder_SmallShip_Armor(armor), 1f)); } } // foundation factory var foundationFactory = new MyMwcObjectBuilder_PrefabFoundationFactory(); foundationFactory.PrefabHealthRatio = 1f; foundationFactory.PrefabMaxHealth = null; inventoryItems.Add(new MyMwcObjectBuilder_InventoryItem(foundationFactory, 1f)); inventoryItems.RemoveAll(x => MyMwcObjectBuilder_InventoryItem.IsDisabled(x)); if (inventoryItems.Count > maxInventoryItems) { inventoryItems = inventoryItems.GetRange(0, maxInventoryItems); } MyMwcObjectBuilder_SmallShip_Player builder = new MyMwcObjectBuilder_SmallShip_Player( shipType, new MyMwcObjectBuilder_Inventory(inventoryItems, maxInventoryItems), weapons, new MyMwcObjectBuilder_SmallShip_Engine(MyMwcObjectBuilder_SmallShip_Engine_TypesEnum.PowerCells_1), ammoAssignment, new MyMwcObjectBuilder_SmallShip_Armor(MyMwcObjectBuilder_SmallShip_Armor_TypesEnum.Basic), new MyMwcObjectBuilder_SmallShip_Radar(MyMwcObjectBuilder_SmallShip_Radar_TypesEnum.Radar_1), null, 1f, float.MaxValue, float.MaxValue, float.MaxValue, float.MaxValue, true, false, 200f, 0); builder.Faction = faction; return builder; }
public MyFactionStats(MyMwcObjectBuilder_FactionEnum faction, int kills, int deaths) { Faction = faction; Kills = kills; Deaths = deaths; }