Esempio n. 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;
        }
Esempio n. 2
0
        // Token: 0x06002845 RID: 10309 RVA: 0x000F3DC0 File Offset: 0x000F21C0
        private void spawnItem(byte x, byte y, ushort id, byte amount, byte quality, byte[] state, Vector3 point, uint instanceID)
        {
            ItemAsset itemAsset = (ItemAsset)Assets.find(EAssetType.ITEM, id);

            if (itemAsset != null)
            {
                Transform transform = new GameObject().transform;
                transform.name               = id.ToString();
                transform.transform.parent   = LevelItems.models;
                transform.transform.position = point;
                Transform item = ItemTool.getItem(id, 0, quality, state, false, itemAsset, null);
                item.parent = transform;
                InteractableItem interactableItem = item.gameObject.AddComponent <InteractableItem>();
                interactableItem.item  = new Item(id, amount, quality, state);
                interactableItem.asset = itemAsset;
                item.position          = point + Vector3.up * 0.75f;
                item.rotation          = Quaternion.Euler((float)(-90 + UnityEngine.Random.Range(-15, 15)), (float)UnityEngine.Random.Range(0, 360), (float)UnityEngine.Random.Range(-15, 15));
                item.gameObject.AddComponent <Rigidbody>();
                item.GetComponent <Rigidbody>().interpolation          = RigidbodyInterpolation.Interpolate;
                item.GetComponent <Rigidbody>().collisionDetectionMode = CollisionDetectionMode.Discrete;
                item.GetComponent <Rigidbody>().drag        = 0.5f;
                item.GetComponent <Rigidbody>().angularDrag = 0.1f;
                if (LevelObjects.loads[(int)x, (int)y] != -1)
                {
                    item.GetComponent <Rigidbody>().useGravity  = false;
                    item.GetComponent <Rigidbody>().isKinematic = true;
                }
                ItemDrop item2 = new ItemDrop(transform, interactableItem, instanceID);
                ItemManager.regions[(int)x, (int)y].drops.Add(item2);
                if (ItemManager.onItemDropAdded != null)
                {
                    ItemManager.onItemDropAdded(item, interactableItem);
                }
            }
        }
Esempio n. 3
0
        // Token: 0x06003421 RID: 13345 RVA: 0x00153B70 File Offset: 0x00151F70
        public static Transform getItem(ushort id, ushort skin, byte quality, byte[] state, bool viewmodel, ItemAsset itemAsset, List <Mesh> outTempMeshes, out Material tempMaterial, GetStatTrackerValueHandler statTrackerCallback)
        {
            SkinAsset skinAsset = null;

            if (skin != 0)
            {
                skinAsset = (SkinAsset)Assets.find(EAssetType.SKIN, skin);
            }
            return(ItemTool.getItem(id, skin, quality, state, viewmodel, itemAsset, skinAsset, outTempMeshes, out tempMaterial, statTrackerCallback));
        }
Esempio n. 4
0
        public static Transform getItem(ushort id, ushort skin, byte quality, byte[] state, bool viewmodel, ItemAsset itemAsset)
        {
            SkinAsset skinAsset = null;

            if (skin != 0)
            {
                skinAsset = (SkinAsset)Assets.find(EAssetType.SKIN, skin);
            }
            return(ItemTool.getItem(id, skin, quality, state, viewmodel, itemAsset, skinAsset));
        }
Esempio n. 5
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>());
 }
