物品预备
This commit is contained in:
1 parent
43c1859aad
commit
a0ff1f80d1
297 files changed
+4000
-9
No files matched your search
@@ -232,6 +232,17 @@ try:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# ---- 寿司(手持 饭团/鱼/卷寿司/手握 右键 寿司方块 走 handleBlockUse):
|
||||
# ShousiData.SHOUSI_SWITCHES。
|
||||
# 寿司规则内联在 ShousiService, 未随 *Data.SWITCH_RULES 派生; 若不在此汇入,
|
||||
# 客户端会把"手持饭团/鱼右键寿司方块"当成吃/放置(饭团被吃、鱼放成死鱼),
|
||||
# 转换不触发。加入后命中 BLOCKUSE_CANCEL -> 客户端显式发 BlockUseRequest。
|
||||
try:
|
||||
from ..shousi.ShousiData import SHOUSI_SWITCHES as SHOUSI_RS_BLOCKUSE
|
||||
_BLOCK_USE_TABLES.append(SHOUSI_RS_BLOCKUSE)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# ---- 原版放置/盘子转换 (itemUseOn, surface=相邻放置 / source=盘子) ----
|
||||
try:
|
||||
from ..yuanbanfangzhi.YuanbanData import (
|
||||
|
||||
@@ -124,3 +124,34 @@ CUT_COUNT = 2
|
||||
|
||||
# 手握堆叠/寿司堆 每次消耗手持数
|
||||
STACK_CONSUME = 1
|
||||
|
||||
# ============================================================================
|
||||
# 手持物品右键"寿司方块本体"的转换对(block + item)
|
||||
# 寿司的规则都内联在 ShousiService 里, 不像其它分类写在 *Data 的 SWITCH_RULES,
|
||||
# 客户端拦截白名单无法自动派生 -> 手持饭团/鱼右键寿司方块时会被当成"吃/放置"
|
||||
# (饭团被吃、鱼被放成死鱼), 转换不触发。
|
||||
# 这里按 SUSHI_GROUPS 反向导出一份 (block, item) 表, 供 InterceptData 汇入
|
||||
# BLOCKUSE_CANCEL, 使客户端命中后显式发 BlockUseRequest, 由服务端
|
||||
# ShousiService.handleBlockUse 执行转换。
|
||||
# ============================================================================
|
||||
def _build_shousi_switches():
|
||||
pairs = [{"block": NORI_0, "item": RICE_BALL}] # 基础组: 干海带 + 饭团
|
||||
for g in SUSHI_GROUPS:
|
||||
fish = g.get("fish")
|
||||
roll = g.get("roll")
|
||||
# 手握: 手握普通寿司 + 鱼
|
||||
pairs.append({"block": NIGIRI_BASE, "item": fish})
|
||||
# 手握堆叠: 手持 手握X(一个) 右键 手握X(一/两个)
|
||||
pairs.append({"block": g["nigiri1"], "item": g["nigiri1"]})
|
||||
pairs.append({"block": g["nigiri2"], "item": g["nigiri1"]})
|
||||
if roll:
|
||||
# 加鱼: 干海带(加饭团) + 鱼
|
||||
pairs.append({"block": NORI_1, "item": fish})
|
||||
# 寿司堆: 手持 卷寿司(链尾) 右键 卷寿司/寿司堆(两个)
|
||||
pairs.append({"block": roll[-1], "item": roll[-1]})
|
||||
if g.get("pile2"):
|
||||
pairs.append({"block": g["pile2"], "item": roll[-1]})
|
||||
return pairs
|
||||
|
||||
|
||||
SHOUSI_SWITCHES = _build_shousi_switches()
|
||||
+8
@@ -188,6 +188,14 @@ class ShousiService(BlueFoxServerSystem):
|
||||
recipe = self.findRecipe(blockName, itemDict)
|
||||
if not recipe:
|
||||
return False
|
||||
# ---- 数量校验: 消耗型转换必须手持足量(如 铺饭团需4个), 不足则提示不转换 ----
|
||||
need = recipe.get("consume", 0)
|
||||
if need > 0:
|
||||
have = itemDict.get("count", 0) if itemDict else 0
|
||||
if have < need:
|
||||
comp.CreateMsg(playerId).NotifyOneMessage(
|
||||
playerId, "§c数量不足,需要 %d 个" % need)
|
||||
return True
|
||||
if not self.checkCooldown(key, 0.5):
|
||||
return True
|
||||
self.handleSwitch(recipe, playerId, pos, dim, itemDict)
|
||||
|
||||
Reference in new issue
Block a user