public void LoadItems()
        {
            var assets = Assets.find(EAssetType.ITEM).Cast <ItemAsset>().ToList();

            foreach (ItemAsset asset in assets)
            {
                var ready = new ItemIconReady((icon) =>
                {
                    AddUnturnedIcon(asset.id, icon.EncodeToPNG());
                });
                ItemTool.getIcon(asset.id, 0, asset.quality, asset.getState(), asset, null, string.Empty, string.Empty, asset.size_x * 250, asset.size_y * 250, false, true, ready);
            }
        }
Beispiel #2
0
        public static void getIcon(ushort id, byte quality, byte[] state, ItemIconReady callback)
        {
            ushort    num       = 0;
            SkinAsset skinAsset = null;
            int       num2;

            if (Player.player != null && Player.player.channel.owner.skins.TryGetValue(id, out num2) && num2 != 0)
            {
                num       = Provider.provider.economyService.getInventorySkinID(num2);
                skinAsset = (SkinAsset)Assets.find(EAssetType.SKIN, num);
            }
            ItemAsset itemAsset = (ItemAsset)Assets.find(EAssetType.ITEM, id);

            ItemTool.getIcon(id, num, quality, state, itemAsset, skinAsset, (int)(itemAsset.size_x * 50), (int)(itemAsset.size_y * 50), false, callback);
        }
        public void LoadItems()
        {
            UnturnedMarketplaceModule.Instance.Config.Reload(UnturnedMarketplaceModule.Instance);
            List <ushort> noIconItems = GetItemsWithNoIcons();

            Debug.Log($"{noIconItems.Count} items do not have icons");

            int num1 = 0;

            foreach (ushort itemId in noIconItems)
            {
                ItemAsset asset = Assets.find(EAssetType.ITEM, itemId) as ItemAsset;
                var       ready = new ItemIconReady((icon) =>
                {
                    UploadUnturnedItemIcon(asset.id, icon.EncodeToPNG());
                });

                ItemTool.getIcon(asset.id, 0, asset.quality, asset.getState(), asset, null, string.Empty, string.Empty,
                                 asset.size_x * UnturnedMarketplaceModule.Instance.Config.IconSize, asset.size_y * UnturnedMarketplaceModule.Instance.Config.IconSize, false, true, ready);
                num1++;
            }
        }
Beispiel #4
0
        public static void getIcon(ushort id, ushort skin, byte quality, byte[] state, ItemAsset itemAsset, SkinAsset skinAsset, int x, int y, bool scale, ItemIconReady callback)
        {
            if (itemAsset != null && id != itemAsset.id)
            {
                Debug.LogError("ID and item asset ID are not in sync!");
            }
            if (skinAsset != null && skin != skinAsset.id)
            {
                Debug.LogError("ID and skin asset ID are not in sync!");
            }
            Texture2D texture2D;

            if (state.Length == 0 && skin == 0 && x == (int)(itemAsset.size_x * 50) && y == (int)(itemAsset.size_y * 50) && ItemTool.cache.TryGetValue(id, out texture2D))
            {
                if (texture2D != null)
                {
                    callback(texture2D);
                    return;
                }
                ItemTool.cache.Remove(id);
            }
            ItemIconInfo itemIconInfo = new ItemIconInfo();

            itemIconInfo.id        = id;
            itemIconInfo.skin      = skin;
            itemIconInfo.quality   = quality;
            itemIconInfo.state     = state;
            itemIconInfo.itemAsset = itemAsset;
            itemIconInfo.skinAsset = skinAsset;
            itemIconInfo.x         = x;
            itemIconInfo.y         = y;
            itemIconInfo.scale     = scale;
            itemIconInfo.callback  = callback;
            ItemTool.icons.Enqueue(itemIconInfo);
        }
        // Token: 0x06003428 RID: 13352 RVA: 0x00154140 File Offset: 0x00152540
        public static void getIcon(ushort id, byte quality, byte[] state, ItemAsset itemAsset, int x, int y, ItemIconReady callback)
        {
            ushort    num       = 0;
            SkinAsset skinAsset = null;
            string    empty     = string.Empty;
            string    empty2    = string.Empty;
            int       num2;

            if (Player.player != null && Player.player.channel.owner.getItemSkinItemDefID(id, out num2) && num2 != 0)
            {
                num       = Provider.provider.economyService.getInventorySkinID(num2);
                skinAsset = (SkinAsset)Assets.find(EAssetType.SKIN, num);
                Player.player.channel.owner.getTagsAndDynamicPropsForItem(num2, out empty, out empty2);
            }
            ItemTool.getIcon(id, num, quality, state, itemAsset, skinAsset, empty, empty2, x, y, false, callback);
        }
 // Token: 0x06003427 RID: 13351 RVA: 0x00154120 File Offset: 0x00152520
 public static void getIcon(ushort id, byte quality, byte[] state, ItemAsset itemAsset, ItemIconReady callback)
 {
     ItemTool.getIcon(id, quality, state, itemAsset, (int)(itemAsset.size_x * 50), (int)(itemAsset.size_y * 50), callback);
 }
        // Token: 0x06003426 RID: 13350 RVA: 0x001540FC File Offset: 0x001524FC
        public static void getIcon(ushort id, byte quality, byte[] state, ItemIconReady callback)
        {
            ItemAsset itemAsset = (ItemAsset)Assets.find(EAssetType.ITEM, id);

            ItemTool.getIcon(id, quality, state, itemAsset, callback);
        }