Merge branch 'develop' of https://github.com/sp-tarkov/server-csharp into develop
This commit is contained in:
@@ -15,6 +15,7 @@ using SPTarkov.Server.Core.Utils.Json;
|
||||
using SPTarkov.Server;
|
||||
using SPTarkov.Common.Annotations;
|
||||
using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel;
|
||||
using SPTarkov.Server.Core.Models.Spt.Location;
|
||||
|
||||
|
||||
namespace SPTarkov.Server.Core.Controllers;
|
||||
@@ -290,7 +291,7 @@ public class GameController(
|
||||
/// <param name="sessionId">Session/Player id</param>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
public GetRaidTimeResponse GetRaidTime(string sessionId, GetRaidTimeRequest request)
|
||||
public RaidChanges GetRaidTime(string sessionId, GetRaidTimeRequest request)
|
||||
{
|
||||
return _raidTimeAdjustmentService.GetRaidAdjustments(sessionId, request);
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ public class RaidTimeAdjustmentService(
|
||||
var startSeconds = raidAdjustments.SimulatedRaidStartSeconds.GetValueOrDefault(1);
|
||||
foreach (var wave in mapBase.Waves)
|
||||
{
|
||||
// Dont let time fall below 0
|
||||
// Don't let time fall below 0
|
||||
wave.TimeMin -= (int) Math.Max(startSeconds, 0);
|
||||
wave.TimeMax -= (int) Math.Max(startSeconds, 0);
|
||||
}
|
||||
@@ -131,17 +131,22 @@ public class RaidTimeAdjustmentService(
|
||||
/// <param name="sessionId">Session id</param>
|
||||
/// <param name="request">Raid adjustment request</param>
|
||||
/// <returns>Response to send to client</returns>
|
||||
public GetRaidTimeResponse GetRaidAdjustments(string sessionId, GetRaidTimeRequest request)
|
||||
public RaidChanges GetRaidAdjustments(string sessionId, GetRaidTimeRequest request)
|
||||
{
|
||||
var globals = _databaseService.GetGlobals();
|
||||
var mapBase = _databaseService.GetLocation(request.Location.ToLower()).Base;
|
||||
var baseEscapeTimeMinutes = mapBase.EscapeTimeLimit;
|
||||
|
||||
// Prep result object to return
|
||||
var result = new GetRaidTimeResponse
|
||||
var result = new RaidChanges
|
||||
{
|
||||
NewSurviveTimeSeconds = null,
|
||||
OriginalSurvivalTimeSeconds = globals.Configuration.Exp.MatchEnd.SurvivedSecondsRequirement
|
||||
NewSurviveTimeSeconds = globals.Configuration.Exp.MatchEnd.SurvivedSecondsRequirement,
|
||||
OriginalSurvivalTimeSeconds = globals.Configuration.Exp.MatchEnd.SurvivedSecondsRequirement,
|
||||
DynamicLootPercent = 100,
|
||||
StaticLootPercent = 100,
|
||||
SimulatedRaidStartSeconds = 0,
|
||||
RaidTimeMinutes = baseEscapeTimeMinutes,
|
||||
ExitChanges = []
|
||||
};
|
||||
|
||||
// Pmc raid, send default
|
||||
@@ -150,7 +155,7 @@ public class RaidTimeAdjustmentService(
|
||||
return result;
|
||||
}
|
||||
|
||||
// We're scav adjust values
|
||||
// We're scav, adjust values
|
||||
var mapSettings = GetMapSettings(request.Location);
|
||||
|
||||
// Chance of reducing raid time for scav, not guaranteed
|
||||
@@ -173,25 +178,16 @@ public class RaidTimeAdjustmentService(
|
||||
|
||||
// Time player spawns into the raid if it was online
|
||||
var simulatedRaidStartTimeMinutes = baseEscapeTimeMinutes - newRaidTimeMinutes;
|
||||
result.SimulatedRaidStartSeconds = simulatedRaidStartTimeMinutes * 60;
|
||||
result.RaidTimeMinutes = newRaidTimeMinutes;
|
||||
|
||||
// Calculate how long player needs to be in raid to get a `survived` extract status
|
||||
result.NewSurviveTimeSeconds = Math.Max(result.OriginalSurvivalTimeSeconds.Value - (baseEscapeTimeMinutes.Value - newRaidTimeMinutes) * 60, 0);
|
||||
|
||||
// State that we'll pass to loot generation
|
||||
var raidChanges = new RaidChanges {
|
||||
DynamicLootPercent = 100,
|
||||
StaticLootPercent = 100,
|
||||
RaidTimeMinutes = newRaidTimeMinutes,
|
||||
OriginalSurvivalTimeSeconds = result.OriginalSurvivalTimeSeconds,
|
||||
ExitChanges = [],
|
||||
NewSurviveTimeSeconds = result.NewSurviveTimeSeconds,
|
||||
SimulatedRaidStartSeconds = 0 };
|
||||
|
||||
if (mapSettings.ReduceLootByPercent)
|
||||
{
|
||||
raidChanges.DynamicLootPercent = Math.Max(raidTimeRemainingPercent, mapSettings.MinDynamicLootPercent);
|
||||
raidChanges.StaticLootPercent = Math.Max(raidTimeRemainingPercent, mapSettings.MinStaticLootPercent);
|
||||
raidChanges.SimulatedRaidStartSeconds = simulatedRaidStartTimeMinutes * 60;
|
||||
result.DynamicLootPercent = Math.Max(raidTimeRemainingPercent, mapSettings.MinDynamicLootPercent);
|
||||
result.StaticLootPercent = Math.Max(raidTimeRemainingPercent, mapSettings.MinStaticLootPercent);
|
||||
}
|
||||
|
||||
_logger.Debug($"Reduced: {request.Location} raid time by: {chosenRaidReductionPercent}% to {newRaidTimeMinutes} minutes");
|
||||
@@ -203,13 +199,13 @@ public class RaidTimeAdjustmentService(
|
||||
);
|
||||
|
||||
var exitAdjustments = GetExitAdjustments(mapBase, newRaidTimeMinutes);
|
||||
if (exitAdjustments is not null)
|
||||
if (exitAdjustments.Any())
|
||||
{
|
||||
raidChanges.ExitChanges.AddRange(exitAdjustments);
|
||||
result.ExitChanges.AddRange(exitAdjustments);
|
||||
}
|
||||
|
||||
// Store state to use in loot generation
|
||||
_applicationContext.AddValue(ContextVariableType.RAID_ADJUSTMENTS, raidChanges);
|
||||
_applicationContext.AddValue(ContextVariableType.RAID_ADJUSTMENTS, result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -458,7 +458,7 @@ public class SeasonalEventService(
|
||||
AddEventGearToBots(SeasonalEventType.Halloween);
|
||||
AddEventGearToBots(SeasonalEventType.Christmas);
|
||||
AddEventLootToBots(SeasonalEventType.Christmas);
|
||||
AddEventBossesToMaps(SeasonalEventType.Halloween.ToString());
|
||||
AddEventBossesToMaps("halloweensummon");
|
||||
EnableHalloweenSummonEvent();
|
||||
AddPumpkinsToScavBackpacks();
|
||||
RenameBitcoin();
|
||||
@@ -1024,12 +1024,16 @@ public class SeasonalEventService(
|
||||
if (!maps.TryGetValue(gifterMapSettings.Map, out var mapData))
|
||||
{
|
||||
_logger.Warning($"AddGifterBotToMaps() Map not found {gifterMapSettings.Map}");
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// Dont add gifter to map twice
|
||||
if (mapData.Base.BossLocationSpawn.Any(boss => boss.BossName == "gifter"))
|
||||
// Don't add gifter to map twice
|
||||
var existingGifter = mapData.Base.BossLocationSpawn.FirstOrDefault(boss => boss.BossName == "gifter");
|
||||
if (existingGifter is not null)
|
||||
{
|
||||
existingGifter.BossChance = gifterMapSettings.SpawnChance;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1050,7 +1054,8 @@ public class SeasonalEventService(
|
||||
TriggerId = "",
|
||||
TriggerName = "",
|
||||
Delay = 0,
|
||||
IsRandomTimeSpawn = false
|
||||
IsRandomTimeSpawn = false,
|
||||
IgnoreMaxBots = true
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Gifter/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=ragfair/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=scav/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Tarkov/@EntryIndexedValue">True</s:Boolean>
|
||||
|
||||
Reference in New Issue
Block a user