稻谷bug修复 提示删除
This commit is contained in:
1 parent
344fad19ac
commit
bd2ebfb154
43 files changed
+700
-846
No files matched your search
+3
-28
@@ -24,7 +24,7 @@ ServerSystem = serverApi.GetServerSystemCls() # 服务端系统基类
|
||||
comp = serverApi.GetEngineCompFactory() # 组件工厂
|
||||
|
||||
from ....BlueFoxTools.SpecialFunciton.BlueFoxSystem import BlueFoxServerSystem
|
||||
from ..ShiyongfoodData import EAT_RULE_MAP, TRY_USE_RULES, EFFECT_CN
|
||||
from ..ShiyongfoodData import EAT_RULE_MAP, TRY_USE_RULES
|
||||
|
||||
|
||||
class ShiyongfoodService(BlueFoxServerSystem):
|
||||
@@ -90,7 +90,6 @@ class ShiyongfoodService(BlueFoxServerSystem):
|
||||
drop = rule.get("drop")
|
||||
if drop:
|
||||
self.dropItem(dim, pos, drop)
|
||||
self._notify(playerId, rule)
|
||||
return True
|
||||
|
||||
# ====================================================================
|
||||
@@ -134,12 +133,11 @@ class ShiyongfoodService(BlueFoxServerSystem):
|
||||
"auxValue": itemDict.get("newAuxValue", 0),
|
||||
"userData": itemDict.get("userData", {})})
|
||||
self._applyFood(playerId, rule.get("hunger", 0), rule.get("effects", []))
|
||||
self._notify(playerId, rule)
|
||||
return True
|
||||
|
||||
# ====================================================================
|
||||
# ============================================================================
|
||||
# 工具: 回复饱食度 + 增益效果
|
||||
# ====================================================================
|
||||
# ============================================================================
|
||||
def _applyFood(self, playerId, hunger, effects):
|
||||
try:
|
||||
# 饱食度【在现有值上累加】(不是覆盖): 当前值 + 回复值, 上限20点
|
||||
@@ -193,29 +191,6 @@ class ShiyongfoodService(BlueFoxServerSystem):
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# ====================================================================
|
||||
# 工具: 食用提示
|
||||
# ====================================================================
|
||||
def _notify(self, playerId, rule):
|
||||
try:
|
||||
hunger = rule.get("hunger", 0)
|
||||
# 用真正的 § 颜色符(与全模组一致), 不要写 "\u00a7" 转义(Py2 字节串不解释该转义, 会原样显示)
|
||||
msg = "§a回复 %d 点饱食度" % hunger
|
||||
effects = rule.get("effects", [])
|
||||
if effects:
|
||||
parts = []
|
||||
for name, dur, lvl in effects:
|
||||
cn = EFFECT_CN.get(name, name)
|
||||
parts.append("%s%s(%d秒)" % (cn, self._roman(lvl), dur))
|
||||
msg += "§a,获得 " + "§e" + "§a".join(parts)
|
||||
comp.CreateMsg(playerId).NotifyOneMessage(playerId, msg)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def _roman(lvl):
|
||||
return {1: "I", 2: "II", 3: "III", 4: "IV", 5: "V"}.get(lvl, "")
|
||||
|
||||
# ====================================================================
|
||||
# 工具: 冷却检查(0.4秒, 防长按右键连吃)
|
||||
# ====================================================================
|
||||
|
||||
Reference in new issue
Block a user