返回提交历史
Modified
src/services/missionInventoryUpdateService.ts
+70
-63
XFEstudio/SpaceNinjaServer
fix: handle fake jobs without syndicateMissionId (#2982)
Closes #2970 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/2982 Reviewed-by: Sainan <63328889+sainan@users.noreply.github.com> Co-authored-by: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com> Co-committed-by: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com>
2264ae17
代码差异
1 个文件
+70
-63
@@ -1522,7 +1522,38 @@ export const addMissionRewards = async (
1522
1522
syndicateEntry = Goals.find(m => m._id.$oid === syndicateMissionId);
1523
1523
if (syndicateEntry) syndicateEntry.Tag = syndicateEntry.JobAffiliationTag!;
1524
1524
}
1525
if (syndicateEntry && syndicateEntry.Jobs && !jobType.startsWith("/Lotus/Types/Gameplay/NokkoColony/Jobs")) {
1525
const specialCase = [
1526
{
1527
endings: ["Heists/HeistProfitTakerBountyOne"],
1528
stage: 2,
1529
amount: 1000,
1530
tag: "SolarisSyndicate"
1531
},
1532
{
1533
endings: [
1534
"Heists/HeistProfitTakerBountyTwo",
1535
"Heists/HeistProfitTakerBountyThree",
1536
"Heists/HeistProfitTakerBountyFour",
1537
"Heists/HeistExploiterBountyOne"
1538
],
1539
amount: 1000,
1540
tag: "SolarisSyndicate"
1541
},
1542
{ endings: ["Hunts/AllTeralystsHunt"], stage: 2, amount: 5000, tag: "CetusSyndicate" },
1543
{
1544
endings: ["Hunts/TeralystHunt"],
1545
amount: 1000,
1546
tag: "CetusSyndicate"
1547
},
1548
{ endings: ["Jobs/NewbieJob"], amount: 200, tag: "CetusSyndicate" }
1549
];
1550
const match = specialCase.find(rule => rule.endings.some(e => jobType.endsWith(e)));
1551
if (match) {
1552
const specialCaseReward = match.stage === undefined || rewardInfo.JobStage === match.stage ? match : null;
1553
if (specialCaseReward) {
1554
addStanding(inventory, match.tag, Math.floor(match.amount / (rewardInfo.Q ? 0.8 : 1)), AffiliationMods);
1555
}
1556
} else if (syndicateEntry && syndicateEntry.Jobs) {
1526
1557
let currentJob = syndicateEntry.Jobs[rewardInfo.JobTier!];
1527
1558
if (
1528
1559
[
@@ -1580,42 +1611,15 @@ export const addMissionRewards = async (
1580
1611
);
1581
1612
logger.warning(`currentJob`, { currentJob: currentJob });
1582
1613
}
1583
} else {
1584
const specialCase = [
1585
{ endings: ["Heists/HeistProfitTakerBountyOne"], stage: 2, amount: 1000 },
1586
{ endings: ["Hunts/AllTeralystsHunt"], stage: 2, amount: 5000 },
1587
{
1588
endings: [
1589
"Hunts/TeralystHunt",
1590
"Heists/HeistProfitTakerBountyTwo",
1591
"Heists/HeistProfitTakerBountyThree",
1592
"Heists/HeistProfitTakerBountyFour",
1593
"Heists/HeistExploiterBountyOne"
1594
],
1595
amount: 1000
1596
}
1597
];
1598
const specialCaseReward = specialCase.find(
1599
rule =>
1600
rule.endings.some(e => jobType.endsWith(e)) &&
1601
(rule.stage === undefined || rewardInfo.JobStage === rule.stage)
1614
} else if (!jobType.startsWith("/Lotus/Types/Gameplay/NokkoColony/Jobs")) {
1615
addStanding(
1616
inventory,
1617
syndicateEntry.Tag,
1618
Math.floor(currentJob.xpAmounts[rewardInfo.JobStage] / (rewardInfo.Q ? 0.8 : 1)),
1619
AffiliationMods
1602
1620
);
1603
1604
if (specialCaseReward) {
1605
addStanding(inventory, syndicateEntry.Tag, specialCaseReward.amount, AffiliationMods);
1606
} else {
1607
addStanding(
1608
inventory,
1609
syndicateEntry.Tag,
1610
Math.floor(currentJob.xpAmounts[rewardInfo.JobStage] / (rewardInfo.Q ? 0.8 : 1)),
1611
AffiliationMods
1612
);
1613
}
1614
1621
}
1615
1622
}
1616
if (jobType == "/Lotus/Types/Gameplay/Eidolon/Jobs/NewbieJob") {
1617
addStanding(inventory, "CetusSyndicate", Math.floor(200 / (rewardInfo.Q ? 0.8 : 1)), AffiliationMods);
1618
}
1619
1623
}
1620
1624
1621
1625
if (rewardInfo.challengeMissionId) {
@@ -1969,7 +1973,8 @@ function getRandomMissionDrops(
1969
1973
if (syndicateEntry) syndicateEntry.Tag = syndicateEntry.JobAffiliationTag!;
1970
1974
}
1971
1975
if (syndicateEntry && syndicateEntry.Jobs) {
1972
let job = syndicateEntry.Jobs[RewardInfo.JobTier!];
1976
let job;
1977
if (RewardInfo.JobTier && RewardInfo.JobTier > 0) job = syndicateEntry.Jobs[RewardInfo.JobTier];
1973
1978
1974
1979
if (syndicateEntry.Tag === "EntratiSyndicate") {
1975
1980
if (
@@ -2073,38 +2078,40 @@ function getRandomMissionDrops(
2073
2078
) {
2074
2079
job = syndicateEntry.Jobs.find(j => j.jobType === jobType)!;
2075
2080
}
2076
rewardManifests = [job.rewards];
2077
if (job.xpAmounts.length > 1) {
2078
const curentStage = RewardInfo.JobStage! + 1;
2079
const totalStage = job.xpAmounts.length;
2080
let tableIndex = 1; // Stage 2, Stage 3 of 4, and Stage 3 of 5
2081
2082
if (curentStage == 1) {
2083
tableIndex = 0;
2084
} else if (curentStage == totalStage) {
2085
tableIndex = 3;
2086
} else if (totalStage == 5 && curentStage == 4) {
2087
tableIndex = 2;
2088
}
2089
if (jobType.startsWith("/Lotus/Types/Gameplay/NokkoColony/Jobs/NokkoJob")) {
2090
if (RewardInfo.JobStage === job.xpAmounts.length - 1) {
2091
rotations = [0, 1, 2];
2081
if (job) {
2082
rewardManifests = [job.rewards];
2083
if (job.xpAmounts.length > 1) {
2084
const curentStage = RewardInfo.JobStage! + 1;
2085
const totalStage = job.xpAmounts.length;
2086
let tableIndex = 1; // Stage 2, Stage 3 of 4, and Stage 3 of 5
2087
2088
if (curentStage == 1) {
2089
tableIndex = 0;
2090
} else if (curentStage == totalStage) {
2091
tableIndex = 3;
2092
} else if (totalStage == 5 && curentStage == 4) {
2093
tableIndex = 2;
2094
}
2095
if (jobType.startsWith("/Lotus/Types/Gameplay/NokkoColony/Jobs/NokkoJob")) {
2096
if (RewardInfo.JobStage === job.xpAmounts.length - 1) {
2097
rotations = [0, 1, 2];
2098
} else {
2099
rewardManifests = [];
2100
}
2092
2101
} else {
2093
rewardManifests = [];
2102
rotations = [tableIndex];
2094
2103
}
2095
2104
} else {
2096
rotations = [tableIndex];
2105
rotations = [0];
2106
}
2107
if (
2108
RewardInfo.Q &&
2109
(RewardInfo.JobStage === job.xpAmounts.length - 1 || jobType.endsWith("VaultBounty")) &&
2110
!jobType.startsWith("/Lotus/Types/Gameplay/NokkoColony/Jobs/NokkoJob") &&
2111
!isEndlessJob
2112
) {
2113
rotations.push(ExportRewards[job.rewards].length - 1);
2097
2114
}
2098
} else {
2099
rotations = [0];
2100
}
2101
if (
2102
RewardInfo.Q &&
2103
(RewardInfo.JobStage === job.xpAmounts.length - 1 || jobType.endsWith("VaultBounty")) &&
2104
!jobType.startsWith("/Lotus/Types/Gameplay/NokkoColony/Jobs/NokkoJob") &&
2105
!isEndlessJob
2106
) {
2107
rotations.push(ExportRewards[job.rewards].length - 1);
2108
2115
}
2109
2116
}
2110
2117
}