release: v1.0.3
一键跑图:自选区域推到终点;设置里可关「给」的弹图与音效
This commit is contained in:
1 parent
874fe81039
commit
c0b9a10ae9
8 files changed
+2502
-28
No files matched your search
@@ -736,6 +736,12 @@ class PlayData:
|
||||
default_factory=lambda: config.PLAY_MUSIC_PLAY_COUNT_GAIN)
|
||||
map_distance_gain: int = field(default_factory=lambda: config.PLAY_MAP_DISTANCE_GAIN)
|
||||
character_exp_gain: int = field(default_factory=lambda: config.PLAY_CHARACTER_EXP_GAIN)
|
||||
#: ★ 目标地图:0 = 不切换(沿用服务器下发的 selectMapId,只推进当前选中的那张)。
|
||||
#: 非 0 = 先把 userData.selectMapId 切到该 mapId,再把 distance 加在它身上。
|
||||
#: 注意:服务端是否接受客户端改 selectMapId 尚未在真机验证 —— 真机样本里
|
||||
#: selectMapId 只出现在 Get 侧,Upsert 侧从没被改过。若服务端忽略该字段,
|
||||
#: 推进仍会落在「服务器当前选中的地图」上,而不是这里指定的那张。
|
||||
select_map_id: int = 0
|
||||
|
||||
# ---- 里程 / 登录奖励 ----
|
||||
# ★ 这两个是**登录奖励发放**才产生的,普通游玩结算不回传(留空)。
|
||||
@@ -1757,6 +1763,11 @@ def apply_play_effects(
|
||||
ud["dateTime"] = int(auth_date_time)
|
||||
if ud.get("banState") is None:
|
||||
ud["banState"] = 0
|
||||
# ★ 切区域:只有显式给了目标 mapId 才写入;否则保持服务器下发的 selectMapId。
|
||||
# 放在这里(而不是差分段)是为了让下面 userMapList 能读到"切换后"的值。
|
||||
_want_map = int(getattr(play, "select_map_id", 0) or 0)
|
||||
if _want_map:
|
||||
ud["selectMapId"] = _want_map
|
||||
|
||||
# ---------------- userExtend ----------------
|
||||
ext_list = user_all.get("userExtend") or []
|
||||
@@ -1824,17 +1835,31 @@ def apply_play_effects(
|
||||
if "userMapList" in user_all:
|
||||
if play.map_distance_gain:
|
||||
baseline = user_all.get("_baseline_map") or []
|
||||
map_id = None
|
||||
ud = (user_all.get("userData") or [{}])[0]
|
||||
if isinstance(ud, dict):
|
||||
map_id = ud.get("selectMapId")
|
||||
want = int(getattr(play, "select_map_id", 0) or 0)
|
||||
map_id = want or (ud.get("selectMapId") if isinstance(ud, dict) else None)
|
||||
target = None
|
||||
for item in baseline:
|
||||
if isinstance(item, dict) and item.get("mapId") == map_id:
|
||||
target = copy.deepcopy(item)
|
||||
break
|
||||
if target is None and baseline and isinstance(baseline[0], dict):
|
||||
target = copy.deepcopy(baseline[0])
|
||||
if target is None:
|
||||
if map_id:
|
||||
# ★ 目标地图不在玩家基线里(没进过这个区域):
|
||||
# 按 GetUserMap 返回的字段形状造一条全新记录,distance 从 0 起算。
|
||||
# 这条会因「新状态有、基线没有」在差分环节被保留,
|
||||
# isNewMapList 自动打 "1"(新增)。
|
||||
target = {
|
||||
"mapId": int(map_id),
|
||||
"distance": 0,
|
||||
"isLock": False,
|
||||
"isClear": False,
|
||||
"isComplete": False,
|
||||
"unlockFlag": 0,
|
||||
}
|
||||
log_info("userMapList:目标地图 " + str(map_id) + " 不在基线中,按新记录构造")
|
||||
elif baseline and isinstance(baseline[0], dict):
|
||||
target = copy.deepcopy(baseline[0])
|
||||
if target is not None:
|
||||
target["distance"] = int(target.get("distance", 0) or 0) + play.map_distance_gain
|
||||
user_all["userMapList"] = [target]
|
||||
|
||||
Reference in new issue
Block a user