Esempio n. 6
0
        // Token: 0x06002168 RID: 8552 RVA: 0x000B5FB4 File Offset: 0x000B43B4
        public override void updateState(Asset asset, byte[] state)
        {
            base.updateState(asset, state);
            if (!this.isInit)
            {
                this.isInit    = true;
                this._npcAsset = (asset as ObjectNPCAsset);
                if (!Dedicator.isDedicated)
                {
                    Transform transform  = base.transform.FindChild("Root");
                    Transform transform2 = transform.FindChild("Skeleton");
                    this.skull           = transform2.FindChild("Spine").FindChild("Skull");
                    this.anim            = transform.GetComponent <Animation>();
                    this.humanAnim       = transform.GetComponent <HumanAnimator>();
                    transform.localScale = new Vector3((float)((!this.npcAsset.isBackward) ? 1 : -1), 1f, 1f);
                    ItemAsset itemAsset  = (ItemAsset)Assets.find(EAssetType.ITEM, this.npcAsset.primary);
                    ItemAsset itemAsset2 = (ItemAsset)Assets.find(EAssetType.ITEM, this.npcAsset.secondary);
                    ItemAsset itemAsset3 = (ItemAsset)Assets.find(EAssetType.ITEM, this.npcAsset.tertiary);
                    ItemAsset itemAsset4 = null;
                    Transform parent     = transform2.FindChild("Spine").FindChild("Primary_Melee");
                    Transform parent2    = transform2.FindChild("Spine").FindChild("Primary_Large_Gun");
                    Transform parent3    = transform2.FindChild("Spine").FindChild("Primary_Small_Gun");
                    Transform parent4    = transform2.FindChild("Right_Hip").FindChild("Right_Leg").FindChild("Secondary_Melee");
                    Transform parent5    = transform2.FindChild("Right_Hip").FindChild("Right_Leg").FindChild("Secondary_Gun");
                    Transform parent6    = transform2.FindChild("Spine").FindChild("Left_Shoulder").FindChild("Left_Arm").FindChild("Left_Hand").FindChild("Left_Hook");
                    Transform parent7    = transform2.FindChild("Spine").FindChild("Right_Shoulder").FindChild("Right_Arm").FindChild("Right_Hand").FindChild("Right_Hook");
                    this.clothes          = transform.GetComponent <HumanClothes>();
                    this.clothes.shirt    = this.npcAsset.shirt;
                    this.clothes.pants    = this.npcAsset.pants;
                    this.clothes.hat      = this.npcAsset.hat;
                    this.clothes.backpack = this.npcAsset.backpack;
                    this.clothes.vest     = this.npcAsset.vest;
                    this.clothes.mask     = this.npcAsset.mask;
                    this.clothes.glasses  = this.npcAsset.glasses;
                    this.clothes.face     = this.npcAsset.face;
                    this.clothes.hair     = this.npcAsset.hair;
                    this.clothes.beard    = this.npcAsset.beard;
                    this.clothes.skin     = this.npcAsset.skin;
                    this.clothes.color    = this.npcAsset.color;
                    this.clothes.apply();
                    if (this.npcAsset.primary != 0 && itemAsset != null)
                    {
                        Material  material;
                        Transform item = ItemTool.getItem(itemAsset.id, 0, 100, itemAsset.getState(), false, itemAsset, null, out material, null);
                        if (this.npcAsset.equipped == ESlotType.PRIMARY)
                        {
                            if (itemAsset.isBackward)
                            {
                                item.transform.parent = parent6;
                            }
                            else
                            {
                                item.transform.parent = parent7;
                            }
                            itemAsset4 = itemAsset;
                        }
                        else if (itemAsset.type == EItemType.MELEE)
                        {
                            item.transform.parent = parent;
                        }
                        else if (itemAsset.slot == ESlotType.PRIMARY)
                        {
                            item.transform.parent = parent2;
                        }
                        else
                        {
                            item.transform.parent = parent3;
                        }
                        item.localPosition = Vector3.zero;
                        item.localRotation = Quaternion.Euler(0f, 0f, 90f);
                        item.localScale    = Vector3.one;
                        UnityEngine.Object.Destroy(item.GetComponent <Collider>());
                        Layerer.enemy(item);
                    }
                    if (this.npcAsset.secondary != 0 && itemAsset2 != null)
                    {
                        Material  material2;
                        Transform item2 = ItemTool.getItem(itemAsset2.id, 0, 100, itemAsset2.getState(), false, itemAsset2, null, out material2, null);
                        if (this.npcAsset.equipped == ESlotType.SECONDARY)
                        {
                            if (itemAsset2.isBackward)
                            {
                                item2.transform.parent = parent6;
                            }
                            else
                            {
                                item2.transform.parent = parent7;
                            }
                            itemAsset4 = itemAsset2;
                        }
                        else if (itemAsset2.type == EItemType.MELEE)
                        {
                            item2.transform.parent = parent4;
                        }
                        else
                        {
                            item2.transform.parent = parent5;
                        }
                        item2.localPosition = Vector3.zero;
                        item2.localRotation = Quaternion.Euler(0f, 0f, 90f);
                        item2.localScale    = Vector3.one;
                        UnityEngine.Object.Destroy(item2.GetComponent <Collider>());
                        Layerer.enemy(item2);
                    }
                    if (this.npcAsset.tertiary != 0 && itemAsset3 != null && this.npcAsset.equipped == ESlotType.TERTIARY)
                    {
                        Material  material3;
                        Transform item3 = ItemTool.getItem(itemAsset3.id, 0, 100, itemAsset3.getState(), false, itemAsset3, null, out material3, null);
                        if (itemAsset3.isBackward)
                        {
                            item3.transform.parent = parent6;
                        }
                        else
                        {
                            item3.transform.parent = parent7;
                        }
                        itemAsset4          = itemAsset3;
                        item3.localPosition = Vector3.zero;
                        item3.localRotation = Quaternion.Euler(0f, 0f, 90f);
                        item3.localScale    = Vector3.one;
                        UnityEngine.Object.Destroy(item3.GetComponent <Collider>());
                        Layerer.enemy(item3);
                    }
                    if (itemAsset4 != null)
                    {
                        Transform mix  = transform2.FindChild("Spine").FindChild("Left_Shoulder");
                        Transform mix2 = transform2.FindChild("Spine").FindChild("Right_Shoulder");
                        int       i    = 0;
                        while (i < itemAsset4.animations.Length)
                        {
                            AnimationClip animationClip = itemAsset4.animations[i];
                            if (animationClip.name == "Equip")
                            {
                                this.hasEquip = true;
                                goto IL_683;
                            }
                            if (animationClip.name == "Sprint_Start" || animationClip.name == "Sprint_Stop")
                            {
                                this.hasSafety = true;
                                goto IL_683;
                            }
                            if (animationClip.name == "Inspect")
                            {
                                this.hasInspect = true;
                                goto IL_683;
                            }
IL_6E3:
                            i++;
                            continue;
IL_683:
                            this.anim.AddClip(animationClip, animationClip.name);
                            this.anim[animationClip.name].AddMixingTransform(mix, true);
                            this.anim[animationClip.name].AddMixingTransform(mix2, true);
                            this.anim[animationClip.name].layer = 1;
                            goto IL_6E3;
                        }
                    }
                    this.anim["Idle_Kick_Left"].AddMixingTransform(transform2.FindChild("Left_Hip"), true);
                    this.anim["Idle_Kick_Left"].layer = 2;
                    this.anim["Idle_Kick_Right"].AddMixingTransform(transform2.FindChild("Right_Hip"), true);
                    this.anim["Idle_Kick_Right"].layer = 2;
                    this.updateAnimation();
                }
            }
        }
        // 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;
        }
