Implemented getAllBotDifficulties
This commit is contained in:
@@ -48,9 +48,7 @@ public class InsuranceCallbacks : OnUpdate
|
||||
/// <returns></returns>
|
||||
public string GetInsuranceCost(string url, GetInsuranceCostRequestData info, string sessionID)
|
||||
{
|
||||
// return _httpResponseUtil.GetBody(_insuranceController.Cost(info, sessionID));
|
||||
// TODO: InsuranceController is not implemented rn
|
||||
throw new NotImplementedException();
|
||||
return _httpResponseUtil.GetBody(_insuranceController.Cost(info, sessionID));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -57,10 +57,10 @@ public class NotifierCallbacks
|
||||
/// </summary>
|
||||
/// <param name="url"></param>
|
||||
/// <param name="info"></param>
|
||||
/// <param name="sessionID"></param>
|
||||
/// <param name="sessionId"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public string GetNotifier(string url, object info, string sessionID) // TODO: no types were given
|
||||
public string GetNotifier(string url, object info, string sessionId)
|
||||
{
|
||||
return _httpResponseUtil.EmptyArrayResponse();
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ public class BotController
|
||||
{
|
||||
var difficulty = diffLevel.ToLower();
|
||||
|
||||
if (!(raidConfig != null || ignoreRaidSettings)) // TODD: this might be wrong logic
|
||||
if (!(raidConfig != null || ignoreRaidSettings))
|
||||
_logger.Error(_localisationService.GetText("bot-missing_application_context", "RAID_CONFIGURATION"));
|
||||
|
||||
// Check value chosen in pre-raid difficulty dropdown
|
||||
@@ -118,12 +118,46 @@ public class BotController
|
||||
return _botDifficultyHelper.GetBotDifficultySettings(type, difficulty, botDb);
|
||||
}
|
||||
|
||||
public Dictionary<string, object> GetAllBotDifficulties()
|
||||
public Dictionary<string, Dictionary<string, DifficultyCategories>> GetAllBotDifficulties()
|
||||
{
|
||||
var result = new Dictionary<string, object>();
|
||||
var result = new Dictionary<string, Dictionary<string, DifficultyCategories>>();
|
||||
|
||||
var botTypesDb = _databaseService.GetBots().Types;
|
||||
// TODO: Come back to this, brainfuck
|
||||
//Get all bot types as sting array
|
||||
var botTypes = Enum.GetValues<WildSpawnType>().Select(item => item.ToString()).ToList();
|
||||
foreach (var botType in botTypes)
|
||||
{
|
||||
// If bot is usec/bear, swap to different name
|
||||
var botTypeLower = _botHelper.IsBotPmc(botType)
|
||||
? _botHelper.GetPmcSideByRole(botType).ToLower()
|
||||
: botType.ToLower();
|
||||
|
||||
// Get details from db
|
||||
if (!botTypesDb.TryGetValue(botTypeLower, out var botDetails))
|
||||
{
|
||||
// No bot of this type found, skip
|
||||
continue;
|
||||
};
|
||||
|
||||
if (botDetails.BotDifficulty is null)
|
||||
{
|
||||
// Bot has no difficulty values, skip
|
||||
continue;
|
||||
}
|
||||
|
||||
var botNameKey = botType.ToLower();
|
||||
foreach (var (difficultyName, difficultyValues) in botDetails.BotDifficulty)
|
||||
{
|
||||
// Bot doesnt exist in result, add
|
||||
if (!result.ContainsKey(botNameKey))
|
||||
{
|
||||
result.TryAdd(botNameKey, new Dictionary<string, DifficultyCategories>());
|
||||
}
|
||||
|
||||
// Store all difficulty values in dict keyed by difficulty type e.g. easy/normal/impossible
|
||||
result[botNameKey].Add(difficultyName, GetBotDifficulty(botNameKey, difficultyName, null, true));
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,74 @@
|
||||
using Core.Annotations;
|
||||
using Core.Helpers;
|
||||
using Core.Models.Eft.Common.Tables;
|
||||
using Core.Models.Eft.Insurance;
|
||||
using Core.Models.Spt.Config;
|
||||
using Core.Models.Utils;
|
||||
using Core.Servers;
|
||||
using Core.Services;
|
||||
|
||||
namespace Core.Controllers;
|
||||
|
||||
[Injectable]
|
||||
public class InsuranceController
|
||||
{
|
||||
// TODO
|
||||
private readonly ISptLogger<InsuranceController> _logger;
|
||||
private readonly ProfileHelper _profileHelper;
|
||||
private readonly InsuranceService _insuranceService;
|
||||
private readonly ConfigServer _configServer;
|
||||
private readonly InsuranceConfig _insuranceConfig;
|
||||
|
||||
public InsuranceController(
|
||||
ISptLogger<InsuranceController> logger,
|
||||
ProfileHelper profileHelper,
|
||||
InsuranceService insuranceService,
|
||||
ConfigServer configServer
|
||||
)
|
||||
{
|
||||
_logger = logger;
|
||||
_profileHelper = profileHelper;
|
||||
_insuranceService = insuranceService;
|
||||
_configServer = configServer;
|
||||
|
||||
_insuranceConfig = _configServer.GetConfig<InsuranceConfig>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle client/insurance/items/list/cost
|
||||
* Calculate insurance cost
|
||||
*
|
||||
* @param request request object
|
||||
* @param sessionID session id
|
||||
* @returns IGetInsuranceCostResponseData object to send to client
|
||||
*/
|
||||
public GetInsuranceCostResponseData Cost(GetInsuranceCostRequestData request, string sessionId)
|
||||
{
|
||||
var response = new GetInsuranceCostResponseData();
|
||||
var pmcData = _profileHelper.GetPmcProfile(sessionId);
|
||||
var inventoryItemsHash = new Dictionary<string, Item>();
|
||||
|
||||
foreach (var item in pmcData.Inventory.Items) {
|
||||
inventoryItemsHash[item.Id] = item;
|
||||
}
|
||||
|
||||
// Loop over each trader in request
|
||||
foreach(var trader in request.Traders)
|
||||
{
|
||||
var items = new Dictionary<string, double>();
|
||||
|
||||
foreach (var itemId in request.Items) {
|
||||
// Ensure hash has item in it
|
||||
if (!inventoryItemsHash.ContainsKey(itemId))
|
||||
{
|
||||
_logger.Debug("Item with id: ${ itemId} missing from player inventory, skipping");
|
||||
continue;
|
||||
}
|
||||
items[inventoryItemsHash[itemId].Template] = _insuranceService.GetRoublePriceToInsureItemWithTrader(pmcData, inventoryItemsHash[itemId], trader);
|
||||
}
|
||||
|
||||
response[trader] = items;
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Text.Json.Serialization;
|
||||
using Core.Models.Common;
|
||||
|
||||
namespace Core.Models.Eft.Common;
|
||||
@@ -937,9 +937,65 @@ public record Area
|
||||
|
||||
public enum WildSpawnType
|
||||
{
|
||||
assault,
|
||||
marksman,
|
||||
pmcbot,
|
||||
bosskilla,
|
||||
bossknight
|
||||
assault,
|
||||
bossTest,
|
||||
bossBully,
|
||||
followerTest,
|
||||
followerBully,
|
||||
bossKilla,
|
||||
bossKojaniy,
|
||||
followerKojaniy,
|
||||
pmcBot,
|
||||
cursedAssault,
|
||||
bossGluhar,
|
||||
followerGluharAssault,
|
||||
followerGluharSecurity,
|
||||
followerGluharScout,
|
||||
followerGluharSnipe,
|
||||
followerSanitar,
|
||||
bossSanitar,
|
||||
test,
|
||||
assaultGroup,
|
||||
sectantWarrior,
|
||||
sectantPriest,
|
||||
bossTagilla,
|
||||
followerTagilla,
|
||||
exUsec,
|
||||
gifter,
|
||||
bossKnight,
|
||||
followerBigPipe,
|
||||
followerBirdEye,
|
||||
bossZryachiy,
|
||||
followerZryachiy,
|
||||
bossBoar = 32,
|
||||
followerBoar,
|
||||
arenaFighter,
|
||||
arenaFighterEvent,
|
||||
bossBoarSniper,
|
||||
crazyAssaultEvent,
|
||||
peacefullZryachiyEvent,
|
||||
sectactPriestEvent,
|
||||
ravangeZryachiyEvent,
|
||||
followerBoarClose1,
|
||||
followerBoarClose2,
|
||||
bossKolontay,
|
||||
followerKolontayAssault,
|
||||
followerKolontaySecurity,
|
||||
shooterBTR,
|
||||
bossPartisan,
|
||||
spiritWinter,
|
||||
spiritSpring,
|
||||
peacemaker,
|
||||
pmcBEAR,
|
||||
pmcUSEC,
|
||||
skier,
|
||||
sectantPredvestnik = 57,
|
||||
sectantPrizrak,
|
||||
sectantOni,
|
||||
infectedAssault,
|
||||
infectedPmc,
|
||||
infectedCivil,
|
||||
infectedLaborant,
|
||||
infectedTagilla
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ public record BotType
|
||||
public Chances? BotChances { get; set; }
|
||||
|
||||
[JsonPropertyName("difficulty")]
|
||||
public Difficulties? BotDifficulty { get; set; }
|
||||
public Dictionary<string, DifficultyCategories>? BotDifficulty { get; set; }
|
||||
|
||||
[JsonPropertyName("experience")]
|
||||
public Experience? BotExperience { get; set; }
|
||||
|
||||
@@ -750,10 +750,10 @@ public class SeasonalEventService
|
||||
{
|
||||
var gifterBot = _databaseService.GetBots().Types["gifter"];
|
||||
var items = gifterBot.BotInventory.Items.Backpack.Keys.ToList();
|
||||
gifterBot.BotDifficulty.Easy.Patrol["ITEMS_TO_DROP"] = items;
|
||||
gifterBot.BotDifficulty.Normal.Patrol["ITEMS_TO_DROP"] = items;
|
||||
gifterBot.BotDifficulty.Hard.Patrol["ITEMS_TO_DROP"] = items;
|
||||
gifterBot.BotDifficulty.Impossible.Patrol["ITEMS_TO_DROP"] = items;
|
||||
gifterBot.BotDifficulty["Easy"].Patrol["ITEMS_TO_DROP"] = items;
|
||||
gifterBot.BotDifficulty["Normal"].Patrol["ITEMS_TO_DROP"] = items;
|
||||
gifterBot.BotDifficulty["Hard"].Patrol["ITEMS_TO_DROP"] = items;
|
||||
gifterBot.BotDifficulty["Impossible"].Patrol["ITEMS_TO_DROP"] = items;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user