message: Fix move logic for unique stacks into full inventory
diff: @@ -59,7 +59,7 @@ const StoreProto = {
  throw new Error("item needs a 'type' field");
  }
  // Account-wide buckets (mods, etc) are only on the first character
  - if (item.location.accountWide && !this.current) {
  + if (item.bucket.accountWide && !this.current) {
  return 0;
  }
  if (!item.bucket) {
  @@ -75,14 +75,18 @@ const StoreProto = {
  // we need to check out how much space is left in that bucket, which is
  // only on the current store.
  if (item.bucket.accountWide) {
  - return Math.max(
  - item.maxStackSize -
  - item
  + const existingAmount = item
  .getStoresService()
  .getActiveStore()!
  - .amountOfItem(item),
  - 0
  - );
  + .amountOfItem(item);
  +
  + if (existingAmount === 0) {
  + // if this would be the first stack, make sure there's room for a stack
  + return openStacks > 0 ? item.maxStackSize : 0;
  + } else {
  + // return how much can be added to the existing stack
  + return Math.max(item.maxStackSize - existingAmount, 0);
  + }
  }
  // If there's some already there, we can add enough to fill a stack. Otherwise
  @@ -158,7 +162,10 @@ const StoreProto = {
  .filter((item) => item.canBeInLoadout())
  // tslint:disable-next-line:no-unnecessary-callback-wrapper
  .map((item) => copy(item));
  - return newLoadout(name, _.groupBy(allItems, (i) => i.type.toLowerCase()));
  + return newLoadout(
  + name,
  + _.groupBy(allItems, (i) => i.type.toLowerCase())
  + );
  },
  isDestiny1(this: D2Store) {
  