Esempio n. 8
0
        private void Update()
        {
            if (ItemTool.icons == null || ItemTool.icons.Count == 0)
            {
                return;
            }
            ItemIconInfo itemIconInfo = ItemTool.icons.Dequeue();

            if (itemIconInfo == null)
            {
                return;
            }
            if (itemIconInfo.itemAsset == null)
            {
                return;
            }
            Transform item = ItemTool.getItem(itemIconInfo.id, itemIconInfo.skin, itemIconInfo.quality, itemIconInfo.state, false, itemIconInfo.itemAsset, itemIconInfo.skinAsset);

            item.position = new Vector3(-256f, -256f, 0f);
            Transform transform;

            if (itemIconInfo.scale && itemIconInfo.skin != 0)
            {
                if (itemIconInfo.itemAsset.size2_z == 0f)
                {
                    item.position = new Vector3(0f, -256f, -256f);
                    Object.Destroy(item.gameObject);
                    Assets.errors.Add("Failed to create a skin icon of size 0 for " + itemIconInfo.id + ".");
                    return;
                }
                transform = item.FindChild("Icon2");
                if (transform == null)
                {
                    item.position = new Vector3(0f, -256f, -256f);
                    Object.Destroy(item.gameObject);
                    Assets.errors.Add("Failed to find a skin icon hook on " + itemIconInfo.id + ".");
                    return;
                }
            }
            else
            {
                if (itemIconInfo.itemAsset.size_z == 0f)
                {
                    item.position = new Vector3(0f, -256f, -256f);
                    Object.Destroy(item.gameObject);
                    Assets.errors.Add("Failed to create an item icon of size 0 for " + itemIconInfo.id + ".");
                    return;
                }
                transform = item.FindChild("Icon");
                if (transform == null)
                {
                    item.position = new Vector3(0f, -256f, -256f);
                    Object.Destroy(item.gameObject);
                    Assets.errors.Add("Failed to find an item icon hook on " + itemIconInfo.id + ".");
                    return;
                }
            }
            ItemTool.tool.transform.position = transform.position;
            ItemTool.tool.transform.rotation = transform.rotation;
            RenderTexture temporary = RenderTexture.GetTemporary(itemIconInfo.x, itemIconInfo.y, 16, 0, 2);

            temporary.name = string.Concat(new object[]
            {
                "Item_Render_",
                itemIconInfo.id,
                "_",
                itemIconInfo.skin
            });
            RenderTexture.active = temporary;
            ItemTool.tool.GetComponent <Camera>().targetTexture    = temporary;
            ItemTool.tool.GetComponent <Camera>().orthographicSize = itemIconInfo.itemAsset.size_z;
            if (itemIconInfo.scale)
            {
                if (itemIconInfo.skin != 0)
                {
                    ItemTool.tool.GetComponent <Camera>().orthographicSize = itemIconInfo.itemAsset.size2_z;
                }
                else
                {
                    float num = (float)itemIconInfo.itemAsset.size_x / (float)itemIconInfo.itemAsset.size_y;
                    ItemTool.tool.GetComponent <Camera>().orthographicSize *= num;
                }
            }
            bool        fog                 = RenderSettings.fog;
            AmbientMode ambientMode         = RenderSettings.ambientMode;
            Color       ambientSkyColor     = RenderSettings.ambientSkyColor;
            Color       ambientEquatorColor = RenderSettings.ambientEquatorColor;
            Color       ambientGroundColor  = RenderSettings.ambientGroundColor;

            RenderSettings.fog                 = false;
            RenderSettings.ambientMode         = 1;
            RenderSettings.ambientSkyColor     = Color.white;
            RenderSettings.ambientEquatorColor = Color.white;
            RenderSettings.ambientGroundColor  = Color.white;
            if (Provider.isConnected)
            {
                LevelLighting.setEnabled(false);
            }
            ItemTool.tool.GetComponent <Light>().enabled       = true;
            ItemTool.tool.GetComponent <Camera>().cullingMask  = RayMasks.ITEM;
            ItemTool.tool.GetComponent <Camera>().farClipPlane = 16f;
            ItemTool.tool.GetComponent <Camera>().Render();
            ItemTool.tool.GetComponent <Light>().enabled = false;
            if (Provider.isConnected)
            {
                LevelLighting.setEnabled(true);
            }
            RenderSettings.fog                 = fog;
            RenderSettings.ambientMode         = ambientMode;
            RenderSettings.ambientSkyColor     = ambientSkyColor;
            RenderSettings.ambientEquatorColor = ambientEquatorColor;
            RenderSettings.ambientGroundColor  = ambientGroundColor;
            item.position = new Vector3(0f, -256f, -256f);
            Object.Destroy(item.gameObject);
            Texture2D texture2D = new Texture2D(itemIconInfo.x, itemIconInfo.y, 5, false, true);

            texture2D.name = string.Concat(new object[]
            {
                "Item_Icon_",
                itemIconInfo.id,
                "_",
                itemIconInfo.skin
            });
            texture2D.filterMode = 0;
            texture2D.ReadPixels(new Rect(0f, 0f, (float)itemIconInfo.x, (float)itemIconInfo.y), 0, 0);
            texture2D.Apply();
            RenderTexture.ReleaseTemporary(temporary);
            if (itemIconInfo.callback != null)
            {
                itemIconInfo.callback(texture2D);
            }
            if (itemIconInfo.state.Length == 0 && itemIconInfo.skin == 0 && itemIconInfo.x == (int)(itemIconInfo.itemAsset.size_x * 50) && itemIconInfo.y == (int)(itemIconInfo.itemAsset.size_y * 50) && !ItemTool.cache.ContainsKey(itemIconInfo.id))
            {
                ItemTool.cache.Add(itemIconInfo.id, texture2D);
            }
        }
