Permalink
Browse files

Fixes #1412

Prices are now displayed in the hint for selling/buying resources
  • Loading branch information...
1 parent 90fb3df commit 8f2e13b87ecdd7af3c3aa9abf4f897862e9b55ce @nihathrael nihathrael committed Mar 23, 2012
Showing with 8 additions and 4 deletions.
  1. +1 −1 content/gui/xml/ingame/tabwidget/warehouse/buysellmenu.xml
  2. +7 −3 horizons/gui/tabs/buyselltab.py
View
2 content/gui/xml/ingame/tabwidget/warehouse/buysellmenu.xml
@@ -11,7 +11,7 @@
<!-- Replaced with the buy/sell boxes. -->
<HBox size="250, 100" position="23,47" name="content" padding="10" />
<Icon image="content/gui/images/background/hr.png" position="20,105" />
- <Label name="hint_label" position="20,120" max_size="220,180" wrap_text="1" />
+ <Label name="hint_label" position="20,120" max_size="230,180" wrap_text="1" />
<Icon image="content/gui/images/background/hr.png" position="20,180" />
View
10 horizons/gui/tabs/buyselltab.py
@@ -31,6 +31,7 @@
from horizons.util import Callback, WorldObject
from horizons.util.gui import load_uh_widget, get_res_icon, create_resource_selection_dialog
from horizons.world.component.tradepostcomponent import TradePostComponent
+from horizons.constants import TRADER
class BuySellTab(TabInterface):
"""
@@ -356,15 +357,18 @@ def _update_hint(self, slot_id):
slot = self.slots[slot_id]
limit = int( slot.findChild(name="slider").value )
action = slot.action
+ price = self.session.db.get_res_value(slot.res)
if action == "buy":
#xgettext:python-format
- hint = _("Will buy {resource_name} whenever less than {limit}t are in stock.")
+ hint = _("Will buy {resource_name} for {price}gold/t whenever less than {limit}t are in stock.")
+ price *= TRADER.PRICE_MODIFIER_SELL
elif action == "sell":
#xgettext:python-format
- hint = _("Will sell {resource_name} whenever more than {limit}t are available.")
+ hint = _("Will sell {resource_name} for {price}gold/t whenever more than {limit}t are available.")
+ price *= TRADER.PRICE_MODIFIER_BUY
hint = hint.format(limit=unicode(limit),
- resource_name=_(self.session.db.get_res_name(slot.res)))
+ resource_name=_(self.session.db.get_res_name(slot.res)), price=price)
self._set_hint( hint )
def _set_hint(self, text):

0 comments on commit 8f2e13b

Please sign in to comment.