实现功能
- 每天早上6点后玩家上线自动领取任务
- 每天早上6点刷新任务,需要手动领取
任务配置
任务文件:core/quest/auto_task.yml
玩家上线自动领取每日任务
break_stone_10:
meta:
name: "每日任务: 破坏10个石头"
objective:
1:
event: "block break"
node:
material:
- "STONE"
amount: 10
addon:
time:
plan:
auto: true # 玩家上线自动接受
timing: day 06 00 # 次日早上 6 点任务重新开放
ui:
display:
- "&r目标:破坏10个石头"
- "&7- 进度:{progress_1}/10 {is_complete_1}"
trigger:
accept: |
tell "你接取每日任务:破坏10个石头"
complete: |
tell "任务完成,奖励已发放!"
command papi "give %player_name% minecraft:apple 1" as console
任务文件:core/quest/daily_task.yml
玩家上线手动领取每日任务
break_stone_10:
meta:
name: "每日任务: 破坏10个石头"
objective:
1:
event: "block break"
node:
material:
- "STONE"
amount: 10
addon:
time:
plan:
auto: false # 玩家上线手动接受
timing: day 06 00 # 次日早上 6 点任务重新开放
ui:
display:
- "&r目标:破坏10个石头"
- "&7- 进度:{progress_1}/10 {is_complete_1}"
trigger:
accept: |
tell "你接取每日任务:破坏10个石头"
complete: |
tell "任务完成,奖励已发放!"
command papi "give %player_name% minecraft:apple 1" as console
对话配置
对话文件:core/conversation/npc_daily.yml
#绑定 npc 对话,检测之后自动跳转对应的对话框
check_daily_task:
when:
#检测有 check_daily_task 拥有权限
- if: permission check_daily_task
open: daily_task_dialogue
#检测没有 check_daily_task 权限,跳转到任务完成对话框
- open: task_completed_dialogue
daily_task_dialogue:
content:
- "你可以每天来领取一个任务,去完成后领取奖励吧!"
answer:
- text: "领取任务!"
action: |
choose quest break_stone_10 quest accept
tell "你今天的任务是:破坏10个石头!"
command papi "lp user %player_name% permission settemp check_daily_task false %math_86400-({server_time_HH}*3600+{server_time_mm}*60+{server_time_ss})%s" as console
task_completed_dialogue:
content:
- "请明天再来领取新的任务吧!"
answer:
- text: "好的,谢谢!"
action: |
tell "记得明天再来哦!"