private static void onClickedAddItemButton(SleekButton button) { if ((int)EditorSpawns.selectedZombie < LevelZombies.tables.Count) { ItemAsset itemAsset = (ItemAsset)Assets.find(EAssetType.ITEM, EditorSpawnsZombiesUI.itemIDField.state); if (itemAsset != null) { if (EditorSpawnsZombiesUI.selectedSlot == 0 && itemAsset.type != EItemType.SHIRT) { return; } if (EditorSpawnsZombiesUI.selectedSlot == 1 && itemAsset.type != EItemType.PANTS) { return; } if ((EditorSpawnsZombiesUI.selectedSlot == 2 || EditorSpawnsZombiesUI.selectedSlot == 3) && itemAsset.type != EItemType.HAT && itemAsset.type != EItemType.BACKPACK && itemAsset.type != EItemType.VEST && itemAsset.type != EItemType.MASK && itemAsset.type != EItemType.GLASSES) { return; } LevelZombies.tables[(int)EditorSpawns.selectedZombie].addCloth(EditorSpawnsZombiesUI.selectedSlot, EditorSpawnsZombiesUI.itemIDField.state); EditorSpawnsZombiesUI.updateSelection(); EditorSpawnsZombiesUI.spawnsScrollBox.state = new Vector2(0f, float.MaxValue); } EditorSpawnsZombiesUI.itemIDField.state = 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; }
// 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); } } }
public override string formatReward(Player player) { if (string.IsNullOrEmpty(this.text)) { this.text = PlayerNPCQuestUI.localization.read("Reward_Item"); } ItemAsset itemAsset = Assets.find(EAssetType.ITEM, this.id) as ItemAsset; string arg; if (itemAsset != null) { arg = string.Concat(new string[] { "<color=", Palette.hex(ItemTool.getRarityColorUI(itemAsset.rarity)), ">", itemAsset.itemName, "</color>" }); } else { arg = "?"; } return(string.Format(this.text, this.amount, arg)); }
public override string formatCondition(Player player) { if (string.IsNullOrEmpty(this.text)) { this.text = PlayerNPCQuestUI.localization.format("Condition_Item"); } ItemAsset itemAsset = Assets.find(EAssetType.ITEM, this.id) as ItemAsset; string arg; if (itemAsset != null) { arg = string.Concat(new string[] { "<color=", Palette.hex(ItemTool.getRarityColorUI(itemAsset.rarity)), ">", itemAsset.itemName, "</color>" }); } else { arg = "?"; } NPCItemCondition.search.Clear(); player.inventory.search(NPCItemCondition.search, this.id, false, true); return(string.Format(this.text, NPCItemCondition.search.Count, this.amount, arg)); }
public Item(ushort newID, EItemOrigin origin, byte newQuality) { this._id = newID; this.quality = newQuality; ItemAsset itemAsset = (ItemAsset)Assets.find(EAssetType.ITEM, this.id); if (itemAsset == null) { this.state = new byte[0]; return; } if (origin == EItemOrigin.WORLD && !Provider.modeConfigData.Items.Has_Durability) { origin = EItemOrigin.CRAFT; } if (origin != EItemOrigin.WORLD) { this.amount = itemAsset.amount; } else { this.amount = itemAsset.count; } this.state = itemAsset.getState(origin); }
// Token: 0x0600284A RID: 10314 RVA: 0x000F4490 File Offset: 0x000F2890 private bool respawnItems() { if (Level.info == null || Level.info.type == ELevelType.ARENA) { return(false); } if (LevelItems.spawns[(int)ItemManager.respawnItems_X, (int)ItemManager.respawnItems_Y].Count > 0) { if (Time.realtimeSinceStartup - ItemManager.regions[(int)ItemManager.respawnItems_X, (int)ItemManager.respawnItems_Y].lastRespawn > Provider.modeConfigData.Items.Respawn_Time && (float)ItemManager.regions[(int)ItemManager.respawnItems_X, (int)ItemManager.respawnItems_Y].items.Count < (float)LevelItems.spawns[(int)ItemManager.respawnItems_X, (int)ItemManager.respawnItems_Y].Count * Provider.modeConfigData.Items.Spawn_Chance) { ItemManager.regions[(int)ItemManager.respawnItems_X, (int)ItemManager.respawnItems_Y].lastRespawn = Time.realtimeSinceStartup; ItemSpawnpoint itemSpawnpoint = LevelItems.spawns[(int)ItemManager.respawnItems_X, (int)ItemManager.respawnItems_Y][UnityEngine.Random.Range(0, LevelItems.spawns[(int)ItemManager.respawnItems_X, (int)ItemManager.respawnItems_Y].Count)]; if (!SafezoneManager.checkPointValid(itemSpawnpoint.point)) { return(false); } ushort num = 0; while ((int)num < ItemManager.regions[(int)ItemManager.respawnItems_X, (int)ItemManager.respawnItems_Y].items.Count) { if ((ItemManager.regions[(int)ItemManager.respawnItems_X, (int)ItemManager.respawnItems_Y].items[(int)num].point - itemSpawnpoint.point).sqrMagnitude < 4f) { return(false); } num += 1; } ushort item = LevelItems.getItem(itemSpawnpoint); ItemAsset itemAsset = (ItemAsset)Assets.find(EAssetType.ITEM, item); if (itemAsset != null) { Item item2 = new Item(item, EItemOrigin.WORLD); ItemData itemData = new ItemData(item2, ItemManager.instanceCount += 1u, itemSpawnpoint.point, false); ItemManager.regions[(int)ItemManager.respawnItems_X, (int)ItemManager.respawnItems_Y].items.Add(itemData); ItemManager.manager.channel.send("tellItem", ESteamCall.CLIENTS, ESteamPacket.UPDATE_RELIABLE_BUFFER, new object[] { ItemManager.respawnItems_X, ItemManager.respawnItems_Y, item2.id, item2.quality, item2.state, itemSpawnpoint.point, itemData.instanceID }); } else { CommandWindow.LogError(string.Concat(new object[] { "Failed to respawn an item with ID ", item, " from type ", itemSpawnpoint.type, "!" })); } } return(false); } return(true); }
public ReunObjectAdd(int newStep, ObjectAsset newObjectAsset, ItemAsset newItemAsset, Vector3 newPosition, Quaternion newRotation, Vector3 newScale) { this.step = newStep; this.model = null; this.objectAsset = newObjectAsset; this.itemAsset = newItemAsset; this.position = newPosition; this.rotation = newRotation; this.scale = newScale; }
public int Compare(VendorBuying a, VendorBuying b) { ItemAsset itemAsset = Assets.find(EAssetType.ITEM, a.id) as ItemAsset; ItemAsset itemAsset2 = Assets.find(EAssetType.ITEM, b.id) as ItemAsset; if (itemAsset == null || itemAsset2 == null) { return(0); } return(itemAsset.itemName.CompareTo(itemAsset2.itemName)); }
public override Sleek createUI(Player player) { string text = this.formatReward(player); if (string.IsNullOrEmpty(text)) { return(null); } ItemAsset itemAsset = (ItemAsset)Assets.find(EAssetType.ITEM, this.id); if (itemAsset == null) { return(null); } SleekBox sleekBox = new SleekBox(); if (itemAsset.size_y == 1) { sleekBox.sizeOffset_Y = (int)(itemAsset.size_y * 50 + 10); } else { sleekBox.sizeOffset_Y = (int)(itemAsset.size_y * 25 + 10); } sleekBox.sizeScale_X = 1f; SleekImageTexture sleekImageTexture = new SleekImageTexture(); sleekImageTexture.positionOffset_X = 5; sleekImageTexture.positionOffset_Y = 5; if (itemAsset.size_y == 1) { sleekImageTexture.sizeOffset_X = (int)(itemAsset.size_x * 50); sleekImageTexture.sizeOffset_Y = (int)(itemAsset.size_y * 50); } else { sleekImageTexture.sizeOffset_X = (int)(itemAsset.size_x * 25); sleekImageTexture.sizeOffset_Y = (int)(itemAsset.size_y * 25); } sleekBox.add(sleekImageTexture); ItemTool.getIcon(this.id, 100, itemAsset.getState(false), itemAsset, sleekImageTexture.sizeOffset_X, sleekImageTexture.sizeOffset_Y, new ItemIconReady(sleekImageTexture.updateTexture)); sleekBox.add(new SleekLabel { positionOffset_X = 10 + sleekImageTexture.sizeOffset_X, sizeOffset_X = -15 - sleekImageTexture.sizeOffset_X, sizeScale_X = 1f, sizeScale_Y = 1f, fontAlignment = 3, foregroundTint = ESleekTint.NONE, isRich = true, text = text }); return(sleekBox); }
// Token: 0x0600283F RID: 10303 RVA: 0x000F3794 File Offset: 0x000F1B94 public static void dropItem(Item item, Vector3 point, bool playEffect, bool isDropped, bool wideSpread) { if (ItemManager.regions == null || ItemManager.manager == null) { return; } if (wideSpread) { point.x += UnityEngine.Random.Range(-0.75f, 0.75f); point.z += UnityEngine.Random.Range(-0.75f, 0.75f); } else { point.x += UnityEngine.Random.Range(-0.125f, 0.125f); point.z += UnityEngine.Random.Range(-0.125f, 0.125f); } byte b; byte b2; if (Regions.tryGetCoordinate(point, out b, out b2)) { ItemAsset itemAsset = (ItemAsset)Assets.find(EAssetType.ITEM, item.id); if (itemAsset != null && !itemAsset.isPro) { if (playEffect) { EffectManager.sendEffect(6, EffectManager.SMALL, point); } if (point.y > 0f) { RaycastHit raycastHit; Physics.Raycast(point + Vector3.up, Vector3.down, out raycastHit, Mathf.Min(point.y + 1f, Level.HEIGHT), RayMasks.BLOCK_ITEM); if (raycastHit.collider != null) { point.y = raycastHit.point.y; } } ItemData itemData = new ItemData(item, ItemManager.instanceCount += 1u, point, isDropped); ItemManager.regions[(int)b, (int)b2].items.Add(itemData); ItemManager.manager.channel.send("tellItem", ESteamCall.CLIENTS, b, b2, ItemManager.ITEM_REGIONS, ESteamPacket.UPDATE_RELIABLE_BUFFER, new object[] { b, b2, item.id, item.amount, item.quality, item.state, point, itemData.instanceID }); } } }
public ItemJar(Item newItem) { this._item = newItem; ItemAsset itemAsset = (ItemAsset)Assets.find(EAssetType.ITEM, this.item.id); if (itemAsset == null) { return; } this.size_x = itemAsset.size_x; this.size_y = itemAsset.size_y; }
// Token: 0x0600284B RID: 10315 RVA: 0x000F475C File Offset: 0x000F2B5C private void generateItems(byte x, byte y) { if (Level.info == null || Level.info.type == ELevelType.ARENA) { return; } List <ItemData> list = new List <ItemData>(); if (LevelItems.spawns[(int)x, (int)y].Count > 0) { List <ItemSpawnpoint> list2 = new List <ItemSpawnpoint>(); for (int i = 0; i < LevelItems.spawns[(int)x, (int)y].Count; i++) { ItemSpawnpoint itemSpawnpoint = LevelItems.spawns[(int)x, (int)y][i]; if (SafezoneManager.checkPointValid(itemSpawnpoint.point)) { list2.Add(itemSpawnpoint); } } while ((float)list.Count < (float)LevelItems.spawns[(int)x, (int)y].Count * Provider.modeConfigData.Items.Spawn_Chance && list2.Count > 0) { int index = UnityEngine.Random.Range(0, list2.Count); ItemSpawnpoint itemSpawnpoint2 = list2[index]; list2.RemoveAt(index); ushort item = LevelItems.getItem(itemSpawnpoint2); ItemAsset itemAsset = (ItemAsset)Assets.find(EAssetType.ITEM, item); if (itemAsset != null) { Item newItem = new Item(item, EItemOrigin.WORLD); list.Add(new ItemData(newItem, ItemManager.instanceCount += 1u, itemSpawnpoint2.point, false)); } else { CommandWindow.LogError(string.Concat(new object[] { "Failed to generate an item with ID ", item, " from type ", itemSpawnpoint2.type, "!" })); } } } for (int j = 0; j < ItemManager.regions[(int)x, (int)y].items.Count; j++) { if (ItemManager.regions[(int)x, (int)y].items[j].isDropped) { list.Add(ItemManager.regions[(int)x, (int)y].items[j]); } } ItemManager.regions[(int)x, (int)y].items = list; }
public static void getIcon(ushort id, byte quality, byte[] state, ItemAsset itemAsset, int x, int y, 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); } ItemTool.getIcon(id, num, quality, state, itemAsset, skinAsset, x, y, false, callback); }
public Item(ushort newID, byte newAmount, byte newQuality) { this._id = newID; this.amount = newAmount; this.quality = newQuality; ItemAsset itemAsset = (ItemAsset)Assets.find(EAssetType.ITEM, this.id); if (itemAsset == null) { this.state = new byte[0]; return; } this.state = itemAsset.getState(); }
private static void onClickedAddItemButton(SleekButton button) { if ((int)EditorSpawns.selectedItem < LevelItems.tables.Count && (int)EditorSpawnsItemsUI.selectedTier < LevelItems.tables[(int)EditorSpawns.selectedItem].tiers.Count) { ItemAsset itemAsset = (ItemAsset)Assets.find(EAssetType.ITEM, EditorSpawnsItemsUI.itemIDField.state); if (itemAsset != null && !itemAsset.isPro) { LevelItems.tables[(int)EditorSpawns.selectedItem].addItem(EditorSpawnsItemsUI.selectedTier, EditorSpawnsItemsUI.itemIDField.state); EditorSpawnsItemsUI.updateSelection(); EditorSpawnsItemsUI.spawnsScrollBox.state = new Vector2(0f, float.MaxValue); } EditorSpawnsItemsUI.itemIDField.state = 0; } }
public ItemJar(byte new_x, byte new_y, byte newRot, Item newItem) { this.x = new_x; this.y = new_y; this.rot = newRot; this._item = newItem; ItemAsset itemAsset = (ItemAsset)Assets.find(EAssetType.ITEM, this.item.id); if (itemAsset == null) { return; } this.size_x = itemAsset.size_x; this.size_y = itemAsset.size_y; }
public static bool tryForceGiveItem(Player player, ushort id, byte amount) { ItemAsset itemAsset = (ItemAsset)Assets.find(EAssetType.ITEM, id); if (itemAsset == null || itemAsset.isPro) { return(false); } for (int i = 0; i < (int)amount; i++) { Item item = new Item(id, EItemOrigin.ADMIN); player.inventory.forceAddItem(item, true); } return(true); }
public void format(Player player, out ushort total, out byte amount) { ItemAsset itemAsset = Assets.find(EAssetType.ITEM, base.id) as ItemAsset; VendorBuying.search.Clear(); player.inventory.search(VendorBuying.search, base.id, false, true); total = 0; byte b = 0; while ((int)b < VendorBuying.search.Count) { total += (ushort)VendorBuying.search[(int)b].jar.item.amount; b += 1; } amount = itemAsset.amount; }
public bool canSell(Player player) { ItemAsset itemAsset = Assets.find(EAssetType.ITEM, base.id) as ItemAsset; VendorBuying.search.Clear(); player.inventory.search(VendorBuying.search, base.id, false, true); ushort num = 0; byte b = 0; while ((int)b < VendorBuying.search.Count) { num += (ushort)VendorBuying.search[(int)b].jar.item.amount; b += 1; } return(num >= (ushort)itemAsset.amount); }
// 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: 0x06002363 RID: 9059 RVA: 0x000C47A4 File Offset: 0x000C2BA4 public List <InventorySearch> search(List <InventorySearch> search, EItemType type, ushort caliber) { byte b = 0; while ((int)b < this.items.Count) { ItemJar itemJar = this.items[(int)b]; if (itemJar.item.amount > 0) { bool flag = false; for (int i = 0; i < search.Count; i++) { if (search[i].page == this.page && search[i].jar.x == itemJar.x && search[i].jar.y == itemJar.y) { flag = true; break; } } if (!flag) { ItemAsset itemAsset = (ItemAsset)Assets.find(EAssetType.ITEM, itemJar.item.id); if (itemAsset != null && itemAsset.type == type) { if (((ItemCaliberAsset)itemAsset).calibers.Length == 0) { search.Add(new InventorySearch(this.page, itemJar)); } else { byte b2 = 0; while ((int)b2 < ((ItemCaliberAsset)itemAsset).calibers.Length) { if (((ItemCaliberAsset)itemAsset).calibers[(int)b2] == caliber) { search.Add(new InventorySearch(this.page, itemJar)); break; } b2 += 1; } } } } } b += 1; } return(search); }
public static bool checkUseable(byte page, ushort id) { ItemAsset itemAsset = (ItemAsset)Assets.find(EAssetType.ITEM, id); if (itemAsset == null) { return(false); } if (itemAsset.slot == ESlotType.NONE) { return(itemAsset.isUseable); } if (itemAsset.slot == ESlotType.PRIMARY) { return(page == 0 && itemAsset.isUseable); } return(itemAsset.slot == ESlotType.SECONDARY && (page == 0 || page == 1) && itemAsset.isUseable); }
// Token: 0x06002362 RID: 9058 RVA: 0x000C4720 File Offset: 0x000C2B20 public List <InventorySearch> search(List <InventorySearch> search, EItemType type) { byte b = 0; while ((int)b < this.items.Count) { ItemJar itemJar = this.items[(int)b]; if (itemJar.item.amount > 0) { ItemAsset itemAsset = (ItemAsset)Assets.find(EAssetType.ITEM, itemJar.item.id); if (itemAsset != null && itemAsset.type == type) { search.Add(new InventorySearch(this.page, itemJar)); } } b += 1; } return(search); }
public void askPurchase(CSteamID steamID, byte index) { if (base.channel.checkOwner(steamID) && Provider.isServer) { if (!base.player.tryToPerformRateLimitedAction()) { return; } if ((int)index >= LevelNodes.nodes.Count) { return; } PurchaseNode purchaseNode = null; try { purchaseNode = (PurchaseNode)LevelNodes.nodes[(int)index]; } catch { return; } if (this.experience >= purchaseNode.cost) { this._experience -= purchaseNode.cost; base.channel.send("tellExperience", ESteamCall.OWNER, ESteamPacket.UPDATE_RELIABLE_BUFFER, new object[] { this.experience }); ItemAsset itemAsset = (ItemAsset)Assets.find(EAssetType.ITEM, purchaseNode.id); if (itemAsset.type == EItemType.GUN && base.player.inventory.has(purchaseNode.id) != null) { base.player.inventory.tryAddItem(new Item(((ItemGunAsset)itemAsset).getMagazineID(), EItemOrigin.ADMIN), true); } else { base.player.inventory.tryAddItem(new Item(purchaseNode.id, EItemOrigin.ADMIN), true); } } } }
public SleekJars(float radius, List <InventorySearch> search) { base.init(); float num = 6.28318548f / (float)search.Count; for (int i = 0; i < search.Count; i++) { ItemJar jar = search[i].jar; ItemAsset itemAsset = (ItemAsset)Assets.find(EAssetType.ITEM, jar.item.id); if (itemAsset != null) { SleekItem sleekItem = new SleekItem(jar); sleekItem.positionOffset_X = (int)(Mathf.Cos(num * (float)i) * radius) - sleekItem.sizeOffset_X / 2; sleekItem.positionOffset_Y = (int)(Mathf.Sin(num * (float)i) * radius) - sleekItem.sizeOffset_Y / 2; sleekItem.positionScale_X = 0.5f; sleekItem.positionScale_Y = 0.5f; sleekItem.onClickedItem = new ClickedItem(this.onClickedButton); sleekItem.onDraggedItem = new DraggedItem(this.onClickedButton); base.add(sleekItem); } } }
public void sell(Player player) { ItemAsset itemAsset = Assets.find(EAssetType.ITEM, base.id) as ItemAsset; VendorBuying.search.Clear(); player.inventory.search(VendorBuying.search, base.id, false, true); VendorBuying.search.Sort(VendorBuying.qualityAscendingComparator); ushort num = (ushort)itemAsset.amount; byte b = 0; while ((int)b < VendorBuying.search.Count) { InventorySearch inventorySearch = VendorBuying.search[(int)b]; if (player.equipment.checkSelection(inventorySearch.page, inventorySearch.jar.x, inventorySearch.jar.y)) { player.equipment.dequip(); } if ((ushort)inventorySearch.jar.item.amount > num) { player.inventory.sendUpdateAmount(inventorySearch.page, inventorySearch.jar.x, inventorySearch.jar.y, (byte)((ushort)inventorySearch.jar.item.amount - num)); break; } num -= (ushort)inventorySearch.jar.item.amount; player.inventory.sendUpdateAmount(inventorySearch.page, inventorySearch.jar.x, inventorySearch.jar.y, 0); player.crafting.removeItem(inventorySearch.page, inventorySearch.jar); if (inventorySearch.page < PlayerInventory.SLOTS) { player.equipment.sendSlot(inventorySearch.page); } if (num == 0) { break; } b += 1; } player.skills.askAward(base.cost); }
// Token: 0x06003476 RID: 13430 RVA: 0x00157B34 File Offset: 0x00155F34 private static bool isVariantItemTier(ItemTier tier) { if (tier.table.Count < 6) { return(false); } ItemAsset itemAsset = (ItemAsset)Assets.find(EAssetType.ITEM, tier.table[0].item); if (itemAsset == null) { return(false); } int num = itemAsset.itemName.IndexOf(" "); if (num <= 0) { return(false); } string text = itemAsset.itemName.Substring(num + 1); if (text.Length <= 1) { Debug.LogError(itemAsset.itemName + " name has a trailing space!"); return(false); } for (int i = 1; i < tier.table.Count; i++) { ItemAsset itemAsset2 = (ItemAsset)Assets.find(EAssetType.ITEM, tier.table[i].item); if (!itemAsset2.itemName.Contains(text)) { return(false); } } tier.name = text; return(true); }
private static bool searchBlueprintText(Blueprint blueprint, string text) { byte b = 0; while ((int)b < blueprint.outputs.Length) { BlueprintOutput blueprintOutput = blueprint.outputs[(int)b]; ItemAsset itemAsset = (ItemAsset)Assets.find(EAssetType.ITEM, blueprintOutput.id); if (itemAsset != null && itemAsset.itemName != null && itemAsset.itemName.IndexOf(text, StringComparison.OrdinalIgnoreCase) != -1) { return(true); } b += 1; } if (blueprint.tool != 0) { ItemAsset itemAsset2 = (ItemAsset)Assets.find(EAssetType.ITEM, blueprint.tool); if (itemAsset2 != null && itemAsset2.itemName != null && itemAsset2.itemName.IndexOf(text, StringComparison.OrdinalIgnoreCase) != -1) { return(true); } } byte b2 = 0; while ((int)b2 < blueprint.supplies.Length) { BlueprintSupply blueprintSupply = blueprint.supplies[(int)b2]; ItemAsset itemAsset3 = (ItemAsset)Assets.find(EAssetType.ITEM, blueprintSupply.id); if (itemAsset3 != null && itemAsset3.itemName != null && itemAsset3.itemName.IndexOf(text, StringComparison.OrdinalIgnoreCase) != -1) { return(true); } b2 += 1; } return(false); }
public override void updateState(Asset asset, byte[] state) { this.gunLargeTransform = base.transform.FindChildRecursive("Gun_Large"); this.gunSmallTransform = base.transform.FindChildRecursive("Gun_Small"); this.meleeTransform = base.transform.FindChildRecursive("Melee"); this.itemTransform = base.transform.FindChildRecursive("Item"); this.isLocked = ((ItemBarricadeAsset)asset).isLocked; this._isDisplay = ((ItemStorageAsset)asset).isDisplay; if (Provider.isServer) { SteamPacker.openRead(0, state); this._owner = (CSteamID)SteamPacker.read(Types.STEAM_ID_TYPE); this._group = (CSteamID)SteamPacker.read(Types.STEAM_ID_TYPE); this._items = new Items(PlayerInventory.STORAGE); this.items.resize(((ItemStorageAsset)asset).storage_x, ((ItemStorageAsset)asset).storage_y); byte b = (byte)SteamPacker.read(Types.BYTE_TYPE); for (byte b2 = 0; b2 < b; b2 += 1) { if (BarricadeManager.version > 7) { object[] array = SteamPacker.read(Types.BYTE_TYPE, Types.BYTE_TYPE, Types.BYTE_TYPE, Types.UINT16_TYPE, Types.BYTE_TYPE, Types.BYTE_TYPE, Types.BYTE_ARRAY_TYPE); ItemAsset itemAsset = (ItemAsset)Assets.find(EAssetType.ITEM, (ushort)array[3]); if (itemAsset != null) { this.items.loadItem((byte)array[0], (byte)array[1], (byte)array[2], new Item((ushort)array[3], (byte)array[4], (byte)array[5], (byte[])array[6])); } } else { object[] array2 = SteamPacker.read(Types.BYTE_TYPE, Types.BYTE_TYPE, Types.UINT16_TYPE, Types.BYTE_TYPE, Types.BYTE_TYPE, Types.BYTE_ARRAY_TYPE); ItemAsset itemAsset2 = (ItemAsset)Assets.find(EAssetType.ITEM, (ushort)array2[2]); if (itemAsset2 != null) { this.items.loadItem((byte)array2[0], (byte)array2[1], 0, new Item((ushort)array2[2], (byte)array2[3], (byte)array2[4], (byte[])array2[5])); } } } if (this.isDisplay) { this.displaySkin = (ushort)SteamPacker.read(Types.UINT16_TYPE); this.displayMythic = (ushort)SteamPacker.read(Types.UINT16_TYPE); if (BarricadeManager.version > 8) { this.applyRotation((byte)SteamPacker.read(Types.BYTE_TYPE)); } else { this.applyRotation(0); } } this.items.onStateUpdated = new StateUpdated(this.onStateUpdated); SteamPacker.closeRead(); if (this.isDisplay) { this.updateDisplay(); this.refreshDisplay(); } } else { Block block = new Block(state); this._owner = new CSteamID((ulong)block.read(Types.UINT64_TYPE)); this._group = new CSteamID((ulong)block.read(Types.UINT64_TYPE)); if (state.Length > 16) { object[] array3 = block.read(Types.UINT16_TYPE, Types.BYTE_TYPE, Types.BYTE_ARRAY_TYPE, Types.UINT16_TYPE, Types.UINT16_TYPE, Types.BYTE_TYPE); this.applyRotation((byte)array3[5]); this.setDisplay((ushort)array3[0], (byte)array3[1], (byte[])array3[2], (ushort)array3[3], (ushort)array3[4]); } } }