Beispiel #1
0
    // Token: 0x060003EE RID: 1006 RVA: 0x000128DC File Offset: 0x00010ADC
    private void CheckBeltUsage()
    {
        if (global::UIUnityEvents.shouldBlockButtonInput)
        {
            return;
        }
        if (!base.enabled)
        {
            return;
        }
        if (global::ConsoleWindow.IsVisible())
        {
            return;
        }
        global::Inventory inventory = this.inventory;

        if (!inventory)
        {
            return;
        }
        global::InventoryHolder inventoryHolder = inventory.inventoryHolder;

        if (!inventoryHolder)
        {
            return;
        }
        int num = global::HumanController.InputSample.PollItemButtons();

        if (num != -1)
        {
            inventoryHolder.BeltUse(num);
        }
    }
    // Token: 0x060039B8 RID: 14776 RVA: 0x000CB630 File Offset: 0x000C9830
    public override string ToString()
    {
        global::Inventory inventory = base.inventory;
        string            text;

        if (this.datablock)
        {
            DB db = this.datablock;
            text = db.name;
        }
        else
        {
            text = global::InventoryItem <DB> .tostringhelper.nullDatablockString;
        }
        string text2 = text;

        if (inventory)
        {
            return(string.Format("[{0} (on {1}[{2}]) with ({3} uses)]", new object[]
            {
                text2,
                inventory.name,
                base.slot,
                base.uses
            }));
        }
        return(string.Format("[{0} (unbound slot {1}) with ({2} uses)]", text2, base.slot, base.uses));
    }
    // Token: 0x06003CEC RID: 15596 RVA: 0x000DA044 File Offset: 0x000D8244
    public bool CanRepair(global::Inventory ingredientInv)
    {
        global::IInventoryItem repairItem = this.GetRepairItem();

        if (repairItem == null || !repairItem.datablock.isRepairable)
        {
            return(false);
        }
        if (!repairItem.IsDamaged())
        {
            return(false);
        }
        global::BlueprintDataBlock blueprintDataBlock;

        if (global::BlueprintDataBlock.FindBlueprintForItem <global::BlueprintDataBlock>(repairItem.datablock, out blueprintDataBlock))
        {
            for (int i = 0; i < blueprintDataBlock.ingredients.Length; i++)
            {
                global::BlueprintDataBlock.IngredientEntry ingredientEntry = blueprintDataBlock.ingredients[i];
                int num = Mathf.CeilToInt((float)blueprintDataBlock.ingredients[i].amount * this.GetResourceScalar());
                if (num > 0 && ingredientInv.CanConsume(blueprintDataBlock.ingredients[i].Ingredient, num) <= 0)
                {
                    return(false);
                }
            }
            return(true);
        }
        return(false);
    }
    // Token: 0x06003290 RID: 12944 RVA: 0x000BFB5C File Offset: 0x000BDD5C
    public virtual bool CompleteWork(int amount, global::Inventory workbenchInv)
    {
        if (!this.CanWork(amount, workbenchInv))
        {
            return(false);
        }
        int num = 0;

        for (int i = 0; i < this.ingredients.Length; i++)
        {
            int num2 = this.ingredients[i].amount * amount;
            if (num2 != 0)
            {
                int num3 = this.lastCanWorkIngredientCount[i];
                for (int j = 0; j < num3; j++)
                {
                    int slot = this.lastCanWorkResult[num++];
                    global::IInventoryItem inventoryItem;
                    if (workbenchInv.GetItem(slot, out inventoryItem) && inventoryItem.Consume(ref num2))
                    {
                        workbenchInv.RemoveItem(slot);
                    }
                }
            }
        }
        workbenchInv.AddItemAmount(this.resultItem, amount * this.numResultItem);
        return(true);
    }
Beispiel #5
0
 // Token: 0x06003948 RID: 14664 RVA: 0x000CAABC File Offset: 0x000C8CBC
 public override void OnMovedTo(global::Inventory toInv, int toSlot)
 {
     if (base.active)
     {
         base.inventory.DeactivateItem();
     }
 }
    // 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);
    }
