コード例 #1
0
        public static void viewItem(int newItem, ulong newInstance)
        {
            MenuSurvivorsClothingInspectUI.item = newItem;
            if (MenuSurvivorsClothingInspectUI.model != null)
            {
                Object.Destroy(MenuSurvivorsClothingInspectUI.model.gameObject);
            }
            ushort    inventoryItemID   = Provider.provider.economyService.getInventoryItemID(MenuSurvivorsClothingInspectUI.item);
            ushort    inventorySkinID   = Provider.provider.economyService.getInventorySkinID(MenuSurvivorsClothingInspectUI.item);
            ushort    inventoryMythicID = Provider.provider.economyService.getInventoryMythicID(MenuSurvivorsClothingInspectUI.item);
            ItemAsset itemAsset         = (ItemAsset)Assets.find(EAssetType.ITEM, inventoryItemID);

            if (inventorySkinID != 0)
            {
                SkinAsset skinAsset = (SkinAsset)Assets.find(EAssetType.SKIN, inventorySkinID);
                MenuSurvivorsClothingInspectUI.model = ItemTool.getItem(itemAsset.id, inventorySkinID, 100, itemAsset.getState(), false, itemAsset, skinAsset);
                if (inventoryMythicID != 0)
                {
                    ItemTool.applyEffect(MenuSurvivorsClothingInspectUI.model, inventoryMythicID, EEffectType.THIRD);
                }
            }
            else
            {
                MenuSurvivorsClothingInspectUI.model = ItemTool.getItem(itemAsset.id, 0, 100, itemAsset.getState(), false, itemAsset);
                if (inventoryMythicID != 0)
                {
                    ItemTool.applyEffect(MenuSurvivorsClothingInspectUI.model, inventoryMythicID, EEffectType.HOOK);
                }
            }
            MenuSurvivorsClothingInspectUI.model.parent        = MenuSurvivorsClothingInspectUI.inspect;
            MenuSurvivorsClothingInspectUI.model.localPosition = Vector3.zero;
            if (itemAsset.type == EItemType.MELEE)
            {
                MenuSurvivorsClothingInspectUI.model.localRotation = Quaternion.Euler(0f, -90f, 90f);
            }
            else
            {
                MenuSurvivorsClothingInspectUI.model.localRotation = Quaternion.Euler(-90f, 0f, 0f);
            }
            if (MenuSurvivorsClothingInspectUI.model.GetComponent <Renderer>() != null)
            {
                MenuSurvivorsClothingInspectUI.look.pos = MenuSurvivorsClothingInspectUI.model.GetComponent <Renderer>().bounds.center;
            }
            else if (MenuSurvivorsClothingInspectUI.model.GetComponent <LODGroup>() != null)
            {
                for (int i = 0; i < 4; i++)
                {
                    Transform transform = MenuSurvivorsClothingInspectUI.model.FindChild("Model_" + i);
                    if (!(transform == null))
                    {
                        if (transform.GetComponent <Renderer>() != null)
                        {
                            MenuSurvivorsClothingInspectUI.look.pos = transform.GetComponent <Renderer>().bounds.center;
                            break;
                        }
                    }
                }
            }
            MenuSurvivorsClothingInspectUI.look.pos = MenuSurvivorsClothingInspectUI.model.position + MenuSurvivorsClothingInspectUI.model.rotation * MenuSurvivorsClothingInspectUI.model.GetComponent <BoxCollider>().center;
        }
コード例 #2
0
ファイル: ItemTool.cs プロジェクト: sky-xk-nge/Unturned
 public static void applyEffect(Transform[] bones, Transform[] systems, ushort mythicID, EEffectType type)
 {
     if (mythicID == 0)
     {
         return;
     }
     if (bones == null || systems == null)
     {
         return;
     }
     for (int i = 0; i < bones.Length; i++)
     {
         systems[i] = ItemTool.applyEffect(bones[i], mythicID, type);
     }
 }
