Use string.empty and MongoId.Empty() where appropriate
This commit is contained in:
@@ -324,7 +324,7 @@ public class BotController(
|
||||
/// <returns>MinMax values</returns>
|
||||
protected MinMax<int>? GetPmcLevelRangeForMap(string? location)
|
||||
{
|
||||
return pmcConfig.LocationSpecificPmcLevelOverride!.GetValueOrDefault(location?.ToLowerInvariant() ?? "", null);
|
||||
return pmcConfig.LocationSpecificPmcLevelOverride!.GetValueOrDefault(location?.ToLowerInvariant() ?? string.Empty, null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -162,7 +162,7 @@ public class CustomizationController(
|
||||
SchemeItems = [new IdWithCount { Count = inventoryItemToProcess.Count!.Value, Id = inventoryItemToProcess.Id }],
|
||||
TransactionId = Traders.RAGMAN,
|
||||
Action = "BuyCustomization",
|
||||
Type = "",
|
||||
Type = string.Empty,
|
||||
ItemId = MongoId.Empty(),
|
||||
Count = 0,
|
||||
SchemeId = 0,
|
||||
|
||||
@@ -599,7 +599,7 @@ public class DialogueController(
|
||||
return new FriendRequestSendResponse
|
||||
{
|
||||
Status = BackendErrorCodes.PlayerProfileNotFound,
|
||||
RequestId = "", // Unused in an error state
|
||||
RequestId = string.Empty, // Unused in an error state
|
||||
RetryAfter = 600,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -252,7 +252,7 @@ public class HealthController(
|
||||
Action = healthTreatmentRequest.Action,
|
||||
TransactionId = Traders.THERAPIST,
|
||||
SchemeItems = healthTreatmentRequest.Items,
|
||||
Type = "",
|
||||
Type = string.Empty,
|
||||
ItemId = MongoId.Empty(),
|
||||
Count = 0,
|
||||
SchemeId = 0,
|
||||
|
||||
@@ -747,8 +747,8 @@ public class InsuranceController(
|
||||
SchemeItems = itemsToPay,
|
||||
TransactionId = request.TransactionId,
|
||||
Action = "SptInsure",
|
||||
Type = "",
|
||||
ItemId = "",
|
||||
Type = string.Empty,
|
||||
ItemId = MongoId.Empty(),
|
||||
Count = 0,
|
||||
SchemeId = 0,
|
||||
};
|
||||
|
||||
@@ -58,8 +58,8 @@ public class MatchController(
|
||||
ProfileId = "TODO",
|
||||
ProfileToken = "TODO",
|
||||
Status = "MatchWait",
|
||||
Sid = "",
|
||||
Ip = "",
|
||||
Sid = string.Empty,
|
||||
Ip = string.Empty,
|
||||
Port = 0,
|
||||
Version = "live",
|
||||
Location = "TODO get location",
|
||||
|
||||
@@ -58,7 +58,7 @@ public class NotifierController(HttpServerHelper httpServerHelper, NotifierHelpe
|
||||
{
|
||||
Server = httpServerHelper.BuildUrl(),
|
||||
ChannelId = sessionId,
|
||||
Url = "",
|
||||
Url = string.Empty,
|
||||
NotifierServer = GetServer(sessionId),
|
||||
WebSocket = notifierHelper.GetWebSocketServer(sessionId),
|
||||
};
|
||||
|
||||
@@ -57,17 +57,17 @@ public class ProfileController(
|
||||
{
|
||||
return new MiniProfile
|
||||
{
|
||||
Username = profile.ProfileInfo?.Username ?? "",
|
||||
Username = profile.ProfileInfo?.Username ?? string.Empty,
|
||||
Nickname = "unknown",
|
||||
HasPassword = profile.ProfileInfo?.Password != "",
|
||||
HasPassword = profile.ProfileInfo?.Password != string.Empty,
|
||||
Side = "unknown",
|
||||
CurrentLevel = 0,
|
||||
CurrentExperience = 0,
|
||||
PreviousExperience = 0,
|
||||
NextLevel = xpToNextLevel,
|
||||
MaxLevel = maxLvl,
|
||||
Edition = profile.ProfileInfo?.Edition ?? "",
|
||||
ProfileId = profile.ProfileInfo?.ProfileId ?? "",
|
||||
Edition = profile.ProfileInfo?.Edition ?? string.Empty,
|
||||
ProfileId = profile.ProfileInfo?.ProfileId ?? string.Empty,
|
||||
SptData = profileHelper.GetDefaultSptDataObject(),
|
||||
};
|
||||
}
|
||||
@@ -83,8 +83,8 @@ public class ProfileController(
|
||||
PreviousExperience = currentLevel == 0 ? 0 : profileHelper.GetExperience(currentLevel.Value),
|
||||
NextLevel = xpToNextLevel,
|
||||
MaxLevel = maxLvl,
|
||||
Edition = profile.ProfileInfo?.Edition ?? "",
|
||||
ProfileId = profile.ProfileInfo?.ProfileId ?? "",
|
||||
Edition = profile.ProfileInfo?.Edition ?? string.Empty,
|
||||
ProfileId = profile.ProfileInfo?.ProfileId ?? string.Empty,
|
||||
SptData = profile.SptData,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1096,7 +1096,7 @@ public class RagfairController(
|
||||
TransactionId = "ragfair",
|
||||
Action = "TradingConfirm",
|
||||
SchemeItems = [new IdWithCount { Id = currency.GetCurrencyTpl(), Count = Math.Round(value) }],
|
||||
Type = "",
|
||||
Type = string.Empty,
|
||||
ItemId = MongoId.Empty(),
|
||||
Count = 0,
|
||||
SchemeId = 0,
|
||||
|
||||
@@ -29,8 +29,8 @@ public class WeatherController(
|
||||
var result = new WeatherData
|
||||
{
|
||||
Acceleration = 0,
|
||||
Time = "",
|
||||
Date = "",
|
||||
Time = string.Empty,
|
||||
Date = string.Empty,
|
||||
Weather = null,
|
||||
Season = Season.AUTUMN,
|
||||
};
|
||||
|
||||
@@ -1052,7 +1052,7 @@ public class BotEquipmentModGenerator(
|
||||
// Get random mod to attach from items db for required slots if none found above
|
||||
if (!(chosenModResult.Found ?? false) && parentSlot != null && (parentSlot.Required ?? false))
|
||||
{
|
||||
chosenModResult.ChosenTemplate = GetRandomModTplFromItemDb("", parentSlot, request.ModSlot, request.Weapon);
|
||||
chosenModResult.ChosenTemplate = GetRandomModTplFromItemDb(MongoId.Empty(), parentSlot, request.ModSlot, request.Weapon);
|
||||
chosenModResult.Found = true;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -360,7 +360,7 @@ public class CompletionQuestGenerator(
|
||||
{
|
||||
Id = new MongoId(),
|
||||
Index = 0,
|
||||
ParentId = "",
|
||||
ParentId = string.Empty,
|
||||
DynamicLocale = true,
|
||||
VisibilityConditions = [],
|
||||
Target = new ListOrT<string>([itemTpl], null),
|
||||
|
||||
+1
-1
@@ -663,7 +663,7 @@ public class RepeatableQuestRewardGenerator(
|
||||
.Values.Where(itemTemplate =>
|
||||
{
|
||||
// Base "Item" item has no parent, ignore it
|
||||
if (itemTemplate.Parent == "")
|
||||
if (itemTemplate.Parent == MongoId.Empty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ public class ScavCaseRewardGenerator(
|
||||
.Values.Where(item =>
|
||||
{
|
||||
// Base "Item" item has no parent, ignore it
|
||||
if (item.Parent == "")
|
||||
if (item.Parent == MongoId.Empty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -144,7 +144,7 @@ public class ScavCaseRewardGenerator(
|
||||
.Values.Where(item =>
|
||||
{
|
||||
// Base "Item" item has no parent, ignore it
|
||||
if (item.Parent == "")
|
||||
if (item.Parent == MongoId.Empty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -75,8 +75,8 @@ public class WeatherGenerator(
|
||||
WindDirection = GetWeightedWindDirection(weatherValues),
|
||||
WindSpeed = GetWeightedWindSpeed(weatherValues),
|
||||
Cloud = clouds,
|
||||
Time = "",
|
||||
Date = "",
|
||||
Time = string.Empty,
|
||||
Date = string.Empty,
|
||||
Timestamp = 0,
|
||||
SptInRaidTimestamp = 0,
|
||||
};
|
||||
|
||||
@@ -249,7 +249,7 @@ public class BotGeneratorHelper(
|
||||
{
|
||||
Incompatible = false,
|
||||
Found = false,
|
||||
Reason = "",
|
||||
Reason = string.Empty,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -409,7 +409,7 @@ public class BotGeneratorHelper(
|
||||
};
|
||||
}
|
||||
|
||||
return new ChooseRandomCompatibleModResult { Incompatible = false, Reason = "" };
|
||||
return new ChooseRandomCompatibleModResult { Incompatible = false, Reason = string.Empty };
|
||||
}
|
||||
|
||||
protected bool HasBlockingProperty(TemplateItem? item, string blockingPropertyName)
|
||||
|
||||
@@ -117,7 +117,7 @@ public class PrestigeHelper(
|
||||
{
|
||||
mailSendService.SendSystemMessageToPlayer(
|
||||
sessionId.Value,
|
||||
"",
|
||||
string.Empty,
|
||||
itemsToTransfer,
|
||||
timeUtil.GetHoursAsSeconds(8760) // Year
|
||||
);
|
||||
@@ -168,7 +168,7 @@ public class PrestigeHelper(
|
||||
|
||||
if (itemsToSend.Count > 0)
|
||||
{
|
||||
mailSendService.SendSystemMessageToPlayer(sessionId, "", itemsToSend, 31536000);
|
||||
mailSendService.SendSystemMessageToPlayer(sessionId, string.Empty, itemsToSend, 31536000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ public class PmcChatResponseService(
|
||||
playerName = pmcData.Info.Nickname,
|
||||
playerLevel = pmcData.Info.Level,
|
||||
playerSide = pmcData.Info.Side,
|
||||
victimDeathLocation = victimData is not null ? GetLocationName(victimData.Location) : "",
|
||||
victimDeathLocation = victimData is not null ? GetLocationName(victimData.Location) : string.Empty,
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -126,8 +126,8 @@ public class RepairService(
|
||||
SchemeItems = [new IdWithCount { Count = Math.Round(repairCost), Id = Money.ROUBLES }],
|
||||
TransactionId = traderId,
|
||||
Action = "SptRepair",
|
||||
Type = "",
|
||||
ItemId = "",
|
||||
Type = string.Empty,
|
||||
ItemId = MongoId.Empty(),
|
||||
Count = 0,
|
||||
SchemeId = 0,
|
||||
};
|
||||
|
||||
@@ -1100,8 +1100,8 @@ public class SeasonalEventService(
|
||||
ForceSpawn = true,
|
||||
SpawnMode = ["regular", "pve"],
|
||||
Time = -1,
|
||||
TriggerId = "",
|
||||
TriggerName = "",
|
||||
TriggerId = string.Empty,
|
||||
TriggerName = string.Empty,
|
||||
Delay = 0,
|
||||
IsRandomTimeSpawn = false,
|
||||
IgnoreMaxBots = true,
|
||||
|
||||
@@ -67,7 +67,7 @@ public class HttpResponseUtil(JsonUtil jsonUtil, ServerLocalisationService serve
|
||||
/// <returns>Client response</returns>
|
||||
public string EmptyResponse()
|
||||
{
|
||||
return GetBody("", BackendErrorCodes.None, "");
|
||||
return GetBody(string.Empty, BackendErrorCodes.None, "");
|
||||
}
|
||||
|
||||
public string NullResponse()
|
||||
|
||||
Reference in New Issue
Block a user