koishi-plugin-toram 0.1.1 → 0.1.3

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 +45 -4
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -53,7 +53,7 @@ async function apply(ctx) {
53
53
  return '去女帝陵墓打只因骨龙吧~';
54
54
  }
55
55
  ;
56
- const rows = await ctx.database.get('toram_boss', { level: { $gte: 等级 - 8, $lte: 等级 + 8 }, });
56
+ const rows = await ctx.database.get('toram_boss', { level: { $gte: 等级 - 8, $lte: Math.min(等级 + 8, 243) }, });
57
57
  n = rows.length - 1;
58
58
  text = '';
59
59
  arr1 = [];
@@ -84,13 +84,13 @@ async function apply(ctx) {
84
84
  }
85
85
  ;
86
86
  arr2 = [];
87
- for (i = 0; i <= n; i++) {
87
+ for (i = 0; i <= Math.min(n, 9); i++) {
88
88
  y = arr1.indexOf(Math.max(...arr1));
89
89
  arr1[y] = 0;
90
90
  arr2.push(y);
91
91
  }
92
92
  ;
93
- for (i = 0; i <= n; i++) {
93
+ for (i = 0; i <= Math.min(n, 9); i++) {
94
94
  y = arr2[i];
95
95
  switch (Math.abs(等级 - rows[y]?.level)) {
96
96
  case 0:
@@ -126,7 +126,7 @@ async function apply(ctx) {
126
126
  ctx.command('写入定点王 <名称:string> <基础等级:number> <地图:string> <基础经验:number> <属性:string>').action(async ({ session }, ...args) => {
127
127
  {
128
128
  let 定点王名称 = args[0], 定点王基础等级 = args[1], 定点王地图 = args[2], 定点王基础经验 = args[3], 定点王属性 = args[4];
129
- const rows = await ctx.database.get('toram_boss', { id: { $gte: 1, $lte: 100 }, });
129
+ const rows = await ctx.database.get('toram_boss', { id: { $gte: 1, $lte: 1000 }, });
130
130
  n = rows.length;
131
131
  for (i = 1; i <= 4; i++) {
132
132
  text = String(i) + '星' + 定点王名称;
@@ -155,5 +155,46 @@ async function apply(ctx) {
155
155
  return '写入定点王成功!';
156
156
  }
157
157
  });
158
+ ctx.command('查询王存在 <名称:string>').action(async ({ session }, ...args) => {
159
+ {
160
+ let 王名称 = args[0];
161
+ return ([(await ctx.database.get('toram_boss', { name: 王名称, }))[0]?.id].join(''));
162
+ }
163
+ });
164
+ ctx.command('修改定点王数据 <定点王1星id:number> <名称:string> <基础等级:number> <地图:string> <基础经验:number> <属性:string>').action(async ({ session }, ...args) => {
165
+ {
166
+ let 定点王1星id = args[0], 定点王名称 = args[1], 定点王基础等级 = args[2], 定点王地图 = args[3], 定点王基础经验 = args[4], 定点王属性 = args[5];
167
+ for (i = 1; i <= 4; i++) {
168
+ text = String(i) + '星' + 定点王名称;
169
+ switch (i) {
170
+ case 1:
171
+ x = 0;
172
+ y = 1;
173
+ break;
174
+ case 2:
175
+ x = 10;
176
+ y = 2;
177
+ break;
178
+ case 3:
179
+ x = 20;
180
+ y = 5;
181
+ break;
182
+ case 4:
183
+ x = 40;
184
+ y = 10;
185
+ break;
186
+ }
187
+ ;
188
+ await ctx.database.upsert('toram_boss', [{ id: 定点王1星id + i - 1, name: text, level: 定点王基础等级 + x, map: 定点王地图, baseEXP: 定点王基础经验 * y, element: 定点王属性 }]);
189
+ }
190
+ ;
191
+ return '修改定点王数据成功!';
192
+ }
193
+ });
194
+ ctx.middleware(async (session, next) => {
195
+ if ((session.content) == '@青灯的魔法书' || (session.content) == '@青灯的魔法书 ') {
196
+ return '魔法书现有的功能:\n1.查询指定等级的练级定点王';
197
+ }
198
+ });
158
199
  }
159
200
  exports.apply = apply;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-toram",
3
3
  "description": "托拉姆物语工具捏",
4
- "version": "0.1.1",
4
+ "version": "0.1.3",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [