Skip to content

Commit

Permalink
feat(pkuxkx): 允许通过快捷键禁用 HP 摘要
Browse files Browse the repository at this point in the history
  • Loading branch information
dzpao committed Sep 17, 2024
1 parent f2e677a commit f1b4003
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 5 deletions.
1 change: 1 addition & 0 deletions mud/pkuxkx/etc/ui-settings.extra.tin
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
{{key}{\cog} {meaning}{开启/关闭 GMCP 调试信息} {action}{option.Toggle GMCPDebug}}
{{key}{\coM} {meaning}{开启/关闭地图调试模式} {action}{option.Toggle MapDebug; look}}
{{key}{\coV} {meaning}{开启/禁止显示房间风景图} {action}{option.Toggle ShowRoomView; look}}
{{key}{\coH} {meaning}{开启/暂停 HP 摘要,效果持续七天} {action}{option.Toggle HPSummarize.Pause}}
};

event.HandleOnce {user-online} {ui/walk/setup/pkuxkx} {pkuxkx/online} {
Expand Down
31 changes: 31 additions & 0 deletions mud/pkuxkx/plugins/basic/char/hp.tin
Original file line number Diff line number Diff line change
Expand Up @@ -397,9 +397,22 @@ hp -neili 格式:
#local level {@default{%1;强制}};

#if { "$level" != "强制" } {
#if { @option.IsEnable{HPSummarize.Pause} } {
#local time {@option.Get{HPSummarize.PauseTime}};
#if { $time > @time.Now{} } {
#return;
};
#elseif { $time > 0 } {
okLog HP 摘要抑制时间已结束,现已重新开启。;
option.Toggle HPSummarize.Pause;
option.Set HPSummarize.PauseTime {0};
};
};

#if { "$char.HPSummarize.Echo" == "从不" } {
#return;
};

#if { "$char.HPSummarize.Echo" == "自动" && "$level" != "自动" } {
#return;
};
Expand Down Expand Up @@ -550,6 +563,24 @@ hp -neili 格式:
#showme $summarize;
};

option.Define {HPSummarize.Pause} {Bool} {是否暂停 HP 摘要显示} {false};
option.Define {HPSummarize.PauseTime} {Time} {暂停显示 HP 摘要截止时间} {0};
event.Handle {option/changed} {opt/HPSummarize.Pause/pkuxkx} {$MODULE} {char.HPSummarize.onTogglePause};

#alias {char.HPSummarize.onTogglePause} {
#if { @option.IsEnable{HPSummarize.Pause} } {
#local time {@math.Eval{@time.Now{} + 86400 * 7}};
warnLog 你已选择临时抑制 HP 摘要。在 @time.Format{$time} 之前,你将不会再看到 HP 摘要。;
warnLog HP 摘要是 PaoTin++ 非常有特色的功能,几乎每个用户都喜欢它。;
warnLog 希望那时的你能够以更加开放的心态来迎接它。;
option.Set HPSummarize.PauseTime {$time};
};
#else {
okLog HP 摘要是 PaoTin++ 非常有特色的功能,几乎每个用户都喜欢它。欢迎体验。;
option.Set HPSummarize.PauseTime {0};
};
};

#func {char.hp.expandBigNumber} {
#local number {%1};
#replace number {K} {*1000};
Expand Down
19 changes: 14 additions & 5 deletions plugins/lib/option.tin
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,26 @@ event.Define {option/changed} {无参} {$MODULE} {选项已更新。本事件只
// };
#alias {option.List} {
#echo {};
#echo { <128>%-20s%-10s %-30s %+20s} {选项名称} {选项类型} {选项含义} {选项当前值};
#draw Yellow scroll line 1 1 1 90;
#echo { <128>%-25s%-10s %-30s %+22s} {选项名称} {选项类型} {选项含义} {选项当前值};
#draw Yellow scroll line 1 1 1 100;

#local option {};
#foreach {*gOptions[]} {option} {
#echo { %-20s %-10s %-30s %+20s}
#local value {$gOptions[$option][value]};

#if { "$gOptions[$option][type]" == "Time" } {
#if { $value > 0 } {
#format value {%t} {{%Y-%m-%d %H:%M:%S}{$value}};
};
};

#echo { %-25s %-10s %-30s %+22s}
{$gOptions[$option][name]}
{$gOptions[$option][type]}
{$gOptions[$option][meaning]}
{{$gOptions[$option][value]}};
{{$value}};
};

#echo {};
};

Expand Down Expand Up @@ -274,7 +283,7 @@ event.Define {option/changed} {无参} {$MODULE} {选项已更新。本事件只
#local type {%2};
#local value {%3};

#local types {Bool|String|Slist|Number};
#local types {Bool|String|Slist|Number|Time};
#if { "$type" != "{$types}" } {
errLog 不能识别的选项类型: 「$type」,目前仅支持选项类型:{$types};
#return;
Expand Down

0 comments on commit f1b4003

Please sign in to comment.