Beispiel #1
0
        protected int PayOut(CardPlayerData playerData, int maxAmount)
        {
            int num = 0;
            StorageContainer storage = playerData.GetStorage();
            StorageContainer pot     = Owner.GetPot();

            if (storage != null && pot != null)
            {
                List <Item> obj = Pool.GetList <Item>();
                num = pot.inventory.Take(obj, ScrapItemID, maxAmount);
                if (num > 0)
                {
                    foreach (Item item in obj)
                    {
                        item.MoveToContainer(storage.inventory, -1, true, true);
                    }
                }
                Pool.FreeList(ref obj);
            }
            else
            {
                Debug.LogError(GetType().Name + ": PayOut: Null storage.");
            }
            return(num);
        }
Beispiel #2
0
        protected int RemoveScrapFromStorage(CardPlayerData data)
        {
            StorageContainer storage    = data.GetStorage();
            BasePlayer       basePlayer = BasePlayer.FindByID(data.UserID);
            int num = 0;

            if (basePlayer != null)
            {
                List <Item> obj = Pool.GetList <Item>();
                num = storage.inventory.Take(obj, ScrapItemID, int.MaxValue);
                if (num > 0)
                {
                    foreach (Item item in obj)
                    {
                        item.MoveToContainer(basePlayer.inventory.containerMain, -1, true, true);
                    }
                }
                Pool.FreeList(ref obj);
            }
            return(num);
        }