fix: handle creation of infested lich
All checks were successful
Build / build (20) (push) Successful in 1m10s
Build / build (18) (push) Successful in 1m18s
Build / build (18) (pull_request) Successful in 45s
Build / build (20) (pull_request) Successful in 1m10s
Build / build (22) (pull_request) Successful in 1m15s
Build / build (22) (push) Successful in 41s

just setting the höllvania nodes and preventing the generation of a weapon index
This commit is contained in:
Sainan 2025-03-20 19:13:13 +01:00
parent b761ff1bff
commit 88f3b30a4d

View File

@ -13,8 +13,35 @@ export const nemesisController: RequestHandler = async (req, res) => {
const accountId = await getAccountIdForRequest(req); const accountId = await getAccountIdForRequest(req);
const inventory = await getInventory(accountId, "Nemesis NemesisAbandonedRewards"); const inventory = await getInventory(accountId, "Nemesis NemesisAbandonedRewards");
const body = getJSONfromString<INemesisStartRequest>(String(req.body)); const body = getJSONfromString<INemesisStartRequest>(String(req.body));
body.target.fp = BigInt(body.target.fp);
const infNodes: IInfNode[] = []; let infNodes: IInfNode[];
let weaponIdx = -1;
if (body.target.Faction == "FC_INFESTATION") {
infNodes = [
{
Node: "SolNode852",
Influence: 1
},
{
Node: "SolNode850",
Influence: 1
},
{
Node: "SolNode851",
Influence: 1
},
{
Node: "SolNode853",
Influence: 1
},
{
Node: "SolNode854",
Influence: 1
}
];
} else {
infNodes = [];
for (const [key, value] of Object.entries(ExportRegions)) { for (const [key, value] of Object.entries(ExportRegions)) {
if ( if (
value.systemIndex == 2 && // earth value.systemIndex == 2 && // earth
@ -43,9 +70,8 @@ export const nemesisController: RequestHandler = async (req, res) => {
throw new Error(`unknown nemesis manifest: ${body.target.manifest}`); throw new Error(`unknown nemesis manifest: ${body.target.manifest}`);
} }
body.target.fp = BigInt(body.target.fp);
const initialWeaponIdx = new SRng(body.target.fp).randomInt(0, weapons.length - 1); const initialWeaponIdx = new SRng(body.target.fp).randomInt(0, weapons.length - 1);
let weaponIdx = initialWeaponIdx; weaponIdx = initialWeaponIdx;
do { do {
const weapon = weapons[weaponIdx]; const weapon = weapons[weaponIdx];
if (!body.target.DisallowedWeapons.find(x => x == weapon)) { if (!body.target.DisallowedWeapons.find(x => x == weapon)) {
@ -53,6 +79,8 @@ export const nemesisController: RequestHandler = async (req, res) => {
} }
weaponIdx = (weaponIdx + 1) % weapons.length; weaponIdx = (weaponIdx + 1) % weapons.length;
} while (weaponIdx != initialWeaponIdx); } while (weaponIdx != initialWeaponIdx);
}
inventory.Nemesis = { inventory.Nemesis = {
fp: body.target.fp, fp: body.target.fp,
manifest: body.target.manifest, manifest: body.target.manifest,
@ -111,6 +139,8 @@ export interface INemesisStartRequest {
Weakened: boolean; Weakened: boolean;
PrevOwners: number; PrevOwners: number;
HenchmenKilled: number; HenchmenKilled: number;
MissionCount?: number; // Added in 38.5.0
LastEnc?: number; // Added in 38.5.0
SecondInCommand: boolean; SecondInCommand: boolean;
}; };
} }