Skip to content

Commit b863023

Browse files
committed
Adds vehicle payment configuration
- Adds the ability to adjust vehicle payment items and amounts. - Adjusts default coop extract to $75.
1 parent 2a73967 commit b863023

File tree

4 files changed

+86
-22
lines changed

4 files changed

+86
-22
lines changed

config/config.json5

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,25 @@
6363
// Enable CO-OP extracts via payment
6464
convertToPayment: false,
6565

66-
// Item needed for payment. Default is "5449016a4bdc2d6f028b456f" (Ruble).
66+
// Item needed for co-op extract payment. Default is "5696686a4bdc2da3298b456a" (Dollars).
6767
// Hint: Use https://db.sp-tarkov.com to find the item ID.
68-
item: "5449016a4bdc2d6f028b456f",
68+
item: "5696686a4bdc2da3298b456a",
6969

70-
// Number of items required for payment. Default is 7500 (Rubles).
71-
number: 7500,
70+
// Number of items required for payment. Default is 75 dollars.
71+
number: 75,
7272
},
73+
74+
// Vehicle extracts settings
75+
vehicle: {
76+
// Enable vehicle payment changes
77+
adjustPayment: false,
78+
79+
// Item needed for vehicle extract payment. Default is "5449016a4bdc2d6f028b456f" (Roubles).
80+
// Hint: Use https://db.sp-tarkov.com to find the item ID.
81+
item: "5449016a4bdc2d6f028b456f",
82+
83+
// Number of items required for payment. Default is 5000 rubles.
84+
number: 5000,
85+
}
7386
},
7487
}

src/adjusters/ExtractAdjuster.ts

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ export class ExtractAdjuster {
6060
}
6161

6262
this.convertCooperationToPayment(extract, location);
63+
this.adjustVehiclePayment(extract, location);
6364
this.removeBackpackRequirement(extract, location);
6465
this.removeCliffRequirements(extract, location);
6566
}
@@ -278,7 +279,7 @@ export class ExtractAdjuster {
278279
}
279280

280281
if (!ExtractAdjuster.isCliffExtract(extract)) {
281-
// This isn't a cliff extract;
282+
// This isn't a cliff extract.
282283
return;
283284
}
284285

@@ -325,4 +326,51 @@ export class ExtractAdjuster {
325326
const location = gameLocationName.toLowerCase();
326327
return ExtractAdjuster.locationNameMappings[location]?.[nameType] || location;
327328
}
329+
330+
/**
331+
* Adjusts the vehicle payment item information.
332+
*/
333+
private adjustVehiclePayment(extract: Exit, location: ILocationBase): void {
334+
if (!OpenExtracts.config.extracts.vehicle.adjustPayment) {
335+
// Option has been disabled in the configuration file.
336+
return;
337+
}
338+
339+
if (!this.isVehicleExtract(extract)) {
340+
// This isn't a vehicle extract.
341+
return;
342+
}
343+
344+
extract.Id = OpenExtracts.config.extracts.vehicle.item;
345+
extract.Count = OpenExtracts.config.extracts.vehicle.number;
346+
347+
if (OpenExtracts.config.general.debug) {
348+
OpenExtracts.logger.log(
349+
`OpenExtracts: ${extract.Name.trim()} on ${this.getLocationName(
350+
location.Id,
351+
"human"
352+
)} has had payment options adjusted.`,
353+
"gray"
354+
);
355+
}
356+
}
357+
358+
/**
359+
* Determines whether the specified extract is a vehicle extract.
360+
*/
361+
private isVehicleExtract(extract: Exit): boolean {
362+
const vehicleExtracts = [
363+
"dorms v-ex",
364+
"pp exfil",
365+
"v-ex_light",
366+
"south v-ex",
367+
"e7_car",
368+
"sandbox_vexit",
369+
"shorl_v-ex"
370+
];
371+
return (
372+
extract.Name.trim().toLowerCase().includes("v-ex") ||
373+
vehicleExtracts.includes(extract.Name.trim().toLowerCase())
374+
);
375+
}
328376
}

src/schemas/ConfigSchema.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,16 @@ export class ConfigSchema {
117117
required: ["convertToPayment", "item", "number"],
118118
additionalProperties: false,
119119
},
120+
vehicle: {
121+
type: "object",
122+
properties: {
123+
adjustPayment: { type: "boolean" },
124+
item: { type: "string" },
125+
number: { type: "number", minimum: 0, maximum: 65535 },
126+
},
127+
required: ["adjustPayment", "item", "number"],
128+
additionalProperties: false,
129+
},
120130
},
121131
required: [
122132
"ignoreEntryPoint",

src/types.ts

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,24 @@ export interface Configuration {
44
extracts: Extracts;
55
}
66

7-
// The configuration file structure for the "general" section.
7+
// The configuration structure for the "general" section.
88
export interface General {
99
enabled: boolean;
1010
debug: boolean;
1111
}
1212

13-
// The configuration file structure for the "extracts" section.
13+
// The configuration structure for the "extracts" section.
1414
export interface Extracts {
1515
ignoreEntryPoint: boolean;
1616
ignoreCliffRequirements: boolean;
1717
ignoreBackpackRequirements: boolean;
1818
maxExtractionTime: number;
1919
random: Random;
2020
cooperation: Cooperation;
21+
vehicle: Vehicle;
2122
}
2223

23-
// The configuration file structure for the "random" section.
24+
// The configuration structure for the "random" section.
2425
export interface Random {
2526
enabled: boolean;
2627
chances: {
@@ -30,24 +31,16 @@ export interface Random {
3031
};
3132
}
3233

33-
// The configuration file structure for the "cooperation" section.
34+
// The configuration structure for the "cooperation" section.
3435
export interface Cooperation {
3536
convertToPayment: boolean;
3637
item: string;
3738
number: number;
3839
}
3940

40-
export interface ExtractHistory {
41-
[sessionId: string]: ExtractRecord[];
42-
}
43-
44-
export interface ExtractRecord {
45-
extractName: string;
46-
timestamp: string; // ISO 8601 format (UTC timezone)
47-
}
48-
49-
export interface FenceMessages {
50-
[language: string]: {
51-
[messageKey: string]: string;
52-
};
41+
// The configuration structure for the "vehicle" section.
42+
export interface Vehicle {
43+
adjustPayment: boolean;
44+
item: string;
45+
number: number;
5346
}

0 commit comments

Comments
 (0)