koishi-plugin-smmcat-gensokyo 0.0.7 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/index.js +21 -2
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -1393,8 +1393,8 @@ MP:${item.mp}/${item.maxMp + item.gain.maxMp}`);
1393
1393
  const monsterName = tempData.goal.filter((item) => item.type == "怪物").map((i) => ({ name: i.name, lv: i.lv }));
1394
1394
  monsterName.forEach((item) => {
1395
1395
  const monster = Monster.monsterTempData[item.name];
1396
- if (monster[item.name]) {
1397
- val += monster[item.name].giveExp + monster[item.name].giveExp * (monster[item.name].lv - 1) * 0.2;
1396
+ if (monster) {
1397
+ val += monster.giveExp + monster.giveExp * (item.lv - 1) * 0.2;
1398
1398
  }
1399
1399
  });
1400
1400
  for (const agent of selfList) {
@@ -1657,6 +1657,25 @@ function apply(ctx, config) {
1657
1657
  return `[${goal}]信息如下:
1658
1658
  ` + skillFn[goal].info;
1659
1659
  });
1660
+ const temp = {};
1661
+ ctx.command("幻想乡/补给").action(async ({ session }) => {
1662
+ const userData = await User.getUserAttribute(session);
1663
+ if (!userData) return;
1664
+ GensokyoMap.initUserPoistion(session, userData);
1665
+ if (temp[session.userId] == void 0) {
1666
+ temp[session.userId] = 0;
1667
+ }
1668
+ const useTime = Date.now() - temp[session.userId];
1669
+ if (useTime < 36e4) {
1670
+ return `请等待下一个补给时间!剩余${Math.floor(useTime / 6e4)}分钟。`;
1671
+ }
1672
+ temp[session.userId] = Date.now();
1673
+ const { maxHp, maxMp, playName } = User.getUserAttributeByUserId(session.userId);
1674
+ User.userTempData[session.userId].hp = maxHp;
1675
+ User.userTempData[session.userId].mp = maxMp;
1676
+ await User.setDatabaseUserAttribute(session.userId);
1677
+ return playName + `通过补给,目前已恢复HP和MP`;
1678
+ });
1660
1679
  }
1661
1680
  __name(apply, "apply");
1662
1681
  // Annotate the CommonJS export names for ESM import in node:
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-smmcat-gensokyo",
3
3
  "description": "名为《幻想乡》的文字冒险游戏",
4
- "version": "0.0.7",
4
+ "version": "0.0.9",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [