Skip to content

Commit

Permalink
fix(inventory,stockpile): can no longer oversell [which forces quick …
Browse files Browse the repository at this point in the history
…sell]
  • Loading branch information
seiyria committed Mar 28, 2023
1 parent bdd2f40 commit 76d41f5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/app/pages/character/inventory/inventory.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { CharSelectState, CombatState } from '../../../../stores';
import { OOCEatFood } from '../../../../stores/combat/combat.actions';
import { QuickSellItemFromInventory, SellItem, SendToStockpile } from '../../../../stores/mercantile/mercantile.actions';
import { setDiscordStatus } from '../../../helpers/electron';
import { maxShopCounterSize } from '../../../../stores/mercantile/mercantile.functions';
import { NotifyWarning } from '../../../../stores/game/game.actions';

@Component({
selector: 'app-inventory',
Expand Down Expand Up @@ -79,6 +81,13 @@ export class InventoryPage implements OnInit, OnDestroy {
}

sell(item: IGameItem) {
const state = this.store.snapshot().mercantile;
const maxSize = maxShopCounterSize(state.shop.saleCounterLevel);
if(state.shop.forSale.length >= maxSize) {
this.store.dispatch(new NotifyWarning('You cannot sell any more items at this time!'));
return;
}

this.store.dispatch(new SellItem(item));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import {
QuickSellAllFromStockpile, QuickSellItemFromStockpile,
SellItem, SendToInventory, UpgradeStockpileSize
} from '../../../../../../stores/mercantile/mercantile.actions';
import { maxStockpileLevel, maxStockpileSizeUpgradeCost } from '../../../../../../stores/mercantile/mercantile.functions';
import { maxShopCounterSize, maxStockpileLevel, maxStockpileSizeUpgradeCost } from '../../../../../../stores/mercantile/mercantile.functions';
import { NotifyWarning } from '../../../../../../stores/game/game.actions';

@Component({
selector: 'app-stockpile',
Expand Down Expand Up @@ -95,6 +96,13 @@ export class StockpilePage implements OnInit, OnDestroy {
}

sell(item: IGameItem) {
const state = this.store.snapshot().mercantile;
const maxSize = maxShopCounterSize(state.shop.saleCounterLevel);
if(state.shop.forSale.length >= maxSize) {
this.store.dispatch(new NotifyWarning('You cannot sell any more items at this time!'));
return;
}

this.store.dispatch(new SellItem(item));
}

Expand Down

0 comments on commit 76d41f5

Please sign in to comment.