diff --git a/Libraries/Core/Generators/BotLootGenerator.cs b/Libraries/Core/Generators/BotLootGenerator.cs index a2f7d7c7..8f827cef 100644 --- a/Libraries/Core/Generators/BotLootGenerator.cs +++ b/Libraries/Core/Generators/BotLootGenerator.cs @@ -365,9 +365,10 @@ public class BotLootGenerator( } /// + /// Get an array of the containers a bot has on them (pockets/backpack/vest) /// - /// - /// + /// Bot to check + /// Array of available slots protected HashSet GetAvailableContainersBotCanStoreItemsIn(BotBaseInventory botInventory) { HashSet result = [EquipmentSlots.Pockets]; @@ -594,9 +595,10 @@ public class BotLootGenerator( } /// + /// Adds loot to the specified Wallet /// - /// - /// + /// Wallet to add loot to + /// Generated list of currency stacks with the wallet as their parent public List> CreateWalletLoot(string walletId) { List> result = []; diff --git a/Libraries/Core/Generators/FenceBaseAssortGenerator.cs b/Libraries/Core/Generators/FenceBaseAssortGenerator.cs index ec6fa9eb..cc7ad362 100644 --- a/Libraries/Core/Generators/FenceBaseAssortGenerator.cs +++ b/Libraries/Core/Generators/FenceBaseAssortGenerator.cs @@ -29,9 +29,9 @@ public class FenceBaseAssortGenerator( { protected TraderConfig traderConfig = configServer.GetConfig(); - /** - * Create base fence assorts dynamically and store in memory - */ + /// + /// Create base fence assorts dynamically and store in memory + /// 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 - */ + /// + /// Check ammo in boxes + loose ammos has a penetration value above the configured value in trader.json / ammoMaxPenLimit + /// + /// Ammo box or ammo item from items.db + /// True if penetration value is above limit set in config 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 - */ + /// + /// Get the penetration power value of an ammo, works with ammo boxes and raw ammos + /// + /// Ammo box or ammo item from items.db + /// Penetration power of passed in item, undefined if it doesnt have a power 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 - */ + /// + /// Add soft inserts + armor plates to an armor + /// + /// Armor item array to add mods into + /// Armor items db template protected void AddChildrenToArmorModSlots(List 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 - */ + /// + /// Check if item is valid for being added to fence assorts + /// + /// Item to check + /// True if valid fence item protected bool IsValidFenceItem(TemplateItem item) { return string.Equals(item.Type, "Item", StringComparison.OrdinalIgnoreCase); diff --git a/Libraries/Core/Generators/LocationLootGenerator.cs b/Libraries/Core/Generators/LocationLootGenerator.cs index a6193699..0530465b 100644 --- a/Libraries/Core/Generators/LocationLootGenerator.cs +++ b/Libraries/Core/Generators/LocationLootGenerator.cs @@ -977,7 +977,13 @@ public class LocationLootGenerator( } } } - + /// + /// Create array of item (with child items) and return + /// + /// Key we want to look up items for + /// Location loot Template + /// Ammo distributions + /// ContainerItem object protected ContainerItem CreateDynamicLootItem(string? chosenComposedKey, List items, Dictionary> staticAmmoDist) { var chosenItem = items.FirstOrDefault(item => item.Id == chosenComposedKey); diff --git a/Libraries/Core/Generators/PmcWaveGenerator.cs b/Libraries/Core/Generators/PmcWaveGenerator.cs index 2389e9e9..4091c0bd 100644 --- a/Libraries/Core/Generators/PmcWaveGenerator.cs +++ b/Libraries/Core/Generators/PmcWaveGenerator.cs @@ -30,21 +30,29 @@ namespace Core.Generators this._configServer = _configServer; _pmcConfig = _configServer.GetConfig(); } - + /// + /// Add a pmc wave to a map + /// + /// e.g. factory4_day, bigmap + /// Boss wave to add to map 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 - */ + /// + /// Add custom boss and normal waves to all maps found in config/location.json to db + /// public void ApplyWaveChangesToAllMaps() { foreach (var location in _pmcConfig.CustomPmcWaves) { ApplyWaveChangesToMapByName(location.Key); } } + /// + /// Add custom boss and normal waves to a map found in config/location.json to db by name + /// + /// e.g. factory4_day, bigmap 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); } - + /// + /// Add custom boss and normal waves to a map found in config/location.json to db by LocationBase + /// + /// Location Object public void ApplyWaveChangesToMap(LocationBase location) { if (!_pmcConfig.CustomPmcWaves.TryGetValue(location.Id.ToLower(), out var pmcWavesToAdd)) { diff --git a/Libraries/Core/Generators/RagfairAssortGenerator.cs b/Libraries/Core/Generators/RagfairAssortGenerator.cs index f8d49854..588247f8 100644 --- a/Libraries/Core/Generators/RagfairAssortGenerator.cs +++ b/Libraries/Core/Generators/RagfairAssortGenerator.cs @@ -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 - */ + /// + /// Get a list of lists that can be sold on the flea.
+ /// Each sub list contains item + children (if any) + ///
+ /// List with children lists of items public List> GetAssortItems() { if (!AssortsAreGenerated()) @@ -50,19 +50,19 @@ public class RagfairAssortGenerator( return generatedAssortItems; } - /** - * Check internal generatedAssortItems array has objects - * @returns true if array has objects - */ + /// + /// Check if internal generatedAssortItems list has objects + /// + /// True if array has objects protected bool AssortsAreGenerated() { return generatedAssortItems.Count > 0; } - /** - * Generate an array of arrays (item + children) the flea can sell - * @returns array of arrays (item + children) - */ + /// + /// Generate a list of lists (item + children) the flea can sell + /// + /// List of lists (item + children) protected List> GenerateRagfairAssortItems() { List> 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 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 - */ + /// + /// Get presets from globals to add to flea.
+ /// ragfairConfig.dynamic.showDefaultPresetsOnly decides if it's all presets or just defaults + ///
+ /// List of Preset protected List 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 - */ + /// + /// Create a base assort item and return it with populated values + 999999 stack count + unlimited count = true + /// + /// tplid to add to item + /// id to add to item + /// Hydrated Item object protected Item CreateRagfairAssortRootItem(string tplId, string? id = null) { if (string.IsNullOrEmpty(id)) diff --git a/Libraries/Core/Generators/RagfairOfferGenerator.cs b/Libraries/Core/Generators/RagfairOfferGenerator.cs index 338867da..652af786 100644 --- a/Libraries/Core/Generators/RagfairOfferGenerator.cs +++ b/Libraries/Core/Generators/RagfairOfferGenerator.cs @@ -42,9 +42,7 @@ public class RagfairOfferGenerator( protected List? allowedFleaPriceItemsForBarter; protected BotConfig botConfig = configServer.GetConfig(); - /** - * 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(); @@ -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 - */ + /// + /// Calculate the offer price that's listed on the flea listing + /// + /// barter requirements for offer + /// rouble cost of offer protected double ConvertOfferRequirementsIntoRoubles(IEnumerable 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 - */ + /// + /// Get avatar url from trader table in db + /// + /// Is user we're getting avatar for a trader + /// Persons id to get avatar of + /// Url of avatar as String 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 - */ + /// + /// Convert a count of currency into roubles + /// + /// Amount of currency to convert into roubles + /// Type of currency (euro/dollar/rouble) + /// Count of roubles 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 - */ + /// + /// Check userId, if it's a player, return their pmc _id, otherwise return userId parameter + /// + /// Users ID to check + /// Users ID 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 - */ + /// + /// Get a flea trading rating for the passed in user + /// + /// User to get flea rating of + /// Flea rating value 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 - */ + /// + /// Is the offers user rating growing + /// + /// User to check rating of + /// True if growing 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 - */ + /// + /// Get number of section until offer should expire + /// + /// ID of the offer owner + /// Time the offer is posted in seconds + /// Number of seconds until offer expires 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 - */ + /// + /// Create multiple offers for items by using a unique list of items we've generated previously + /// + /// Optional, expired offers to regenerate public void GenerateDynamicOffers(List>? 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 - */ + /// + /// Generates offers from an item and it's children on the flea market + /// + /// Item with its children to process into offers + /// Is an expired offer + /// Ragfair dynamic config protected void CreateOffersFromAssort( List 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 - */ + /// + /// Iterate over an items children and look for plates above desired level and remove them + /// + /// Preset to check for plates + /// Settings + /// True if plates removed protected bool RemoveBannedPlatesFromPreset( List 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 - */ + /// + /// Create one flea offer for a specific item + /// + /// ID of seller + /// Item to create offer for + /// Is item a weapon preset + /// Raw DB item details protected void CreateSingleOfferForItem( string sellerId, List 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 - */ + /// + /// Generate trader offers on flea using the traders assort data + /// + /// Trader to generate offers for 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 - */ + /// + /// 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 + ///
+ /// ID of owner of item + /// Item and mods, get condition of first item (only first array item is modified) + /// DB details of first item protected void RandomiseOfferItemUpdProperties(string userID, List 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 - */ + /// + /// Get the relevant condition id if item tpl matches in ragfair.json/condition + /// + /// Item to look for matching condition object + /// Condition ID 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 - */ + /// + /// Alter an items condition based on its item base type + /// + /// Also the parentID of item being altered + /// Item to adjust condition details of + /// DB Item details of first item in list protected void RandomiseItemCondition( string conditionSettingsId, List 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 - */ + /// + /// Adjust an items durability/maxDurability value + /// + /// Item (weapon/armor) to adjust + /// Item details from DB + /// Value to multiply max durability by + /// Value to multiply current durability by 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 - */ + /// + /// Randomise the durability values for an armors plates and soft inserts + /// + /// Armor item with its child mods + /// Chosen multiplier to use for current durability value + /// Chosen multiplier to use for max durability value protected void RandomiseArmorDurabilityValues( List 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 - */ + /// + /// Add missing conditions to an item if needed.
+ /// Durabiltiy for repairable items.
+ /// HpResource for medical items. + ///
+ /// Item to add conditions to 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 - */ + /// + /// Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based + /// + /// Items for sale in offer + /// Barter config from ragfairConfig.Dynamic.barter + /// Barter scheme protected List CreateBarterBarterScheme(List 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 - */ + /// + /// Get an array of flea prices + item tpl, cached in generator class inside `allowedFleaPriceItemsForBarter` + /// + /// List with tpl/price values protected List 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 - */ + /// + /// Create a random currency-based barter scheme for an array of items + /// + /// Items on offer + /// Is the barter scheme being created for a pack offer + /// What to multiply the resulting price by + /// Barter scheme for offer protected List CreateCurrencyBarterScheme( List offerWithChildren, bool isPackOffer, diff --git a/Libraries/Core/Generators/RepeatableQuestGenerator.cs b/Libraries/Core/Generators/RepeatableQuestGenerator.cs index 169e37eb..5f5c33e3 100644 --- a/Libraries/Core/Generators/RepeatableQuestGenerator.cs +++ b/Libraries/Core/Generators/RepeatableQuestGenerator.cs @@ -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 - */ + /// + /// Get a number of kills needed to complete elimination quest + /// + /// Target type desired e.g. anyPmc/bossBully/Savage + /// Config of the target + /// Config of the elimination + /// Number of AI to kill protected int GetEliminationKillCount( string targetKey, ProbabilityObjectArray targetsConfig, diff --git a/Libraries/Core/Generators/RepeatableQuestRewardGenerator.cs b/Libraries/Core/Generators/RepeatableQuestRewardGenerator.cs index 31c15ecc..d27de4f5 100644 --- a/Libraries/Core/Generators/RepeatableQuestRewardGenerator.cs +++ b/Libraries/Core/Generators/RepeatableQuestRewardGenerator.cs @@ -34,30 +34,30 @@ public class RepeatableQuestRewardGenerator( { protected QuestConfig _questConfig = _configServer.GetConfig(); - /** - * 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 - */ + /// + /// 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 + ///
+ /// Level of player reward is being generated for + /// Reward scaling factor from 0.2 to 1 + /// Trader reward will be given by + /// Config for quest type (daily, weekly) + /// Base Quest config + /// Optional: list of tpls to NOT use when picking a reward + /// QuestRewards public QuestRewards GenerateReward( int pmcLevel, double difficulty, @@ -318,6 +318,14 @@ public class RepeatableQuestRewardGenerator( ); } + /// + /// Get an array of items + stack size to give to player as reward that fit inside a rouble budget. + /// + /// All possible items to choose rewards from + /// Total number of items to reward + /// Rouble budget all item rewards must fit in + /// Config for quest type + /// Dictionary of items and stack size protected Dictionary GetRewardableItemsFromPoolWithinBudget(List 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) - */ + /// + /// Get a count of cartridges that fits the rouble budget amount provided.
+ /// e.g. how many M80s for 50,000 roubles. + ///
+ /// Cartridge template + /// Rouble budget + /// Count of rewarded items + /// Count that fits budget (min 1) 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 - */ + /// + /// Get a randomised number a reward items stack size should be based on its handbook price + /// + /// Reward item to get stack size for + /// Matching stack size for the passed in items price 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 - */ + /// + /// Select a number of items that have a collective value of the passed in parameter + /// + /// Config + /// Total value of items to return + /// ID of the trader who will give player reward + /// List of reward items that fit budget protected List 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 - */ + /// + /// Filters a list of reward Items within a budget. + /// + /// List of reward items to filter + /// The budget remaining for rewards + /// The minimum priced item to include + /// List of Items protected List FilterRewardPoolWithinBudget(List rewardItems, double roublesBudget, double minPrice) { @@ -528,6 +537,12 @@ public class RepeatableQuestRewardGenerator( .ToList(); } + /// + /// Choose a random Weapon preset that fits inside a rouble amount limit + /// + /// Budget in roubles + /// Index of the reward + /// Dictionary of the reward and it's price, can return null. protected KeyValuePair? 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 - */ + /// + /// Helper to create a reward item structured as required by the client + /// + /// ItemId of the rewarded item + /// Amount of items to give + /// All rewards will be appended to a list, for unknown reasons the client wants the index + /// Optional list of preset items + /// If generated Item is found in raid, default True + /// Object of "Reward"-item-type protected Reward GeneratePresetReward(string tpl, int count, int index, List? 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 - */ + /// + /// Helper to create a reward item structured as required by the client + /// + /// ItemId of the rewarded item + /// Amount of items to give + /// All rewards will be appended to a list, for unknown reasons the client wants the index + /// If generated Item is found in raid, default True + /// Object of "Reward"-item-type 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],...] - */ + /// + /// Picks rewardable items from items.json
+ /// This means they must:
+ /// - Fit into the inventory
+ /// - Shouldn't be keys
+ /// - Have a price greater than 0 + ///
+ /// Config + /// ID of trader who will give reward to player + /// List of rewardable items [[_tpl, itemTemplate],...] public List 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 - */ + /// + /// 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. + /// + /// Template id of item to check + /// Config + /// Default null, specific trader item base classes + /// True if item is valid reward protected bool IsValidRewardItem(string tpl, RepeatableQuestConfig repeatableQuestConfig, List? itemBaseWhitelist = null) { diff --git a/Libraries/Core/Generators/ScavCaseRewardGenerator.cs b/Libraries/Core/Generators/ScavCaseRewardGenerator.cs index 173ebe31..71df30a6 100644 --- a/Libraries/Core/Generators/ScavCaseRewardGenerator.cs +++ b/Libraries/Core/Generators/ScavCaseRewardGenerator.cs @@ -87,10 +87,10 @@ public class ScavCaseRewardGenerator( } /// - /// Get all db items that are not blacklisted in scavcase config or global blacklist - /// Store in class field - /// - protected void CacheDbItems() + /// Get all db items that are not blacklisted in scavcase config or global blacklist + /// Store in class field + /// + 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( } /// - /// 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 /// /// items to convert /// Product array protected List> RandomiseContainerItemRewards(List rewardItems, string rarity) { - /** Each array is an item + children */ + // Each array is an item + children List> result = []; foreach (var rewardItemDb in rewardItems) { @@ -461,7 +461,11 @@ public class ScavCaseRewardGenerator( _ => 1 }; } - + /// + /// Randomises the size of ammo stacks + /// + /// ammo or money item + /// value to set stack count to protected int GetRandomisedAmmoRewardStackSize(TemplateItem itemToCalculate) { return _randomUtil.GetInt( @@ -469,7 +473,12 @@ public class ScavCaseRewardGenerator( itemToCalculate.Properties.StackMaxSize ?? 0 ); } - + /// + /// Randomises the size of money stacks + /// + /// ammo or money item + /// rarity (common/rare/superrare) + /// value to set stack count to protected int GetRandomisedMoneyRewardStackSize(TemplateItem itemToCalculate, string rarity) { return itemToCalculate.Id switch diff --git a/Libraries/Core/Generators/WeaponGen/Implementations/ExternalInventoryMagGen.cs b/Libraries/Core/Generators/WeaponGen/Implementations/ExternalInventoryMagGen.cs index 96ecff84..acc6c52d 100644 --- a/Libraries/Core/Generators/WeaponGen/Implementations/ExternalInventoryMagGen.cs +++ b/Libraries/Core/Generators/WeaponGen/Implementations/ExternalInventoryMagGen.cs @@ -158,7 +158,12 @@ public class ExternalInventoryMagGen( } } } - + /// + /// Get a random compatible external magazine for a weapon, exclude internal magazines from possible pool + /// + /// Weapon to get mag for + /// Blacklisted magazines + /// Item of chosen magazine public TemplateItem? GetRandomExternalMagazineForInternalMagazineGun(string weaponTpl, List magazineBlacklist) { // The mag Slot data for the weapon diff --git a/Libraries/Core/Generators/WeatherGenerator.cs b/Libraries/Core/Generators/WeatherGenerator.cs index 5c5241cd..8ef160be 100644 --- a/Libraries/Core/Generators/WeatherGenerator.cs +++ b/Libraries/Core/Generators/WeatherGenerator.cs @@ -21,11 +21,11 @@ public class WeatherGenerator( { protected WeatherConfig _weatherConfig = _configServer.GetConfig(); - /** - * Get current + raid datetime and format into correct BSG format and return - * @param data Weather data - * @returns WeatherData - */ + /// + /// Get current + raid datetime and format into correct BSG format. + /// + /// Weather data + /// WeatherData 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 - */ + /// + /// Get server uptime seconds multiplied by a multiplier and add to current time as seconds. + /// Formatted to BSGs requirements + /// + /// Formatted time as String 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 - */ + /// + /// Get current time formatted to fit BSGs requirement + /// + /// Date to format into bsg style + /// Time formatted in BSG format 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 - */ + /// + /// Return randomised Weather data with help of config/weather.json + /// + /// The currently active season + /// Optional, what timestamp to generate the weather data at, defaults to now when not supplied + /// Randomised weather data 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 - */ + /// + /// Choose a temperature for the raid based on time of day + /// + /// What season Tarkov is currently in + /// What time is the raid running at + /// Timestamp 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 - */ + /// + /// Set Weather date/time/timestamp values to now + /// + /// Object to update + /// Optional, timestamp used protected void SetCurrentDateTime(Weather weather, long? timestamp = null) { var inRaidTime = _weatherHelper.GetInRaidTime(timestamp);