forked from OpenWF/SpaceNinjaServer
Compare commits
2 Commits
943574bf3a
...
c3aa619652
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c3aa619652 | ||
![]() |
f8ecd49fd6 |
@ -17,81 +17,99 @@ export const syndicateSacrificeController: RequestHandler = async (request, resp
|
|||||||
if (!syndicate) {
|
if (!syndicate) {
|
||||||
syndicate = inventory.Affiliations[inventory.Affiliations.push({ Tag: data.AffiliationTag, Standing: 0 }) - 1];
|
syndicate = inventory.Affiliations[inventory.Affiliations.push({ Tag: data.AffiliationTag, Standing: 0 }) - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
const level = data.SacrificeLevel - (syndicate.Title ?? 0);
|
|
||||||
const res: ISyndicateSacrificeResponse = {
|
const res: ISyndicateSacrificeResponse = {
|
||||||
AffiliationTag: data.AffiliationTag,
|
AffiliationTag: data.AffiliationTag,
|
||||||
InventoryChanges: {},
|
InventoryChanges: {},
|
||||||
Level: data.SacrificeLevel,
|
Level: 0, // the new level after the sacrifice
|
||||||
LevelIncrease: level <= 0 ? 1 : level,
|
LevelIncrease: 0, // the amount of levels gained from the sacrifice
|
||||||
NewEpisodeReward: false
|
NewEpisodeReward: false
|
||||||
};
|
};
|
||||||
|
|
||||||
const manifest = ExportSyndicates[data.AffiliationTag];
|
const manifest = ExportSyndicates[data.AffiliationTag];
|
||||||
let sacrifice: ISyndicateSacrifice | undefined;
|
const isNightwave = manifest.dailyChallenges !== undefined;
|
||||||
let reward: string | undefined;
|
|
||||||
if (data.SacrificeLevel == 0) {
|
const titles = manifest.titles;
|
||||||
sacrifice = manifest.initiationSacrifice;
|
const oldLevel = syndicate.Title ?? 0;
|
||||||
reward = manifest.initiationReward;
|
const currentStanding = syndicate.Standing ?? 0;
|
||||||
|
let newLevel = oldLevel;
|
||||||
|
|
||||||
|
interface _HandleItem {
|
||||||
|
sacrifice?: ISyndicateSacrifice;
|
||||||
|
reward?: {
|
||||||
|
type: string;
|
||||||
|
count?: number; // default 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const needProcess: _HandleItem[] = [];
|
||||||
|
|
||||||
|
if (!syndicate.Initiated) {
|
||||||
|
needProcess.push({
|
||||||
|
sacrifice: manifest.initiationSacrifice,
|
||||||
|
reward: manifest.initiationReward ? { type: manifest.initiationReward } : undefined,
|
||||||
|
});
|
||||||
syndicate.Initiated = true;
|
syndicate.Initiated = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (titles == undefined) {
|
||||||
|
// ummm then just trust what the client says?
|
||||||
|
newLevel = res.Level = data.SacrificeLevel;
|
||||||
|
res.LevelIncrease = data.SacrificeLevel - oldLevel;
|
||||||
} else {
|
} else {
|
||||||
sacrifice = manifest.titles?.find(x => x.level == data.SacrificeLevel)?.sacrifice;
|
titles.filter(x => x.level > oldLevel && x.minStanding <= currentStanding).forEach(x => {
|
||||||
}
|
if (x.level > newLevel) newLevel = x.level;
|
||||||
|
const item: _HandleItem = {};
|
||||||
if (sacrifice) {
|
if (x.sacrifice) {
|
||||||
res.InventoryChanges = { ...updateCurrency(inventory, sacrifice.credits, false) };
|
item.sacrifice = x.sacrifice;
|
||||||
|
|
||||||
const miscItemChanges = sacrifice.items.map(x => ({
|
|
||||||
ItemType: x.ItemType,
|
|
||||||
ItemCount: x.ItemCount * -1
|
|
||||||
}));
|
|
||||||
addMiscItems(inventory, miscItemChanges);
|
|
||||||
res.InventoryChanges.MiscItems = miscItemChanges;
|
|
||||||
}
|
|
||||||
|
|
||||||
syndicate.Title ??= 0;
|
|
||||||
syndicate.Title += 1;
|
|
||||||
|
|
||||||
if (reward) {
|
|
||||||
combineInventoryChanges(
|
|
||||||
res.InventoryChanges,
|
|
||||||
(await handleStoreItemAcquisition(reward, inventory)).InventoryChanges
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Quacks like a nightwave syndicate?
|
|
||||||
if (manifest.dailyChallenges) {
|
|
||||||
const title = manifest.titles!.find(x => x.level == syndicate.Title);
|
|
||||||
if (title) {
|
|
||||||
res.NewEpisodeReward = true;
|
|
||||||
let rewardType: string;
|
|
||||||
let rewardCount: number;
|
|
||||||
if (title.storeItemReward) {
|
|
||||||
rewardType = title.storeItemReward;
|
|
||||||
rewardCount = 1;
|
|
||||||
} else {
|
|
||||||
rewardType = toStoreItem(title.reward!.ItemType);
|
|
||||||
rewardCount = title.reward!.ItemCount;
|
|
||||||
}
|
}
|
||||||
const rewardInventoryChanges = (await handleStoreItemAcquisition(rewardType, inventory, rewardCount))
|
if (x.storeItemReward) {
|
||||||
.InventoryChanges;
|
item.reward = { type: x.storeItemReward, count: 1 };
|
||||||
if (Object.keys(rewardInventoryChanges).length == 0) {
|
} else if (x.reward) {
|
||||||
logger.debug(`nightwave rank up reward did not seem to get added, giving 50 creds instead`);
|
item.reward = { type: toStoreItem(x.reward.ItemType), count: x.reward.ItemCount };
|
||||||
const nightwaveCredsItemType = manifest.titles![0].reward!.ItemType;
|
|
||||||
rewardInventoryChanges.MiscItems = [{ ItemType: nightwaveCredsItemType, ItemCount: 50 }];
|
|
||||||
addMiscItems(inventory, rewardInventoryChanges.MiscItems);
|
|
||||||
}
|
}
|
||||||
combineInventoryChanges(res.InventoryChanges, rewardInventoryChanges);
|
if (item.sacrifice || item.reward) {
|
||||||
|
needProcess.push(item);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
res.Level = newLevel;
|
||||||
|
res.LevelIncrease = newLevel - oldLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const item of needProcess) {
|
||||||
|
if (item.sacrifice) {
|
||||||
|
const changes = updateCurrency(inventory, item.sacrifice.credits, false);
|
||||||
|
const miscItemChanges = item.sacrifice.items.map(x => ({
|
||||||
|
ItemType: x.ItemType,
|
||||||
|
ItemCount: x.ItemCount * -1
|
||||||
|
}));
|
||||||
|
addMiscItems(inventory, miscItemChanges);
|
||||||
|
if (res.InventoryChanges.MiscItems === undefined) {
|
||||||
|
res.InventoryChanges.MiscItems = [];
|
||||||
|
}
|
||||||
|
res.InventoryChanges.MiscItems.push(...miscItemChanges);
|
||||||
|
combineInventoryChanges(res.InventoryChanges, changes);
|
||||||
}
|
}
|
||||||
|
if (item.reward) {
|
||||||
|
const rewardChanges = await handleStoreItemAcquisition(item.reward.type, inventory, item.reward.count ?? 1);
|
||||||
|
if (isNightwave && Object.keys(rewardChanges.InventoryChanges).length == 0) {
|
||||||
|
logger.debug(`syndicate sacrifice reward did not seem to get added, giving 50 creds instead`);
|
||||||
|
const syndicateCredsItemType = manifest.titles![0].reward!.ItemType;
|
||||||
|
rewardChanges.InventoryChanges.MiscItems = [{ ItemType: syndicateCredsItemType, ItemCount: 50 }];
|
||||||
|
addMiscItems(inventory, rewardChanges.InventoryChanges.MiscItems);
|
||||||
|
}
|
||||||
|
combineInventoryChanges(res.InventoryChanges, rewardChanges.InventoryChanges);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isNightwave) {
|
||||||
|
res.NewEpisodeReward = needProcess.length > 0;
|
||||||
} else {
|
} else {
|
||||||
if (syndicate.Title > 0 && manifest.favours.find(x => x.rankUpReward && x.requiredLevel == syndicate.Title)) {
|
manifest.favours.filter(x => x.rankUpReward && x.requiredLevel <= newLevel).forEach(x => {
|
||||||
syndicate.FreeFavorsEarned ??= [];
|
syndicate.FreeFavorsEarned ??= [];
|
||||||
if (!syndicate.FreeFavorsEarned.includes(syndicate.Title)) {
|
if (!syndicate.FreeFavorsEarned.includes(x.requiredLevel)) {
|
||||||
syndicate.FreeFavorsEarned.push(syndicate.Title);
|
syndicate.FreeFavorsEarned.push(x.requiredLevel);
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
|
syndicate.Title = newLevel;
|
||||||
await inventory.save();
|
await inventory.save();
|
||||||
|
|
||||||
response.json(res);
|
response.json(res);
|
||||||
|
@ -64,6 +64,7 @@ interface IConfig {
|
|||||||
lockTime?: number;
|
lockTime?: number;
|
||||||
nightwaveOverride?: string;
|
nightwaveOverride?: string;
|
||||||
};
|
};
|
||||||
|
nightwaveStandingMultliplier?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const configPath = path.join(repoDir, "config.json");
|
export const configPath = path.join(repoDir, "config.json");
|
||||||
|
@ -1772,13 +1772,18 @@ export const addChallenges = (
|
|||||||
}) - 1
|
}) - 1
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
affiliation.Standing += meta.standing!;
|
|
||||||
|
|
||||||
if (affiliationMods.length == 0) {
|
let standingToAdd = meta.standing ?? 0;
|
||||||
affiliationMods.push({ Tag: nightwaveSyndicateTag });
|
if (standingToAdd >= 0) {
|
||||||
|
standingToAdd *= config.nightwaveStandingMultliplier ?? 1;
|
||||||
|
affiliation.Standing += standingToAdd;
|
||||||
|
|
||||||
|
if (affiliationMods.length == 0) {
|
||||||
|
affiliationMods.push({ Tag: nightwaveSyndicateTag });
|
||||||
|
}
|
||||||
|
affiliationMods[0].Standing ??= 0;
|
||||||
|
affiliationMods[0].Standing += standingToAdd;
|
||||||
}
|
}
|
||||||
affiliationMods[0].Standing ??= 0;
|
|
||||||
affiliationMods[0].Standing += meta.standing!;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -722,6 +722,10 @@
|
|||||||
<label class="form-label" for="spoofMasteryRank" data-loc="cheats_spoofMasteryRank"></label>
|
<label class="form-label" for="spoofMasteryRank" data-loc="cheats_spoofMasteryRank"></label>
|
||||||
<input class="form-control" id="spoofMasteryRank" type="number" min="-1" max="65535" />
|
<input class="form-control" id="spoofMasteryRank" type="number" min="-1" max="65535" />
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group mt-2">
|
||||||
|
<label class="form-label" for="nightwaveStandingMultliplier" data-loc="cheats_nightwaveStandingMultliplier"></label>
|
||||||
|
<input class="form-control" id="nightwaveStandingMultliplier" type="number" min="1" max="1000000" value="1" />
|
||||||
|
</div>
|
||||||
<button class="btn btn-primary mt-3" type="submit" data-loc="cheats_saveSettings"></button>
|
<button class="btn btn-primary mt-3" type="submit" data-loc="cheats_saveSettings"></button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
@ -163,6 +163,7 @@ dict = {
|
|||||||
cheats_noDojoResearchTime: `Keine Dojo-Forschungszeit`,
|
cheats_noDojoResearchTime: `Keine Dojo-Forschungszeit`,
|
||||||
cheats_fastClanAscension: `Schneller Clan-Aufstieg`,
|
cheats_fastClanAscension: `Schneller Clan-Aufstieg`,
|
||||||
cheats_spoofMasteryRank: `Gefälschter Meisterschaftsrang (-1 zum deaktivieren)`,
|
cheats_spoofMasteryRank: `Gefälschter Meisterschaftsrang (-1 zum deaktivieren)`,
|
||||||
|
cheats_nightwaveStandingMultliplier: `Nightwave-Ansehen-Multiplikator`,
|
||||||
cheats_saveSettings: `Einstellungen speichern`,
|
cheats_saveSettings: `Einstellungen speichern`,
|
||||||
cheats_account: `Account`,
|
cheats_account: `Account`,
|
||||||
cheats_unlockAllFocusSchools: `Alle Fokus-Schulen freischalten`,
|
cheats_unlockAllFocusSchools: `Alle Fokus-Schulen freischalten`,
|
||||||
|
@ -162,6 +162,7 @@ dict = {
|
|||||||
cheats_noDojoResearchTime: `No Dojo Research Time`,
|
cheats_noDojoResearchTime: `No Dojo Research Time`,
|
||||||
cheats_fastClanAscension: `Fast Clan Ascension`,
|
cheats_fastClanAscension: `Fast Clan Ascension`,
|
||||||
cheats_spoofMasteryRank: `Spoofed Mastery Rank (-1 to disable)`,
|
cheats_spoofMasteryRank: `Spoofed Mastery Rank (-1 to disable)`,
|
||||||
|
cheats_nightwaveStandingMultliplier: `Nightwave Standing Multiplier`,
|
||||||
cheats_saveSettings: `Save Settings`,
|
cheats_saveSettings: `Save Settings`,
|
||||||
cheats_account: `Account`,
|
cheats_account: `Account`,
|
||||||
cheats_unlockAllFocusSchools: `Unlock All Focus Schools`,
|
cheats_unlockAllFocusSchools: `Unlock All Focus Schools`,
|
||||||
|
@ -163,6 +163,7 @@ dict = {
|
|||||||
cheats_noDojoResearchTime: `Sin tiempo de investigación del dojo`,
|
cheats_noDojoResearchTime: `Sin tiempo de investigación del dojo`,
|
||||||
cheats_fastClanAscension: `Ascenso rápido del clan`,
|
cheats_fastClanAscension: `Ascenso rápido del clan`,
|
||||||
cheats_spoofMasteryRank: `Rango de maestría simulado (-1 para desactivar)`,
|
cheats_spoofMasteryRank: `Rango de maestría simulado (-1 para desactivar)`,
|
||||||
|
cheats_nightwaveStandingMultliplier: `Multiplicador de reputación de Onda Nocturna`,
|
||||||
cheats_saveSettings: `Guardar configuración`,
|
cheats_saveSettings: `Guardar configuración`,
|
||||||
cheats_account: `Cuenta`,
|
cheats_account: `Cuenta`,
|
||||||
cheats_unlockAllFocusSchools: `Desbloquear todas las escuelas de enfoque`,
|
cheats_unlockAllFocusSchools: `Desbloquear todas las escuelas de enfoque`,
|
||||||
|
@ -163,6 +163,7 @@ dict = {
|
|||||||
cheats_noDojoResearchTime: `Aucun temps de recherche (Dojo)`,
|
cheats_noDojoResearchTime: `Aucun temps de recherche (Dojo)`,
|
||||||
cheats_fastClanAscension: `Ascension de clan rapide`,
|
cheats_fastClanAscension: `Ascension de clan rapide`,
|
||||||
cheats_spoofMasteryRank: `Rang de maîtrise personnalisé (-1 pour désactiver)`,
|
cheats_spoofMasteryRank: `Rang de maîtrise personnalisé (-1 pour désactiver)`,
|
||||||
|
cheats_nightwaveStandingMultliplier: `Multiplicateur de standing Ondes Nocturnes`,
|
||||||
cheats_saveSettings: `Sauvegarder les paramètres`,
|
cheats_saveSettings: `Sauvegarder les paramètres`,
|
||||||
cheats_account: `Compte`,
|
cheats_account: `Compte`,
|
||||||
cheats_unlockAllFocusSchools: `Débloquer toutes les écoles de focus`,
|
cheats_unlockAllFocusSchools: `Débloquer toutes les écoles de focus`,
|
||||||
|
@ -163,6 +163,7 @@ dict = {
|
|||||||
cheats_noDojoResearchTime: `Мгновенные Исследование Додзё`,
|
cheats_noDojoResearchTime: `Мгновенные Исследование Додзё`,
|
||||||
cheats_fastClanAscension: `Мгновенное Вознесение Клана`,
|
cheats_fastClanAscension: `Мгновенное Вознесение Клана`,
|
||||||
cheats_spoofMasteryRank: `Подделанный ранг мастерства (-1 для отключения)`,
|
cheats_spoofMasteryRank: `Подделанный ранг мастерства (-1 для отключения)`,
|
||||||
|
cheats_nightwaveStandingMultliplier: `Множитель репутации Ночной Волны`,
|
||||||
cheats_saveSettings: `Сохранить настройки`,
|
cheats_saveSettings: `Сохранить настройки`,
|
||||||
cheats_account: `Аккаунт`,
|
cheats_account: `Аккаунт`,
|
||||||
cheats_unlockAllFocusSchools: `Разблокировать все школы фокуса`,
|
cheats_unlockAllFocusSchools: `Разблокировать все школы фокуса`,
|
||||||
|
@ -163,6 +163,7 @@ dict = {
|
|||||||
cheats_noDojoResearchTime: `无视道场研究时间`,
|
cheats_noDojoResearchTime: `无视道场研究时间`,
|
||||||
cheats_fastClanAscension: `快速升级氏族`,
|
cheats_fastClanAscension: `快速升级氏族`,
|
||||||
cheats_spoofMasteryRank: `伪造精通段位(-1为禁用)`,
|
cheats_spoofMasteryRank: `伪造精通段位(-1为禁用)`,
|
||||||
|
cheats_nightwaveStandingMultliplier: `午夜电波声望倍率`,
|
||||||
cheats_saveSettings: `保存设置`,
|
cheats_saveSettings: `保存设置`,
|
||||||
cheats_account: `账户`,
|
cheats_account: `账户`,
|
||||||
cheats_unlockAllFocusSchools: `解锁所有专精学派`,
|
cheats_unlockAllFocusSchools: `解锁所有专精学派`,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user