koishi-plugin-ggcevo 1.1.7 → 1.1.9
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 +28 -0
- package/lib/index.js +158 -4
- package/package.json +1 -1
- package/readme.md +27 -7
package/lib/index.d.ts
CHANGED
|
@@ -53,6 +53,8 @@ declare module 'koishi' {
|
|
|
53
53
|
ggcevo_ban_record: GgcEvoBanRecord;
|
|
54
54
|
ggcevo_admin_welfare: GgcEvoAdminWelfare;
|
|
55
55
|
ggcevo_mining: GgcEvoMiningState;
|
|
56
|
+
ggcevo_explore: GgcEvoExploreState;
|
|
57
|
+
ggcevo_explore_stats: GgcEvoExploreStat;
|
|
56
58
|
}
|
|
57
59
|
}
|
|
58
60
|
export interface GgcEvoPlayer {
|
|
@@ -121,6 +123,32 @@ export interface GgcEvoMiningState {
|
|
|
121
123
|
/** 最近一次更新/领取时间 */
|
|
122
124
|
update_time: Date;
|
|
123
125
|
}
|
|
126
|
+
export interface GgcEvoExploreState {
|
|
127
|
+
/** 探索身份标识, 复用游戏句柄字符串 */
|
|
128
|
+
user_id: string;
|
|
129
|
+
/** 当前进行中的探索星系ID */
|
|
130
|
+
galaxy_id: number;
|
|
131
|
+
/** 本轮探索开始时间 */
|
|
132
|
+
start_time: Date;
|
|
133
|
+
/** 最近一次更新/领取时间 */
|
|
134
|
+
update_time: Date;
|
|
135
|
+
}
|
|
136
|
+
export interface GgcEvoExploreStat {
|
|
137
|
+
/** 探索身份标识, 复用游戏句柄字符串 */
|
|
138
|
+
user_id: string;
|
|
139
|
+
/** 星系ID */
|
|
140
|
+
galaxy_id: number;
|
|
141
|
+
/** 累计探索次数 */
|
|
142
|
+
total_count: number;
|
|
143
|
+
/** 累计成功次数 */
|
|
144
|
+
success_count: number;
|
|
145
|
+
/** 累计失败次数 */
|
|
146
|
+
fail_count: number;
|
|
147
|
+
/** 累计获得金币数(含失败安慰奖) */
|
|
148
|
+
total_coins: number;
|
|
149
|
+
/** 最近一次更新/领取时间 */
|
|
150
|
+
update_time: Date;
|
|
151
|
+
}
|
|
124
152
|
export interface Backpack {
|
|
125
153
|
id: number;
|
|
126
154
|
user_id: string;
|
package/lib/index.js
CHANGED
|
@@ -40,7 +40,7 @@ var Config = import_koishi.Schema.intersect([
|
|
|
40
40
|
mapMonitorRecommendMapName: import_koishi.Schema.string().description("当所有配置地图均离线时, 推荐玩家游玩的地图名称").default("")
|
|
41
41
|
}).description("地图检测"),
|
|
42
42
|
import_koishi.Schema.object({
|
|
43
|
-
curfewEnabled: import_koishi.Schema.boolean().description("是否启用宵禁(启用后每晚17点-24
|
|
43
|
+
curfewEnabled: import_koishi.Schema.boolean().description("是否启用宵禁(启用后每晚17点-24点禁止抽奖、挖矿和探索, 签到不受限制)").default(false)
|
|
44
44
|
}).description("宵禁设置"),
|
|
45
45
|
import_koishi.Schema.object({
|
|
46
46
|
exchangeAdminName: import_koishi.Schema.string().description("活动兑换管理员名字(填写后, 兑换成功及兑换列表会提示向该管理员私聊登记, 不填则不提醒)").default("")
|
|
@@ -250,6 +250,25 @@ function apply(ctx, config) {
|
|
|
250
250
|
}, {
|
|
251
251
|
primary: "user_id"
|
|
252
252
|
});
|
|
253
|
+
ctx.model.extend("ggcevo_explore", {
|
|
254
|
+
user_id: "string",
|
|
255
|
+
galaxy_id: "unsigned",
|
|
256
|
+
start_time: "timestamp",
|
|
257
|
+
update_time: "timestamp"
|
|
258
|
+
}, {
|
|
259
|
+
primary: "user_id"
|
|
260
|
+
});
|
|
261
|
+
ctx.model.extend("ggcevo_explore_stats", {
|
|
262
|
+
user_id: "string",
|
|
263
|
+
galaxy_id: "unsigned",
|
|
264
|
+
total_count: "unsigned",
|
|
265
|
+
success_count: "unsigned",
|
|
266
|
+
fail_count: "unsigned",
|
|
267
|
+
total_coins: "unsigned",
|
|
268
|
+
update_time: "timestamp"
|
|
269
|
+
}, {
|
|
270
|
+
primary: ["user_id", "galaxy_id"]
|
|
271
|
+
});
|
|
253
272
|
if (config.mapMonitorEnabled && config.mapMonitorGroups.length > 0 && config.mapMonitorMapIds.length > 0) {
|
|
254
273
|
ctx.setInterval(async () => {
|
|
255
274
|
try {
|
|
@@ -326,8 +345,10 @@ function apply(ctx, config) {
|
|
|
326
345
|
if (hour >= 17) {
|
|
327
346
|
if (type === "lottery") {
|
|
328
347
|
return `🌙 宵禁时段(17:00-24:00),暂不能抽奖。`;
|
|
329
|
-
} else {
|
|
348
|
+
} else if (type === "mining") {
|
|
330
349
|
return `🌙 宵禁时段(17:00-24:00),暂不能挖矿。`;
|
|
350
|
+
} else {
|
|
351
|
+
return `🌙 宵禁时段(17:00-24:00),暂不能探索。`;
|
|
331
352
|
}
|
|
332
353
|
}
|
|
333
354
|
return null;
|
|
@@ -680,11 +701,10 @@ ${message}`;
|
|
|
680
701
|
}
|
|
681
702
|
lastAllowanceMonth = summary.last_allowance_month || 0;
|
|
682
703
|
}
|
|
683
|
-
const qq = String(session.userId || "");
|
|
684
704
|
const normalizedHandle = normalizeHandle(handle);
|
|
685
705
|
const welfareRecords = await ctx.database.get("ggcevo_admin_welfare", {});
|
|
686
706
|
const isWelfareMember = welfareRecords.some(
|
|
687
|
-
(r) =>
|
|
707
|
+
(r) => r.handle && normalizeHandle(r.handle) === normalizedHandle
|
|
688
708
|
);
|
|
689
709
|
if (isWelfareMember && lastAllowanceMonth !== currentMonth) {
|
|
690
710
|
monthlyAllowance = 50;
|
|
@@ -811,6 +831,140 @@ ${message}`;
|
|
|
811
831
|
⏱️ 本轮挖矿 ${formatMiningDuration(cappedMinutes)}
|
|
812
832
|
📊 累计挖矿 ${formatMiningDuration(newTotalMinutes)},累计收益 ${newTotalCoins} 金币
|
|
813
833
|
🌱 已自动进入下一轮挖矿。`;
|
|
834
|
+
});
|
|
835
|
+
const EXPLORE_DURATION_MIN = 12 * 60;
|
|
836
|
+
const EXPLORE_GALAXIES = [
|
|
837
|
+
{ id: 1, name: "天枢星系", desc: "成功率100%,成功获得80金币", successRate: 100, successCoins: 80, failCoins: 0 },
|
|
838
|
+
{ id: 2, name: "赤潮星系", desc: "成功率60%,成功获得120金币,失败获得60金币", successRate: 60, successCoins: 120, failCoins: 60 },
|
|
839
|
+
{
|
|
840
|
+
id: 3,
|
|
841
|
+
name: "千帆星系",
|
|
842
|
+
desc: "成功率80%,成功获得50金币,失败获得25金币,成功时概率获得补签券/咕咕币",
|
|
843
|
+
successRate: 80,
|
|
844
|
+
successCoins: 50,
|
|
845
|
+
failCoins: 25,
|
|
846
|
+
items: [
|
|
847
|
+
{ itemId: 9, min: 1, max: 1, rate: 10 },
|
|
848
|
+
// 补签券 x1 (10%)
|
|
849
|
+
{ itemId: 2, min: 1, max: 3, rate: 50 }
|
|
850
|
+
// 咕咕币 1-3 (50%)
|
|
851
|
+
]
|
|
852
|
+
}
|
|
853
|
+
];
|
|
854
|
+
ctx.command("ggcevo/探索", "选择星系进行12小时探索, 结束后领取收益").action(async (argv) => {
|
|
855
|
+
const session = argv.session;
|
|
856
|
+
const curfewMsg = checkCurfew("explore");
|
|
857
|
+
if (curfewMsg) return `<quote id="${session.messageId}"/>${curfewMsg}`;
|
|
858
|
+
const handle = await getHandle(session);
|
|
859
|
+
if (!handle) {
|
|
860
|
+
return `<quote id="${session.messageId}"/>🔒 需要先绑定游戏句柄。
|
|
861
|
+
💡 使用 \`绑定句柄\` 命令进行绑定。`;
|
|
862
|
+
}
|
|
863
|
+
const now = /* @__PURE__ */ new Date();
|
|
864
|
+
const [explore] = await ctx.database.get("ggcevo_explore", { user_id: handle });
|
|
865
|
+
if (!explore) {
|
|
866
|
+
const galaxyList = EXPLORE_GALAXIES.map((g) => `${g.id}. ${g.name}(${g.desc})`).join("\n");
|
|
867
|
+
await session.send(`<quote id="${session.messageId}"/>🛸 选择一个星系开始探索(探索时长 12 小时):
|
|
868
|
+
${galaxyList}
|
|
869
|
+
请回复星系编号(1/2/3)选择,回复其他内容取消。`);
|
|
870
|
+
const choice = await session.prompt(3e4);
|
|
871
|
+
if (!choice) return `🛸 已取消探索。`;
|
|
872
|
+
const galaxyId = parseInt(choice.trim(), 10);
|
|
873
|
+
const galaxy2 = EXPLORE_GALAXIES.find((g) => g.id === galaxyId);
|
|
874
|
+
if (!galaxy2) return `🛸 星系编号无效,已取消探索。`;
|
|
875
|
+
await ctx.database.create("ggcevo_explore", {
|
|
876
|
+
user_id: handle,
|
|
877
|
+
galaxy_id: galaxy2.id,
|
|
878
|
+
start_time: now,
|
|
879
|
+
update_time: now
|
|
880
|
+
});
|
|
881
|
+
return `<quote id="${session.messageId}"/>🛸 探索开始!你选择了「${galaxy2.name}」。
|
|
882
|
+
⏱️ 探索将持续 12 小时,届时使用 探索 命令领取收益。`;
|
|
883
|
+
}
|
|
884
|
+
const galaxy = EXPLORE_GALAXIES.find((g) => g.id === explore.galaxy_id);
|
|
885
|
+
if (!galaxy) {
|
|
886
|
+
await ctx.database.remove("ggcevo_explore", { user_id: handle });
|
|
887
|
+
return `<quote id="${session.messageId}"/>⚠️ 当前探索的星系不存在,已重置,请重新选择星系开始探索。`;
|
|
888
|
+
}
|
|
889
|
+
const elapsedMinutes = Math.floor((now.getTime() - new Date(explore.start_time).getTime()) / 6e4);
|
|
890
|
+
if (elapsedMinutes < EXPLORE_DURATION_MIN) {
|
|
891
|
+
const restMinutes = EXPLORE_DURATION_MIN - elapsedMinutes;
|
|
892
|
+
return `<quote id="${session.messageId}"/>🛸 探索进行中:${galaxy.name}
|
|
893
|
+
⏱️ 还需 ${formatMiningDuration(restMinutes)} 完成探索。`;
|
|
894
|
+
}
|
|
895
|
+
const isSuccess = Math.random() * 100 < galaxy.successRate;
|
|
896
|
+
const gold = isSuccess ? galaxy.successCoins : galaxy.failCoins;
|
|
897
|
+
const rewardLines = [];
|
|
898
|
+
const gainedTexts = [];
|
|
899
|
+
const droppedItems = [];
|
|
900
|
+
if (isSuccess && galaxy.items) {
|
|
901
|
+
for (const item of galaxy.items) {
|
|
902
|
+
if (Math.random() * 100 >= item.rate) continue;
|
|
903
|
+
const count = item.min + Math.floor(Math.random() * (item.max - item.min + 1));
|
|
904
|
+
droppedItems.push({ itemId: item.itemId, count });
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
if (gold > 0) {
|
|
908
|
+
const [existingGold] = await ctx.database.get("ggcevo_backpack", { user_id: handle, item_id: 1 });
|
|
909
|
+
const newGoldCount = (existingGold?.count || 0) + gold;
|
|
910
|
+
if (existingGold) {
|
|
911
|
+
await ctx.database.upsert("ggcevo_backpack", [{
|
|
912
|
+
user_id: handle,
|
|
913
|
+
item_id: 1,
|
|
914
|
+
count: newGoldCount
|
|
915
|
+
}]);
|
|
916
|
+
} else {
|
|
917
|
+
await ctx.database.create("ggcevo_backpack", {
|
|
918
|
+
user_id: handle,
|
|
919
|
+
item_id: 1,
|
|
920
|
+
count: newGoldCount
|
|
921
|
+
});
|
|
922
|
+
}
|
|
923
|
+
rewardLines.push(`💰 获得 ${gold} 金币`);
|
|
924
|
+
}
|
|
925
|
+
for (const g of droppedItems) {
|
|
926
|
+
const [existing] = await ctx.database.get("ggcevo_backpack", { user_id: handle, item_id: g.itemId });
|
|
927
|
+
const newCount = (existing?.count || 0) + g.count;
|
|
928
|
+
if (existing) {
|
|
929
|
+
await ctx.database.upsert("ggcevo_backpack", [{
|
|
930
|
+
user_id: handle,
|
|
931
|
+
item_id: g.itemId,
|
|
932
|
+
count: newCount
|
|
933
|
+
}]);
|
|
934
|
+
} else {
|
|
935
|
+
await ctx.database.create("ggcevo_backpack", {
|
|
936
|
+
user_id: handle,
|
|
937
|
+
item_id: g.itemId,
|
|
938
|
+
count: newCount
|
|
939
|
+
});
|
|
940
|
+
}
|
|
941
|
+
gainedTexts.push(`${ItemConfig[g.itemId] || `道具#${g.itemId}`} x${g.count}`);
|
|
942
|
+
}
|
|
943
|
+
if (gainedTexts.length) {
|
|
944
|
+
rewardLines.push(`🎁 获得:${gainedTexts.join("、")}`);
|
|
945
|
+
}
|
|
946
|
+
const [stat] = await ctx.database.get("ggcevo_explore_stats", { user_id: handle, galaxy_id: galaxy.id });
|
|
947
|
+
const newStat = {
|
|
948
|
+
user_id: handle,
|
|
949
|
+
galaxy_id: galaxy.id,
|
|
950
|
+
total_count: (stat?.total_count || 0) + 1,
|
|
951
|
+
success_count: (stat?.success_count || 0) + (isSuccess ? 1 : 0),
|
|
952
|
+
fail_count: (stat?.fail_count || 0) + (isSuccess ? 0 : 1),
|
|
953
|
+
total_coins: (stat?.total_coins || 0) + gold,
|
|
954
|
+
update_time: now
|
|
955
|
+
};
|
|
956
|
+
if (stat) {
|
|
957
|
+
await ctx.database.upsert("ggcevo_explore_stats", [newStat]);
|
|
958
|
+
} else {
|
|
959
|
+
await ctx.database.create("ggcevo_explore_stats", newStat);
|
|
960
|
+
}
|
|
961
|
+
await ctx.database.remove("ggcevo_explore", { user_id: handle });
|
|
962
|
+
const resultMsg = isSuccess ? `🛸 探索完成!「${galaxy.name}」探索成功!` : `🛸 探索完成!「${galaxy.name}」探索失败,获得安慰奖。`;
|
|
963
|
+
const body = rewardLines.length ? `
|
|
964
|
+
${rewardLines.join("\n")}` : "";
|
|
965
|
+
return `<quote id="${session.messageId}"/>${resultMsg}${body}
|
|
966
|
+
📊 该星系累计探索 ${newStat.total_count} 次,成功 ${newStat.success_count} 次,累计获得 ${newStat.total_coins} 金币
|
|
967
|
+
🛸 可再次使用 探索 命令选择星系开启新的探索。`;
|
|
814
968
|
});
|
|
815
969
|
ctx.command("ggcevo/兑换 <name:string>").action(async (argv, name2) => {
|
|
816
970
|
const session = argv.session;
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -33,17 +33,17 @@ npm install koishi-plugin-ggcevo
|
|
|
33
33
|
|
|
34
34
|
| 配置项 | 类型 | 默认值 | 说明 |
|
|
35
35
|
| --- | --- | --- | --- |
|
|
36
|
-
| `curfewEnabled` | `boolean` | `false` | 是否启用宵禁。启用后每晚 17:00-24:00
|
|
36
|
+
| `curfewEnabled` | `boolean` | `false` | 是否启用宵禁。启用后每晚 17:00-24:00 禁止抽奖、挖矿和探索(签到不受宵禁限制) |
|
|
37
37
|
|
|
38
38
|
> 宵禁影响「咕咕之战」游戏模式下的玩法指令(抽奖、挖矿等)。后续新增的咕咕之战玩法指令均默认受宵禁影响。
|
|
39
39
|
|
|
40
40
|
**宵禁时段说明:**
|
|
41
41
|
|
|
42
|
-
| 时段 | 签到 | 抽奖 | 挖矿 |
|
|
43
|
-
| --- | --- | --- | --- |
|
|
44
|
-
| 0:00-6:00 | ✅ 允许 | ✅ 允许 | ✅ 允许 |
|
|
45
|
-
| 6:00-17:00 | ✅ 允许 | ✅ 允许 | ✅ 允许 |
|
|
46
|
-
| 17:00-24:00 | ✅ 允许 | ❌ 禁止 | ❌ 禁止 |
|
|
42
|
+
| 时段 | 签到 | 抽奖 | 挖矿 | 探索 |
|
|
43
|
+
| --- | --- | --- | --- | --- |
|
|
44
|
+
| 0:00-6:00 | ✅ 允许 | ✅ 允许 | ✅ 允许 | ✅ 允许 |
|
|
45
|
+
| 6:00-17:00 | ✅ 允许 | ✅ 允许 | ✅ 允许 | ✅ 允许 |
|
|
46
|
+
| 17:00-24:00 | ✅ 允许 | ❌ 禁止 | ❌ 禁止 | ❌ 禁止 |
|
|
47
47
|
|
|
48
48
|
### 腾讯文档(封禁记录查询)
|
|
49
49
|
|
|
@@ -102,8 +102,9 @@ npm install koishi-plugin-ggcevo
|
|
|
102
102
|
|
|
103
103
|
| 指令 | 别名 | 权限 | 说明 |
|
|
104
104
|
| --- | --- | --- | --- |
|
|
105
|
-
| `签到` | — | — |
|
|
105
|
+
| `签到` | — | — | 每日签到,获取奖励并发放签到券/补签券等。每月首次签到时,若签到者的游戏句柄匹配管理员福利文档记录,额外发放 50 咕咕币津贴(仅校验句柄) |
|
|
106
106
|
| `挖矿` | — | — | 领取挂机挖矿收益(咕咕之战玩法)。每半小时收益 4 金币,单次存储上限 24 小时,领取后立即进入下一轮挖矿。累计挖矿总时长与累计收益金币数会被记录统计。受宵禁影响:17:00-24:00 禁止领取 |
|
|
107
|
+
| `探索` | — | — | 选择星系进行 12 小时探索,结束后领取收益(咕咕之战玩法)。星系:天枢(成功率100%,成功80金币)、赤潮(成功率60%,成功120金币/失败60金币)、千帆(成功率80%,成功50金币/失败25金币,成功时独立概率获得补签券×1(10%)、咕咕币1-3枚(50%),失败无道具)。金币/道具发放到背包,按星系累计统计探索次数/成功次数/累计金币。受宵禁影响:17:00-24:00 禁止 |
|
|
107
108
|
| `兑换 <name>` | — | — | 使用兑换券兑换指定物品。消耗兑换券数量随物品品质而定(T3皮肤=3、T2=4、T1=5、T3宠物=3、T2=4、T1=5、T0宠物=6、入场特效=5、角色冠名权=10、赎罪券=2)。兑换成功后会提示登记(若配置了 `exchangeAdminName`,则提示向该活动管理员私聊登记) |
|
|
108
109
|
| `抽奖` | — | — | 抽奖。选项:`-p <poolId>` 奖池ID,`-c <count>` 抽奖次数。各池消耗:金币池=100金币/次、普通池=1咕咕币/次、皮肤池/宠物池=3兑换券/次 |
|
|
109
110
|
| `背包` | — | — | 查看自己的物品背包 |
|
|
@@ -166,9 +167,28 @@ npm install koishi-plugin-ggcevo
|
|
|
166
167
|
- `ggcevo_ban_record` — 封禁记录(主键 `id` 自增,对应文档行号 `id+1`,每小时全量同步)
|
|
167
168
|
- `ggcevo_admin_welfare` — 管理员福利(主键 `id` 自增,对应文档行号 `id+1`,每小时全量同步;A列QQ号/B列句柄)
|
|
168
169
|
- `ggcevo_mining` — 挖矿状态与累计统计(主键 `user_id`,复用句柄标识;含本轮开始时间 `start_time`、累计挖矿时长 `total_minutes`、累计收益金币 `total_coins`)
|
|
170
|
+
- `ggcevo_explore` — 探索状态(主键 `user_id`,复用句柄标识;含当前星系 `galaxy_id`、本轮开始时间 `start_time`)
|
|
171
|
+
- `ggcevo_explore_stats` — 探索统计(复合主键 `user_id` + `galaxy_id`;含探索次数 `total_count`、成功次数 `success_count`、失败次数 `fail_count`、累计获得金币 `total_coins`)
|
|
169
172
|
|
|
170
173
|
## 更新日志
|
|
171
174
|
|
|
175
|
+
### v1.1.9
|
|
176
|
+
|
|
177
|
+
新增星系探索玩法(咕咕之战)。
|
|
178
|
+
|
|
179
|
+
- **新增探索功能**:`探索` 指令先选择星系,进行为期 12 小时的探索,满 12 小时后再次调用指令领取收益,领取后清除本轮记录可重新选择星系。
|
|
180
|
+
- **天枢星系**:成功率 100%,成功获得 80 金币,无道具
|
|
181
|
+
- **赤潮星系**:成功率 60%,成功获得 120 金币,失败仅获得 60 金币,无道具
|
|
182
|
+
- **千帆星系**:成功率 80%,成功获得 50 金币,失败仅获得 25 金币;成功时独立概率掉落补签券×1(10%)、咕咕币 1-3 枚(50%),失败无任何道具
|
|
183
|
+
- **统计入库**:按星系累计统计探索次数、成功次数、失败次数与累计获得金币(`ggcevo_explore_stats` 表),领取时随消息展示,暂无独立输出指令
|
|
184
|
+
- **宵禁覆盖**:探索为咕咕之战玩法指令,受宵禁影响(17:00-24:00 禁止,签到不受影响),宵禁时段说明表新增探索列
|
|
185
|
+
|
|
186
|
+
### v1.1.8
|
|
187
|
+
|
|
188
|
+
签到管理员福利津贴改为仅校验句柄。
|
|
189
|
+
|
|
190
|
+
- **津贴判断简化**:每月首次签到发放 50 咕咕币津贴时,不再要求 QQ 号与句柄同时匹配管理员福利文档记录,**仅校验游戏句柄**匹配即可。
|
|
191
|
+
|
|
172
192
|
### v1.1.7
|
|
173
193
|
|
|
174
194
|
新增活动兑换管理员登记提醒。
|