Exemple #1
0
        public static void KnifeChangerThread()
        {
            bool shouldReloadModelIndex = true;

            RuntimeGlobals.selectedKnifeModelIndex = 0;
            int selectedKnifeIndex = 0;

            while (true)
            {
                if (!Globals.KnifeChangerEnabled)
                {
                    Thread.Sleep(Globals.IdleWait);
                    shouldReloadModelIndex = true;
                    continue;
                }
                if (!EngineDLL.InGame)
                {
                    Thread.Sleep(Globals.IdleWait);
                    shouldReloadModelIndex = true;
                    continue;
                }

                if (shouldReloadModelIndex || selectedKnifeIndex != (int)Constants.KnifeList[Globals.SelectedKnife].itemDefinitionIndex)
                {
                    RuntimeGlobals.selectedKnifeModelIndex = EngineDLL.GetModelIndexByName(Constants.KnifeList[Globals.SelectedKnife].modelName);
                    selectedKnifeIndex     = (int)Constants.KnifeList[Globals.SelectedKnife].itemDefinitionIndex;
                    shouldReloadModelIndex = false;
                }

                for (var i = 0; i < 12; i++)
                {
                    CBaseCombatWeapon currentWeapon = weaponList[i];

                    if (currentWeapon.IsKnife())
                    {
                        currentWeapon.ItemDefinitionIndex = (int)Constants.KnifeList[Globals.SelectedKnife].itemDefinitionIndex;
                        currentWeapon.EntityQuality       = 3;
                        currentWeapon.ModelIndex          = RuntimeGlobals.selectedKnifeModelIndex;
                        currentWeapon.ViewModelIndex      = RuntimeGlobals.selectedKnifeModelIndex;
                    }
                }

                for (int i = 0; i < 10; i++) //Seems to be making it more stable
                {
                    if (weaponList.ActiveWeapon.IsKnife())
                    {
                        weaponList.ActiveWeapon.ViewModelEntityModelIndex = RuntimeGlobals.selectedKnifeModelIndex;
                    }
                }

                Thread.Sleep(Globals.UsageDelay);
            }
        }
