diff --git a/adventure/adventure.py b/adventure/adventure.py index a36161c3..f92f7478 100755 --- a/adventure/adventure.py +++ b/adventure/adventure.py @@ -2301,6 +2301,8 @@ async def _add_rewards(self, ctx: commands.Context, user, exp, cp, special): rebirth_emoji = self.emojis.rebirth if lvl_end >= c.maxlevel: rebirthextra = _("{} You can now rebirth {}").format(rebirth_emoji, user.mention) + if c.static_last_known_currency is None: + c.static_last_known_currency = c.bal if lvl_start < lvl_end: # recalculate free skillpoint pool based on new level and already spent points. c.lvl = lvl_end diff --git a/adventure/charsheet.py b/adventure/charsheet.py index 5eac2df9..a46298c9 100644 --- a/adventure/charsheet.py +++ b/adventure/charsheet.py @@ -301,6 +301,7 @@ def __init__(self, **kwargs): self.rebirths = kwargs.pop("rebirths", 0) self.last_known_currency = kwargs.get("last_known_currency") self.last_currency_check = kwargs.get("last_currency_check") + self.static_last_known_currency = kwargs.get("static_last_known_currency") self.gear_set_bonus = {} self.get_set_bonus() self.maxlevel = self.get_max_level() @@ -1392,6 +1393,7 @@ async def from_json( hero_data[k] = v hero_data["last_skill_reset"] = data.get("last_skill_reset", 0) hero_data["last_known_currency"] = data.get("last_known_currency", 0) + hero_data["static_last_known_currency"] = data.get("static_last_known_currency") hero_data["last_currency_check"] = data.get("last_currency_check", 0) return cls(**hero_data, ctx=ctx, daily_bonus_mapping=daily_bonus_mapping) @@ -1459,6 +1461,7 @@ async def to_json(self, ctx: commands.Context, config: Config) -> dict: "set_items": self.set_items, "last_skill_reset": self.last_skill_reset, "last_known_currency": self.last_known_currency, + "static_last_known_currency": self.static_last_known_currency, } async def rebirth(self, dev_val: int = None) -> dict: @@ -1542,6 +1545,7 @@ async def rebirth(self, dev_val: int = None) -> dict: "rebirths": self.rebirths, "set_items": self.set_items, "last_known_currency": 0, + "static_last_known_currency": None, "last_currency_check": 0, } diff --git a/adventure/defaults.py b/adventure/defaults.py index dfbb8dc7..9dd771eb 100644 --- a/adventure/defaults.py +++ b/adventure/defaults.py @@ -7,6 +7,7 @@ "last_skill_reset": 0, "last_known_currency": 0, "last_currency_check": 0, + "static_last_known_currency": None, "treasure": [0, 0, 0, 0, 0, 0], "items": { "head": {}, diff --git a/adventure/negaverse.py b/adventure/negaverse.py index a41786e5..38ac66b8 100644 --- a/adventure/negaverse.py +++ b/adventure/negaverse.py @@ -361,6 +361,5 @@ async def _negaverse( current_loses_value = character.nega.get("loses", 0) character.nega.update({"loses": current_loses_value + 1}) changed = True - if changed: await self.config.user(ctx.author).set(await character.to_json(ctx, self.config)) diff --git a/adventure/rebirth.py b/adventure/rebirth.py index 3512dc3a..7ff5f2ef 100644 --- a/adventure/rebirth.py +++ b/adventure/rebirth.py @@ -46,7 +46,16 @@ async def rebirth(self, ctx: commands.Context): rebirthcost = 1000 * c.rebirths current_balance = c.bal last_known_currency = c.last_known_currency - if last_known_currency and current_balance / last_known_currency < 0.25: + if ( + c.static_last_known_currency is None + and last_known_currency + and (current_balance / last_known_currency) < 0.5 + ) or (c.static_last_known_currency is not None and (current_balance / c.static_last_known_currency) < 0.5): + if c.static_last_known_currency is None: + c.static_last_known_currency = last_known_currency + await self.config.user(ctx.author).set(await c.to_json(ctx, self.config)) + if c.static_last_known_currency is not None: + last_known_currency = c.static_last_known_currency currency_name = await bank.get_currency_name( ctx.guild, )