コード例 #1
0
        // Token: 0x0600138C RID: 5004 RVA: 0x0005F66C File Offset: 0x0005D86C
        public bool CanBeAffordedByInteractor(Interactor activator)
        {
            switch (this.costType)
            {
            case CostType.None:
                return(true);

            case CostType.Money:
            {
                CharacterBody component = activator.GetComponent <CharacterBody>();
                if (component)
                {
                    CharacterMaster master = component.master;
                    if (master)
                    {
                        return((ulong)master.money >= (ulong)((long)this.cost));
                    }
                }
                return(false);
            }

            case CostType.PercentHealth:
            {
                HealthComponent component2 = activator.GetComponent <HealthComponent>();
                return(component2 && component2.health / component2.fullHealth * 100f >= (float)this.cost);
            }

            case CostType.Lunar:
            {
                NetworkUser networkUser = Util.LookUpBodyNetworkUser(activator.gameObject);
                return(networkUser && (ulong)networkUser.lunarCoins >= (ulong)((long)this.cost));
            }

            case CostType.WhiteItem:
            case CostType.GreenItem:
            case CostType.RedItem:
            {
                ItemTier      itemTier   = PurchaseInteraction.CostTypeToItemTier(this.costType);
                CharacterBody component3 = activator.gameObject.GetComponent <CharacterBody>();
                if (component3)
                {
                    Inventory inventory = component3.inventory;
                    if (inventory)
                    {
                        return(inventory.HasAtLeastXTotalItemsOfTier(itemTier, this.cost));
                    }
                }
                return(false);
            }

            default:
                return(false);
            }
        }