コード例 #3
0
 public virtual void refreshDisplay()
 {
     if (this.displayModel != null)
     {
         Object.Destroy(this.displayModel.gameObject);
         this.displayModel = null;
         this.displayAsset = null;
     }
     if (this.displayItem == null)
     {
         return;
     }
     if (this.gunLargeTransform == null || this.gunSmallTransform == null || this.meleeTransform == null || this.itemTransform == null)
     {
         return;
     }
     this.displayAsset = (ItemAsset)Assets.find(EAssetType.ITEM, this.displayItem.id);
     if (this.displayAsset == null)
     {
         return;
     }
     if (this.displaySkin != 0)
     {
         if ((SkinAsset)Assets.find(EAssetType.SKIN, this.displaySkin) == null)
         {
             return;
         }
         this.displayModel = ItemTool.getItem(this.displayItem.id, this.displaySkin, this.displayItem.quality, this.displayItem.state, false);
         if (this.displayMythic != 0)
         {
             ItemTool.applyEffect(this.displayModel, this.displayMythic, EEffectType.THIRD);
         }
     }
     else
     {
         this.displayModel = ItemTool.getItem(this.displayItem.id, 0, this.displayItem.quality, this.displayItem.state, false);
         if (this.displayMythic != 0)
         {
             ItemTool.applyEffect(this.displayModel, this.displayMythic, EEffectType.HOOK);
         }
     }
     if (this.displayModel == null)
     {
         return;
     }
     if (this.displayAsset.type == EItemType.GUN)
     {
         if (this.displayAsset.slot == ESlotType.PRIMARY)
         {
             this.displayModel.parent = this.gunLargeTransform;
         }
         else
         {
             this.displayModel.parent = this.gunSmallTransform;
         }
     }
     else if (this.displayAsset.type == EItemType.MELEE)
     {
         this.displayModel.parent = this.meleeTransform;
     }
     else
     {
         this.displayModel.parent = this.itemTransform;
     }
     this.displayModel.localPosition = Vector3.zero;
     this.displayModel.localRotation = this.displayRotation;
     this.displayModel.localScale    = Vector3.one;
     Object.Destroy(this.displayModel.GetComponent <Collider>());
 }
