返回提交历史
Modified
src/controllers/api/syndicateStandingBonusController.ts
+2
-0
Modified
src/services/inventoryService.ts
+14
-9
XFEstudio/XFESpaceNinjaServer
fix: don't apply alignments when applying alignments (#4335)
Closes #4334 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/4335 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
5c03fdf5
代码差异
2 个文件
+16
-9
@@ -79,6 +79,8 @@ export const syndicateStandingBonusController: RequestHandler = async (req, res)
79
79
eStandingSource.Medallion
80
80
);
81
81
82
logger.debug(`affiliationMods:`, affiliationMods);
83
82
84
await inventory.save();
83
85
84
86
res.json({
@@ -1885,9 +1885,10 @@ const updateStandingLimit = (
1885
1885
};
1886
1886
1887
1887
export const eStandingSource = {
1888
Medallion: 0,
1889
Mission: 1, // in mission report, the client provides both the affiliation & bin changes, so when using this source with addStanding, it does not update the daily cap.
1890
Misc: 2
1888
Medallion: 0b101, // Effect on daily cap depends on syndicate. Propagates to aligned syndicates.
1889
Mission: 0b000, // Does not apply/update daily cap. Does not propagate to aligned syndicates. (In mission report, the client provides all the affiliation & bin changes.)
1890
Alignment: 0b010, // Applies & updates daily cap. Does not propagate to aligned syndicates (to avoid infinite recursion).
1891
Misc: 0b011 // Applies & updates daily cap. Propagates to aligned syndicates.
1891
1892
};
1892
1893
type TStandingSource = (typeof eStandingSource)[keyof typeof eStandingSource];
1893
1894
@@ -1914,10 +1915,7 @@ export const addStanding = async (
1914
1915
gainedStanding = -71000 - syndicate.Standing;
1915
1916
}
1916
1917
1917
if (
1918
source == eStandingSource.Misc ||
1919
(source == eStandingSource.Medallion && syndicateMeta.medallionsCappedByDailyLimit)
1920
) {
1918
if ((source == eStandingSource.Medallion && syndicateMeta.medallionsCappedByDailyLimit) || source & 0b010) {
1921
1919
if (gainedStanding > getStandingLimit(inventory, syndicateMeta.dailyLimitBin)) {
1922
1920
gainedStanding = getStandingLimit(inventory, syndicateMeta.dailyLimitBin);
1923
1921
}
@@ -1932,9 +1930,16 @@ export const addStanding = async (
1932
1930
affiliationMods.push(affiliationMod);
1933
1931
1934
1932
if (syndicateMeta.alignments) {
1935
if (source != eStandingSource.Mission) {
1933
if (source & 0b001) {
1936
1934
for (const [tag, factor] of Object.entries(syndicateMeta.alignments)) {
1937
await addStanding(inventory, buildLabel, tag, gainedStanding * factor, affiliationMods, source);
1935
await addStanding(
1936
inventory,
1937
buildLabel,
1938
tag,
1939
gainedStanding * factor,
1940
affiliationMods,
1941
eStandingSource.Alignment
1942
);
1938
1943
}
1939
1944
} else {
1940
1945
while (syndicate.Standing < getMinStanding(syndicateMeta, syndicate.Title ?? 0)) {