コード例 #1
0
ファイル: SkinChanger.cs プロジェクト: roccosec/Trion-Hack
        private static void ApplyWearable(BasePlayer *localPlayer, ref CSkinChangerWeapon configWeapon, IVEngineClient.PlayerInfo playerInfo)
        {
            uint *wearables = localPlayer->GetMyWearables;

            if (wearables == null)
            {
                return;
            }

            IBaseClientDLL.ClientClass *Class = Interface.BaseClientDLL.GetAllClasses();

            if (Class == null)
            {
                return;
            }

            int serial = Weapon.Random.Next() % 0x1000;
            int entry  = Interface.ClientEntityList.GetHighestEntityIndex + 1;

            if (entry == 0)
            {
                return;
            }

            if (Interface.ClientEntityList.GetClientEntity((int)(wearables[0] & 0xFFF)) == null)
            {
                while (Class != null)
                {
                    if (Class->ClassId == IBaseClientDLL.ClassId.CEconWearable)
                    {
                        break;
                    }

                    Class = Class->Next;
                }

                Marshal.GetDelegateForFunctionPointer <MakeGloveDelegate>((IntPtr)Class->CreateFunction)(entry, serial);

                wearables[0] = (uint)(entry | (serial << 16));
            }

            BaseCombatWeapon *Glove = (BaseCombatWeapon *)Interface.ClientEntityList.GetClientEntityFromHandle((void *)wearables[0]);

            if (Glove == null)
            {
                return;
            }

            if (Glove->ItemDefinitionIndex != configWeapon.WeaponID)
            {
                Glove->ItemIdHigh = -1;
                Glove->AccountId  = playerInfo.m_nXuidLow;

                Glove->ItemDefinitionIndex = configWeapon.WeaponID;
                ((BaseViewModel *)Glove)->SetModelIndex(Interface.ModelInfoClient.GetModelIndex(GloveModel[Glove->ItemDefinitionIndex]));

                Glove->EntityQuality    = QualityId.Normal;
                Glove->FallBackPaintKit = configWeapon.SkinID;

                ((IClientEntity *)Glove)->GetClientNetworkable->PreDataUpdate(0);
            }
        }
コード例 #2
0
ファイル: SkinChanger.cs プロジェクト: roccosec/Trion-Hack
        private static void ApplyWeapon(BasePlayer *localPlayer, BaseCombatWeapon *weaponPtr, CSkinChangerWeapon configWeapon, IVEngineClient.PlayerInfo playerInfo)
        {
            if (configWeapon.WeaponID == WeaponId.None)
            {
                return;
            }

            weaponPtr->ItemIdHigh = -1;

            weaponPtr->AccountId = playerInfo.m_nXuidLow;

            if (!string.IsNullOrWhiteSpace(configWeapon.WeaponName))
            {
                weaponPtr->CustomName = configWeapon.WeaponName;
            }

            if (configWeapon.StatTrackEnable && configWeapon.StatTrack >= 0)
            {
                weaponPtr->EntityQuality     = QualityId.Strange;
                weaponPtr->FallBackStatTrack = configWeapon.StatTrack;
            }

            weaponPtr->FallBackPaintKit = configWeapon.SkinID;

            WeaponId WeaponIndex = weaponPtr->ItemDefinitionIndex;

            if (WeaponIndex.IsKnife() && WeaponIndex != configWeapon.WeaponID)
            {
                weaponPtr->ItemDefinitionIndex = configWeapon.WeaponID;
                ((BaseViewModel *)weaponPtr)->SetModelIndex(Interface.ModelInfoClient.GetModelIndex(KnifeModel[weaponPtr->ItemDefinitionIndex]));
            }
        }