Beispiel #7
0
    // Token: 0x06002A2F RID: 10799 RVA: 0x0009C644 File Offset: 0x0009A844
    protected virtual void CreateCellsOnGameObject(global::Inventory inven, GameObject parent)
    {
        bool flag = inven;
        int  newSize;
        int  num;

        if (flag)
        {
            global::Inventory.Slot.Range range;
            inven.GetSlotsOfKind(global::Inventory.Slot.Kind.Default, out range);
            newSize = range.Count;
            num     = range.End;
        }
        else
        {
            newSize = this.GetNumCells();
            num     = int.MaxValue;
        }
        Array.Resize <global::RPOSInventoryCell>(ref this._inventoryCells, newSize);
        float x = this.CellPrefab.GetComponent <global::RPOSInventoryCell>()._background.transform.localScale.x;
        float y = this.CellPrefab.GetComponent <global::RPOSInventoryCell>()._background.transform.localScale.y;

        for (int i = 0; i < this.NumCellsVertical; i++)
        {
            for (int j = 0; j < this.NumCellsHorizontal; j++)
            {
                byte b = (byte)(this.CellIndexStart + global::RPOSInvCellManager.GetIndex2D(j, i, this.NumCellsHorizontal));
                if ((int)b >= num)
                {
                    return;
                }
                GameObject gameObject = global::NGUITools.AddChild(parent, this.CellPrefab);
                global::RPOSInventoryCell component = gameObject.GetComponent <global::RPOSInventoryCell>();
                component._mySlot           = b;
                component._displayInventory = inven;
                if (this.NumberedCells)
                {
                    component._numberLabel.text = (global::RPOSInvCellManager.GetIndex2D(j, i, this.NumCellsHorizontal) + 1).ToString();
                }
                gameObject.transform.localPosition = new Vector3((float)this.CellOffsetX + ((float)j * x + (float)(j * this.CellSpacing)), -((float)this.CellOffsetY + ((float)i * y + (float)(i * this.CellSpacing))), -2f);
                this._inventoryCells[global::RPOS.GetIndex2D(j, i, this.NumCellsHorizontal)] = gameObject.GetComponent <global::RPOSInventoryCell>();
            }
        }
        if (this.CenterFromCells)
        {
            if (this.NumCellsHorizontal > 1)
            {
                base.transform.localPosition = new Vector3((float)(this.CellOffsetX + (this.NumCellsHorizontal * this.CellSize + (this.NumCellsHorizontal - 1) * this.CellSpacing)) * -0.5f, (float)this.CellSize, 0f);
            }
            else if (this.NumCellsVertical > 1)
            {
                base.transform.localPosition = new Vector3((float)(-(float)this.CellSize), (float)(this.CellOffsetY + this.NumCellsVertical * this.CellSize) * 0.5f, 0f);
            }
        }
    }
    // Token: 0x06003377 RID: 13175 RVA: 0x000C1880 File Offset: 0x000BFA80
    public virtual void UseItem(global::IConsumableItem item)
    {
        global::Inventory  inventory = item.inventory;
        global::Metabolism local     = inventory.GetLocal <global::Metabolism>();

        if (local == null)
        {
            return;
        }
        if (!local.CanConsumeYet())
        {
            return;
        }
        local.MarkConsumptionTime();
        float numCalories = Mathf.Min(local.GetRemainingCaloricSpace(), this.calories);

        if (this.calories > 0f)
        {
            local.AddCalories(numCalories);
        }
        if (this.litresOfWater > 0f)
        {
            local.AddWater(this.litresOfWater);
        }
        if (this.antiRads > 0f)
        {
            local.AddAntiRad(this.antiRads);
        }
        if (this.healthToHeal != 0f)
        {
            global::HumanBodyTakeDamage local2 = inventory.GetLocal <global::HumanBodyTakeDamage>();
            if (local2 != null)
            {
                if (this.healthToHeal > 0f)
                {
                    local2.HealOverTime(this.healthToHeal);
                }
                else
                {
                    global::TakeDamage.HurtSelf(inventory.idMain, Mathf.Abs(this.healthToHeal), null);
                }
            }
        }
        if (this.poisonAmount > 0f)
        {
            local.AddPoison(this.poisonAmount);
        }
        int num = 1;

        if (item.Consume(ref num))
        {
            inventory.RemoveItem(item.slot);
        }
    }
 // Token: 0x06003A88 RID: 14984 RVA: 0x000CD70C File Offset: 0x000CB90C
 public void PopulateInventory(global::Inventory inven)
 {
     global::LootSpawnList.RecursiveInventoryPopulateArgs recursiveInventoryPopulateArgs;
     recursiveInventoryPopulateArgs.inventory         = inven;
     recursiveInventoryPopulateArgs.spawnCount        = 0;
     recursiveInventoryPopulateArgs.inventoryExausted = inven.noVacantSlots;
     if (!recursiveInventoryPopulateArgs.inventoryExausted)
     {
         this.PopulateInventory_Recurse(ref recursiveInventoryPopulateArgs);
     }
 }
