Implemented RepairController.TraderRepair + repeatable cleanup
This commit is contained in:
@@ -2,12 +2,15 @@ using SptCommon.Annotations;
|
||||
using Core.Models.Eft.Common;
|
||||
using Core.Models.Eft.ItemEvent;
|
||||
using Core.Models.Eft.Repair;
|
||||
using Core.Routers;
|
||||
using Core.Services;
|
||||
|
||||
namespace Core.Controllers;
|
||||
|
||||
[Injectable]
|
||||
public class RepairController(
|
||||
|
||||
EventOutputHolder _eventOutputHolder,
|
||||
RepairService _repairService
|
||||
)
|
||||
{
|
||||
/// <summary>
|
||||
@@ -19,11 +22,37 @@ public class RepairController(
|
||||
/// <param name="pmcData">player profile</param>
|
||||
/// <returns>item event router action</returns>
|
||||
public ItemEventRouterResponse TraderRepair(
|
||||
string sessionId,
|
||||
string sessionID,
|
||||
TraderRepairActionDataRequest body,
|
||||
PmcData pmcData)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
var output = _eventOutputHolder.GetOutput(sessionID);
|
||||
|
||||
// find the item to repair
|
||||
foreach (var repairItem in body.RepairItems) {
|
||||
var repairDetails = _repairService.RepairItemByTrader(sessionID, pmcData, repairItem, body.TId);
|
||||
|
||||
_repairService.PayForRepair(
|
||||
sessionID,
|
||||
pmcData,
|
||||
repairItem.Id,
|
||||
repairDetails.RepairCost.Value,
|
||||
body.TId,
|
||||
output);
|
||||
|
||||
if (output.Warnings.Count > 0)
|
||||
{
|
||||
return output;
|
||||
}
|
||||
|
||||
// Add repaired item to output object
|
||||
output.ProfileChanges[sessionID].Items.ChangedItems.Add(repairDetails.RepairedItem.ConvertToProduct());
|
||||
|
||||
// Add skill points for repairing weapons
|
||||
_repairService.AddRepairSkillPoints(sessionID, repairDetails, pmcData);
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -12,7 +12,6 @@ using Core.Services;
|
||||
using Core.Utils.Collections;
|
||||
using SptCommon.Extensions;
|
||||
using BodyPart = Core.Models.Spt.Config.BodyPart;
|
||||
using Core.Models.Eft.Hideout;
|
||||
using Core.Utils.Cloners;
|
||||
|
||||
namespace Core.Generators;
|
||||
@@ -387,22 +386,6 @@ public class RepeatableQuestGenerator(
|
||||
return Math.Sqrt(Math.Sqrt(target) + bodyPart + dist + weaponRequirement) * kill;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a number of kills needed to complete elimination quest
|
||||
/// </summary>
|
||||
/// <param name="targetKey">Target type desired e.g. anyPmc/bossBully/Savage</param>
|
||||
/// <param name="targetsConfig">Config</param>
|
||||
/// <param name="eliminationConfig">Config</param>
|
||||
/// <returns>Number of AI to kill</returns>
|
||||
protected int GetEliminationKillCount(
|
||||
string targetKey,
|
||||
object targetsConfig, // TODO: typing was ProbabilityObjectArray<string, BossInfo>
|
||||
EliminationConfig eliminationConfig
|
||||
)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json)
|
||||
/// This is a helper method for GenerateEliminationQuest to create a location condition.
|
||||
@@ -766,7 +749,9 @@ public class RepeatableQuestGenerator(
|
||||
/// <returns>List of Exit objects</returns>
|
||||
protected List<Exit> GetLocationExitsForSide(string locationKey, string playerSide)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
var mapExtracts = _databaseService.GetLocation(locationKey.ToLower()).AllExtracts;
|
||||
|
||||
return mapExtracts.Where((exit) => exit.Side == playerSide).ToList();
|
||||
}
|
||||
|
||||
protected RepeatableQuest GeneratePickupQuest(
|
||||
@@ -797,7 +782,12 @@ public class RepeatableQuestGenerator(
|
||||
/// <returns>Exit condition</returns>
|
||||
protected QuestConditionCounterCondition GenerateExplorationExitCondition(Exit exit)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
return new QuestConditionCounterCondition {
|
||||
Id = _hashUtil.Generate(),
|
||||
DynamicLocale = true,
|
||||
ExitName = exit.Name,
|
||||
ConditionType = "ExitName"
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -58,7 +58,7 @@ public class RepairService
|
||||
string sessionID,
|
||||
PmcData pmcData,
|
||||
string repairedItemId,
|
||||
decimal repairCost,
|
||||
double repairCost,
|
||||
string traderId,
|
||||
ItemEventRouterResponse output
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user