Shop - JayhawkZombie/EECS581Project GitHub Wiki
#Shop
##Abstract The shop is where we buy and sell items. The basic implementation will check to see if the purchase you request is possible(if you have enough money) and on the selling side will check to see if the shop has enough money
##Derived From Nothing
##Dependencies
- Item and derived classes
- Because were selling Items
- Party
- Need to access Party Inventory/gold
##MemberVariables *int m_gold //how much money the shop has *Item[] m_inventory //How much inventory the shop has
##Methods
-
Shop(int which)
- Constructor initializes whatever shop you are looking for- read from file
-
mainMenu()
-
Displays the main menu of the shop
-
- Buy
-
- Sell
-
- Exit
-
-
BuyMenu()
- Checks to see if the shop currently has any inventory -if not displays "Sorry I don't have anything to sell you right now or something like that
- Displays the shops inventory and what you can buy from it
- Handles menu interaction for the buy() functions
- Calls Purchase and PurchaseMultiple when appropriate
-
bool canBuy(Item selected, int quantity)
-
returns true if the player can buy the selected item(s) false else -checks to see if purchase is possible
-
purchase(int index, Party ourParty)
- Calls Canbuy and then processes purchase
- Subtracts from Shops inventory and adds to Party's inventory
-
purchaseMultiple(int index, int quantity, Party ourParty)
- Same as purchase but for more than one item
-
sellMenu()
- works like the buy menu but in reverse - shows the Parties inventory etc
-
bool canSell()
- Checks to see if a sale is possible (if the shop can afford it)
-
sell()
- Works like buy in reverse
-
sellMultiple()
- Works like buyMultiple but in reverse
##Old Version The Old version is very similar to the final version except in the wrong language
##Future Plans
- Limit display by Category (allow option to only show weapons, armor, useables etc
- In the Future we would like to see if we could implement a dynamic economy (basically the less the shop has of an item the more it is worth and vice versa) buying the shop for guarenteed income- to offset the loss of housing/feeding monsters