收益增长,等级越高,收益越高

This commit is contained in:
liuwei
2025-11-24 10:34:38 +08:00
parent ea71fc0931
commit 20f82944f5

View File

@@ -774,7 +774,8 @@ class XiuxianPlugin(MessagePluginInterface):
now = datetime.now(timezone.utc)
duration_hours = (now - start).total_seconds() / 3600.0
duration_hours = max(0.0, min(duration_hours, float(self.max_cultivate_hours)))
rate = self.base_rate_per_hour * float(player.get("spirit_root_mult", 1.0))
mult = self._yield_multiplier(player.get("realm", "炼气1层"))
rate = self.base_rate_per_hour * float(player.get("spirit_root_mult", 1.0)) * mult
gain = int(duration_hours * rate)
player["cultivation_points"] = int(player.get("cultivation_points", 0)) + gain
player["status"] = "Unstable_Qi"
@@ -812,9 +813,10 @@ class XiuxianPlugin(MessagePluginInterface):
# self.revoke.add_message_to_revoke((roomid if roomid else sender), client_msg_id, create_time, new_msg_id, 5)
return False, "灵石不足"
player["spirit_stone"] = stones - qty
base_gain = qty * 10
bonus = float(player.get("gather_bonus", 0.0))
gain = int(base_gain * (1.0 + bonus))
base_gain = qty * 10
mult = self._yield_multiplier(player.get("realm", "炼气1层"))
gain = int(base_gain * (1.0 + bonus) * mult)
player["cultivation_points"] = int(player.get("cultivation_points", 0)) + gain
if bonus > 0:
player["gather_bonus"] = 0.0
@@ -909,6 +911,13 @@ class XiuxianPlugin(MessagePluginInterface):
base = self.realm_score_map.get(prefix, 0)
return base + (layer or 0)
def _yield_multiplier(self, realm: str) -> float:
prefix, layer = self._parse_realm(realm)
rs = self.realm_score_map.get(prefix, 0)
realm_mult = 1.0 + (float(rs) / 100.0)
layer_bonus = 1.0 + (max(0, (layer or 1) - 1) * 0.02)
return realm_mult * layer_bonus
def _set_realm(self, user_id: str, player: Dict[str, Any], new_realm: str):
player["realm"] = new_realm
if self.xdb:
@@ -1099,7 +1108,7 @@ class XiuxianPlugin(MessagePluginInterface):
player = self._get_player(sender, roomid or "")
if not player:
return False, "未注册"
if self.redis_db.check_rate_limited(sender, "__global__", cmd):
if self.redis_db.check_rate_limited(sender, "__global__", "出门历练"):
client_msg_id, create_time, new_msg_id = await bot.send_text_message((roomid if roomid else sender), "⚠️ 历练冷却中,请稍候再试", sender)
if self.revoke:
self.revoke.add_message_to_revoke((roomid if roomid else sender), client_msg_id, create_time, new_msg_id, 5)