-
Notifications
You must be signed in to change notification settings - Fork 106
Open
Labels
hardLarge-scale improvement which may take longer to fixLarge-scale improvement which may take longer to fixmodulesRelated to creation of a specific module (not core game flow)Related to creation of a specific module (not core game flow)
Description
A player should be able to receive a loan from the Banker. The following is needed:
Player.py
- add the "loan" command to the get_input() function, available only in the Terminals Screen.
- using the command should then send player to modules.py loan_menu() function.
Modules.py
- add loan_menu() function
- this should update the active terminal with a fun Loan interface, similar to the Shop (see the cat?) *note that thematically, the Shopkeeper is not the same as this Banker. Hence why loans are not disbursed through the Shop module.
- Two types of loans should be available: high interest vs low interest. High interest loans allow the player to receive up to $2000, low interest loans allow the player to receive up to $500. Values subject to change during game testing.
- The player can choose one if the choices either using Keyboard module or simple input calls
- The player is then prompted to input a certain amount for the loan, according to the maximums above.
- This Module needs to use networking to send a message to the banker for the loan amount. Similar to how casino Module does so.
If you do everything above uo to (6), I (Adam) will be happy and finish the networking part on my own. Having said that, below are the steps that need to be completed for networking.
Banker.py
- Create a Loan object with the following instance variables:
- term (int)
- principal (int)
- interest_rate (float)
- amount_due (int)
A Loan object should also accept the following parameters for initialization:
- amount (int)
- low_or_high (bool)
- The instance variables should be initialized as follows:
- term: If high interest loan, take current system time, convert to minutes, then add 9 minutes to that time. If low interest loan, add 3 minutes to that time.
- principal: set to amount parameter
- interest_rate: set to 1.025 for high interest, 1.010 for low interest. Subject to change.
- amount_due: set to principal
- Add the following functions to the Loan object:
- get_due()
Returns amount_due - get_deadline()
Returns the term in seconds subtracted by the system current time in seconds. Convert to minutes and seconds. This represents the amount of time before the loan is due and the player defaults. - payoff(amount: int)
Removes amount from amount_due - accrue()
Get difference in time between when the loan was accepted and now, then multiply by interest rate. Add to amount_due. (Potentially set amount_due to principal and go from there, as you'd expect a loan to do)
-
Accept data prefixed by "loan" with "amount" in handle_data. Create a Loan object from above. Add to list of loans, which needs to be stored somewhere which corresponds to the player who owns the loan.
-
Add check_loans() function to banker, on a timer to be checked in some main thread. In check_loans(), the list of loans should be iterated through and adjusted with their accrue() functions. If any loans expire, a notification should be sent to that player and shortly after the amount_due should be deducted from the player.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
hardLarge-scale improvement which may take longer to fixLarge-scale improvement which may take longer to fixmodulesRelated to creation of a specific module (not core game flow)Related to creation of a specific module (not core game flow)