Beispiel #1
0
        public void Update()
        {
            if (tool_ToolZ.getLocalPlayer().equipment.asset is ItemGunAsset)
            {
                ItemGunAsset gun = (ItemGunAsset)tool_ToolZ.getLocalPlayer().equipment.asset;
                if (nospread)
                {
                    if (!isBackupAsset(gun))
                    {
                        backups_Asset.Add(new GunAssetInfo(gun));
                    }
                    gun.GetType().GetField("_spreadAim", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(gun, 0f);
                    gun.GetType().GetField("_spreadHip", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(gun, 0f);
                }
                if (norecoil)
                {
                    if (!isBackupAsset(gun))
                    {
                        backups_Asset.Add(new GunAssetInfo(gun));
                    }
                    gun.GetType().GetField("_recoilMax_x", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(gun, 0f);
                    gun.GetType().GetField("_recoilMax_y", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(gun, 0f);
                    gun.GetType().GetField("_recoilMin_x", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(gun, 0f);
                    gun.GetType().GetField("_recoilMin_y", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(gun, 0f);
                }

                if (!nospread)
                {
                    if (isBackupAsset(gun))
                    {
                        GunAssetInfo back = getGunAsset(gun);
                        gun.GetType().GetField("_recoilMax_x", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(gun, back.recoilMax_x);
                        gun.GetType().GetField("_recoilMax_y", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(gun, back.recoilMax_y);
                        gun.GetType().GetField("_recoilMin_x", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(gun, back.recoilMin_x);
                        gun.GetType().GetField("_recoilMin_y", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(gun, back.recoilMin_y);
                    }
                }
                if (!norecoil)
                {
                    if (isBackupAsset(gun))
                    {
                        GunAssetInfo back = getGunAsset(gun);
                        gun.GetType().GetField("_spreadAim", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(gun, back.spreadAim);
                        gun.GetType().GetField("_spreadHip", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(gun, back.spreadHip);
                    }
                }
            }
            if (tool_ToolZ.getLocalPlayer().equipment.useable is UseableGun)
            {
                UseableGun gun = (UseableGun)tool_ToolZ.getLocalPlayer().equipment.useable;
                if (rapidfire)
                {
                    gun.GetType().GetField("firemode", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(gun, EFiremode.AUTO);
                }
            }
        }
Beispiel #2
0
 private float getZoom(UseableGun gun)
 {
     return((float)gun.GetType().GetField("zoom", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(gun));
 }