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

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.d.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  import { Context } from 'koishi';
2
2
  import { User } from './function/classes';
3
+ import { Config } from '.';
3
4
  export declare const name = "aoandou";
4
5
  declare module 'koishi' {
5
6
  interface Tables {
6
7
  toramUser: User;
7
8
  }
8
9
  }
9
- export declare function apply(ctx: Context): Promise<void>;
10
+ export declare function apply(ctx: Context, config: Config): Promise<void>;
package/lib/aoandou.js CHANGED
@@ -4,9 +4,9 @@ exports.apply = exports.name = void 0;
4
4
  const classes_1 = require("./function/classes");
5
5
  const functions_1 = require("./functions");
6
6
  exports.name = 'aoandou';
7
- async function apply(ctx) {
7
+ async function apply(ctx, config) {
8
8
  const logger = ctx.logger('aoandou');
9
- const helpList = { '帮助': 'help', '菜单': 'menu', '指令': 'command', '料理': 'dishes' };
9
+ const helpList = { '帮助': 'help', '菜单': 'menu', '指令': 'command', '料理': 'dishes', '升级': 'levelUP', '练宠': 'levelUP_pet', '更新': 'update' };
10
10
  const menuTemp = { '昵称': 'name', '权限等级': 'authority', '魔能': 'magic' };
11
11
  // 数据库
12
12
  ctx.model.extend('toramUser', {
@@ -40,20 +40,8 @@ async function apply(ctx) {
40
40
  }
41
41
  return next();
42
42
  });
43
- // 被@
44
- ctx.middleware(async (session, next) => {
45
- const message = session.event.message;
46
- let needHelp = false;
47
- for (const element of message.elements) {
48
- if (element.type === 'at')
49
- needHelp = true;
50
- }
51
- if (needHelp)
52
- session.send((0, functions_1.makeReply)('help'));
53
- return next();
54
- });
55
43
  // 注册
56
- ctx.command('注册').action(async ({ session }, ...args) => {
44
+ ctx.command('注册').action(async ({ session }) => {
57
45
  const qq = session.userId;
58
46
  switch (session.event.platform) {
59
47
  case 'qqguild':
@@ -75,11 +63,11 @@ async function apply(ctx) {
75
63
  ctx.command('帮助 <选项>').action(async ({ session }, ...args) => {
76
64
  const option = args[0];
77
65
  if (option === undefined)
78
- return (0, functions_1.makeReply)('help');
66
+ return (0, functions_1.makeReply)('help_aoandou');
79
67
  return (0, functions_1.makeReply)(`help_${helpList[option]}`);
80
68
  });
81
69
  // 菜单
82
- ctx.command('菜单').action(async ({ session }, ...args) => {
70
+ ctx.command('菜单').action(async ({ session }) => {
83
71
  const user = await (0, functions_1.getUser)(ctx, session);
84
72
  const result = [];
85
73
  for (const key in menuTemp) {
@@ -17,17 +17,32 @@
17
17
  "如果你确定输入是正确的,那大概是还没有收录这样昵称的玩家的料理吧【缩缩】",
18
18
  "【书页翻动】嗯……已查阅@_0_@条料理记录,找到符合的记录0条【合上书本】"
19
19
  ],
20
- "help":[
20
+ "help": [
21
+ "魔导书现有功能:\n1.升级 [等级]:查询该等级升级头目\n2.练宠 [等级]:查询该等级练宠头目\n3.更新:查看接下来更新的内容\n4.料理 [料理名称] (料理等级):查询高级料理名单【结果通常用拼音排序】\n5.料理 [玩家名称]:查询可能的玩家的料理信息"
22
+ ],
23
+ "help_aoandou":[
21
24
  "魔导书系统使用方法如下:\n① 帮助 (指令名):查询目标指令的用处。\n② 菜单:查看个人菜单。\n③ [指令名] (指令参数):调用魔导书指令功能。"
22
25
  ],
26
+ "help_command": [
27
+ "指令是使用魔导书功能的基础,使用不同的指令可以调用魔导书不同的功能。\n指令列表如下,可输入“帮助 [指令名]”进一步查询使用方法:\n1.升级\n2.练宠\n3.更新\n4.料理"
28
+ ],
29
+ "help_dishes":[
30
+ "料理指令有2种使用方法:\n①料理 [料理名称] (料理等级):查询高级料理名单【结果通常用拼音排序】。如:“料理 hp”,“料理 攻回 10”\n⑤料理 [玩家名称]:查询可能的玩家的料理信息。如“料理 青灯”"
31
+ ],
23
32
  "help_help":[
24
- "使用帮助可以让你查看魔导书的各项功能,比如说输入“帮助 菜单”……虽然书并不是很理解怎么有人连帮助也要帮助……?"
33
+ "使用帮助可以让你查看魔导书的各项功能,比如说输入“帮助 料理”可以查询料理指令的详细信息……虽然书并不是很理解怎么有人连帮助也要帮助……?"
34
+ ],
35
+ "help_levelUP": [
36
+ "输入“升级 [等级]”可以查询该等级的升级头目。如:“升级 198”"
37
+ ],
38
+ "help_levelUP_pet": [
39
+ "输入“练宠 [等级]”可以查询该等级的练宠头目。如:“练宠 140”"
25
40
  ],
26
41
  "help_menu":[
27
42
  "输入“菜单”可以查看个人的信息,如权限等级,剩余魔能等。"
28
43
  ],
29
- "help_command":[
30
- "指令是使用魔导书功能的基础,使用不同的指令可以调用魔导书不同的功能。\n①升级 等级:查询该等级升级头目\n①练宠 等级:查询该等级练宠头目\n③更新预告:查看接下来更新的内容\n④料理 料理名称 (料理等级):查询高级料理名单【结果通常用拼音排序】"
44
+ "help_update": [
45
+ "输入“更新”可以查看接下来一段时间的更新内容(根据国际服同时间公告)。"
31
46
  ],
32
47
  "levelUP_level_error": [
33
48
  "输入的等级有误,请输入1-@_0_@之间的整数作为等级噢?"
@@ -62,7 +62,7 @@ async function disher_highLevel_info(ctx, config, type, dishes_list = []) {
62
62
  returnText += ',' + dishesList_info(dishes_level_list, 'name_level');
63
63
  }
64
64
  n += dishes_level_list.length;
65
- if (n >= config.dishesReturn)
65
+ if (n >= config.dishes_return)
66
66
  return returnText;
67
67
  }
68
68
  return returnText;
@@ -109,8 +109,8 @@ function levelUP_boss_sort(boss_list, level, type) {
109
109
  }
110
110
  // 获取该等级boss信息
111
111
  async function levelUP_bossInfos(ctx, config, level, type) {
112
- const playerLevelUpConfig = { '定点王': config.fixedBossReturn, '野王': config.wildBossReturn };
113
- const petLevelUpConfig = { '定点王': config.petBossReturn };
112
+ const playerLevelUpConfig = { '定点王': config.levelUP_player_fixedBossReturn, '野王': config.levelUP_player_wildBossReturn };
113
+ const petLevelUpConfig = { '定点王': config.levelUP_pet_fixedBossReturn };
114
114
  let boss_list = await levelUP_boss(ctx, config, level, type);
115
115
  boss_list = levelUP_boss_sort(boss_list, level, type);
116
116
  let levelUpConfig;
@@ -9,7 +9,7 @@ async function command_update(ctx, config) {
9
9
  return (0, functions_1.makeReply)('update_notUpdate');
10
10
  return futureUpdateList
11
11
  .sort((update1, update2) => Number(update1.values) - Number(update2.values))
12
- .slice(0, config.updateNoticeReturn)
12
+ .slice(0, config.update_return)
13
13
  .map(update => {
14
14
  const updateDate = new Date(Number(update.values));
15
15
  return `${updateDate.getMonth() + 1}月${updateDate.getDate()}日更新:${update.description}`;
package/lib/index.d.ts CHANGED
@@ -7,14 +7,16 @@ declare module 'koishi' {
7
7
  }
8
8
  }
9
9
  export interface Config {
10
- account: string;
10
+ account_qq: string;
11
+ account_qq_guild: string;
11
12
  aoandou: boolean;
13
+ dishes_return: number;
14
+ levelUP_pet_fixedBossReturn: number;
15
+ levelUP_player_fixedBossReturn: number;
16
+ magic_dailyGet: number;
12
17
  maxLevel: number;
13
- fixedBossReturn: number;
14
- wildBossReturn: number;
15
- dishesReturn: number;
16
- updateNoticeReturn: number;
17
- petBossReturn: number;
18
+ update_return: number;
19
+ levelUP_player_wildBossReturn: number;
18
20
  }
19
21
  export declare const Config: Schema<Config>;
20
22
  export declare function apply(ctx: Context, config: Config): Promise<void>;
package/lib/index.js CHANGED
@@ -30,22 +30,24 @@ const functions_1 = require("./functions");
30
30
  exports.name = 'toram';
31
31
  exports.Config = koishi_1.Schema.intersect([
32
32
  koishi_1.Schema.object({
33
- account: koishi_1.Schema.string().description('机器人使用的QQ号'),
33
+ account_qq: koishi_1.Schema.string().description('机器人使用的QQ号'),
34
+ account_qq_guild: koishi_1.Schema.string().description('机器人在频道的QQ号【通过在频道发送 account_qq 获得'),
34
35
  aoandou: koishi_1.Schema.boolean().default(false).description('开启高级魔导书'),
35
36
  }).description('机器人'),
36
37
  koishi_1.Schema.object({
37
38
  maxLevel: koishi_1.Schema.number().min(1).step(1).default(255).description('当前版本的最大等级'),
38
39
  }).description('游戏信息'),
39
40
  koishi_1.Schema.object({
40
- fixedBossReturn: koishi_1.Schema.number().min(1).step(1).default(6).description('使用升级指令时返回的定点王数量'),
41
- wildBossReturn: koishi_1.Schema.number().min(1).step(1).default(4).description('使用升级指令时返回的野王数量'),
42
- dishesReturn: koishi_1.Schema.number().min(1).step(1).default(15).description('使用料理指令且不指定等级时最少返回的玩家昵称数量'),
43
- updateNoticeReturn: koishi_1.Schema.number().min(1).step(1).default(4).description('使用更新指令时返回的更新内容数量'),
41
+ dishes_return: koishi_1.Schema.number().min(1).step(1).default(15).description('使用料理指令且不指定等级时最少返回的玩家昵称数量'),
42
+ levelUP_pet_fixedBossReturn: koishi_1.Schema.number().min(1).step(1).default(8).description('使用练宠指令时返回的定点王数量'),
43
+ levelUP_player_fixedBossReturn: koishi_1.Schema.number().min(1).step(1).default(6).description('使用升级指令时返回的定点王数量'),
44
+ levelUP_player_wildBossReturn: koishi_1.Schema.number().min(1).step(1).default(4).description('使用升级指令时返回的野王数量'),
45
+ update_return: koishi_1.Schema.number().min(1).step(1).default(4).description('使用更新指令时返回的更新内容数量'),
44
46
  }).description('指令管理'),
45
47
  koishi_1.Schema.union([
46
48
  koishi_1.Schema.object({
47
49
  aoandou: koishi_1.Schema.const(true).required(),
48
- petBossReturn: koishi_1.Schema.number().min(1).step(1).default(8).description('使用练宠指令时返回的定点王数量'),
50
+ magic_dailyGet: koishi_1.Schema.number().min(0).default(10).description('每日发言奖励的魔能'),
49
51
  })
50
52
  ])
51
53
  ]);
@@ -68,7 +70,7 @@ async function apply(ctx, config) {
68
70
  }, {
69
71
  primary: 'id'
70
72
  });
71
- const pluginVersion = '1.0.0-bata-1'; // 插件当前版本
73
+ const pluginVersion = '1.0.0-bata-2'; // 插件当前版本
72
74
  // 更新数据库指令
73
75
  ctx.command('updateDatabase').action(async ({ session }) => {
74
76
  let version = await ctx.database.get('toram', { database: 'data_version' });
@@ -94,6 +96,28 @@ async function apply(ctx, config) {
94
96
  }
95
97
  return (0, functions_1.makeReply)('updateDatabase_finish');
96
98
  });
99
+ // 被@
100
+ ctx.middleware(async (session, next) => {
101
+ const message = session.event.message;
102
+ let needHelp = false;
103
+ for (const element of message.elements) {
104
+ if (element.type === 'at' && (session.event.selfId === config.account_qq || session.event.selfId === config.account_qq_guild))
105
+ needHelp = true;
106
+ }
107
+ if (needHelp) {
108
+ if (config.aoandou) {
109
+ session.send((0, functions_1.makeReply)('help_aoandou'));
110
+ }
111
+ else {
112
+ session.send((0, functions_1.makeReply)('help'));
113
+ }
114
+ }
115
+ return next();
116
+ });
117
+ // 返回频道状态的qq号
118
+ ctx.command('account_qq').action(async ({ session }) => {
119
+ return session.event.selfId;
120
+ });
97
121
  // 料理指令
98
122
  ctx.command('料理 <料理种类> <料理等级>').action(async ({ session }, ...args) => {
99
123
  await (0, functions_1.useCommand)('dishes', ctx, session, logger, config, 1, args);
@@ -103,7 +127,7 @@ async function apply(ctx, config) {
103
127
  await (0, functions_1.useCommand)('levelUP', ctx, session, logger, config, 1, args);
104
128
  });
105
129
  // 更新指令
106
- ctx.command('更新预告').action(async ({ session }) => {
130
+ ctx.command('更新').action(async ({ session }) => {
107
131
  await (0, functions_1.useCommand)('update', ctx, session, logger, config, 1);
108
132
  });
109
133
  // 练宠指令
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-1",
4
+ "version": "1.0.0-bata-2",
5
5
  "contributors": [
6
6
  "青灯 <1874053520@qq.com>"
7
7
  ],