koishi-plugin-toram 0.1.1 → 0.1.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.
Files changed (2) hide show
  1. package/lib/index.js +40 -3
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -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,42 @@ 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('修改定点王数据 <名称:string> <基础等级:number> <地图:string> <基础经验:number> <属性:string>').action(async ({ session }, ...args) => {
165
+ {
166
+ let 定点王名称 = args[0], 定点王基础等级 = args[1], 定点王地图 = args[2], 定点王基础经验 = args[3], 定点王属性 = args[4];
167
+ n = (await ctx.database.get('toram_boss', { name: '1星' + 定点王名称, }))[0]?.id;
168
+ for (i = 1; i <= 4; i++) {
169
+ text = String(i) + '星' + 定点王名称;
170
+ switch (i) {
171
+ case 1:
172
+ x = 0;
173
+ y = 1;
174
+ break;
175
+ case 2:
176
+ x = 10;
177
+ y = 2;
178
+ break;
179
+ case 3:
180
+ x = 20;
181
+ y = 5;
182
+ break;
183
+ case 4:
184
+ x = 40;
185
+ y = 10;
186
+ break;
187
+ }
188
+ ;
189
+ await ctx.database.upsert('toram_boss', [{ id: n + i - 1, name: text, level: 定点王基础等级 + x, map: 定点王地图, baseEXP: 定点王基础经验 * y, element: 定点王属性 }]);
190
+ }
191
+ ;
192
+ return '修改定点王数据成功!';
193
+ }
194
+ });
158
195
  }
159
196
  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.2",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [