// Token: 0x06002AFA RID: 11002 RVA: 0x0009FB10 File Offset: 0x0009DD10 public void Bind(global::BlueprintDataBlock.IngredientEntry ingredient, int needAmount, int haveAmount) { global::ItemDataBlock ingredient2 = ingredient.Ingredient; Color color; if (needAmount <= haveAmount) { this.checkIcon.enabled = true; this.xIcon.enabled = false; color = Color.green; } else { this.checkIcon.enabled = false; this.xIcon.enabled = true; color = Color.red; } global::UIWidget uiwidget = this.need; Color color2 = color; this.have.color = color2; uiwidget.color = color2; this.itemName.text = ingredient2.name; this.need.text = needAmount.ToString("N0"); this.have.text = haveAmount.ToString("N0"); }
// Token: 0x060039D9 RID: 14809 RVA: 0x000CBAD0 File Offset: 0x000C9CD0 public override global::InventoryItem.MergeResult TryCombine(global::IInventoryItem otherItem) { global::PlayerInventory playerInventory = base.inventory as global::PlayerInventory; if (!playerInventory || otherItem.inventory != playerInventory) { return(global::InventoryItem.MergeResult.Failed); } global::ItemDataBlock datablock = otherItem.datablock; if (!datablock || !datablock.isResearchable) { Rust.Notice.Popup("", "You can't research this", 4f); return(global::InventoryItem.MergeResult.Failed); } if (!playerInventory.AtWorkBench()) { Rust.Notice.Popup("", "You must be at a workbench to do this.", 4f); return(global::InventoryItem.MergeResult.Failed); } global::BlueprintDataBlock bp; if (!global::BlueprintDataBlock.FindBlueprintForItem <global::BlueprintDataBlock>(otherItem.datablock, out bp)) { Rust.Notice.Popup("", "You can't research this.. No Blueprint Available!...", 4f); return(global::InventoryItem.MergeResult.Failed); } if (playerInventory.KnowsBP(bp)) { Rust.Notice.Popup("", "You already know how to make this!", 4f); return(global::InventoryItem.MergeResult.Failed); } return(global::InventoryItem.MergeResult.Combined); }
// Token: 0x06003CAC RID: 15532 RVA: 0x000D8F78 File Offset: 0x000D7178 private void StoreItemInfo(global::ItemDataBlock datablock, int uses) { global::ItemPickup.PickupInfo value; value.datablock = datablock; value.amount = uses; this.info = new global::ItemPickup.PickupInfo?(value); value.datablock.ConfigureItemPickup(this, uses); }
// Token: 0x06002A22 RID: 10786 RVA: 0x0009C2EC File Offset: 0x0009A4EC public GameObject AddItemDescription(global::ItemDataBlock item, float aboveSpace) { float contentHeight = this.GetContentHeight(); GameObject gameObject = global::NGUITools.AddChild(this.addParent, this.itemDescriptionPrefab); gameObject.transform.FindChild("DescText").GetComponent <global::UILabel>().text = item.GetItemDescription(); gameObject.transform.SetLocalPositionY(-(contentHeight + aboveSpace)); return(null); }
// Token: 0x06003A89 RID: 14985 RVA: 0x000CD74C File Offset: 0x000CB94C private void PopulateInventory_Recurse(ref global::LootSpawnList.RecursiveInventoryPopulateArgs args) { if (this.maxPackagesToSpawn > this.LootPackages.Length) { this.maxPackagesToSpawn = this.LootPackages.Length; } int num; if (this.spawnOneOfEach) { num = this.LootPackages.Length; } else { num = Random.Range(this.minPackagesToSpawn, this.maxPackagesToSpawn); } int num2 = 0; while (!args.inventoryExausted && num2 < num) { global::LootSpawnList.LootWeightedEntry lootWeightedEntry; if (this.spawnOneOfEach) { lootWeightedEntry = this.LootPackages[num2]; } else { lootWeightedEntry = (global::WeightSelection.RandomPickEntry(this.LootPackages) as global::LootSpawnList.LootWeightedEntry); } if (lootWeightedEntry == null) { Debug.Log("Massive fuckup..."); return; } Object obj = lootWeightedEntry.obj; if (obj) { if (obj is global::ItemDataBlock) { global::ItemDataBlock datablock = obj as global::ItemDataBlock; if (!object.ReferenceEquals(args.inventory.AddItem(datablock, global::Inventory.Slot.Preference.Define(args.spawnCount, false, global::Inventory.Slot.KindFlags.Default | global::Inventory.Slot.KindFlags.Belt), Random.Range(lootWeightedEntry.amountMin, lootWeightedEntry.amountMax + 1)), null)) { args.spawnCount++; if (args.inventory.noVacantSlots) { args.inventoryExausted = true; } } } else if (obj is global::LootSpawnList) { ((global::LootSpawnList)obj).PopulateInventory_Recurse(ref args); } } num2++; } }
// Token: 0x060039B7 RID: 14775 RVA: 0x000CB508 File Offset: 0x000C9708 public override global::InventoryItem.MergeResult TryCombine(global::IInventoryItem other) { global::ItemDataBlock db = other.datablock; DB db2 = this.datablock; global::ItemDataBlock.CombineRecipe matchingRecipe = db2.GetMatchingRecipe(db); if (matchingRecipe == null) { return(global::InventoryItem.MergeResult.Failed); } int uses = other.uses; if (uses < matchingRecipe.amountToLoseOther) { return(global::InventoryItem.MergeResult.Failed); } if (base.uses < matchingRecipe.amountToLose) { return(global::InventoryItem.MergeResult.Failed); } global::Inventory inventory = other.inventory; int num = base.uses / matchingRecipe.amountToLose; int num2 = uses / matchingRecipe.amountToLoseOther; int num3 = Mathf.Min(num, num2); int num4 = 0; if (matchingRecipe.resultItem.IsSplittable()) { num4 = Mathf.CeilToInt((float)num3 / (float)num4); } else { num4 = num3; } int vacantSlotCount = inventory.vacantSlotCount; if (num4 > vacantSlotCount) { return(global::InventoryItem.MergeResult.Failed); } int num5 = num3 * matchingRecipe.amountToLoseOther; if (other.Consume(ref num5)) { inventory.RemoveItem(other.slot); } inventory.AddItemAmount(matchingRecipe.resultItem, num3, global::Inventory.AmountMode.Default); int num6 = num3 * matchingRecipe.amountToLose; if (base.Consume(ref num6)) { base.inventory.RemoveItem(base.slot); } return(global::InventoryItem.MergeResult.Failed); }
// Token: 0x06002A20 RID: 10784 RVA: 0x0009C230 File Offset: 0x0009A430 public GameObject AddItemTitle(global::ItemDataBlock item, float aboveSpace) { float contentHeight = this.GetContentHeight(); GameObject gameObject = global::NGUITools.AddChild(this.addParent, this.itemTitlePrefab); gameObject.GetComponentInChildren <global::UILabel>().text = item.name; global::UITexture componentInChildren = gameObject.GetComponentInChildren <global::UITexture>(); componentInChildren.material = componentInChildren.material.Clone(); componentInChildren.material.Set("_MainTex", item.GetIconTexture()); gameObject.transform.SetLocalPositionY(-(contentHeight + aboveSpace)); return(gameObject); }
// Token: 0x060028E5 RID: 10469 RVA: 0x00095B00 File Offset: 0x00093D00 public void Internal_SetToolTip(global::ItemDataBlock itemdb, global::IInventoryItem item) { this.ClearContents(); if (itemdb == null) { this.SetVisible(false); return; } this.RepositionAtCursor(); itemdb.PopulateInfoWindow(this, item); this._background.transform.localScale = new Vector3(250f, this.GetContentHeight() + Mathf.Abs(this.addParent.transform.localPosition.y * 2f), 1f); this.SetVisible(true); }
// Token: 0x06003912 RID: 14610 RVA: 0x000CA284 File Offset: 0x000C8484 public bool GetCookableInfo(out int consumeCount, out global::ItemDataBlock cookedVersion, out int cookedCount, out int cookTempMin, out int burnTemp) { burnTemp = this.datablock.burnTemp; cookTempMin = this.datablock.cookHeatRequirement; cookedVersion = this.datablock.cookedVersion; if (this.datablock.cookable && cookedVersion) { cookedCount = (consumeCount = Mathf.Min(2, base.uses)); return(consumeCount > 0); } cookedCount = (consumeCount = 0); return(false); }
// Token: 0x060028E8 RID: 10472 RVA: 0x00095C10 File Offset: 0x00093E10 public GameObject AddItemTitle(global::ItemDataBlock itemdb, global::IInventoryItem itemInstance = null, float aboveSpace = 0f) { float contentHeight = this.GetContentHeight(); GameObject gameObject = global::NGUITools.AddChild(this.addParent, this.itemTitlePrefab); gameObject.GetComponentInChildren <global::UILabel>().text = ((itemInstance == null) ? itemdb.name : itemInstance.toolTip); global::UITexture componentInChildren = gameObject.GetComponentInChildren <global::UITexture>(); componentInChildren.material = componentInChildren.material.Clone(); componentInChildren.material.Set("_MainTex", itemdb.GetIconTexture()); componentInChildren.color = ((itemInstance == null || !itemInstance.IsBroken()) ? Color.white : Color.red); gameObject.transform.SetLocalPositionY(-(contentHeight + aboveSpace)); return(gameObject); }
// Token: 0x06003296 RID: 12950 RVA: 0x000BFD58 File Offset: 0x000BDF58 public static bool FindBlueprintForItem <T>(global::ItemDataBlock item, out T blueprint) where T : global::BlueprintDataBlock { foreach (global::ItemDataBlock itemDataBlock in global::DatablockDictionary.All) { T t = itemDataBlock as T; if (t && t.resultItem == item) { blueprint = t; return(true); } } Debug.LogWarning("Could not find blueprint foritem"); blueprint = (T)((object)null); return(false); }
// Token: 0x06002A43 RID: 10819 RVA: 0x0009CF7C File Offset: 0x0009B17C private void OnTooltip(bool show) { global::IInventoryItem inventoryItem; if (show && this._myDisplayItem != null) { global::IInventoryItem myDisplayItem = this._myDisplayItem; inventoryItem = myDisplayItem; } else { inventoryItem = null; } global::IInventoryItem item = inventoryItem; global::ItemDataBlock itemdb = (!show || this._myDisplayItem == null) ? null : this._myDisplayItem.datablock; global::ItemToolTip.SetToolTip(itemdb, item); }
// Token: 0x060039DC RID: 14812 RVA: 0x000CBBC8 File Offset: 0x000C9DC8 public bool GetCookableInfo(out int consumeCount, out global::ItemDataBlock cookedVersion, out int cookedCount, out int cookTempMin, out int burnTemp) { burnTemp = 999999999; cookTempMin = this.datablock.cookHeatRequirement; cookedVersion = this.datablock.cookedVersion; if (!this.datablock.cookable || !cookedVersion) { cookedCount = (consumeCount = 0); return(false); } consumeCount = Mathf.Min(2, base.uses); cookedCount = consumeCount * Random.Range(this.datablock.numToGiveCookedMin, this.datablock.numToGiveCookedMax + 1); if (cookedCount == 0) { consumeCount = 0; return(false); } return(true); }
public void ReceiveBoundBPs(byte[] data, uLink.NetworkMessageInfo info) { this._boundBPs = (this._boundBPs ?? new List <global::BlueprintDataBlock>()); this._boundBPs.Clear(); BitStream bitStream = new BitStream(data, false); int num = bitStream.ReadInt32(); for (int i = 0; i < num; i++) { int uniqueID = bitStream.ReadInt32(); global::ItemDataBlock byUniqueID = global::DatablockDictionary.GetByUniqueID(uniqueID); if (byUniqueID) { global::BlueprintDataBlock item = byUniqueID as global::BlueprintDataBlock; this._boundBPs.Add(item); } } this.Refresh(); }
// Token: 0x06003486 RID: 13446 RVA: 0x000C2FEC File Offset: 0x000C11EC public bool PollForAmmoDatablock(out global::ItemDataBlock ammoType) { if (this.IsSplittable()) { ammoType = this; return(true); } if (this is global::BulletWeaponDataBlock) { ammoType = ((global::BulletWeaponDataBlock)this).ammoType; return(ammoType); } if (this is global::BowWeaponDataBlock) { ammoType = ((global::BowWeaponDataBlock)this).defaultAmmo; return(ammoType); } ammoType = null; return(false); }
// Token: 0x0600397C RID: 14716 RVA: 0x000CAD58 File Offset: 0x000C8F58 internal InventoryItem(global::ItemDataBlock datablock) { this.maxUses = datablock._maxUses; this.datablockUniqueID = datablock.uniqueID; this.iface = (this as global::IInventoryItem); }
// Token: 0x06003297 RID: 12951 RVA: 0x000BFDD8 File Offset: 0x000BDFD8 public static bool FindBlueprintForItem(global::ItemDataBlock item) { global::BlueprintDataBlock blueprintDataBlock; return(global::BlueprintDataBlock.FindBlueprintForItem <global::BlueprintDataBlock>(item, out blueprintDataBlock)); }
// Token: 0x060035D8 RID: 13784 RVA: 0x000C4C7C File Offset: 0x000C2E7C bool GetCookableInfo(out int consumeCount, out global::ItemDataBlock cookedVersion, out int cookedCount, out int cookTempMin, out int burnTemp) { return(base.GetCookableInfo(out consumeCount, out cookedVersion, out cookedCount, out cookTempMin, out burnTemp)); }
// Token: 0x060028E4 RID: 10468 RVA: 0x00095AE8 File Offset: 0x00093CE8 public static void SetToolTip(global::ItemDataBlock itemdb, global::IInventoryItem item = null) { global::ItemToolTip.Get().Internal_SetToolTip(itemdb, item); global::ItemToolTip.Get().RepositionAtCursor(); }
// Token: 0x060039AC RID: 14764 RVA: 0x000CB27C File Offset: 0x000C947C protected static void SerializeSharedProperties(BitStream stream, global::InventoryItem item, global::ItemDataBlock db) { stream.WriteInvInt(item.uses); if (item.datablock.DoesLoseCondition()) { stream.WriteSingle(item.condition); stream.WriteSingle(item.maxcondition); } }
// Token: 0x060039AD RID: 14765 RVA: 0x000CB2C0 File Offset: 0x000C94C0 protected static void DeserializeSharedProperties(BitStream stream, global::InventoryItem item, global::ItemDataBlock db) { item.uses = stream.ReadInvInt(); if (item.datablock.DoesLoseCondition()) { item.condition = stream.ReadSingle(); item.maxcondition = stream.ReadSingle(); } }
// Token: 0x06002A1F RID: 10783 RVA: 0x0009C220 File Offset: 0x0009A420 public GameObject AddItemTitle(global::ItemDataBlock item) { return(this.AddItemTitle(item, 0f)); }