Ejemplo n.º 1
0
 public MissionLogEventGroupInitInfo(MissionLogEventHeader header)
     : base(header)
 {
     GroupId   = RawParameters.GetInt("GID");
     ObjectIds = Util.SequenceToIntArray(RawParameters.GetString("IDS"));
     LeaderId  = RawParameters.GetInt("LID");
 }
Ejemplo n.º 2
0
        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"));
        }
Ejemplo n.º 3
0
        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,
                    });
                }
            }
        }
Ejemplo n.º 4
0
        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];
            }
        }
Ejemplo n.º 5
0
        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");
        }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 7
0
 public MissionLogEventVersion(MissionLogEventHeader header)
     : base(header)
 {
     Version = RawParameters.GetString("VER");
 }