Giter Club home page Giter Club logo

dailyfortune's Introduction

DailyFortune

今日运势

介绍

一个简单的今日运势插件,没啥好介绍的,详细请往下看

插件除了抽取今日运势外,还可以根据运势给予玩家奖励,支持经济与物品
物品奖励给予特地做了防吞机制,如果玩家背包放不下物品,会在玩家坐标生成一个掉落物

截图

此处截图仅做示例,实际上插件不会在同一天对同一位玩家显示不同的运势结果,除非配置文件被修改

img
img
img
img
img

安装

lip install github.com/lgc-LLDev/DailyFortune

如果你要装载插件预设的运势文案和奖励配置,请复制 fortune.json 文件至插件数据目录 plugins/DailyFortune

指令

fortune

  • 不带任何参数 - 抽取今日运势
  • dump - 将手中的物品 NBT 以 SNBT 字符串格式导出至 plugins/DailyFortune/dumped 文件夹下,可以在配置文件中引用(需要 OP)
  • reload - 重载插件配置(需要 OP)

配置

实际的配置文件请不要有注释

plugins/DailyFortune/config.json

// 插件配置
{
  // 是否将玩家的今日运势全服广播(只有每日首次执行指令的时候会广播)
  "broadcast": true,

  // 是否启用运势奖励
  "enableAward": true
}

plugins/DailyFortune/player.json

// 玩家历史运势数据
{
  // 玩家xuid
  "2535466512457742": {
    // 上次抽取时间
    "lastDate": "2023-01-13T19:26:26.000Z",

    "lastFortune": {
      // 上次抽取的文案 id
      "id": -6,

      // 上次抽取的文案下 content 列表的数组下标
      "contentIndex": 24
    }
  }
  // ...
}

plugins/DailyFortune/fortune.json

// 运势文案及奖励设置
[
  {
    // 文案 id,会被记录到玩家历史运势数据
    "id": 1,

    // 显示的运势名称
    "title": "§e大吉",

    // 该运势搭配的文本,抽取运势的时候会从中随机选择一个展示
    "content": [
      "寄全身于好奇心,世界将更加宽阔",
      "曾经的努力和经验会成为他人眼中魅力的样子"
      // ...
    ],

    // 该运势对应的奖励,如果 enableAward 为 false 将不会给予到玩家
    "award": [
      {
        // 当 type 为物品 id 时,会给予玩家对应物品(理论上支持 addon 物品)
        "type": "minecraft:diamond",

        // 要给予给玩家的物品数量
        "amount": 16,

        // 物品特殊值,可以不填
        "aux": 0
      },
      {
        // 当有 sNbt 项时,将会给予玩家此 SNBT 字符串对应的物品,并忽略其他项
        "sNbt": "{\"Count\":1b,\"Damage\":0s,\"Name\":\"minecraft:diamond\",\"WasPickedUp\":0b}"
      },
      {
        // 当 type 为 money 时,会给予玩家 LLMoney 货币
        "type": "money",

        // 要给予玩家的货币数量
        "amount": 114
      },
      {
        // 当 type 为 score 时,会给予玩家计分板经济
        "type": "score",

        // 对应的计分板名称
        "scoreName": "money",

        // 要给予玩家的货币数量
        "amount": 514
      },
      {
        // 当 type 为 command 时,会执行命令
        "type": "command",

        // 执行的命令,可以使用 {realName} 变量代替玩家名称
        "command": "execute at \"{realName}\" summon creeper"
      },
      {
        // 当 type 为 dumped 时
        // 会读取 plugins/DailyFortune/dumped 下的文件作为奖励项处理
        // 通常用于给予玩家 `fortune dump` 指令保存的带 NBT 的物品
        "type": "dumped",

        // 要读取的 dumped 文件夹下的文件名
        "filename": "1673637142566.json"
      }
      // ...
    ]
  }
  // ...
]

联系我

QQ:3076823485
吹水群:1105946125
邮箱:[email protected]

鸣谢

  • fortune.json 预设文案来源
  • 插件点子(

赞助

感谢大家的赞助!你们的赞助将是我继续创作的动力!

  • 爱发电

  • 赞助二维码(点击展开)

    讨饭

更新日志

0.1.1

  • 奖励支持执行指令

dailyfortune's People

Contributors

lgc2333 avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

novtnt

dailyfortune's Issues

输入命令会报错

类型: SyntaxError
信息: unexpected token: 'undefined'
位于: 文件 第 1 行
堆栈: at :1
at parse (native)
at getItem (DailyFortune.js:158)
at map (native)
at giveAward (DailyFortune.js:187)
at todayFortune (DailyFortune.js:225)

14:29:49 ERROR [LiteLoader] Fail in executing command "fortune"!

14:29:49 ERROR [LiteLoader] script::Exception: Unknown Error

14:29:49 ERROR [LiteLoader] In Plugin: DailyFortune

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.