コード例 #4
0
        // Token: 0x06003740 RID: 14144 RVA: 0x0018163C File Offset: 0x0017FA3C
        public static void viewItem(int newItem, ulong newInstance)
        {
            MenuSurvivorsClothingInspectUI.item     = newItem;
            MenuSurvivorsClothingInspectUI.instance = newInstance;
            if (MenuSurvivorsClothingInspectUI.model != null)
            {
                UnityEngine.Object.Destroy(MenuSurvivorsClothingInspectUI.model.gameObject);
            }
            ushort id;
            ushort id2;

            Provider.provider.economyService.getInventoryTargetID(MenuSurvivorsClothingInspectUI.item, out id, out id2);
            ushort       inventorySkinID   = Provider.provider.economyService.getInventorySkinID(MenuSurvivorsClothingInspectUI.item);
            ushort       inventoryMythicID = Provider.provider.economyService.getInventoryMythicID(MenuSurvivorsClothingInspectUI.item);
            ItemAsset    itemAsset         = (ItemAsset)Assets.find(EAssetType.ITEM, id);
            VehicleAsset vehicleAsset      = (VehicleAsset)Assets.find(EAssetType.VEHICLE, id2);

            if (itemAsset == null && vehicleAsset == null)
            {
                return;
            }
            if (inventorySkinID != 0)
            {
                SkinAsset skinAsset = (SkinAsset)Assets.find(EAssetType.SKIN, inventorySkinID);
                if (vehicleAsset != null)
                {
                    MenuSurvivorsClothingInspectUI.model = VehicleTool.getVehicle(vehicleAsset.id, skinAsset.id, inventoryMythicID, vehicleAsset, skinAsset);
                }
                else
                {
                    ushort    id3        = itemAsset.id;
                    ushort    skin       = inventorySkinID;
                    byte      quality    = 100;
                    byte[]    state      = itemAsset.getState();
                    bool      viewmodel  = false;
                    ItemAsset itemAsset2 = itemAsset;
                    SkinAsset skinAsset2 = skinAsset;
                    if (MenuSurvivorsClothingInspectUI.< > f__mg$cache0 == null)
                    {
                        MenuSurvivorsClothingInspectUI.< > f__mg$cache0 = new GetStatTrackerValueHandler(MenuSurvivorsClothingInspectUI.getInspectedItemStatTrackerValue);
                    }
                    MenuSurvivorsClothingInspectUI.model = ItemTool.getItem(id3, skin, quality, state, viewmodel, itemAsset2, skinAsset2, MenuSurvivorsClothingInspectUI.< > f__mg$cache0);
                    if (inventoryMythicID != 0)
                    {
                        ItemTool.applyEffect(MenuSurvivorsClothingInspectUI.model, inventoryMythicID, EEffectType.THIRD);
                    }
                }
            }
            else
            {
                ushort    id4        = itemAsset.id;
                ushort    skin2      = 0;
                byte      quality2   = 100;
                byte[]    state2     = itemAsset.getState();
                bool      viewmodel2 = false;
                ItemAsset itemAsset3 = itemAsset;
                if (MenuSurvivorsClothingInspectUI.< > f__mg$cache1 == null)
                {
                    MenuSurvivorsClothingInspectUI.< > f__mg$cache1 = new GetStatTrackerValueHandler(MenuSurvivorsClothingInspectUI.getInspectedItemStatTrackerValue);
                }
                MenuSurvivorsClothingInspectUI.model = ItemTool.getItem(id4, skin2, quality2, state2, viewmodel2, itemAsset3, MenuSurvivorsClothingInspectUI.< > f__mg$cache1);
                if (inventoryMythicID != 0)
                {
                    ItemTool.applyEffect(MenuSurvivorsClothingInspectUI.model, inventoryMythicID, EEffectType.HOOK);
                }
            }
            MenuSurvivorsClothingInspectUI.model.parent        = MenuSurvivorsClothingInspectUI.inspect;
            MenuSurvivorsClothingInspectUI.model.localPosition = Vector3.zero;
            if (vehicleAsset != null)
            {
                MenuSurvivorsClothingInspectUI.model.localRotation = Quaternion.identity;
            }
            else if (itemAsset != null && itemAsset.type == EItemType.MELEE)
            {
                MenuSurvivorsClothingInspectUI.model.localRotation = Quaternion.Euler(0f, -90f, 90f);
            }
            else
            {
                MenuSurvivorsClothingInspectUI.model.localRotation = Quaternion.Euler(-90f, 0f, 0f);
            }
            Bounds bounds = new Bounds(MenuSurvivorsClothingInspectUI.model.position, Vector3.zero);

            Collider[] components = MenuSurvivorsClothingInspectUI.model.GetComponents <Collider>();
            foreach (Collider collider in components)
            {
                Bounds bounds2 = collider.bounds;
                bounds.Encapsulate(bounds2);
            }
            MenuSurvivorsClothingInspectUI.look.pos  = bounds.center;
            MenuSurvivorsClothingInspectUI.look.dist = bounds.extents.magnitude * 2.25f;
        }
