koishi-plugin-ggcevo-game 1.3.30 → 1.3.31
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 +7 -0
- package/lib/index.js +176 -28
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -41,6 +41,7 @@ declare module 'koishi' {
|
|
|
41
41
|
ggcevo_warehouse: warehouse;
|
|
42
42
|
ggcevo_tech: tech;
|
|
43
43
|
ggcevo_Mining: Mining;
|
|
44
|
+
ggcevo_task: task;
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
47
|
export interface backpack {
|
|
@@ -189,4 +190,10 @@ export interface Mining {
|
|
|
189
190
|
handle: string;
|
|
190
191
|
startTime: Date;
|
|
191
192
|
}
|
|
193
|
+
export interface task {
|
|
194
|
+
handle: string;
|
|
195
|
+
taskId: number;
|
|
196
|
+
progress: number;
|
|
197
|
+
Completions: number;
|
|
198
|
+
}
|
|
192
199
|
export declare function apply(ctx: Context, config: Config): void;
|
package/lib/index.js
CHANGED
|
@@ -284,6 +284,14 @@ function apply(ctx, config) {
|
|
|
284
284
|
}, {
|
|
285
285
|
primary: "handle"
|
|
286
286
|
});
|
|
287
|
+
ctx.model.extend("ggcevo_task", {
|
|
288
|
+
handle: "string",
|
|
289
|
+
taskId: "unsigned",
|
|
290
|
+
progress: "unsigned",
|
|
291
|
+
Completions: "unsigned"
|
|
292
|
+
}, {
|
|
293
|
+
primary: ["handle", "taskId"]
|
|
294
|
+
});
|
|
287
295
|
const weaponConfig = {
|
|
288
296
|
// 武器配置
|
|
289
297
|
"高斯步枪": {
|
|
@@ -631,11 +639,11 @@ function apply(ctx, config) {
|
|
|
631
639
|
},
|
|
632
640
|
"吸血唾液": {
|
|
633
641
|
effect: 0,
|
|
634
|
-
description: "受到攻击将会获得一层“吸血”,每层“吸血”提供5%的减伤(至多
|
|
642
|
+
description: "受到攻击将会获得一层“吸血”,每层“吸血”提供5%的减伤(至多20层)"
|
|
635
643
|
},
|
|
636
644
|
"进食": {
|
|
637
645
|
effect: 0,
|
|
638
|
-
description: "当“吸血”达到
|
|
646
|
+
description: "当“吸血”达到20层后,下一次受到攻击将会消耗所有层数回复自身20%的最大生命值"
|
|
639
647
|
},
|
|
640
648
|
"嗜血狂暴": {
|
|
641
649
|
effect: 0,
|
|
@@ -643,7 +651,7 @@ function apply(ctx, config) {
|
|
|
643
651
|
},
|
|
644
652
|
"吐血": {
|
|
645
653
|
effect: 0,
|
|
646
|
-
description: "当无“吸血”层数时,受到的伤害+
|
|
654
|
+
description: "当无“吸血”层数时,受到的伤害+20%"
|
|
647
655
|
},
|
|
648
656
|
"辐射": {
|
|
649
657
|
effect: 0,
|
|
@@ -956,19 +964,19 @@ function apply(ctx, config) {
|
|
|
956
964
|
level: 3,
|
|
957
965
|
cost: 2950,
|
|
958
966
|
description: "提高挖矿效率,每日签到金币奖励+15%",
|
|
959
|
-
careerBonus: "深空矿工/情报副官: 每日签到金币奖励+30%;
|
|
967
|
+
careerBonus: "深空矿工/情报副官: 每日签到金币奖励+30%; 解锁太空“挖矿”权限; 建造矿骡协同挖矿,效率提高20%"
|
|
960
968
|
},
|
|
961
969
|
{
|
|
962
970
|
level: 4,
|
|
963
971
|
cost: 4250,
|
|
964
972
|
description: "提高挖矿效率,每日签到金币奖励+20%",
|
|
965
|
-
careerBonus: "深空矿工/情报副官: 每日签到金币奖励+40%; 解锁太空“挖矿”权限; 建造矿骡协同挖矿,效率提高
|
|
973
|
+
careerBonus: "深空矿工/情报副官: 每日签到金币奖励+40%; 解锁太空“挖矿”权限; 建造矿骡协同挖矿,效率提高40%"
|
|
966
974
|
},
|
|
967
975
|
{
|
|
968
976
|
level: 5,
|
|
969
977
|
cost: 5375,
|
|
970
978
|
description: "提高挖矿效率,每日签到金币奖励+25%",
|
|
971
|
-
careerBonus: "深空矿工/情报副官: 每日签到金币奖励+50%; 解锁太空“挖矿”权限; 建造矿骡协同挖矿,效率提高
|
|
979
|
+
careerBonus: "深空矿工/情报副官: 每日签到金币奖励+50%; 解锁太空“挖矿”权限; 建造矿骡协同挖矿,效率提高60%,并且单次挖矿时间上限增加至48小时"
|
|
972
980
|
}
|
|
973
981
|
]
|
|
974
982
|
},
|
|
@@ -1032,6 +1040,17 @@ function apply(ctx, config) {
|
|
|
1032
1040
|
]
|
|
1033
1041
|
}
|
|
1034
1042
|
];
|
|
1043
|
+
const Tasklist = {
|
|
1044
|
+
"成人之美": {
|
|
1045
|
+
id: 1,
|
|
1046
|
+
type: "可重复任务",
|
|
1047
|
+
description: "每一个成功人士的背后总有默默付出的辅助,而你,我的朋友,理应获得补助",
|
|
1048
|
+
target: 2,
|
|
1049
|
+
price: 100,
|
|
1050
|
+
redCrystalCost: 0,
|
|
1051
|
+
condition: "使用伽马枪攻击异形并成功使辐射层数+1"
|
|
1052
|
+
}
|
|
1053
|
+
};
|
|
1035
1054
|
async function calculateTotalDamage(ctx2, session, equippedWeapon, targetBoss, options) {
|
|
1036
1055
|
let effectMessage = [];
|
|
1037
1056
|
const finalTags = options?.customTags || targetBoss.tags || [];
|
|
@@ -1669,8 +1688,8 @@ function apply(ctx, config) {
|
|
|
1669
1688
|
messages.push(`🔥 【嗜血狂暴】生效:血量低于50%,进入狂暴状态,受到的伤害-20%`);
|
|
1670
1689
|
}
|
|
1671
1690
|
if (targetBoss.skills.includes("吐血") && bloodStacks < 1) {
|
|
1672
|
-
damageMultiplier += 0.
|
|
1673
|
-
messages.push(`💔 【吐血】生效:无“吸血”层数,受到的伤害+
|
|
1691
|
+
damageMultiplier += 0.2;
|
|
1692
|
+
messages.push(`💔 【吐血】生效:无“吸血”层数,受到的伤害+20%`);
|
|
1674
1693
|
}
|
|
1675
1694
|
return { damageMultiplier, messages };
|
|
1676
1695
|
}, "handleBloodEffects"),
|
|
@@ -1682,7 +1701,7 @@ function apply(ctx, config) {
|
|
|
1682
1701
|
let updatedHP = currentHP;
|
|
1683
1702
|
let newStacks;
|
|
1684
1703
|
const oldStacks = targetBoss.Skillcountpoints || 0;
|
|
1685
|
-
if (oldStacks >=
|
|
1704
|
+
if (oldStacks >= 20 && targetBoss.skills.includes("进食")) {
|
|
1686
1705
|
const heal = Math.floor(maxHP * 0.2);
|
|
1687
1706
|
updatedHP = Math.min(currentHP + heal, maxHP);
|
|
1688
1707
|
await ctx2.database.set("ggcevo_boss", { name: targetBoss.name }, { Skillcountpoints: 0 });
|
|
@@ -1697,8 +1716,8 @@ function apply(ctx, config) {
|
|
|
1697
1716
|
newStacks += 1;
|
|
1698
1717
|
messages.push(`🔥 【嗜血狂暴】生效:额外获得1层“吸血”`);
|
|
1699
1718
|
}
|
|
1700
|
-
newStacks = Math.min(newStacks,
|
|
1701
|
-
if (oldStacks <
|
|
1719
|
+
newStacks = Math.min(newStacks, 20);
|
|
1720
|
+
if (oldStacks < 20 && newStacks >= 20) {
|
|
1702
1721
|
messages.push(`🩸 “吸血”层数达到${newStacks},下次受到攻击将触发【进食】`);
|
|
1703
1722
|
}
|
|
1704
1723
|
await ctx2.database.set("ggcevo_boss", { name: targetBoss.name }, { Skillcountpoints: newStacks });
|
|
@@ -1710,21 +1729,24 @@ function apply(ctx, config) {
|
|
|
1710
1729
|
return null;
|
|
1711
1730
|
}
|
|
1712
1731
|
const messages = [];
|
|
1732
|
+
let radiationApplied = false;
|
|
1713
1733
|
const hasRadiation = targetBoss.skills.includes("辐射");
|
|
1714
1734
|
const currentLayers = targetBoss.Vulnerability || 0;
|
|
1715
1735
|
const skillUpdates = [];
|
|
1716
1736
|
const newLayers = hasRadiation ? Math.min(currentLayers + 1, 100) : 1;
|
|
1717
1737
|
let layerMsg;
|
|
1718
1738
|
if (!hasRadiation) {
|
|
1719
|
-
layerMsg = `☢️ ${targetBoss.name}
|
|
1739
|
+
layerMsg = `☢️ ${targetBoss.name} 获得【辐射】效果(初始层数1)`;
|
|
1720
1740
|
skillUpdates.push({
|
|
1721
1741
|
name: targetBoss.name,
|
|
1722
1742
|
add: ["辐射"]
|
|
1723
1743
|
});
|
|
1744
|
+
radiationApplied = true;
|
|
1724
1745
|
} else if (newLayers === currentLayers) {
|
|
1725
1746
|
layerMsg = `☢️ 辐射层数已达上限(100层)`;
|
|
1726
1747
|
} else {
|
|
1727
1748
|
layerMsg = `☢️ 辐射层数+1`;
|
|
1749
|
+
radiationApplied = true;
|
|
1728
1750
|
}
|
|
1729
1751
|
await ctx2.database.set(
|
|
1730
1752
|
"ggcevo_boss",
|
|
@@ -1734,7 +1756,12 @@ function apply(ctx, config) {
|
|
|
1734
1756
|
}
|
|
1735
1757
|
);
|
|
1736
1758
|
messages.push(layerMsg);
|
|
1737
|
-
return {
|
|
1759
|
+
return {
|
|
1760
|
+
messages,
|
|
1761
|
+
skillUpdates,
|
|
1762
|
+
radiationApplied
|
|
1763
|
+
// 返回辐射应用标志
|
|
1764
|
+
};
|
|
1738
1765
|
}, "handleGammaRadiation"),
|
|
1739
1766
|
// 伽马枪辐射计算(返回增伤系数)
|
|
1740
1767
|
calculateRadiationDamage: /* @__PURE__ */ __name((targetBoss) => {
|
|
@@ -1751,6 +1778,7 @@ function apply(ctx, config) {
|
|
|
1751
1778
|
let messages = [];
|
|
1752
1779
|
let skillUpdates = [];
|
|
1753
1780
|
let totalMultiplier = 0;
|
|
1781
|
+
let radiationApplied = false;
|
|
1754
1782
|
const frostEvoResult = this.handleFrostEvolution(targetBoss, weaponName, initialDamage, maxHP);
|
|
1755
1783
|
if (frostEvoResult) {
|
|
1756
1784
|
return {
|
|
@@ -1769,9 +1797,6 @@ function apply(ctx, config) {
|
|
|
1769
1797
|
initialDamage: 0
|
|
1770
1798
|
};
|
|
1771
1799
|
}
|
|
1772
|
-
if (currentHP <= 0 && !targetBoss.skills.includes("求生本能I") && !targetBoss.skills.includes("求生本能II")) {
|
|
1773
|
-
return { currentHP, messages: [], skillUpdates: [], initialDamage };
|
|
1774
|
-
}
|
|
1775
1800
|
targetBoss.skills.forEach((skill) => {
|
|
1776
1801
|
const config2 = passiveConfig[skill];
|
|
1777
1802
|
if (config2 && config2.effect !== void 0 && config2.effect !== 0) {
|
|
@@ -1801,14 +1826,16 @@ function apply(ctx, config) {
|
|
|
1801
1826
|
messages.push(...radiationCalc.messages);
|
|
1802
1827
|
}
|
|
1803
1828
|
const originalMultiplier = totalMultiplier;
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
messages.push(`⚠️ 减伤效果已达上限(99%)`);
|
|
1829
|
+
if (originalMultiplier < -1) {
|
|
1830
|
+
messages.push(`⚠️ 触发伤害保底机制:强制造成1点伤害`);
|
|
1807
1831
|
}
|
|
1808
1832
|
let finalDamage = initialDamage * (1 + totalMultiplier);
|
|
1809
1833
|
finalDamage = Math.floor(finalDamage);
|
|
1810
1834
|
finalDamage = Math.max(finalDamage, 1);
|
|
1811
1835
|
currentHP = targetBoss.HP - finalDamage;
|
|
1836
|
+
if (currentHP <= 0 && !targetBoss.skills.includes("求生本能I") && !targetBoss.skills.includes("求生本能II")) {
|
|
1837
|
+
return { currentHP, messages: [], skillUpdates: [], initialDamage };
|
|
1838
|
+
}
|
|
1812
1839
|
const frostSurroundResult = await this.handleFrostSurround(ctx2, targetBoss, currentHP, maxHP);
|
|
1813
1840
|
if (frostSurroundResult) {
|
|
1814
1841
|
currentHP = frostSurroundResult.updatedHP;
|
|
@@ -1848,12 +1875,15 @@ function apply(ctx, config) {
|
|
|
1848
1875
|
if (gammaRadResult) {
|
|
1849
1876
|
messages.push(...gammaRadResult.messages);
|
|
1850
1877
|
skillUpdates.push(...gammaRadResult.skillUpdates);
|
|
1878
|
+
radiationApplied = gammaRadResult.radiationApplied;
|
|
1851
1879
|
}
|
|
1852
1880
|
return {
|
|
1853
1881
|
currentHP,
|
|
1854
1882
|
messages,
|
|
1855
1883
|
skillUpdates,
|
|
1856
|
-
initialDamage: finalDamage
|
|
1884
|
+
initialDamage: finalDamage,
|
|
1885
|
+
radiationApplied
|
|
1886
|
+
// 新增返回辐射应用标记
|
|
1857
1887
|
};
|
|
1858
1888
|
}, "handlePassives"),
|
|
1859
1889
|
// 应用技能更新到数据库(优化合并同名boss的更新)
|
|
@@ -4649,6 +4679,7 @@ ${validTypes.join("、")}`;
|
|
|
4649
4679
|
let initialDamage = Math.min(damage, targetBoss.HP);
|
|
4650
4680
|
let currentHP = targetBoss.HP - initialDamage;
|
|
4651
4681
|
let passiveMessages = [];
|
|
4682
|
+
let radiationApplied;
|
|
4652
4683
|
const passiveResult = await PassiveHandler.handlePassives(
|
|
4653
4684
|
ctx,
|
|
4654
4685
|
targetBoss,
|
|
@@ -4663,6 +4694,7 @@ ${validTypes.join("、")}`;
|
|
|
4663
4694
|
currentHP = passiveResult.currentHP;
|
|
4664
4695
|
initialDamage = passiveResult.initialDamage;
|
|
4665
4696
|
passiveMessages.push(...passiveResult.messages);
|
|
4697
|
+
radiationApplied = passiveResult.radiationApplied;
|
|
4666
4698
|
if (passiveResult.skillUpdates.length > 0) {
|
|
4667
4699
|
await PassiveHandler.applySkillUpdates(ctx, passiveResult.skillUpdates);
|
|
4668
4700
|
}
|
|
@@ -4681,6 +4713,15 @@ ${validTypes.join("、")}`;
|
|
|
4681
4713
|
attackCount: (existingRecord?.attackCount || 0) + 1,
|
|
4682
4714
|
lastattackDate: /* @__PURE__ */ new Date()
|
|
4683
4715
|
}], ["handle"]);
|
|
4716
|
+
const [RadiationRecord] = await ctx.database.get("ggcevo_task", {
|
|
4717
|
+
handle,
|
|
4718
|
+
taskId: 1
|
|
4719
|
+
});
|
|
4720
|
+
await ctx.database.upsert("ggcevo_task", [{
|
|
4721
|
+
handle,
|
|
4722
|
+
taskId: 1,
|
|
4723
|
+
progress: (RadiationRecord?.progress || 0) + 1
|
|
4724
|
+
}], ["handle"]);
|
|
4684
4725
|
if (isDefeated) {
|
|
4685
4726
|
if (targetBoss.type === "主宰") {
|
|
4686
4727
|
await ctx.database.set(
|
|
@@ -5633,7 +5674,7 @@ ${Spacestationtechnology.map((t) => t.techname).join("、")}`;
|
|
|
5633
5674
|
startTime: /* @__PURE__ */ new Date()
|
|
5634
5675
|
// 记录当前时间为开始时间
|
|
5635
5676
|
});
|
|
5636
|
-
return "⛏️
|
|
5677
|
+
return "⛏️ 首次挖矿作业已开始,等待至少1小时后可收获。";
|
|
5637
5678
|
}
|
|
5638
5679
|
const nowtime = /* @__PURE__ */ new Date();
|
|
5639
5680
|
const chinaStart = convertUTCtoChinaTime(record.startTime);
|
|
@@ -5654,14 +5695,18 @@ ${Spacestationtechnology.map((t) => t.techname).join("、")}`;
|
|
|
5654
5695
|
const halfHours = Math.floor(duration / 30);
|
|
5655
5696
|
let base = halfHours * 6;
|
|
5656
5697
|
base = Math.round(base);
|
|
5657
|
-
|
|
5698
|
+
const maxHalfHours = tech.level === 5 ? 96 : 48;
|
|
5699
|
+
base = Math.min(base, maxHalfHours * 6);
|
|
5658
5700
|
let multiplier = 0;
|
|
5659
5701
|
switch (tech.level) {
|
|
5702
|
+
case 3:
|
|
5703
|
+
multiplier = 0.2;
|
|
5704
|
+
break;
|
|
5660
5705
|
case 4:
|
|
5661
|
-
multiplier = 0.
|
|
5706
|
+
multiplier = 0.4;
|
|
5662
5707
|
break;
|
|
5663
5708
|
case 5:
|
|
5664
|
-
multiplier = 0.
|
|
5709
|
+
multiplier = 0.6;
|
|
5665
5710
|
break;
|
|
5666
5711
|
}
|
|
5667
5712
|
const total = Math.round(base * (1 + multiplier));
|
|
@@ -5686,20 +5731,123 @@ ${Spacestationtechnology.map((t) => t.techname).join("、")}`;
|
|
|
5686
5731
|
`⏱️ 结束时间:${nowtime.toLocaleString("zh-CN", { hour12: false })}`,
|
|
5687
5732
|
`⏳ 持续时间:${formatTime(duration)}`
|
|
5688
5733
|
];
|
|
5689
|
-
|
|
5690
|
-
|
|
5734
|
+
const maxHours = tech.level === 5 ? 48 : 24;
|
|
5735
|
+
if (duration > maxHours * 60) {
|
|
5736
|
+
reportLines.push(`⚠️ 注意:收益已在${maxHours}小时达到上限`);
|
|
5691
5737
|
}
|
|
5692
5738
|
let rewardLine = `💰 实际获得:${total}金币`;
|
|
5693
|
-
if (tech.level >=
|
|
5739
|
+
if (tech.level >= 3) {
|
|
5694
5740
|
rewardLine += ` (基础值:${base}金币)`;
|
|
5695
5741
|
}
|
|
5696
5742
|
reportLines.push(rewardLine);
|
|
5697
|
-
if (tech.level >=
|
|
5743
|
+
if (tech.level >= 3) {
|
|
5698
5744
|
reportLines.push(`🔧 挖矿系统 Lv.${tech.level}:金币+${multiplier * 100}%`);
|
|
5699
5745
|
}
|
|
5700
5746
|
reportLines.push("💡 已自动开始下一轮挖矿");
|
|
5701
5747
|
return reportLines.join("\n");
|
|
5702
5748
|
});
|
|
5749
|
+
ctx.command("ggcevo/任务 [name]").usage('输入"任务"查看所有任务列表,或"任务 任务名称"查看详细任务信息').action(async ({ session }, name2) => {
|
|
5750
|
+
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
5751
|
+
if (!profile) return "⚠️ 需要先绑定游戏句柄";
|
|
5752
|
+
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
5753
|
+
if (!name2) {
|
|
5754
|
+
const taskList = [];
|
|
5755
|
+
for (const [taskName, task2] of Object.entries(Tasklist)) {
|
|
5756
|
+
const [playerTask2] = await ctx.database.get("ggcevo_task", {
|
|
5757
|
+
handle,
|
|
5758
|
+
taskId: task2.id
|
|
5759
|
+
}).catch(() => [null]);
|
|
5760
|
+
const completionStatus = playerTask2 ? `进度: ${playerTask2.progress}/${task2.target}` : "尚未开始";
|
|
5761
|
+
taskList.push([
|
|
5762
|
+
`▸ 【${taskName}】`,
|
|
5763
|
+
`类型: ${task2.type}`,
|
|
5764
|
+
`目标: ${task2.target}次`,
|
|
5765
|
+
`奖励: ${task2.price}金币`,
|
|
5766
|
+
`状态: ${completionStatus}`
|
|
5767
|
+
].join("\n"));
|
|
5768
|
+
}
|
|
5769
|
+
return [
|
|
5770
|
+
"📋 任务列表",
|
|
5771
|
+
'使用"任务 任务名称"查看详细任务信息',
|
|
5772
|
+
"====================",
|
|
5773
|
+
...taskList,
|
|
5774
|
+
"===================="
|
|
5775
|
+
].join("\n\n");
|
|
5776
|
+
}
|
|
5777
|
+
const task = Object.entries(Tasklist).find(
|
|
5778
|
+
([taskName]) => taskName === name2
|
|
5779
|
+
)?.[1];
|
|
5780
|
+
if (!task) return "⚠️ 未找到该任务,请检查任务名称是否正确";
|
|
5781
|
+
const [playerTask] = await ctx.database.get("ggcevo_task", {
|
|
5782
|
+
handle,
|
|
5783
|
+
taskId: task.id
|
|
5784
|
+
}).catch(() => [null]);
|
|
5785
|
+
const progress = playerTask ? playerTask.progress : 0;
|
|
5786
|
+
const completions = playerTask ? playerTask.Completions : 0;
|
|
5787
|
+
return [
|
|
5788
|
+
`📝 任务详情: ${name2}`,
|
|
5789
|
+
"====================",
|
|
5790
|
+
`任务名称: ${name2}`,
|
|
5791
|
+
`任务类型: ${task.type}`,
|
|
5792
|
+
`任务目标: ${task.target}次`,
|
|
5793
|
+
`任务奖励: ${task.price}金币`,
|
|
5794
|
+
`当前进度: ${progress}/${task.target}`,
|
|
5795
|
+
`累计完成: ${completions}次`,
|
|
5796
|
+
"-------------------",
|
|
5797
|
+
"任务描述:",
|
|
5798
|
+
task.description,
|
|
5799
|
+
"-------------------",
|
|
5800
|
+
"完成条件:",
|
|
5801
|
+
task.condition,
|
|
5802
|
+
"====================",
|
|
5803
|
+
`📌 使用"完成任务 ${name2}"领取奖励`
|
|
5804
|
+
].join("\n");
|
|
5805
|
+
});
|
|
5806
|
+
ctx.command("ggcevo/完成任务 <name:text>", "完成指定任务领取奖励").usage('输入"完成任务 任务名称"来完成任务并领取奖励').action(async ({ session }, name2) => {
|
|
5807
|
+
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
5808
|
+
if (!profile) return "⚠️ 需要先绑定游戏句柄";
|
|
5809
|
+
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
5810
|
+
if (await ctx.database.get("ggcevo_blacklist", { handle }).then((r) => r.length)) {
|
|
5811
|
+
return "⛔ 您已被列入黑名单";
|
|
5812
|
+
}
|
|
5813
|
+
const taskEntry = Object.entries(Tasklist).find(
|
|
5814
|
+
([taskName2]) => taskName2.includes(name2)
|
|
5815
|
+
);
|
|
5816
|
+
if (!name2) return "请输入“完成任务 任务名称”领取任务奖励";
|
|
5817
|
+
if (!taskEntry) return `⚠️ 未找到名称包含"${name2}"的任务`;
|
|
5818
|
+
const [taskName, taskConfig] = taskEntry;
|
|
5819
|
+
const [taskData] = await ctx.database.get("ggcevo_task", {
|
|
5820
|
+
handle,
|
|
5821
|
+
taskId: taskConfig.id
|
|
5822
|
+
});
|
|
5823
|
+
if (!taskData) return `⚠️ 您尚未开始"${taskName}"任务`;
|
|
5824
|
+
if (taskData.progress < taskConfig.target) {
|
|
5825
|
+
return `⚠️ 任务进度不足!当前进度:${taskData.progress}/${taskConfig.target}`;
|
|
5826
|
+
}
|
|
5827
|
+
const newProgress = taskData.progress - taskConfig.target;
|
|
5828
|
+
const newCompletions = taskData.Completions + 1;
|
|
5829
|
+
await ctx.database.set("ggcevo_task", {
|
|
5830
|
+
handle,
|
|
5831
|
+
taskId: taskConfig.id
|
|
5832
|
+
}, {
|
|
5833
|
+
progress: newProgress,
|
|
5834
|
+
Completions: newCompletions
|
|
5835
|
+
});
|
|
5836
|
+
const [signData] = await ctx.database.get("ggcevo_sign", { handle });
|
|
5837
|
+
await ctx.database.upsert("ggcevo_sign", [{
|
|
5838
|
+
handle,
|
|
5839
|
+
totalRewards: (signData?.totalRewards || 0) + taskConfig.price
|
|
5840
|
+
}], ["handle"]);
|
|
5841
|
+
const [updatedSignData] = await ctx.database.get("ggcevo_sign", { handle });
|
|
5842
|
+
return [
|
|
5843
|
+
`🎉 恭喜您成功完成【${taskName}】任务!`,
|
|
5844
|
+
`任务奖励:${taskConfig.price}金币`,
|
|
5845
|
+
`累计完成次数:${newCompletions}次`,
|
|
5846
|
+
`剩余进度点数:${newProgress}`,
|
|
5847
|
+
`当前拥有金币:${updatedSignData.totalRewards}`,
|
|
5848
|
+
newProgress >= taskConfig.target ? `💡 当前剩余进度可再完成${Math.floor(newProgress / taskConfig.target)}次任务` : ``
|
|
5849
|
+
].join("\n");
|
|
5850
|
+
});
|
|
5703
5851
|
}
|
|
5704
5852
|
__name(apply, "apply");
|
|
5705
5853
|
function simpleDraw() {
|