public MissionLogEventGroupInitInfo(MissionLogEventHeader header) : base(header) { GroupId = RawParameters.GetInt("GID"); ObjectIds = Util.SequenceToIntArray(RawParameters.GetString("IDS")); LeaderId = RawParameters.GetInt("LID"); }
public MissionLogEventInfluenceAreaInfo(MissionLogEventHeader header) : base(header) { var country = new Country(RawParameters.GetInt("COUNTRY")); var coalition = Server.CoalitionIndexes.FirstOrDefault(c => c.Country.Id == country.Id); int coalitionIndex = 0; if (coalition != null) { coalitionIndex = coalition.Index; } var id = RawParameters.GetInt("AID"); var existingArea = Server.Areas[id]; if (existingArea != null) { Server.Areas[id].Country = country; Server.Areas[id].Coalition = coalitionIndex; Server.Areas[id].IsEnabled = RawParameters.GetInt("ENABLED") == 1 ? true : false; Area = Server.Areas[id]; } else { Area = new Area(RawParameters.GetInt("AID"), country, RawParameters.GetInt("ENABLED") == 1 ? true : false) { Coalition = coalition.Index, }; } PlanesByCoalition = new List <CoalitionPlanesCount>(); var planesNumber = Util.SequenceToIntArray(RawParameters.GetString("BC")); }
public MissionLogEventObjectiveCompleted(MissionLogEventHeader header) : base(header) { ObjectiveId = RawParameters.GetInt("OBJID"); Position = RawParameters.GetVector3D("POS"); IsPrimary = RawParameters.GetInt("TYPE") == 1 ? true : false; CoalitionIndex = RawParameters.GetInt("COAL"); IsCompleted = RawParameters.GetInt("RES") == 1 ? true : false; }
public MissionLogEventAirfieldInfo(MissionLogEventHeader header) : base(header) { AirField = new AirField() { Country = new Country(RawParameters.GetInt("COUNTRY")), Id = RawParameters.GetInt("AID"), Position = RawParameters.GetVector3D("POS"), }; }
public MissionLogEject(MissionLogEventHeader header) : base(header) { Position = RawParameters.GetVector3D("POS"); var area = Server.Areas.FindAreaByPos(RawParameters.GetVector3D("POS")); Player = Server.Players[RawParameters.GetInt("PARENTID")] ?? Server.Players[RawParameters.GetInt("BOTID")]; if (Player != null && area != null) { IsFriendlyArea = area.Coalition == Player.CoalitionIndex; } }
public MissionLogEventPlayerAmmo(MissionLogEventHeader header) : base(header) { PlaneId = RawParameters.GetInt("PLID"); PlayerId = RawParameters.GetInt("PID"); Bullets = RawParameters.GetInt("BUL"); Shells = RawParameters.GetInt("SH"); Bombs = RawParameters.GetInt("BOMB"); Rockets = RawParameters.GetInt("RCT"); Player = Server.Players[PlaneId] ?? Server.Players[PlayerId]; //if (Player == null) // Bot = Server.GameObjects[PlaneId]; }
public MissionLogEventLanding(MissionLogEventHeader header) : base(header) { PlayerId = RawParameters.GetInt("PID"); Position = RawParameters.GetVector3D("POS"); Player = Server.Players[PlayerId]; if (Player == null) { Bot = Server.GameObjects[PlayerId]; } else { Player.IsInAir = false; } }
public MissionLogEventStart(MissionLogEventHeader header) : base(header) { //TODO: handle DateTime type var gameDate = Regex.Match(RawParameters.GetString("GDate"), @"(\d+)\.(\d+)\.(\d+)"); var gameTime = Regex.Match(RawParameters.GetString("GTime"), @"(\d+)\:(\d+)\:(\d+)"); if (gameDate.Success && gameTime.Success) { GameDateTime = new DateTime( int.Parse(gameDate.Groups[1].Value), int.Parse(gameDate.Groups[2].Value), int.Parse(gameDate.Groups[3].Value), int.Parse(gameTime.Groups[1].Value), int.Parse(gameTime.Groups[2].Value), int.Parse(gameTime.Groups[3].Value)); } MissionFile = RawParameters.GetString("MFile"); MissionID = RawParameters.GetString("MID"); GameType = RawParameters.GetInt("GType"); Mods = RawParameters.GetInt("MODS"); Preset = RawParameters.GetInt("Preset"); AQMId = RawParameters.GetInt("AWMID"); SettingsFlags = RawParameters.GetString("SETTS"); var coalitions = RawParameters.GetString("CNTRS"); var countryPairs = coalitions.Split(',').Select(p => p.Split(':')).ToArray(); CoalitionIndexes = new List <CoalitionIndex>(); int country, index; for (int i = 0; i < countryPairs.Length; i++) { if (countryPairs[i].Length == 2 && int.TryParse(countryPairs[i][0], out country) && int.TryParse(countryPairs[i][1], out index)) { CoalitionIndexes.Add(new CoalitionIndex() { Country = new Country(country), Index = index, }); } } }
public MissionLogEventHit(MissionLogEventHeader header) : base(header) { AttackerId = RawParameters.GetInt("AID"); TargetId = RawParameters.GetInt("TID"); AmmoName = RawParameters.GetString("AMMO"); AttackerPlayer = Server.Players[AttackerId]; if (AttackerPlayer == null) { AttackerObject = Server.GameObjects[AttackerId]; } TargetPlayer = Server.Players[TargetId]; if (TargetPlayer == null) { TargetObject = Server.GameObjects[TargetId]; } }
public MissionLogEventInfluenceAreaBoundary(MissionLogEventHeader header) : base(header) { var id = RawParameters.GetInt("AID"); var existingArea = Server.Areas[id]; if (existingArea != null) { Server.Areas[id].SetBoundaries(RawParameters.GetVectorArray("BP")); Area = Server.Areas[id]; } else { Area = new Area(RawParameters.GetVectorArray("BP")) { Id = RawParameters.GetInt("AID") }; } }
public MissionLogEventDamage(MissionLogEventHeader header) : base(header) { AttackerId = RawParameters.GetInt("AID"); TargetId = RawParameters.GetInt("TID"); Damage = RawParameters.GetDouble("DMG"); Position = RawParameters.GetVector3D("POS"); AttackerPlayer = Server.Players[AttackerId]; if (AttackerPlayer == null) { AttackerObject = Server.GameObjects[AttackerId]; } TargetPlayer = Server.Players[TargetId]; if (TargetPlayer == null) { TargetObject = Server.GameObjects[TargetId]; } }
public MissionLogRemoveBot(MissionLogEventHeader header) : base(header) { Position = RawParameters.GetVector3D("POS"); var area = Server.Areas.FindAreaByPos(RawParameters.GetVector3D("POS")); Player = Server.Players[RawParameters.GetInt("BOTID")]; if (area != null) { if (Player == null) { Bot = Server.GameObjects[RawParameters.GetInt("BOTID")]; IsFriendlyArea = area.Coalition == Bot.CoalitionIndex; } else { IsFriendlyArea = area.Coalition == Player.CoalitionIndex; } } }
public MissionLogEventGameObjectSpawn(MissionLogEventHeader header) : base(header) { GameObjectItem purpose; GameInfo.ObjectsClassification.TryGetValue(RawParameters.GetString("TYPE"), out purpose); if (purpose == null) { purpose = new GameObjectItem(GameObjectClass.Other, "Unknown"); } Object = new GameObject(RawParameters.GetInt("ID"), RawParameters.GetString("TYPE")) { Classification = purpose.Classification.ToString("g"), Purpose = purpose.Purpose, Country = new Country(RawParameters.GetInt("COUNTRY")), }; Object.CoalitionIndex = Server.GetCoalitionIndex(Object.Country); PlayerId = RawParameters.GetInt("PID"); }
public MissionLogEventPlaneSpawn(MissionLogEventHeader header) : base(header) { GameObjectItem purpose; GameInfo.ObjectsClassification.TryGetValue(RawParameters.GetString("TYPE"), out purpose); if (purpose == null) { purpose = new GameObjectItem(GameObjectClass.Other, "Unknown"); } Player = new Player() { Id = RawParameters.GetInt("PID"), Country = new Country(RawParameters.GetInt("COUNTRY")), IsInAir = RawParameters.GetInt("INAIR") == 0 ? true : false, IsOnline = true, LoginId = RawParameters.GetGuid("LOGIN"), NickId = RawParameters.GetGuid("IDS"), NickName = RawParameters.GetString("NAME"), Plane = new Plane(RawParameters.GetInt("PLID"), RawParameters.GetString("TYPE")) { Bullets = RawParameters.GetInt("BUL"), Bombs = RawParameters.GetInt("BOMB"), Classification = GameObjectClass.Plane.ToString("g"), Fuel = RawParameters.GetDouble("FUEL"), Payload = RawParameters.GetString("PAYLOAD"), Purpose = purpose == null ? null : purpose.Purpose, Shells = RawParameters.GetInt("SH"), Skin = RawParameters.GetString("SKIN"), WeaponMods = RawParameters.GetString("WM"), }, BotPilot = new GameObject(RawParameters.GetInt("PID"), "BotPilot"), SortieId = EventID, }; Player.CoalitionIndex = Server.GetCoalitionIndex(Player.Country); Server.Players.PlayerSpawn(Player); }
public MissionLogEventKill(MissionLogEventHeader header) : base(header) { AttackerId = RawParameters.GetInt("AID"); TargetId = RawParameters.GetInt("TID"); Position = RawParameters.GetVector3D("POS"); AttackerPlayer = Server.Players[AttackerId]; AttackerObject = Server.GameObjects[AttackerId]; TargetPlayer = Server.Players[TargetId]; TargetObject = Server.GameObjects[TargetId]; if (AttackerPlayer == null && AttackerObject == null && TargetPlayer != null && TargetPlayer.HitsSources.Count > 0) { AttackerPlayer = TargetPlayer.MostDamageByPlayer(); if (AttackerPlayer == null) { AttackerObject = TargetPlayer.MostDamageByObject(); } } }