Beispiel #10
0
    // Token: 0x060036F6 RID: 14070 RVA: 0x000C5E28 File Offset: 0x000C4028
    public override bool CanWork(global::IToolItem tool, global::Inventory workbenchInv)
    {
        if (workbenchInv.occupiedSlotCount > 2)
        {
            Debug.Log("Too many items for recycle");
            return(false);
        }
        global::IInventoryItem firstItemNotTool = base.GetFirstItemNotTool(tool, workbenchInv);

        return(firstItemNotTool.datablock.isRecycleable && global::BlueprintDataBlock.FindBlueprintForItem(firstItemNotTool.datablock));
    }
 // Token: 0x060038A7 RID: 14503 RVA: 0x000C94E8 File Offset: 0x000C76E8
 public override bool CanMoveToSlot(global::Inventory toinv, int toslot)
 {
     if (base.IsBroken())
     {
         global::PlayerInventory playerInventory = toinv as global::PlayerInventory;
         if (playerInventory != null && global::PlayerInventory.IsEquipmentSlot(toslot))
         {
             return(false);
         }
     }
     return(true);
 }
 // Token: 0x06003D0E RID: 15630 RVA: 0x000DAAB0 File Offset: 0x000D8CB0
 public void PlayerUse(global::Controllable controllable)
 {
     if (base.BelongsTo(controllable))
     {
         if (!this.IsValidToSpawn())
         {
             return;
         }
         global::Inventory component = controllable.GetComponent <global::Inventory>();
         if (component.AddItemAmount(global::DatablockDictionary.GetByName(this.giveItemName), 1) == 1)
         {
             return;
         }
     }
 }
Beispiel #13
0
    // Token: 0x0600371B RID: 14107 RVA: 0x000C6120 File Offset: 0x000C4320
    public override bool CompleteWork(global::IToolItem tool, global::Inventory workbenchInv)
    {
        if (!this.CanWork(tool, workbenchInv))
        {
            return(false);
        }
        global::IInventoryItem     firstItemNotTool = base.GetFirstItemNotTool(tool, workbenchInv);
        global::BlueprintDataBlock blueprintDataBlock;

        if (global::BlueprintDataBlock.FindBlueprintForItem <global::BlueprintDataBlock>(firstItemNotTool.datablock, out blueprintDataBlock))
        {
            workbenchInv.AddItem(blueprintDataBlock, global::Inventory.Slot.Preference.Define(global::Inventory.Slot.Kind.Default, blueprintDataBlock.IsSplittable(), global::Inventory.Slot.Kind.Belt), 1);
            return(true);
        }
        return(false);
    }
