koishi-plugin-ggcevo-game 1.3.46 → 1.3.47
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.js +98 -28
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -500,6 +500,14 @@ function apply(ctx, config) {
|
|
|
500
500
|
price: 75,
|
|
501
501
|
redCrystalCost: 0,
|
|
502
502
|
effects: "对目标使用后,消耗其500点能量"
|
|
503
|
+
},
|
|
504
|
+
"MP3播放器": {
|
|
505
|
+
id: 5,
|
|
506
|
+
type: "设备工具",
|
|
507
|
+
description: "这是一款未来派音乐设备",
|
|
508
|
+
price: 0,
|
|
509
|
+
redCrystalCost: 10,
|
|
510
|
+
effects: "主动PK对战结果失败时上交给对方的金币-50%"
|
|
503
511
|
}
|
|
504
512
|
};
|
|
505
513
|
const modConfig = {
|
|
@@ -991,11 +999,11 @@ function apply(ctx, config) {
|
|
|
991
999
|
},
|
|
992
1000
|
{
|
|
993
1001
|
professionName: "计算机专家",
|
|
994
|
-
effect: "
|
|
995
|
-
requirements: "",
|
|
996
|
-
Jobtransfer:
|
|
997
|
-
costcoins:
|
|
998
|
-
costredcrystal:
|
|
1002
|
+
effect: "黑市订购设备工具类物品享有50%折扣",
|
|
1003
|
+
requirements: "仓库中拥有一个黑市订购的设备工具类物品",
|
|
1004
|
+
Jobtransfer: true,
|
|
1005
|
+
costcoins: 0,
|
|
1006
|
+
costredcrystal: 40
|
|
999
1007
|
},
|
|
1000
1008
|
{
|
|
1001
1009
|
professionName: "指挥官",
|
|
@@ -2731,6 +2739,17 @@ function apply(ctx, config) {
|
|
|
2731
2739
|
success: signData?.monthlyDays >= 14,
|
|
2732
2740
|
message: `需要当月累计签到14天及以上(当前${signData?.monthlyDays || 0}天)`
|
|
2733
2741
|
};
|
|
2742
|
+
case "计算机专家": {
|
|
2743
|
+
const warehouseItems = await ctx2.database.get("ggcevo_warehouse", { handle });
|
|
2744
|
+
const blackMarketDeviceTools = Object.values(SyndicatedItems).filter((item) => item.type === "设备工具" && item.redCrystalCost > 0).map((item) => item.id);
|
|
2745
|
+
const hasDeviceTool = warehouseItems.some(
|
|
2746
|
+
(item) => blackMarketDeviceTools.includes(item.itemId) && item.quantity > 0
|
|
2747
|
+
);
|
|
2748
|
+
return {
|
|
2749
|
+
success: hasDeviceTool,
|
|
2750
|
+
message: hasDeviceTool ? "" : "需要仓库中拥有一个从黑市订购的设备工具物品"
|
|
2751
|
+
};
|
|
2752
|
+
}
|
|
2734
2753
|
default:
|
|
2735
2754
|
return { success: false, message: "未知职业要求" };
|
|
2736
2755
|
}
|
|
@@ -2803,10 +2822,10 @@ function apply(ctx, config) {
|
|
|
2803
2822
|
message: `成功使用 ${itemName},已重置 ${target} 的技能计数`
|
|
2804
2823
|
};
|
|
2805
2824
|
}
|
|
2806
|
-
if (itemConfig2.id === 3) {
|
|
2825
|
+
if (itemConfig2.id === 3 || itemConfig2.id === 5) {
|
|
2807
2826
|
return {
|
|
2808
2827
|
success: false,
|
|
2809
|
-
message:
|
|
2828
|
+
message: `此物品无法使用,存放于仓库即刻生效。`
|
|
2810
2829
|
};
|
|
2811
2830
|
}
|
|
2812
2831
|
if (itemConfig2.id === 4) {
|
|
@@ -4503,14 +4522,27 @@ ${items.join("、")}
|
|
|
4503
4522
|
const targetGold = targetSign[0]?.totalRewards || 0;
|
|
4504
4523
|
if (initiatorGold < 100) return "发起者需要至少100金币才能发起挑战。";
|
|
4505
4524
|
if (targetGold < 100) return "对方金币不足100,无法应战。";
|
|
4525
|
+
let hasMP3 = false;
|
|
4526
|
+
const [mp3Item] = await ctx.database.get("ggcevo_warehouse", {
|
|
4527
|
+
handle: initiatorHandle,
|
|
4528
|
+
itemId: 5
|
|
4529
|
+
// MP3播放器的物品ID
|
|
4530
|
+
});
|
|
4531
|
+
hasMP3 = mp3Item && mp3Item.quantity > 0;
|
|
4506
4532
|
const powerDiff = initiatorPower - targetPower;
|
|
4507
4533
|
let winRate = 50 + powerDiff / 50 * 0.1;
|
|
4508
4534
|
winRate = Math.min(Math.max(winRate, 5), 95);
|
|
4509
4535
|
const isWin = Math.random() * 100 < winRate;
|
|
4510
|
-
|
|
4511
|
-
|
|
4536
|
+
let stealPercentage = getRandomInt(1, 5);
|
|
4537
|
+
let goldTransfer = Math.floor(
|
|
4512
4538
|
(isWin ? targetGold : initiatorGold) * stealPercentage / 100
|
|
4513
4539
|
);
|
|
4540
|
+
let mp3Effect = false;
|
|
4541
|
+
if (!isWin && hasMP3) {
|
|
4542
|
+
const reducedGold = Math.floor(goldTransfer * 0.5);
|
|
4543
|
+
mp3Effect = true;
|
|
4544
|
+
goldTransfer = reducedGold;
|
|
4545
|
+
}
|
|
4514
4546
|
if ((isWin ? targetGold : initiatorGold) < goldTransfer) {
|
|
4515
4547
|
return `${isWin ? "对方" : "你"}的金币不足以完成交易`;
|
|
4516
4548
|
}
|
|
@@ -4572,13 +4604,16 @@ ${items.join("、")}
|
|
|
4572
4604
|
handle: initiatorHandle
|
|
4573
4605
|
});
|
|
4574
4606
|
const result = [
|
|
4575
|
-
`⚔️【对战结果】${isWin ? "胜利" : "失败"}`,
|
|
4607
|
+
`⚔️【对战结果】${isWin ? "胜利" : "失败"}${mp3Effect ? " (MP3减免)" : ""}`,
|
|
4576
4608
|
`🏅 挑战者:${initiatorRankname}(战斗力 ${initiatorPower})`,
|
|
4577
4609
|
`🛡️ 应战者:${targetRankname}(战斗力 ${targetPower})`,
|
|
4578
4610
|
`📊 胜率预测:${winRate.toFixed(1)}%`,
|
|
4579
4611
|
`🎰 金币变动:${stealPercentage}%`
|
|
4580
4612
|
];
|
|
4581
4613
|
isWin ? result.push(`💰 您从对方的口袋里抢夺了${goldTransfer}枚金币`) : result.push(`💸 您从口袋里拿出了${goldTransfer}枚金币上交给对方`);
|
|
4614
|
+
if (mp3Effect) {
|
|
4615
|
+
result.push(`💿 MP3播放器生效:上缴金币减少50%`);
|
|
4616
|
+
}
|
|
4582
4617
|
initiatorCareer?.group === "辛迪加海盗" ? result.push(`🔴 辛迪加海盗阵营加成:获得1枚红晶`) : "";
|
|
4583
4618
|
result.push(`📅 剩余挑战次数:${config.dailyPKLimit - (initiatorPK.todayCount + 1)}`);
|
|
4584
4619
|
return result.join("\n");
|
|
@@ -4727,10 +4762,10 @@ ${Object.keys(typeStats).join("、")}`;
|
|
|
4727
4762
|
`类型:${config2.type}`,
|
|
4728
4763
|
`基础伤害:${config2.damage}`,
|
|
4729
4764
|
`价格:${actualPrice}金币${totalDiscount > 0 ? ` (原价${config2.price})` : ""}`,
|
|
4730
|
-
"特性:",
|
|
4731
|
-
tagEffectsDesc,
|
|
4732
4765
|
specialEffect,
|
|
4733
4766
|
// 新增特殊效果显示
|
|
4767
|
+
"特性:",
|
|
4768
|
+
tagEffectsDesc,
|
|
4734
4769
|
`描述:${config2.description}`
|
|
4735
4770
|
].filter(Boolean).join("\n");
|
|
4736
4771
|
});
|
|
@@ -5996,6 +6031,7 @@ ${scatterEffectMessages.map((m) => `▸ ${m}`).join("\n")}`
|
|
|
5996
6031
|
if (!careerData || careerData.group !== "辛迪加海盗") {
|
|
5997
6032
|
return "🚫 该功能需要【辛迪加海盗】阵营权限";
|
|
5998
6033
|
}
|
|
6034
|
+
const isComputerExpert = careerData.career === "计算机专家";
|
|
5999
6035
|
const typeStats = {};
|
|
6000
6036
|
Object.values(weaponConfig).filter((config2) => config2.redCrystalCost > 0).forEach((weapon) => {
|
|
6001
6037
|
typeStats[weapon.type] = (typeStats[weapon.type] || 0) + 1;
|
|
@@ -6009,7 +6045,9 @@ ${scatterEffectMessages.map((m) => `▸ ${m}`).join("\n")}`
|
|
|
6009
6045
|
'使用 "黑市 类型名称" 查看详细信息',
|
|
6010
6046
|
"====================",
|
|
6011
6047
|
...Object.entries(typeStats).map(([typeName, count]) => `▸ ${typeName} (${count}种)`),
|
|
6012
|
-
"===================="
|
|
6048
|
+
"====================",
|
|
6049
|
+
// 添加计算机专家提示
|
|
6050
|
+
isComputerExpert ? "💳 计算机专家可享受设备工具类物品50%折扣!" : ""
|
|
6013
6051
|
].join("\n");
|
|
6014
6052
|
}
|
|
6015
6053
|
const normalizedType = Object.keys(typeStats).find((t) => t === type);
|
|
@@ -6021,10 +6059,11 @@ ${scatterEffectMessages.map((m) => `▸ ${m}`).join("\n")}`
|
|
|
6021
6059
|
const infoBlocks = [
|
|
6022
6060
|
`【${name2}】`,
|
|
6023
6061
|
`类型:${config2.type}`,
|
|
6024
|
-
...config2.damage ? [`基础伤害:${config2.damage}`] : [],
|
|
6025
6062
|
`订购价:${config2.redCrystalCost}红晶`
|
|
6026
|
-
// 只显示红晶价格
|
|
6027
6063
|
];
|
|
6064
|
+
if (config2.specialeffect) {
|
|
6065
|
+
infoBlocks.push(`特殊效果:${config2.specialeffect}`);
|
|
6066
|
+
}
|
|
6028
6067
|
if (Object.keys(config2.tagEffects).length > 0) {
|
|
6029
6068
|
const tagEffectsDesc = Object.entries(config2.tagEffects).map(([tag, mul]) => `▸ 对${tag}目标造成${(mul * 100).toFixed(0)}%伤害`).join("\n");
|
|
6030
6069
|
infoBlocks.push("特性:", tagEffectsDesc);
|
|
@@ -6038,24 +6077,36 @@ ${scatterEffectMessages.map((m) => `▸ ${m}`).join("\n")}`
|
|
|
6038
6077
|
...Object.entries(SyndicatedItems).filter(
|
|
6039
6078
|
([_, item]) => item.type === normalizedType && item.redCrystalCost > 0
|
|
6040
6079
|
).map(([name2, item]) => {
|
|
6080
|
+
const finalPrice = isComputerExpert && normalizedType === "设备工具" ? Math.floor(item.redCrystalCost * 0.5) : item.redCrystalCost;
|
|
6041
6081
|
const infoBlocks = [
|
|
6042
6082
|
`【${name2}】`,
|
|
6043
|
-
`类型:${item.type}
|
|
6044
|
-
|
|
6045
|
-
|
|
6046
|
-
|
|
6083
|
+
`类型:${item.type}`
|
|
6084
|
+
];
|
|
6085
|
+
if (isComputerExpert && normalizedType === "设备工具") {
|
|
6086
|
+
infoBlocks.push(
|
|
6087
|
+
`订购价:${finalPrice}红晶 (原价${item.redCrystalCost})`
|
|
6088
|
+
);
|
|
6089
|
+
} else {
|
|
6090
|
+
infoBlocks.push(
|
|
6091
|
+
`订购价:${item.redCrystalCost}红晶`
|
|
6092
|
+
);
|
|
6093
|
+
}
|
|
6094
|
+
infoBlocks.push(
|
|
6095
|
+
`特殊效果:${item.effects}`,
|
|
6047
6096
|
`描述:${item.description}`,
|
|
6048
6097
|
"──────────────"
|
|
6049
|
-
|
|
6098
|
+
);
|
|
6050
6099
|
return infoBlocks.join("\n");
|
|
6051
6100
|
})
|
|
6052
6101
|
];
|
|
6053
6102
|
return [
|
|
6054
6103
|
`🏴☠️ 辛迪加黑市 - ${normalizedType} 🏴☠️`,
|
|
6055
6104
|
"使用“订购 物品名称”进行购买(仅消耗红晶)",
|
|
6105
|
+
// 计算机专家专属提示
|
|
6106
|
+
isComputerExpert && normalizedType === "设备工具" ? "💳 计算机专家可享受50%折扣!" : "",
|
|
6056
6107
|
"====================",
|
|
6057
6108
|
...items
|
|
6058
|
-
].join("\n\n");
|
|
6109
|
+
].filter(Boolean).join("\n\n");
|
|
6059
6110
|
});
|
|
6060
6111
|
ctx.command("ggcevo/订购 <item>").action(async ({ session }, item) => {
|
|
6061
6112
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
@@ -6074,6 +6125,19 @@ ${scatterEffectMessages.map((m) => `▸ ${m}`).join("\n")}`
|
|
|
6074
6125
|
if (!isWeapon && !isSyndicatedItem) return "❌ 无效物品名称";
|
|
6075
6126
|
const itemConfig2 = isWeapon ? weaponConfig[item] : SyndicatedItems[item];
|
|
6076
6127
|
if (!itemConfig2.redCrystalCost) return "⛔ 该物品不可订购";
|
|
6128
|
+
let isComputerExpertDiscount = false;
|
|
6129
|
+
let originalPrice = itemConfig2.redCrystalCost;
|
|
6130
|
+
let finalCost = originalPrice;
|
|
6131
|
+
let discountApplied = false;
|
|
6132
|
+
if (!isWeapon && itemConfig2.type === "设备工具" && careerData.career === "计算机专家") {
|
|
6133
|
+
finalCost = Math.floor(originalPrice * 0.5);
|
|
6134
|
+
isComputerExpertDiscount = true;
|
|
6135
|
+
discountApplied = true;
|
|
6136
|
+
}
|
|
6137
|
+
if ((careerData.redcrystal || 0) < finalCost) {
|
|
6138
|
+
const discountMessage = isComputerExpertDiscount ? `(原价${originalPrice})` : "";
|
|
6139
|
+
return `❌ 红晶不足!需要:${finalCost}${discountMessage} 当前拥有红晶:${careerData.redcrystal}`;
|
|
6140
|
+
}
|
|
6077
6141
|
if (isWeapon) {
|
|
6078
6142
|
const existing = await ctx.database.get("ggcevo_equipment", {
|
|
6079
6143
|
handle,
|
|
@@ -6081,13 +6145,9 @@ ${scatterEffectMessages.map((m) => `▸ ${m}`).join("\n")}`
|
|
|
6081
6145
|
});
|
|
6082
6146
|
if (existing.length) return "您已经拥有该武器。";
|
|
6083
6147
|
}
|
|
6084
|
-
const requiredRed = itemConfig2.redCrystalCost;
|
|
6085
|
-
if ((careerData.redcrystal || 0) < requiredRed) {
|
|
6086
|
-
return `❌ 红晶不足!需要:${requiredRed} 当前:${careerData.redcrystal}`;
|
|
6087
|
-
}
|
|
6088
6148
|
await ctx.database.withTransaction(async () => {
|
|
6089
6149
|
await ctx.database.set("ggcevo_careers", { handle }, {
|
|
6090
|
-
redcrystal: careerData.redcrystal -
|
|
6150
|
+
redcrystal: careerData.redcrystal - finalCost
|
|
6091
6151
|
});
|
|
6092
6152
|
if (isWeapon) {
|
|
6093
6153
|
await ctx.database.create("ggcevo_equipment", {
|
|
@@ -6118,6 +6178,11 @@ ${scatterEffectMessages.map((m) => `▸ ${m}`).join("\n")}`
|
|
|
6118
6178
|
}], ["handle", "itemId"]);
|
|
6119
6179
|
}
|
|
6120
6180
|
});
|
|
6181
|
+
let discountInfo = "";
|
|
6182
|
+
if (discountApplied) {
|
|
6183
|
+
discountInfo = `
|
|
6184
|
+
💳 计算机专家职业加成:设备工具类物品50%折扣`;
|
|
6185
|
+
}
|
|
6121
6186
|
if (isWeapon) {
|
|
6122
6187
|
const equippedStatus = await ctx.database.get("ggcevo_equipment", {
|
|
6123
6188
|
handle,
|
|
@@ -6125,7 +6190,7 @@ ${scatterEffectMessages.map((m) => `▸ ${m}`).join("\n")}`
|
|
|
6125
6190
|
}).then((r) => r[0]?.equipped ? "已自动装备武器" : "需手动装备武器");
|
|
6126
6191
|
return [
|
|
6127
6192
|
`✅ 成功订购【${item}】!`,
|
|
6128
|
-
`消耗红晶:${
|
|
6193
|
+
`消耗红晶:${finalCost}${discountInfo}`,
|
|
6129
6194
|
`装备状态:${equippedStatus}`,
|
|
6130
6195
|
'输入 "武器仓库" 管理武器'
|
|
6131
6196
|
].join("\n");
|
|
@@ -6134,9 +6199,14 @@ ${scatterEffectMessages.map((m) => `▸ ${m}`).join("\n")}`
|
|
|
6134
6199
|
handle,
|
|
6135
6200
|
itemId: itemConfig2.id
|
|
6136
6201
|
}).then((r) => r[0]?.quantity || 1);
|
|
6202
|
+
let priceInfo = `消耗红晶:${finalCost}`;
|
|
6203
|
+
if (isComputerExpertDiscount) {
|
|
6204
|
+
priceInfo += `(原价${originalPrice})`;
|
|
6205
|
+
}
|
|
6206
|
+
priceInfo += discountInfo;
|
|
6137
6207
|
return [
|
|
6138
6208
|
`✅ 成功订购【${item}】x1!`,
|
|
6139
|
-
|
|
6209
|
+
priceInfo,
|
|
6140
6210
|
`当前库存:${currentStock}件`,
|
|
6141
6211
|
'输入 "仓库" 查看所有物品'
|
|
6142
6212
|
].join("\n");
|