Replace labsAccessCardChancePercent
with lootItemsToAddChancePercent
inside playerscav.json
Fixed scav generation on profile generation always using fence rep 0 Added small % chance to add red flare to pscav
This commit is contained in:
parent
2965709535
commit
7bc867a8f7
@ -77,7 +77,9 @@
|
|||||||
"whitelist": []
|
"whitelist": []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"labsAccessCardChancePercent": 0
|
"labsAccessCardChancePercent": 0,
|
||||||
|
"lootItemsToAddChancePercent": {
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"-6": {
|
"-6": {
|
||||||
"botTypeForLoot": "assault",
|
"botTypeForLoot": "assault",
|
||||||
@ -162,7 +164,8 @@
|
|||||||
"whitelist": []
|
"whitelist": []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"labsAccessCardChancePercent": 0
|
"lootItemsToAddChancePercent": {
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"-5": {
|
"-5": {
|
||||||
"botTypeForLoot": "assault",
|
"botTypeForLoot": "assault",
|
||||||
@ -247,7 +250,8 @@
|
|||||||
"whitelist": []
|
"whitelist": []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"labsAccessCardChancePercent": 0
|
"lootItemsToAddChancePercent": {
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"-4": {
|
"-4": {
|
||||||
"botTypeForLoot": "assault",
|
"botTypeForLoot": "assault",
|
||||||
@ -332,7 +336,8 @@
|
|||||||
"whitelist": []
|
"whitelist": []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"labsAccessCardChancePercent": 0
|
"lootItemsToAddChancePercent": {
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"-3": {
|
"-3": {
|
||||||
"botTypeForLoot": "assault",
|
"botTypeForLoot": "assault",
|
||||||
@ -417,7 +422,8 @@
|
|||||||
"whitelist": []
|
"whitelist": []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"labsAccessCardChancePercent": 0
|
"lootItemsToAddChancePercent": {
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"-2": {
|
"-2": {
|
||||||
"botTypeForLoot": "assault",
|
"botTypeForLoot": "assault",
|
||||||
@ -502,7 +508,8 @@
|
|||||||
"whitelist": []
|
"whitelist": []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"labsAccessCardChancePercent": 0
|
"lootItemsToAddChancePercent": {
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"-1": {
|
"-1": {
|
||||||
"botTypeForLoot": "assault",
|
"botTypeForLoot": "assault",
|
||||||
@ -587,7 +594,8 @@
|
|||||||
"whitelist": []
|
"whitelist": []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"labsAccessCardChancePercent": 0
|
"lootItemsToAddChancePercent": {
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"0": {
|
"0": {
|
||||||
"botTypeForLoot": "assault",
|
"botTypeForLoot": "assault",
|
||||||
@ -672,7 +680,8 @@
|
|||||||
"whitelist": []
|
"whitelist": []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"labsAccessCardChancePercent": 0
|
"lootItemsToAddChancePercent": {
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"1": {
|
"1": {
|
||||||
"botTypeForLoot": "assault",
|
"botTypeForLoot": "assault",
|
||||||
@ -759,7 +768,9 @@
|
|||||||
"whitelist": []
|
"whitelist": []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"labsAccessCardChancePercent": 3
|
"lootItemsToAddChancePercent": {
|
||||||
|
"5c94bbff86f7747ee735c08f": 3
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"2": {
|
"2": {
|
||||||
"botTypeForLoot": "assault",
|
"botTypeForLoot": "assault",
|
||||||
@ -842,7 +853,10 @@
|
|||||||
"whitelist": []
|
"whitelist": []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"labsAccessCardChancePercent": 6
|
"lootItemsToAddChancePercent": {
|
||||||
|
"5c94bbff86f7747ee735c08f": 6,
|
||||||
|
"62178c4d4ecf221597654e3d": 3
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"3": {
|
"3": {
|
||||||
"botTypeForLoot": "assault",
|
"botTypeForLoot": "assault",
|
||||||
@ -928,7 +942,10 @@
|
|||||||
"whitelist": []
|
"whitelist": []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"labsAccessCardChancePercent": 11
|
"lootItemsToAddChancePercent": {
|
||||||
|
"5c94bbff86f7747ee735c08f": 11,
|
||||||
|
"62178c4d4ecf221597654e3d": 8
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"4": {
|
"4": {
|
||||||
"botTypeForLoot": "assault",
|
"botTypeForLoot": "assault",
|
||||||
@ -1013,7 +1030,11 @@
|
|||||||
"whitelist": []
|
"whitelist": []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"labsAccessCardChancePercent": 17
|
"lootItemsToAddChancePercent": {
|
||||||
|
"5c94bbff86f7747ee735c08f": 17,
|
||||||
|
"62178c4d4ecf221597654e3d": 13
|
||||||
|
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"5": {
|
"5": {
|
||||||
"botTypeForLoot": "assault",
|
"botTypeForLoot": "assault",
|
||||||
@ -1098,7 +1119,10 @@
|
|||||||
"whitelist": []
|
"whitelist": []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"labsAccessCardChancePercent": 22
|
"lootItemsToAddChancePercent": {
|
||||||
|
"5c94bbff86f7747ee735c08f": 22,
|
||||||
|
"62178c4d4ecf221597654e3d": 18
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"6": {
|
"6": {
|
||||||
"botTypeForLoot": "assault",
|
"botTypeForLoot": "assault",
|
||||||
@ -1182,7 +1206,10 @@
|
|||||||
"whitelist": []
|
"whitelist": []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"labsAccessCardChancePercent": 27
|
"lootItemsToAddChancePercent": {
|
||||||
|
"5c94bbff86f7747ee735c08f": 27,
|
||||||
|
"62178c4d4ecf221597654e3d": 23
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -214,10 +214,10 @@ export class ProfileController
|
|||||||
this.givePlayerStartingQuestRewards(profileDetails, sessionID, response);
|
this.givePlayerStartingQuestRewards(profileDetails, sessionID, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.saveServer.getProfile(sessionID).characters.scav = this.generatePlayerScav(sessionID);
|
|
||||||
|
|
||||||
this.resetAllTradersInProfile(sessionID);
|
this.resetAllTradersInProfile(sessionID);
|
||||||
|
|
||||||
|
this.saveServer.getProfile(sessionID).characters.scav = this.generatePlayerScav(sessionID);
|
||||||
|
|
||||||
// Store minimal profile and reload it
|
// Store minimal profile and reload it
|
||||||
this.saveServer.saveProfile(sessionID);
|
this.saveServer.saveProfile(sessionID);
|
||||||
this.saveServer.loadProfile(sessionID);
|
this.saveServer.loadProfile(sessionID);
|
||||||
|
@ -7,7 +7,7 @@ import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHel
|
|||||||
import { ItemHelper } from "@spt-aki/helpers/ItemHelper";
|
import { ItemHelper } from "@spt-aki/helpers/ItemHelper";
|
||||||
import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper";
|
import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper";
|
||||||
import { IPmcData } from "@spt-aki/models/eft/common/IPmcData";
|
import { IPmcData } from "@spt-aki/models/eft/common/IPmcData";
|
||||||
import { Settings, Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase";
|
import { IBotBase, Settings, Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase";
|
||||||
import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType";
|
import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType";
|
||||||
import { Item } from "@spt-aki/models/eft/common/tables/IItem";
|
import { Item } from "@spt-aki/models/eft/common/tables/IItem";
|
||||||
import { AccountTypes } from "@spt-aki/models/enums/AccountTypes";
|
import { AccountTypes } from "@spt-aki/models/enums/AccountTypes";
|
||||||
@ -67,10 +67,7 @@ export class PlayerScavGenerator
|
|||||||
const pmcDataClone = this.jsonUtil.clone(profile.characters.pmc);
|
const pmcDataClone = this.jsonUtil.clone(profile.characters.pmc);
|
||||||
const existingScavDataClone = this.jsonUtil.clone(profile.characters.scav);
|
const existingScavDataClone = this.jsonUtil.clone(profile.characters.scav);
|
||||||
|
|
||||||
// scav profile can be empty on first profile creation
|
const scavKarmaLevel = this.getScavKarmaLevel(pmcDataClone);
|
||||||
const scavKarmaLevel = (Object.keys(existingScavDataClone).length === 0)
|
|
||||||
? 0
|
|
||||||
: this.getScavKarmaLevel(pmcDataClone);
|
|
||||||
|
|
||||||
// use karma level to get correct karmaSettings
|
// use karma level to get correct karmaSettings
|
||||||
const playerScavKarmaSettings = this.playerScavConfig.karmaLevel[scavKarmaLevel];
|
const playerScavKarmaSettings = this.playerScavConfig.karmaLevel[scavKarmaLevel];
|
||||||
@ -121,28 +118,12 @@ export class PlayerScavGenerator
|
|||||||
scavData.WishList = existingScavDataClone.WishList ?? [];
|
scavData.WishList = existingScavDataClone.WishList ?? [];
|
||||||
scavData.Encyclopedia = pmcDataClone.Encyclopedia;
|
scavData.Encyclopedia = pmcDataClone.Encyclopedia;
|
||||||
|
|
||||||
// Add an extra labs card to pscav backpack based on config chance
|
// Add additional items to player scav as loot
|
||||||
if (this.randomUtil.getChance100(playerScavKarmaSettings.labsAccessCardChancePercent))
|
this.addAdditionalLootToPlayerScavContainers(playerScavKarmaSettings.lootItemsToAddChancePercent, scavData, [
|
||||||
{
|
"TacticalVest",
|
||||||
const labsCard = this.itemHelper.getItem("5c94bbff86f7747ee735c08f")[1];
|
"Pockets",
|
||||||
const itemsToAdd: Item[] = [{
|
"Backpack",
|
||||||
_id: this.hashUtil.generate(),
|
]);
|
||||||
_tpl: labsCard._id,
|
|
||||||
...this.botGeneratorHelper.generateExtraPropertiesForItem(labsCard),
|
|
||||||
}];
|
|
||||||
const result = this.botWeaponGeneratorHelper.addItemWithChildrenToEquipmentSlot(
|
|
||||||
["TacticalVest", "Pockets", "Backpack"],
|
|
||||||
itemsToAdd[0]._id,
|
|
||||||
labsCard._id,
|
|
||||||
itemsToAdd,
|
|
||||||
scavData.Inventory,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (result !== ItemAddedResult.SUCCESS)
|
|
||||||
{
|
|
||||||
this.logger.debug(`Unable to add keycard to bot. Reason: ${ItemAddedResult[result]}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove secure container
|
// Remove secure container
|
||||||
scavData = this.profileHelper.removeSecureContainer(scavData);
|
scavData = this.profileHelper.removeSecureContainer(scavData);
|
||||||
@ -156,6 +137,55 @@ export class PlayerScavGenerator
|
|||||||
return scavData;
|
return scavData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add items picked from `playerscav.lootItemsToAddChancePercent`
|
||||||
|
* @param possibleItemsToAdd dict of tpl + % chance to be added
|
||||||
|
* @param scavData
|
||||||
|
* @param containersToAddTo Possible slotIds to add loot to
|
||||||
|
*/
|
||||||
|
protected addAdditionalLootToPlayerScavContainers(
|
||||||
|
possibleItemsToAdd: Record<string, number>,
|
||||||
|
scavData: IBotBase,
|
||||||
|
containersToAddTo: string[],
|
||||||
|
): void
|
||||||
|
{
|
||||||
|
for (const tpl in possibleItemsToAdd)
|
||||||
|
{
|
||||||
|
const shouldAdd = this.randomUtil.getChance100(possibleItemsToAdd[tpl]);
|
||||||
|
if (!shouldAdd)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const itemResult = this.itemHelper.getItem(tpl);
|
||||||
|
if (!itemResult[0])
|
||||||
|
{
|
||||||
|
this.logger.warning(`Unable to add ${tpl} to player scav, not an item`);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const itemTemplate = itemResult[1];
|
||||||
|
const itemsToAdd: Item[] = [{
|
||||||
|
_id: this.hashUtil.generate(),
|
||||||
|
_tpl: itemTemplate._id,
|
||||||
|
...this.botGeneratorHelper.generateExtraPropertiesForItem(itemTemplate),
|
||||||
|
}];
|
||||||
|
|
||||||
|
const result = this.botWeaponGeneratorHelper.addItemWithChildrenToEquipmentSlot(
|
||||||
|
containersToAddTo,
|
||||||
|
itemsToAdd[0]._id,
|
||||||
|
itemTemplate._id,
|
||||||
|
itemsToAdd,
|
||||||
|
scavData.Inventory,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (result !== ItemAddedResult.SUCCESS)
|
||||||
|
{
|
||||||
|
this.logger.debug(`Unable to add keycard to bot. Reason: ${ItemAddedResult[result]}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the scav karama level for a profile
|
* Get the scav karama level for a profile
|
||||||
* Is also the fence trader rep level
|
* Is also the fence trader rep level
|
||||||
|
@ -13,7 +13,7 @@ export interface KarmaLevel
|
|||||||
modifiers: Modifiers;
|
modifiers: Modifiers;
|
||||||
itemLimits: ItemLimits;
|
itemLimits: ItemLimits;
|
||||||
equipmentBlacklist: Record<string, string[]>;
|
equipmentBlacklist: Record<string, string[]>;
|
||||||
labsAccessCardChancePercent: number;
|
lootItemsToAddChancePercent: Record<string, number>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Modifiers
|
export interface Modifiers
|
||||||
|
Loading…
Reference in New Issue
Block a user