From 6df5dccd981adf08c6ab670ca7cd20954793568a Mon Sep 17 00:00:00 2001 From: dzp Date: Sun, 19 Nov 2023 10:32:26 +0800 Subject: [PATCH] =?UTF-8?q?feat(pkuxkx):=20=E4=B8=BA=20char=20=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E5=A2=9E=E5=8A=A0=203=20=E4=B8=AA=20API=EF=BC=9Achar.?= =?UTF-8?q?IsBusy/IsIdle/InCombat?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 另外,增加 char[HP][气血健康度] 和 char[HP][精神健康度] 两个值 --- mud/pkuxkx/plugins/basic/char/gmcp.tin | 7 ++ mud/pkuxkx/plugins/basic/char/hp.tin | 120 ++++++++++++++++--------- 2 files changed, 87 insertions(+), 40 deletions(-) diff --git a/mud/pkuxkx/plugins/basic/char/gmcp.tin b/mud/pkuxkx/plugins/basic/char/gmcp.tin index 53bedcc2..2d46d17f 100644 --- a/mud/pkuxkx/plugins/basic/char/gmcp.tin +++ b/mud/pkuxkx/plugins/basic/char/gmcp.tin @@ -120,6 +120,13 @@ event.Define {char/nofight} {无参} {$MODULE} {角色脱离战斗}; #math char[HP][$pctName] { $char[HP][$name] * 100 / $char[HP][$maxName] }; }; + #if { "$name" == "当前气血" } { + #math char[HP][气血健康度] { $gGMCP[Status][有效气血] * 100 / $char[HP][最大气血] }; + }; + #elseif { "$name" == "当前精神" } { + #math char[HP][精神健康度] { $gGMCP[Status][有效精神] * 100 / $char[HP][最大精神] }; + }; + #continue; }; #else { diff --git a/mud/pkuxkx/plugins/basic/char/hp.tin b/mud/pkuxkx/plugins/basic/char/hp.tin index 73625bbf..8cd0c5f4 100644 --- a/mud/pkuxkx/plugins/basic/char/hp.tin +++ b/mud/pkuxkx/plugins/basic/char/hp.tin @@ -23,39 +23,41 @@ event.Define {char/hpbrief} {无参} {$MODULE} {已经获取到 hpbrief 命令 #func {basic_char_hp.Init} { #class data/basic/char open; - #var char[HP] {}; - #var char[HP][经验] {1}; - #var char[HP][经验显示] {1}; - #var char[HP][潜能] {1}; - #var char[HP][潜能显示] {1}; - #var char[HP][当前内力] {0}; - #var char[HP][最大内力] {1}; - #var char[HP][加力] {0}; - #var char[HP][内力百分比] {0}; - #var char[HP][当前精力] {0}; - #var char[HP][最大精力] {1}; - #var char[HP][精力百分比] {0}; - #var char[HP][当前气血] {0}; - #var char[HP][有效气血] {1}; - #var char[HP][最大气血] {1}; - #var char[HP][气血百分比] {0}; - #var char[HP][当前精神] {0}; - #var char[HP][有效精神] {1}; - #var char[HP][最大精神] {1}; - #var char[HP][精神百分比] {0}; - #var char[HP][当前真气] {0}; - #var char[HP][最大真气] {1}; - #var char[HP][真气减伤] {0}; - #var char[HP][真元] {0}; - #var char[HP][食物] {0}; - #var char[HP][最大食物] {1}; - #var char[HP][饥饿] {}; - #var char[HP][饮水] {0}; - #var char[HP][最大饮水] {1}; - #var char[HP][口渴] {}; - #var char[HP][气势] {0}; - #var char[HP][状态] {}; - #var char[HP][毒] {}; + #var char[HP] {}; + #var char[HP][经验] {1}; + #var char[HP][经验显示] {1}; + #var char[HP][潜能] {1}; + #var char[HP][潜能显示] {1}; + #var char[HP][当前内力] {0}; + #var char[HP][最大内力] {1}; + #var char[HP][加力] {0}; + #var char[HP][内力百分比] {0}; + #var char[HP][当前精力] {0}; + #var char[HP][最大精力] {1}; + #var char[HP][精力百分比] {0}; + #var char[HP][当前气血] {0}; + #var char[HP][有效气血] {1}; + #var char[HP][最大气血] {1}; + #var char[HP][气血百分比] {0}; + #var char[HP][气血健康度] {0}; + #var char[HP][当前精神] {0}; + #var char[HP][有效精神] {1}; + #var char[HP][最大精神] {1}; + #var char[HP][精神百分比] {0}; + #var char[HP][精神健康度] {0}; + #var char[HP][当前真气] {0}; + #var char[HP][最大真气] {1}; + #var char[HP][真气减伤] {0}; + #var char[HP][真元] {0}; + #var char[HP][食物] {0}; + #var char[HP][最大食物] {1}; + #var char[HP][饥饿] {}; + #var char[HP][饮水] {0}; + #var char[HP][最大饮水] {1}; + #var char[HP][口渴] {}; + #var char[HP][气势] {0}; + #var char[HP][状态] {}; + #var char[HP][毒] {}; #class data/basic/char close; set hpbrief long,report; @@ -142,8 +144,10 @@ hp 有两种格式,非战斗状态: #action {^╰─────────────{(─)*}%S────╯{|ID=char.hp}$} { #math char[HP][气血百分比] { $char[HP][当前气血] * 100 / $char[HP][最大气血] }; #math char[HP][精神百分比] { $char[HP][当前精神] * 100 / $char[HP][最大精神] }; - #math char[HP][内力百分比] { $char[HP][当前内力] * 50 / $char[HP][最大内力] }; - #math char[HP][精力百分比] { $char[HP][当前精力] * 50 / $char[HP][最大精力] }; + #math char[HP][内力百分比] { $char[HP][当前内力] * 50 / $char[HP][最大内力] }; + #math char[HP][精力百分比] { $char[HP][当前精力] * 50 / $char[HP][最大精力] }; + #math char[HP][气血健康度] { $char[HP][有效气血] * 100 / $char[HP][最大气血] }; + #math char[HP][精神健康度] { $char[HP][有效精神] * 100 / $char[HP][最大精神] }; event.Emit char/hp; char.hp.parse.done; }; @@ -390,9 +394,6 @@ hp -neili 格式: #local 每秒精力变化 {}; }; - #local {气血健康度} {@math.Int{@math.Eval{$char[HP][有效气血] * 100 / $char[HP][最大气血]}}}; - #local {精神健康度} {@math.Int{@math.Eval{$char[HP][有效精神] * 100 / $char[HP][最大精神]}}}; - #nop 气血恢复的数值展示为每分钟可以恢复的最大血量的倍数(以百分比形式); #local {气血恢复} {@math.Int{@math.Eval{$char[STATUS][气血恢复] * 100 * 60 / $char[HP][最大气血]}}}; @@ -402,7 +403,7 @@ hp -neili 格式: #local summarize {}; #if { "$char[HP][战斗中]" == "true" } { #format summarize {<099>$color〔HP摘要〕<298>气血: %s%s/%s 内力: %s%s 回气: %s/%s 精神: %s%s/%s 食水: %s/%s$combat<099>} - {@__char_hp_colorit__{$char[HP][气血百分比]}} {${每秒气血变化}} {@__char_hp_colorit__{${气血健康度}}} + {@__char_hp_colorit__{$char[HP][气血百分比]}} {${每秒气血变化}} {@__char_hp_colorit__{$char[HP][气血健康度]}} {@__char_hp_colorit__{$char[HP][内力百分比]}} {${每秒内力变化}} {@__char_hp_colorit__{${气血恢复}}} {@__char_hp_colorit__{${气血治疗}}} {@__char_hp_colorit__{$char[HP][精神百分比]}} {${每秒精神变化}} {@__char_hp_colorit__{${精神健康度}}} @@ -411,7 +412,7 @@ hp -neili 格式: #else { #local jingli {@if{$chat[HP][精力百分比] < 30;{@__char_hp_colorit__{$char[HP][精力百分比]} ${每秒精力变化}}}}; #format summarize {<099>$color〔HP摘要〕<298>气血: %s%s/%s 内力: %s%s 回气: %s/%s 精神: %s%s/%s $jingli食水: %s/%s(%s/%s)$combat<099>} - {@__char_hp_colorit__{$char[HP][气血百分比]}} {${每秒气血变化}} {@__char_hp_colorit__{${气血健康度}}} + {@__char_hp_colorit__{$char[HP][气血百分比]}} {${每秒气血变化}} {@__char_hp_colorit__{$char[HP][气血健康度]}} {@__char_hp_colorit__{$char[HP][内力百分比]}} {${每秒内力变化}} {@__char_hp_colorit__{${气血恢复}}} {@__char_hp_colorit__{${气血治疗}}} {@__char_hp_colorit__{$char[HP][精神百分比]}} {${每秒精神变化}} {@__char_hp_colorit__{${精神健康度}}} @@ -480,3 +481,42 @@ hp -neili 格式: xtt.Send hp %0; }; }; + +///=== { +// #@ char.IsBusy +// 如果角色正忙,则返回真,否则返回假。无参数。 +// }; +#func {char.IsBusy} { + #if { "$char[HP][忙]" == "true" } { + #return 1; + }; + #else { + #return 0; + }; +}; + +///=== { +// #@ char.IsIdle +// 如果角色不忙,则返回真,否则返回假。无参数。 +// }; +#func {char.IsIdle} { + #if { "$char[HP][忙]" == "false" } { + #return 1; + }; + #else { + #return 0; + }; +}; + +///=== { +// #@ char.InCombat +// 如果角色正处于战斗中,则返回真,否则返回假。无参数。 +// }; +#func {char.IsIdle} { + #if { "$char[HP][战斗中]" == "true" } { + #return 1; + }; + #else { + #return 0; + }; +};