Skip to content

Commit d573edf

Browse files
committed
update
1 parent 045bcdb commit d573edf

File tree

13 files changed

+200
-45
lines changed

13 files changed

+200
-45
lines changed

Lsys-Score1/readme.md

+27-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,30 @@
1313
2. 猜拳 (xx)
1414
3. 打劫 @xx
1515

16-
配置文件中: win 代表猜拳 赢得概率 ob 代表平局的概率
16+
配置文件中: win 代表猜拳 赢得概率 ob 代表平局的概率
17+
18+
== update time on 21/12/9
19+
20+
- 增加Conf
21+
<details>
22+
23+
<summary>配置文件</summary>
24+
25+
```json
26+
{
27+
//猜拳平局的概率 18%
28+
"ob": 18,
29+
//第一名签到获得的积分
30+
"signFirstGet": 220,
31+
//正常签到获得的积分
32+
"signNormalGet": 100,
33+
//第二名签到获得的积分
34+
"signSecondGet": 160,
35+
//第三名签到获得的积分
36+
"signThirdGet": 120,
37+
//猜拳赢的概率 18%
38+
"win": 40
39+
}
40+
```
41+
42+
</details>

Lsys-Score1/src/main/java/cn/kloping/lsys/sc1/CommandLine.kt

+16-28
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ package cn.kloping.lsys.sc1
33
import cn.kloping.lsys.Resource
44
import io.github.kloping.initialize.FileInitializeValue
55
import net.mamoe.mirai.console.command.CommandSender
6-
import net.mamoe.mirai.console.command.SimpleCommand
7-
import java.lang.System.err
6+
import net.mamoe.mirai.console.command.CompositeCommand
87

