koishi-plugin-toram 1.0.0-bata-2 → 1.0.0-bata-4

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.
package/lib/aoandou.js CHANGED
@@ -32,7 +32,7 @@ async function apply(ctx, config) {
32
32
  }
33
33
  // 判断是否今日首次发言
34
34
  if ((0, functions_1.isToday)(user.lastChatTime)) {
35
- user.magic += 10;
35
+ user.magic += config.magic_dailyGet;
36
36
  await ctx.database.set('toramUser', { qq: qq }, { magic: user.magic });
37
37
  }
38
38
  await ctx.database.set('toramUser', { qq: qq }, { lastChatTime: new Date().getTime() });
package/lib/functions.js CHANGED
@@ -22,10 +22,10 @@ exports.isToday = isToday;
22
22
  // 消耗魔能
23
23
  async function magicUse(ctx, session, use) {
24
24
  const qq = session.userId;
25
- const users = await ctx.database.get('toramUser', { qq: qq });
26
- const residue = users[0].magic - use;
25
+ const user = await getUser(ctx, session);
26
+ const residue = (user?.magic ?? 0) - use;
27
27
  if (residue >= 0) {
28
- await ctx.database.set('toramUser', { qq: qq }, { magic: users[0].magic - use });
28
+ await ctx.database.set('toramUser', { qq: qq }, { magic: residue });
29
29
  return true;
30
30
  }
31
31
  else {
package/lib/index.d.ts CHANGED
@@ -13,10 +13,14 @@ export interface Config {
13
13
  dishes_return: number;
14
14
  levelUP_pet_fixedBossReturn: number;
15
15
  levelUP_player_fixedBossReturn: number;
16
+ levelUP_player_wildBossReturn: number;
16
17
  magic_dailyGet: number;
18
+ magic_dishes: number;
19
+ magic_levelUP: number;
20
+ magic_levelUP_pet: number;
21
+ magic_update: number;
17
22
  maxLevel: number;
18
23
  update_return: number;
19
- levelUP_player_wildBossReturn: number;
20
24
  }
21
25
  export declare const Config: Schema<Config>;
22
26
  export declare function apply(ctx: Context, config: Config): Promise<void>;
package/lib/index.js CHANGED
@@ -31,7 +31,7 @@ exports.name = 'toram';
31
31
  exports.Config = koishi_1.Schema.intersect([
32
32
  koishi_1.Schema.object({
33
33
  account_qq: koishi_1.Schema.string().description('机器人使用的QQ号'),
34
- account_qq_guild: koishi_1.Schema.string().description('机器人在频道的QQ号【通过在频道发送 account_qq 获得'),
34
+ account_qq_guild: koishi_1.Schema.string().description('机器人在频道的QQ号【通过在频道发送 account_qq 获得】'),
35
35
  aoandou: koishi_1.Schema.boolean().default(false).description('开启高级魔导书'),
36
36
  }).description('机器人'),
37
37
  koishi_1.Schema.object({
@@ -48,6 +48,10 @@ exports.Config = koishi_1.Schema.intersect([
48
48
  koishi_1.Schema.object({
49
49
  aoandou: koishi_1.Schema.const(true).required(),
50
50
  magic_dailyGet: koishi_1.Schema.number().min(0).default(10).description('每日发言奖励的魔能'),
51
+ magic_dishes: koishi_1.Schema.number().min(0).default(1).description('料理指令消耗魔能'),
52
+ magic_levelUP: koishi_1.Schema.number().min(0).default(1).description('升级指令消耗魔能'),
53
+ magic_levelUP_pet: koishi_1.Schema.number().min(0).default(1).description('练宠指令消耗魔能'),
54
+ magic_update: koishi_1.Schema.number().min(0).default(1).description('更新指令消耗魔能'),
51
55
  })
52
56
  ])
53
57
  ]);
@@ -70,7 +74,7 @@ async function apply(ctx, config) {
70
74
  }, {
71
75
  primary: 'id'
72
76
  });
73
- const pluginVersion = '1.0.0-bata-2'; // 插件当前版本
77
+ const pluginVersion = '1.0.0-bata-4'; // 插件当前版本
74
78
  // 更新数据库指令
75
79
  ctx.command('updateDatabase').action(async ({ session }) => {
76
80
  let version = await ctx.database.get('toram', { database: 'data_version' });
@@ -120,19 +124,19 @@ async function apply(ctx, config) {
120
124
  });
121
125
  // 料理指令
122
126
  ctx.command('料理 <料理种类> <料理等级>').action(async ({ session }, ...args) => {
123
- await (0, functions_1.useCommand)('dishes', ctx, session, logger, config, 1, args);
127
+ await (0, functions_1.useCommand)('dishes', ctx, session, logger, config, config.magic_dishes, args);
124
128
  });
125
129
  // 升级指令
126
130
  ctx.command('升级 <等级数>').action(async ({ session }, ...args) => {
127
- await (0, functions_1.useCommand)('levelUP', ctx, session, logger, config, 1, args);
131
+ await (0, functions_1.useCommand)('levelUP', ctx, session, logger, config, config.magic_levelUP, args);
128
132
  });
129
133
  // 更新指令
130
134
  ctx.command('更新').action(async ({ session }) => {
131
- await (0, functions_1.useCommand)('update', ctx, session, logger, config, 1);
135
+ await (0, functions_1.useCommand)('update', ctx, session, logger, config, config.magic_update);
132
136
  });
133
137
  // 练宠指令
134
138
  ctx.command('练宠 <等级数>').action(async ({ session }, ...args) => {
135
- await (0, functions_1.useCommand)('levelUP_pet', ctx, session, logger, config, 1, args);
139
+ await (0, functions_1.useCommand)('levelUP_pet', ctx, session, logger, config, config.magic_levelUP_pet, args);
136
140
  });
137
141
  }
138
142
  exports.apply = apply;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-toram",
3
3
  "description": "托拉姆物语小工具",
4
- "version": "1.0.0-bata-2",
4
+ "version": "1.0.0-bata-4",
5
5
  "contributors": [
6
6
  "青灯 <1874053520@qq.com>"
7
7
  ],