Split config of lasers/lights active status by raid day/night status, default to day if no raid found

Removed:
lightLaserIsActiveChancePercent
Added:
lightIsActiveDayChancePercent?: number;
lightIsActiveNightChancePercent?: number;
laserIsActiveChancePercent?: number;
This commit is contained in:
Dev 2023-04-08 13:18:01 +01:00
parent 31c00b2979
commit c60c67fce5
3 changed files with 104 additions and 30 deletions

View File

@ -268,7 +268,9 @@
"lightLaserLimit": 2
},
"faceShieldIsActiveChancePercent": 85,
"lightLaserIsActiveChancePercent": 75,
"lightIsActiveDayChancePercent": 25,
"lightIsActiveNightChancePercent": 85,
"laserIsActiveChancePercent": 75,
"weightingAdjustments": [{
"levelRange": {
"min": 1,
@ -293,7 +295,9 @@
"marksman": {
"nvgIsActiveChancePercent": 60,
"faceShieldIsActiveChancePercent": 100,
"lightLaserIsActiveChancePercent": 75,
"lightIsActiveDayChancePercent": 25,
"lightIsActiveNightChancePercent": 85,
"laserIsActiveChancePercent": 85,
"weaponModLimits": {
"scopeLimit": 1,
"lightLaserLimit": 1
@ -301,30 +305,42 @@
},
"cursedassault": {
"faceShieldIsActiveChancePercent": 90,
"lightLaserIsActiveChancePercent": 75
"lightIsActiveDayChancePercent": 25,
"lightIsActiveNightChancePercent": 75,
"laserIsActiveChancePercent": 75
},
"exusec": {
"nvgIsActiveChancePercent": 80,
"faceShieldIsActiveChancePercent": 100,
"lightLaserIsActiveChancePercent": 90
"lightIsActiveDayChancePercent": 25,
"lightIsActiveNightChancePercent": 90,
"laserIsActiveChancePercent": 85
},
"bossbully": {
"nvgIsActiveChancePercent": 75,
"faceShieldIsActiveChancePercent": 100,
"lightLaserIsActiveChancePercent": 75
"lightIsActiveDayChancePercent": 25,
"lightIsActiveNightChancePercent": 75,
"laserIsActiveChancePercent": 75
},
"bossgluhar": {
"nvgIsActiveChancePercent": 80,
"faceShieldIsActiveChancePercent": 100,
"lightLaserIsActiveChancePercent": 95
"lightIsActiveDayChancePercent": 45,
"lightIsActiveNightChancePercent": 95,
"laserIsActiveChancePercent": 95
},
"bosskilla": {
"faceShieldIsActiveChancePercent": 100,
"lightLaserIsActiveChancePercent": 75
"lightIsActiveDayChancePercent": 35,
"lightIsActiveNightChancePercent": 85,
"laserIsActiveChancePercent": 85
},
"bosskojaniy": {
"faceShieldIsActiveChancePercent": 100,
"lightLaserIsActiveChancePercent": 75,
"lightIsActiveDayChancePercent": 25,
"lightIsActiveNightChancePercent": 75,
"laserIsActiveChancePercent": 75,
"weaponModLimits": {
"scopeLimit": 1,
"lightLaserLimit": 1
@ -332,57 +348,81 @@
},
"bosssanitar": {
"faceShieldIsActiveChancePercent": 100,
"lightLaserIsActiveChancePercent": 75
"lightIsActiveDayChancePercent": 25,
"lightIsActiveNightChancePercent": 75,
"laserIsActiveChancePercent": 85
},
"bosstagilla": {
"faceShieldIsActiveChancePercent": 100,
"lightLaserIsActiveChancePercent": 75
"lightIsActiveDayChancePercent": 25,
"lightIsActiveNightChancePercent": 75,
"laserIsActiveChancePercent": 75
},
"bossknight": {
"nvgIsActiveChancePercent": 90,
"faceShieldIsActiveChancePercent": 100,
"lightLaserIsActiveChancePercent": 75
"lightIsActiveDayChancePercent": 25,
"lightIsActiveNightChancePercent": 75,
"laserIsActiveChancePercent": 75
},
"bosszryachiy": {
"nvgIsActiveChancePercent": 90,
"lightLaserIsActiveChancePercent": 95
"lightIsActiveDayChancePercent": 25,
"lightIsActiveNightChancePercent": 85,
"laserIsActiveChancePercent": 85
},
"bosstest": {},
"followerbully": {
"faceShieldIsActiveChancePercent": 100,
"lightLaserIsActiveChancePercent": 75
"lightIsActiveDayChancePercent": 25,
"lightIsActiveNightChancePercent": 75,
"laserIsActiveChancePercent": 75
},
"followergluharassault": {
"nvgIsActiveChancePercent": 75,
"faceShieldIsActiveChancePercent": 100,
"lightLaserIsActiveChancePercent": 75
"lightIsActiveDayChancePercent": 25,
"lightIsActiveNightChancePercent": 75,
"laserIsActiveChancePercent": 75
},
"followergluharscout": {
"faceShieldIsActiveChancePercent": 100,
"lightLaserIsActiveChancePercent": 75
"lightIsActiveDayChancePercent": 25,
"lightIsActiveNightChancePercent": 75,
"laserIsActiveChancePercent": 75
},
"followergluharsecurity": {
"faceShieldIsActiveChancePercent": 100,
"lightLaserIsActiveChancePercent": 75
"lightIsActiveDayChancePercent": 25,
"lightIsActiveNightChancePercent": 75,
"laserIsActiveChancePercent": 75
},
"followergluharsnipe": {
"faceShieldIsActiveChancePercent": 100,
"lightLaserIsActiveChancePercent": 75
"lightIsActiveDayChancePercent": 25,
"lightIsActiveNightChancePercent": 75,
"laserIsActiveChancePercent": 75
},
"followerkojaniy": {
"nvgIsActiveChancePercent": 80,
"faceShieldIsActiveChancePercent": 100,
"lightLaserIsActiveChancePercent": 75
"lightIsActiveDayChancePercent": 25,
"lightIsActiveNightChancePercent": 75,
"laserIsActiveChancePercent": 75
},
"followersanitar": {
"faceShieldIsActiveChancePercent": 100,
"lightLaserIsActiveChancePercent": 75
"lightIsActiveDayChancePercent": 25,
"lightIsActiveNightChancePercent": 75,
"laserIsActiveChancePercent": 75
},
"followertagilla": {},
"followerbirdeye": {
"nvgIsActiveChancePercent": 80,
"faceShieldIsActiveChancePercent": 100,
"lightLaserIsActiveChancePercent": 75,
"lightIsActiveDayChancePercent": 25,
"lightIsActiveNightChancePercent": 75,
"laserIsActiveChancePercent": 75,
"weaponModLimits": {
"scopeLimit": 1,
"lightLaserLimit": 1
@ -391,28 +431,38 @@
"followerbigpipe": {
"nvgIsActiveChancePercent": 90,
"faceShieldIsActiveChancePercent": 100,
"lightLaserIsActiveChancePercent": 75
"lightIsActiveDayChancePercent": 25,
"lightIsActiveNightChancePercent": 75,
"laserIsActiveChancePercent": 75
},
"followerzryachiy": {
"nvgIsActiveChancePercent": 90,
"lightLaserIsActiveChancePercent": 95
"lightIsActiveDayChancePercent": 25,
"lightIsActiveNightChancePercent": 85,
"laserIsActiveChancePercent": 85
},
"followertest": {},
"sectantpriest": {
"nvgIsActiveChancePercent": 100,
"faceShieldIsActiveChancePercent": 100,
"lightLaserIsActiveChancePercent": 95
"lightIsActiveDayChancePercent": 25,
"lightIsActiveNightChancePercent": 85,
"laserIsActiveChancePercent": 95
},
"sectantwarrior": {
"nvgIsActiveChancePercent": 100,
"faceShieldIsActiveChancePercent": 100,
"lightLaserIsActiveChancePercent": 95
"lightIsActiveDayChancePercent": 25,
"lightIsActiveNightChancePercent": 75,
"laserIsActiveChancePercent": 95
},
"test": {},
"pmcbot": {
"nvgIsActiveChancePercent": 80,
"faceShieldIsActiveChancePercent": 100,
"lightLaserIsActiveChancePercent": 75,
"lightIsActiveDayChancePercent": 35,
"lightIsActiveNightChancePercent": 95,
"laserIsActiveChancePercent": 95,
"weaponModLimits": {
"scopeLimit": 1,
"lightLaserLimit": 1
@ -420,7 +470,9 @@
},
"assaultgroup": {},
"gifter": {
"lightLaserIsActiveChancePercent": 50
"lightIsActiveDayChancePercent": 25,
"lightIsActiveNightChancePercent": 75,
"laserIsActiveChancePercent": 75
},
"pmc": {
"weaponModLimits": {
@ -441,7 +493,9 @@
},
"nvgIsActiveChancePercent": 50,
"faceShieldIsActiveChancePercent": 85,
"lightLaserIsActiveChancePercent": 75,
"lightIsActiveDayChancePercent": 25,
"lightIsActiveNightChancePercent": 95,
"laserIsActiveChancePercent": 85,
"randomisation": [{
"levelRange": {
"min": 1,

View File

@ -1,8 +1,13 @@
import { inject, injectable } from "tsyringe";
import { ApplicationContext } from "../context/ApplicationContext";
import { ContextVariableType } from "../context/ContextVariableType";
import { DurabilityLimitsHelper } from "../helpers/DurabilityLimitsHelper";
import { Item, Repairable, Upd } from "../models/eft/common/tables/IItem";
import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem";
import {
IGetRaidConfigurationRequestData
} from "../models/eft/match/IGetRaidConfigurationRequestData";
import { BaseClasses } from "../models/enums/BaseClasses";
import { ConfigTypes } from "../models/enums/ConfigTypes";
import { EquipmentFilters, IBotConfig } from "../models/spt/config/IBotConfig";
@ -25,6 +30,7 @@ export class BotGeneratorHelper
@inject("DatabaseServer") protected databaseServer: DatabaseServer,
@inject("DurabilityLimitsHelper") protected durabilityLimitsHelper: DurabilityLimitsHelper,
@inject("ItemHelper") protected itemHelper: ItemHelper,
@inject("ApplicationContext") protected applicationContext: ApplicationContext,
@inject("LocalisationService") protected localisationService: LocalisationService,
@inject("ConfigServer") protected configServer: ConfigServer
)
@ -87,10 +93,22 @@ export class BotGeneratorHelper
itemProperties.FoodDrink = { HpPercent: itemTemplate._props.MaxResource };
}
if ([BaseClasses.FLASHLIGHT, BaseClasses.TACTICAL_COMBO].includes(<BaseClasses>itemTemplate._parent))
if (itemTemplate._parent === BaseClasses.FLASHLIGHT)
{
// Get raid settings, if no raid, default to day
const raidSettings = this.applicationContext.getLatestValue(ContextVariableType.RAID_CONFIGURATION)?.getValue<IGetRaidConfigurationRequestData>();
const raidIsNight = raidSettings?.timeVariant === "PAST";
// Get chance from botconfig for bot type, use 50% if no value found
const lightLaserActiveChance = raidIsNight
? this.getBotEquipmentSettingFromConfig(botRole, "lightIsActiveNightChancePercent", 50)
: this.getBotEquipmentSettingFromConfig(botRole, "lightIsActiveDayChancePercent", 25);
itemProperties.Light = { IsActive: (this.randomUtil.getChance100(lightLaserActiveChance)), SelectedMode: 0 };
}
else if (itemTemplate._parent === BaseClasses.TACTICAL_COMBO)
{
// Get chance from botconfig for bot type, use 50% if no value found
const lightLaserActiveChance = this.getBotEquipmentSettingFromConfig(botRole, "lightLaserIsActiveChancePercent", 50);
const lightLaserActiveChance = this.getBotEquipmentSettingFromConfig(botRole, "laserIsActiveChancePercent", 50);
itemProperties.Light = { IsActive: (this.randomUtil.getChance100(lightLaserActiveChance)), SelectedMode: 0 };
}

View File

@ -78,7 +78,9 @@ export interface EquipmentFilters
weaponModLimits: ModLimits
weaponSightWhitelist: Record<string, string[]>
faceShieldIsActiveChancePercent?: number;
lightLaserIsActiveChancePercent?: number;
lightIsActiveDayChancePercent?: number;
lightIsActiveNightChancePercent?: number;
laserIsActiveChancePercent?: number;
nvgIsActiveChancePercent?: number;
randomisation: RandomisationDetails[]
blacklist: EquipmentFilterDetails[]