Merge pull request #104 from tetrisdev/GeneratorComments
Update Generator Comments
This commit is contained in:
@@ -365,9 +365,10 @@ public class BotLootGenerator(
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get an array of the containers a bot has on them (pockets/backpack/vest)
|
||||
/// </summary>
|
||||
/// <param name="botInventory"></param>
|
||||
/// <returns></returns>
|
||||
/// <param name="botInventory">Bot to check</param>
|
||||
/// <returns>Array of available slots</returns>
|
||||
protected HashSet<EquipmentSlots> GetAvailableContainersBotCanStoreItemsIn(BotBaseInventory botInventory)
|
||||
{
|
||||
HashSet<EquipmentSlots> result = [EquipmentSlots.Pockets];
|
||||
@@ -594,9 +595,10 @@ public class BotLootGenerator(
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds loot to the specified Wallet
|
||||
/// </summary>
|
||||
/// <param name="walletId"></param>
|
||||
/// <returns></returns>
|
||||
/// <param name="walletId"> Wallet to add loot to</param>
|
||||
/// <returns>Generated list of currency stacks with the wallet as their parent</returns>
|
||||
public List<List<Item>> CreateWalletLoot(string walletId)
|
||||
{
|
||||
List<List<Item>> result = [];
|
||||
|
||||
@@ -29,9 +29,9 @@ public class FenceBaseAssortGenerator(
|
||||
{
|
||||
protected TraderConfig traderConfig = configServer.GetConfig<TraderConfig>();
|
||||
|
||||
/**
|
||||
* Create base fence assorts dynamically and store in memory
|
||||
*/
|
||||
/// <summary>
|
||||
/// Create base fence assorts dynamically and store in memory
|
||||
/// </summary>
|
||||
public void GenerateFenceBaseAssorts()
|
||||
{
|
||||
var blockedSeasonalItems = seasonalEventService.GetInactiveSeasonalEventItems();
|
||||
@@ -200,11 +200,11 @@ public class FenceBaseAssortGenerator(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check ammo in boxes + loose ammos has a penetration value above the configured value in trader.json / ammoMaxPenLimit
|
||||
* @param rootItemDb Ammo box or ammo item from items.db
|
||||
* @returns True if penetration value is above limit set in config
|
||||
*/
|
||||
/// <summary>
|
||||
/// Check ammo in boxes + loose ammos has a penetration value above the configured value in trader.json / ammoMaxPenLimit
|
||||
/// </summary>
|
||||
/// <param name="rootItemDb"> Ammo box or ammo item from items.db </param>
|
||||
/// <returns>True if penetration value is above limit set in config</returns>
|
||||
protected bool IsAmmoAbovePenetrationLimit(TemplateItem rootItemDb)
|
||||
{
|
||||
var ammoPenetrationPower = GetAmmoPenetrationPower(rootItemDb);
|
||||
@@ -217,11 +217,11 @@ public class FenceBaseAssortGenerator(
|
||||
return ammoPenetrationPower > traderConfig.Fence.AmmoMaxPenLimit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the penetration power value of an ammo, works with ammo boxes and raw ammos
|
||||
* @param rootItemDb Ammo box or ammo item from items.db
|
||||
* @returns Penetration power of passed in item, undefined if it doesnt have a power
|
||||
*/
|
||||
/// <summary>
|
||||
/// Get the penetration power value of an ammo, works with ammo boxes and raw ammos
|
||||
/// </summary>
|
||||
/// <param name="rootItemDb"> Ammo box or ammo item from items.db </param>
|
||||
/// <returns> Penetration power of passed in item, undefined if it doesnt have a power </returns>
|
||||
protected double? GetAmmoPenetrationPower(TemplateItem rootItemDb)
|
||||
{
|
||||
if (itemHelper.IsOfBaseclass(rootItemDb.Id, BaseClasses.AMMO_BOX))
|
||||
@@ -250,11 +250,11 @@ public class FenceBaseAssortGenerator(
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add soft inserts + armor plates to an armor
|
||||
* @param armor Armor item array to add mods into
|
||||
* @param itemDbDetails Armor items db template
|
||||
*/
|
||||
/// <summary>
|
||||
/// Add soft inserts + armor plates to an armor
|
||||
/// </summary>
|
||||
/// <param name="armor"> Armor item array to add mods into </param>
|
||||
/// <param name="itemDbDetails">Armor items db template</param>
|
||||
protected void AddChildrenToArmorModSlots(List<Item> armor, TemplateItem itemDbDetails)
|
||||
{
|
||||
// Armor has no mods, make no additions
|
||||
@@ -336,11 +336,11 @@ public class FenceBaseAssortGenerator(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if item is valid for being added to fence assorts
|
||||
* @param item Item to check
|
||||
* @returns true if valid fence item
|
||||
*/
|
||||
/// <summary>
|
||||
/// Check if item is valid for being added to fence assorts
|
||||
/// </summary>
|
||||
/// <param name="item"> Item to check </param>
|
||||
/// <returns> True if valid fence item </returns>
|
||||
protected bool IsValidFenceItem(TemplateItem item)
|
||||
{
|
||||
return string.Equals(item.Type, "Item", StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
@@ -977,7 +977,13 @@ public class LocationLootGenerator(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create array of item (with child items) and return
|
||||
/// </summary>
|
||||
/// <param name="chosenComposedKey"> Key we want to look up items for </param>
|
||||
/// <param name="items"> Location loot Template </param>
|
||||
/// <param name="staticAmmoDist"> Ammo distributions </param>
|
||||
/// <returns> ContainerItem object </returns>
|
||||
protected ContainerItem CreateDynamicLootItem(string? chosenComposedKey, List<Item> items, Dictionary<string, List<StaticAmmoDetails>> staticAmmoDist)
|
||||
{
|
||||
var chosenItem = items.FirstOrDefault(item => item.Id == chosenComposedKey);
|
||||
|
||||
@@ -30,21 +30,29 @@ namespace Core.Generators
|
||||
this._configServer = _configServer;
|
||||
_pmcConfig = _configServer.GetConfig<PmcConfig>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a pmc wave to a map
|
||||
/// </summary>
|
||||
/// <param name="locationId"> e.g. factory4_day, bigmap </param>
|
||||
/// <param name="waveToAdd"> Boss wave to add to map </param>
|
||||
public void AddPmcWaveToLocation(string locationId, BossLocationSpawn waveToAdd)
|
||||
{
|
||||
_pmcConfig.CustomPmcWaves[locationId].Add(waveToAdd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add custom boss and normal waves to maps found in config/location.json to db
|
||||
*/
|
||||
/// <summary>
|
||||
/// Add custom boss and normal waves to all maps found in config/location.json to db
|
||||
/// </summary>
|
||||
public void ApplyWaveChangesToAllMaps() {
|
||||
foreach (var location in _pmcConfig.CustomPmcWaves) {
|
||||
ApplyWaveChangesToMapByName(location.Key);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add custom boss and normal waves to a map found in config/location.json to db by name
|
||||
/// </summary>
|
||||
/// <param name="name"> e.g. factory4_day, bigmap </param>
|
||||
public void ApplyWaveChangesToMapByName(string name) {
|
||||
if (!_pmcConfig.CustomPmcWaves.TryGetValue(name, out var pmcWavesToAdd)) {
|
||||
return;
|
||||
@@ -57,7 +65,10 @@ namespace Core.Generators
|
||||
|
||||
location.Base.BossLocationSpawn.AddRange(pmcWavesToAdd);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add custom boss and normal waves to a map found in config/location.json to db by LocationBase
|
||||
/// </summary>
|
||||
/// <param name="location"> Location Object </param>
|
||||
public void ApplyWaveChangesToMap(LocationBase location) {
|
||||
if (!_pmcConfig.CustomPmcWaves.TryGetValue(location.Id.ToLower(), out var pmcWavesToAdd))
|
||||
{
|
||||
|
||||
@@ -35,11 +35,11 @@ public class RagfairAssortGenerator(
|
||||
BaseClasses.BUILT_IN_INSERTS
|
||||
];
|
||||
|
||||
/**
|
||||
* Get an array of arrays that can be sold on the flea
|
||||
* Each sub array contains item + children (if any)
|
||||
* @returns array of arrays
|
||||
*/
|
||||
/// <summary>
|
||||
/// Get a list of lists that can be sold on the flea. <br/>
|
||||
/// Each sub list contains item + children (if any)
|
||||
/// </summary>
|
||||
/// <returns> List with children lists of items </returns>
|
||||
public List<List<Item>> GetAssortItems()
|
||||
{
|
||||
if (!AssortsAreGenerated())
|
||||
@@ -50,19 +50,19 @@ public class RagfairAssortGenerator(
|
||||
return generatedAssortItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check internal generatedAssortItems array has objects
|
||||
* @returns true if array has objects
|
||||
*/
|
||||
/// <summary>
|
||||
/// Check if internal generatedAssortItems list has objects
|
||||
/// </summary>
|
||||
/// <returns> True if array has objects </returns>
|
||||
protected bool AssortsAreGenerated()
|
||||
{
|
||||
return generatedAssortItems.Count > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate an array of arrays (item + children) the flea can sell
|
||||
* @returns array of arrays (item + children)
|
||||
*/
|
||||
/// <summary>
|
||||
/// Generate a list of lists (item + children) the flea can sell
|
||||
/// </summary>
|
||||
/// <returns> List of lists (item + children)</returns>
|
||||
protected List<List<Item>> GenerateRagfairAssortItems()
|
||||
{
|
||||
List<List<Item>> results = [];
|
||||
@@ -70,7 +70,7 @@ public class RagfairAssortGenerator(
|
||||
// Get cloned items from db
|
||||
var dbItemsClone = itemHelper.GetItems().Where(item => !string.Equals(item.Type, "Node", StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
// Store processed preset tpls so we don't add them when processing non-preset items
|
||||
// Store processed preset tpls so we don't add them when processing non-preset items
|
||||
HashSet<string> processedArmorItems = [];
|
||||
var seasonalEventActive = seasonalEventService.SeasonalEventEnabled();
|
||||
var seasonalItemTplBlacklist = seasonalEventService.GetInactiveSeasonalEventItems();
|
||||
@@ -131,11 +131,11 @@ public class RagfairAssortGenerator(
|
||||
return results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get presets from globals to add to flea
|
||||
* ragfairConfig.dynamic.showDefaultPresetsOnly decides if its all presets or just defaults
|
||||
* @returns IPreset array
|
||||
*/
|
||||
/// <summary>
|
||||
/// Get presets from globals to add to flea. <br/>
|
||||
/// ragfairConfig.dynamic.showDefaultPresetsOnly decides if it's all presets or just defaults
|
||||
/// </summary>
|
||||
/// <returns> List of Preset </returns>
|
||||
protected List<Preset> GetPresetsToAdd()
|
||||
{
|
||||
return ragfairConfig.Dynamic.ShowDefaultPresetsOnly
|
||||
@@ -143,12 +143,12 @@ public class RagfairAssortGenerator(
|
||||
: presetHelper.GetAllPresets();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a base assort item and return it with populated values + 999999 stack count + unlimited count = true
|
||||
* @param tplId tplid to add to item
|
||||
* @param id id to add to item
|
||||
* @returns Hydrated Item object
|
||||
*/
|
||||
/// <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="id"> id to add to item </param>
|
||||
/// <returns> Hydrated Item object </returns>
|
||||
protected Item CreateRagfairAssortRootItem(string tplId, string? id = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(id))
|
||||
|
||||
@@ -42,9 +42,7 @@ public class RagfairOfferGenerator(
|
||||
protected List<TplWithFleaPrice>? allowedFleaPriceItemsForBarter;
|
||||
protected BotConfig botConfig = configServer.GetConfig<BotConfig>();
|
||||
|
||||
/**
|
||||
* Internal counter to ensure each offer created has a unique value for its intId property
|
||||
*/
|
||||
/// Internal counter to ensure each offer created has a unique value for its intId property
|
||||
protected int offerCounter;
|
||||
protected RagfairConfig ragfairConfig = configServer.GetConfig<RagfairConfig>();
|
||||
|
||||
@@ -207,11 +205,11 @@ public class RagfairOfferGenerator(
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the offer price that's listed on the flea listing
|
||||
* @param offerRequirements barter requirements for offer
|
||||
* @returns rouble cost of offer
|
||||
*/
|
||||
/// <summary>
|
||||
/// Calculate the offer price that's listed on the flea listing
|
||||
/// </summary>
|
||||
/// <param name="offerRequirements"> barter requirements for offer </param>
|
||||
/// <returns> rouble cost of offer </returns>
|
||||
protected double ConvertOfferRequirementsIntoRoubles(IEnumerable<OfferRequirement> offerRequirements)
|
||||
{
|
||||
var roublePrice = 0d;
|
||||
@@ -225,12 +223,12 @@ public class RagfairOfferGenerator(
|
||||
return roublePrice;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get avatar url from trader table in db
|
||||
* @param isTrader Is user we're getting avatar for a trader
|
||||
* @param userId persons id to get avatar of
|
||||
* @returns url of avatar
|
||||
*/
|
||||
/// <summary>
|
||||
/// Get avatar url from trader table in db
|
||||
/// </summary>
|
||||
/// <param name="isTrader"> Is user we're getting avatar for a trader </param>
|
||||
/// <param name="userId"> Persons id to get avatar of </param>
|
||||
/// <returns> Url of avatar as String </returns>
|
||||
protected string GetAvatarUrl(bool isTrader, string userId)
|
||||
{
|
||||
if (isTrader)
|
||||
@@ -241,12 +239,12 @@ public class RagfairOfferGenerator(
|
||||
return "/files/trader/avatar/unknown.jpg";
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a count of currency into roubles
|
||||
* @param currencyCount amount of currency to convert into roubles
|
||||
* @param currencyType Type of currency (euro/dollar/rouble)
|
||||
* @returns count of roubles
|
||||
*/
|
||||
/// <summary>
|
||||
/// Convert a count of currency into roubles
|
||||
/// </summary>
|
||||
/// <param name="currencyCount"> Amount of currency to convert into roubles </param>
|
||||
/// <param name="currencyType"> Type of currency (euro/dollar/rouble) </param>
|
||||
/// <returns> Count of roubles </returns>
|
||||
protected double CalculateRoublePrice(double currencyCount, string currencyType)
|
||||
{
|
||||
if (currencyType == Money.ROUBLES)
|
||||
@@ -257,11 +255,11 @@ public class RagfairOfferGenerator(
|
||||
return handbookHelper.InRUB(currencyCount, currencyType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check userId, if its a player, return their pmc _id, otherwise return userId parameter
|
||||
* @param userId Users Id to check
|
||||
* @returns Users Id
|
||||
*/
|
||||
/// <summary>
|
||||
/// Check userId, if it's a player, return their pmc _id, otherwise return userId parameter
|
||||
/// </summary>
|
||||
/// <param name="userId"> Users ID to check </param>
|
||||
/// <returns> Users ID </returns>
|
||||
protected string GetTraderId(string userId)
|
||||
{
|
||||
if (profileHelper.IsPlayer(userId))
|
||||
@@ -272,11 +270,11 @@ public class RagfairOfferGenerator(
|
||||
return userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a flea trading rating for the passed in user
|
||||
* @param userId User to get flea rating of
|
||||
* @returns Flea rating value
|
||||
*/
|
||||
/// <summary>
|
||||
/// Get a flea trading rating for the passed in user
|
||||
/// </summary>
|
||||
/// <param name="userId"> User to get flea rating of </param>
|
||||
/// <returns> Flea rating value </returns>
|
||||
protected double? GetRating(string userId)
|
||||
{
|
||||
if (profileHelper.IsPlayer(userId))
|
||||
@@ -295,11 +293,11 @@ public class RagfairOfferGenerator(
|
||||
return randomUtil.GetDouble((double) ragfairConfig.Dynamic.Rating.Min, (double) ragfairConfig.Dynamic.Rating.Max);
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the offers user rating growing
|
||||
* @param userID user to check rating of
|
||||
* @returns true if its growing
|
||||
*/
|
||||
/// <summary>
|
||||
/// Is the offers user rating growing
|
||||
/// </summary>
|
||||
/// <param name="userID"> User to check rating of</param>
|
||||
/// <returns> True if growing </returns>
|
||||
protected bool GetRatingGrowing(string userID)
|
||||
{
|
||||
if (profileHelper.IsPlayer(userID))
|
||||
@@ -319,12 +317,12 @@ public class RagfairOfferGenerator(
|
||||
return randomUtil.GetBool();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get number of section until offer should expire
|
||||
* @param userID Id of the offer owner
|
||||
* @param time Time the offer is posted
|
||||
* @returns number of seconds until offer expires
|
||||
*/
|
||||
/// <summary>
|
||||
/// Get number of section until offer should expire
|
||||
/// </summary>
|
||||
/// <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(string userID, long time)
|
||||
{
|
||||
if (profileHelper.IsPlayer(userID))
|
||||
@@ -346,10 +344,10 @@ public class RagfairOfferGenerator(
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create multiple offers for items by using a unique list of items we've generated previously
|
||||
* @param expiredOffers optional, expired offers to regenerate
|
||||
*/
|
||||
/// <summary>
|
||||
/// Create multiple offers for items by using a unique list of items we've generated previously
|
||||
/// </summary>
|
||||
/// <param name="expiredOffers"> Optional, expired offers to regenerate </param>
|
||||
public void GenerateDynamicOffers(List<List<Item>>? expiredOffers = null)
|
||||
{
|
||||
var replacingExpiredOffers = (expiredOffers?.Count ?? 0) > 0;
|
||||
@@ -387,11 +385,12 @@ public class RagfairOfferGenerator(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param assortItemWithChildren Item with its children to process into offers
|
||||
* @param isExpiredOffer is an expired offer
|
||||
* @param config Ragfair dynamic config
|
||||
*/
|
||||
/// <summary>
|
||||
/// Generates offers from an item and it's children on the flea market
|
||||
/// </summary>
|
||||
/// <param name="assortItemWithChildren"> Item with its children to process into offers </param>
|
||||
/// <param name="isExpiredOffer"> Is an expired offer </param>
|
||||
/// <param name="config"> Ragfair dynamic config </param>
|
||||
protected void CreateOffersFromAssort(
|
||||
List<Item> assortItemWithChildren,
|
||||
bool isExpiredOffer,
|
||||
@@ -439,12 +438,12 @@ public class RagfairOfferGenerator(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* iterate over an items chidren and look for plates above desired level and remove them
|
||||
* @param presetWithChildren preset to check for plates
|
||||
* @param plateSettings Settings
|
||||
* @returns True if plate removed
|
||||
*/
|
||||
/// <summary>
|
||||
/// Iterate over an items children and look for plates above desired level and remove them
|
||||
/// </summary>
|
||||
/// <param name="presetWithChildren"> Preset to check for plates </param>
|
||||
/// <param name="plateSettings"> Settings </param>
|
||||
/// <returns> True if plates removed </returns>
|
||||
protected bool RemoveBannedPlatesFromPreset(
|
||||
List<Item> presetWithChildren,
|
||||
ArmorPlateBlacklistSettings plateSettings
|
||||
@@ -483,14 +482,13 @@ public class RagfairOfferGenerator(
|
||||
return removedPlate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create one flea offer for a specific item
|
||||
* @param sellerId Id of seller
|
||||
* @param itemWithChildren Item to create offer for
|
||||
* @param isPreset Is item a weapon preset
|
||||
* @param itemToSellDetails Raw db item details
|
||||
* @returns Item array
|
||||
*/
|
||||
/// <summary>
|
||||
/// Create one flea offer for a specific item
|
||||
/// </summary>
|
||||
/// <param name="sellerId"> ID of seller</param>
|
||||
/// <param name="itemWithChildren"> Item to create offer for </param>
|
||||
/// <param name="isPreset"> Is item a weapon preset</param>
|
||||
/// <param name="itemToSellDetails"> Raw DB item details </param>
|
||||
protected void CreateSingleOfferForItem(
|
||||
string sellerId,
|
||||
List<Item> itemWithChildren,
|
||||
@@ -580,10 +578,10 @@ public class RagfairOfferGenerator(
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate trader offers on flea using the traders assort data
|
||||
* @param traderID Trader to generate offers for
|
||||
*/
|
||||
/// <summary>
|
||||
/// Generate trader offers on flea using the traders assort data
|
||||
/// </summary>
|
||||
/// <param name="traderID"> Trader to generate offers for </param>
|
||||
public void GenerateFleaOffersForTrader(string traderID)
|
||||
{
|
||||
// Purge
|
||||
@@ -665,13 +663,13 @@ public class RagfairOfferGenerator(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get array of an item with its mods + condition properties (e.g durability)
|
||||
* Apply randomisation adjustments to condition if item base is found in ragfair.json/dynamic/condition
|
||||
* @param userID id of owner of item
|
||||
* @param itemWithMods Item and mods, get condition of first item (only first array item is modified)
|
||||
* @param itemDetails db details of first item
|
||||
*/
|
||||
/// <summary>
|
||||
/// 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="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>
|
||||
protected void RandomiseOfferItemUpdProperties(string userID, List<Item> itemWithMods, TemplateItem itemDetails)
|
||||
{
|
||||
// Add any missing properties to first item in array
|
||||
@@ -694,11 +692,11 @@ public class RagfairOfferGenerator(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the relevant condition id if item tpl matches in ragfair.json/condition
|
||||
* @param tpl Item to look for matching condition object
|
||||
* @returns condition id
|
||||
*/
|
||||
/// <summary>
|
||||
/// Get the relevant condition id if item tpl matches in ragfair.json/condition
|
||||
/// </summary>
|
||||
/// <param name="tpl"> Item to look for matching condition object</param>
|
||||
/// <returns> Condition ID </returns>
|
||||
protected string? GetDynamicConditionIdForTpl(string tpl)
|
||||
{
|
||||
// Get keys from condition config dictionary
|
||||
@@ -714,12 +712,12 @@ public class RagfairOfferGenerator(
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Alter an items condition based on its item base type
|
||||
* @param conditionSettingsId also the parentId of item being altered
|
||||
* @param itemWithMods Item to adjust condition details of
|
||||
* @param itemDetails db item details of first item in array
|
||||
*/
|
||||
/// <summary>
|
||||
/// Alter an items condition based on its item base type
|
||||
/// </summary>
|
||||
/// <param name="conditionSettingsId"> Also the parentID of item being altered </param>
|
||||
/// <param name="itemWithMods"> Item to adjust condition details of </param>
|
||||
/// <param name="itemDetails"> DB Item details of first item in list </param>
|
||||
protected void RandomiseItemCondition(
|
||||
string conditionSettingsId,
|
||||
List<Item> itemWithMods,
|
||||
@@ -810,13 +808,13 @@ public class RagfairOfferGenerator(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjust an items durability/maxDurability value
|
||||
* @param item item (weapon/armor) to Adjust
|
||||
* @param itemDbDetails Weapon details from db
|
||||
* @param maxMultiplier Value to multiply max durability by
|
||||
* @param currentMultiplier Value to multiply current durability by
|
||||
*/
|
||||
///<summary>
|
||||
/// Adjust an items durability/maxDurability value
|
||||
/// </summary>
|
||||
/// <param name="item"> Item (weapon/armor) to adjust </param>
|
||||
/// <param name="itemDbDetails"> Item details from DB </param>
|
||||
/// <param name="maxMultiplier"> Value to multiply max durability by </param>
|
||||
/// <param name="currentMultiplier"> Value to multiply current durability by </param>
|
||||
protected void RandomiseWeaponDurability(
|
||||
Item item,
|
||||
TemplateItem itemDbDetails,
|
||||
@@ -837,12 +835,12 @@ public class RagfairOfferGenerator(
|
||||
item.Upd.Repairable.MaxDurability = chosenMaxDurability;
|
||||
}
|
||||
|
||||
/**
|
||||
* Randomise the durability values for an armors plates and soft inserts
|
||||
* @param armorWithMods Armor item with its child mods
|
||||
* @param currentMultiplier Chosen multiplier to use for current durability value
|
||||
* @param maxMultiplier Chosen multiplier to use for max durability value
|
||||
*/
|
||||
/// <summary>
|
||||
/// Randomise the durability values for an armors plates and soft inserts
|
||||
/// </summary>
|
||||
/// <param name="armorWithMods"> Armor item with its child mods </param>
|
||||
/// <param name="currentMultiplier"> Chosen multiplier to use for current durability value </param>
|
||||
/// <param name="maxMultiplier"> Chosen multiplier to use for max durability value </param>
|
||||
protected void RandomiseArmorDurabilityValues(
|
||||
List<Item> armorWithMods,
|
||||
double currentMultiplier,
|
||||
@@ -872,12 +870,12 @@ public class RagfairOfferGenerator(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add missing conditions to an item if needed
|
||||
* Durabiltiy for repairable items
|
||||
* HpResource for medical items
|
||||
* @param item item to add conditions to
|
||||
*/
|
||||
/// <summary>
|
||||
/// Add missing conditions to an item if needed. <br/>
|
||||
/// Durabiltiy for repairable items. <br/>
|
||||
/// HpResource for medical items.
|
||||
/// </summary>
|
||||
/// <param name="item"> Item to add conditions to </param>
|
||||
protected void AddMissingConditions(Item item)
|
||||
{
|
||||
var props = itemHelper.GetItem(item.Template).Value.Properties;
|
||||
@@ -938,12 +936,12 @@ public class RagfairOfferGenerator(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based
|
||||
* @param offerItems Items for sale in offer
|
||||
* @param barterConfig Barter config from ragfairConfig.Dynamic.barter
|
||||
* @returns Barter scheme
|
||||
*/
|
||||
/// <summary>
|
||||
/// Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based
|
||||
/// </summary>
|
||||
/// <param name="offerItems"> Items for sale in offer </param>
|
||||
/// <param name="barterConfig"> Barter config from ragfairConfig.Dynamic.barter </param>
|
||||
/// <returns> Barter scheme </returns>
|
||||
protected List<BarterScheme> CreateBarterBarterScheme(List<Item> offerItems, BarterDetails barterConfig)
|
||||
{
|
||||
// Get flea price of item being sold
|
||||
@@ -981,7 +979,7 @@ public class RagfairOfferGenerator(
|
||||
!string.Equals(itemAndPrice.Tpl, offerItems[0].Template,
|
||||
StringComparison.OrdinalIgnoreCase) // Don't allow the item being sold to be chosen
|
||||
);
|
||||
|
||||
|
||||
|
||||
// No items on flea have a matching price, fall back to currency
|
||||
if (!itemsInsidePriceBounds.Any())
|
||||
@@ -1002,10 +1000,10 @@ public class RagfairOfferGenerator(
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array of flea prices + item tpl, cached in generator class inside `allowedFleaPriceItemsForBarter`
|
||||
* @returns array with tpl/price values
|
||||
*/
|
||||
/// <summary>
|
||||
/// Get an array of flea prices + item tpl, cached in generator class inside `allowedFleaPriceItemsForBarter`
|
||||
/// </summary>
|
||||
/// <returns> List with tpl/price values </returns>
|
||||
protected List<TplWithFleaPrice> GetFleaPricesAsArray()
|
||||
{
|
||||
// Generate if needed
|
||||
@@ -1031,13 +1029,13 @@ public class RagfairOfferGenerator(
|
||||
return allowedFleaPriceItemsForBarter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a random currency-based barter scheme for an array of items
|
||||
* @param offerWithChildren Items on offer
|
||||
* @param isPackOffer Is the barter scheme being created for a pack offer
|
||||
* @param multiplier What to multiply the resulting price by
|
||||
* @returns Barter scheme for offer
|
||||
*/
|
||||
/// <summary>
|
||||
/// Create a random currency-based barter scheme for an array of items
|
||||
/// </summary>
|
||||
/// <param name="offerWithChildren"> Items on offer </param>
|
||||
/// <param name="isPackOffer"> Is the barter scheme being created for a pack offer </param>
|
||||
/// <param name="multiplier"> What to multiply the resulting price by </param>
|
||||
/// <returns> Barter scheme for offer </returns>
|
||||
protected List<BarterScheme> CreateCurrencyBarterScheme(
|
||||
List<Item> offerWithChildren,
|
||||
bool isPackOffer,
|
||||
|
||||
@@ -382,13 +382,13 @@ public class RepeatableQuestGenerator(
|
||||
return quest;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a number of kills needed to complete elimination quest
|
||||
* @param targetKey Target type desired e.g. anyPmc/bossBully/Savage
|
||||
* @param targetsConfig Config
|
||||
* @param eliminationConfig Config
|
||||
* @returns Number of AI to kill
|
||||
*/
|
||||
/// <summary>
|
||||
/// Get a number of kills needed to complete elimination quest
|
||||
/// </summary>
|
||||
/// <param name="targetKey"> Target type desired e.g. anyPmc/bossBully/Savage </param>
|
||||
/// <param name="targetsConfig"> Config of the target </param>
|
||||
/// <param name="eliminationConfig"> Config of the elimination </param>
|
||||
/// <returns> Number of AI to kill </returns>
|
||||
protected int GetEliminationKillCount(
|
||||
string targetKey,
|
||||
ProbabilityObjectArray<string, BossInfo> targetsConfig,
|
||||
|
||||
@@ -34,30 +34,30 @@ public class RepeatableQuestRewardGenerator(
|
||||
{
|
||||
protected QuestConfig _questConfig = _configServer.GetConfig<QuestConfig>();
|
||||
|
||||
/**
|
||||
* Generate the reward for a mission. A reward can consist of:
|
||||
* - Experience
|
||||
* - Money
|
||||
* - GP coins
|
||||
* - Weapon preset
|
||||
* - Items
|
||||
* - Trader Reputation
|
||||
* - Skill level experience
|
||||
*
|
||||
* The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to
|
||||
* experience / money / items / trader reputation can be defined in QuestConfig.js
|
||||
*
|
||||
* There's also a random variation of the reward the spread of which can be also defined in the config
|
||||
*
|
||||
* Additionally, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used
|
||||
* @param pmcLevel Level of player reward is being generated for
|
||||
* @param difficulty Reward scaling factor from 0.2 to 1
|
||||
* @param traderId Trader reward will be given by
|
||||
* @param repeatableConfig Config for quest type (daily, weekly)
|
||||
* @param questConfig
|
||||
* @param rewardTplBlacklist OPTIONAL: list of tpls to NOT use when picking a reward
|
||||
* @returns IQuestRewards
|
||||
*/
|
||||
/// <summary>
|
||||
/// Generate the reward for a mission. A reward can consist of: <br/>
|
||||
/// - Experience <br/>
|
||||
/// - Money <br/>
|
||||
/// - GP coins <br/>
|
||||
/// - Weapon preset <br/>
|
||||
/// - Items <br/>
|
||||
/// - Trader Reputation <br/>
|
||||
/// - Skill level experience <br/>
|
||||
/// <br/>
|
||||
/// The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to <br/>
|
||||
/// experience / money / items / trader reputation can be defined in QuestConfig.js <br/>
|
||||
/// <br/>
|
||||
/// There's also a random variation of the reward the spread of which can be also defined in the config <br/>
|
||||
/// <br/>
|
||||
/// Additionally, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used
|
||||
/// </summary>
|
||||
/// <param name="pmcLevel"> Level of player reward is being generated for </param>
|
||||
/// <param name="difficulty"> Reward scaling factor from 0.2 to 1 </param>
|
||||
/// <param name="traderId"> Trader reward will be given by </param>
|
||||
/// <param name="repeatableConfig"> Config for quest type (daily, weekly) </param>
|
||||
/// <param name="eliminationConfig"> Base Quest config</param>
|
||||
/// <param name="rewardTplBlacklist"> Optional: list of tpls to NOT use when picking a reward </param>
|
||||
/// <returns> QuestRewards </returns>
|
||||
public QuestRewards GenerateReward(
|
||||
int pmcLevel,
|
||||
double difficulty,
|
||||
@@ -318,6 +318,14 @@ public class RepeatableQuestRewardGenerator(
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get an array of items + stack size to give to player as reward that fit inside a rouble budget.
|
||||
/// </summary>
|
||||
/// <param name="itemPool"> All possible items to choose rewards from </param>
|
||||
/// <param name="maxItemCount"> Total number of items to reward </param>
|
||||
/// <param name="itemRewardBudget"> Rouble budget all item rewards must fit in </param>
|
||||
/// <param name="repeatableConfig"> Config for quest type </param>
|
||||
/// <returns> Dictionary of items and stack size</returns>
|
||||
protected Dictionary<TemplateItem, int> GetRewardableItemsFromPoolWithinBudget(List<TemplateItem> itemPool,
|
||||
int maxItemCount, double itemRewardBudget, RepeatableQuestConfig repeatableConfig)
|
||||
{
|
||||
@@ -396,14 +404,14 @@ public class RepeatableQuestRewardGenerator(
|
||||
return itemsToReturn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a count of cartridges that fits the rouble budget amount provided
|
||||
* e.g. how many M80s for 50,000 roubles
|
||||
* @param itemSelected Cartridge
|
||||
* @param roublesBudget Rouble budget
|
||||
* @param rewardNumItems
|
||||
* @returns Count that fits budget (min 1)
|
||||
*/
|
||||
/// <summary>
|
||||
/// Get a count of cartridges that fits the rouble budget amount provided.<br/>
|
||||
/// e.g. how many M80s for 50,000 roubles.
|
||||
/// </summary>
|
||||
/// <param name="itemSelected"> Cartridge template </param>
|
||||
/// <param name="roublesBudget"> Rouble budget </param>
|
||||
/// <param name="rewardNumItems"> Count of rewarded items </param>
|
||||
/// <returns> Count that fits budget (min 1) </returns>
|
||||
protected int CalculateAmmoStackSizeThatFitsBudget(TemplateItem itemSelected, double roublesBudget,
|
||||
int rewardNumItems)
|
||||
{
|
||||
@@ -440,11 +448,11 @@ public class RepeatableQuestRewardGenerator(
|
||||
return isEligibleForStackSizeIncrease && _randomUtil.GetChance100(randomChanceToPass);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a randomised number a reward items stack size should be based on its handbook price
|
||||
* @param item Reward item to get stack size for
|
||||
* @returns matching stack size for the passed in items price
|
||||
*/
|
||||
/// <summary>
|
||||
/// Get a randomised number a reward items stack size should be based on its handbook price
|
||||
/// </summary>
|
||||
/// <param name="item"> Reward item to get stack size for </param>
|
||||
/// <returns> Matching stack size for the passed in items price </returns>
|
||||
protected int GetRandomisedRewardItemStackSizeByPrice(TemplateItem item)
|
||||
{
|
||||
var rewardItemPrice = _presetHelper.GetDefaultPresetOrItemPrice(item.Id);
|
||||
@@ -467,13 +475,13 @@ public class RepeatableQuestRewardGenerator(
|
||||
return _randomUtil.GetArrayValue(tier.Item2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Select a number of items that have a collective value of the passed in parameter
|
||||
* @param repeatableConfig Config
|
||||
* @param roublesBudget Total value of items to return
|
||||
* @param traderId Id of the trader who will give player reward
|
||||
* @returns Array of reward items that fit budget
|
||||
*/
|
||||
/// <summary>
|
||||
/// Select a number of items that have a collective value of the passed in parameter
|
||||
/// </summary>
|
||||
/// <param name="repeatableConfig"> Config </param>
|
||||
/// <param name="roublesBudget"> Total value of items to return </param>
|
||||
/// <param name="traderId"> ID of the trader who will give player reward </param>
|
||||
/// <returns> List of reward items that fit budget </returns>
|
||||
protected List<TemplateItem> ChooseRewardItemsWithinBudget(RepeatableQuestConfig repeatableConfig,
|
||||
double? roublesBudget, string traderId)
|
||||
{
|
||||
@@ -509,12 +517,13 @@ public class RepeatableQuestRewardGenerator(
|
||||
return rewardableItemPoolWithinBudget;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param rewardItems List of reward items to filter
|
||||
* @param roublesBudget The budget remaining for rewards
|
||||
* @param minPrice The minimum priced item to include
|
||||
* @returns True if any items remain in `rewardItems`, false otherwise
|
||||
*/
|
||||
/// <summary>
|
||||
/// Filters a list of reward Items within a budget.
|
||||
/// </summary>
|
||||
/// <param name="rewardItems"> List of reward items to filter </param>
|
||||
/// <param name="roublesBudget"> The budget remaining for rewards </param>
|
||||
/// <param name="minPrice"> The minimum priced item to include </param>
|
||||
/// <returns> List of Items </returns>
|
||||
protected List<TemplateItem> FilterRewardPoolWithinBudget(List<TemplateItem> rewardItems, double roublesBudget,
|
||||
double minPrice)
|
||||
{
|
||||
@@ -528,6 +537,12 @@ public class RepeatableQuestRewardGenerator(
|
||||
.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Choose a random Weapon preset that fits inside a rouble amount limit
|
||||
/// </summary>
|
||||
/// <param name="roublesBudget"> Budget in roubles </param>
|
||||
/// <param name="rewardIndex"> Index of the reward </param>
|
||||
/// <returns> Dictionary of the reward and it's price, can return null. </returns>
|
||||
protected KeyValuePair<Reward, double>? GetRandomWeaponPresetWithinBudget(double roublesBudget, int rewardIndex)
|
||||
{
|
||||
// Add a random default preset weapon as reward
|
||||
@@ -565,15 +580,15 @@ public class RepeatableQuestRewardGenerator(
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to create a reward item structured as required by the client
|
||||
*
|
||||
* @param {string} tpl ItemId of the rewarded item
|
||||
* @param {integer} count Amount of items to give
|
||||
* @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index
|
||||
* @param preset Optional array of preset items
|
||||
* @returns {object} Object of "Reward"-item-type
|
||||
*/
|
||||
/// <summary>
|
||||
/// Helper to create a reward item structured as required by the client
|
||||
/// </summary>
|
||||
/// <param name="tpl"> ItemId of the rewarded item </param>
|
||||
/// <param name="count"> Amount of items to give </param>
|
||||
/// <param name="index"> All rewards will be appended to a list, for unknown reasons the client wants the index </param>
|
||||
/// <param name="preset"> Optional list of preset items </param>
|
||||
/// <param name="foundInRaid"> If generated Item is found in raid, default True </param>
|
||||
/// <returns> Object of "Reward"-item-type </returns>
|
||||
protected Reward GeneratePresetReward(string tpl, int count, int index, List<Item>? preset, bool foundInRaid = true)
|
||||
{
|
||||
var id = _hashUtil.Generate();
|
||||
@@ -610,15 +625,14 @@ public class RepeatableQuestRewardGenerator(
|
||||
return questRewardItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to create a reward item structured as required by the client
|
||||
*
|
||||
* @param {string} tpl ItemId of the rewarded item
|
||||
* @param {integer} count Amount of items to give
|
||||
* @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index
|
||||
* @param preset Optional array of preset items
|
||||
* @returns {object} Object of "Reward"-item-type
|
||||
*/
|
||||
/// <summary>
|
||||
/// Helper to create a reward item structured as required by the client
|
||||
/// </summary>
|
||||
/// <param name="tpl"> ItemId of the rewarded item </param>
|
||||
/// <param name="count"> Amount of items to give</param>
|
||||
/// <param name="index"> All rewards will be appended to a list, for unknown reasons the client wants the index</param>
|
||||
/// <param name="foundInRaid"> If generated Item is found in raid, default True </param>
|
||||
/// <returns> Object of "Reward"-item-type </returns>
|
||||
protected Reward GenerateItemReward(string tpl, double count, int index, bool foundInRaid = true)
|
||||
{
|
||||
var id = _hashUtil.Generate();
|
||||
@@ -667,16 +681,16 @@ public class RepeatableQuestRewardGenerator(
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Picks rewardable items from items.json
|
||||
* This means they must:
|
||||
* - Fit into the inventory
|
||||
* - Shouldn't be keys
|
||||
* - Have a price greater than 0
|
||||
* @param repeatableQuestConfig Config file
|
||||
* @param traderId Id of trader who will give reward to player
|
||||
* @returns List of rewardable items [[_tpl, itemTemplate],...]
|
||||
*/
|
||||
/// <summary>
|
||||
/// Picks rewardable items from items.json <br/>
|
||||
/// This means they must: <br/>
|
||||
/// - Fit into the inventory <br/>
|
||||
/// - Shouldn't be keys <br/>
|
||||
/// - Have a price greater than 0
|
||||
/// </summary>
|
||||
/// <param name="repeatableQuestConfig"> Config </param>
|
||||
/// <param name="tradderId"> ID of trader who will give reward to player </param>
|
||||
/// <returns> List of rewardable items [[_tpl, itemTemplate],...] </returns>
|
||||
public List<TemplateItem> GetRewardableItems(RepeatableQuestConfig repeatableQuestConfig, string traderId)
|
||||
{
|
||||
// Get an array of seasonal items that should not be shown right now as seasonal event is not active
|
||||
@@ -714,12 +728,14 @@ public class RepeatableQuestRewardGenerator(
|
||||
.ToList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if an id is a valid item. Valid meaning that it's an item that may be a reward
|
||||
* or content of bot loot. Items that are tested as valid may be in a player backpack or stash.
|
||||
* @param {string} tpl template id of item to check
|
||||
* @returns True if item is valid reward
|
||||
*/
|
||||
/// <summary>
|
||||
/// Checks if an id is a valid item. Valid meaning that it's an item that may be a reward
|
||||
/// or content of bot loot. Items that are tested as valid may be in a player backpack or stash.
|
||||
/// </summary>
|
||||
/// <param name="tpl"> Template id of item to check</param>
|
||||
/// <param name="repeatableQuestConfig"> Config </param>
|
||||
/// <param name="itemBaseWhitelist"> Default null, specific trader item base classes</param>
|
||||
/// <returns> True if item is valid reward </returns>
|
||||
protected bool IsValidRewardItem(string tpl, RepeatableQuestConfig repeatableQuestConfig,
|
||||
List<string>? itemBaseWhitelist = null)
|
||||
{
|
||||
|
||||
@@ -87,10 +87,10 @@ public class ScavCaseRewardGenerator(
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get all db items that are not blacklisted in scavcase config or global blacklist
|
||||
/// Store in class field
|
||||
/// </summary>
|
||||
protected void CacheDbItems()
|
||||
/// Get all db items that are not blacklisted in scavcase config or global blacklist
|
||||
/// Store in class field
|
||||
/// </summary>
|
||||
protected void CacheDbItems()
|
||||
{
|
||||
// Get an array of seasonal items that should not be shown right now as seasonal event is not active
|
||||
var inactiveSeasonalItems = _seasonalEventService.GetInactiveSeasonalEventItems();
|
||||
@@ -328,14 +328,14 @@ public class ScavCaseRewardGenerator(
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Take all the rewards picked create the Product object array ready to return to calling code
|
||||
/// Take all the rewards picked create the Product object array ready to return to calling code.
|
||||
/// Also add a stack count to ammo and money
|
||||
/// </summary>
|
||||
/// <param name="rewardItems">items to convert</param>
|
||||
/// <returns>Product array</returns>
|
||||
protected List<List<Item>> RandomiseContainerItemRewards(List<TemplateItem> rewardItems, string rarity)
|
||||
{
|
||||
/** Each array is an item + children */
|
||||
// Each array is an item + children
|
||||
List<List<Item>> result = [];
|
||||
foreach (var rewardItemDb in rewardItems)
|
||||
{
|
||||
@@ -461,7 +461,11 @@ public class ScavCaseRewardGenerator(
|
||||
_ => 1
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Randomises the size of ammo stacks
|
||||
/// </summary>
|
||||
/// <param name="itemToCalculate">ammo or money item</param>
|
||||
/// <returns>value to set stack count to</returns>
|
||||
protected int GetRandomisedAmmoRewardStackSize(TemplateItem itemToCalculate)
|
||||
{
|
||||
return _randomUtil.GetInt(
|
||||
@@ -469,7 +473,12 @@ public class ScavCaseRewardGenerator(
|
||||
itemToCalculate.Properties.StackMaxSize ?? 0
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Randomises the size of money stacks
|
||||
/// </summary>
|
||||
/// <param name="itemToCalculate">ammo or money item</param>
|
||||
/// <param name="rarity">rarity (common/rare/superrare)</param>
|
||||
/// <returns>value to set stack count to</returns>
|
||||
protected int GetRandomisedMoneyRewardStackSize(TemplateItem itemToCalculate, string rarity)
|
||||
{
|
||||
return itemToCalculate.Id switch
|
||||
|
||||
@@ -158,7 +158,12 @@ public class ExternalInventoryMagGen(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a random compatible external magazine for a weapon, exclude internal magazines from possible pool
|
||||
/// </summary>
|
||||
/// <param name="weaponTpl"> Weapon to get mag for </param>
|
||||
/// <param name="magazineBlacklist"> Blacklisted magazines </param>
|
||||
/// <returns> Item of chosen magazine </returns>
|
||||
public TemplateItem? GetRandomExternalMagazineForInternalMagazineGun(string weaponTpl, List<string> magazineBlacklist)
|
||||
{
|
||||
// The mag Slot data for the weapon
|
||||
|
||||
@@ -21,11 +21,11 @@ public class WeatherGenerator(
|
||||
{
|
||||
protected WeatherConfig _weatherConfig = _configServer.GetConfig<WeatherConfig>();
|
||||
|
||||
/**
|
||||
* Get current + raid datetime and format into correct BSG format and return
|
||||
* @param data Weather data
|
||||
* @returns WeatherData
|
||||
*/
|
||||
/// <summary>
|
||||
/// Get current + raid datetime and format into correct BSG format.
|
||||
/// </summary>
|
||||
/// <param name="data"> Weather data </param>
|
||||
/// <returns> WeatherData </returns>
|
||||
public void CalculateGameTime(WeatherData data)
|
||||
{
|
||||
var computedDate = _timeUtil.GetDateTimeNow();
|
||||
@@ -38,12 +38,11 @@ public class WeatherGenerator(
|
||||
data.Season = _seasonalEventService.GetActiveWeatherSeason();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get server uptime seconds multiplied by a multiplier and add to current time as seconds
|
||||
* Format to BSGs requirements
|
||||
* @param currentDate current date
|
||||
* @returns formatted time
|
||||
*/
|
||||
/// <summary>
|
||||
/// Get server uptime seconds multiplied by a multiplier and add to current time as seconds.
|
||||
/// Formatted to BSGs requirements
|
||||
/// </summary>
|
||||
/// <returns>Formatted time as String </returns>
|
||||
protected string GetBsgFormattedInRaidTime()
|
||||
{
|
||||
var clientAcceleratedDate = _weatherHelper.GetInRaidTime();
|
||||
@@ -51,22 +50,22 @@ public class WeatherGenerator(
|
||||
return GetBsgFormattedTime(clientAcceleratedDate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current time formatted to fit BSGs requirement
|
||||
* @param date date to format into bsg style
|
||||
* @returns Time formatted in BSG format
|
||||
*/
|
||||
/// <summary>
|
||||
/// Get current time formatted to fit BSGs requirement
|
||||
/// </summary>
|
||||
/// <param name="date"> Date to format into bsg style </param>
|
||||
/// <returns> Time formatted in BSG format </returns>
|
||||
protected string GetBsgFormattedTime(DateTime date)
|
||||
{
|
||||
return _timeUtil.FormatTime(date).Replace("-", ":").Replace("-", ":");
|
||||
}
|
||||
|
||||
/**
|
||||
* Return randomised Weather data with help of config/weather.json
|
||||
* @param currentSeason the currently active season
|
||||
* @param timestamp OPTIONAL what timestamp to generate the weather data at, defaults to now when not supplied
|
||||
* @returns Randomised weather data
|
||||
*/
|
||||
/// <summary>
|
||||
/// Return randomised Weather data with help of config/weather.json
|
||||
/// </summary>
|
||||
/// <param name="currentSeason"> The currently active season </param>
|
||||
/// <param name="timestamp"> Optional, what timestamp to generate the weather data at, defaults to now when not supplied </param>
|
||||
/// <returns> Randomised weather data </returns>
|
||||
public Weather GenerateWeather(Season currentSeason, long? timestamp = null)
|
||||
{
|
||||
var weatherValues = GetWeatherValuesBySeason(currentSeason);
|
||||
@@ -112,12 +111,12 @@ public class WeatherGenerator(
|
||||
return value!;
|
||||
}
|
||||
|
||||
/**
|
||||
* Choose a temprature for the raid based on time of day
|
||||
* @param currentSeason What season tarkov is currently in
|
||||
* @param inRaidTimestamp What time is the raid running at
|
||||
* @returns Timestamp
|
||||
*/
|
||||
/// <summary>
|
||||
/// Choose a temperature for the raid based on time of day
|
||||
/// </summary>
|
||||
/// <param name="weather"> What season Tarkov is currently in </param>
|
||||
/// <param name="inRaidTimestamp"> What time is the raid running at </param>
|
||||
/// <returns> Timestamp </returns>
|
||||
protected double GetRaidTemperature(SeasonalValues weather, long inRaidTimestamp)
|
||||
{
|
||||
// Convert timestamp to date so we can get current hour and check if its day or night
|
||||
@@ -129,11 +128,11 @@ public class WeatherGenerator(
|
||||
return Math.Round(_randomUtil.GetDouble(minMax.Min, minMax.Max), 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Weather date/time/timestamp values to now
|
||||
* @param weather Object to update
|
||||
* @param timestamp OPTIONAL, define timestamp used
|
||||
*/
|
||||
/// <summary>
|
||||
/// Set Weather date/time/timestamp values to now
|
||||
/// </summary>
|
||||
/// <param name="weather"> Object to update </param>
|
||||
/// <param name="timestamp"> Optional, timestamp used </param>
|
||||
protected void SetCurrentDateTime(Weather weather, long? timestamp = null)
|
||||
{
|
||||
var inRaidTime = _weatherHelper.GetInRaidTime(timestamp);
|
||||
|
||||
Reference in New Issue
Block a user