コード例 #5
0
        public void apply()
        {
            if (Dedicator.isDedicated)
            {
                return;
            }
            ItemShirtAsset itemShirtAsset = (this.visualShirtAsset == null || !this.isVisual) ? this.shirtAsset : this.visualShirtAsset;
            ItemPantsAsset itemPantsAsset = (this.visualPantsAsset == null || !this.isVisual) ? this.pantsAsset : this.visualPantsAsset;

            if (this.needsClothesUpdate || this.needsShirtUpdate || this.needsPantsUpdate)
            {
                this.clothing.shirt         = null;
                this.clothing.shirtEmission = null;
                this.clothing.shirtMetallic = null;
                this.clothing.flipShirt     = false;
                if (itemShirtAsset != null)
                {
                    this.clothing.shirt         = itemShirtAsset.shirt;
                    this.clothing.shirtEmission = itemShirtAsset.emission;
                    this.clothing.shirtMetallic = itemShirtAsset.metallic;
                    this.clothing.flipShirt     = (this.hand && itemShirtAsset.ignoreHand);
                }
                this.clothing.pants         = null;
                this.clothing.pantsEmission = null;
                this.clothing.pantsMetallic = null;
                if (itemPantsAsset != null)
                {
                    this.clothing.pants         = itemPantsAsset.pants;
                    this.clothing.pantsEmission = itemPantsAsset.emission;
                    this.clothing.pantsMetallic = itemPantsAsset.metallic;
                }
                this.clothing.apply();
                if (this.materialClothing != null)
                {
                    this.materialClothing.mainTexture = this.clothing.texture;
                    this.materialClothing.SetTexture("_EmissionMap", this.clothing.emission);
                    this.materialClothing.SetTexture("_MetallicGlossMap", this.clothing.metallic);
                }
            }
            if (!this.isMine)
            {
                if (this.needsShirtUpdate)
                {
                    if (this.isUpper && this.upperSystems != null)
                    {
                        for (int i = 0; i < this.upperSystems.Length; i++)
                        {
                            Transform transform = this.upperSystems[i];
                            if (transform != null)
                            {
                                Object.Destroy(transform.gameObject);
                            }
                        }
                        this.isUpper = false;
                    }
                    if (this.isVisual && this.isMythic && this.visualShirt != 0)
                    {
                        ushort inventoryMythicID = Provider.provider.economyService.getInventoryMythicID(this.visualShirt);
                        if (inventoryMythicID != 0)
                        {
                            ItemTool.applyEffect(this.upperBones, this.upperSystems, inventoryMythicID, EEffectType.AREA);
                            this.isUpper = true;
                        }
                    }
                }
                if (this.needsPantsUpdate)
                {
                    if (this.isLower && this.lowerSystems != null)
                    {
                        for (int j = 0; j < this.lowerSystems.Length; j++)
                        {
                            Transform transform2 = this.lowerSystems[j];
                            if (transform2 != null)
                            {
                                Object.Destroy(transform2.gameObject);
                            }
                        }
                        this.isLower = false;
                    }
                    if (this.isVisual && this.isMythic && this.visualPants != 0)
                    {
                        ushort inventoryMythicID2 = Provider.provider.economyService.getInventoryMythicID(this.visualPants);
                        if (inventoryMythicID2 != 0)
                        {
                            ItemTool.applyEffect(this.lowerBones, this.lowerSystems, inventoryMythicID2, EEffectType.AREA);
                            this.isLower = true;
                        }
                    }
                }
                ItemHatAsset      itemHatAsset      = (this.visualHatAsset == null || !this.isVisual) ? this.hatAsset : this.visualHatAsset;
                ItemBackpackAsset itemBackpackAsset = (this.visualBackpackAsset == null || !this.isVisual) ? this.backpackAsset : this.visualBackpackAsset;
                ItemVestAsset     itemVestAsset     = (this.visualVestAsset == null || !this.isVisual) ? this.vestAsset : this.visualVestAsset;
                ItemMaskAsset     itemMaskAsset     = (this.visualMaskAsset == null || !this.isVisual) ? this.maskAsset : this.visualMaskAsset;
                ItemGlassesAsset  itemGlassesAsset  = (this.visualGlassesAsset == null || !this.isVisual || (this.glassesAsset != null && (this.glassesAsset.vision != ELightingVision.NONE || this.glassesAsset.isBlindfold))) ? this.glassesAsset : this.visualGlassesAsset;
                bool flag  = true;
                bool flag2 = true;
                if (this.needsHatUpdate)
                {
                    if (this.hatModel != null)
                    {
                        Object.Destroy(this.hatModel.gameObject);
                    }
                    if (itemHatAsset != null && itemHatAsset.hat != null)
                    {
                        this.hatModel                         = Object.Instantiate <GameObject>(itemHatAsset.hat).transform;
                        this.hatModel.name                    = "Hat";
                        this.hatModel.transform.parent        = this.skull;
                        this.hatModel.transform.localPosition = Vector3.zero;
                        this.hatModel.transform.localRotation = Quaternion.identity;
                        this.hatModel.transform.localScale    = Vector3.one;
                        if (!this.isView)
                        {
                            Object.Destroy(this.hatModel.GetComponent <Collider>());
                        }
                        if (this.isVisual && this.isMythic && this.visualHat != 0)
                        {
                            ushort inventoryMythicID3 = Provider.provider.economyService.getInventoryMythicID(this.visualHat);
                            if (inventoryMythicID3 != 0)
                            {
                                ItemTool.applyEffect(this.hatModel, inventoryMythicID3, EEffectType.HOOK);
                            }
                        }
                    }
                }
                if (itemHatAsset != null && itemHatAsset.hat != null)
                {
                    if (!itemHatAsset.hasHair)
                    {
                        flag = false;
                    }
                    if (!itemHatAsset.hasBeard)
                    {
                        flag2 = false;
                    }
                }
                if (this.needsBackpackUpdate)
                {
                    if (this.backpackModel != null)
                    {
                        Object.Destroy(this.backpackModel.gameObject);
                    }
                    if (itemBackpackAsset != null && itemBackpackAsset.backpack != null)
                    {
                        this.backpackModel                         = Object.Instantiate <GameObject>(itemBackpackAsset.backpack).transform;
                        this.backpackModel.name                    = "Backpack";
                        this.backpackModel.transform.parent        = this.spine;
                        this.backpackModel.transform.localPosition = Vector3.zero;
                        this.backpackModel.transform.localRotation = Quaternion.identity;
                        this.backpackModel.transform.localScale    = Vector3.one;
                        if (!this.isView)
                        {
                            Object.Destroy(this.backpackModel.GetComponent <Collider>());
                        }
                        if (this.isVisual && this.isMythic && this.visualBackpack != 0)
                        {
                            ushort inventoryMythicID4 = Provider.provider.economyService.getInventoryMythicID(this.visualBackpack);
                            if (inventoryMythicID4 != 0)
                            {
                                ItemTool.applyEffect(this.backpackModel, inventoryMythicID4, EEffectType.HOOK);
                            }
                        }
                        this.backpackModel.gameObject.SetActive(this.hasBackpack);
                    }
                }
                if (this.needsVestUpdate)
                {
                    if (this.vestModel != null)
                    {
                        Object.Destroy(this.vestModel.gameObject);
                    }
                    if (itemVestAsset != null && itemVestAsset.vest != null)
                    {
                        this.vestModel                         = Object.Instantiate <GameObject>(itemVestAsset.vest).transform;
                        this.vestModel.name                    = "Vest";
                        this.vestModel.transform.parent        = this.spine;
                        this.vestModel.transform.localPosition = Vector3.zero;
                        this.vestModel.transform.localRotation = Quaternion.identity;
                        this.vestModel.transform.localScale    = Vector3.one;
                        if (!this.isView)
                        {
                            Object.Destroy(this.vestModel.GetComponent <Collider>());
                        }
                        if (this.isVisual && this.isMythic && this.visualVest != 0)
                        {
                            ushort inventoryMythicID5 = Provider.provider.economyService.getInventoryMythicID(this.visualVest);
                            if (inventoryMythicID5 != 0)
                            {
                                ItemTool.applyEffect(this.vestModel, inventoryMythicID5, EEffectType.HOOK);
                            }
                        }
                    }
                }
                if (this.needsMaskUpdate)
                {
                    if (this.maskModel != null)
                    {
                        Object.Destroy(this.maskModel.gameObject);
                    }
                    if (itemMaskAsset != null && itemMaskAsset.mask != null)
                    {
                        this.maskModel                         = Object.Instantiate <GameObject>(itemMaskAsset.mask).transform;
                        this.maskModel.name                    = "Mask";
                        this.maskModel.transform.parent        = this.skull;
                        this.maskModel.transform.localPosition = Vector3.zero;
                        this.maskModel.transform.localRotation = Quaternion.identity;
                        this.maskModel.transform.localScale    = Vector3.one;
                        if (!this.isView)
                        {
                            Object.Destroy(this.maskModel.GetComponent <Collider>());
                        }
                        if (this.isVisual && this.isMythic && this.visualMask != 0)
                        {
                            ushort inventoryMythicID6 = Provider.provider.economyService.getInventoryMythicID(this.visualMask);
                            if (inventoryMythicID6 != 0)
                            {
                                ItemTool.applyEffect(this.maskModel, inventoryMythicID6, EEffectType.HOOK);
                            }
                        }
                    }
                }
                if (itemMaskAsset != null && itemMaskAsset.mask != null)
                {
                    if (!itemMaskAsset.hasHair)
                    {
                        flag = false;
                    }
                    if (!itemMaskAsset.hasBeard)
                    {
                        flag2 = false;
                    }
                }
                if (this.needsGlassesUpdate)
                {
                    if (this.glassesModel != null)
                    {
                        Object.Destroy(this.glassesModel.gameObject);
                    }
                    if (itemGlassesAsset != null && itemGlassesAsset.glasses != null)
                    {
                        this.glassesModel                         = Object.Instantiate <GameObject>(itemGlassesAsset.glasses).transform;
                        this.glassesModel.name                    = "Glasses";
                        this.glassesModel.transform.parent        = this.skull;
                        this.glassesModel.transform.localPosition = Vector3.zero;
                        this.glassesModel.transform.localRotation = Quaternion.identity;
                        this.glassesModel.localScale              = Vector3.one;
                        if (!this.isView)
                        {
                            Object.Destroy(this.glassesModel.GetComponent <Collider>());
                        }
                        if (this.isVisual && this.isMythic && this.visualGlasses != 0)
                        {
                            ushort inventoryMythicID7 = Provider.provider.economyService.getInventoryMythicID(this.visualGlasses);
                            if (inventoryMythicID7 != 0)
                            {
                                ItemTool.applyEffect(this.glassesModel, inventoryMythicID7, EEffectType.HOOK);
                            }
                        }
                    }
                }
                if (itemGlassesAsset != null && itemGlassesAsset.glasses != null)
                {
                    if (!itemGlassesAsset.hasHair)
                    {
                        flag = false;
                    }
                    if (!itemGlassesAsset.hasBeard)
                    {
                        flag2 = false;
                    }
                }
                if (this.materialHair != null)
                {
                    this.materialHair.color = this.color;
                }
                if (this.hasHair != flag)
                {
                    this.hasHair         = flag;
                    this.needsHairUpdate = true;
                }
                if (this.needsHairUpdate)
                {
                    if (this.hairModel != null)
                    {
                        Object.Destroy(this.hairModel.gameObject);
                    }
                    if (this.hasHair)
                    {
                        Object @object = Resources.Load("Hairs/" + this.hair + "/Hair");
                        if (@object != null)
                        {
                            this.hairModel                         = ((GameObject)Object.Instantiate(@object)).transform;
                            this.hairModel.name                    = "Hair";
                            this.hairModel.transform.parent        = this.skull;
                            this.hairModel.transform.localPosition = Vector3.zero;
                            this.hairModel.transform.localRotation = Quaternion.identity;
                            this.hairModel.transform.localScale    = Vector3.one;
                            if (this.hairModel.FindChild("Model_0") != null)
                            {
                                this.hairModel.FindChild("Model_0").GetComponent <Renderer>().sharedMaterial = this.materialHair;
                            }
                        }
                    }
                }
                if (this.hasBeard != flag2)
                {
                    this.hasBeard         = flag2;
                    this.needsBeardUpdate = true;
                }
                if (this.needsBeardUpdate)
                {
                    if (this.beardModel != null)
                    {
                        Object.Destroy(this.beardModel.gameObject);
                    }
                    if (this.hasBeard)
                    {
                        Object object2 = Resources.Load("Beards/" + this.beard + "/Beard");
                        if (object2 != null)
                        {
                            this.beardModel                         = ((GameObject)Object.Instantiate(object2)).transform;
                            this.beardModel.name                    = "Beard";
                            this.beardModel.transform.parent        = this.skull;
                            this.beardModel.transform.localPosition = Vector3.zero;
                            this.beardModel.transform.localRotation = Quaternion.identity;
                            this.beardModel.localScale              = Vector3.one;
                            if (this.beardModel.FindChild("Model_0") != null)
                            {
                                this.beardModel.FindChild("Model_0").GetComponent <Renderer>().sharedMaterial = this.materialHair;
                            }
                        }
                    }
                }
            }
            this.updateAll(false);
        }
