XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFESpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/XFESpaceNinjaServer

feat: coda weapon vendor rotation (#1471)

Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/1471 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>

3c79f910
Sainan <63328889+Sainan@users.noreply.github.com>
提交于

代码差异

3 个文件 +52 -160
Modified src/services/serversideVendorsService.ts +47 -2
@@ -3,8 +3,9 @@ import path from "path";
3 3 import { repoDir } from "@/src/helpers/pathHelper";
4 4 import { CRng, mixSeeds } from "@/src/services/rngService";
5 5 import { IMongoDate } from "@/src/types/commonTypes";
6 import { IRawVendorManifest, IVendorManifestPreprocessed } from "@/src/types/vendorTypes";
6 import { IItemManifestPreprocessed, IRawVendorManifest, IVendorManifestPreprocessed } from "@/src/types/vendorTypes";
7 7 import { JSONParse } from "json-with-bigint";
8 import { ExportVendors } from "warframe-public-export-plus";
8 9
9 10 const getVendorManifestJson = (name: string): IRawVendorManifest => {
10 11 return JSONParse(fs.readFileSync(path.join(repoDir, `static/fixed_responses/getVendorInfo/${name}.json`), "utf-8"));
@@ -29,7 +30,6 @@ const rawVendorManifests: IRawVendorManifest[] = [
29 30 getVendorManifestJson("HubsIronwakeDondaVendorManifest"), // uses preprocessing
30 31 getVendorManifestJson("HubsPerrinSequenceWeaponVendorManifest"),
31 32 getVendorManifestJson("HubsRailjackCrewMemberVendorManifest"),
32 getVendorManifestJson("InfestedLichWeaponVendorManifest"),
33 33 getVendorManifestJson("MaskSalesmanManifest"),
34 34 getVendorManifestJson("Nova1999ConquestShopManifest"),
35 35 getVendorManifestJson("OstronFishmongerVendorManifest"),
@@ -50,6 +50,9 @@ export const getVendorManifestByTypeName = (typeName: string): IVendorManifestPr
50 50 return preprocessVendorManifest(vendorManifest);
51 51 }
52 52 }
53 if (typeName == "/Lotus/Types/Game/VendorManifests/TheHex/InfestedLichWeaponVendorManifest") {
54 return generateCodaWeaponVendorManifest();
55 }
53 56 return undefined;
54 57 };
55 58
@@ -59,6 +62,9 @@ export const getVendorManifestByOid = (oid: string): IVendorManifestPreprocessed
59 62 return preprocessVendorManifest(vendorManifest);
60 63 }
61 64 }
65 if (oid == "67dadc30e4b6e0e5979c8d84") {
66 return generateCodaWeaponVendorManifest();
67 }
62 68 return undefined;
63 69 };
64 70
@@ -96,3 +102,42 @@ const refreshExpiry = (expiry: IMongoDate): number => {
96 102 }
97 103 return 0;
98 104 };
105
106 const generateCodaWeaponVendorManifest = (): IVendorManifestPreprocessed => {
107 const EPOCH = 1740960000 * 1000;
108 const DUR = 4 * 86400 * 1000;
109 const cycle = Math.trunc((Date.now() - EPOCH) / DUR);
110 const cycleStart = EPOCH + cycle * DUR;
111 const cycleEnd = cycleStart + DUR;
112 const binThisCycle = cycle % 2; // isOneBinPerCycle
113 const items: IItemManifestPreprocessed[] = [];
114 const manifest = ExportVendors["/Lotus/Types/Game/VendorManifests/TheHex/InfestedLichWeaponVendorManifest"];
115 const rng = new CRng(cycle);
116 for (const rawItem of manifest.items) {
117 if (rawItem.bin != binThisCycle) {
118 continue;
119 }
120 items.push({
121 StoreItem: rawItem.storeItem,
122 ItemPrices: rawItem.itemPrices!.map(item => ({ ...item, ProductCategory: "MiscItems" })),
123 Bin: "BIN_" + rawItem.bin,
124 QuantityMultiplier: 1,
125 Expiry: { $date: { $numberLong: cycleEnd.toString() } },
126 AllowMultipurchase: false,
127 LocTagRandSeed: (BigInt(rng.randomInt(0, 0xffffffff)) << 32n) | BigInt(rng.randomInt(0, 0xffffffff)),
128 Id: { $oid: "67e9da12793a120d" + rng.randomInt(0, 0xffffffff).toString(16).padStart(8, "0") }
129 });
130 }
131 return {
132 VendorInfo: {
133 _id: { $oid: "67dadc30e4b6e0e5979c8d84" },
134 TypeName: "/Lotus/Types/Game/VendorManifests/TheHex/InfestedLichWeaponVendorManifest",
135 ItemManifest: items,
136 PropertyTextHash: "77093DD05A8561A022DEC9A4B9BB4A56",
137 RandomSeedType: "VRST_WEAPON",
138 RequiredGoalTag: "",
139 WeaponUpgradeValueAttenuationExponent: 2.25,
140 Expiry: { $date: { $numberLong: cycleEnd.toString() } }
141 }
142 };
143 };
Modified src/types/vendorTypes.ts +5 -1
@@ -23,7 +23,7 @@ interface IItemManifest {
23 23 Id: IOid;
24 24 }
25 25
26 interface IItemManifestPreprocessed extends Omit<IItemManifest, "ItemPrices"> {
26 export interface IItemManifestPreprocessed extends Omit<IItemManifest, "ItemPrices"> {
27 27 ItemPrices?: IItemPricePreprocessed[];
28 28 }
29 29
@@ -31,6 +31,10 @@ interface IVendorInfo {
31 31 _id: IOid;
32 32 TypeName: string;
33 33 ItemManifest: IItemManifest[];
34 PropertyTextHash?: string;
35 RandomSeedType?: "VRST_WEAPON";
36 RequiredGoalTag?: string;
37 WeaponUpgradeValueAttenuationExponent?: number;
34 38 Expiry: IMongoDate; // Either a date in the distant future or a period in milliseconds for preprocessing.
35 39 }
36 40
Deleted static/fixed_responses/getVendorInfo/InfestedLichWeaponVendorManifest.json +0 -157
@@ -1,157 +0,0 @@
1 {
2 "VendorInfo": {
3 "_id": {
4 "$oid": "67dadc30e4b6e0e5979c8d84"
5 },
6 "TypeName": "/Lotus/Types/Game/VendorManifests/TheHex/InfestedLichWeaponVendorManifest",
7 "ItemManifest": [
8 {
9 "StoreItem": "/Lotus/StoreItems/Weapons/Infested/InfestedLich/LongGuns/1999InfShotgun/1999InfShotgunWeapon",
10 "ItemPrices": [
11 {
12 "ItemCount": 10,
13 "ItemType": "/Lotus/Types/Items/MiscItems/CodaWeaponBucks",
14 "ProductCategory": "MiscItems"
15 }
16 ],
17 "Bin": "BIN_1",
18 "QuantityMultiplier": 1,
19 "Expiry": {
20 "$date": {
21 "$numberLong": "9999999999999"
22 }
23 },
24 "PurchaseQuantityLimit": 1,
25 "AllowMultipurchase": false,
26 "LocTagRandSeed": 65079176837546984,
27 "Id": {
28 "$oid": "67e9da12793a120dbbc1c193"
29 }
30 },
31 {
32 "StoreItem": "/Lotus/StoreItems/Weapons/Infested/InfestedLich/Melee/CodaCaustacyst/CodaCaustacyst",
33 "ItemPrices": [
34 {
35 "ItemCount": 10,
36 "ItemType": "/Lotus/Types/Items/MiscItems/CodaWeaponBucks",
37 "ProductCategory": "MiscItems"
38 }
39 ],
40 "Bin": "BIN_1",
41 "QuantityMultiplier": 1,
42 "Expiry": {
43 "$date": {
44 "$numberLong": "9999999999999"
45 }
46 },
47 "PurchaseQuantityLimit": 1,
48 "AllowMultipurchase": false,
49 "LocTagRandSeed": 5687904240491804000,
50 "Id": {
51 "$oid": "67e9da12793a120dbbc1c194"
52 }
53 },
54 {
55 "StoreItem": "/Lotus/StoreItems/Weapons/Infested/InfestedLich/Melee/CodaPathocyst/CodaPathocyst",
56 "ItemPrices": [
57 {
58 "ItemCount": 10,
59 "ItemType": "/Lotus/Types/Items/MiscItems/CodaWeaponBucks",
60 "ProductCategory": "MiscItems"
61 }
62 ],
63 "Bin": "BIN_1",
64 "QuantityMultiplier": 1,
65 "Expiry": {
66 "$date": {
67 "$numberLong": "9999999999999"
68 }
69 },
70 "PurchaseQuantityLimit": 1,
71 "AllowMultipurchase": false,
72 "LocTagRandSeed": 6177144662234093000,
73 "Id": {
74 "$oid": "67e9da12793a120dbbc1c195"
75 }
76 },
77 {
78 "StoreItem": "/Lotus/StoreItems/Weapons/Infested/InfestedLich/Pistols/CodaTysis",
79 "ItemPrices": [
80 {
81 "ItemCount": 10,
82 "ItemType": "/Lotus/Types/Items/MiscItems/CodaWeaponBucks",
83 "ProductCategory": "MiscItems"
84 }
85 ],
86 "Bin": "BIN_1",
87 "QuantityMultiplier": 1,
88 "Expiry": {
89 "$date": {
90 "$numberLong": "9999999999999"
91 }
92 },
93 "PurchaseQuantityLimit": 1,
94 "AllowMultipurchase": false,
95 "LocTagRandSeed": 1988275604378227700,
96 "Id": {
97 "$oid": "67e9da12793a120dbbc1c196"
98 }
99 },
100 {
101 "StoreItem": "/Lotus/StoreItems/Weapons/Infested/InfestedLich/LongGuns/CodaSynapse",
102 "ItemPrices": [
103 {
104 "ItemCount": 10,
105 "ItemType": "/Lotus/Types/Items/MiscItems/CodaWeaponBucks",
106 "ProductCategory": "MiscItems"
107 }
108 ],
109 "Bin": "BIN_1",
110 "QuantityMultiplier": 1,
111 "Expiry": {
112 "$date": {
113 "$numberLong": "9999999999999"
114 }
115 },
116 "PurchaseQuantityLimit": 1,
117 "AllowMultipurchase": false,
118 "LocTagRandSeed": 8607452585593957000,
119 "Id": {
120 "$oid": "67e9da12793a120dbbc1c197"
121 }
122 },
123 {
124 "StoreItem": "/Lotus/StoreItems/Weapons/Infested/InfestedLich/Melee/CodaHirudo",
125 "ItemPrices": [
126 {
127 "ItemCount": 10,
128 "ItemType": "/Lotus/Types/Items/MiscItems/CodaWeaponBucks",
129 "ProductCategory": "MiscItems"
130 }
131 ],
132 "Bin": "BIN_1",
133 "QuantityMultiplier": 1,
134 "Expiry": {
135 "$date": {
136 "$numberLong": "9999999999999"
137 }
138 },
139 "PurchaseQuantityLimit": 1,
140 "AllowMultipurchase": false,
141 "LocTagRandSeed": 8385013066220909000,
142 "Id": {
143 "$oid": "67e9da12793a120dbbc1c198"
144 }
145 }
146 ],
147 "PropertyTextHash": "77093DD05A8561A022DEC9A4B9BB4A56",
148 "RandomSeedType": "VRST_WEAPON",
149 "RequiredGoalTag": "",
150 "WeaponUpgradeValueAttenuationExponent": 2.25,
151 "Expiry": {
152 "$date": {
153 "$numberLong": "9999999999999"
154 }
155 }
156 }
157 }