feat(赛马插件): 调整参与奖励并优化赛马显示对齐
- 将参与奖励从50点降低到20点以平衡经济系统 - 为所有马主添加参与奖励计算和发放逻辑 - 优化赛况显示中的马名对齐,支持中文字符宽度计算
This commit is contained in:
@@ -146,6 +146,10 @@ def _describe_points_delta(delta: int) -> str:
|
||||
def _build_point_changes(room: Room, odds: dict[str, float]) -> tuple[dict[str, int], dict[str, str]]:
|
||||
point_changes: dict[str, int] = {}
|
||||
|
||||
# Participation reward for all horse owners
|
||||
for horse in room.horses.values():
|
||||
point_changes[horse.owner_id] = point_changes.get(horse.owner_id, 0) + config.PARTICIPANT_REWARD
|
||||
|
||||
for bet in room.bets:
|
||||
point_changes[bet.user_id] = point_changes.get(bet.user_id, 0) - bet.amount
|
||||
|
||||
@@ -202,6 +206,10 @@ async def settle_race(room: Room) -> RaceResult | None:
|
||||
if not champion:
|
||||
return None
|
||||
|
||||
# Reward all participants
|
||||
for horse in room.horses.values():
|
||||
await points_service.reward_participant(horse.owner_id)
|
||||
|
||||
# Reward champion owner
|
||||
await points_service.reward_champion(champion.owner_id)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user