use new calc_total_wealth()
@@ -6,7 +6,7 @@ import random
import arrow
import math
-from util.misc import lb_logic, cmds_lb, format_required, make_health_bar
+from util.misc import lb_logic, cmds_lb, format_required, make_health_bar, calc_total_wealth
class Econ(commands.Cog):
@@ -104,11 +104,7 @@ class Econ(commands.Cog):
db_user = await self.db.fetch_user(user.id)
u_items = await self.db.fetch_items(user.id)
- total_wealth = (
- db_user["emeralds"]
- + db_user.get("vault_bal", 0) * 9
- + sum([u_it["sell_price"] * u_it.get("amount", 0) for u_it in u_items if u_it["sell_price"] > 0])
- )
+ total_wealth = calc_total_wealth(db_user, u_items)
health_bar = make_health_bar(
db_user["health"], 20, self.d.emojis.heart_full, self.d.emojis.heart_half, self.d.emojis.heart_empty
)
@@ -160,11 +156,7 @@ class Econ(commands.Cog):
vault_bal = db_user["vault_bal"]
- total_wealth = (
- db_user["emeralds"]
- + ((0 if vault_bal is None else vault_bal) * 9)
- + sum([u_it["sell_price"] * u_it["amount"] for u_it in u_items if u_it["sell_price"] > 0])
- )
+ total_wealth = calc_total_wealth(db_user, u_items)
embed = discord.Embed(color=self.d.cc)
embed.set_author(name=ctx.l.econ.bal.s_emeralds.format(user.display_name), icon_url=user.avatar_url_as())
