From db4ae865e146ef779437359e8758b3466a0873fd Mon Sep 17 00:00:00 2001 From: Chomp Date: Sun, 23 Feb 2025 14:31:00 +0000 Subject: [PATCH] Updated `InsuranceController` methods to be protected instead of private --- .../Core/Controllers/InsuranceController.cs | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/Libraries/Core/Controllers/InsuranceController.cs b/Libraries/Core/Controllers/InsuranceController.cs index 1fa2d080..d0712638 100644 --- a/Libraries/Core/Controllers/InsuranceController.cs +++ b/Libraries/Core/Controllers/InsuranceController.cs @@ -85,7 +85,7 @@ public class InsuranceController( * @param time The time to check ready status against. Current time by default. * @returns All insured items that are ready to be processed. */ - private List FilterInsuredItems(string sessionId, long? time = null) + protected List FilterInsuredItems(string sessionId, long? time = null) { // Use the current time by default. var insuranceTime = time ?? _timeUtil.GetTimeStamp(); @@ -152,7 +152,7 @@ public class InsuranceController( * @param insurance * @returns */ - private double CountAllInsuranceItems(List insuranceDetails) + protected double CountAllInsuranceItems(List insuranceDetails) { return insuranceDetails.Select(ins => ins.Items.Count).Count(); } @@ -164,7 +164,7 @@ public class InsuranceController( * @param index The array index of the insurance package to remove. * @returns void */ - private void RemoveInsurancePackageFromProfile(string sessionId, Insurance insPackage) + protected void RemoveInsurancePackageFromProfile(string sessionId, Insurance insPackage) { var profile = _saveServer.GetProfile(sessionId); profile.InsuranceList = profile.InsuranceList.Where( @@ -189,7 +189,7 @@ public class InsuranceController( * @param insured - The insurance object containing the items to evaluate for deletion. * @returns A Set containing the IDs of items that should be deleted. */ - private HashSet FindItemsToDelete(string rootItemParentId, Insurance insured) + protected HashSet FindItemsToDelete(string rootItemParentId, Insurance insured) { var toDelete = new HashSet(); @@ -241,7 +241,7 @@ public class InsuranceController( * @param itemsMap - A Map object for quick item look-up by item ID. * @returns A Map object containing parent item IDs to arrays of their attachment items. */ - private Dictionary> PopulateParentAttachmentsMap(string rootItemParentID, Insurance insured, Dictionary itemsMap) + protected Dictionary> PopulateParentAttachmentsMap(string rootItemParentID, Insurance insured, Dictionary itemsMap) { var mainParentToAttachmentsMap = new Dictionary>(); foreach (var insuredItem in insured.Items) @@ -335,7 +335,7 @@ public class InsuranceController( * @param itemsMap - A Map object for quick item look-up by item ID. * @returns A Map object containing parent item IDs to arrays of their attachment items which are not moddable in-raid. */ - private Dictionary> RemoveNonModdableAttachments(Dictionary> parentAttachmentsMap, Dictionary itemsMap) + protected Dictionary> RemoveNonModdableAttachments(Dictionary> parentAttachmentsMap, Dictionary itemsMap) { var updatedMap = new Dictionary>(); @@ -385,7 +385,7 @@ public class InsuranceController( * @param parentAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items. * @returns void */ - private void ProcessRegularItems(Insurance insured, HashSet toDelete, Dictionary> parentAttachmentsMap) + protected void ProcessRegularItems(Insurance insured, HashSet toDelete, Dictionary> parentAttachmentsMap) { foreach (var insuredItem in insured.Items) { @@ -434,7 +434,7 @@ public class InsuranceController( * @param traderId The trader ID from the Insurance object. * @param toDelete A Set object to keep track of items marked for deletion. */ - private void ProcessAttachments(Dictionary> mainParentToAttachmentsMap, Dictionary itemsMap, string? insuredTraderId, + protected void ProcessAttachments(Dictionary> mainParentToAttachmentsMap, Dictionary itemsMap, string? insuredTraderId, HashSet toDelete) { foreach (var parentObj in mainParentToAttachmentsMap) @@ -470,7 +470,7 @@ public class InsuranceController( * @param toDelete The array that accumulates the IDs of the items to be deleted. * @returns void */ - private void ProcessAttachmentByParent(List attachments, string? traderId, HashSet toDelete) + protected void ProcessAttachmentByParent(List attachments, string? traderId, HashSet toDelete) { // Create dict of item ids + their flea/handbook price (highest is chosen) var weightedAttachmentByPrice = WeightAttachmentsByPrice(attachments); @@ -502,7 +502,7 @@ public class InsuranceController( } } - private void LogAttachmentsBeingRemoved(List attachmentIdsToRemove, List attachments, Dictionary attachmentPrices) + protected void LogAttachmentsBeingRemoved(List attachmentIdsToRemove, List attachments, Dictionary attachmentPrices) { var index = 1; foreach (var attachmentId in attachmentIdsToRemove) @@ -519,7 +519,7 @@ public class InsuranceController( } } - private Dictionary WeightAttachmentsByPrice(List attachments) + protected Dictionary WeightAttachmentsByPrice(List attachments) { var result = new Dictionary(); @@ -538,7 +538,7 @@ public class InsuranceController( return result; } - private double GetAttachmentCountToRemove(Dictionary weightedAttachmentByPrice, string? traderId) + protected double GetAttachmentCountToRemove(Dictionary weightedAttachmentByPrice, string? traderId) { var removeCount = 0; @@ -553,7 +553,7 @@ public class InsuranceController( .Count(_ => RollForDelete(traderId) ?? false); } - private void RemoveItemsFromInsurance(Insurance insured, HashSet toDelete) + protected void RemoveItemsFromInsurance(Insurance insured, HashSet toDelete) { insured.Items = insured.Items.Where(item => !toDelete.Contains(item.Id)).ToList(); } @@ -565,7 +565,7 @@ public class InsuranceController( * @param insurance The context of insurance to use. * @returns void */ - private void SendMail(string sessionId, Insurance insurance) + protected void SendMail(string sessionId, Insurance insurance) { // If there are no items remaining after the item filtering, the insurance has // successfully "failed" to return anything and an appropriate message should be sent to the player. @@ -599,7 +599,7 @@ public class InsuranceController( ); } - private bool IsMapLabsAndInsuranceDisabled(Insurance insurance, string labsId = "laboratory") + protected bool IsMapLabsAndInsuranceDisabled(Insurance insurance, string labsId = "laboratory") { return string.Equals(insurance.SystemData?.Location, labsId, StringComparison.OrdinalIgnoreCase) && !(_databaseService.GetLocation(labsId)?.Base?.Insurance.GetValueOrDefault(false) ?? false); @@ -608,7 +608,7 @@ public class InsuranceController( /** * Update IInsurance object with new messageTemplateId and wipe out items array data */ - private void HandleLabsInsurance(Dictionary?>? traderDialogMessages, Insurance insurance) + protected void HandleLabsInsurance(Dictionary?>? traderDialogMessages, Insurance insurance) { // Use labs specific messages if available, otherwise use default var responseMesageIds = @@ -623,7 +623,7 @@ public class InsuranceController( } - private bool? RollForDelete(string traderId, Item? insuredItem = null) + protected bool? RollForDelete(string traderId, Item? insuredItem = null) { var trader = _traderHelper.GetTraderById(traderId); if (trader is null)