Пример #1
0
        private void MapEquipment()
        {
            for (int i = 0; i < SendTableParser.ServerClasses.Count; i++)
            {
                var sc = SendTableParser.ServerClasses[i];

                if (sc.BaseClasses.Count > 6 && sc.BaseClasses [6].Name == "CWeaponCSBase")
                {
                    //It is a "weapon" (Gun, C4, ... (...is the cz still a "weapon" after the nerf? (fml, it was buffed again)))
                    if (sc.BaseClasses.Count > 7)
                    {
                        if (sc.BaseClasses [7].Name == "CWeaponCSBaseGun")
                        {
                            //it is a ratatatata-weapon.
                            var s = sc.DTName.Substring(9).ToLower();
                            equipmentMapping.Add(sc, Equipment.MapEquipment(s));
                        }
                        else if (sc.BaseClasses [7].Name == "CBaseCSGrenade")
                        {
                            //"boom"-weapon.
                            equipmentMapping.Add(sc, Equipment.MapEquipment(sc.DTName.Substring(3).ToLower()));
                        }
                    }
                    else if (sc.Name == "CC4")
                    {
                        //Bomb is neither "ratatata" nor "boom", its "booooooom".
                        equipmentMapping.Add(sc, EquipmentElement.Bomb);
                    }
                    else if (sc.Name == "CKnife" || (sc.BaseClasses.Count > 6 && sc.BaseClasses [6].Name == "CKnife"))
                    {
                        //tsching weapon
                        equipmentMapping.Add(sc, EquipmentElement.Knife);
                    }
                    else if (sc.Name == "CWeaponNOVA" || sc.Name == "CWeaponSawedoff" || sc.Name == "CWeaponXM1014")
                    {
                        equipmentMapping.Add(sc, Equipment.MapEquipment(sc.Name.Substring(7).ToLower()));
                    }
                }
            }
        }
Пример #2
0
        private bool ParseTick()
        {
            DemoCommand command = (DemoCommand)BitStream.ReadByte();

            BitStream.ReadInt(32);          // tick number
            BitStream.ReadByte();           // player slot

            this.CurrentTick++;             // = TickNum;

            switch (command)
            {
            case DemoCommand.Synctick:
                break;

            case DemoCommand.Stop:
                return(false);

            case DemoCommand.ConsoleCommand:
                BitStream.BeginChunk(BitStream.ReadSignedInt(32) * 8);
                BitStream.EndChunk();
                break;

            case DemoCommand.DataTables:
                BitStream.BeginChunk(BitStream.ReadSignedInt(32) * 8);
                SendTableParser.ParsePacket(BitStream);
                BitStream.EndChunk();

                for (int i = 0; i < SendTableParser.ServerClasses.Count; i++)
                {
                    var sc = SendTableParser.ServerClasses[i];

                    if (sc.BaseClasses.Count > 6 && sc.BaseClasses [6].Name == "CWeaponCSBase")
                    {
                        //It is a "weapon" (Gun, C4, ... (...is the cz still a "weapon" after the nerf?))
                        if (sc.BaseClasses.Count > 7)
                        {
                            if (sc.BaseClasses [7].Name == "CWeaponCSBaseGun")
                            {
                                //it is a ratatatata-weapon.
                                var s = sc.DTName.Substring(9).ToLower();
                                equipmentMapping.Add(sc, Equipment.MapEquipment(s));
                            }
                            else if (sc.BaseClasses [7].Name == "CBaseCSGrenade")
                            {
                                //"boom"-weapon.
                                equipmentMapping.Add(sc, Equipment.MapEquipment(sc.DTName.Substring(3).ToLower()));
                            }
                        }
                        else if (sc.Name == "CC4")
                        {
                            //Bomb is neither "ratatata" nor "boom", its "booooooom".
                            equipmentMapping.Add(sc, EquipmentElement.Bomb);
                        }
                        else if (sc.Name == "CKnife" || (sc.BaseClasses.Count > 6 && sc.BaseClasses [6].Name == "CKnife"))
                        {
                            //tsching weapon
                            equipmentMapping.Add(sc, EquipmentElement.Knife);
                        }
                        else if (sc.Name == "CWeaponNOVA" || sc.Name == "CWeaponSawedoff" || sc.Name == "CWeaponXM1014")
                        {
                            equipmentMapping.Add(sc, Equipment.MapEquipment(sc.Name.Substring(7).ToLower()));
                        }
                    }
                }

                BindEntites();

                break;

            case DemoCommand.StringTables:
                BitStream.BeginChunk(BitStream.ReadSignedInt(32) * 8);
                StringTables.ParsePacket(BitStream, this);
                BitStream.EndChunk();
                break;

            case DemoCommand.UserCommand:
                BitStream.ReadInt(32);
                BitStream.BeginChunk(BitStream.ReadSignedInt(32) * 8);
                BitStream.EndChunk();
                break;

            case DemoCommand.Signon:
            case DemoCommand.Packet:
                ParseDemoPacket();
                break;

            default:
                throw new Exception("Can't handle Demo-Command " + command);
            }

            return(true);
        }