Various code linting changes
This commit is contained in:
@@ -1434,10 +1434,10 @@ public class ItemHelper
|
||||
List<Item> magazine,
|
||||
TemplateItem magTemplate,
|
||||
Dictionary<string, List<StaticAmmoDetails>> staticAmmoDist,
|
||||
string caliber = null,
|
||||
string? caliber = null,
|
||||
double minSizePercent = 0.25,
|
||||
string defaultCartridgeTpl = null,
|
||||
TemplateItem weapon = null)
|
||||
string? defaultCartridgeTpl = null,
|
||||
TemplateItem? weapon = null)
|
||||
{
|
||||
var chosenCaliber = caliber ?? GetRandomValidCaliber(magTemplate);
|
||||
|
||||
@@ -1456,7 +1456,7 @@ public class ItemHelper
|
||||
);
|
||||
if (cartridgeTpl is null)
|
||||
{
|
||||
_logger.Debug($"Unable to fill item: {magazine[0].Id} {magTemplate.Name} with cartrides as none were found.");
|
||||
_logger.Debug($"Unable to fill item: {magazine[0].Id} {magTemplate.Name} with cartridges, none found.");
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -1523,7 +1523,7 @@ public class ItemHelper
|
||||
var cartridgeCountToAdd =
|
||||
desiredStackCount <= cartridgeMaxStackSize ? desiredStackCount : cartridgeMaxStackSize;
|
||||
|
||||
// Ensure we don't go over the max stackcount size
|
||||
// Ensure we don't go over the max stackCount size
|
||||
var remainingSpace = desiredStackCount - currentStoredCartridgeCount;
|
||||
if (cartridgeCountToAdd > remainingSpace)
|
||||
{
|
||||
@@ -1545,7 +1545,7 @@ public class ItemHelper
|
||||
location++;
|
||||
}
|
||||
|
||||
// Only one cartridge stack added, remove location property as its only used for 2 or more stacks
|
||||
// Only one cartridge stack added, remove location property as it's only used for 2 or more stacks
|
||||
if (location == 1)
|
||||
{
|
||||
magazineWithChildCartridges[1].Location = null;
|
||||
|
||||
@@ -8,28 +8,28 @@ public class QuestConditionHelper
|
||||
{
|
||||
public List<QuestCondition> GetQuestConditions(
|
||||
List<QuestCondition> questConditions,
|
||||
Func<QuestCondition, List<QuestCondition>> furtherFilter = null)
|
||||
Func<QuestCondition, List<QuestCondition>>? furtherFilter = null)
|
||||
{
|
||||
return FilterConditions(questConditions, "Quest", furtherFilter);
|
||||
}
|
||||
|
||||
public List<QuestCondition> GetLevelConditions(
|
||||
List<QuestCondition> questConditions,
|
||||
Func<QuestCondition, List<QuestCondition>> furtherFilter = null)
|
||||
Func<QuestCondition, List<QuestCondition>>? furtherFilter = null)
|
||||
{
|
||||
return FilterConditions(questConditions, "Level", furtherFilter);
|
||||
}
|
||||
|
||||
public List<QuestCondition> GetLoyaltyConditions(
|
||||
List<QuestCondition> questConditions,
|
||||
Func<QuestCondition, List<QuestCondition>> furtherFilter = null)
|
||||
Func<QuestCondition, List<QuestCondition>>? furtherFilter = null)
|
||||
{
|
||||
return FilterConditions(questConditions, "TraderLoyalty", furtherFilter);
|
||||
}
|
||||
|
||||
public List<QuestCondition> GetStandingConditions(
|
||||
List<QuestCondition> questConditions,
|
||||
Func<QuestCondition, List<QuestCondition>> furtherFilter = null)
|
||||
Func<QuestCondition, List<QuestCondition>>? furtherFilter = null)
|
||||
{
|
||||
return FilterConditions(questConditions, "TraderStanding", furtherFilter);
|
||||
}
|
||||
@@ -37,7 +37,7 @@ public class QuestConditionHelper
|
||||
protected List<QuestCondition> FilterConditions(
|
||||
List<QuestCondition> questConditions,
|
||||
string questType,
|
||||
Func<QuestCondition, List<QuestCondition>> furtherFilter = null)
|
||||
Func<QuestCondition, List<QuestCondition>>? furtherFilter = null)
|
||||
{
|
||||
var filteredQuests = questConditions.Where((c) => {
|
||||
if (c.ConditionType == questType)
|
||||
|
||||
+34
-27
@@ -101,31 +101,31 @@ public class QuestHelper
|
||||
/// <returns>true if player level is greater than or equal to quest</returns>
|
||||
public bool DoesPlayerLevelFulfilCondition(double playerLevel, QuestCondition condition)
|
||||
{
|
||||
if (condition.ConditionType == "Level")
|
||||
if (condition.ConditionType != "Level")
|
||||
{
|
||||
var conditionValue = double.Parse(condition.Value.ToString());
|
||||
switch (condition.CompareMethod)
|
||||
{
|
||||
case ">=":
|
||||
return playerLevel >= conditionValue;
|
||||
case ">":
|
||||
return playerLevel > conditionValue;
|
||||
case "<":
|
||||
return playerLevel < conditionValue;
|
||||
case "<=":
|
||||
return playerLevel <= conditionValue;
|
||||
case "=":
|
||||
return playerLevel == conditionValue;
|
||||
default:
|
||||
_logger.Error(
|
||||
_localisationService.GetText("quest-unable_to_find_compare_condition", condition.CompareMethod)
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
var conditionValue = double.Parse(condition.Value.ToString());
|
||||
switch (condition.CompareMethod)
|
||||
{
|
||||
case ">=":
|
||||
return playerLevel >= conditionValue;
|
||||
case ">":
|
||||
return playerLevel > conditionValue;
|
||||
case "<":
|
||||
return playerLevel < conditionValue;
|
||||
case "<=":
|
||||
return playerLevel <= conditionValue;
|
||||
case "=":
|
||||
return playerLevel == conditionValue;
|
||||
default:
|
||||
_logger.Error(
|
||||
_localisationService.GetText("quest-unable_to_find_compare_condition", condition.CompareMethod)
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -858,8 +858,14 @@ public class QuestHelper
|
||||
*/
|
||||
public List<Quest> GetClientQuests(string sessionID)
|
||||
{
|
||||
List<Quest> questsToShowPlayer = new List<Quest>();
|
||||
List<Quest> questsToShowPlayer = [];
|
||||
var profile = _profileHelper.GetPmcProfile(sessionID);
|
||||
if (profile is null)
|
||||
{
|
||||
_logger.Error($"Profile {sessionID} not found, unable to return quests");
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
var allQuests = GetQuestsFromDb();
|
||||
foreach (var quest in allQuests)
|
||||
@@ -873,7 +879,7 @@ public class QuestHelper
|
||||
continue;
|
||||
}
|
||||
|
||||
// Filter out bear quests for usec and vice versa
|
||||
// Filter out bear quests for USEC and vice versa
|
||||
if (QuestIsForOtherSide(profile.Info.Side, quest.Id))
|
||||
{
|
||||
continue;
|
||||
@@ -911,11 +917,12 @@ public class QuestHelper
|
||||
|
||||
// Check the status of each quest condition, if any are not completed
|
||||
// then this quest should not be visible
|
||||
bool haveCompletedPreviousQuest = true;
|
||||
var haveCompletedPreviousQuest = true;
|
||||
foreach (var conditionToFulfil in questRequirements)
|
||||
{
|
||||
// If the previous quest isn't in the user profile, it hasn't been completed or started
|
||||
var prerequisiteQuest = profile.Quests.FirstOrDefault(profileQuest => (conditionToFulfil.Target as string[]).Contains(profileQuest.QId));
|
||||
var questIdsToFulfil = conditionToFulfil.Target as string[] ?? [];
|
||||
var prerequisiteQuest = profile.Quests.FirstOrDefault(profileQuest => questIdsToFulfil.Contains(profileQuest.QId));
|
||||
|
||||
if (prerequisiteQuest is null)
|
||||
{
|
||||
@@ -1068,7 +1075,7 @@ public class QuestHelper
|
||||
* @returns QuestStatusChange array
|
||||
*/
|
||||
protected List<QuestStatus> GetQuestsWithDifferentStatuses(
|
||||
List<QuestStatus> preQuestStatusus,
|
||||
List<QuestStatus> preQuestStatuses,
|
||||
List<QuestStatus> postQuestStatuses
|
||||
)
|
||||
{
|
||||
|
||||
@@ -408,8 +408,7 @@ public class QuestRewardHelper
|
||||
foreach (var target in targets)
|
||||
{
|
||||
// This has all the original id relations since we reset the id to the original after the splitStack
|
||||
var itemsClone = new List<Item>();
|
||||
itemsClone.Add(_cloner.Clone(target));
|
||||
var itemsClone = new List<Item> { _cloner.Clone(target) };
|
||||
// Here we generate a new id for the root item
|
||||
target.Id = _hashUtil.Generate();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user