Ejemplo n.º 1
0
 public ItemInstance GetItem(ItemLocation loc)
 {
     if (loc.Equals(ItemLocation.InvalidLocation))
     {
         return(null);
     }
     return(_zoneMap[loc.zoneType].GetContainer(loc.container).GetItem(loc.slot));
 }
Ejemplo n.º 2
0
        public ItemLocation PutItemInNextOpenSlot(ItemZoneType itemZoneType, ItemInstance item)
        {
            ItemLocation nextOpenSlot = NextOpenSlot(itemZoneType);

            if (!nextOpenSlot.Equals(ItemLocation.InvalidLocation))
            {
                PutItem(nextOpenSlot, item);
            }
            return(nextOpenSlot);
        }
Ejemplo n.º 3
0
        /// <summary>
        ///     Finds the next open slot in adventure bag, equipped bags, and premium bag, in that order.
        /// </summary>
        /// <returns></returns>
        public ItemLocation NextOpenSlotInInventory()
        {
            ItemLocation nextOpenSlot = ItemLocation.InvalidLocation;

            nextOpenSlot = NextOpenSlot(ItemZoneType.AdventureBag);
            if (!nextOpenSlot.Equals(ItemLocation.InvalidLocation))
            {
                return(nextOpenSlot);
            }
            nextOpenSlot = NextOpenSlot(ItemZoneType.EquippedBags);
            if (!nextOpenSlot.Equals(ItemLocation.InvalidLocation))
            {
                return(nextOpenSlot);
            }
            nextOpenSlot = NextOpenSlot(ItemZoneType.PremiumBag);
            if (!nextOpenSlot.Equals(ItemLocation.InvalidLocation))
            {
                return(nextOpenSlot);
            }
            return(nextOpenSlot);
        }
Ejemplo n.º 4
0
        public MoveResult CancelExhibit(byte slot)
        {
            //TODO don't allow cancelling auctions with bids
            ItemLocation itemLocation = new ItemLocation(ItemZoneType.ProbablyAuctionLots, 0, slot);
            ItemInstance fromItem     = _character.itemLocationVerifier.GetItem(itemLocation);
            ItemLocation nextOpenSlot = _character.itemLocationVerifier.NextOpenSlotInInventory();

            //check possible errors. these should only occur if client is compromised
            if (fromItem is null || nextOpenSlot.Equals(ItemLocation.InvalidLocation))
            {
                throw new AuctionException(AuctionExceptionType.Generic);
            }
            if (fromItem.bidderSoulId > 0)
            {
                throw new AuctionException(AuctionExceptionType.BiddingCompleted);
            }

            MoveResult moveResult = MoveItemPlace(nextOpenSlot, fromItem);

            _itemDao.UpdateAuctionCancelExhibit(fromItem.instanceId);

            return(moveResult);
        }