koishi-plugin-toram 0.0.1
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/index.d.ts +2 -0
- package/lib/index.js +113 -0
- package/package.json +19 -0
- package/readme.md +5 -0
package/lib/index.d.ts
ADDED
package/lib/index.js
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.apply = exports.name = void 0;
|
|
4
|
+
exports.name = 'toram';
|
|
5
|
+
async function apply(ctx) {
|
|
6
|
+
//新建托拉姆boss表
|
|
7
|
+
ctx.model.extend('toram_boss', {
|
|
8
|
+
// 各字段类型
|
|
9
|
+
id: 'number',
|
|
10
|
+
name: 'string',
|
|
11
|
+
level: 'number',
|
|
12
|
+
map: 'string',
|
|
13
|
+
baseEXP: 'number',
|
|
14
|
+
element: 'string',
|
|
15
|
+
/*
|
|
16
|
+
type: 'string',
|
|
17
|
+
*/
|
|
18
|
+
}, {
|
|
19
|
+
// 使用自增的主键值
|
|
20
|
+
primary: 'id'
|
|
21
|
+
});
|
|
22
|
+
var n;
|
|
23
|
+
var i;
|
|
24
|
+
var j;
|
|
25
|
+
var x;
|
|
26
|
+
var y;
|
|
27
|
+
var text;
|
|
28
|
+
let arr1;
|
|
29
|
+
let arr2;
|
|
30
|
+
ctx.command('升级 <等级数:number>').action(async ({ session }, ...args) => {
|
|
31
|
+
{
|
|
32
|
+
let 等级 = args[0];
|
|
33
|
+
if (等级 >= 240 || 等级 <= 0) {
|
|
34
|
+
let 回复语句 = Math.floor(Math.random() * 5) + 1;
|
|
35
|
+
switch (回复语句) {
|
|
36
|
+
case 1:
|
|
37
|
+
return '团长!团长你在干什么呀团长!';
|
|
38
|
+
case 2:
|
|
39
|
+
return '鸮鸮的眼里有大大的疑惑.jpg';
|
|
40
|
+
case 3:
|
|
41
|
+
return '打飞你的医保卡哦!';
|
|
42
|
+
case 4:
|
|
43
|
+
return '你要不要看看你自己在说些什么?';
|
|
44
|
+
case 5:
|
|
45
|
+
return '没救了,别练了,埋了罢【无慈悲】';
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
;
|
|
49
|
+
if (等级 < 38) {
|
|
50
|
+
let 回复语句 = Math.floor(Math.random() * 2) + 1;
|
|
51
|
+
switch (回复语句) {
|
|
52
|
+
case 1:
|
|
53
|
+
return '亲亲,建议去尼山砍柴哦?';
|
|
54
|
+
case 2:
|
|
55
|
+
return '可怜的孩子,快去恰尼木嘞——';
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
;
|
|
59
|
+
if (等级 < 55) {
|
|
60
|
+
return '去女帝陵墓打只因骨龙吧~';
|
|
61
|
+
}
|
|
62
|
+
;
|
|
63
|
+
const rows = await ctx.database.get('toram_boss', { level: { $gte: 等级 - 8, $lte: 等级 + 8 }, });
|
|
64
|
+
n = rows.length - 1;
|
|
65
|
+
text = '';
|
|
66
|
+
arr1 = [];
|
|
67
|
+
for (i = 0; i <= n; i++) {
|
|
68
|
+
switch (Math.abs(等级 - rows[i]?.level)) {
|
|
69
|
+
case 0:
|
|
70
|
+
case 1:
|
|
71
|
+
case 2:
|
|
72
|
+
case 3:
|
|
73
|
+
case 4:
|
|
74
|
+
x = 11;
|
|
75
|
+
break;
|
|
76
|
+
case 5:
|
|
77
|
+
x = 10;
|
|
78
|
+
break;
|
|
79
|
+
case 6:
|
|
80
|
+
x = 9;
|
|
81
|
+
break;
|
|
82
|
+
case 7:
|
|
83
|
+
x = 7;
|
|
84
|
+
break;
|
|
85
|
+
case 8:
|
|
86
|
+
x = 3;
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
;
|
|
90
|
+
arr1.push(rows[i]?.baseEXP * x);
|
|
91
|
+
}
|
|
92
|
+
;
|
|
93
|
+
arr2 = [];
|
|
94
|
+
for (i = 0; i <= n; i++) {
|
|
95
|
+
y = arr1.indexOf(Math.max(...arr1));
|
|
96
|
+
arr2.push(y);
|
|
97
|
+
arr1[y] = 0;
|
|
98
|
+
}
|
|
99
|
+
;
|
|
100
|
+
for (i = 0; i <= n; i++) {
|
|
101
|
+
y = arr2[i];
|
|
102
|
+
text += [rows[y]?.name, ' 等级', rows[y]?.level, ' ', rows[y]?.map, ' 经验值', rows[y]?.baseEXP * x, ' ', rows[y]?.element, '属性'].join('');
|
|
103
|
+
if (i != n) {
|
|
104
|
+
text += '\n';
|
|
105
|
+
}
|
|
106
|
+
;
|
|
107
|
+
}
|
|
108
|
+
;
|
|
109
|
+
return text;
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
exports.apply = apply;
|
package/package.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "koishi-plugin-toram",
|
|
3
|
+
"description": "托拉姆物语工具捏",
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"typings": "lib/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"lib",
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"scripts": {},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"gametool"
|
|
15
|
+
],
|
|
16
|
+
"peerDependencies": {
|
|
17
|
+
"koishi": "^4.11.9"
|
|
18
|
+
}
|
|
19
|
+
}
|