9-
class CommandLine : SimpleCommand(
8+
class CommandLine : CompositeCommand(
109
PluginMain.INSTANCE, "Lsys_sc1", "sc1",
1110
description = "kloping的Lsys_sc1插件指令"
1211
) {
@@ -16,30 +15,19 @@ class CommandLine : SimpleCommand(
1615
val INSTANCE = CommandLine()
1716
}
1817

19-
@Handler
20-
fun CommandSender.handle(arg: String) {
21-
when {
22-
arg == "reload" -> {
23-
sc1.conf = FileInitializeValue.getValue(Resource.rootPath + "/conf/Lsys/sc1.json", sc1.conf, true)
24-
println("已重新getSc1加载配置")
25-
}
26-
arg.startsWith("win") -> {
27-
try {
28-
val cd = java.lang.Long.parseLong(arg.split("=")[1])
29-
sc1.conf.setWin(cd.toInt())
30-
sc1.conf.apply();
31-
println("设置赢的概率为${cd}%")
32-
} catch (e: Exception) {
33-
println("格式错误 示例:win=40 (单位:%)")
34-
}
35-
}
36-
else -> {
37-
err.println(
38-
"已知参数:\n" +
39-
"reload\t#重新加载配置\n" +
40-
"win=?\t\t#设置猜拳赢的概率\n"
41-
)
42-
}
43-
}
18+
@Description("重载配置")
19+
@SubCommand("reload")
20+
suspend fun CommandSender.LsysSc1Reload() {
21+
sc1.conf = FileInitializeValue.getValue(Resource.rootPath + "/conf/Lsys/sc1.json", sc1.conf, true)
22+
sendMessage("已重新getSc1加载配置")
23+
}
24+
25+
@Description("设置猜拳赢得概率")
26+
@SubCommand("reload")
27+
suspend fun CommandSender.LsysSc1SetWin(arg: String) {
28+
val cd = java.lang.Long.parseLong(arg.trim())
29+
sc1.conf.setWin(cd.toInt())
30+
sc1.conf.apply();
31+
sendMessage("设置赢的概率为${cd}%")
4432
}
4533
}

Lsys-Score1/src/main/java/cn/kloping/lsys/sc1/Conf.java

+36
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
public class Conf {
77
private int win = 40;
88
private int ob = 18;
9+
private int signNormalGet = 100;
10+
private int signFirstGet = 220;
11+
private int signSecondGet = 160;
12+
private int signThirdGet = 120;
913

1014
public void setWin(int win) {
1115
this.win = win;
@@ -23,6 +27,38 @@ public int getOb() {
2327
return ob;
2428
}
2529

30+
public int getSignNormalGet() {
31+
return signNormalGet;
32+
}
33+
34+
public void setSignNormalGet(int signNormalGet) {
35+
this.signNormalGet = signNormalGet;
36+
}
37+
38+
public int getSignFirstGet() {
39+
return signFirstGet;
40+
}
41+
42+
public void setSignFirstGet(int signFirstGet) {
43+
this.signFirstGet = signFirstGet;
44+
}
45+
46+
public int getSignSecondGet() {
47+
return signSecondGet;
48+
}
49+
50+
public void setSignSecondGet(int signSecondGet) {
51+
this.signSecondGet = signSecondGet;
52+
}
53+
54+
public int getSignThirdGet() {
55+
return signThirdGet;
56+
}
57+
58+
public void setSignThirdGet(int signThirdGet) {
59+
this.signThirdGet = signThirdGet;
60+
}
61+
2662
public void apply() {
2763
FileInitializeValue.putValues(Resource.rootPath + "/conf/Lsys/sc1.json", this, true);
2864
}

Lsys-Score1/src/main/java/cn/kloping/lsys/sc1/Methods.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,16 @@ public class Methods {
4444
if (day != user.getUr()) {
4545
reg(day, user.getQq().longValue());
4646
int n = getRegNum(day);
47-
int s1 = 100;
47+
int s1 = conf.getSignNormalGet();
4848
switch (n) {
4949
case 1:
50-
s1 = 220;
50+
s1 = conf.getSignFirstGet();
5151
break;
5252
case 2:
53-
s1 = 160;
53+
s1 = conf.getSignSecondGet();
5454
break;
5555
case 3:
56-
s1 = 120;
56+
s1 = conf.getSignThirdGet();
5757
break;
5858
}
5959
user.setPf(0);

Lsys-Score2/readme.md

+26-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,36 @@
11
### MiraiLsys 子插件
22

33
### 积分相关的操作
4+
45
下载
56

67
- 积分相关的 [z5-Lsys-Score2 ](https://github.com/Kloping/MiraiLsys/releases)
78
- 同样若无极端情况请不要修改文件名 否则将无法正常工作
89

9-
### 其命令
10-
10+
### 其命令
11+
1112
1. 积分侦查@xx
1213
2. 积分转让@xx(xx)
13-
3. 打工@xx
14+
3. 打工@xx
15+
16+
== update time on 21/12/9
17+
18+
- 添加Conf
19+
<details>
20+
21+
<summary>配置文件</summary>
22+
23+
```json
24+
{
25+
//打工最大cd 单位/分钟
26+
"workCdMax": 12,
27+
//打工最小cd
28+
"workCdMin": 5,
29+
//打工最大获得
30+
"workGetMax": 60,
31+
//打工最小获得
32+
"workGetMin": 30
33+
}
34+
```
35+
36+
</details>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package cn.kloping.lsys.sc2
2+
3+
import cn.kloping.lsys.Resource
4+
import io.github.kloping.initialize.FileInitializeValue
5+
import net.mamoe.mirai.console.command.CommandSender
6+
import net.mamoe.mirai.console.command.CompositeCommand
7+
8+
class CommandLine : CompositeCommand(
9+
PluginMain.INSTANCE, "Lsys_sc2", "sc2",
10+
description = "kloping的Lsys_sc2插件指令"
11+
) {
12+
13+
companion object {
14+
@JvmField
15+
val INSTANCE = CommandLine()
16+
}
17+
18+
@Description("重载配置")
19+
@SubCommand("reload")
20+
suspend fun CommandSender.LsysSc2Reload() {
21+
sc2.conf = FileInitializeValue.getValue(Resource.rootPath + "/conf/Lsys/sc2.json", sc2.conf, true)
22+
sendMessage("已重新getSc2加载配置")
23+
}
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package cn.kloping.lsys.sc2;
2+
3+
import cn.kloping.lsys.Resource;
4+
import io.github.kloping.initialize.FileInitializeValue;
5+
6+
public class Conf {
7+
private int workCdMin = 5;
8+
private int workCdMax = 12;
9+
private int workGetMin = 30;
10+
private int workGetMax = 60;
11+
12+
public int getWorkCdMin() {
13+
return workCdMin;
14+
}
15+
16+
public void setWorkCdMin(int workCdMin) {
17+
this.workCdMin = workCdMin;
18+
}
19+
20+
public int getWorkCdMax() {
21+
return workCdMax;
22+
}
23+
24+
public void setWorkCdMax(int workCdMax) {
25+
this.workCdMax = workCdMax;
26+
}
27+
28+
public int getWorkGetMin() {
29+
return workGetMin;
30+
}
31+
32+
public void setWorkGetMin(int workGetMin) {
33+
this.workGetMin = workGetMin;
34+
}
35+
36+
public int getWorkGetMax() {
37+
return workGetMax;
38+
}
39+
40+
public void setWorkGetMax(int workGetMax) {
41+
this.workGetMax = workGetMax;
42+
}
43+
44+
45+
public void apply() {
46+
FileInitializeValue.putValues(Resource.rootPath + "/conf/Lsys/sc2.json", this, true);
47+
}
48+
}

Lsys-Score2/src/main/java/cn/kloping/lsys/sc2/Methods.java

+7-3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import kotlin.jvm.functions.Function2;
1010

1111
import static cn.kloping.lsys.savers.PutGetter.get;
12+
import static cn.kloping.lsys.sc2.sc2.conf;
1213
import static cn.kloping.lsys.workers.Methods.*;
1314

1415
public class Methods {
@@ -18,7 +19,7 @@ public class Methods {
1819
if (q2 == -1) return state3;
1920
User u2 = get(q2);
2021
if (u2 == null) return state2;
21-
String nStr = NumberUtils.findNumberFromString(request.getStr()).replace(q2+"","");
22+
String nStr = NumberUtils.findNumberFromString(request.getStr()).replace(q2 + "", "");
2223
if (Judge.isEmpty(nStr)) return state4;
2324
long n = Long.parseLong(nStr);
2425
if (user.getP() < n) return state1;
@@ -32,9 +33,9 @@ public class Methods {
3233
String tips = (k1 - System.currentTimeMillis()) / 1000 / 60 + "分钟之后";
3334
return new Result(new Object[]{tips}, 0);
3435
}
35-
int r = MessageUtils.random.nextInt(20) + 40;
36+
int r = getRand(conf.getWorkGetMin(), conf.getWorkGetMax());
3637
user.addP(r);
37-
int rt = (MessageUtils.random.nextInt(5) + 6);
38+
int rt = getRand(conf.getWorkCdMin(), conf.getWorkCdMax());
3839
user.setK1(System.currentTimeMillis() + rt * 1000 * 60);
3940
user.apply();
4041
return new Result(new Object[]{rt, r}, 1);
@@ -47,4 +48,7 @@ public class Methods {
4748
return new Result(new Object[]{u2.getP()}, 0);
4849
};
4950

51+
public static int getRand(int from, int to) {
52+
return MessageUtils.random.nextInt(from) + (to - from);
53+
}
5054
}

Lsys-Score2/src/main/java/cn/kloping/lsys/sc2/PluginMain.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class PluginMain extends JavaPlugin {
1111
public static final PluginMain INSTANCE = new PluginMain();
1212

1313
private PluginMain() {
14-
super(new JvmPluginDescriptionBuilder("cn.kloping.lsys.sco2.PluginMain", "0.1")
14+
super(new JvmPluginDescriptionBuilder("cn.kloping.lsys.sco2.PluginMain", "0.12")
1515
.name("插件_8 Author => HRS LSys sco2 Loaded")
1616
.info("插件")
1717
.author("HRS")

Lsys-Score2/src/main/java/cn/kloping/lsys/sc2/Utils.java

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package cn.kloping.lsys.sc2;
22

3+
import cn.kloping.lsys.entitys.Conf;
34
import net.mamoe.mirai.console.plugin.Plugin;
45
import net.mamoe.mirai.console.plugin.PluginManager;
56
import net.mamoe.mirai.console.plugin.description.PluginDescription;

Lsys-Score2/src/main/java/cn/kloping/lsys/sc2/sc2.java

+5
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,16 @@
33
import cn.kloping.lsys.Resource;
44
import cn.kloping.lsys.entitys.InvokeGroup;
55
import cn.kloping.lsys.workers.Methods;
6+
import io.github.kloping.initialize.FileInitializeValue;
67

78
import static cn.kloping.lsys.sc2.Methods.*;
89

910
public class sc2 {
11+
public static Conf conf = new Conf();
12+
1013
public static void start() {
14+
conf = FileInitializeValue.getValue(Resource.rootPath + "/conf/Lsys/sc2.json", conf, true);
15+
1116
InvokeGroup invokeGroup = new InvokeGroup("sco2");
1217

1318
invokeGroup.getInvokes().put("积分转让.*", "transTo");

src/main/java/cn/kloping/lsys/PluginMain.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import kotlin.coroutines.CoroutineContext
2020
class PluginMain : KotlinPlugin {
2121

2222
constructor() : super(
23-
JvmPluginDescriptionBuilder("cn.kloping.Lsys", "0.2.6")
23+
JvmPluginDescriptionBuilder("cn.kloping.Lsys", "0.2.7")
2424
.name("插件_ Author => HRS LSys Loaded")
2525
.info("插件")
2626
.author("HRS")

src/main/java/cn/kloping/lsys/entitys/Conf.kt

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ import java.io.File
88
import java.util.concurrent.ConcurrentHashMap
99

1010
data class Conf(
11-
val path: String,
11+
var path: String,
1212
var qq: Number,
1313
var opens: java.util.HashSet<Long>,
14-
val invokeGroups: ConcurrentHashMap<String, InvokeGroup>,
14+
var invokeGroups: ConcurrentHashMap<String, InvokeGroup>,
1515
var prK: Boolean
1616
) : Entity {
1717

1818
constructor() : this("", -1, LinkedHashSet(), ConcurrentHashMap<String, InvokeGroup>(), false);
1919

20-
@JSONField(serialize = false)
20+
@JSONField(serialize = false, deserialize = false)
2121
val invokes = ConcurrentHashMap<String, String>();
2222

23-
@JSONField(serialize = false)
23+
@JSONField(serialize = false, deserialize = false)
2424
val invokesAfter = ConcurrentHashMap<String, Array<String>>();
2525

2626
fun load() {

0 commit comments

Comments
 (0)