-
-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #590 from sailro/dev-0.15.5.33420
[WIP] Support for upcoming SPT 3.10, using EFT 0.15.5.33420
- Loading branch information
Showing
36 changed files
with
737 additions
and
185 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,11 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Comfort.Common; | ||
using EFT.InventoryLogic; | ||
|
||
#nullable enable | ||
|
||
namespace EFT.Trainer.ConsoleCommands; | ||
|
||
internal abstract class BaseTemplateCommand : ConsoleCommandWithArgument | ||
{ | ||
public override string Pattern => RequiredArgumentPattern; | ||
|
||
protected static ItemTemplate[] FindTemplates(string searchShortNameOrTemplateId) | ||
{ | ||
if (!Singleton<ItemFactory>.Instantiated) | ||
return []; | ||
|
||
var templates = Singleton<ItemFactory> | ||
.Instance | ||
.ItemTemplates; | ||
|
||
// Match by TemplateId | ||
if (templates.TryGetValue(searchShortNameOrTemplateId, out var template)) | ||
return [template]; | ||
|
||
// Match by short name(s) | ||
return templates | ||
.Values | ||
.Where(t => t.ShortNameLocalizationKey.Localized().IndexOf(searchShortNameOrTemplateId, StringComparison.OrdinalIgnoreCase) >= 0 | ||
|| t.NameLocalizationKey.Localized().IndexOf(searchShortNameOrTemplateId, StringComparison.OrdinalIgnoreCase) >= 0) | ||
.ToArray(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using EFT.Trainer.Extensions; | ||
using EFT.Trainer.Features; | ||
using EFT.Trainer.Properties; | ||
using HarmonyLib; | ||
using JetBrains.Annotations; | ||
|
||
#nullable enable | ||
|
||
namespace EFT.Trainer.ConsoleCommands; | ||
|
||
[UsedImplicitly] | ||
internal class SpawnHideoutItems : ConsoleCommandWithoutArgument | ||
{ | ||
public override string Name => Strings.CommandSpawnHideoutItems; | ||
|
||
public override void Execute() | ||
{ | ||
var player = GameState.Current?.LocalPlayer; | ||
if (!player.IsValid()) | ||
return; | ||
|
||
var manager = player.Profile?.WishlistManager; | ||
if (manager == null) | ||
return; | ||
|
||
// Find the obfuscated method that returns the computed hidout items | ||
// We need to have the auto-add hideout items enabled in EFT settings | ||
var method = AccessTools | ||
.GetDeclaredMethods(manager.GetType()) | ||
.FirstOrDefault(m => m.ReturnType == typeof(IEnumerable<MongoID>)); | ||
|
||
if (method?.Invoke(manager, []) is not IEnumerable<MongoID> templates) | ||
return; | ||
|
||
foreach (var template in templates) | ||
Spawn.SpawnTemplate(template, player, this, i => true); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System.Linq; | ||
using Comfort.Common; | ||
using EFT.InventoryLogic; | ||
using EFT.Trainer.Properties; | ||
using JetBrains.Annotations; | ||
using UnityEngine; | ||
|
||
#nullable enable | ||
|
||
namespace EFT.Trainer.Features; | ||
|
||
[UsedImplicitly] | ||
internal class AirDrop : TriggerFeature | ||
{ | ||
public override string Name => Strings.FeatureAirDropName; | ||
public override string Description => Strings.FeatureAirDropDescription; | ||
|
||
public override KeyCode Key { get; set; } = KeyCode.None; | ||
|
||
protected override void UpdateOnceWhenTriggered() | ||
{ | ||
var player = GameState.Current?.LocalPlayer; | ||
if (player == null) | ||
return; | ||
|
||
if (TemplateHelper.FindTemplates(KnownTemplateIds.RedSignalFlare).FirstOrDefault() is not AmmoTemplate template) | ||
return; | ||
|
||
player.HandleFlareSuccessEvent(player.Transform.position, template); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.