public MissionLogEventInfluenceAreaInfo(MissionLogEventHeader header) : base(header) { var country = new Country(this.RawParameters.GetInt("COUNTRY")); var coalition = this.Server.CoalitionIndexes.FirstOrDefault(c => c.Country.Id == country.Id); var coalitionIndex = coalition?.Index ?? 0; var id = this.RawParameters.GetInt("AID"); var existingArea = this.Server.Areas[id]; if (existingArea != null) { this.Server.Areas[id].Country = country; this.Server.Areas[id].Coalition = coalitionIndex; this.Server.Areas[id].IsEnabled = this.RawParameters.GetInt("ENABLED") == 1; this.Area = this.Server.Areas[id]; } else { this.Area = new Area(this.RawParameters.GetInt("AID"), country, this.RawParameters.GetInt("ENABLED") == 1) { Coalition = coalitionIndex, }; } this.PlanesByCoalition = new List <CoalitionPlanesCount>(); var planesNumber = Util.SequenceToIntArray(this.RawParameters.GetString("BC")); }
public MissionLogEventPlayerLeave(MissionLogEventHeader header) : base(header) { this.NickGuid = this.RawParameters.GetGuid("USERNICKID"); this.LoginGuid = this.RawParameters.GetGuid("USERID"); this.Player = this.Server.Players.FindPlayerByGuid(this.NickGuid); }
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 MissionLogEventGroupInitInfo(MissionLogEventHeader header) : base(header) { this.GroupId = this.RawParameters.GetInt("GID"); this.ObjectIds = Util.SequenceToIntArray(this.RawParameters.GetString("IDS")); this.LeaderId = this.RawParameters.GetInt("LID"); }
public MissionLogEventPlayerLeave(MissionLogEventHeader header) : base(header) { NickGuid = RawParameters.GetGuid("USERNICKID"); LoginGuid = RawParameters.GetGuid("USERID"); Player = Server.Players.FindPlayerByGuid(NickGuid); }
public MissionLogEventObjectiveCompleted(MissionLogEventHeader header) : base(header) { this.ObjectiveId = this.RawParameters.GetInt("OBJID"); this.Position = this.RawParameters.GetVector3D("POS"); this.IsPrimary = this.RawParameters.GetInt("TYPE") == 1; this.CoalitionIndex = this.RawParameters.GetInt("COAL"); this.IsCompleted = this.RawParameters.GetInt("RES") == 1; }
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) { this.AirField = new AirField() { Country = new Country(this.RawParameters.GetInt("COUNTRY")), Id = this.RawParameters.GetInt("AID"), Position = this.RawParameters.GetVector3D("POS"), }; }
public MissionLogEventHeader(MissionLogEventHeader header) { this.Server = header.Server; this.logLine = header.logLine; this.Type = header.Type; this.Ticks = header.Ticks; this.EventID = header.EventID; this.MissionStartTime = header.MissionStartTime; this.RawParameters = new Dictionary <string, string>(header.RawParameters); this.EventTime = header.MissionStartTime.AddMilliseconds(this.Ticks / 50.0 * 1000.0); }
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 MissionLogEject(MissionLogEventHeader header) : base(header) { this.Position = this.RawParameters.GetVector3D("POS"); var area = this.Server.Areas.FindAreaByPos(this.RawParameters.GetVector3D("POS")); this.Player = this.Server.Players[this.RawParameters.GetInt("PARENTID")] ?? this.Server.Players[this.RawParameters.GetInt("BOTID")]; if (this.Player != null && area != null) { this.IsFriendlyArea = area.Coalition == this.Player.CoalitionIndex; } }
public MissionLogEventPlayerAmmo(MissionLogEventHeader header) : base(header) { this.PlaneId = this.RawParameters.GetInt("PLID"); this.PlayerId = this.RawParameters.GetInt("PID"); this.Bullets = this.RawParameters.GetInt("BUL"); this.Shells = this.RawParameters.GetInt("SH"); this.Bombs = this.RawParameters.GetInt("BOMB"); this.Rockets = this.RawParameters.GetInt("RCT"); this.Player = this.Server.Players[this.PlaneId] ?? this.Server.Players[this.PlayerId]; //if (Player == null) // Bot = Server.GameObjects[PlaneId]; }
public MissionLogEventLanding(MissionLogEventHeader header) : base(header) { this.PlayerId = this.RawParameters.GetInt("PID"); this.Position = this.RawParameters.GetVector3D("POS"); this.Player = this.Server.Players[this.PlayerId]; if (this.Player == null) { this.Bot = this.Server.GameObjects[this.PlayerId]; } else { this.Player.IsInAir = false; } }
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 static object GetData(string text, DateTime missionStartTime, int eventNumber, Server server) { var header = new MissionLogEventHeader(text, missionStartTime); header.Server = server; if (header.Type != EventType.Unknown) { header.EventID = GuidUtility.Create(GuidUtility.IsoOidNamespace, String.Concat(server.ServerId, "_", missionStartTime, "_", eventNumber)); Func <MissionLogEventHeader, object> handler; if (dataFactory.TryGetValue(header.Type, out handler)) { return(handler(header)); } } return(null); }
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 = this.RawParameters.GetInt("AID"); var existingArea = this.Server.Areas[id]; if (existingArea != null) { this.Server.Areas[id].SetBoundaries(this.RawParameters.GetVectorArray("BP")); this.Area = this.Server.Areas[id]; } else { this.Area = new Area(this.RawParameters.GetVectorArray("BP")) { Id = this.RawParameters.GetInt("AID") }; } }
public MissionLogEventHit(MissionLogEventHeader header) : base(header) { this.AttackerId = this.RawParameters.GetInt("AID"); this.TargetId = this.RawParameters.GetInt("TID"); this.AmmoName = this.RawParameters.GetString("AMMO"); this.AttackerPlayer = this.Server.Players[this.AttackerId]; if (this.AttackerPlayer == null) { this.AttackerObject = this.Server.GameObjects[this.AttackerId]; } this.TargetPlayer = this.Server.Players[this.TargetId]; if (this.TargetPlayer == null) { this.TargetObject = this.Server.GameObjects[this.TargetId]; } }
public MissionLogEventDamage(MissionLogEventHeader header) : base(header) { this.AttackerId = this.RawParameters.GetInt("AID"); this.TargetId = this.RawParameters.GetInt("TID"); this.Damage = this.RawParameters.GetDouble("DMG"); this.Position = this.RawParameters.GetVector3D("POS"); this.AttackerPlayer = this.Server.Players[this.AttackerId]; if (this.AttackerPlayer == null) { this.AttackerObject = this.Server.GameObjects[this.AttackerId]; } this.TargetPlayer = this.Server.Players[this.TargetId]; if (this.TargetPlayer == null) { this.TargetObject = this.Server.GameObjects[this.TargetId]; } }
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 MissionLogEventGameObjectSpawn(MissionLogEventHeader header) : base(header) { GameInfo.ObjectsClassification.TryGetValue(this.RawParameters.GetString("TYPE"), out var purpose); if (purpose == null) { purpose = new GameObjectItem(GameObjectClass.Other, "Unknown"); } this.Object = new GameObject(this.RawParameters.GetInt("ID"), this.RawParameters.GetString("TYPE")) { Classification = purpose.Classification.ToString("g"), Purpose = purpose.Purpose, Country = new Country(this.RawParameters.GetInt("COUNTRY")), }; this.Object.CoalitionIndex = this.Server.GetCoalitionIndex(this.Object.Country); this.PlayerId = this.RawParameters.GetInt("PID"); }
public MissionLogRemoveBot(MissionLogEventHeader header) : base(header) { this.Position = this.RawParameters.GetVector3D("POS"); var area = this.Server.Areas.FindAreaByPos(this.RawParameters.GetVector3D("POS")); this.Player = this.Server.Players[this.RawParameters.GetInt("BOTID")]; if (area != null) { if (this.Player == null) { this.Bot = this.Server.GameObjects[this.RawParameters.GetInt("BOTID")]; this.IsFriendlyArea = area.Coalition == this.Bot.CoalitionIndex; } else { this.IsFriendlyArea = area.Coalition == this.Player.CoalitionIndex; } } }
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 MissionLogEventPlaneSpawn(MissionLogEventHeader header) : base(header) { GameObjectItem purpose; GameInfo.ObjectsClassification.TryGetValue(this.RawParameters.GetString("TYPE"), out purpose); if (purpose == null) { purpose = new GameObjectItem(GameObjectClass.Other, "Unknown"); } this.Player = new Player() { Id = this.RawParameters.GetInt("PID"), Country = new Country(this.RawParameters.GetInt("COUNTRY")), IsInAir = this.RawParameters.GetInt("INAIR") == 0, IsOnline = true, LoginId = this.RawParameters.GetGuid("LOGIN"), NickId = this.RawParameters.GetGuid("IDS"), NickName = this.RawParameters.GetString("NAME"), Plane = new Plane(this.RawParameters.GetInt("PLID"), this.RawParameters.GetString("TYPE")) { Bullets = this.RawParameters.GetInt("BUL"), Bombs = this.RawParameters.GetInt("BOMB"), Classification = GameObjectClass.Plane.ToString("g"), Fuel = this.RawParameters.GetDouble("FUEL"), Payload = this.RawParameters.GetString("PAYLOAD"), Purpose = purpose.Purpose, Shells = this.RawParameters.GetInt("SH"), Skin = this.RawParameters.GetString("SKIN"), WeaponMods = this.RawParameters.GetString("WM"), }, BotPilot = new GameObject(this.RawParameters.GetInt("PID"), "BotPilot"), SortieId = this.EventID, }; this.Player.CoalitionIndex = this.Server.GetCoalitionIndex(this.Player.Country); this.Server.Players.PlayerSpawn(this.Player); }
public MissionLogEventKill(MissionLogEventHeader header) : base(header) { this.AttackerId = this.RawParameters.GetInt("AID"); this.TargetId = this.RawParameters.GetInt("TID"); this.Position = this.RawParameters.GetVector3D("POS"); this.AttackerPlayer = this.Server.Players[this.AttackerId]; this.AttackerObject = this.Server.GameObjects[this.AttackerId]; this.TargetPlayer = this.Server.Players[this.TargetId]; this.TargetObject = this.Server.GameObjects[this.TargetId]; if (this.AttackerPlayer == null && this.AttackerObject == null && this.TargetPlayer != null && this.TargetPlayer.HitsSources.Count > 0) { this.AttackerPlayer = this.TargetPlayer.MostDamageByPlayer(); if (this.AttackerPlayer == null) { this.AttackerObject = this.TargetPlayer.MostDamageByObject(); } } }
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(); } } }
public MissionLogEventMissionEnd(MissionLogEventHeader header) : base(header) { this.MissionEndTime = DateTime.UtcNow; }
public MissionLogEventPlayerJoin(MissionLogEventHeader header) : base(header) { this.NickGuid = this.RawParameters.GetGuid("USERNICKID"); this.LoginGuid = this.RawParameters.GetGuid("USERID"); }
public MissionLogEventVersion(MissionLogEventHeader header) : base(header) { this.Version = this.RawParameters.GetString("VER"); }