feat: coda weapon vendor rotation (#1471)
Reviewed-on: #1471 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
This commit is contained in:
parent
65306e0478
commit
3c79f910a2
@ -3,8 +3,9 @@ import path from "path";
|
|||||||
import { repoDir } from "@/src/helpers/pathHelper";
|
import { repoDir } from "@/src/helpers/pathHelper";
|
||||||
import { CRng, mixSeeds } from "@/src/services/rngService";
|
import { CRng, mixSeeds } from "@/src/services/rngService";
|
||||||
import { IMongoDate } from "@/src/types/commonTypes";
|
import { IMongoDate } from "@/src/types/commonTypes";
|
||||||
import { IRawVendorManifest, IVendorManifestPreprocessed } from "@/src/types/vendorTypes";
|
import { IItemManifestPreprocessed, IRawVendorManifest, IVendorManifestPreprocessed } from "@/src/types/vendorTypes";
|
||||||
import { JSONParse } from "json-with-bigint";
|
import { JSONParse } from "json-with-bigint";
|
||||||
|
import { ExportVendors } from "warframe-public-export-plus";
|
||||||
|
|
||||||
const getVendorManifestJson = (name: string): IRawVendorManifest => {
|
const getVendorManifestJson = (name: string): IRawVendorManifest => {
|
||||||
return JSONParse(fs.readFileSync(path.join(repoDir, `static/fixed_responses/getVendorInfo/${name}.json`), "utf-8"));
|
return JSONParse(fs.readFileSync(path.join(repoDir, `static/fixed_responses/getVendorInfo/${name}.json`), "utf-8"));
|
||||||
@ -29,7 +30,6 @@ const rawVendorManifests: IRawVendorManifest[] = [
|
|||||||
getVendorManifestJson("HubsIronwakeDondaVendorManifest"), // uses preprocessing
|
getVendorManifestJson("HubsIronwakeDondaVendorManifest"), // uses preprocessing
|
||||||
getVendorManifestJson("HubsPerrinSequenceWeaponVendorManifest"),
|
getVendorManifestJson("HubsPerrinSequenceWeaponVendorManifest"),
|
||||||
getVendorManifestJson("HubsRailjackCrewMemberVendorManifest"),
|
getVendorManifestJson("HubsRailjackCrewMemberVendorManifest"),
|
||||||
getVendorManifestJson("InfestedLichWeaponVendorManifest"),
|
|
||||||
getVendorManifestJson("MaskSalesmanManifest"),
|
getVendorManifestJson("MaskSalesmanManifest"),
|
||||||
getVendorManifestJson("Nova1999ConquestShopManifest"),
|
getVendorManifestJson("Nova1999ConquestShopManifest"),
|
||||||
getVendorManifestJson("OstronFishmongerVendorManifest"),
|
getVendorManifestJson("OstronFishmongerVendorManifest"),
|
||||||
@ -50,6 +50,9 @@ export const getVendorManifestByTypeName = (typeName: string): IVendorManifestPr
|
|||||||
return preprocessVendorManifest(vendorManifest);
|
return preprocessVendorManifest(vendorManifest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (typeName == "/Lotus/Types/Game/VendorManifests/TheHex/InfestedLichWeaponVendorManifest") {
|
||||||
|
return generateCodaWeaponVendorManifest();
|
||||||
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -59,6 +62,9 @@ export const getVendorManifestByOid = (oid: string): IVendorManifestPreprocessed
|
|||||||
return preprocessVendorManifest(vendorManifest);
|
return preprocessVendorManifest(vendorManifest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (oid == "67dadc30e4b6e0e5979c8d84") {
|
||||||
|
return generateCodaWeaponVendorManifest();
|
||||||
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -96,3 +102,42 @@ const refreshExpiry = (expiry: IMongoDate): number => {
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const generateCodaWeaponVendorManifest = (): IVendorManifestPreprocessed => {
|
||||||
|
const EPOCH = 1740960000 * 1000;
|
||||||
|
const DUR = 4 * 86400 * 1000;
|
||||||
|
const cycle = Math.trunc((Date.now() - EPOCH) / DUR);
|
||||||
|
const cycleStart = EPOCH + cycle * DUR;
|
||||||
|
const cycleEnd = cycleStart + DUR;
|
||||||
|
const binThisCycle = cycle % 2; // isOneBinPerCycle
|
||||||
|
const items: IItemManifestPreprocessed[] = [];
|
||||||
|
const manifest = ExportVendors["/Lotus/Types/Game/VendorManifests/TheHex/InfestedLichWeaponVendorManifest"];
|
||||||
|
const rng = new CRng(cycle);
|
||||||
|
for (const rawItem of manifest.items) {
|
||||||
|
if (rawItem.bin != binThisCycle) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
items.push({
|
||||||
|
StoreItem: rawItem.storeItem,
|
||||||
|
ItemPrices: rawItem.itemPrices!.map(item => ({ ...item, ProductCategory: "MiscItems" })),
|
||||||
|
Bin: "BIN_" + rawItem.bin,
|
||||||
|
QuantityMultiplier: 1,
|
||||||
|
Expiry: { $date: { $numberLong: cycleEnd.toString() } },
|
||||||
|
AllowMultipurchase: false,
|
||||||
|
LocTagRandSeed: (BigInt(rng.randomInt(0, 0xffffffff)) << 32n) | BigInt(rng.randomInt(0, 0xffffffff)),
|
||||||
|
Id: { $oid: "67e9da12793a120d" + rng.randomInt(0, 0xffffffff).toString(16).padStart(8, "0") }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
VendorInfo: {
|
||||||
|
_id: { $oid: "67dadc30e4b6e0e5979c8d84" },
|
||||||
|
TypeName: "/Lotus/Types/Game/VendorManifests/TheHex/InfestedLichWeaponVendorManifest",
|
||||||
|
ItemManifest: items,
|
||||||
|
PropertyTextHash: "77093DD05A8561A022DEC9A4B9BB4A56",
|
||||||
|
RandomSeedType: "VRST_WEAPON",
|
||||||
|
RequiredGoalTag: "",
|
||||||
|
WeaponUpgradeValueAttenuationExponent: 2.25,
|
||||||
|
Expiry: { $date: { $numberLong: cycleEnd.toString() } }
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
@ -23,7 +23,7 @@ interface IItemManifest {
|
|||||||
Id: IOid;
|
Id: IOid;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IItemManifestPreprocessed extends Omit<IItemManifest, "ItemPrices"> {
|
export interface IItemManifestPreprocessed extends Omit<IItemManifest, "ItemPrices"> {
|
||||||
ItemPrices?: IItemPricePreprocessed[];
|
ItemPrices?: IItemPricePreprocessed[];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,6 +31,10 @@ interface IVendorInfo {
|
|||||||
_id: IOid;
|
_id: IOid;
|
||||||
TypeName: string;
|
TypeName: string;
|
||||||
ItemManifest: IItemManifest[];
|
ItemManifest: IItemManifest[];
|
||||||
|
PropertyTextHash?: string;
|
||||||
|
RandomSeedType?: "VRST_WEAPON";
|
||||||
|
RequiredGoalTag?: string;
|
||||||
|
WeaponUpgradeValueAttenuationExponent?: number;
|
||||||
Expiry: IMongoDate; // Either a date in the distant future or a period in milliseconds for preprocessing.
|
Expiry: IMongoDate; // Either a date in the distant future or a period in milliseconds for preprocessing.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,157 +0,0 @@
|
|||||||
{
|
|
||||||
"VendorInfo": {
|
|
||||||
"_id": {
|
|
||||||
"$oid": "67dadc30e4b6e0e5979c8d84"
|
|
||||||
},
|
|
||||||
"TypeName": "/Lotus/Types/Game/VendorManifests/TheHex/InfestedLichWeaponVendorManifest",
|
|
||||||
"ItemManifest": [
|
|
||||||
{
|
|
||||||
"StoreItem": "/Lotus/StoreItems/Weapons/Infested/InfestedLich/LongGuns/1999InfShotgun/1999InfShotgunWeapon",
|
|
||||||
"ItemPrices": [
|
|
||||||
{
|
|
||||||
"ItemCount": 10,
|
|
||||||
"ItemType": "/Lotus/Types/Items/MiscItems/CodaWeaponBucks",
|
|
||||||
"ProductCategory": "MiscItems"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"Bin": "BIN_1",
|
|
||||||
"QuantityMultiplier": 1,
|
|
||||||
"Expiry": {
|
|
||||||
"$date": {
|
|
||||||
"$numberLong": "9999999999999"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"PurchaseQuantityLimit": 1,
|
|
||||||
"AllowMultipurchase": false,
|
|
||||||
"LocTagRandSeed": 65079176837546984,
|
|
||||||
"Id": {
|
|
||||||
"$oid": "67e9da12793a120dbbc1c193"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"StoreItem": "/Lotus/StoreItems/Weapons/Infested/InfestedLich/Melee/CodaCaustacyst/CodaCaustacyst",
|
|
||||||
"ItemPrices": [
|
|
||||||
{
|
|
||||||
"ItemCount": 10,
|
|
||||||
"ItemType": "/Lotus/Types/Items/MiscItems/CodaWeaponBucks",
|
|
||||||
"ProductCategory": "MiscItems"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"Bin": "BIN_1",
|
|
||||||
"QuantityMultiplier": 1,
|
|
||||||
"Expiry": {
|
|
||||||
"$date": {
|
|
||||||
"$numberLong": "9999999999999"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"PurchaseQuantityLimit": 1,
|
|
||||||
"AllowMultipurchase": false,
|
|
||||||
"LocTagRandSeed": 5687904240491804000,
|
|
||||||
"Id": {
|
|
||||||
"$oid": "67e9da12793a120dbbc1c194"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"StoreItem": "/Lotus/StoreItems/Weapons/Infested/InfestedLich/Melee/CodaPathocyst/CodaPathocyst",
|
|
||||||
"ItemPrices": [
|
|
||||||
{
|
|
||||||
"ItemCount": 10,
|
|
||||||
"ItemType": "/Lotus/Types/Items/MiscItems/CodaWeaponBucks",
|
|
||||||
"ProductCategory": "MiscItems"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"Bin": "BIN_1",
|
|
||||||
"QuantityMultiplier": 1,
|
|
||||||
"Expiry": {
|
|
||||||
"$date": {
|
|
||||||
"$numberLong": "9999999999999"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"PurchaseQuantityLimit": 1,
|
|
||||||
"AllowMultipurchase": false,
|
|
||||||
"LocTagRandSeed": 6177144662234093000,
|
|
||||||
"Id": {
|
|
||||||
"$oid": "67e9da12793a120dbbc1c195"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"StoreItem": "/Lotus/StoreItems/Weapons/Infested/InfestedLich/Pistols/CodaTysis",
|
|
||||||
"ItemPrices": [
|
|
||||||
{
|
|
||||||
"ItemCount": 10,
|
|
||||||
"ItemType": "/Lotus/Types/Items/MiscItems/CodaWeaponBucks",
|
|
||||||
"ProductCategory": "MiscItems"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"Bin": "BIN_1",
|
|
||||||
"QuantityMultiplier": 1,
|
|
||||||
"Expiry": {
|
|
||||||
"$date": {
|
|
||||||
"$numberLong": "9999999999999"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"PurchaseQuantityLimit": 1,
|
|
||||||
"AllowMultipurchase": false,
|
|
||||||
"LocTagRandSeed": 1988275604378227700,
|
|
||||||
"Id": {
|
|
||||||
"$oid": "67e9da12793a120dbbc1c196"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"StoreItem": "/Lotus/StoreItems/Weapons/Infested/InfestedLich/LongGuns/CodaSynapse",
|
|
||||||
"ItemPrices": [
|
|
||||||
{
|
|
||||||
"ItemCount": 10,
|
|
||||||
"ItemType": "/Lotus/Types/Items/MiscItems/CodaWeaponBucks",
|
|
||||||
"ProductCategory": "MiscItems"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"Bin": "BIN_1",
|
|
||||||
"QuantityMultiplier": 1,
|
|
||||||
"Expiry": {
|
|
||||||
"$date": {
|
|
||||||
"$numberLong": "9999999999999"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"PurchaseQuantityLimit": 1,
|
|
||||||
"AllowMultipurchase": false,
|
|
||||||
"LocTagRandSeed": 8607452585593957000,
|
|
||||||
"Id": {
|
|
||||||
"$oid": "67e9da12793a120dbbc1c197"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"StoreItem": "/Lotus/StoreItems/Weapons/Infested/InfestedLich/Melee/CodaHirudo",
|
|
||||||
"ItemPrices": [
|
|
||||||
{
|
|
||||||
"ItemCount": 10,
|
|
||||||
"ItemType": "/Lotus/Types/Items/MiscItems/CodaWeaponBucks",
|
|
||||||
"ProductCategory": "MiscItems"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"Bin": "BIN_1",
|
|
||||||
"QuantityMultiplier": 1,
|
|
||||||
"Expiry": {
|
|
||||||
"$date": {
|
|
||||||
"$numberLong": "9999999999999"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"PurchaseQuantityLimit": 1,
|
|
||||||
"AllowMultipurchase": false,
|
|
||||||
"LocTagRandSeed": 8385013066220909000,
|
|
||||||
"Id": {
|
|
||||||
"$oid": "67e9da12793a120dbbc1c198"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"PropertyTextHash": "77093DD05A8561A022DEC9A4B9BB4A56",
|
|
||||||
"RandomSeedType": "VRST_WEAPON",
|
|
||||||
"RequiredGoalTag": "",
|
|
||||||
"WeaponUpgradeValueAttenuationExponent": 2.25,
|
|
||||||
"Expiry": {
|
|
||||||
"$date": {
|
|
||||||
"$numberLong": "9999999999999"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user