Beispiel #14
0
 // Token: 0x06002FBC RID: 12220 RVA: 0x000B7BD4 File Offset: 0x000B5DD4
 public bool Restart(global::Inventory inventory, int amount, global::BlueprintDataBlock blueprint, ulong startTimeMillis)
 {
     if (!blueprint || !blueprint.CanWork(amount, inventory))
     {
         this = default(global::CraftingSession);
         return(false);
     }
     this.blueprint       = blueprint;
     this.startTime       = (float)(startTimeMillis / 1000.0);
     this.duration        = blueprint.craftingDuration * (float)amount;
     this.progressPerSec  = 1f;
     this.progressSeconds = 0f;
     this.amount          = amount;
     this.inProgress      = true;
     return(true);
 }
Beispiel #15
0
    // Token: 0x0600371A RID: 14106 RVA: 0x000C60BC File Offset: 0x000C42BC
    public override bool CanWork(global::IToolItem tool, global::Inventory workbenchInv)
    {
        if (workbenchInv.occupiedSlotCount > 2)
        {
            Debug.Log("Too many items for research");
            return(false);
        }
        global::IInventoryItem firstItemNotTool = base.GetFirstItemNotTool(tool, workbenchInv);

        if (firstItemNotTool != null && firstItemNotTool.datablock.isResearchable && global::BlueprintDataBlock.FindBlueprintForItem(firstItemNotTool.datablock))
        {
            return(true);
        }
        Debug.Log("Can't work!?!!?");
        return(false);
    }
Beispiel #16
0
 // Token: 0x0600373F RID: 14143 RVA: 0x000C62B0 File Offset: 0x000C44B0
 public global::IInventoryItem GetFirstItemNotTool(global::IToolItem tool, global::Inventory workbenchInv)
 {
     using (global::Inventory.OccupiedIterator occupiedIterator = workbenchInv.occupiedIterator)
     {
         global::IInventoryItem inventoryItem;
         while (occupiedIterator.Next(out inventoryItem))
         {
             if (!object.ReferenceEquals(inventoryItem, tool))
             {
                 return(inventoryItem);
             }
         }
     }
     Debug.LogWarning("Could not find target item");
     return(null);
 }
Beispiel #17
0
    // Token: 0x060036F8 RID: 14072 RVA: 0x000C5E84 File Offset: 0x000C4084
    public override bool CompleteWork(global::IToolItem tool, global::Inventory workbenchInv)
    {
        if (!this.CanWork(tool, workbenchInv))
        {
            return(false);
        }
        global::IInventoryItem     firstItemNotTool = base.GetFirstItemNotTool(tool, workbenchInv);
        global::BlueprintDataBlock blueprintDataBlock;

        global::BlueprintDataBlock.FindBlueprintForItem <global::BlueprintDataBlock>(firstItemNotTool.datablock, out blueprintDataBlock);
        int num = 1;

        if (firstItemNotTool.datablock.IsSplittable())
        {
            num = firstItemNotTool.uses;
        }
        for (int i = 0; i < num; i++)
        {
            foreach (global::BlueprintDataBlock.IngredientEntry ingredientEntry in blueprintDataBlock.ingredients)
            {
                int num2 = Random.Range(0, 4);
                if (num2 != 0)
                {
                    if (num2 == 1 || num2 == 2 || num2 == 3)
                    {
                        workbenchInv.AddItemAmount(ingredientEntry.Ingredient, ingredientEntry.amount);
                    }
                }
            }
        }
        int num3;

        if (!firstItemNotTool.datablock.IsSplittable())
        {
            num3 = firstItemNotTool.uses;
        }
        else
        {
            num3 = num;
        }
        if (firstItemNotTool.Consume(ref num3))
        {
            firstItemNotTool.inventory.RemoveItem(firstItemNotTool.slot);
        }
        return(true);
    }
    // Token: 0x06003844 RID: 14404 RVA: 0x000C7BB0 File Offset: 0x000C5DB0
    public bool TossItem(int slot)
    {
        Facepunch.NetworkView networkView = base.networkView;
        if (!networkView || !networkView.isMine)
        {
            return(false);
        }
        global::Inventory      inventory = this.inventory;
        global::IInventoryItem inventoryItem;

        if (!inventory || !inventory.GetItem(slot, out inventoryItem))
        {
            return(false);
        }
        global::NetCull.RPC <byte>(this, "TOSS", 0, global::Inventory.RPCInteger(slot));
        inventory.NULL_SLOT_FIX_ME(slot);
        return(true);
    }
