public void askStripAttachments(CSteamID steamID, byte page, byte x, byte y) { if (base.channel.checkOwner(steamID) && Provider.isServer) { if (page < PlayerInventory.SLOTS || page >= PlayerInventory.PAGES - 1) { return; } if (base.player.equipment.checkSelection(page, x, y)) { if (base.player.equipment.isBusy) { return; } base.player.equipment.dequip(); } byte index = base.player.inventory.getIndex(page, x, y); if (index == 255) { return; } ItemJar item = base.player.inventory.getItem(page, index); if (item == null) { return; } if (!this.stripAttachments(page, item)) { return; } base.player.inventory.sendUpdateInvState(page, x, y, item.item.state); } }
// Token: 0x060021FB RID: 8699 RVA: 0x000B83A8 File Offset: 0x000B67A8 public void rebuildState() { if (this.items == null) { return; } SteamPacker.openWrite(0); SteamPacker.write(this.owner, this.group, this.items.getItemCount()); for (byte b = 0; b < this.items.getItemCount(); b += 1) { ItemJar item = this.items.getItem(b); SteamPacker.write(item.x, item.y, item.rot, item.item.id, item.item.amount, item.item.quality, item.item.state); } if (this.isDisplay) { SteamPacker.write(this.displaySkin); SteamPacker.write(this.displayMythic); SteamPacker.write((!string.IsNullOrEmpty(this.displayTags)) ? this.displayTags : string.Empty); SteamPacker.write((!string.IsNullOrEmpty(this.displayDynamicProps)) ? this.displayDynamicProps : string.Empty); SteamPacker.write(this.rot_comp); } int size; byte[] state = SteamPacker.closeWrite(out size); BarricadeManager.updateState(base.transform, state, size); }
// Token: 0x06002369 RID: 9065 RVA: 0x000C4AA0 File Offset: 0x000C2EA0 public bool tryAddItem(Item item, bool isStateUpdatable) { if (this.getItemCount() >= 200) { return(false); } ItemJar itemJar = new ItemJar(item); byte x; byte y; byte rot; if (!this.tryFindSpace(itemJar.size_x, itemJar.size_y, out x, out y, out rot)) { return(false); } itemJar.x = x; itemJar.y = y; itemJar.rot = rot; this.fillSlot(itemJar, true); this.items.Add(itemJar); if (this.onItemAdded != null) { this.onItemAdded(this.page, (byte)(this.items.Count - 1), itemJar); } if (isStateUpdatable && this.onStateUpdated != null) { this.onStateUpdated(); } return(true); }
// Token: 0x06002366 RID: 9062 RVA: 0x000C49FC File Offset: 0x000C2DFC public void loadItem(byte x, byte y, byte rot, Item item) { ItemJar itemJar = new ItemJar(x, y, rot, item); this.fillSlot(itemJar, true); this.items.Add(itemJar); }
// Token: 0x06003343 RID: 13123 RVA: 0x0014D28A File Offset: 0x0014B68A public void updateItem(ItemJar jar) { if (this.item == null) { return; } this.item.updateItem(jar); }
// Token: 0x060032D3 RID: 13011 RVA: 0x00149864 File Offset: 0x00147C64 public void addItem(ItemJar jar) { SleekItem sleekItem = new SleekItem(jar); sleekItem.positionOffset_X = (int)(jar.x * 50); sleekItem.positionOffset_Y = (int)(jar.y * 50); sleekItem.onClickedItem = new ClickedItem(this.onClickedItem); sleekItem.onDraggedItem = new DraggedItem(this.onDraggedItem); base.add(sleekItem); this.items.Add(sleekItem); }
// Token: 0x060032D4 RID: 13012 RVA: 0x001498D0 File Offset: 0x00147CD0 public void removeItem(ItemJar jar) { for (int i = 0; i < this.items.Count; i++) { if (this.items[i].positionOffset_X == (int)(jar.x * 50) && this.items[i].positionOffset_Y == (int)(jar.y * 50)) { base.remove(this.items[i]); this.items.RemoveAt(i); return; } } }
// Token: 0x06002367 RID: 9063 RVA: 0x000C4A28 File Offset: 0x000C2E28 public void addItem(byte x, byte y, byte rot, Item item) { ItemJar itemJar = new ItemJar(x, y, rot, item); this.fillSlot(itemJar, true); this.items.Add(itemJar); if (this.onItemAdded != null) { this.onItemAdded(this.page, (byte)(this.items.Count - 1), itemJar); } if (this.onStateUpdated != null) { this.onStateUpdated(); } }
// Token: 0x06002365 RID: 9061 RVA: 0x000C4994 File Offset: 0x000C2D94 public InventorySearch has(ushort id) { byte b = 0; while ((int)b < this.items.Count) { ItemJar itemJar = this.items[(int)b]; if (itemJar.item.amount > 0 && itemJar.item.id == id) { return(new InventorySearch(this.page, itemJar)); } b += 1; } return(null); }
// Token: 0x06002364 RID: 9060 RVA: 0x000C4908 File Offset: 0x000C2D08 public List <InventorySearch> search(List <InventorySearch> search, ushort id, bool findEmpty, bool findHealthy) { byte b = 0; while ((int)b < this.items.Count) { ItemJar itemJar = this.items[(int)b]; if ((findEmpty || itemJar.item.amount > 0) && (findHealthy || itemJar.item.quality < 100) && itemJar.item.id == id) { search.Add(new InventorySearch(this.page, itemJar)); } b += 1; } return(search); }
// Token: 0x0600236C RID: 9068 RVA: 0x000C4BEC File Offset: 0x000C2FEC public void loadSize(byte newWidth, byte newHeight) { this._width = newWidth; this._height = newHeight; this.slots = new bool[(int)this.width, (int)this.height]; for (byte b = 0; b < this.width; b += 1) { for (byte b2 = 0; b2 < this.height; b2 += 1) { this.slots[(int)b, (int)b2] = false; } } List <ItemJar> list = new List <ItemJar>(); if (this.items != null) { byte b3 = 0; while ((int)b3 < this.items.Count) { ItemJar itemJar = this.items[(int)b3]; byte b4 = itemJar.size_x; byte b5 = itemJar.size_y; if (itemJar.rot % 2 == 1) { b4 = itemJar.size_y; b5 = itemJar.size_x; } if (this.width == 0 || this.height == 0 || (this.page >= PlayerInventory.SLOTS && (itemJar.x + b4 > this.width || itemJar.y + b5 > this.height))) { if (this.onItemDiscarded != null) { this.onItemDiscarded(this.page, b3, itemJar); } if (this.onStateUpdated != null) { this.onStateUpdated(); } } else { this.fillSlot(itemJar, true); list.Add(itemJar); } b3 += 1; } } this.items = list; }
// 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); }
// Token: 0x06003344 RID: 13124 RVA: 0x0014D2A4 File Offset: 0x0014B6A4 public void applyItem(ItemJar jar) { if (this.item != null) { base.remove(this.item); } if (jar != null) { this._item = new SleekItem(jar); this.item.positionOffset_X = (int)(-jar.size_x * 25); this.item.positionOffset_Y = (int)(-jar.size_y * 25); this.item.positionScale_X = 0.5f; this.item.positionScale_Y = 0.5f; this.item.updateHotkey(this.page); this.item.onClickedItem = new ClickedItem(this.onClickedItem); this.item.onDraggedItem = new DraggedItem(this.onDraggedItem); base.add(this.item); } }
// 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); }
// Token: 0x060032B3 RID: 12979 RVA: 0x00148D00 File Offset: 0x00147100 public SleekItem(ItemJar jar) { base.init(); this.button = new SleekButton(); this.button.positionOffset_X = 1; this.button.positionOffset_Y = 1; this.button.sizeOffset_X = -2; this.button.sizeOffset_Y = -2; this.button.sizeScale_X = 1f; this.button.sizeScale_Y = 1f; this.button.backgroundTint = ESleekTint.NONE; this.button.foregroundTint = ESleekTint.NONE; this.button.onClickedButton = new ClickedButton(this.onClickedButton); base.add(this.button); this.icon = new SleekImageTexture(); base.add(this.icon); this.icon.isVisible = false; this.icon.isAngled = true; this.amountLabel = new SleekLabel(); this.amountLabel.positionScale_Y = 1f; this.amountLabel.sizeOffset_Y = 30; this.amountLabel.sizeScale_X = 1f; this.amountLabel.fontAlignment = TextAnchor.LowerLeft; this.amountLabel.foregroundTint = ESleekTint.NONE; base.add(this.amountLabel); this.amountLabel.isVisible = false; this.qualityImage = new SleekImageTexture(); this.qualityImage.positionScale_X = 1f; this.qualityImage.positionScale_Y = 1f; base.add(this.qualityImage); this.qualityImage.isVisible = false; this.hotkeyLabel = new SleekLabel(); this.hotkeyLabel.positionOffset_X = 5; this.hotkeyLabel.positionOffset_Y = 5; this.hotkeyLabel.sizeOffset_X = -10; this.hotkeyLabel.sizeOffset_Y = 30; this.hotkeyLabel.sizeScale_X = 1f; this.hotkeyLabel.fontAlignment = TextAnchor.UpperRight; base.add(this.hotkeyLabel); this.hotkeyLabel.isVisible = false; this.updateItem(jar); }
// Token: 0x06002372 RID: 9074 RVA: 0x000C51CC File Offset: 0x000C35CC private void fillSlot(ItemJar jar, bool isOccupied) { byte b = jar.size_x; byte b2 = jar.size_y; if (jar.rot % 2 == 1) { b = jar.size_y; b2 = jar.size_x; } for (byte b3 = 0; b3 < b; b3 += 1) { for (byte b4 = 0; b4 < b2; b4 += 1) { if (jar.x + b3 < this.width && jar.y + b4 < this.height) { this.slots[(int)(jar.x + b3), (int)(jar.y + b4)] = isOccupied; } } } }
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); } } }
// Token: 0x06002209 RID: 8713 RVA: 0x000B8F3C File Offset: 0x000B733C public void ManualOnDestroy() { if (this.isDisplay) { this.setDisplay(0, 0, null, 0, 0, string.Empty, string.Empty); } if (!Provider.isServer) { return; } this.items.onStateUpdated = null; if (!this.despawnWhenDestroyed) { for (byte b = 0; b < this.items.getItemCount(); b += 1) { ItemJar item = this.items.getItem(b); ItemManager.dropItem(item.item, base.transform.position, false, true, true); } } this.items.clear(); this._items = null; if (this.isOpen) { if (this.opener != null) { if (this.opener.inventory.isStoring) { this.opener.inventory.isStoring = false; this.opener.inventory.isStorageTrunk = false; this.opener.inventory.storage = null; this.opener.inventory.updateItems(PlayerInventory.STORAGE, null); this.opener.inventory.sendStorage(); } this.opener = null; } this.isOpen = false; } }
// Token: 0x06002B82 RID: 11138 RVA: 0x0010FD02 File Offset: 0x0010E102 public void removeItem(byte page, ItemJar jar) { base.player.inventory.removeItem(page, base.player.inventory.getIndex(page, jar.x, jar.y)); this.stripAttachments(page, jar); }
// Token: 0x06002B81 RID: 11137 RVA: 0x0010FA10 File Offset: 0x0010DE10 private bool stripAttachments(byte page, ItemJar jar) { ItemAsset itemAsset = (ItemAsset)Assets.find(EAssetType.ITEM, jar.item.id); if (itemAsset != null && itemAsset.type == EItemType.GUN && jar.item.state != null && jar.item.state.Length == 18) { if (((ItemGunAsset)itemAsset).hasSight) { ushort num = BitConverter.ToUInt16(jar.item.state, 0); if (num != 0 && num != ((ItemGunAsset)itemAsset).sightID) { base.player.inventory.forceAddItem(new Item(num, false, jar.item.state[13]), true); jar.item.state[0] = 0; jar.item.state[1] = 0; jar.item.state[13] = 0; } } if (((ItemGunAsset)itemAsset).hasTactical) { ushort num2 = BitConverter.ToUInt16(jar.item.state, 2); if (num2 != 0) { base.player.inventory.forceAddItem(new Item(num2, false, jar.item.state[14]), true); jar.item.state[2] = 0; jar.item.state[3] = 0; jar.item.state[14] = 0; } } if (((ItemGunAsset)itemAsset).hasGrip) { ushort num3 = BitConverter.ToUInt16(jar.item.state, 4); if (num3 != 0) { base.player.inventory.forceAddItem(new Item(num3, false, jar.item.state[15]), true); jar.item.state[4] = 0; jar.item.state[5] = 0; jar.item.state[15] = 0; } } if (((ItemGunAsset)itemAsset).hasBarrel) { ushort num4 = BitConverter.ToUInt16(jar.item.state, 6); if (num4 != 0) { base.player.inventory.forceAddItem(new Item(num4, false, jar.item.state[16]), true); jar.item.state[6] = 0; jar.item.state[7] = 0; jar.item.state[16] = 0; } } ushort num5 = BitConverter.ToUInt16(jar.item.state, 8); if (num5 != 0 && jar.item.state[10] > 0) { base.player.inventory.forceAddItem(new Item(num5, jar.item.state[10], jar.item.state[17]), true); jar.item.state[8] = 0; jar.item.state[9] = 0; jar.item.state[10] = 0; jar.item.state[17] = 0; } return(true); } return(false); }
// Token: 0x060032D2 RID: 13010 RVA: 0x0014984E File Offset: 0x00147C4E public void updateItem(byte index, ItemJar jar) { this.items[(int)index].updateItem(jar); }
// Token: 0x06002A66 RID: 10854 RVA: 0x00108016 File Offset: 0x00106416 public InventorySearch(byte newPage, ItemJar newJar) { this._page = newPage; this._jar = newJar; }
// Token: 0x060032BA RID: 12986 RVA: 0x0014923C File Offset: 0x0014763C public void updateItem(ItemJar newJar) { this._jar = newJar; ItemAsset itemAsset = (ItemAsset)Assets.find(EAssetType.ITEM, this.jar.item.id); if (itemAsset != null) { if (!this.isTemporary) { this.button.tooltip = itemAsset.itemName; } if (this.jar.rot % 2 == 0) { base.sizeOffset_X = (int)(itemAsset.size_x * 50); base.sizeOffset_Y = (int)(itemAsset.size_y * 50); this.icon.positionOffset_X = 0; this.icon.positionOffset_Y = 0; } else { base.sizeOffset_X = (int)(itemAsset.size_y * 50); base.sizeOffset_Y = (int)(itemAsset.size_x * 50); int num = Mathf.Abs((int)(itemAsset.size_y - itemAsset.size_x)); if (itemAsset.size_x > itemAsset.size_y) { this.icon.positionOffset_X = -num * 25; this.icon.positionOffset_Y = num * 25; } else { this.icon.positionOffset_X = num * 25; this.icon.positionOffset_Y = -num * 25; } } this.icon.angle = (float)(this.jar.rot * 90); this.icon.sizeOffset_X = (int)(itemAsset.size_x * 50); this.icon.sizeOffset_Y = (int)(itemAsset.size_y * 50); this.icon.isVisible = false; ItemTool.getIcon(this.jar.item.id, this.jar.item.quality, this.jar.item.state, itemAsset, new ItemIconReady(this.onItemIconReady)); if (itemAsset.size_x == 1 || itemAsset.size_y == 1) { this.amountLabel.positionOffset_X = 0; this.amountLabel.positionOffset_Y = -30; this.amountLabel.sizeOffset_X = 0; this.amountLabel.fontSize = 10; this.hotkeyLabel.fontSize = 10; } else { this.amountLabel.positionOffset_X = 5; this.amountLabel.positionOffset_Y = -35; this.amountLabel.sizeOffset_X = -10; this.amountLabel.fontSize = 12; this.hotkeyLabel.fontSize = 12; } this.button.backgroundColor = ItemTool.getRarityColorUI(itemAsset.rarity); this.button.foregroundColor = this.button.backgroundColor; if (itemAsset.showQuality) { if (itemAsset.size_x == 1 || itemAsset.size_y == 1) { this.qualityImage.positionOffset_X = -15; this.qualityImage.positionOffset_Y = -15; this.qualityImage.sizeOffset_X = 10; this.qualityImage.sizeOffset_Y = 10; this.qualityImage.texture = (Texture2D)PlayerDashboardInventoryUI.icons.load("Quality_1"); } else { this.qualityImage.positionOffset_X = -30; this.qualityImage.positionOffset_Y = -30; this.qualityImage.sizeOffset_X = 20; this.qualityImage.sizeOffset_Y = 20; this.qualityImage.texture = (Texture2D)PlayerDashboardInventoryUI.icons.load("Quality_0"); } this.qualityImage.backgroundColor = ItemTool.getQualityColor((float)this.jar.item.quality / 100f); this.qualityImage.foregroundColor = this.qualityImage.backgroundColor; this.amountLabel.text = this.jar.item.quality + "%"; this.amountLabel.backgroundColor = this.qualityImage.backgroundColor; this.amountLabel.foregroundColor = this.qualityImage.backgroundColor; this.qualityImage.isVisible = true; this.amountLabel.isVisible = true; } else { this.qualityImage.isVisible = false; if (itemAsset.amount > 1) { this.amountLabel.text = "x" + this.jar.item.amount; this.amountLabel.backgroundColor = Color.white; this.amountLabel.foregroundColor = Color.white; this.amountLabel.isVisible = true; } else { this.amountLabel.isVisible = false; } } } }