Formatting and naming consistency changes
This commit is contained in:
@@ -80,7 +80,7 @@ public class BotEquipmentModGenerator(
|
||||
const string modScopeKey = "mod_scope";
|
||||
const string modScope000Key = "mod_scope_000";
|
||||
|
||||
protected readonly BotConfig _botConfig = configServer.GetConfig<BotConfig>();
|
||||
protected readonly BotConfig BotConfig = configServer.GetConfig<BotConfig>();
|
||||
|
||||
/// <summary>
|
||||
/// Check mods are compatible and add to array
|
||||
@@ -460,7 +460,7 @@ public class BotEquipmentModGenerator(
|
||||
// Get pool of mods that fit weapon
|
||||
request.ModPool.TryGetValue(request.ParentTemplate.Id, out var compatibleModsPool);
|
||||
|
||||
_botConfig.Equipment.TryGetValue(request.BotData.EquipmentRole, out var botEquipConfig);
|
||||
BotConfig.Equipment.TryGetValue(request.BotData.EquipmentRole, out var botEquipConfig);
|
||||
var botEquipBlacklist = botEquipmentFilterService.GetBotEquipmentBlacklist(
|
||||
request.BotData.EquipmentRole,
|
||||
pmcProfile?.Info?.Level ?? 0
|
||||
@@ -996,7 +996,7 @@ public class BotEquipmentModGenerator(
|
||||
if ((request.WeaponStats?.HasOptic ?? false) && modPool.Count > 1)
|
||||
{
|
||||
// Attempt to limit modpool to low profile gas blocks when weapon has an optic
|
||||
var onlyLowProfileGasBlocks = modPool.Where(tpl => _botConfig.LowProfileGasBlockTpls.Contains(tpl));
|
||||
var onlyLowProfileGasBlocks = modPool.Where(tpl => BotConfig.LowProfileGasBlockTpls.Contains(tpl));
|
||||
if (onlyLowProfileGasBlocks.Any())
|
||||
{
|
||||
modPool = onlyLowProfileGasBlocks.ToHashSet();
|
||||
@@ -1005,7 +1005,7 @@ public class BotEquipmentModGenerator(
|
||||
else if ((request.WeaponStats?.HasRearIronSight ?? false) && modPool.Count > 1)
|
||||
{
|
||||
// Attempt to limit modpool to high profile gas blocks when weapon has rear iron sight + no front iron sight
|
||||
var onlyHighProfileGasBlocks = modPool.Where(tpl => !_botConfig.LowProfileGasBlockTpls.Contains(tpl));
|
||||
var onlyHighProfileGasBlocks = modPool.Where(tpl => !BotConfig.LowProfileGasBlockTpls.Contains(tpl));
|
||||
if (onlyHighProfileGasBlocks.Any())
|
||||
{
|
||||
modPool = onlyHighProfileGasBlocks.ToHashSet();
|
||||
|
||||
@@ -36,8 +36,8 @@ public class BotGenerator(
|
||||
ICloner cloner
|
||||
)
|
||||
{
|
||||
protected readonly BotConfig _botConfig = configServer.GetConfig<BotConfig>();
|
||||
protected readonly PmcConfig _pmcConfig = configServer.GetConfig<PmcConfig>();
|
||||
protected readonly BotConfig BotConfig = configServer.GetConfig<BotConfig>();
|
||||
protected readonly PmcConfig PMCConfig = configServer.GetConfig<PmcConfig>();
|
||||
|
||||
/// <summary>
|
||||
/// Generate a player scav bot object
|
||||
@@ -187,7 +187,7 @@ public class BotGenerator(
|
||||
botJsonTemplate,
|
||||
botGenerationDetails,
|
||||
botRoleLowercase,
|
||||
_botConfig.BotRolesThatMustHaveUniqueName
|
||||
BotConfig.BotRolesThatMustHaveUniqueName
|
||||
);
|
||||
|
||||
// Only PMCs need a lower nickname
|
||||
@@ -263,7 +263,7 @@ public class BotGenerator(
|
||||
bot.Info.GameVersion
|
||||
);
|
||||
|
||||
if (_botConfig.BotRolesWithDogTags.Contains(botRoleLowercase))
|
||||
if (BotConfig.BotRolesWithDogTags.Contains(botRoleLowercase))
|
||||
{
|
||||
AddDogtagToBot(bot);
|
||||
}
|
||||
@@ -287,7 +287,7 @@ public class BotGenerator(
|
||||
/// <returns>True if name should be simulated pscav</returns>
|
||||
protected bool ShouldSimulatePlayerScav(string botRole)
|
||||
{
|
||||
return botRole == Roles.Assault && randomUtil.GetChance100(_botConfig.ChanceAssaultScavHasPlayerScavName);
|
||||
return botRole == Roles.Assault && randomUtil.GetChance100(BotConfig.ChanceAssaultScavHasPlayerScavName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -708,7 +708,7 @@ public class BotGenerator(
|
||||
}
|
||||
|
||||
// Choose random weighted game version for bot
|
||||
botInfo.GameVersion = weightedRandomHelper.GetWeightedValue(_pmcConfig.GameVersionWeight);
|
||||
botInfo.GameVersion = weightedRandomHelper.GetWeightedValue(PMCConfig.GameVersionWeight);
|
||||
|
||||
// Choose appropriate member category value
|
||||
switch (botInfo.GameVersion)
|
||||
@@ -721,7 +721,7 @@ public class BotGenerator(
|
||||
break;
|
||||
default:
|
||||
// Everyone else gets a weighted randomised category
|
||||
botInfo.MemberCategory = weightedRandomHelper.GetWeightedValue(_pmcConfig.AccountTypeWeight);
|
||||
botInfo.MemberCategory = weightedRandomHelper.GetWeightedValue(PMCConfig.AccountTypeWeight);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -758,7 +758,7 @@ public class BotGenerator(
|
||||
/// <returns>item tpl</returns>
|
||||
protected MongoId GetDogtagTplByGameVersionAndSide(string side, string gameVersion)
|
||||
{
|
||||
_pmcConfig.DogtagSettings.TryGetValue(side.ToLower(), out var gameVersionWeights);
|
||||
PMCConfig.DogtagSettings.TryGetValue(side.ToLower(), out var gameVersionWeights);
|
||||
if (!gameVersionWeights.TryGetValue(gameVersion, out var possibleDogtags))
|
||||
{
|
||||
gameVersionWeights.TryGetValue("default", out possibleDogtags);
|
||||
|
||||
@@ -59,8 +59,8 @@ public class BotInventoryGenerator(
|
||||
EquipmentSlots.Earpiece,
|
||||
];
|
||||
|
||||
private readonly BotConfig _botConfig = configServer.GetConfig<BotConfig>();
|
||||
private readonly PmcConfig _pmcConfig = configServer.GetConfig<PmcConfig>();
|
||||
protected readonly BotConfig BotConfig = configServer.GetConfig<BotConfig>();
|
||||
protected readonly PmcConfig PMCConfig = configServer.GetConfig<PmcConfig>();
|
||||
|
||||
private readonly FrozenSet<string> _slotsToCheck = [nameof(EquipmentSlots.Pockets), nameof(EquipmentSlots.SecuredContainer)];
|
||||
|
||||
@@ -197,7 +197,7 @@ public class BotInventoryGenerator(
|
||||
GetRaidConfigurationRequestData? raidConfig
|
||||
)
|
||||
{
|
||||
if (!_botConfig.Equipment.TryGetValue(botGeneratorHelper.GetBotEquipmentRole(botRole), out var botEquipConfig))
|
||||
if (!BotConfig.Equipment.TryGetValue(botGeneratorHelper.GetBotEquipmentRole(botRole), out var botEquipConfig))
|
||||
{
|
||||
logger.Error($"Bot Equipment generation failed, unable to find equipment filters for: {botRole}");
|
||||
|
||||
@@ -224,13 +224,13 @@ public class BotInventoryGenerator(
|
||||
}
|
||||
|
||||
// Is PMC + generating armband + armband forcing is enabled
|
||||
if (_pmcConfig.ForceArmband.Enabled && isPmc)
|
||||
if (PMCConfig.ForceArmband.Enabled && isPmc)
|
||||
{
|
||||
// Replace armband pool with single tpl from config
|
||||
if (templateInventory.Equipment.TryGetValue(EquipmentSlots.ArmBand, out var armbands))
|
||||
{
|
||||
// Get tpl based on pmc side
|
||||
var armbandTpl = botRole == "pmcusec" ? _pmcConfig.ForceArmband.Usec : _pmcConfig.ForceArmband.Bear;
|
||||
var armbandTpl = botRole == "pmcusec" ? PMCConfig.ForceArmband.Usec : PMCConfig.ForceArmband.Bear;
|
||||
|
||||
armbands.Clear();
|
||||
armbands.Add(armbandTpl, 1);
|
||||
@@ -599,7 +599,7 @@ public class BotInventoryGenerator(
|
||||
|
||||
// Edge case: Filter the armor items mod pool if bot exists in config dict + config has armor slot
|
||||
if (
|
||||
_botConfig.Equipment.ContainsKey(settings.BotData.EquipmentRole)
|
||||
BotConfig.Equipment.ContainsKey(settings.BotData.EquipmentRole)
|
||||
&& settings.RandomisationDetails?.RandomisedArmorSlots != null
|
||||
&& settings.RandomisationDetails.RandomisedArmorSlots.Contains(settings.RootEquipmentSlot.ToString())
|
||||
)
|
||||
|
||||
@@ -44,6 +44,14 @@ public class BotLevelGenerator(RandomUtil randomUtil, DatabaseService databaseSe
|
||||
return new RandomisedBotLevelResult { Exp = baseExp + fractionalExp, Level = level };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Choose a randomised level based on inputs
|
||||
/// </summary>
|
||||
/// <param name="min">Lowest level to choose</param>
|
||||
/// <param name="max">Highest level to choose</param>
|
||||
/// <param name="shift">Bias shift to apply to the random number generation</param>
|
||||
/// <param name="number">Number of iterations to use for generating a Gaussian random number</param>
|
||||
/// <returns>Bot level</returns>
|
||||
public int ChooseBotLevel(double min, double max, int shift, double number)
|
||||
{
|
||||
return (int)randomUtil.GetBiasedRandomNumber(min, max, shift, number);
|
||||
|
||||
@@ -32,8 +32,8 @@ public class BotLootGenerator(
|
||||
ICloner cloner
|
||||
)
|
||||
{
|
||||
protected readonly BotConfig _botConfig = configServer.GetConfig<BotConfig>();
|
||||
protected readonly PmcConfig _pmcConfig = configServer.GetConfig<PmcConfig>();
|
||||
protected readonly BotConfig BotConfig = configServer.GetConfig<BotConfig>();
|
||||
protected readonly PmcConfig PMCConfig = configServer.GetConfig<PmcConfig>();
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
@@ -110,7 +110,7 @@ public class BotLootGenerator(
|
||||
var grenadeCount = weightedRandomHelper.GetWeightedValue(itemCounts.Grenades.Weights);
|
||||
|
||||
// If bot has been flagged as not having loot, set below counts to 0
|
||||
if (_botConfig.DisableLootOnBotTypes.Contains(botRole.ToLowerInvariant()))
|
||||
if (BotConfig.DisableLootOnBotTypes.Contains(botRole.ToLowerInvariant()))
|
||||
{
|
||||
backpackLootCount = 0;
|
||||
pocketLootCount = 0;
|
||||
@@ -119,7 +119,7 @@ public class BotLootGenerator(
|
||||
}
|
||||
|
||||
// Forced pmc healing loot into secure container
|
||||
if (isPmc && _pmcConfig.ForceHealingItemsIntoSecure)
|
||||
if (isPmc && PMCConfig.ForceHealingItemsIntoSecure)
|
||||
{
|
||||
AddForcedMedicalItemsToPmcSecure(botInventory, botRole, botId);
|
||||
}
|
||||
@@ -248,7 +248,7 @@ public class BotLootGenerator(
|
||||
if (containersBotHasAvailable.Contains(EquipmentSlots.Backpack) && backpackLootCount > 0)
|
||||
{
|
||||
// Add randomly generated weapon to PMC backpacks
|
||||
if (isPmc && randomUtil.GetChance100(_pmcConfig.LooseWeaponInBackpackChancePercent))
|
||||
if (isPmc && randomUtil.GetChance100(PMCConfig.LooseWeaponInBackpackChancePercent))
|
||||
{
|
||||
AddLooseWeaponsToInventorySlot(
|
||||
botId,
|
||||
@@ -265,7 +265,7 @@ public class BotLootGenerator(
|
||||
}
|
||||
|
||||
var backpackLootRoubleTotal = isPmc
|
||||
? _pmcConfig.LootSettings.Backpack.GetRoubleValue(botLevel, botGenerationDetails.Location)
|
||||
? PMCConfig.LootSettings.Backpack.GetRoubleValue(botLevel, botGenerationDetails.Location)
|
||||
: 0;
|
||||
|
||||
AddLootFromPool(
|
||||
@@ -282,7 +282,7 @@ public class BotLootGenerator(
|
||||
);
|
||||
}
|
||||
|
||||
var vestLootRoubleTotal = isPmc ? _pmcConfig.LootSettings.Vest.GetRoubleValue(botLevel, botGenerationDetails.Location) : 0;
|
||||
var vestLootRoubleTotal = isPmc ? PMCConfig.LootSettings.Vest.GetRoubleValue(botLevel, botGenerationDetails.Location) : 0;
|
||||
|
||||
// TacticalVest - generate loot if they have one
|
||||
if (containersBotHasAvailable.Contains(EquipmentSlots.TacticalVest))
|
||||
@@ -302,7 +302,7 @@ public class BotLootGenerator(
|
||||
);
|
||||
}
|
||||
|
||||
var pocketLootRoubleTotal = isPmc ? _pmcConfig.LootSettings.Pocket.GetRoubleValue(botLevel, botGenerationDetails.Location) : 0;
|
||||
var pocketLootRoubleTotal = isPmc ? PMCConfig.LootSettings.Pocket.GetRoubleValue(botLevel, botGenerationDetails.Location) : 0;
|
||||
|
||||
// Pockets
|
||||
AddLootFromPool(
|
||||
@@ -321,7 +321,7 @@ public class BotLootGenerator(
|
||||
// Secure
|
||||
|
||||
// only add if not a pmc or is pmc and flag is true
|
||||
if (!isPmc || (isPmc && _pmcConfig.AddSecureContainerLootFromBotConfig))
|
||||
if (!isPmc || (isPmc && PMCConfig.AddSecureContainerLootFromBotConfig))
|
||||
{
|
||||
AddLootFromPool(
|
||||
botId,
|
||||
@@ -346,7 +346,7 @@ public class BotLootGenerator(
|
||||
return null;
|
||||
}
|
||||
|
||||
var matchingValue = _pmcConfig?.LootItemLimitsRub.FirstOrDefault(minMaxValue =>
|
||||
var matchingValue = PMCConfig?.LootItemLimitsRub.FirstOrDefault(minMaxValue =>
|
||||
botLevel >= minMaxValue.Min && botLevel <= minMaxValue.Max
|
||||
);
|
||||
|
||||
@@ -475,9 +475,9 @@ public class BotLootGenerator(
|
||||
];
|
||||
|
||||
// Is Simple-Wallet / WZ wallet
|
||||
if (_botConfig.WalletLoot.WalletTplPool.Contains(weightedItemTpl))
|
||||
if (BotConfig.WalletLoot.WalletTplPool.Contains(weightedItemTpl))
|
||||
{
|
||||
var addCurrencyToWallet = randomUtil.GetChance100(_botConfig.WalletLoot.ChancePercent);
|
||||
var addCurrencyToWallet = randomUtil.GetChance100(BotConfig.WalletLoot.ChancePercent);
|
||||
if (addCurrencyToWallet)
|
||||
{
|
||||
// Create the currency items we want to add to wallet
|
||||
@@ -576,17 +576,17 @@ public class BotLootGenerator(
|
||||
List<List<Item>> result = [];
|
||||
|
||||
// Choose how many stacks of currency will be added to wallet
|
||||
var itemCount = randomUtil.GetInt(_botConfig.WalletLoot.ItemCount.Min, _botConfig.WalletLoot.ItemCount.Max);
|
||||
var itemCount = randomUtil.GetInt(BotConfig.WalletLoot.ItemCount.Min, BotConfig.WalletLoot.ItemCount.Max);
|
||||
for (var index = 0; index < itemCount; index++)
|
||||
{
|
||||
// Choose the size of the currency stack - default is 5k, 10k, 15k, 20k, 25k
|
||||
var chosenStackCount = weightedRandomHelper.GetWeightedValue(_botConfig.WalletLoot.StackSizeWeight);
|
||||
var chosenStackCount = weightedRandomHelper.GetWeightedValue(BotConfig.WalletLoot.StackSizeWeight);
|
||||
List<Item> items =
|
||||
[
|
||||
new()
|
||||
{
|
||||
Id = new MongoId(),
|
||||
Template = weightedRandomHelper.GetWeightedValue(_botConfig.WalletLoot.CurrencyWeight),
|
||||
Template = weightedRandomHelper.GetWeightedValue(BotConfig.WalletLoot.CurrencyWeight),
|
||||
ParentId = walletId,
|
||||
Upd = new Upd { StackObjectsCount = int.Parse(chosenStackCount) },
|
||||
},
|
||||
@@ -663,8 +663,8 @@ public class BotLootGenerator(
|
||||
]
|
||||
);
|
||||
var randomisedWeaponCount = randomUtil.GetInt(
|
||||
_pmcConfig.LooseWeaponInBackpackLootMinMax.Min,
|
||||
_pmcConfig.LooseWeaponInBackpackLootMinMax.Max
|
||||
PMCConfig.LooseWeaponInBackpackLootMinMax.Min,
|
||||
PMCConfig.LooseWeaponInBackpackLootMinMax.Max
|
||||
);
|
||||
|
||||
if (randomisedWeaponCount <= 0)
|
||||
@@ -788,9 +788,9 @@ public class BotLootGenerator(
|
||||
public void RandomiseMoneyStackSize(string botRole, TemplateItem itemTemplate, Item moneyItem)
|
||||
{
|
||||
// Get all currency weights for this bot type
|
||||
if (!_botConfig.CurrencyStackSize.TryGetValue(botRole, out var currencyWeights))
|
||||
if (!BotConfig.CurrencyStackSize.TryGetValue(botRole, out var currencyWeights))
|
||||
{
|
||||
currencyWeights = _botConfig.CurrencyStackSize["default"];
|
||||
currencyWeights = BotConfig.CurrencyStackSize["default"];
|
||||
}
|
||||
|
||||
var currencyWeight = currencyWeights[moneyItem.Template];
|
||||
@@ -824,12 +824,12 @@ public class BotLootGenerator(
|
||||
{
|
||||
if (botHelper.IsBotPmc(botRole))
|
||||
{
|
||||
return _botConfig.ItemSpawnLimits["pmc"];
|
||||
return BotConfig.ItemSpawnLimits["pmc"];
|
||||
}
|
||||
|
||||
if (_botConfig.ItemSpawnLimits.ContainsKey(botRole.ToLowerInvariant()))
|
||||
if (BotConfig.ItemSpawnLimits.ContainsKey(botRole.ToLowerInvariant()))
|
||||
{
|
||||
return _botConfig.ItemSpawnLimits[botRole.ToLowerInvariant()];
|
||||
return BotConfig.ItemSpawnLimits[botRole.ToLowerInvariant()];
|
||||
}
|
||||
|
||||
logger.Warning(serverLocalisationService.GetText("bot-unable_to_find_spawn_limits_fallback_to_defaults", botRole));
|
||||
|
||||
@@ -35,11 +35,11 @@ public class BotWeaponGenerator(
|
||||
IEnumerable<IInventoryMagGen> inventoryMagGenComponents
|
||||
)
|
||||
{
|
||||
protected const string _modMagazineSlotId = "mod_magazine";
|
||||
protected readonly BotConfig _botConfig = configServer.GetConfig<BotConfig>();
|
||||
protected readonly IEnumerable<IInventoryMagGen> _inventoryMagGenComponents = MagGenSetUp(inventoryMagGenComponents);
|
||||
protected readonly PmcConfig _pmcConfig = configServer.GetConfig<PmcConfig>();
|
||||
protected readonly RepairConfig _repairConfig = configServer.GetConfig<RepairConfig>();
|
||||
private const string ModMagazineSlotId = "mod_magazine";
|
||||
protected readonly BotConfig BotConfig = configServer.GetConfig<BotConfig>();
|
||||
protected readonly IEnumerable<IInventoryMagGen> InventoryMagGenComponents = MagGenSetUp(inventoryMagGenComponents);
|
||||
protected readonly PmcConfig PMCConfig = configServer.GetConfig<PmcConfig>();
|
||||
protected readonly RepairConfig RepairConfig = configServer.GetConfig<RepairConfig>();
|
||||
|
||||
protected static List<IInventoryMagGen> MagGenSetUp(IEnumerable<IInventoryMagGen> components)
|
||||
{
|
||||
@@ -151,10 +151,10 @@ public class BotWeaponGenerator(
|
||||
var weaponWithModsArray = ConstructWeaponBaseList(weaponTpl, weaponParentId, slotName, weaponItemTemplate, botRole).ToList();
|
||||
|
||||
// Chance to add randomised weapon enhancement
|
||||
if (isPmc && randomUtil.GetChance100(_pmcConfig.WeaponHasEnhancementChancePercent))
|
||||
if (isPmc && randomUtil.GetChance100(PMCConfig.WeaponHasEnhancementChancePercent))
|
||||
// Add buff to weapon root
|
||||
{
|
||||
repairService.AddBuff(_repairConfig.RepairKit.Weapon, weaponWithModsArray[0]);
|
||||
repairService.AddBuff(RepairConfig.RepairKit.Weapon, weaponWithModsArray[0]);
|
||||
}
|
||||
|
||||
// Add mods to weapon base
|
||||
@@ -194,7 +194,7 @@ public class BotWeaponGenerator(
|
||||
weaponWithModsArray = GetPresetWeaponMods(weaponTpl, slotName, weaponParentId, weaponItemTemplate, botRole);
|
||||
}
|
||||
|
||||
var tempList = cloner.Clone(weaponWithModsArray.Where(item => item.SlotId == _modMagazineSlotId));
|
||||
var tempList = cloner.Clone(weaponWithModsArray.Where(item => item.SlotId == ModMagazineSlotId));
|
||||
// Fill existing magazines to full and sync ammo type
|
||||
foreach (var magazine in tempList)
|
||||
{
|
||||
@@ -455,12 +455,12 @@ public class BotWeaponGenerator(
|
||||
|
||||
var inventoryMagGenModel = new InventoryMagGen(magWeights, magTemplate, weaponTemplate, ammoTemplate.Value, inventory, botId);
|
||||
|
||||
_inventoryMagGenComponents.FirstOrDefault(v => v.CanHandleInventoryMagGen(inventoryMagGenModel)).Process(inventoryMagGenModel);
|
||||
InventoryMagGenComponents.FirstOrDefault(v => v.CanHandleInventoryMagGen(inventoryMagGenModel)).Process(inventoryMagGenModel);
|
||||
|
||||
// Add x stacks of bullets to SecuredContainer (bots use a magic mag packing skill to reload instantly)
|
||||
AddAmmoToSecureContainer(
|
||||
botId,
|
||||
_botConfig.SecureContainerAmmoStackCount,
|
||||
BotConfig.SecureContainerAmmoStackCount,
|
||||
generatedWeaponResult.ChosenAmmoTemplate,
|
||||
ammoTemplate.Value.Properties.StackMaxSize ?? 0,
|
||||
inventory
|
||||
@@ -497,7 +497,7 @@ public class BotWeaponGenerator(
|
||||
|
||||
// Add greandes to bot inventory
|
||||
var ubglAmmoGenModel = new InventoryMagGen(ubglMinMax, ubglDbTemplate, ubglDbTemplate, ubglAmmoDbTemplate, inventory, botId);
|
||||
_inventoryMagGenComponents.FirstOrDefault(v => v.CanHandleInventoryMagGen(ubglAmmoGenModel)).Process(ubglAmmoGenModel);
|
||||
InventoryMagGenComponents.FirstOrDefault(v => v.CanHandleInventoryMagGen(ubglAmmoGenModel)).Process(ubglAmmoGenModel);
|
||||
|
||||
// Store extra grenades in secure container
|
||||
AddAmmoToSecureContainer(botId, 5, generatedWeaponResult.ChosenUbglAmmoTemplate.Value, 20, inventory);
|
||||
@@ -543,7 +543,7 @@ public class BotWeaponGenerator(
|
||||
/// <returns>Magazine template string.</returns>
|
||||
protected MongoId? GetMagazineTemplateFromWeaponTemplate(IEnumerable<Item> weaponMods, TemplateItem weaponTemplate, string botRole)
|
||||
{
|
||||
var magazine = weaponMods.FirstOrDefault(m => m.SlotId == _modMagazineSlotId);
|
||||
var magazine = weaponMods.FirstOrDefault(m => m.SlotId == ModMagazineSlotId);
|
||||
if (magazine is null)
|
||||
{
|
||||
// Edge case - magazineless chamber loaded weapons don't have magazines, e.g. mp18
|
||||
@@ -708,10 +708,8 @@ public class BotWeaponGenerator(
|
||||
|
||||
// Try to get cartridges from slots array first, if none found, try Cartridges array
|
||||
var cartridges =
|
||||
magazineTemplate.Value.Properties.Slots.FirstOrDefault()?.Properties?.Filters.FirstOrDefault()?.Filter ?? magazineTemplate
|
||||
.Value.Properties.Cartridges.FirstOrDefault()
|
||||
?.Properties?.Filters.FirstOrDefault()
|
||||
?.Filter;
|
||||
magazineTemplate.Value.Properties.Slots.FirstOrDefault()?.Properties?.Filters.FirstOrDefault()?.Filter
|
||||
?? magazineTemplate.Value.Properties.Cartridges.FirstOrDefault()?.Properties?.Filters.FirstOrDefault()?.Filter;
|
||||
|
||||
return cartridges ?? [];
|
||||
}
|
||||
|
||||
@@ -24,10 +24,10 @@ public class FenceBaseAssortGenerator(
|
||||
ServerLocalisationService localisationService,
|
||||
ConfigServer configServer,
|
||||
FenceService fenceService,
|
||||
ICloner _cloner
|
||||
ICloner cloner
|
||||
)
|
||||
{
|
||||
protected readonly TraderConfig traderConfig = configServer.GetConfig<TraderConfig>();
|
||||
protected readonly TraderConfig TraderConfig = configServer.GetConfig<TraderConfig>();
|
||||
|
||||
/// <summary>
|
||||
/// Create base fence assorts dynamically and store in memory
|
||||
@@ -63,9 +63,9 @@ public class FenceBaseAssortGenerator(
|
||||
}
|
||||
|
||||
// Item base type blacklisted
|
||||
if (traderConfig.Fence.Blacklist.Count > 0)
|
||||
if (TraderConfig.Fence.Blacklist.Count > 0)
|
||||
{
|
||||
if (traderConfig.Fence.Blacklist.Contains(itemId) || itemHelper.IsOfBaseclasses(itemId, traderConfig.Fence.Blacklist))
|
||||
if (TraderConfig.Fence.Blacklist.Contains(itemId) || itemHelper.IsOfBaseclasses(itemId, TraderConfig.Fence.Blacklist))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -81,7 +81,7 @@ public class FenceBaseAssortGenerator(
|
||||
}
|
||||
|
||||
// Skip seasonal event items when not in seasonal event
|
||||
if (traderConfig.Fence.BlacklistSeasonalItems && blockedSeasonalItems.Contains(itemId))
|
||||
if (TraderConfig.Fence.BlacklistSeasonalItems && blockedSeasonalItems.Contains(itemId))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -150,7 +150,7 @@ public class FenceBaseAssortGenerator(
|
||||
foreach (var defaultPreset in defaultPresets)
|
||||
{
|
||||
// Construct preset + mods
|
||||
var itemAndChildren = _cloner.Clone(defaultPreset.Items).ReplaceIDs();
|
||||
var itemAndChildren = cloner.Clone(defaultPreset.Items).ReplaceIDs();
|
||||
|
||||
// Find root item and add some properties to it
|
||||
var rootItem = itemAndChildren.FirstOrDefault(item => string.IsNullOrEmpty(item.ParentId));
|
||||
@@ -196,7 +196,7 @@ public class FenceBaseAssortGenerator(
|
||||
return false;
|
||||
}
|
||||
|
||||
return ammoPenetrationPower > traderConfig.Fence.AmmoMaxPenLimit;
|
||||
return ammoPenetrationPower > TraderConfig.Fence.AmmoMaxPenLimit;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -31,8 +31,8 @@ public class LocationLootGenerator(
|
||||
ICloner cloner
|
||||
)
|
||||
{
|
||||
protected readonly LocationConfig _locationConfig = configServer.GetConfig<LocationConfig>();
|
||||
protected readonly SeasonalEventConfig _seasonalEventConfig = configServer.GetConfig<SeasonalEventConfig>();
|
||||
protected readonly LocationConfig LocationConfig = configServer.GetConfig<LocationConfig>();
|
||||
protected readonly SeasonalEventConfig SeasonalEventConfig = configServer.GetConfig<SeasonalEventConfig>();
|
||||
|
||||
/// <summary>
|
||||
/// Generate Loot for provided location ()
|
||||
@@ -56,7 +56,7 @@ public class LocationLootGenerator(
|
||||
|
||||
// Pull location-specific spawn limits from db
|
||||
var itemsWithSpawnCountLimitsClone = cloner.Clone(
|
||||
_locationConfig.LootMaxSpawnLimits.GetValueOrDefault(locationId.ToLowerInvariant())
|
||||
LocationConfig.LootMaxSpawnLimits.GetValueOrDefault(locationId.ToLowerInvariant())
|
||||
);
|
||||
|
||||
// Store items with spawn count limits inside so they can be accessed later inside static/dynamic loot spawn methods
|
||||
@@ -123,7 +123,7 @@ public class LocationLootGenerator(
|
||||
if (!seasonalEventService.ChristmasEventEnabled())
|
||||
{
|
||||
allStaticContainersOnMap = allStaticContainersOnMap.Where(item =>
|
||||
!_seasonalEventConfig.ChristmasContainerIds.Contains(item.Template.Id)
|
||||
!SeasonalEventConfig.ChristmasContainerIds.Contains(item.Template.Id)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -268,8 +268,8 @@ public class LocationLootGenerator(
|
||||
/// <returns>true = enabled</returns>
|
||||
protected bool LocationRandomisationEnabled(string locationId)
|
||||
{
|
||||
return _locationConfig.ContainerRandomisationSettings.Enabled
|
||||
&& _locationConfig.ContainerRandomisationSettings.Maps.ContainsKey(locationId);
|
||||
return LocationConfig.ContainerRandomisationSettings.Enabled
|
||||
&& LocationConfig.ContainerRandomisationSettings.Maps.ContainsKey(locationId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -282,7 +282,7 @@ public class LocationLootGenerator(
|
||||
return staticContainers.Where(staticContainer =>
|
||||
staticContainer.Probability != 1
|
||||
&& !staticContainer.Template.IsAlwaysSpawn.GetValueOrDefault(false)
|
||||
&& !_locationConfig.ContainerRandomisationSettings.ContainerTypesToNotRandomise.Contains(
|
||||
&& !LocationConfig.ContainerRandomisationSettings.ContainerTypesToNotRandomise.Contains(
|
||||
staticContainer.Template.Items.FirstOrDefault().Template
|
||||
)
|
||||
);
|
||||
@@ -298,7 +298,7 @@ public class LocationLootGenerator(
|
||||
return staticContainersOnMap.Where(staticContainer =>
|
||||
staticContainer.Probability == 1
|
||||
|| staticContainer.Template.IsAlwaysSpawn.GetValueOrDefault(false)
|
||||
|| _locationConfig.ContainerRandomisationSettings.ContainerTypesToNotRandomise.Contains(
|
||||
|| LocationConfig.ContainerRandomisationSettings.ContainerTypesToNotRandomise.Contains(
|
||||
staticContainer.Template.Items.FirstOrDefault().Template
|
||||
)
|
||||
);
|
||||
@@ -363,12 +363,12 @@ public class LocationLootGenerator(
|
||||
(int)
|
||||
Math.Round(
|
||||
groupKvP.Value.MinContainers.Value
|
||||
* _locationConfig.ContainerRandomisationSettings.ContainerGroupMinSizeMultiplier
|
||||
* LocationConfig.ContainerRandomisationSettings.ContainerGroupMinSizeMultiplier
|
||||
),
|
||||
(int)
|
||||
Math.Round(
|
||||
groupKvP.Value.MaxContainers.Value
|
||||
* _locationConfig.ContainerRandomisationSettings.ContainerGroupMaxSizeMultiplier
|
||||
* LocationConfig.ContainerRandomisationSettings.ContainerGroupMaxSizeMultiplier
|
||||
)
|
||||
),
|
||||
};
|
||||
@@ -465,7 +465,7 @@ public class LocationLootGenerator(
|
||||
|
||||
// Choose items to add to container, factor in weighting + lock money down
|
||||
// Filter out items picked that are already in the above `tplsForced` array
|
||||
var chosenTpls = _locationConfig.AllowDuplicateItemsInStaticContainers
|
||||
var chosenTpls = LocationConfig.AllowDuplicateItemsInStaticContainers
|
||||
? containerLootPool.Draw(itemCountToAdd).Where(tpl => !tplsForced.Contains(tpl) && !counterTrackerHelper.IncrementCount(tpl))
|
||||
: containerLootPool
|
||||
.DrawAndRemove(itemCountToAdd, lockList)
|
||||
@@ -487,7 +487,7 @@ public class LocationLootGenerator(
|
||||
}
|
||||
|
||||
// Check if item should have children removed
|
||||
var items = _locationConfig.TplsToStripChildItemsFrom.Contains(tplToAdd)
|
||||
var items = LocationConfig.TplsToStripChildItemsFrom.Contains(tplToAdd)
|
||||
? [chosenItemWithChildren.Items.FirstOrDefault()] // Strip children from parent
|
||||
: chosenItemWithChildren.Items;
|
||||
|
||||
@@ -495,7 +495,7 @@ public class LocationLootGenerator(
|
||||
var result = containerMap.FindSlotForItem(chosenItemWithChildren.Width, chosenItemWithChildren.Height);
|
||||
if (!result.Success.GetValueOrDefault(false))
|
||||
{
|
||||
if (failedToFitAttemptCount > _locationConfig.FitLootIntoContainerAttempts)
|
||||
if (failedToFitAttemptCount > LocationConfig.FitLootIntoContainerAttempts)
|
||||
// x attempts to fit an item, container is probably full, stop trying to add more
|
||||
{
|
||||
break;
|
||||
@@ -625,9 +625,9 @@ public class LocationLootGenerator(
|
||||
/// <returns>multiplier</returns>
|
||||
protected double GetLooseLootMultiplierForLocation(string location)
|
||||
{
|
||||
return _locationConfig.LooseLootMultiplier.TryGetValue(location, out var value)
|
||||
return LocationConfig.LooseLootMultiplier.TryGetValue(location, out var value)
|
||||
? value
|
||||
: _locationConfig.LooseLootMultiplier["default"];
|
||||
: LocationConfig.LooseLootMultiplier["default"];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -637,9 +637,9 @@ public class LocationLootGenerator(
|
||||
/// <returns>multiplier</returns>
|
||||
protected double GetStaticLootMultiplierForLocation(string location)
|
||||
{
|
||||
return _locationConfig.StaticLootMultiplier.TryGetValue(location, out var value)
|
||||
return LocationConfig.StaticLootMultiplier.TryGetValue(location, out var value)
|
||||
? value
|
||||
: _locationConfig.StaticLootMultiplier["default"];
|
||||
: LocationConfig.StaticLootMultiplier["default"];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -681,7 +681,7 @@ public class LocationLootGenerator(
|
||||
* randomUtil.GetNormallyDistributedRandomNumber(dynamicLootDist.SpawnpointCount.Mean, dynamicLootDist.SpawnpointCount.Std)
|
||||
);
|
||||
|
||||
var blacklistedSpawnPoints = _locationConfig.LooseLootBlacklist.GetValueOrDefault(locationName);
|
||||
var blacklistedSpawnPoints = LocationConfig.LooseLootBlacklist.GetValueOrDefault(locationName);
|
||||
|
||||
// Init empty array to hold spawn points, letting us pick them pseudo-randomly
|
||||
var spawnPointArray = new ProbabilityObjectArray<string, Spawnpoint>(cloner);
|
||||
@@ -967,7 +967,7 @@ public class LocationLootGenerator(
|
||||
// Create array with just magazine
|
||||
List<Item> magazineItem = [new() { Id = new MongoId(), Template = chosenTpl }];
|
||||
|
||||
if (randomUtil.GetChance100(_locationConfig.StaticMagazineLootHasAmmoChancePercent))
|
||||
if (randomUtil.GetChance100(LocationConfig.StaticMagazineLootHasAmmoChancePercent))
|
||||
// Add randomised amount of cartridges
|
||||
{
|
||||
itemHelper.FillMagazineWithRandomCartridge(
|
||||
@@ -975,7 +975,7 @@ public class LocationLootGenerator(
|
||||
itemDbTemplate, // Magazine template
|
||||
staticAmmoDist,
|
||||
null,
|
||||
_locationConfig.MinFillLooseMagazinePercent / 100d
|
||||
LocationConfig.MinFillLooseMagazinePercent / 100d
|
||||
);
|
||||
}
|
||||
|
||||
@@ -990,7 +990,7 @@ public class LocationLootGenerator(
|
||||
// Ensure all IDs are unique
|
||||
itemWithChildren = cloner.Clone(itemWithChildren).ReplaceIDs().ToList();
|
||||
|
||||
if (_locationConfig.TplsToStripChildItemsFrom.Contains(chosenItem.Template))
|
||||
if (LocationConfig.TplsToStripChildItemsFrom.Contains(chosenItem.Template))
|
||||
// Strip children from parent before adding
|
||||
{
|
||||
itemWithChildren = [itemWithChildren.FirstOrDefault()];
|
||||
@@ -1070,7 +1070,7 @@ public class LocationLootGenerator(
|
||||
}
|
||||
else if (itemHelper.IsOfBaseclass(chosenTpl, BaseClasses.MAGAZINE))
|
||||
{
|
||||
if (randomUtil.GetChance100(_locationConfig.MagazineLootHasAmmoChancePercent))
|
||||
if (randomUtil.GetChance100(LocationConfig.MagazineLootHasAmmoChancePercent))
|
||||
{
|
||||
// Create array with just magazine
|
||||
GenerateStaticMagazineItem(staticAmmoDist, rootItem, itemTemplate, items);
|
||||
@@ -1114,7 +1114,7 @@ public class LocationLootGenerator(
|
||||
// We make base item in calling method, no need to do it here
|
||||
if (armorDbTemplate.Properties?.Slots is not null && armorDbTemplate.Properties.Slots.Any())
|
||||
{
|
||||
items = itemHelper.AddChildSlotItems(items, armorDbTemplate, _locationConfig.EquipmentLootSettings.ModSpawnChancePercent);
|
||||
items = itemHelper.AddChildSlotItems(items, armorDbTemplate, LocationConfig.EquipmentLootSettings.ModSpawnChancePercent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1253,7 +1253,7 @@ public class LocationLootGenerator(
|
||||
itemTemplate,
|
||||
staticAmmoDist,
|
||||
null,
|
||||
_locationConfig.MinFillStaticMagazinePercent / 100d
|
||||
LocationConfig.MinFillStaticMagazinePercent / 100d
|
||||
);
|
||||
|
||||
// Replace existing magazine with above array
|
||||
|
||||
@@ -20,7 +20,7 @@ public class PMCLootGenerator(
|
||||
ConfigServer configServer
|
||||
)
|
||||
{
|
||||
private readonly PmcConfig _pmcConfig = configServer.GetConfig<PmcConfig>();
|
||||
protected readonly PmcConfig PMCConfig = configServer.GetConfig<PmcConfig>();
|
||||
|
||||
// Store loot against its type, usec/bear
|
||||
private readonly Dictionary<string, Dictionary<MongoId, double>>? _backpackLootPool = [];
|
||||
@@ -47,7 +47,7 @@ public class PMCLootGenerator(
|
||||
}
|
||||
|
||||
// Get a set of item types we want to generate
|
||||
var allowedItemTypeWhitelist = _pmcConfig.PocketLoot.Whitelist;
|
||||
var allowedItemTypeWhitelist = PMCConfig.PocketLoot.Whitelist;
|
||||
|
||||
// Get a set of ids we don't want to generate
|
||||
var blacklist = GetContainerLootBlacklist();
|
||||
@@ -79,11 +79,11 @@ public class PMCLootGenerator(
|
||||
}
|
||||
|
||||
// Get a set of item types we want to generate
|
||||
var allowedItemTypeWhitelist = _pmcConfig.VestLoot.Whitelist;
|
||||
var allowedItemTypeWhitelist = PMCConfig.VestLoot.Whitelist;
|
||||
|
||||
// Get a set of ids we don't want to generate
|
||||
var blacklist = GetContainerLootBlacklist();
|
||||
blacklist.UnionWith(_pmcConfig.VestLoot.Blacklist); // Include vest-specific blacklist
|
||||
blacklist.UnionWith(PMCConfig.VestLoot.Blacklist); // Include vest-specific blacklist
|
||||
|
||||
// Get pocket priceOverrides
|
||||
var vestPriceOverrides = GetPMCPriceOverrides(pmcRole, "vest");
|
||||
@@ -111,9 +111,9 @@ public class PMCLootGenerator(
|
||||
return existingLootPool;
|
||||
}
|
||||
|
||||
var allowedItemTypeWhitelist = _pmcConfig.BackpackLoot.Whitelist;
|
||||
var allowedItemTypeWhitelist = PMCConfig.BackpackLoot.Whitelist;
|
||||
var blacklist = GetContainerLootBlacklist();
|
||||
blacklist.UnionWith(_pmcConfig.BackpackLoot.Blacklist); // Include backpack-specific blacklist
|
||||
blacklist.UnionWith(PMCConfig.BackpackLoot.Blacklist); // Include backpack-specific blacklist
|
||||
|
||||
// Get pocket priceOverrides
|
||||
var backpackPriceOverrides = GetPMCPriceOverrides(pmcRole, "vest");
|
||||
@@ -187,8 +187,8 @@ public class PMCLootGenerator(
|
||||
protected HashSet<MongoId> GetContainerLootBlacklist()
|
||||
{
|
||||
var blacklist = new HashSet<MongoId>();
|
||||
blacklist.UnionWith(_pmcConfig.PocketLoot.Blacklist);
|
||||
blacklist.UnionWith(_pmcConfig.GlobalLootBlacklist);
|
||||
blacklist.UnionWith(PMCConfig.PocketLoot.Blacklist);
|
||||
blacklist.UnionWith(PMCConfig.GlobalLootBlacklist);
|
||||
blacklist.UnionWith(itemFilterService.GetBlacklistedItems());
|
||||
blacklist.UnionWith(itemFilterService.GetItemRewardBlacklist());
|
||||
blacklist.UnionWith(itemFilterService.GetBlacklistedLootableItems());
|
||||
|
||||
@@ -36,7 +36,7 @@ public class PlayerScavGenerator(
|
||||
TimeUtil timeUtil
|
||||
)
|
||||
{
|
||||
protected readonly PlayerScavConfig _playerScavConfig = configServer.GetConfig<PlayerScavConfig>();
|
||||
protected readonly PlayerScavConfig PlayerScavConfig = configServer.GetConfig<PlayerScavConfig>();
|
||||
|
||||
/// <summary>
|
||||
/// Update a player profile to include a new player scav profile
|
||||
@@ -55,10 +55,7 @@ public class PlayerScavGenerator(
|
||||
|
||||
// use karma level to get correct karmaSettings
|
||||
if (
|
||||
!_playerScavConfig.KarmaLevel.TryGetValue(
|
||||
scavKarmaLevel.ToString(CultureInfo.InvariantCulture),
|
||||
out var playerScavKarmaSettings
|
||||
)
|
||||
!PlayerScavConfig.KarmaLevel.TryGetValue(scavKarmaLevel.ToString(CultureInfo.InvariantCulture), out var playerScavKarmaSettings)
|
||||
)
|
||||
{
|
||||
logger.Error(serverLocalisationService.GetText("scav-missing_karma_settings", scavKarmaLevel));
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace SPTarkov.Server.Core.Generators;
|
||||
[Injectable]
|
||||
public class PmcWaveGenerator(DatabaseService databaseService, ConfigServer configServer)
|
||||
{
|
||||
protected readonly PmcConfig _pmcConfig = configServer.GetConfig<PmcConfig>();
|
||||
protected readonly PmcConfig PMCConfig = configServer.GetConfig<PmcConfig>();
|
||||
|
||||
/// <summary>
|
||||
/// Add a pmc wave to a map
|
||||
@@ -18,7 +18,7 @@ public class PmcWaveGenerator(DatabaseService databaseService, ConfigServer conf
|
||||
/// <param name="waveToAdd"> Boss wave to add to map </param>
|
||||
public void AddPmcWaveToLocation(string locationId, BossLocationSpawn waveToAdd)
|
||||
{
|
||||
_pmcConfig.CustomPmcWaves[locationId].Add(waveToAdd);
|
||||
PMCConfig.CustomPmcWaves[locationId].Add(waveToAdd);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -26,7 +26,7 @@ public class PmcWaveGenerator(DatabaseService databaseService, ConfigServer conf
|
||||
/// </summary>
|
||||
public void ApplyWaveChangesToAllMaps()
|
||||
{
|
||||
foreach (var location in _pmcConfig.CustomPmcWaves)
|
||||
foreach (var location in PMCConfig.CustomPmcWaves)
|
||||
{
|
||||
ApplyWaveChangesToMapByName(location.Key);
|
||||
}
|
||||
@@ -38,7 +38,7 @@ public class PmcWaveGenerator(DatabaseService databaseService, ConfigServer conf
|
||||
/// <param name="name"> e.g. factory4_day, bigmap </param>
|
||||
public void ApplyWaveChangesToMapByName(string name)
|
||||
{
|
||||
if (!_pmcConfig.CustomPmcWaves.TryGetValue(name, out var pmcWavesToAdd))
|
||||
if (!PMCConfig.CustomPmcWaves.TryGetValue(name, out var pmcWavesToAdd))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -53,7 +53,7 @@ public class PmcWaveGenerator(DatabaseService databaseService, ConfigServer conf
|
||||
/// <param name="location"> Location Object </param>
|
||||
public void ApplyWaveChangesToMap(LocationBase location)
|
||||
{
|
||||
if (!_pmcConfig.CustomPmcWaves.TryGetValue(location.Id.ToLowerInvariant(), out var pmcWavesToAdd))
|
||||
if (!PMCConfig.CustomPmcWaves.TryGetValue(location.Id.ToLowerInvariant(), out var pmcWavesToAdd))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public class RagfairAssortGenerator(
|
||||
results = results.Union([presetAndModsClone]);
|
||||
}
|
||||
|
||||
foreach (var (id, item) in dbItems)
|
||||
foreach (var (tpl, item) in dbItems)
|
||||
{
|
||||
if (!itemHelper.IsValidItem(item, RagfairItemInvalidBaseTypes))
|
||||
{
|
||||
@@ -81,18 +81,18 @@ public class RagfairAssortGenerator(
|
||||
}
|
||||
|
||||
// Skip seasonal items when not in-season
|
||||
if (RagfairConfig.Dynamic.RemoveSeasonalItemsWhenNotInEvent && !seasonalEventActive && seasonalItemTplBlacklist.Contains(id))
|
||||
if (RagfairConfig.Dynamic.RemoveSeasonalItemsWhenNotInEvent && !seasonalEventActive && seasonalItemTplBlacklist.Contains(tpl))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Already processed
|
||||
if (processedArmorItems.Contains(id))
|
||||
if (processedArmorItems.Contains(tpl))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var assortItemToAdd = new List<Item> { CreateRagfairAssortRootItem(id, id) }; // tpl and id must be the same so hideout recipe rewards work
|
||||
var assortItemToAdd = new List<Item> { CreateRagfairAssortRootItem(tpl, tpl) }; // tpl and id must be the same so hideout recipe rewards work
|
||||
results = results.Union([assortItemToAdd]);
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ public class RagfairAssortGenerator(
|
||||
/// <summary>
|
||||
/// Create a base assort item and return it with populated values + 999999 stack count + unlimited count = true
|
||||
/// </summary>
|
||||
/// <param name="tplId"> tplid to add to item </param>
|
||||
/// <param name="tplId"> tplId to add to item </param>
|
||||
/// <param name="id"> id to add to item </param>
|
||||
/// <returns> Hydrated Item object </returns>
|
||||
protected Item CreateRagfairAssortRootItem(MongoId tplId, MongoId? id = null)
|
||||
|
||||
@@ -41,13 +41,13 @@ public class RagfairOfferGenerator(
|
||||
ICloner cloner
|
||||
)
|
||||
{
|
||||
protected List<TplWithFleaPrice>? allowedFleaPriceItemsForBarter;
|
||||
protected readonly BotConfig botConfig = configServer.GetConfig<BotConfig>();
|
||||
protected List<TplWithFleaPrice>? AllowedFleaPriceItemsForBarter;
|
||||
protected readonly BotConfig BotConfig = configServer.GetConfig<BotConfig>();
|
||||
|
||||
/// Internal counter to ensure each offer created has a unique value for its intId property
|
||||
protected int offerCounter;
|
||||
protected int OfferCounter;
|
||||
|
||||
protected readonly RagfairConfig ragfairConfig = configServer.GetConfig<RagfairConfig>();
|
||||
protected readonly RagfairConfig RagfairConfig = configServer.GetConfig<RagfairConfig>();
|
||||
|
||||
/// <summary>
|
||||
/// Create a flea offer and store it in the Ragfair server offers array
|
||||
@@ -109,7 +109,7 @@ public class RagfairOfferGenerator(
|
||||
var offer = new RagfairOffer
|
||||
{
|
||||
Id = new MongoId(),
|
||||
InternalId = offerCounter,
|
||||
InternalId = OfferCounter,
|
||||
User =
|
||||
details.Creator == OfferCreator.Player
|
||||
? CreatePlayerUserDataForFleaOffer(details.UserId)
|
||||
@@ -128,7 +128,7 @@ public class RagfairOfferGenerator(
|
||||
Quantity = details.Quantity,
|
||||
};
|
||||
|
||||
offerCounter++;
|
||||
OfferCounter++;
|
||||
|
||||
return offer;
|
||||
}
|
||||
@@ -152,8 +152,8 @@ public class RagfairOfferGenerator(
|
||||
{
|
||||
Id = userId,
|
||||
MemberType = MemberCategory.Default,
|
||||
Nickname = botHelper.GetPmcNicknameOfMaxLength(botConfig.BotNameLengthLimit),
|
||||
Rating = randomUtil.GetDouble(ragfairConfig.Dynamic.Rating.Min, ragfairConfig.Dynamic.Rating.Max),
|
||||
Nickname = botHelper.GetPmcNicknameOfMaxLength(BotConfig.BotNameLengthLimit),
|
||||
Rating = randomUtil.GetDouble(RagfairConfig.Dynamic.Rating.Min, RagfairConfig.Dynamic.Rating.Max),
|
||||
IsRatingGrowing = randomUtil.GetBool(),
|
||||
Avatar = null,
|
||||
Aid = hashUtil.GenerateAccountId(),
|
||||
@@ -188,15 +188,11 @@ public class RagfairOfferGenerator(
|
||||
/// <returns> rouble cost of offer </returns>
|
||||
protected double ConvertOfferRequirementsIntoRoubles(IEnumerable<OfferRequirement> offerRequirements)
|
||||
{
|
||||
var roublePrice = 0d;
|
||||
foreach (var requirement in offerRequirements)
|
||||
{
|
||||
roublePrice += paymentHelper.IsMoneyTpl(requirement.TemplateId)
|
||||
return offerRequirements.Sum(requirement =>
|
||||
paymentHelper.IsMoneyTpl(requirement.TemplateId)
|
||||
? Math.Round(CalculateRoublePrice(requirement.Count.Value, requirement.TemplateId))
|
||||
: ragfairPriceService.GetFleaPriceForItem(requirement.TemplateId) * requirement.Count.Value; // Get flea price for barter offer items
|
||||
}
|
||||
|
||||
return roublePrice;
|
||||
: ragfairPriceService.GetFleaPriceForItem(requirement.TemplateId) * requirement.Count.Value
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -251,32 +247,31 @@ public class RagfairOfferGenerator(
|
||||
}
|
||||
|
||||
// Generated pmc offer
|
||||
return randomUtil.GetDouble(ragfairConfig.Dynamic.Rating.Min, ragfairConfig.Dynamic.Rating.Max);
|
||||
return randomUtil.GetDouble(RagfairConfig.Dynamic.Rating.Min, RagfairConfig.Dynamic.Rating.Max);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get number of section until offer should expire
|
||||
/// </summary>
|
||||
/// <param name="creatorType"></param>
|
||||
/// <param name="userID"> ID of the offer owner </param>
|
||||
/// <param name="userId"> ID of the offer owner </param>
|
||||
/// <param name="time"> Time the offer is posted in seconds </param>
|
||||
/// <returns> Number of seconds until offer expires </returns>
|
||||
protected long GetOfferEndTime(OfferCreator creatorType, MongoId userID, long time)
|
||||
protected long GetOfferEndTime(OfferCreator creatorType, MongoId userId, long time)
|
||||
{
|
||||
if (creatorType == OfferCreator.Player)
|
||||
{
|
||||
// Player offer = current time + offerDurationTimeInHour;
|
||||
var offerDurationTimeHours = databaseService.GetGlobals().Configuration.RagFair.OfferDurationTimeInHour;
|
||||
return (long)(timeUtil.GetTimeStamp() + Math.Round((double)offerDurationTimeHours * TimeUtil.OneHourAsSeconds));
|
||||
return (long)(timeUtil.GetTimeStamp() + Math.Round(offerDurationTimeHours * TimeUtil.OneHourAsSeconds));
|
||||
}
|
||||
|
||||
if (creatorType == OfferCreator.Trader)
|
||||
// Trader offer
|
||||
{
|
||||
return (long)databaseService.GetTrader(userID).Base.NextResupply;
|
||||
return (long)databaseService.GetTrader(userId).Base.NextResupply;
|
||||
}
|
||||
|
||||
var randomSpread = randomUtil.GetDouble(ragfairConfig.Dynamic.EndTimeSeconds.Min, ragfairConfig.Dynamic.EndTimeSeconds.Max);
|
||||
var randomSpread = randomUtil.GetDouble(RagfairConfig.Dynamic.EndTimeSeconds.Min, RagfairConfig.Dynamic.EndTimeSeconds.Max);
|
||||
|
||||
// Fake-player offer
|
||||
return (long)Math.Round(time + randomSpread);
|
||||
@@ -306,7 +301,7 @@ public class RagfairOfferGenerator(
|
||||
tasks.Add(
|
||||
Task.Factory.StartNew(() =>
|
||||
{
|
||||
CreateOffersFromAssort(assortItemWithChildren, replacingExpiredOffers, ragfairConfig.Dynamic);
|
||||
CreateOffersFromAssort(assortItemWithChildren, replacingExpiredOffers, RagfairConfig.Dynamic);
|
||||
})
|
||||
);
|
||||
}
|
||||
@@ -338,9 +333,9 @@ public class RagfairOfferGenerator(
|
||||
|
||||
// Armor presets can hold plates above the allowed flea level, remove if necessary
|
||||
var isPreset = rootItem?.Upd?.SptPresetId is not null && presetHelper.IsPreset(rootItem.Upd.SptPresetId.Value);
|
||||
if (!isExpiredOffer && isPreset && ragfairConfig.Dynamic.Blacklist.EnableBsgList)
|
||||
if (!isExpiredOffer && isPreset && RagfairConfig.Dynamic.Blacklist.EnableBsgList)
|
||||
{
|
||||
RemoveBannedPlatesFromPreset(assortItemWithChildren, ragfairConfig.Dynamic.Blacklist.ArmorPlate);
|
||||
RemoveBannedPlatesFromPreset(assortItemWithChildren, RagfairConfig.Dynamic.Blacklist.ArmorPlate);
|
||||
}
|
||||
|
||||
// Get number of offers to create
|
||||
@@ -443,18 +438,18 @@ public class RagfairOfferGenerator(
|
||||
RemoveArmorPlates(itemWithChildren, rootItem);
|
||||
}
|
||||
|
||||
var isBarterOffer = randomUtil.GetChance100(ragfairConfig.Dynamic.Barter.ChancePercent);
|
||||
var isBarterOffer = randomUtil.GetChance100(RagfairConfig.Dynamic.Barter.ChancePercent);
|
||||
var isPackOffer =
|
||||
!isBarterOffer
|
||||
&& randomUtil.GetChance100(ragfairConfig.Dynamic.Pack.ChancePercent)
|
||||
&& randomUtil.GetChance100(RagfairConfig.Dynamic.Pack.ChancePercent)
|
||||
&& itemWithChildren.Count == 1
|
||||
&& itemHelper.IsOfBaseclasses(rootItem.Template, ragfairConfig.Dynamic.Pack.ItemTypeWhitelist);
|
||||
&& itemHelper.IsOfBaseclasses(rootItem.Template, RagfairConfig.Dynamic.Pack.ItemTypeWhitelist);
|
||||
|
||||
List<BarterScheme> barterScheme;
|
||||
if (isPackOffer)
|
||||
{
|
||||
// Set pack size
|
||||
desiredStackSize = randomUtil.GetInt(ragfairConfig.Dynamic.Pack.ItemCountMin, ragfairConfig.Dynamic.Pack.ItemCountMax);
|
||||
desiredStackSize = randomUtil.GetInt(RagfairConfig.Dynamic.Pack.ItemCountMin, RagfairConfig.Dynamic.Pack.ItemCountMax);
|
||||
|
||||
// Don't randomise pack items
|
||||
barterScheme = CreateCurrencyBarterScheme(itemWithChildren, isPackOffer, desiredStackSize);
|
||||
@@ -463,8 +458,8 @@ public class RagfairOfferGenerator(
|
||||
{
|
||||
// Apply randomised properties
|
||||
RandomiseOfferItemUpdProperties(sellerId, itemWithChildren, itemToSellDetails, offerCreator);
|
||||
barterScheme = CreateBarterBarterScheme(itemWithChildren, ragfairConfig.Dynamic.Barter);
|
||||
if (ragfairConfig.Dynamic.Barter.MakeSingleStackOnly)
|
||||
barterScheme = CreateBarterBarterScheme(itemWithChildren, RagfairConfig.Dynamic.Barter);
|
||||
if (RagfairConfig.Dynamic.Barter.MakeSingleStackOnly)
|
||||
{
|
||||
var rootBarterItem = itemWithChildren.FirstOrDefault();
|
||||
if (rootBarterItem?.Upd != null)
|
||||
@@ -502,7 +497,7 @@ public class RagfairOfferGenerator(
|
||||
/// <param name="rootItem">Root armor item</param>
|
||||
protected void RemoveArmorPlates(List<Item> itemWithChildren, Item rootItem)
|
||||
{
|
||||
var armorConfig = ragfairConfig.Dynamic.Armor;
|
||||
var armorConfig = RagfairConfig.Dynamic.Armor;
|
||||
|
||||
var shouldRemovePlates = randomUtil.GetChance100(armorConfig.RemoveRemovablePlateChance);
|
||||
if (!shouldRemovePlates || !itemHelper.ArmorItemHasRemovablePlateSlots(rootItem.Template))
|
||||
@@ -542,7 +537,7 @@ public class RagfairOfferGenerator(
|
||||
return;
|
||||
}
|
||||
|
||||
var blacklist = ragfairConfig.Dynamic.Blacklist;
|
||||
var blacklist = RagfairConfig.Dynamic.Blacklist;
|
||||
var childAssortItems = assortsClone.Items.Where(x => !string.Equals(x.ParentId, "hideout", StringComparison.Ordinal)).ToList();
|
||||
foreach (var item in assortsClone.Items)
|
||||
{
|
||||
@@ -601,7 +596,7 @@ public class RagfairOfferGenerator(
|
||||
Items = items,
|
||||
BarterScheme = barterSchemeItems,
|
||||
LoyalLevel = loyalLevel,
|
||||
Quantity = (int?)item.Upd.StackObjectsCount ?? 1,
|
||||
Quantity = (int?)item.Upd?.StackObjectsCount ?? 1,
|
||||
Creator = OfferCreator.Trader,
|
||||
};
|
||||
CreateAndAddFleaOffer(createOfferDetails);
|
||||
@@ -615,12 +610,12 @@ public class RagfairOfferGenerator(
|
||||
/// Get array of an item with its mods + condition properties (e.g. durability) <br />
|
||||
/// Apply randomisation adjustments to condition if item base is found in ragfair.json/dynamic/condition
|
||||
/// </summary>
|
||||
/// <param name="userID"> ID of owner of item </param>
|
||||
/// <param name="userId"> ID of owner of item </param>
|
||||
/// <param name="itemWithMods"> Item and mods, get condition of first item (only first array item is modified) </param>
|
||||
/// <param name="itemDetails"> DB details of first item</param>
|
||||
/// <param name="offerCreator"></param>
|
||||
protected void RandomiseOfferItemUpdProperties(
|
||||
MongoId userID,
|
||||
MongoId userId,
|
||||
IEnumerable<Item> itemWithMods,
|
||||
TemplateItem itemDetails,
|
||||
OfferCreator offerCreator
|
||||
@@ -639,7 +634,7 @@ public class RagfairOfferGenerator(
|
||||
}
|
||||
|
||||
// Roll random chance to randomise item condition
|
||||
if (randomUtil.GetChance100(ragfairConfig.Dynamic.Condition[parentId.Value].ConditionChance * 100))
|
||||
if (randomUtil.GetChance100(RagfairConfig.Dynamic.Condition[parentId.Value].ConditionChance * 100))
|
||||
{
|
||||
RandomiseItemCondition(parentId.Value, itemWithMods, itemDetails);
|
||||
}
|
||||
@@ -654,7 +649,7 @@ public class RagfairOfferGenerator(
|
||||
protected MongoId? GetDynamicConditionIdForTpl(MongoId tpl)
|
||||
{
|
||||
// Get keys from condition config dictionary
|
||||
var configConditions = ragfairConfig.Dynamic.Condition.Keys;
|
||||
var configConditions = RagfairConfig.Dynamic.Condition.Keys;
|
||||
foreach (var baseClass in configConditions)
|
||||
{
|
||||
if (itemHelper.IsOfBaseclass(tpl, baseClass))
|
||||
@@ -676,7 +671,7 @@ public class RagfairOfferGenerator(
|
||||
{
|
||||
var rootItem = itemWithMods.First();
|
||||
|
||||
var itemConditionValues = ragfairConfig.Dynamic.Condition[conditionSettingsId];
|
||||
var itemConditionValues = RagfairConfig.Dynamic.Condition[conditionSettingsId];
|
||||
var maxMultiplier = randomUtil.GetDouble(itemConditionValues.Max.Min, itemConditionValues.Max.Min);
|
||||
var currentMultiplier = randomUtil.GetDouble(itemConditionValues.Current.Min, itemConditionValues.Current.Max);
|
||||
|
||||
@@ -692,7 +687,7 @@ public class RagfairOfferGenerator(
|
||||
var visorMod = itemWithMods.FirstOrDefault(item =>
|
||||
item.ParentId == BaseClasses.ARMORED_EQUIPMENT.ToString() && item.SlotId == "mod_equipment_000"
|
||||
);
|
||||
if (randomUtil.GetChance100(25) && visorMod != null)
|
||||
if (visorMod != null && randomUtil.GetChance100(25))
|
||||
{
|
||||
visorMod.AddUpd();
|
||||
|
||||
@@ -806,7 +801,7 @@ public class RagfairOfferGenerator(
|
||||
|
||||
/// <summary>
|
||||
/// Add missing conditions to an item if needed. <br />
|
||||
/// Durabiltiy for repairable items. <br />
|
||||
/// Durability for repairable items. <br />
|
||||
/// HpResource for medical items.
|
||||
/// </summary>
|
||||
/// <param name="item"> Item to add conditions to </param>
|
||||
@@ -911,7 +906,7 @@ public class RagfairOfferGenerator(
|
||||
protected List<TplWithFleaPrice> GetFleaPricesAsArray()
|
||||
{
|
||||
// Generate if needed
|
||||
if (allowedFleaPriceItemsForBarter == null)
|
||||
if (AllowedFleaPriceItemsForBarter == null)
|
||||
{
|
||||
var fleaPrices = databaseService.GetPrices();
|
||||
|
||||
@@ -920,13 +915,13 @@ public class RagfairOfferGenerator(
|
||||
.Select(kvTpl => new TplWithFleaPrice { Tpl = kvTpl.Key, Price = kvTpl.Value })
|
||||
.Where(item => itemHelper.GetItem(item.Tpl).Key);
|
||||
|
||||
var itemTypeBlacklist = ragfairConfig.Dynamic.Barter.ItemTypeBlacklist;
|
||||
allowedFleaPriceItemsForBarter = filteredFleaItems
|
||||
var itemTypeBlacklist = RagfairConfig.Dynamic.Barter.ItemTypeBlacklist;
|
||||
AllowedFleaPriceItemsForBarter = filteredFleaItems
|
||||
.Where(item => !itemHelper.IsOfBaseclasses(item.Tpl, itemTypeBlacklist))
|
||||
.ToList();
|
||||
}
|
||||
|
||||
return allowedFleaPriceItemsForBarter;
|
||||
return AllowedFleaPriceItemsForBarter;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -31,9 +31,9 @@ public class ScavCaseRewardGenerator(
|
||||
ICloner cloner
|
||||
)
|
||||
{
|
||||
protected List<TemplateItem> _dbAmmoItemsCache = [];
|
||||
protected List<TemplateItem> _dbItemsCache = [];
|
||||
protected readonly ScavCaseConfig _scavCaseConfig = configServer.GetConfig<ScavCaseConfig>();
|
||||
protected List<TemplateItem> DbAmmoItemsCache = [];
|
||||
protected List<TemplateItem> DbItemsCache = [];
|
||||
protected readonly ScavCaseConfig ScavCaseConfig = configServer.GetConfig<ScavCaseConfig>();
|
||||
|
||||
/// <summary>
|
||||
/// Create an array of rewards that will be given to the player upon completing their scav case build
|
||||
@@ -49,9 +49,9 @@ public class ScavCaseRewardGenerator(
|
||||
var rewardItemCounts = GetScavCaseRewardCountsAndPrices(scavCaseDetails);
|
||||
|
||||
// Get items that fit the price criteria as set by the scavCase config
|
||||
var commonPricedItems = GetFilteredItemsByPrice(_dbItemsCache, rewardItemCounts.Common);
|
||||
var rarePricedItems = GetFilteredItemsByPrice(_dbItemsCache, rewardItemCounts.Rare);
|
||||
var superRarePricedItems = GetFilteredItemsByPrice(_dbItemsCache, rewardItemCounts.Superrare);
|
||||
var commonPricedItems = GetFilteredItemsByPrice(DbItemsCache, rewardItemCounts.Common);
|
||||
var rarePricedItems = GetFilteredItemsByPrice(DbItemsCache, rewardItemCounts.Rare);
|
||||
var superRarePricedItems = GetFilteredItemsByPrice(DbItemsCache, rewardItemCounts.Superrare);
|
||||
|
||||
// Get randomly picked items from each item collection, the count range of which is defined in hideout/scavcase.json
|
||||
var randomlyPickedCommonRewards = PickRandomRewards(commonPricedItems, rewardItemCounts.Common, RewardRarity.Common);
|
||||
@@ -78,9 +78,9 @@ public class ScavCaseRewardGenerator(
|
||||
{
|
||||
// Get an array of seasonal items that should not be shown right now as seasonal event is not active
|
||||
var inactiveSeasonalItems = seasonalEventService.GetInactiveSeasonalEventItems();
|
||||
if (!_dbItemsCache.Any())
|
||||
if (!DbItemsCache.Any())
|
||||
{
|
||||
_dbItemsCache = databaseService
|
||||
DbItemsCache = databaseService
|
||||
.GetItems()
|
||||
.Values.Where(item =>
|
||||
{
|
||||
@@ -103,7 +103,7 @@ public class ScavCaseRewardGenerator(
|
||||
// Skip item if item id is on blacklist
|
||||
if (
|
||||
item.Type != "Item"
|
||||
|| _scavCaseConfig.RewardItemBlacklist.Contains(item.Id)
|
||||
|| ScavCaseConfig.RewardItemBlacklist.Contains(item.Id)
|
||||
|| itemFilterService.IsItemBlacklisted(item.Id)
|
||||
)
|
||||
{
|
||||
@@ -116,13 +116,13 @@ public class ScavCaseRewardGenerator(
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!_scavCaseConfig.AllowBossItemsAsRewards && itemFilterService.IsBossItem(item.Id))
|
||||
if (!ScavCaseConfig.AllowBossItemsAsRewards && itemFilterService.IsBossItem(item.Id))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Skip item if parent id is blacklisted
|
||||
if (itemHelper.IsOfBaseclasses(item.Id, _scavCaseConfig.RewardItemParentBlacklist))
|
||||
if (itemHelper.IsOfBaseclasses(item.Id, ScavCaseConfig.RewardItemParentBlacklist))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -137,9 +137,9 @@ public class ScavCaseRewardGenerator(
|
||||
.ToList();
|
||||
}
|
||||
|
||||
if (!_dbAmmoItemsCache.Any())
|
||||
if (!DbAmmoItemsCache.Any())
|
||||
{
|
||||
_dbAmmoItemsCache = databaseService
|
||||
DbAmmoItemsCache = databaseService
|
||||
.GetItems()
|
||||
.Values.Where(item =>
|
||||
{
|
||||
@@ -161,7 +161,7 @@ public class ScavCaseRewardGenerator(
|
||||
}
|
||||
|
||||
// Skip item if item id is on blacklist
|
||||
if (_scavCaseConfig.RewardItemBlacklist.Contains(item.Id) || itemFilterService.IsItemBlacklisted(item.Id))
|
||||
if (ScavCaseConfig.RewardItemBlacklist.Contains(item.Id) || itemFilterService.IsItemBlacklisted(item.Id))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -172,7 +172,7 @@ public class ScavCaseRewardGenerator(
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!_scavCaseConfig.AllowBossItemsAsRewards && itemFilterService.IsBossItem(item.Id))
|
||||
if (!ScavCaseConfig.AllowBossItemsAsRewards && itemFilterService.IsBossItem(item.Id))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -184,7 +184,7 @@ public class ScavCaseRewardGenerator(
|
||||
}
|
||||
|
||||
// Skip ammo that doesn't stack as high as value in config
|
||||
if (item.Properties.StackMaxSize < _scavCaseConfig.AmmoRewards.MinStackSize)
|
||||
if (item.Properties.StackMaxSize < ScavCaseConfig.AmmoRewards.MinStackSize)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -215,7 +215,7 @@ public class ScavCaseRewardGenerator(
|
||||
{
|
||||
// Only allow one reward to be money
|
||||
result.Add(GetRandomMoney());
|
||||
if (!_scavCaseConfig.AllowMultipleMoneyRewardsPerRarity)
|
||||
if (!ScavCaseConfig.AllowMultipleMoneyRewardsPerRarity)
|
||||
{
|
||||
rewardWasMoney = true;
|
||||
}
|
||||
@@ -224,7 +224,7 @@ public class ScavCaseRewardGenerator(
|
||||
{
|
||||
// Only allow one reward to be ammo
|
||||
result.Add(GetRandomAmmo(rarity));
|
||||
if (!_scavCaseConfig.AllowMultipleAmmoRewardsPerRarity)
|
||||
if (!ScavCaseConfig.AllowMultipleAmmoRewardsPerRarity)
|
||||
{
|
||||
rewardWasAmmo = true;
|
||||
}
|
||||
@@ -244,7 +244,7 @@ public class ScavCaseRewardGenerator(
|
||||
/// <returns>true if reward should be money</returns>
|
||||
protected bool RewardShouldBeMoney()
|
||||
{
|
||||
return randomUtil.GetChance100(_scavCaseConfig.MoneyRewards.MoneyRewardChancePercent);
|
||||
return randomUtil.GetChance100(ScavCaseConfig.MoneyRewards.MoneyRewardChancePercent);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -253,7 +253,7 @@ public class ScavCaseRewardGenerator(
|
||||
/// <returns>true if reward should be ammo</returns>
|
||||
protected bool RewardShouldBeAmmo()
|
||||
{
|
||||
return randomUtil.GetChance100(_scavCaseConfig.AmmoRewards.AmmoRewardChancePercent);
|
||||
return randomUtil.GetChance100(ScavCaseConfig.AmmoRewards.AmmoRewardChancePercent);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -278,12 +278,12 @@ public class ScavCaseRewardGenerator(
|
||||
/// <returns>random ammo item from items.json</returns>
|
||||
protected TemplateItem GetRandomAmmo(string rarity)
|
||||
{
|
||||
var possibleAmmoPool = _dbAmmoItemsCache.Where(ammo =>
|
||||
var possibleAmmoPool = DbAmmoItemsCache.Where(ammo =>
|
||||
{
|
||||
// Is ammo handbook price between desired range
|
||||
var handbookPrice = ragfairPriceService.GetStaticPriceForItem(ammo.Id);
|
||||
if (
|
||||
_scavCaseConfig.AmmoRewards.AmmoRewardValueRangeRub.TryGetValue(rarity, out var matchingAmmoRewardForRarity)
|
||||
ScavCaseConfig.AmmoRewards.AmmoRewardValueRangeRub.TryGetValue(rarity, out var matchingAmmoRewardForRarity)
|
||||
&& handbookPrice >= matchingAmmoRewardForRarity.Min
|
||||
&& handbookPrice <= matchingAmmoRewardForRarity.Max
|
||||
)
|
||||
@@ -398,22 +398,22 @@ public class ScavCaseRewardGenerator(
|
||||
{
|
||||
MinCount = scavCaseDetails.EndProducts.Common.Min,
|
||||
MaxCount = scavCaseDetails.EndProducts.Common.Max,
|
||||
MinPriceRub = _scavCaseConfig.RewardItemValueRangeRub[RewardRarity.Common].Min,
|
||||
MaxPriceRub = _scavCaseConfig.RewardItemValueRangeRub[RewardRarity.Common].Max,
|
||||
MinPriceRub = ScavCaseConfig.RewardItemValueRangeRub[RewardRarity.Common].Min,
|
||||
MaxPriceRub = ScavCaseConfig.RewardItemValueRangeRub[RewardRarity.Common].Max,
|
||||
},
|
||||
Rare = new RewardCountAndPriceDetails
|
||||
{
|
||||
MinCount = scavCaseDetails.EndProducts.Rare.Min,
|
||||
MaxCount = scavCaseDetails.EndProducts.Rare.Max,
|
||||
MinPriceRub = _scavCaseConfig.RewardItemValueRangeRub[RewardRarity.Rare].Min,
|
||||
MaxPriceRub = _scavCaseConfig.RewardItemValueRangeRub[RewardRarity.Rare].Max,
|
||||
MinPriceRub = ScavCaseConfig.RewardItemValueRangeRub[RewardRarity.Rare].Min,
|
||||
MaxPriceRub = ScavCaseConfig.RewardItemValueRangeRub[RewardRarity.Rare].Max,
|
||||
},
|
||||
Superrare = new RewardCountAndPriceDetails
|
||||
{
|
||||
MinCount = scavCaseDetails.EndProducts.Superrare.Min,
|
||||
MaxCount = scavCaseDetails.EndProducts.Superrare.Max,
|
||||
MinPriceRub = _scavCaseConfig.RewardItemValueRangeRub[RewardRarity.SuperRare].Min,
|
||||
MaxPriceRub = _scavCaseConfig.RewardItemValueRangeRub[RewardRarity.SuperRare].Max,
|
||||
MinPriceRub = ScavCaseConfig.RewardItemValueRangeRub[RewardRarity.SuperRare].Min,
|
||||
MaxPriceRub = ScavCaseConfig.RewardItemValueRangeRub[RewardRarity.SuperRare].Max,
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -449,7 +449,7 @@ public class ScavCaseRewardGenerator(
|
||||
/// <returns>value to set stack count to</returns>
|
||||
protected int GetRandomisedAmmoRewardStackSize(TemplateItem itemToCalculate)
|
||||
{
|
||||
return randomUtil.GetInt(_scavCaseConfig.AmmoRewards.MinStackSize, itemToCalculate.Properties.StackMaxSize ?? 0);
|
||||
return randomUtil.GetInt(ScavCaseConfig.AmmoRewards.MinStackSize, itemToCalculate.Properties.StackMaxSize ?? 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -465,29 +465,29 @@ public class ScavCaseRewardGenerator(
|
||||
if (id == Money.ROUBLES)
|
||||
{
|
||||
return randomUtil.GetInt(
|
||||
_scavCaseConfig.MoneyRewards.RubCount.GetByJsonProperty<MinMax<int>>(rarity).Min,
|
||||
_scavCaseConfig.MoneyRewards.RubCount.GetByJsonProperty<MinMax<int>>(rarity).Max
|
||||
ScavCaseConfig.MoneyRewards.RubCount.GetByJsonProperty<MinMax<int>>(rarity).Min,
|
||||
ScavCaseConfig.MoneyRewards.RubCount.GetByJsonProperty<MinMax<int>>(rarity).Max
|
||||
);
|
||||
}
|
||||
else if (id == Money.EUROS)
|
||||
{
|
||||
return randomUtil.GetInt(
|
||||
_scavCaseConfig.MoneyRewards.EurCount.GetByJsonProperty<MinMax<int>>(rarity).Min,
|
||||
_scavCaseConfig.MoneyRewards.EurCount.GetByJsonProperty<MinMax<int>>(rarity).Max
|
||||
ScavCaseConfig.MoneyRewards.EurCount.GetByJsonProperty<MinMax<int>>(rarity).Min,
|
||||
ScavCaseConfig.MoneyRewards.EurCount.GetByJsonProperty<MinMax<int>>(rarity).Max
|
||||
);
|
||||
}
|
||||
else if (id == Money.DOLLARS)
|
||||
{
|
||||
return randomUtil.GetInt(
|
||||
_scavCaseConfig.MoneyRewards.UsdCount.GetByJsonProperty<MinMax<int>>(rarity).Min,
|
||||
_scavCaseConfig.MoneyRewards.UsdCount.GetByJsonProperty<MinMax<int>>(rarity).Max
|
||||
ScavCaseConfig.MoneyRewards.UsdCount.GetByJsonProperty<MinMax<int>>(rarity).Min,
|
||||
ScavCaseConfig.MoneyRewards.UsdCount.GetByJsonProperty<MinMax<int>>(rarity).Max
|
||||
);
|
||||
}
|
||||
else if (id == Money.GP)
|
||||
{
|
||||
return randomUtil.GetInt(
|
||||
_scavCaseConfig.MoneyRewards.GpCount.GetByJsonProperty<MinMax<int>>(rarity).Min,
|
||||
_scavCaseConfig.MoneyRewards.GpCount.GetByJsonProperty<MinMax<int>>(rarity).Max
|
||||
ScavCaseConfig.MoneyRewards.GpCount.GetByJsonProperty<MinMax<int>>(rarity).Min,
|
||||
ScavCaseConfig.MoneyRewards.GpCount.GetByJsonProperty<MinMax<int>>(rarity).Max
|
||||
);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -20,7 +20,7 @@ public class WeatherGenerator(
|
||||
RandomUtil randomUtil
|
||||
)
|
||||
{
|
||||
protected readonly WeatherConfig _weatherConfig = configServer.GetConfig<WeatherConfig>();
|
||||
protected readonly WeatherConfig WeatherConfig = configServer.GetConfig<WeatherConfig>();
|
||||
|
||||
/// <summary>
|
||||
/// Get current + raid datetime and format into correct BSG format.
|
||||
@@ -34,7 +34,7 @@ public class WeatherGenerator(
|
||||
|
||||
data.Date = formattedDate;
|
||||
data.Time = GetBsgFormattedInRaidTime();
|
||||
data.Acceleration = _weatherConfig.Acceleration;
|
||||
data.Acceleration = WeatherConfig.Acceleration;
|
||||
|
||||
data.Season = seasonalEventService.GetActiveWeatherSeason();
|
||||
}
|
||||
@@ -90,10 +90,10 @@ public class WeatherGenerator(
|
||||
|
||||
protected SeasonalValues GetWeatherValuesBySeason(Season currentSeason)
|
||||
{
|
||||
var result = _weatherConfig.Weather.SeasonValues.TryGetValue(currentSeason.ToString(), out var value);
|
||||
var result = WeatherConfig.Weather.SeasonValues.TryGetValue(currentSeason.ToString(), out var value);
|
||||
if (!result)
|
||||
{
|
||||
return _weatherConfig.Weather.SeasonValues["default"];
|
||||
return WeatherConfig.Weather.SeasonValues["default"];
|
||||
}
|
||||
|
||||
return value!;
|
||||
|
||||
Reference in New Issue
Block a user