Beispiel #19
0
    // Token: 0x06003268 RID: 12904 RVA: 0x000BF72C File Offset: 0x000BD92C
    public virtual void UseItem(global::IBloodDrawItem draw)
    {
        if (Time.time < draw.lastUseTime + 2f)
        {
            return;
        }
        global::Inventory           inventory = draw.inventory;
        global::HumanBodyTakeDamage local     = inventory.GetLocal <global::HumanBodyTakeDamage>();

        if (local.health <= this.bloodToTake)
        {
            return;
        }
        IDMain idMain = inventory.idMain;

        global::TakeDamage.Hurt(idMain, idMain, this.bloodToTake, null);
        inventory.AddItem(ref global::BloodDrawDatablock.LateLoaded.blood, global::Inventory.Slot.Preference.Define(global::Inventory.Slot.Kind.Default, true, global::Inventory.Slot.KindFlags.Belt), 1);
        draw.lastUseTime = Time.time;
    }
    // Token: 0x0600328D RID: 12941 RVA: 0x000BF9DC File Offset: 0x000BDBDC
    public virtual int MaxAmount(global::Inventory workbenchInv)
    {
        int num = int.MaxValue;

        foreach (global::BlueprintDataBlock.IngredientEntry ingredientEntry in this.ingredients)
        {
            int num2 = 0;
            global::IInventoryItem inventoryItem = workbenchInv.FindItem(ingredientEntry.Ingredient, out num2);
            if (inventoryItem != null)
            {
                int num3 = num2 / ingredientEntry.amount;
                if (num3 < num)
                {
                    num = num3;
                }
            }
        }
        return((num != int.MaxValue) ? num : 0);
    }
 // Token: 0x0600328E RID: 12942 RVA: 0x000BFA50 File Offset: 0x000BDC50
 public virtual bool CanWork(int amount, global::Inventory workbenchInv)
 {
     if (this.lastCanWorkResult == null)
     {
         this.lastCanWorkResult = new List <int>();
     }
     else
     {
         this.lastCanWorkResult.Clear();
     }
     if (this.lastCanWorkIngredientCount == null)
     {
         this.lastCanWorkIngredientCount = new List <int>(this.ingredients.Length);
     }
     else
     {
         this.lastCanWorkIngredientCount.Clear();
     }
     if (this.RequireWorkbench)
     {
         global::CraftingInventory component = workbenchInv.GetComponent <global::CraftingInventory>();
         if (!component || !component.AtWorkBench())
         {
             return(false);
         }
     }
     foreach (global::BlueprintDataBlock.IngredientEntry ingredientEntry in this.ingredients)
     {
         if (ingredientEntry.amount != 0)
         {
             int num = workbenchInv.CanConsume(ingredientEntry.Ingredient, ingredientEntry.amount * amount, this.lastCanWorkResult);
             if (num <= 0)
             {
                 this.lastCanWorkResult.Clear();
                 this.lastCanWorkIngredientCount.Clear();
                 return(false);
             }
             this.lastCanWorkIngredientCount.Add(num);
         }
     }
     return(true);
 }
    // Token: 0x06003CED RID: 15597 RVA: 0x000DA0FC File Offset: 0x000D82FC
    public bool CompleteRepair(global::Inventory ingredientInv)
    {
        if (!this.CanRepair(ingredientInv))
        {
            return(false);
        }
        global::IInventoryItem     repairItem = this.GetRepairItem();
        global::BlueprintDataBlock blueprintDataBlock;

        if (!global::BlueprintDataBlock.FindBlueprintForItem <global::BlueprintDataBlock>(repairItem.datablock, out blueprintDataBlock))
        {
            return(false);
        }
        for (int i = 0; i < blueprintDataBlock.ingredients.Length; i++)
        {
            global::BlueprintDataBlock.IngredientEntry ingredientEntry = blueprintDataBlock.ingredients[i];
            int j = Mathf.RoundToInt((float)blueprintDataBlock.ingredients[i].amount * this.GetResourceScalar());
            if (j > 0)
            {
                while (j > 0)
                {
                    int num = 0;
                    global::IInventoryItem inventoryItem = ingredientInv.FindItem(ingredientEntry.Ingredient, out num);
                    if (inventoryItem == null)
                    {
                        return(false);
                    }
                    if (inventoryItem.Consume(ref j))
                    {
                        ingredientInv.RemoveItem(inventoryItem.slot);
                    }
                }
            }
        }
        float num2 = repairItem.maxcondition - repairItem.condition;
        float num3 = num2 * 0.2f + 0.05f;

        repairItem.SetMaxCondition(repairItem.maxcondition - num3);
        repairItem.SetCondition(repairItem.maxcondition);
        return(true);
    }
	// Token: 0x0600390C RID: 14604 RVA: 0x000C9F9C File Offset: 0x000C819C
	public virtual void ActualReload_COD()
	{
		this.reloadStartTime = Time.time;
		base.nextPrimaryAttackTime = Time.time + this.datablock.reloadDuration;
		global::Inventory inventory = base.inventory;
		int i = base.uses;
		int maxClipAmmo = this.datablock.maxClipAmmo;
		if (i == maxClipAmmo)
		{
			return;
		}
		int num = maxClipAmmo - i;
		int num2 = 0;
		while (i < maxClipAmmo)
		{
			global::IInventoryItem inventoryItem = inventory.FindItem(this.datablock.ammoType);
			if (inventoryItem == null)
			{
				break;
			}
			int num3 = num;
			if (inventoryItem.Consume(ref num))
			{
				inventory.RemoveItem(inventoryItem.slot);
			}
			num2 += num3 - num;
			if (num == 0)
			{
				break;
			}
		}
		if (num2 > 0)
		{
			base.AddUses(num2);
		}
		inventory.Refresh();
	}
