Beispiel #1
0
        /// <summary>
        ///     Used when the there is no item already in the end location and the quantity moved is less than total quantity of
        ///     items in the original location.
        /// </summary>
        /// <param name="to">Move to this location.</param>
        /// <param name="fromItem">Move a quantity from this item.</param>
        /// <returns>
        ///     Result containing the original item with less quantity and a new instance with the remaining amount at the
        ///     destination.
        /// </returns>
        private MoveResult MoveItemPlaceQuantity(ItemLocation to, ItemInstance fromItem, byte quantity)
        {
            MoveResult moveResult = new MoveResult(MoveType.PlaceQuantity);

            moveResult.originItem           = fromItem;
            moveResult.originItem.quantity -= quantity;

            ItemSpawnParams spawnParam = new ItemSpawnParams();

            spawnParam.quantity     = quantity;
            spawnParam.itemStatuses = moveResult.originItem.statuses;

            const int SIZE = 1;

            ItemLocation[]    locs        = new ItemLocation[SIZE];
            int[]             baseIds     = new int[SIZE];
            ItemSpawnParams[] spawnParams = new ItemSpawnParams[SIZE];

            locs[0]        = to;
            baseIds[0]     = moveResult.originItem.baseId;
            spawnParams[0] = spawnParam;

            List <ItemInstance> insertedItem = _itemDao.InsertItemInstances(fromItem.ownerId, locs, baseIds, spawnParams);

            _character.itemLocationVerifier.PutItem(to, insertedItem[0]);
            moveResult.destItem = insertedItem[0];

            return(moveResult);
        }
Beispiel #2
0
        public ItemInstance SpawnItemInstance(ItemZoneType itemZoneType, int baseId, ItemSpawnParams spawnParam)
        {
            int[]             itemIds     = { baseId };
            ItemSpawnParams[] spawmParams = new ItemSpawnParams[1];
            spawmParams[0] = spawnParam;
            List <ItemInstance> items = SpawnItemInstances(itemZoneType, itemIds, spawmParams);

            return(items[0]);
        }