Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shop Balance Feature Implemented #84

Merged
merged 9 commits into from
Feb 21, 2024
Merged

Conversation

Sonny-Cao
Copy link
Contributor

text - New function to display shopkeeper balance, modified STR_THIS_ITEM_CANT_BE_SOLD to better fit context
shop - Added new variable shop_balance; initialized to 500 for testing, buy and sell functions adjusted to update vendor amount
menu_creator_manager - create_shop_menu updated to show vendor gold in UI
load xml, load tmx, level_scene - added shop_balance parameter to constructors

Additional Notes: Shop balance does not show on sell interface. Shop balance value is not updated when saved, may be due to the fact that they were set to 500 in the constructor. The load xml, load tmx, and level_scene files need to be reviewed for confirmation. The basic functionality is there, but tweaks still need to be made.

Excuse the previous PR, there was an uninitialized variable within level_scene that prevented main new game button the function, it is now fixed.

…ITEM_CANT_BE_SOLD to better fit context

shop - Added new variable shop_balance; initialized to 500 for testing, buy and sell functions adjusted to update vendor amount
menu_creator_manager - create_shop_menu updated to show vendor gold in UI
load xml, load tmx, level_scene - added shop_balance parameter to constructors

Additional Notes: Shop balance does not show on sell interface. Shop balance value is not updated when saved, may be due to the fact that they were set to 500 in the constructor. The load xml, load tmx, and level_scene files need to be reviewed for confirmation. The basic functionality is there, but tweaks still need to be made.
…TR_THIS_ITEM_CANT_BE_SOLD to better fit context"

This reverts commit d6d7c79.
…dified STR_THIS_ITEM_CANT_BE_SOLD to better fit context""

This reverts commit 694a3cf.
…ITEM_CANT_BE_SOLD to better fit context

shop - Added new variable shop_balance; initialized to 500 for testing, buy and sell functions adjusted to update vendor amount
menu_creator_manager - create_shop_menu updated to show vendor gold in UI
load xml, load tmx, level_scene - added shop_balance parameter to constructors

Additional Notes: Shop balance does not show on sell interface. Shop balance value is not updated when saved, may be due to the fact that they were set to 500 in the constructor. The load xml, load tmx, and level_scene files need to be reviewed for confirmation. The basic functionality is there, but tweaks still need to be made.
data/en/text.py Outdated Show resolved Hide resolved
data/en/text.py Outdated Show resolved Hide resolved
src/game_entities/shop.py Outdated Show resolved Hide resolved
src/game_entities/shop.py Outdated Show resolved Hide resolved
src/services/load_from_xml_manager.py Outdated Show resolved Hide resolved
@Grimmys
Copy link
Owner

Grimmys commented Feb 11, 2024

Great PR overall, only a few details should be addressed 👍

Suggestion for later improvement: speech from shopkeeper in case of item that cannot be sold should differ depending on the reason of the failure ; it's incoherent for the shopkeeper to yell at the player that item cannot be sold because of insufficient funds while the real reason might be that the item is a key item that the player should not abandon.
But don't worry, it doesn't have to be handle in the scope of this PR.

text.py - f_shop_gold deleted 1 line to replicate 2 lines of space between functions,
str_this_item_can't_be_sold space before '!' removed
shop.py - self.shop_balance = 500 -> self.shop_balance = shop_balance, parameter
shop_balance changed to self.shop_balance
load_from_xml_manager.py - shop_balance=None -> shop_balance=500 in load_building_from_save function
Copy link
Owner

@Grimmys Grimmys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good now, thanks for your first contribution!

@Grimmys
Copy link
Owner

Grimmys commented Feb 18, 2024

Huh huh, looks like a test is failing.
@Sonny-Cao could you try to fix it? It's just about providing a default value for the shop balance.

Test is tests.test_shop.TestShop.test_init_shop

@Sonny-Cao
Copy link
Contributor Author

Yes, I will look into it when I get the chance.

@Grimmys Grimmys merged commit ecc0238 into Grimmys:master Feb 21, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants