Wallet loot improvements:

Added % chance to have loot to config
Added currency added weigfht system to config (only roubles by default)
Added allowed wallet types array to config
Added WZ wallet to pool of wallets to add money to

Fixed bug where itemCount type was incorrect
This commit is contained in:
Dev 2024-03-04 20:18:53 +00:00
parent 534e9d2ba1
commit 63d5da4c18
3 changed files with 23 additions and 8 deletions

View File

@ -2486,6 +2486,7 @@
"default": 16
},
"walletLoot": {
"chancePercent": 35,
"itemCount": {
"min": 1,
"max": 3
@ -2496,6 +2497,12 @@
"15000": 4,
"10000": 7,
"5000": 10
}
},
"currencyWeight": {
"5449016a4bdc2d6f028b456f": 1,
"569668774bdc2da2298b4568": 0,
"5696686a4bdc2da3298b456a": 0
},
"walletTplPool": ["5783c43d2459774bbe137486", "60b0f6c058e0b0481a09ad11"]
}
}

View File

@ -404,10 +404,10 @@ export class BotLootGenerator
}];
// Is Simple-Wallet
if (weightedItemTpl === "5783c43d2459774bbe137486")
if (this.botConfig.walletLoot.walletTplPool.includes(weightedItemTpl))
{
const addCurrency = this.randomUtil.getChance100(25);
if (addCurrency)
const addCurrencyToWallet = this.randomUtil.getChance100(this.botConfig.walletLoot.chancePercent);
if (addCurrencyToWallet)
{
// Create the currency items we want to add to wallet
const itemsToAdd = this.createWalletLoot(newRootItemId);
@ -499,16 +499,19 @@ export class BotLootGenerator
const result: Item[][] = [];
// Choose how many stacks of currency will be added to wallet
const itemCount = this.randomUtil.getInt(1, this.botConfig.walletLoot.itemCount);
const itemCount = this.randomUtil.getInt(
this.botConfig.walletLoot.itemCount.min,
this.botConfig.walletLoot.itemCount.max,
);
for (let index = 0; index < itemCount; index++)
{
// Choose the size of the currency stack
// Choose the size of the currency stack - default is 5k, 10k, 15k, 20k, 25k
const chosenStackCount = Number(
this.weightedRandomHelper.getWeightedValue<string>(this.botConfig.walletLoot.stackSizeWeight),
);
result.push([{
_id: this.hashUtil.generate(),
_tpl: "5449016a4bdc2d6f028b456f", // TODO - extend to be more than just roubles
_tpl: this.weightedRandomHelper.getWeightedValue<string>(this.botConfig.walletLoot.currencyWeight),
parentId: walletId,
upd: { StackObjectsCount: chosenStackCount },
}]);

View File

@ -84,8 +84,13 @@ export interface PresetBatch
export interface IWalletLootSettings
{
itemCount: number;
/** Chance wallets have loot in them */
chancePercent: number;
itemCount: MinMax;
stackSizeWeight: Record<string, number>;
currencyWeight: Record<string, number>;
/** What wallets will have money in them */
walletTplPool: string[];
}
export interface EquipmentFilters