mirror of
https://github.com/sp-tarkov/server.git
synced 2025-02-13 09:50:43 -05:00
Fixed getAccountTypeAdjustedTraderPurchaseLimit()
not applying to unheard profiles
Created `GameVersions` enum and replaced all magic strings with it
This commit is contained in:
parent
04dee496eb
commit
4094b7ecff
@ -18,6 +18,7 @@ import {
|
|||||||
import { Appearance, Health, IBotType, Inventory } from "@spt/models/eft/common/tables/IBotType";
|
import { Appearance, Health, IBotType, Inventory } from "@spt/models/eft/common/tables/IBotType";
|
||||||
import { Item, Upd } from "@spt/models/eft/common/tables/IItem";
|
import { Item, Upd } from "@spt/models/eft/common/tables/IItem";
|
||||||
import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
|
import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
|
||||||
|
import { GameEditions } from "@spt/models/enums/GameEditions";
|
||||||
import { ItemTpl } from "@spt/models/enums/ItemTpl";
|
import { ItemTpl } from "@spt/models/enums/ItemTpl";
|
||||||
import { MemberCategory } from "@spt/models/enums/MemberCategory";
|
import { MemberCategory } from "@spt/models/enums/MemberCategory";
|
||||||
import { BotGenerationDetails } from "@spt/models/spt/bots/BotGenerationDetails";
|
import { BotGenerationDetails } from "@spt/models/spt/bots/BotGenerationDetails";
|
||||||
@ -213,7 +214,7 @@ export class BotGenerator
|
|||||||
{
|
{
|
||||||
bot.Info.IsStreamerModeAvailable = true; // Set to true so client patches can pick it up later - client sometimes alters botrole to assaultGroup
|
bot.Info.IsStreamerModeAvailable = true; // Set to true so client patches can pick it up later - client sometimes alters botrole to assaultGroup
|
||||||
chosenGameVersion = this.setRandomisedGameVersionAndCategory(bot.Info);
|
chosenGameVersion = this.setRandomisedGameVersionAndCategory(bot.Info);
|
||||||
if (chosenGameVersion === "unheard_edition")
|
if (chosenGameVersion === GameEditions.UNHEARD)
|
||||||
{
|
{
|
||||||
this.addAdditionalPocketLootWeightsForUnheardBot(botJsonTemplate);
|
this.addAdditionalPocketLootWeightsForUnheardBot(botJsonTemplate);
|
||||||
}
|
}
|
||||||
@ -585,7 +586,7 @@ export class BotGenerator
|
|||||||
{
|
{
|
||||||
if (botInfo.Nickname.toLowerCase() === "nikita")
|
if (botInfo.Nickname.toLowerCase() === "nikita")
|
||||||
{
|
{
|
||||||
botInfo.GameVersion = "unheard_edition";
|
botInfo.GameVersion = GameEditions.UNHEARD;
|
||||||
botInfo.MemberCategory = MemberCategory.DEVELOPER;
|
botInfo.MemberCategory = MemberCategory.DEVELOPER;
|
||||||
|
|
||||||
return botInfo.GameVersion;
|
return botInfo.GameVersion;
|
||||||
@ -648,9 +649,9 @@ export class BotGenerator
|
|||||||
{
|
{
|
||||||
switch (gameVersion)
|
switch (gameVersion)
|
||||||
{
|
{
|
||||||
case "edge_of_darkness":
|
case GameEditions.EDGE_OF_DARKNESS:
|
||||||
return ItemTpl.BARTER_DOGTAG_USEC_EOD;
|
return ItemTpl.BARTER_DOGTAG_USEC_EOD;
|
||||||
case "unheard_edition":
|
case GameEditions.UNHEARD:
|
||||||
return ItemTpl.BARTER_DOGTAG_USEC_TUE;
|
return ItemTpl.BARTER_DOGTAG_USEC_TUE;
|
||||||
default:
|
default:
|
||||||
return ItemTpl.BARTER_DOGTAG_USEC;
|
return ItemTpl.BARTER_DOGTAG_USEC;
|
||||||
@ -659,9 +660,9 @@ export class BotGenerator
|
|||||||
|
|
||||||
switch (gameVersion)
|
switch (gameVersion)
|
||||||
{
|
{
|
||||||
case "edge_of_darkness":
|
case GameEditions.EDGE_OF_DARKNESS:
|
||||||
return ItemTpl.BARTER_DOGTAG_BEAR_EOD;
|
return ItemTpl.BARTER_DOGTAG_BEAR_EOD;
|
||||||
case "unheard_edition":
|
case GameEditions.UNHEARD:
|
||||||
return ItemTpl.BARTER_DOGTAG_BEAR_TUE;
|
return ItemTpl.BARTER_DOGTAG_BEAR_TUE;
|
||||||
default:
|
default:
|
||||||
return ItemTpl.BARTER_DOGTAG_BEAR;
|
return ItemTpl.BARTER_DOGTAG_BEAR;
|
||||||
@ -674,7 +675,7 @@ export class BotGenerator
|
|||||||
*/
|
*/
|
||||||
protected setPmcPocketsByGameVersion(bot: IBotBase): void
|
protected setPmcPocketsByGameVersion(bot: IBotBase): void
|
||||||
{
|
{
|
||||||
if (bot.Info.GameVersion === "unheard_edition")
|
if (bot.Info.GameVersion === GameEditions.UNHEARD)
|
||||||
{
|
{
|
||||||
const pockets = bot.Inventory.items.find((item) => item.slotId === "Pockets");
|
const pockets = bot.Inventory.items.find((item) => item.slotId === "Pockets");
|
||||||
pockets._tpl = ItemTpl.POCKETS_1X4_TUE;
|
pockets._tpl = ItemTpl.POCKETS_1X4_TUE;
|
||||||
|
@ -11,6 +11,7 @@ import { Chances, Generation, IBotType, Inventory, Mods } from "@spt/models/eft/
|
|||||||
import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
|
import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
|
||||||
import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
|
import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
|
||||||
import { EquipmentSlots } from "@spt/models/enums/EquipmentSlots";
|
import { EquipmentSlots } from "@spt/models/enums/EquipmentSlots";
|
||||||
|
import { GameEditions } from "@spt/models/enums/GameEditions";
|
||||||
import { ItemTpl } from "@spt/models/enums/ItemTpl";
|
import { ItemTpl } from "@spt/models/enums/ItemTpl";
|
||||||
import {
|
import {
|
||||||
EquipmentFilterDetails,
|
EquipmentFilterDetails,
|
||||||
@ -191,7 +192,9 @@ export class BotInventoryGenerator
|
|||||||
// Generate below in specific order
|
// Generate below in specific order
|
||||||
this.generateEquipment({
|
this.generateEquipment({
|
||||||
rootEquipmentSlot: EquipmentSlots.POCKETS,
|
rootEquipmentSlot: EquipmentSlots.POCKETS,
|
||||||
rootEquipmentPool: chosenGameVersion === "unheard_edition" ? { [ItemTpl.POCKETS_1X4_TUE]: 1 } : templateInventory.equipment.Pockets,
|
rootEquipmentPool: chosenGameVersion === GameEditions.UNHEARD
|
||||||
|
? { [ItemTpl.POCKETS_1X4_TUE]: 1 }
|
||||||
|
: templateInventory.equipment.Pockets,
|
||||||
modPool: templateInventory.mods,
|
modPool: templateInventory.mods,
|
||||||
spawnChances: wornItemChances,
|
spawnChances: wornItemChances,
|
||||||
botRole: botRole,
|
botRole: botRole,
|
||||||
|
@ -7,6 +7,7 @@ import { IValidateNicknameRequestData } from "@spt/models/eft/profile/IValidateN
|
|||||||
import { AccountTypes } from "@spt/models/enums/AccountTypes";
|
import { AccountTypes } from "@spt/models/enums/AccountTypes";
|
||||||
import { BonusType } from "@spt/models/enums/BonusType";
|
import { BonusType } from "@spt/models/enums/BonusType";
|
||||||
import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
|
import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
|
||||||
|
import { GameEditions } from "@spt/models/enums/GameEditions";
|
||||||
import { SkillTypes } from "@spt/models/enums/SkillTypes";
|
import { SkillTypes } from "@spt/models/enums/SkillTypes";
|
||||||
import { IInventoryConfig } from "@spt/models/spt/config/IInventoryConfig";
|
import { IInventoryConfig } from "@spt/models/spt/config/IInventoryConfig";
|
||||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||||
@ -573,7 +574,7 @@ export class ProfileHelper
|
|||||||
|
|
||||||
public hasAccessToRepeatableFreeRefreshSystem(pmcProfile: IPmcData): boolean
|
public hasAccessToRepeatableFreeRefreshSystem(pmcProfile: IPmcData): boolean
|
||||||
{
|
{
|
||||||
return ["edge_of_darkness", "unheard_edition"]
|
return [GameEditions.EDGE_OF_DARKNESS, GameEditions.UNHEARD]
|
||||||
.includes(pmcProfile.Info?.GameVersion);
|
.includes(<any>pmcProfile.Info?.GameVersion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import { ProfileTraderTemplate } from "@spt/models/eft/common/tables/IProfileTem
|
|||||||
import { ITraderAssort, ITraderBase, LoyaltyLevel } from "@spt/models/eft/common/tables/ITrader";
|
import { ITraderAssort, ITraderBase, LoyaltyLevel } from "@spt/models/eft/common/tables/ITrader";
|
||||||
import { ISptProfile } from "@spt/models/eft/profile/ISptProfile";
|
import { ISptProfile } from "@spt/models/eft/profile/ISptProfile";
|
||||||
import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
|
import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
|
||||||
|
import { GameEditions } from "@spt/models/enums/GameEditions";
|
||||||
import { Money } from "@spt/models/enums/Money";
|
import { Money } from "@spt/models/enums/Money";
|
||||||
import { Traders } from "@spt/models/enums/Traders";
|
import { Traders } from "@spt/models/enums/Traders";
|
||||||
import { ITraderConfig } from "@spt/models/spt/config/ITraderConfig";
|
import { ITraderConfig } from "@spt/models/spt/config/ITraderConfig";
|
||||||
@ -459,7 +460,7 @@ export class TraderHelper
|
|||||||
*/
|
*/
|
||||||
public getAccountTypeAdjustedTraderPurchaseLimit(buyRestrictionMax: number, gameVersion: string): number
|
public getAccountTypeAdjustedTraderPurchaseLimit(buyRestrictionMax: number, gameVersion: string): number
|
||||||
{
|
{
|
||||||
if (["edge_of_darkness", "unheard"].includes(gameVersion))
|
if ([GameEditions.EDGE_OF_DARKNESS, GameEditions.UNHEARD].includes(<any>gameVersion))
|
||||||
{
|
{
|
||||||
return Math.floor(buyRestrictionMax * 1.2);
|
return Math.floor(buyRestrictionMax * 1.2);
|
||||||
}
|
}
|
||||||
|
9
project/src/models/enums/GameEditions.ts
Normal file
9
project/src/models/enums/GameEditions.ts
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
export enum GameEditions
|
||||||
|
{
|
||||||
|
STANDARD = "standard",
|
||||||
|
LEFT_BEHIND = "left_behind",
|
||||||
|
PREPARE_FOR_ESCAPE = "prepare_for_escape",
|
||||||
|
EDGE_OF_DARKNESS = "edge_of_darkness",
|
||||||
|
UNHEARD = "unheard_edition",
|
||||||
|
TOURNAMENT = "tournament_live",
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user