示例#1
0
        private static bool TryGetStashingLocation(ACDItem item, int stashPageNumber, int col, int row, InventoryMap map, ref int placeAtCol, ref int placeAtRow)
        {
            var loc           = new Tuple <int, int>(col, row);
            var isSquareEmpty = !map.ContainsKey(loc);

            var isLastRow = (row + 1) % 10 == 0;

            if (isLastRow && item.IsTwoSquareItem)
            {
                return(false);
            }

            if (item.IsTwoSquareItem)
            {
                var locBelow = new Tuple <int, int>(col, row + 1);
                if (map.ContainsKey(locBelow))
                {
                    return(false);
                }
            }

            var locAbove    = new Tuple <int, int>(col, row - 1);
            var isItemAbove = map.ContainsKey(locAbove);

            if (isItemAbove &&
                map[locAbove].IsTwoSquareItem)
            {
                return(false);
            }

            if (!isSquareEmpty)
            {
                return(false);
            }

            Core.Logger.Verbose($"Can stash item {item.Name} on page {stashPageNumber} at [col={col},row={row}]");
            placeAtCol = col;
            placeAtRow = row;
            return(true);
        }
示例#2
0
        private static bool TryGetStackLocation(ACDItem item, int stashPageNumber, int col, int row, InventoryMap map, ref int placeAtCol, ref int placeAtRow)
        {
            var loc = new Tuple <int, int>(col, row);

            if (col == placeAtCol &&
                row == placeAtRow)
            {
                return(false);
            }

            var isSquareEmpty = !map.ContainsKey(loc);

            if (isSquareEmpty)
            {
                return(false);
            }

            if (item.IsTwoSquareItem)
            {
                return(false);
            }

            if (item.MaxStackCount <= 0)
            {
                return(false);
            }

            var existingItem          = map[loc];
            var existingStackQuantity = existingItem.ItemStackQuantity;
            var itemStackQuantity     = item.ItemStackQuantity;
            var newStackSize          = existingStackQuantity + itemStackQuantity;

            if (item.ActorSnoId != existingItem.ActorSnoId ||
                newStackSize > item.MaxStackCount ||
                item.AnnId == existingItem.AnnId)
            {
                return(false);
            }

            Core.Logger.Debug($"Can stash item {item.Name} on page {stashPageNumber} at [col={col},row={row}] (stack on existing {existingStackQuantity} + {itemStackQuantity} ({newStackSize}) / {item.MaxStackCount})");
            placeAtCol = col;
            placeAtRow = row;
            return(true);
        }