0
0
mirror of https://github.com/sp-tarkov/modules.git synced 2025-02-13 03:30:44 -05:00

Fixed compile-time errors

This commit is contained in:
Terkoiz 2023-12-27 17:10:25 +02:00
parent 15902f7e8f
commit 4da61ffb64
9 changed files with 26 additions and 27 deletions

View File

@ -43,13 +43,13 @@ namespace Aki.Custom.CustomAI
MakeEquipmentNotFiR(___botOwner_0); MakeEquipmentNotFiR(___botOwner_0);
// Get inventory items that hold other items (backpack/rig/pockets) // Get inventory items that hold other items (backpack/rig/pockets)
List<Slot> containerGear = ___botOwner_0.Profile.Inventory.Equipment.GetContainerSlots(); IReadOnlyList<Slot> containerGear = ___botOwner_0.Profile.Inventory.Equipment.ContainerSlots;
foreach (var container in containerGear) foreach (var container in containerGear)
{ {
foreach (var item in container.ContainedItem.GetAllItems()) foreach (var item in container.ContainedItem.GetAllItems())
{ {
// Skip items that match container (array has itself as an item) // Skip items that match container (array has itself as an item)
if (item.Id == container.Items.FirstOrDefault().Id) if (item.Id == container.Items.FirstOrDefault()?.Id)
{ {
//this.logger.LogError($"Skipping item {item.Id} {item.Name} as its same as container {container.FullId}"); //this.logger.LogError($"Skipping item {item.Id} {item.Name} as its same as container {container.FullId}");
continue; continue;
@ -82,8 +82,8 @@ namespace Aki.Custom.CustomAI
} }
// Set dogtag as FiR // Set dogtag as FiR
var dogtag = ___botOwner_0.Profile.Inventory.GetItemsInSlots(new EquipmentSlot[] { EquipmentSlot.Dogtag }); var dogtag = ___botOwner_0.Profile.Inventory.GetItemsInSlots(new EquipmentSlot[] { EquipmentSlot.Dogtag }).FirstOrDefault();
dogtag.FirstOrDefault().SpawnedInSession = true; if (dogtag != null) dogtag.SpawnedInSession = true;
} }

View File

@ -33,7 +33,7 @@ namespace Aki.Custom.Patches
var player = Singleton<GameWorld>.Instance.MainPlayer; var player = Singleton<GameWorld>.Instance.MainPlayer;
if (profileId == player?.Profile.Id) if (profileId == player?.Profile.Id)
{ {
GClass2949.Instance.CloseAllScreensForced(); GClass3104.Instance.CloseAllScreensForced();
} }
return true; return true;

View File

@ -17,8 +17,8 @@ namespace Aki.Custom.Patches
public RagfairFeePatch() public RagfairFeePatch()
{ {
// Remember to update prefix parameter if below lines are broken // Remember to update prefix parameter if below lines are broken
_ = nameof(GClass2911.IsAllSelectedItemSame); _ = nameof(GClass3066.IsAllSelectedItemSame);
_ = nameof(GClass2911.AutoSelectSimilar); _ = nameof(GClass3066.AutoSelectSimilar);
} }
protected override MethodBase GetTargetMethod() protected override MethodBase GetTargetMethod()
@ -30,18 +30,18 @@ namespace Aki.Custom.Patches
/// Calculate tax to charge player and send to server before the offer is sent /// Calculate tax to charge player and send to server before the offer is sent
/// </summary> /// </summary>
/// <param name="___item_0">Item sold</param> /// <param name="___item_0">Item sold</param>
/// <param name="___gclass2859_0">OfferItemCount</param> /// <param name="___gclass3066_0">OfferItemCount</param>
/// <param name="___double_0">RequirementsPrice</param> /// <param name="___double_0">RequirementsPrice</param>
/// <param name="___bool_0">SellInOnePiece</param> /// <param name="___bool_0">SellInOnePiece</param>
[PatchPrefix] [PatchPrefix]
private static void PatchPrefix(ref Item ___item_0, ref GClass2911 ___gclass2911_0, ref double ___double_0, ref bool ___bool_0) private static void PatchPrefix(ref Item ___item_0, ref GClass3066 ___gclass3066_0, ref double ___double_0, ref bool ___bool_0)
{ {
RequestHandler.PutJson("/client/ragfair/offerfees", new RequestHandler.PutJson("/client/ragfair/offerfees", new
{ {
id = ___item_0.Id, id = ___item_0.Id,
tpl = ___item_0.TemplateId, tpl = ___item_0.TemplateId,
count = ___gclass2911_0.OfferItemCount, count = ___gclass3066_0.OfferItemCount,
fee = Mathf.CeilToInt((float)GClass1991.CalculateTaxPrice(___item_0, ___gclass2911_0.OfferItemCount, ___double_0, ___bool_0)) fee = Mathf.CeilToInt((float)GClass2083.CalculateTaxPrice(___item_0, ___gclass3066_0.OfferItemCount, ___double_0, ___bool_0))
} }
.ToJson()); .ToJson());
} }

View File

@ -17,7 +17,7 @@ namespace Aki.Debugging.Patches
[PatchPrefix] [PatchPrefix]
private static bool PatchPreFix(ref LocalizedText ____nickName, ref TMP_Text ____standing, private static bool PatchPreFix(ref LocalizedText ____nickName, ref TMP_Text ____standing,
ref RankPanel ____rankPanel, ref Profile.GClass1675 ___gclass1675_0) ref RankPanel ____rankPanel, ref Profile.TraderInfo ___traderInfo_0)
{ {
if (____nickName.LocalizationKey == null) if (____nickName.LocalizationKey == null)
{ {
@ -37,16 +37,16 @@ namespace Aki.Debugging.Patches
return false; // skip original return false; // skip original
} }
if (___gclass1675_0?.LoyaltyLevel == null) if (___traderInfo_0?.LoyaltyLevel == null)
{ {
ConsoleScreen.LogError("This Shouldn't happen!! Please report this in discord"); ConsoleScreen.LogError("This Shouldn't happen!! Please report this in discord");
Logger.Log(LogLevel.Error, "[AKI] _gclass1618_0 or _gclass1618_0.LoyaltyLevel was null"); Logger.Log(LogLevel.Error, "[AKI] ___traderInfo_0 or ___traderInfo_0.LoyaltyLevel was null");
} }
if (___gclass1675_0?.MaxLoyaltyLevel == null) if (___traderInfo_0?.MaxLoyaltyLevel == null)
{ {
ConsoleScreen.LogError("This Shouldn't happen!! Please report this in discord"); ConsoleScreen.LogError("This Shouldn't happen!! Please report this in discord");
Logger.Log(LogLevel.Error, "[AKI] _gclass1618_0 or _gclass1618_0.MaxLoyaltyLevel was null"); Logger.Log(LogLevel.Error, "[AKI] ___traderInfo_0 or ___traderInfo_0.MaxLoyaltyLevel was null");
} }
return true; return true;

View File

@ -26,7 +26,7 @@ namespace Aki.SinglePlayer.Patches.Progression
{ {
var player = gameWorld.MainPlayer; var player = gameWorld.MainPlayer;
var questController = Traverse.Create(player).Field<QuestControllerClass>("_questController").Value; var questController = Traverse.Create(player).Field<GClass3200>("_questController").Value;
if (questController != null) if (questController != null)
{ {
foreach (var quest in questController.Quests.ToList()) foreach (var quest in questController.Quests.ToList())

View File

@ -58,7 +58,7 @@ namespace Aki.SinglePlayer.Patches.RaidFix
/// BotsPresets.GetNewProfile() /// BotsPresets.GetNewProfile()
/// </summary> /// </summary>
[PatchPrefix] [PatchPrefix]
private static bool PatchPrefix(ref Task<Profile> __result, BotsPresets __instance, List<Profile> ___list_0, GClass560 data, ref bool withDelete) private static bool PatchPrefix(ref Task<Profile> __result, BotsPresets __instance, List<Profile> ___list_0, GClass588 data, ref bool withDelete)
{ {
/* /*
When client wants new bot and GetNewProfile() return null (if not more available templates or they don't satisfy by Role and Difficulty condition) When client wants new bot and GetNewProfile() return null (if not more available templates or they don't satisfy by Role and Difficulty condition)

View File

@ -43,7 +43,7 @@ namespace Aki.SinglePlayer.Patches.RaidFix
} }
var inventoryController = Traverse.Create(player).Field<InventoryControllerClass>("_inventoryController").Value; var inventoryController = Traverse.Create(player).Field<InventoryControllerClass>("_inventoryController").Value;
GClass2636.Remove(accessCardItem, inventoryController, false, true); GClass2767.Remove(accessCardItem, inventoryController, false, true);
} }
} }
} }

View File

@ -2,7 +2,7 @@
using HarmonyLib; using HarmonyLib;
using System; using System;
using System.Reflection; using System.Reflection;
using TraderInfo = EFT.Profile.GClass1675; using EFT;
namespace Aki.SinglePlayer.Patches.RaidFix namespace Aki.SinglePlayer.Patches.RaidFix
{ {
@ -10,7 +10,7 @@ namespace Aki.SinglePlayer.Patches.RaidFix
{ {
protected override MethodBase GetTargetMethod() protected override MethodBase GetTargetMethod()
{ {
var desiredType = typeof(TraderInfo); var desiredType = typeof(Profile.TraderInfo);
var desiredMethod = desiredType.GetMethod("UpdateLevel", BindingFlags.NonPublic | BindingFlags.Instance); var desiredMethod = desiredType.GetMethod("UpdateLevel", BindingFlags.NonPublic | BindingFlags.Instance);
Logger.LogDebug($"{this.GetType().Name} Type: {desiredType?.Name}"); Logger.LogDebug($"{this.GetType().Name} Type: {desiredType?.Name}");
@ -20,7 +20,7 @@ namespace Aki.SinglePlayer.Patches.RaidFix
} }
[PatchPrefix] [PatchPrefix]
protected static void PatchPrefix(TraderInfo __instance) protected static void PatchPrefix(Profile.TraderInfo __instance)
{ {
if (__instance.Settings == null) if (__instance.Settings == null)
{ {
@ -35,8 +35,7 @@ namespace Aki.SinglePlayer.Patches.RaidFix
throw new IndexOutOfRangeException($"Loyalty level {loyaltyLevel} not found."); throw new IndexOutOfRangeException($"Loyalty level {loyaltyLevel} not found.");
} }
// Backing field of the "CurrentLoyalty" property Traverse.Create(__instance).Property("CurrentLoyalty").SetValue(loyaltyLevelSettings.Value);
Traverse.Create(__instance).Field("traderLoyaltyLevel_0").SetValue(loyaltyLevelSettings.Value);
} }
} }
} }

View File

@ -29,7 +29,7 @@ namespace Aki.SinglePlayer.Patches.ScavMode
_ = nameof(TimeAndWeatherSettings.IsRandomWeather); _ = nameof(TimeAndWeatherSettings.IsRandomWeather);
_ = nameof(BotControllerSettings.IsScavWars); _ = nameof(BotControllerSettings.IsScavWars);
_ = nameof(WavesSettings.IsBosses); _ = nameof(WavesSettings.IsBosses);
_ = GClass3004.MAX_SCAV_COUNT; // UPDATE REFS TO THIS CLASS BELOW !!! _ = GClass3163.MAX_SCAV_COUNT; // UPDATE REFS TO THIS CLASS BELOW !!!
var menuControllerType = typeof(MainMenuController); var menuControllerType = typeof(MainMenuController);
@ -118,9 +118,9 @@ namespace Aki.SinglePlayer.Patches.ScavMode
// Get fields from MainMenuController.cs // Get fields from MainMenuController.cs
var raidSettings = Traverse.Create(menuController).Field("raidSettings_0").GetValue<RaidSettings>(); var raidSettings = Traverse.Create(menuController).Field("raidSettings_0").GetValue<RaidSettings>();
var matchmakerPlayersController = Traverse.Create(menuController).Field($"{nameof(GClass3004).ToLowerInvariant()}_0").GetValue<GClass3004>(); var matchmakerPlayersController = Traverse.Create(menuController).Field($"{nameof(GClass3163).ToLowerInvariant()}_0").GetValue<GClass3163>();
var gclass = new MatchmakerOfflineRaidScreen.GClass2993(profile?.Info, ref raidSettings, matchmakerPlayersController); var gclass = new MatchmakerOfflineRaidScreen.GClass3152(profile?.Info, ref raidSettings, matchmakerPlayersController);
gclass.OnShowNextScreen += LoadOfflineRaidNextScreen; gclass.OnShowNextScreen += LoadOfflineRaidNextScreen;