Esempio n. 9
0
        public static Transform getItem(ushort id, ushort skin, byte quality, byte[] state, bool viewmodel, ItemAsset itemAsset, SkinAsset skinAsset)
        {
            Material material;

            return(ItemTool.getItem(id, skin, quality, state, viewmodel, itemAsset, skinAsset, out material));
        }
Esempio n. 10
0
        public static Transform getItem(ushort id, ushort skin, byte quality, byte[] state, bool viewmodel)
        {
            ItemAsset itemAsset = (ItemAsset)Assets.find(EAssetType.ITEM, id);

            return(ItemTool.getItem(id, skin, quality, state, viewmodel, itemAsset));
        }
Esempio n. 11
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;
            }
        }
Esempio n. 12
0
        // Token: 0x0600342C RID: 13356 RVA: 0x0015455C File Offset: 0x0015295C
        private void Update()
        {
            if (ItemTool.icons == null || ItemTool.icons.Count == 0)
            {
                return;
            }
            ItemIconInfo itemIconInfo = ItemTool.icons.Dequeue();

            if (itemIconInfo == null)
            {
                return;
            }
            if (itemIconInfo.itemAsset == null)
            {
                return;
            }
            this.currentIconTags         = itemIconInfo.tags;
            this.currentIconDynamicProps = itemIconInfo.dynamic_props;
            Transform item = ItemTool.getItem(itemIconInfo.id, itemIconInfo.skin, itemIconInfo.quality, itemIconInfo.state, false, itemIconInfo.itemAsset, itemIconInfo.skinAsset, new GetStatTrackerValueHandler(this.getIconStatTrackerValue));

            item.position = new Vector3(-256f, -256f, 0f);
            Transform transform;

            if (itemIconInfo.scale && itemIconInfo.skin != 0)
            {
                if (itemIconInfo.itemAsset.size2_z == 0f)
                {
                    item.position = new Vector3(0f, -256f, -256f);
                    UnityEngine.Object.Destroy(item.gameObject);
                    Assets.errors.Add("Failed to create a skin icon of size 0 for " + itemIconInfo.id + ".");
                    return;
                }
                transform = item.FindChild("Icon2");
                if (transform == null)
                {
                    item.position = new Vector3(0f, -256f, -256f);
                    UnityEngine.Object.Destroy(item.gameObject);
                    Assets.errors.Add("Failed to find a skin icon hook on " + itemIconInfo.id + ".");
                    return;
                }
            }
            else
            {
                if (itemIconInfo.itemAsset.size_z == 0f)
                {
                    item.position = new Vector3(0f, -256f, -256f);
                    UnityEngine.Object.Destroy(item.gameObject);
                    Assets.errors.Add("Failed to create an item icon of size 0 for " + itemIconInfo.id + ".");
                    return;
                }
                transform = item.FindChild("Icon");
                if (transform == null)
                {
                    item.position = new Vector3(0f, -256f, -256f);
                    UnityEngine.Object.Destroy(item.gameObject);
                    Assets.errors.Add("Failed to find an item icon hook on " + itemIconInfo.id + ".");
                    return;
                }
            }
            float num = itemIconInfo.itemAsset.size_z;

            if (itemIconInfo.scale)
            {
                if (itemIconInfo.skin != 0)
                {
                    num = itemIconInfo.itemAsset.size2_z;
                }
                else
                {
                    float num2 = (float)itemIconInfo.itemAsset.size_x / (float)itemIconInfo.itemAsset.size_y;
                    num *= num2;
                }
            }
            Texture2D texture2D = ItemTool.captureIcon(itemIconInfo.id, itemIconInfo.skin, item, transform, itemIconInfo.x, itemIconInfo.y, num);

            if (itemIconInfo.callback != null)
            {
                itemIconInfo.callback(texture2D);
            }
            if (itemIconInfo.state.Length == 0 && itemIconInfo.skin == 0 && itemIconInfo.x == (int)(itemIconInfo.itemAsset.size_x * 50) && itemIconInfo.y == (int)(itemIconInfo.itemAsset.size_y * 50) && !ItemTool.cache.ContainsKey(itemIconInfo.id))
            {
                ItemTool.cache.Add(itemIconInfo.id, texture2D);
            }
        }
Esempio n. 13
0
        // Token: 0x06003423 RID: 13347 RVA: 0x00153BDC File Offset: 0x00151FDC
        public static Transform getItem(ushort id, ushort skin, byte quality, byte[] state, bool viewmodel, ItemAsset itemAsset, SkinAsset skinAsset, GetStatTrackerValueHandler statTrackerCallback)
        {
            Material material;

            return(ItemTool.getItem(id, skin, quality, state, viewmodel, itemAsset, skinAsset, null, out material, statTrackerCallback));
        }
Esempio n. 14
0
        // Token: 0x06003420 RID: 13344 RVA: 0x00153B48 File Offset: 0x00151F48
        public static Transform getItem(ushort id, ushort skin, byte quality, byte[] state, bool viewmodel, GetStatTrackerValueHandler statTrackerCallback)
        {
            ItemAsset itemAsset = (ItemAsset)Assets.find(EAssetType.ITEM, id);

            return(ItemTool.getItem(id, skin, quality, state, viewmodel, itemAsset, statTrackerCallback));
        }