コード例 #6
0
        // Token: 0x06002A15 RID: 10773 RVA: 0x0010512C File Offset: 0x0010352C
        private static void apply(byte slot, bool showItems)
        {
            if (Characters.slots[(int)slot] != null)
            {
                UnityEngine.Object.Destroy(Characters.slots[(int)slot].gameObject);
            }
            if (!showItems)
            {
                return;
            }
            ushort num = 0;

            byte[] state = null;
            if (slot == 0)
            {
                num   = Characters.active.primaryItem;
                state = Characters.active.primaryState;
            }
            else if (slot == 1)
            {
                num   = Characters.active.secondaryItem;
                state = Characters.active.secondaryState;
            }
            if (num == 0)
            {
                return;
            }
            ItemAsset itemAsset = (ItemAsset)Assets.find(EAssetType.ITEM, num);

            if (itemAsset != null)
            {
                ushort skin = 0;
                ushort num2 = 0;
                for (int i = 0; i < Characters.packageSkins.Count; i++)
                {
                    ulong num3 = Characters.packageSkins[i];
                    if (num3 != 0UL)
                    {
                        int inventoryItem = Provider.provider.economyService.getInventoryItem(num3);
                        if (inventoryItem != 0)
                        {
                            ushort inventoryItemID = Provider.provider.economyService.getInventoryItemID(inventoryItem);
                            if (inventoryItemID != 0)
                            {
                                if (num == inventoryItemID)
                                {
                                    skin = Provider.provider.economyService.getInventorySkinID(inventoryItem);
                                    num2 = Provider.provider.economyService.getInventoryMythicID(inventoryItem);
                                    break;
                                }
                            }
                        }
                    }
                }
                GetStatTrackerValueHandler statTrackerCallback = null;
                if (slot == 0)
                {
                    if (Characters.< > f__mg$cache0 == null)
                    {
                        Characters.< > f__mg$cache0 = new GetStatTrackerValueHandler(Characters.getSlot0StatTrackerValue);
                    }
                    statTrackerCallback = Characters.< > f__mg$cache0;
                }
                else if (slot == 1)
                {
                    if (Characters.< > f__mg$cache1 == null)
                    {
                        Characters.< > f__mg$cache1 = new GetStatTrackerValueHandler(Characters.getSlot1StatTrackerValue);
                    }
                    statTrackerCallback = Characters.< > f__mg$cache1;
                }
                Transform item = ItemTool.getItem(num, skin, 100, state, false, statTrackerCallback);
                if (slot == 0)
                {
                    if (itemAsset.type == EItemType.MELEE)
                    {
                        item.transform.parent = Characters.primaryMeleeSlot;
                    }
                    else if (itemAsset.slot == ESlotType.PRIMARY)
                    {
                        item.transform.parent = Characters.primaryLargeGunSlot;
                    }
                    else
                    {
                        item.transform.parent = Characters.primarySmallGunSlot;
                    }
                }
                else if (slot == 1)
                {
                    if (itemAsset.type == EItemType.MELEE)
                    {
                        item.transform.parent = Characters.secondaryMeleeSlot;
                    }
                    else
                    {
                        item.transform.parent = Characters.secondaryGunSlot;
                    }
                }
                item.localPosition = Vector3.zero;
                item.localRotation = Quaternion.Euler(0f, 0f, 90f);
                item.localScale    = Vector3.one;
                UnityEngine.Object.Destroy(item.GetComponent <Collider>());
                if (num2 != 0)
                {
                    ItemTool.applyEffect(item, num2, EEffectType.THIRD);
                }
                Characters.slots[(int)slot] = item;
            }
        }