Skip to Content
The Alchemy Project

src/shop/shop_sell.c

Selling: choosing a party member, the item grid and the sale. More…

Included by shop.c.

Macros

NameDescription
#definePRICE_WINDOW_X BY_LANGUAGE(16, 15, 14, 15, 14, 15)The price window and the item details window are sized to their text.
#definePRICE_WINDOW_WIDTH BY_LANGUAGE(14, 15, 16, 15, 16, 15)
#defineDETAILS_WINDOW_WIDTH BY_LANGUAGE(13, 16, 18, 18, 18, 18)
#defineSHOP_EMPTY_GRID_X ITALIAN_OR(20, 8)Where the item grid writes MsgNoItems for a party member with no items, in pixels.
#defineSHOP_EMPTY_GRID_Y ITALIAN_OR(12, 20)

Functions

NameDescription
Sint32mnShopChooseMember (void)Lets the player choose whose items to sell, repair or forge, by shop->action, until B or, at the forge, an item is taken.
Sint32mnShopSelectSell (Sint32 unitId)Lets the player choose items to sell, repair or forge from the party member's grid, one at a time, with each one's price and description, until B or the inventory is empty.
voidmnShopDrawMemberItems (WINDOW *window, Sint32 unitId)Draws the party member's items as icons in rows of five, or a line saying it has none.
Sint32mnShopSelectSellCount (Sint32 unitId, Sint32 slot)Asks how many of a stack to sell, when the party member holds more than one, and returns the count, -1 when cancelled; 1 otherwise.
voidmnShopSellItem (Sint32 unitId, Sint32 slot, Sint32 count)Sells count of the item in slot once the player accepts the shopkeeper's offer, worded for a broken item, for several or for a rare one.

Description

Selling: choosing a party member, the item grid and the sale. Part of shop.c.

Macros in detail

PRICE_WINDOW_X

#define PRICE_WINDOW_X BY_LANGUAGE(16, 15, 14, 15, 14, 15)

The price window and the item details window are sized to their text.

Referenced by mnShopSelectSell().

Definition at line 96 of file shop_sell.c.

PRICE_WINDOW_WIDTH

#define PRICE_WINDOW_WIDTH BY_LANGUAGE(14, 15, 16, 15, 16, 15)

Referenced by mnShopSelectSell().

Definition at line 97 of file shop_sell.c.

DETAILS_WINDOW_WIDTH

#define DETAILS_WINDOW_WIDTH BY_LANGUAGE(13, 16, 18, 18, 18, 18)

Referenced by mnShopSelectSell().

Definition at line 98 of file shop_sell.c.

SHOP_EMPTY_GRID_X

#define SHOP_EMPTY_GRID_X ITALIAN_OR(20, 8)

Where the item grid writes MsgNoItems for a party member with no items, in pixels.

Referenced by mnShopDrawMemberItems().

Definition at line 274 of file shop_sell.c.

SHOP_EMPTY_GRID_Y

#define SHOP_EMPTY_GRID_Y ITALIAN_OR(12, 20)

Referenced by mnShopDrawMemberItems().

Definition at line 275 of file shop_sell.c.

Functions in detail

mnShopChooseMember

Sint32 mnShopChooseMember(void)

Lets the player choose whose items to sell, repair or forge, by shop->action, until B or, at the forge, an item is taken.

References gmInventoryCountStub(), mnCreatePartyFiguresStub(), mnCursorPlace(), mnForgeSelectItem(), mnGridMoveCursor(), mnItemIconGridSetVisible(), mnReleasePartyFiguresStub(), mnShopDrawMemberItems(), mnShopDrawMoney(), mnShopDrawParty(), mnShopSelectRepair(), mnShopSelectSell(), mnShowPartyFiguresStub(), mnWindowCloseStub(), mnWindowCreateStub(), mnWindowSpritePrepareForRedrawStub(), PerWork, result, Sint32, sySoundPlayStub() and sySynch().

Referenced by mnForgeChooseMember(), mnShopRun() and mnShopRunRepairMemberChoice().

Definition at line 5 of file shop_sell.c.

mnShopSelectSell

Sint32 mnShopSelectSell(Sint32 unitId)

Lets the player choose items to sell, repair or forge from the party member's grid, one at a time, with each one's price and description, until B or the inventory is empty. Returns -1 when cancelled, 0 when the inventory ran out or, at the forge, an item was taken.

References gmInventoryCountStub(), gmUnitGet(), mnCursorPlace(), mnForgeGetItemCondition(), mnForgeOfferItem(), mnItemMenuDrawItemDetailsStub(), mnShopDrawItemPrice(), mnShopDrawMemberItems(), mnShopDrawMessage(), mnShopDrawMoney(), mnShopRepairItem(), mnShopRepairPrice(), mnShopSalePrice(), mnShopSelectSellCount(), mnShopSellItem(), mnShopShowKeeperMessage(), mnWindowCloseStub(), mnWindowCreateStub(), mnWindowSpritePrepareForRedrawStub(), PerWork, result, Sint32, sySoundPlayStub() and sySynch().

Referenced by mnForgeSelectItem(), mnShopChooseMember() and mnShopSelectRepair().

Definition at line 104 of file shop_sell.c.

mnShopDrawMemberItems

void mnShopDrawMemberItems(WINDOW *window, Sint32 unitId)

Draws the party member's items as icons in rows of five, or a line saying it has none.

References gmInventoryCountStub(), mnItemIconGridShowInventory(), mnTextDrawMessageStub(), mnWindowSpritePrepareForRedrawStub() and Sint32.

Referenced by mnForgeOfferItem(), mnItemPickerRun(), mnItemPickerSelectItem(), mnShopChooseMember(), mnShopConfirmEquip(), mnShopRepairItem(), mnShopSelectSell() and mnShopSellItem().

Definition at line 279 of file shop_sell.c.

mnShopSelectSellCount

Sint32 mnShopSelectSellCount(Sint32 unitId, Sint32 slot)

Asks how many of a stack to sell, when the party member holds more than one, and returns the count, -1 when cancelled; 1 otherwise.

References gmInventoryGetQuantityStub(), gmItemGetDefinitionStub(), gmUnitGet(), mnCursorPlace(), mnIconShowStub(), mnShopSalePrice(), mnShopSelectQuantity(), mnShopShowKeeperMessage(), result, Sint32 and sySynch().

Referenced by mnShopSelectSell().

Definition at line 298 of file shop_sell.c.

mnShopSellItem

void mnShopSellItem(Sint32 unitId, Sint32 slot, Sint32 count)

Sells count of the item in slot once the player accepts the shopkeeper's offer, worded for a broken item, for several or for a rare one. A count of -1 is the offer for the equipment a purchase replaced, and sells one. The shop refuses an item it pays nothing for and one its wearer cannot take off.

References gmInventoryDiscardStub(), gmItemGetDefinitionStub(), gmPartyAdjustCoinsStub(), gmUnitCalculateStub(), gmUnitGet(), gmUnitRefreshPsynergyStub(), mnMessageArgumentPushStub(), mnShopAskYesNo(), mnShopDrawMemberItems(), mnShopDrawMoney(), mnShopSalePrice(), mnShopShowKeeperMessageHidingCursor(), Sint32 and sySoundPlayStub().

Referenced by mnShopSelectSell() and mnShopSellOld().

Definition at line 337 of file shop_sell.c.