-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
248 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>MiraiLSys</artifactId> | ||
<groupId>org.example</groupId> | ||
<version>1.0-SNAPSHOT</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>Lsys-Score2</artifactId> | ||
|
||
<properties> | ||
<maven.compiler.source>8</maven.compiler.source> | ||
<maven.compiler.target>8</maven.compiler.target> | ||
</properties> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
### MiraiLsys 子插件 | ||
|
||
###积分相关的操作 | ||
下载 | ||
|
||
- 积分相关的 [z5-Lsys-Score2 ](https://github.com/Kloping/MiraiLsys/releases) | ||
- 同样若无极端情况请不要修改文件名 否则将无法正常工作 | ||
|
||
### 其命令 | ||
|
||
1. 积分侦查@xx | ||
2. 积分转让@xx(xx) | ||
3. 打工@xx |
50 changes: 50 additions & 0 deletions
50
Lsys-Score2/src/main/java/cn/kloping/lsys/sc2/Methods.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package cn.kloping.lsys.sc2; | ||
|
||
import cn.kloping.judge.Judge; | ||
import cn.kloping.lsys.entitys.Request; | ||
import cn.kloping.lsys.entitys.Result; | ||
import cn.kloping.lsys.entitys.User; | ||
import cn.kloping.lsys.utils.MessageUtils; | ||
import cn.kloping.number.NumberUtils; | ||
import kotlin.jvm.functions.Function2; | ||
|
||
import static cn.kloping.lsys.savers.PutGetter.get; | ||
import static cn.kloping.lsys.workers.Methods.*; | ||
|
||
public class Methods { | ||
|
||
public static final Function2<User, Request, Result> transTo = (user, request) -> { | ||
long q2 = MessageUtils.getAtFromRequest(request); | ||
if (q2 == -1) return state3; | ||
User u2 = get(q2); | ||
if (u2 == null) return state2; | ||
String nStr = NumberUtils.findNumberFromString(request.getStr()).replace(q2+"",""); | ||
if (Judge.isEmpty(nStr)) return state4; | ||
long n = Long.parseLong(nStr); | ||
if (user.getP() < n) return state1; | ||
u2.addP(n); | ||
user.addP(-n); | ||
return state0; | ||
}; | ||
public static final Function2<User, Request, Result> LongTimeWork = (user, request) -> { | ||
long k1 = user.getK1(); | ||
if (k1 >= System.currentTimeMillis()) { | ||
String tips = (k1 - System.currentTimeMillis()) / 1000 / 60 + "分钟之后"; | ||
return new Result(new Object[]{tips}, 0); | ||
} | ||
int r = MessageUtils.random.nextInt(20) + 40; | ||
user.addP(r); | ||
int rt = (MessageUtils.random.nextInt(5) + 6); | ||
user.setK1(System.currentTimeMillis() + rt * 1000 * 60); | ||
user.apply(); | ||
return new Result(new Object[]{rt, r}, 1); | ||
}; | ||
public static final Function2<User, Request, Result> lookSc = (user, request) -> { | ||
long q2 = MessageUtils.getAtFromRequest(request); | ||
if (q2 == -1) return state2; | ||
User u2 = get(q2); | ||
if (u2 == null) return state1; | ||
return new Result(new Object[]{u2.getP()}, 0); | ||
}; | ||
|
||
} |
41 changes: 41 additions & 0 deletions
41
Lsys-Score2/src/main/java/cn/kloping/lsys/sc2/PluginMain.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package cn.kloping.lsys.sc2; | ||
|
||
import com.sun.istack.internal.NotNull; | ||
import net.mamoe.mirai.console.extension.PluginComponentStorage; | ||
import net.mamoe.mirai.console.plugin.PluginManager; | ||
import net.mamoe.mirai.console.plugin.jvm.JavaPlugin; | ||
import net.mamoe.mirai.console.plugin.jvm.JvmPluginDescriptionBuilder; | ||
|
||
|
||
public class PluginMain extends JavaPlugin { | ||
public static final PluginMain INSTANCE = new PluginMain(); | ||
|
||
private PluginMain() { | ||
super(new JvmPluginDescriptionBuilder("cn.kloping.lsys.sco2.PluginMain", "0.1") | ||
.name("插件_8 Author => HRS LSys sco2 Loaded") | ||
.info("插件") | ||
.author("HRS") | ||
.build()); | ||
} | ||
|
||
@Override | ||
public void onLoad(@NotNull PluginComponentStorage $this$onLoad) { | ||
if (!Utils.isExits()) { | ||
getLogger().error("欲使用sco2插件 必须安装 Lsys 插件"); | ||
getLogger().error("欲使用sco2插件 必须安装 Lsys 插件"); | ||
getLogger().error("欲使用sco2插件 必须安装 Lsys 插件"); | ||
PluginManager.INSTANCE.disablePlugin(INSTANCE); | ||
return; | ||
} | ||
try { | ||
sc2.start(); | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
@Override | ||
public void onEnable() { | ||
getLogger().info(""); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package cn.kloping.lsys.sc2; | ||
|
||
import net.mamoe.mirai.console.plugin.Plugin; | ||
import net.mamoe.mirai.console.plugin.PluginManager; | ||
import net.mamoe.mirai.console.plugin.description.PluginDescription; | ||
import net.mamoe.mirai.console.plugin.loader.PluginLoader; | ||
|
||
public class Utils { | ||
public static boolean isExits() { | ||
for (Plugin plugin : PluginManager.INSTANCE.getPlugins()) { | ||
PluginLoader<Plugin, PluginDescription> loader = (PluginLoader<Plugin, PluginDescription>) plugin.getLoader(); | ||
String id = loader.getPluginDescription(plugin).getId(); | ||
if (id.equals("cn.kloping.Lsys")) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package cn.kloping.lsys.sc2; | ||
|
||
import cn.kloping.lsys.Resource; | ||
import cn.kloping.lsys.entitys.InvokeGroup; | ||
import cn.kloping.lsys.workers.Methods; | ||
|
||
import static cn.kloping.lsys.sc2.Methods.*; | ||
|
||
public class sc2 { | ||
public static void start() { | ||
InvokeGroup invokeGroup = new InvokeGroup("sco2"); | ||
|
||
invokeGroup.getInvokes().put("积分转让.*", "transTo"); | ||
invokeGroup.getInvokesAfter().put("积分转让.*", new String[]{"<At = ?>\n积分转让成功" | ||
, "<At = ?>\n积分不足" | ||
, "<At = ?>\nta还没有注册呢" | ||
, "<At = ?>\nta转给谁呢" | ||
, "<At = ?>\n转多少呢" | ||
}); | ||
Methods.invokes.put("transTo", transTo); | ||
//=打劫end | ||
invokeGroup.getInvokes().put("积分侦查.*", "lookSc"); | ||
invokeGroup.getInvokesAfter().put("积分侦查.*", new String[]{"<At = ?>\nta剩的积分:$1" | ||
, "<At = ?>\nta还没有注册" | ||
, "<At = ?>\n侦查谁" | ||
}); | ||
Methods.invokes.put("lookSc", lookSc); | ||
//=签到end | ||
invokeGroup.getInvokes().put("打工.*", "LongTimeWork"); | ||
invokeGroup.getInvokesAfter().put("打工.*", new String[]{"<At = ?>\n冷却时间未到:$1" | ||
, "<At = ?>\n您花费了$1分钟,打工赚了 $2 积分" | ||
}); | ||
Methods.invokes.put("LongTimeWork", LongTimeWork); | ||
//=猜拳end | ||
|
||
Resource.loadConfAfter.add(() -> { | ||
if (!Resource.conf.getInvokeGroups().containsKey(invokeGroup.getId())) | ||
Resource.conf.getInvokeGroups().put(invokeGroup.getId(), invokeGroup); | ||
}); | ||
Resource.i1(); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...-Score2/src/main/resources/META-INF/services/net.mamoe.mirai.console.plugin.jvm.JvmPlugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
cn.kloping.lsys.sc2.PluginMain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.