Beispiel #24
0
    // Token: 0x06002A2C RID: 10796 RVA: 0x0009C52C File Offset: 0x0009A72C
    public void SetInventory(global::Inventory newInv, bool spawnNewCells)
    {
        this.displayInventory = newInv;
        if (spawnNewCells && this.SpawnCells)
        {
            this.generatedCells = true;
            for (int i = 0; i < this._inventoryCells.Length; i++)
            {
                Object.Destroy(this._inventoryCells[i].gameObject);
                this._inventoryCells[i] = null;
            }
            this.NumCellsVertical = Mathf.CeilToInt((float)newInv.slotCount / 3f);
            this.CreateCellsOnGameObject(newInv, base.gameObject);
        }
        int num = 0;

        foreach (global::RPOSInventoryCell rposinventoryCell in this._inventoryCells)
        {
            rposinventoryCell._displayInventory = newInv;
            rposinventoryCell._mySlot           = (byte)(this.CellIndexStart + num);
            newInv.MarkSlotDirty((int)rposinventoryCell._mySlot);
            num++;
        }
    }
 // Token: 0x060039B4 RID: 14772 RVA: 0x000CB3E4 File Offset: 0x000C95E4
 public override void OnMovedTo(global::Inventory inv, int slot)
 {
 }
Beispiel #26
0
 // Token: 0x06003998 RID: 14744 RVA: 0x000CB10C File Offset: 0x000C930C
 public virtual bool CanMoveToSlot(global::Inventory toinv, int toslot)
 {
     return(true);
 }