Exemple #2
0
        public static void KnifeChangerAnimationFixThread()
        {
            bool shouldReloadModelIndex = true;
            int  butterflyModelIndex    = 0;
            int  falchionModelIndex     = 0;
            int  cssModelIndex          = 0;
            int  pushModelIndex         = 0;
            int  bowieModelIndex        = 0;
            int  ursusModelIndex        = 0;
            int  cordModelIndex         = 0;
            int  canisModelIndex        = 0;
            int  outdoorModelIndex      = 0;
            int  skeletonModelIndex     = 0;
            int  stilettoModelIndex     = 0;
            int  widowmakerModelIndex   = 0;

            while (true)
            {
                if (!Globals.KnifeChangerEnabled || !Globals.KnifeChangerAnimFixEnabled)
                {
                    Thread.Sleep(Globals.IdleWait);
                    shouldReloadModelIndex = true;
                    continue;
                }
                if (!EngineDLL.InGame)
                {
                    Thread.Sleep(Globals.IdleWait);
                    shouldReloadModelIndex = true;
                    continue;
                }

                if (shouldReloadModelIndex)
                {
                    butterflyModelIndex    = EngineDLL.GetModelIndexByName("models/weapons/v_knife_butterfly.mdl");
                    falchionModelIndex     = EngineDLL.GetModelIndexByName("models/weapons/v_knife_falchion_advanced.mdl");
                    cssModelIndex          = EngineDLL.GetModelIndexByName("models/weapons/v_knife_css.mdl");
                    pushModelIndex         = EngineDLL.GetModelIndexByName("models/weapons/v_knife_push.mdl");
                    bowieModelIndex        = EngineDLL.GetModelIndexByName("models/weapons/v_knife_survival_bowie.mdl");
                    ursusModelIndex        = EngineDLL.GetModelIndexByName("models/weapons/v_knife_ursus.mdl");
                    cordModelIndex         = EngineDLL.GetModelIndexByName("models/weapons/v_knife_cord.mdl");
                    canisModelIndex        = EngineDLL.GetModelIndexByName("models/weapons/v_knife_canis.mdl");
                    outdoorModelIndex      = EngineDLL.GetModelIndexByName("models/weapons/v_knife_outdoor.mdl");
                    skeletonModelIndex     = EngineDLL.GetModelIndexByName("models/weapons/v_knife_skeleton.mdl");
                    stilettoModelIndex     = EngineDLL.GetModelIndexByName("models/weapons/v_knife_stiletto.mdl");
                    widowmakerModelIndex   = EngineDLL.GetModelIndexByName("models/weapons/v_knife_widowmaker.mdl");
                    shouldReloadModelIndex = false;
                }

                CBaseCombatWeapon currentWeapon = weaponList.ActiveWeapon;

                if (currentWeapon.ViewModelEntityModelIndex == butterflyModelIndex)
                {
                    switch (currentWeapon.Sequence)
                    {
                    case (int)Sequence.SEQUENCE_DEFAULT_DRAW:
                        currentWeapon.Sequence = RandomSequence((int)Sequence.SEQUENCE_BUTTERFLY_DRAW, (int)Sequence.SEQUENCE_BUTTERFLY_DRAW2);
                        break;

                    case (int)Sequence.SEQUENCE_DEFAULT_LOOKAT01:
                        currentWeapon.Sequence = RandomSequence((int)Sequence.SEQUENCE_BUTTERFLY_LOOKAT01, (int)Sequence.SEQUENCE_BUTTERFLY_LOOKAT03);
                        break;
                    }
                }
                else if (currentWeapon.ViewModelEntityModelIndex == falchionModelIndex)
                {
                    switch (currentWeapon.Sequence)
                    {
                    case (int)Sequence.SEQUENCE_DEFAULT_IDLE2:
                        currentWeapon.Sequence = (int)Sequence.SEQUENCE_FALCHION_IDLE1;
                        break;

                    case (int)Sequence.SEQUENCE_DEFAULT_HEAVY_MISS1:
                        currentWeapon.Sequence = RandomSequence((int)Sequence.SEQUENCE_FALCHION_HEAVY_MISS1, (int)Sequence.SEQUENCE_FALCHION_HEAVY_MISS1_NOFLIP);
                        break;

                    case (int)Sequence.SEQUENCE_DEFAULT_LOOKAT01:
                        currentWeapon.Sequence = RandomSequence((int)Sequence.SEQUENCE_FALCHION_LOOKAT01, (int)Sequence.SEQUENCE_FALCHION_LOOKAT02);
                        break;
                    }
                }
                else if (currentWeapon.ViewModelEntityModelIndex == cssModelIndex)
                {
                    switch (currentWeapon.Sequence)
                    {
                    case (int)Sequence.SEQUENCE_DEFAULT_LOOKAT01:
                        currentWeapon.Sequence = RandomSequence((int)Sequence.SEQUENCE_CSS_LOOKAT01, (int)Sequence.SEQUENCE_CSS_LOOKAT02);
                        break;
                    }
                }
                else if (currentWeapon.ViewModelEntityModelIndex == pushModelIndex)
                {
                    switch (currentWeapon.Sequence)
                    {
                    case (int)Sequence.SEQUENCE_DEFAULT_IDLE2:
                        currentWeapon.Sequence = (int)Sequence.SEQUENCE_DAGGERS_IDLE1;
                        break;

                    case (int)Sequence.SEQUENCE_DEFAULT_LIGHT_MISS1:
                    case (int)Sequence.SEQUENCE_DEFAULT_LIGHT_MISS2:
                        currentWeapon.Sequence = RandomSequence((int)Sequence.SEQUENCE_DAGGERS_LIGHT_MISS1, (int)Sequence.SEQUENCE_DAGGERS_LIGHT_MISS5);
                        break;

                    case (int)Sequence.SEQUENCE_DEFAULT_HEAVY_MISS1:
                        currentWeapon.Sequence = RandomSequence((int)Sequence.SEQUENCE_DAGGERS_HEAVY_MISS2, (int)Sequence.SEQUENCE_DAGGERS_HEAVY_MISS1);
                        break;
                    }
                }
                else if (currentWeapon.ViewModelEntityModelIndex == bowieModelIndex)
                {
                    switch (currentWeapon.Sequence)
                    {
                    case (int)Sequence.SEQUENCE_DEFAULT_IDLE2:
                        currentWeapon.Sequence = (int)Sequence.SEQUENCE_BOWIE_IDLE1;
                        break;
                    }
                }
                else if (currentWeapon.ViewModelEntityModelIndex == ursusModelIndex ||
                         currentWeapon.ViewModelEntityModelIndex == cordModelIndex ||
                         currentWeapon.ViewModelEntityModelIndex == canisModelIndex ||
                         currentWeapon.ViewModelEntityModelIndex == outdoorModelIndex ||
                         currentWeapon.ViewModelEntityModelIndex == skeletonModelIndex)
                {
                    switch (currentWeapon.Sequence)
                    {
                    case (int)Sequence.SEQUENCE_DEFAULT_DRAW:
                        currentWeapon.Sequence = RandomSequence((int)Sequence.SEQUENCE_BUTTERFLY_DRAW, (int)Sequence.SEQUENCE_BUTTERFLY_DRAW2);
                        break;

                    case (int)Sequence.SEQUENCE_DEFAULT_LOOKAT01:
                        currentWeapon.Sequence = RandomSequence((int)Sequence.SEQUENCE_BUTTERFLY_LOOKAT01, 14);
                        break;
                    }
                }
                else if (currentWeapon.ViewModelEntityModelIndex == stilettoModelIndex)
                {
                    switch (currentWeapon.Sequence)
                    {
                    case (int)Sequence.SEQUENCE_DEFAULT_LOOKAT01:
                        currentWeapon.Sequence = RandomSequence(12, 13);
                        break;
                    }
                }
                else if (currentWeapon.ViewModelEntityModelIndex == widowmakerModelIndex)
                {
                    switch (currentWeapon.Sequence)
                    {
                    case (int)Sequence.SEQUENCE_DEFAULT_LOOKAT01:
                        currentWeapon.Sequence = RandomSequence(14, 15);
                        break;
                    }
                }

                Thread.Sleep(TimeSpan.FromMilliseconds(0.1));
            }
        }