Пример #1
0
        public virtual void Parse(ICsvParser parser)
        {
            this.Version      = parser.GetInt('v');
            this.Id           = parser.GetInt();
            this.Name         = parser.GetString();
            this.SkillLogic   = parser.GetQuotedString();
            this.Description  = parser.GetString();
            this.Hitpoints    = parser.GetInt();
            this.Weight       = parser.GetInt();
            this.ClassId      = this.Version < 31 ? 0 : parser.GetInt();
            this.Armors       = parser.GetInstances <ArmorValues>(6);
            this.BarrelLength = parser.GetShort();
            this.FireHeight   = parser.GetShort();

            if (this.Version >= 34)
            {
                this.PhysicalRadius = parser.GetShort();
                this.TriggerRadius  = parser.GetShort();
            }
            else
            {
                short dummy = parser.GetShort();

                this.PhysicalRadius = dummy;
                this.TriggerRadius  = dummy;

                if (dummy != -1)
                {
                    dummy -= 8;
                    this.PhysicalRadius = (dummy >= 1) ? dummy : (short)1;
                }
            }

            if (this.Version >= 11)
            {
                this.VehiclePhysicsOwned   = parser.GetShort();
                this.VehiclePhysicsUnowned = parser.GetShort();
                this.WeaponPhysicsOwned    = parser.GetShort();
                this.WeaponPhysicsUnowned  = parser.GetShort();
            }
            else
            {
                parser.Skip();
                parser.Skip();
            }

            this.LowZ              = parser.GetShort();
            this.HighZ             = parser.GetShort();
            this.PickupItemId      = parser.GetShort();
            this.IsControllable    = parser.GetShort() == 1;
            this.IsWarpable        = ((this.Version >= 8) ? parser.GetShort() : (short)1) == 1;
            this.EnergyCostPerTick = parser.GetInt();
            this.NormalWeight      = parser.GetInt();
            this.StopWeight        = parser.GetInt();
            this.DisplayHealth     = (this.Version >= 1) ? parser.GetShort() : (short)0;
            this.InventoryItems    = parser.GetInts(6);
            this.ChildVehicles     = parser.GetInts(8);

            if (this.Version >= 6 && this.Version < 31)
            {
                parser.Skip(31);
            }

            this.ExplodeItemId    = (this.Version >= 17) ? parser.GetShort() : (short)0;
            this.RadarPrize       = (this.Version >= 35) ? parser.GetInt() : -1;
            this.VehicleGetInMode = (this.Version >= 36) ? parser.GetInt() : 0;
            this.VisualHeight     = (this.Version >= 37) ? parser.GetShort() : (short)0;
            this.DropItemId       = (this.Version >= 46) ? parser.GetShort() : (short)0;
            this.DropItemQuantity = (this.Version >= 46) ? parser.GetShort() : (short)0;

            if (this.Version >= 5)
            {
                this.Sprites[0].Parse(this.Version, parser);
                this.Sprites[1].Parse(this.Version, parser);
                blofiles.Add(Sprites[0].Blob.BlobName);
                blofiles.Add(Sprites[1].Blob.BlobName);
            }

            this.EnergyMax  = (this.Version >= 5) ? parser.GetInt() : -1;
            this.EnergyRate = (this.Version >= 5) ? parser.GetInt() : -1;
            this.EnergyMin  = (this.Version >= 21) ? parser.GetInt() : -1;
            this.ThrowTime  = (this.Version >= 9) ? parser.GetShort() : (short)-1;

            if (this.Version >= 9 && this.Version < 24)
            {
                parser.Skip();
            }

            this.AllowWeapons        = (this.Version >= 9) ? parser.GetShort() : (short)-1;
            this.Style1BallSpeed     = (this.Version >= 9) ? parser.GetShort() : (short)0;
            this.Style1LowFireAngle  = (this.Version >= 9) ? parser.GetShort() : (short)45;
            this.Style1HighFireAngle = (this.Version >= 9) ? parser.GetShort() : (short)45;
            this.Style1KeyAssignment = (this.Version >= 15) ? parser.GetShort() : (short)1;
            this.Style1BallFriction  = (this.Version >= 15) ? parser.GetShort() : (short)-1;
            this.Style2BallSpeed     = (this.Version >= 15) ? parser.GetShort() : (short)0;
            this.Style2LowFireAngle  = (this.Version >= 15) ? parser.GetShort() : (short)0;
            this.Style2HighFireAngle = (this.Version >= 15) ? parser.GetShort() : (short)0;
            this.Style2KeyAssignment = (this.Version >= 15) ? parser.GetShort() : (short)0;
            this.Style2BallFriction  = (this.Version >= 9) ? parser.GetShort() : (short)1;

            if (this.Version >= 24)
            {
                this.TerrainModifiers = parser.GetShorts(16);
            }
            else
            {
                this.TerrainModifiers = new short[16];
                for (int i = 0; i < this.TerrainModifiers.Length; i++)
                {
                    this.TerrainModifiers[i] = -1;
                }
            }

            if (this.Version >= 9 && this.Version < 23)
            {
                parser.Skip();
            }

            this.BallCarryRollVehicleItem  = (this.Version >= 29) ? parser.GetShort() : (short)0;
            this.BallCarryArmorVehicleItem = (this.Version >= 29) ? parser.GetShort() : (short)0;
            this.FlagCarryRollVehicleItem  = (this.Version >= 29) ? parser.GetShort() : (short)0;
            this.FlagCarryArmorVehicleItem = (this.Version >= 29) ? parser.GetShort() : (short)0;
            this.EventString1           = (this.Version >= 33) ? parser.GetString() : "";
            this.EventString2           = (this.Version >= 38) ? parser.GetString() : "";
            this.EventString3           = (this.Version >= 38) ? parser.GetString() : "";
            this.LosDistance            = (this.Version >= 42) ? parser.GetInt() : 0;
            this.LosAngle               = (this.Version >= 42) ? parser.GetInt() : 0;
            this.LosXRay                = (this.Version >= 42) ? parser.GetInt() : 0;
            this.CombatAwarenessTime    = (this.Version >= 42) ? parser.GetInt() : 0;
            this.SiblingKillsShared     = (this.Version >= 42) ? parser.GetShort() : (short)0;
            this.RelativeId             = (this.Version >= 47) ? parser.GetShort() : (short)0;
            this.DisplayOnFriendlyRadar = (this.Version >= 52) ? parser.GetInt() : 1;
            this.FriendlyRadarColor     = (this.Version >= 50) ? parser.GetInt() : -1;
            this.DisplayOnEnemyRadar    = (this.Version >= 52) ? parser.GetInt() : 1;
            this.EnemyRadarColor        = (this.Version >= 50) ? parser.GetInt() : -1;

            if (this.Version >= 48)
            {
                for (int i = 0; i < 30; i++)
                {
                    this.HoldItemLimits[i]         = parser.GetShort();
                    this.HoldItemExtendedLimits[i] = parser.GetShort();
                }
            }
        }