Beispiel #27
0
 // Token: 0x06002A63 RID: 10851 RVA: 0x0009D890 File Offset: 0x0009BA90
 public void UpdateGUIAmounts()
 {
     if (this._benchItem == null)
     {
         foreach (global::UILabel uilabel in this._amountLabels)
         {
             uilabel.text  = string.Empty;
             uilabel.color = Color.white;
         }
         this.needsLabel.enabled     = false;
         this.conditionLabel.enabled = false;
         this.repairButton.gameObject.SetActive(false);
     }
     else
     {
         global::Controllable controllable = global::PlayerClient.GetLocalPlayer().controllable;
         if (controllable == null)
         {
             return;
         }
         global::Inventory component = controllable.GetComponent <global::Inventory>();
         int num = 0;
         if (this._benchItem.IsDamaged())
         {
             global::BlueprintDataBlock blueprintDataBlock;
             if (global::BlueprintDataBlock.FindBlueprintForItem <global::BlueprintDataBlock>(this._benchItem.datablock, out blueprintDataBlock))
             {
                 for (int j = 0; j < blueprintDataBlock.ingredients.Length; j++)
                 {
                     if (num >= this._amountLabels.Length)
                     {
                         break;
                     }
                     global::BlueprintDataBlock.IngredientEntry ingredientEntry = blueprintDataBlock.ingredients[j];
                     int num2 = Mathf.CeilToInt((float)blueprintDataBlock.ingredients[j].amount * this._bench.GetResourceScalar());
                     if (num2 > 0)
                     {
                         bool flag = component.CanConsume(blueprintDataBlock.ingredients[j].Ingredient, num2) > 0;
                         this._amountLabels[num].text  = num2 + " " + blueprintDataBlock.ingredients[j].Ingredient.name;
                         this._amountLabels[num].color = ((!flag) ? Color.red : Color.green);
                         num++;
                     }
                 }
             }
             this.needsLabel.color       = Color.white;
             this.needsLabel.enabled     = true;
             this.conditionLabel.enabled = true;
             this.repairButton.gameObject.SetActive(true);
             string str  = (this._benchItem.condition * 100f).ToString("0");
             string str2 = (this._benchItem.maxcondition * 100f).ToString("0");
             this.conditionLabel.text  = "Condition : " + str + "/" + str2;
             this.conditionLabel.color = ((this._benchItem.condition >= 0.6f) ? Color.green : Color.yellow);
             if (this._benchItem.IsBroken())
             {
                 this.conditionLabel.color = Color.red;
             }
         }
         else
         {
             this.needsLabel.text    = "Does not need repairs";
             this.needsLabel.color   = Color.green;
             this.needsLabel.enabled = true;
             string str3 = (this._benchItem.condition * 100f).ToString("0");
             string str4 = (this._benchItem.maxcondition * 100f).ToString("0");
             this.conditionLabel.text    = "Condition : " + str3 + "/" + str4;
             this.conditionLabel.color   = Color.green;
             this.conditionLabel.enabled = true;
             this.repairButton.gameObject.SetActive(false);
             foreach (global::UILabel uilabel2 in this._amountLabels)
             {
                 uilabel2.text  = string.Empty;
                 uilabel2.color = Color.white;
             }
         }
     }
 }
Beispiel #28
0
 // Token: 0x060039A6 RID: 14758 RVA: 0x000CB254 File Offset: 0x000C9454
 public virtual void OnAddedTo(global::Inventory inv, int slot)
 {
     this.inventory = inv;
     this.slot      = slot;
 }
Beispiel #29
0
    // Token: 0x060039A2 RID: 14754 RVA: 0x000CB224 File Offset: 0x000C9424
    public bool MarkDirty()
    {
        global::Inventory inventory = this.inventory;

        return(inventory && inventory.MarkSlotDirty(this.slot));
    }
Beispiel #30
0
 // Token: 0x060039A5 RID: 14757
 public abstract void OnMovedTo(global::Inventory inv, int slot);