Release beta 1.1.1 stacked scan boosts
This commit is contained in:
@@ -4,11 +4,11 @@ build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "jwebot-official-extensions"
|
||||
version = "1.1.0b1+1016"
|
||||
version = "1.1.1b1+1016"
|
||||
description = "Reviewed local command adapters and broker implementation for JWeBot"
|
||||
requires-python = ">=3.9"
|
||||
dependencies = [
|
||||
"jwebot-sdk==1.1.0b1+1016",
|
||||
"jwebot-sdk==1.1.1b1+1016",
|
||||
]
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
|
||||
@@ -90,4 +90,4 @@ __all__ = [
|
||||
"render_feature_list",
|
||||
]
|
||||
|
||||
__version__ = "1.1.0b1+1016"
|
||||
__version__ = "1.1.1b1+1016"
|
||||
|
||||
+20
-18
@@ -32,8 +32,10 @@ PRIMOGEM_MORA_VALUE = 3600
|
||||
PRIMOGEM_EVENT_LIMIT = 50
|
||||
PRIMOGEM_EVENT_DISPLAY_LIMIT = 5
|
||||
WISH_HISTORY_LIMIT = 30
|
||||
SCAN_BOOST_USES = 24
|
||||
SCAN_BOOST_WEIGHT = 4
|
||||
SCAN_BOOST_HOURS = 24
|
||||
SCAN_BOOST_SECONDS = SCAN_BOOST_HOURS * 60 * 60
|
||||
SCAN_BOOST_WEIGHT = 5
|
||||
SCAN_BOOST_LIMIT = 200
|
||||
TAFFY_SAY_CREDITS_PER_PRIMOGEM = 2
|
||||
TAFFY_SAY_MAX_CHARS = 160
|
||||
WISH_MORA_TABLE = (
|
||||
@@ -331,31 +333,34 @@ def normalize_player_account(account: dict[str, Any]) -> dict[str, Any]:
|
||||
if not isinstance(boosts, list):
|
||||
boosts = []
|
||||
normalized_boosts = []
|
||||
current_time = time.time()
|
||||
for boost in boosts:
|
||||
if not isinstance(boost, dict):
|
||||
continue
|
||||
target_key = str(boost.get("target_person_key", "")).strip()
|
||||
target_name = str(boost.get("target_display_name", "")).strip()
|
||||
remaining = boost.get("remaining", 0)
|
||||
weight = boost.get("weight", 0)
|
||||
created_at = float(boost.get("created_at", current_time) or current_time)
|
||||
expires_at = boost.get("expires_at")
|
||||
if not isinstance(expires_at, (int, float)):
|
||||
expires_at = created_at + SCAN_BOOST_SECONDS
|
||||
if (
|
||||
target_key
|
||||
and target_name
|
||||
and type(remaining) is int
|
||||
and remaining > 0
|
||||
and type(weight) is int
|
||||
and weight > 0
|
||||
and float(expires_at) > current_time
|
||||
):
|
||||
normalized_boosts.append(
|
||||
{
|
||||
"target_person_key": target_key[:128],
|
||||
"target_display_name": target_name[:120],
|
||||
"remaining": min(remaining, 10_000),
|
||||
"weight": min(weight, 100),
|
||||
"created_at": float(boost.get("created_at", 0) or 0),
|
||||
"weight": min(max(weight, SCAN_BOOST_WEIGHT), 100),
|
||||
"created_at": created_at,
|
||||
"expires_at": float(expires_at),
|
||||
}
|
||||
)
|
||||
account["scan_boosts"] = normalized_boosts[-20:]
|
||||
account["scan_boosts"] = normalized_boosts[-SCAN_BOOST_LIMIT:]
|
||||
return account
|
||||
|
||||
|
||||
@@ -883,24 +888,21 @@ class PlayerGames:
|
||||
f"{player_label}:没有扫码概率券,原石也不足;"
|
||||
f"当前原石 {account['primogems']} 个"
|
||||
)
|
||||
boosts = [
|
||||
item
|
||||
for item in account["scan_boosts"]
|
||||
if item["target_person_key"] != target["person_key"]
|
||||
]
|
||||
now = time.time()
|
||||
boosts = list(account["scan_boosts"])
|
||||
boosts.append(
|
||||
{
|
||||
"target_person_key": str(target["person_key"]),
|
||||
"target_display_name": target_label,
|
||||
"remaining": SCAN_BOOST_USES,
|
||||
"weight": SCAN_BOOST_WEIGHT,
|
||||
"created_at": time.time(),
|
||||
"created_at": now,
|
||||
"expires_at": now + SCAN_BOOST_SECONDS,
|
||||
}
|
||||
)
|
||||
account["scan_boosts"] = boosts[-20:]
|
||||
account["scan_boosts"] = boosts[-SCAN_BOOST_LIMIT:]
|
||||
return (
|
||||
f"{player_label}:已给 {target_label} 增加整点扫码权重;"
|
||||
f"{cost_text};未来 {SCAN_BOOST_USES} 次送达扫码播报中,"
|
||||
f"{cost_text};未来 {SCAN_BOOST_HOURS} 小时内,"
|
||||
f"{target_label} 额外 +{SCAN_BOOST_WEIGHT} 权重"
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user