Exemple #1
0
        public void SaveCashItems(CharacterCashItems otherItems)
        {
            // Move cashitems back to the _cashItems object

            // 'Hidden' equips
            _cashItems.Equips.AddRange(Equips[1].Where(y => y != null && y.CashId != 0));
            // Unequipped equips
            _cashItems.Equips.AddRange(Items[0].Where(y => y is EquipItem && y.CashId != 0).Select(y => y as EquipItem));
            // Bundles
            _cashItems.Bundles.AddRange(Items.SelectMany(x => x.Where(y => y is BundleItem && y.CashId != 0).Select(y => y as BundleItem)));
            // Pets
            _cashItems.Pets.AddRange(Items.SelectMany(x => x.Where(y => y is PetItem && y.CashId != 0).Select(y => y as PetItem)));

            if (otherItems == null)
            {
                CharacterCashItems.SaveMultiple(_cashItems);
            }
            else
            {
                CharacterCashItems.SaveMultiple(_cashItems, otherItems);
            }

            // Cleanup for next save
            _cashItems.Equips.Clear();
            _cashItems.Bundles.Clear();
            _cashItems.Pets.Clear();
        }
Exemple #2
0
 protected BaseCharacterInventory(int userId, int characterId)
 {
     UserID      = userId;
     CharacterID = characterId;
     _cashItems  = new CharacterCashItems(UserID, CharacterID);
 }