diff --git a/.github/workflows/deploy-build.yml b/.github/workflows/deploy-build.yml index 16130fae..ae084bcf 100644 --- a/.github/workflows/deploy-build.yml +++ b/.github/workflows/deploy-build.yml @@ -12,7 +12,7 @@ jobs: permissions: contents: write id-token: write - + steps: - name: Checkout Repo uses: actions/checkout@v4 @@ -26,7 +26,7 @@ jobs: - name: Restore .NET dependencies run: dotnet restore - + # Install Node.js and semantic-release - name: Set up Node.js uses: actions/setup-node@v4 @@ -56,12 +56,11 @@ jobs: sed -i "s/{VERSION_NUMBER}/${{ steps.semantic-release.outputs.new_release_version }}/" ./S1API/S1API.cs sed -i "s/{VERSION_NUMBER}/${{ steps.semantic-release.outputs.new_release_version }}/" ./S1APILoader/S1APILoader.cs -# TODO (@MaxtorCoder): Temporarily disabling until BepInEx is building properly locally. -# - name: Run .NET build for MonoBepInEx -# run: dotnet build ./S1API.sln -c MonoBepInEx -f netstandard2.1 -# -# - name: Run .NET build for Il2CppBepInEx -# run: dotnet build ./S1API.sln -c Il2CppBepInEx -f net6.0 + - name: Run .NET build for MonoBepInEx + run: dotnet build ./S1API.sln -c MonoBepInEx -f netstandard2.1 + + - name: Run .NET build for Il2CppBepInEx + run: dotnet build ./S1API.sln -c Il2CppBepInEx -f net6.0 - name: Run .NET build for MonoMelon run: dotnet build ./S1API.sln -c MonoMelon -f netstandard2.1 @@ -71,14 +70,13 @@ jobs: - name: Build artifact zip for Thunderstore run: | - mkdir -p ./artifacts/thunderstore/Plugins - mkdir -p ./artifacts/thunderstore/Mods - cp ./S1APILoader/bin/MonoMelon/netstandard2.1/S1APILoader.dll ./artifacts/thunderstore/Plugins/S1APILoader.dll + mkdir -p ./artifacts/thunderstore/Plugins/S1API + cp ./S1APILoader/bin/MonoMelon/netstandard2.1/S1APILoader.dll ./artifacts/thunderstore/Plugins/S1APILoader.MelonLoader.dll + cp ./S1APILoader/bin/MonoBepInEx/netstandard2.1/S1APILoader.dll ./artifacts/thunderstore/Plugins/S1APILoader.BepInEx.dll cp ./S1API/bin/Il2CppMelon/net6.0/S1API.dll ./artifacts/thunderstore/Mods/S1API.Il2Cpp.MelonLoader.dll cp ./S1API/bin/MonoMelon/netstandard2.1/S1API.dll ./artifacts/thunderstore/Mods/S1API.Mono.MelonLoader.dll -# cp ./S1APILoader/bin/MonoBepInEx/netstandard2.1/S1APILoader.dll ./artifacts/thunderstore/Plugins/S1APILoader.BepInEx.dll -# cp ./S1API/bin/Il2CppMelon/net6.0/S1API.dll ./artifacts/thunderstore/Plugins/S1API/S1API.Il2Cpp.BepInEx.dll -# cp ./S1API/bin/MonoMelon/netstandard2.1/S1API.dll ./artifacts/thunderstore/Plugins/S1API/S1API.Mono.BepInEx.dll + cp ./S1API/bin/Il2CppBepInEx/net6.0/S1API.dll ./artifacts/thunderstore/Mods/S1API.Il2Cpp.BepInEx.dll + cp ./S1API/bin/MonoBepInEx/netstandard2.1/S1API.dll ./artifacts/thunderstore/Mods/S1API.Mono.BepInEx.dll - name: Publish artifact to Thunderstore uses: GreenTF/upload-thunderstore-package@v4.3 @@ -98,9 +96,9 @@ jobs: mono il2cpp libraries - + - name: Pack NuGet package run: dotnet pack ./S1API/S1API.csproj -c MonoMelon --output ./nupkg /p:PackageVersion=${{ steps.semantic-release.outputs.new_release_version }} - name: Push to NuGet Gallery - run: dotnet nuget push ./nupkg/*.nupkg --api-key ${{ secrets.NUGET_TOKEN }} --source https://api.nuget.org/v3/index.json \ No newline at end of file + run: dotnet nuget push ./nupkg/*.nupkg --api-key ${{ secrets.NUGET_TOKEN }} --source https://api.nuget.org/v3/index.json diff --git a/.github/workflows/verify-build.yml b/.github/workflows/verify-build.yml index 1cdef91b..d50326d3 100644 --- a/.github/workflows/verify-build.yml +++ b/.github/workflows/verify-build.yml @@ -13,30 +13,29 @@ jobs: build: name: Verify Successful Build runs-on: ubuntu-latest - + steps: - name: Checkout Repo uses: actions/checkout@v4 - + - name: Clone Game Assemblies run: | git clone https://x-access-token:${{ secrets.GH_PAT }}@github.com/KaBooMa/ScheduleOneAssemblies.git ./ScheduleOneAssemblies - + - name: Setup .NET uses: actions/setup-dotnet@v4 - + - name: Restore .NET Dependencies run: dotnet restore - -# TODO (@MaxtorCoder): Temporarily disabling until BepInEx is building properly locally. -# - name: Run .NET build for MonoBepInEx -# run: dotnet build ./S1API.sln -c MonoBepInEx -f netstandard2.1 -# -# - name: Run .NET build for Il2CppBepInEx -# run: dotnet build ./S1API.sln -c Il2CppBepInEx -f net6.0 + + - name: Run .NET build for MonoBepInEx + run: dotnet build ./S1API.sln -c MonoBepInEx -f netstandard2.1 + + - name: Run .NET build for Il2CppBepInEx + run: dotnet build ./S1API.sln -c Il2CppBepInEx -f net6.0 - name: Run .NET build for MonoMelon run: dotnet build ./S1API.sln -c MonoMelon -f netstandard2.1 - name: Run .NET build for Il2CppMelon - run: dotnet build ./S1API.sln -c Il2CppMelon -f net6.0 \ No newline at end of file + run: dotnet build ./S1API.sln -c Il2CppMelon -f net6.0 diff --git a/S1API/Conditionals/SystemTriggerEntry.cs b/S1API/Conditionals/SystemTriggerEntry.cs new file mode 100644 index 00000000..44281914 --- /dev/null +++ b/S1API/Conditionals/SystemTriggerEntry.cs @@ -0,0 +1,137 @@ +#if (IL2CPPMELON) +using S1Quests = Il2CppScheduleOne.Quests; +using S1Variables = Il2CppScheduleOne.Variables; +using static Il2CppScheduleOne.Quests.QuestManager; +#elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) +using S1Quests = ScheduleOne.Quests; +using S1Variables = ScheduleOne.Variables; +using static ScheduleOne.Quests.QuestManager; +#endif + +using System; +using S1API.Internal.Abstraction; +using S1API.Internal.Utils; +using S1API.PhoneCalls.Constants; +using S1API.Quests; +using S1API.Quests.Constants; + +namespace S1API.Conditions +{ + /// + /// @TODO: DOCS + /// + public class SystemTriggerEntry + { + /// + /// INTERNAL: The stored reference to the system trigger in-game. + /// + internal readonly S1Quests.SystemTrigger S1SystemTrigger; + + /// + /// An action called when the is true + /// + public event Action OnEvaluateTrue + { + add => EventHelper.AddListener(value, S1SystemTrigger.onEvaluateTrue); + remove => EventHelper.RemoveListener(value, S1SystemTrigger.onEvaluateTrue); + } + + /// + /// An action called when the is false + /// + public event Action OnEvaluateFalse + { + add => EventHelper.AddListener(value, S1SystemTrigger.onEvaluateFalse); + remove => EventHelper.RemoveListener(value, S1SystemTrigger.onEvaluateFalse); + } + + /// + /// INTERNAL: Creates a system trigger from an in-game system trigger instance. + /// + /// + internal SystemTriggerEntry(S1Quests.SystemTrigger systemTrigger) + { + S1SystemTrigger = systemTrigger; + + // Set any null values, blame runtime coding setting all of these items to null :/ + S1SystemTrigger.Conditions = new S1Variables.Conditions(); + S1SystemTrigger.Conditions.ConditionList ??= Array.Empty(); + S1SystemTrigger.Conditions.QuestConditionList ??= Array.Empty(); + + S1SystemTrigger.onEvaluateTrueVariableSetters ??= Array.Empty(); + S1SystemTrigger.onEvaluateFalseVariableSetters ??= Array.Empty(); + + S1SystemTrigger.onEvaluateTrueQuestSetters ??= Array.Empty(); + S1SystemTrigger.onEvaluateFalseQuestSetters ??= Array.Empty(); + } + + /// + /// Creates a instance + /// + /// The condition to use + /// The variable to use + /// The new value for this variable + public void AddVariableSetter(EvaluationType evaluation, string variableName, string newValue) + { + S1Variables.VariableSetter variableSetter = new S1Variables.VariableSetter + { + VariableName = variableName, + NewValue = newValue + }; + + switch (evaluation) + { + case EvaluationType.PassOnTrue: + S1SystemTrigger.onEvaluateTrueVariableSetters = S1SystemTrigger.onEvaluateTrueVariableSetters.AddItemToArray(variableSetter); + break; + case EvaluationType.PassOnFalse: + S1SystemTrigger.onEvaluateFalseVariableSetters = S1SystemTrigger.onEvaluateFalseVariableSetters.AddItemToArray(variableSetter); + break; + } + } + + /// + /// Creates a instance + /// + /// The condition to use + /// The instance to use for this condition + /// (Optional) The state of the quest + /// (Optional) The state of the quest entry + public void AddQuestSetter(EvaluationType evaluation, Quest questData, + QuestAction? questAction = null, Tuple? questEntryState = null) + { + S1Quests.QuestStateSetter questStateSetter = new S1Quests.QuestStateSetter + { + QuestName = questData.S1Quest.Title, + }; + + if (questAction.HasValue) + { + questStateSetter.SetQuestState = true; + questStateSetter.QuestState = (EQuestAction)questAction.Value; + } + + if (questEntryState != null) + { + questStateSetter.SetQuestEntryState = true; + questStateSetter.QuestEntryIndex = questEntryState.Item1; + questStateSetter.QuestEntryState = (S1Quests.EQuestState)questEntryState.Item2; + } + + switch (evaluation) + { + case EvaluationType.PassOnTrue: + S1SystemTrigger.onEvaluateTrueQuestSetters = S1SystemTrigger.onEvaluateTrueQuestSetters.AddItemToArray(questStateSetter); + break; + case EvaluationType.PassOnFalse: + S1SystemTrigger.onEvaluateFalseQuestSetters = S1SystemTrigger.onEvaluateFalseQuestSetters.AddItemToArray(questStateSetter); + break; + } + } + + /// + /// Trigger the conditions for evaluation + /// + public void Trigger() => S1SystemTrigger.Trigger(); + } +} diff --git a/S1API/Console/ConsoleHelper.cs b/S1API/Console/ConsoleHelper.cs index f1239090..0544df16 100644 --- a/S1API/Console/ConsoleHelper.cs +++ b/S1API/Console/ConsoleHelper.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppSystem.Collections.Generic; using static Il2CppScheduleOne.Console; #else @@ -31,4 +31,4 @@ public static void RunCashCommand(int amount) command.Execute(args); } } -} \ No newline at end of file +} diff --git a/S1API/DeadDrops/DeadDropInstance.cs b/S1API/DeadDrops/DeadDropInstance.cs index 91c57942..20b877de 100644 --- a/S1API/DeadDrops/DeadDropInstance.cs +++ b/S1API/DeadDrops/DeadDropInstance.cs @@ -1,6 +1,6 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using S1Economy = Il2CppScheduleOne.Economy; -#elif (MONOMELON || MONOBEPINEX) +#elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) using S1Economy = ScheduleOne.Economy; #endif @@ -20,19 +20,19 @@ public class DeadDropInstance : IGUIDReference /// INTERNAL: Stores a reference to the game dead drop instance. /// internal readonly S1Economy.DeadDrop S1DeadDrop; - + /// /// The cached storage instance. /// private StorageInstance? _cachedStorage; - + /// /// INTERNAL: Instances a new dead drop from the game dead drop instance. /// /// The game dead drop instance. - internal DeadDropInstance(S1Economy.DeadDrop deadDrop) => + internal DeadDropInstance(S1Economy.DeadDrop deadDrop) => S1DeadDrop = deadDrop; - + /// /// INTERNAL: Gets a dead drop from a GUID value. /// @@ -40,23 +40,23 @@ internal DeadDropInstance(S1Economy.DeadDrop deadDrop) => /// internal static DeadDropInstance? GetFromGUID(string guid) => DeadDropManager.All.FirstOrDefault(deadDrop => deadDrop.GUID == guid); - + /// /// The unique identifier assigned for this dead drop. /// - public string GUID => + public string GUID => S1DeadDrop.GUID.ToString(); /// /// The storage container associated with this dead drop. /// - public StorageInstance Storage => + public StorageInstance Storage => _cachedStorage ??= new StorageInstance(S1DeadDrop.Storage); - + /// /// The world position of the dead drop. /// - public Vector3 Position => + public Vector3 Position => S1DeadDrop.transform.position; } } diff --git a/S1API/DeadDrops/DeadDropManager.cs b/S1API/DeadDrops/DeadDropManager.cs index e162f337..f4fc8b47 100644 --- a/S1API/DeadDrops/DeadDropManager.cs +++ b/S1API/DeadDrops/DeadDropManager.cs @@ -1,6 +1,6 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using S1Economy = Il2CppScheduleOne.Economy; -#elif (MONOMELON || MONOBEPINEX) +#elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) using S1Economy = ScheduleOne.Economy; #endif @@ -16,7 +16,7 @@ public class DeadDropManager /// /// Gets all dead drops in the scene. /// - public static DeadDropInstance[] All => + public static DeadDropInstance[] All => S1Economy.DeadDrop.DeadDrops.ToArray() .Select(deadDrop => new DeadDropInstance(deadDrop)).ToArray(); } } diff --git a/S1API/Entities/NPC.cs b/S1API/Entities/NPC.cs index 6cfea9e9..818185e6 100644 --- a/S1API/Entities/NPC.cs +++ b/S1API/Entities/NPC.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using S1DevUtilities = Il2CppScheduleOne.DevUtilities; using S1Interaction = Il2CppScheduleOne.Interaction; using S1Messaging = Il2CppScheduleOne.Messaging; @@ -13,8 +13,7 @@ using S1Vehicles = Il2CppScheduleOne.Vehicles; using S1Vision = Il2CppScheduleOne.Vision; using S1NPCs = Il2CppScheduleOne.NPCs; -using Il2CppSystem.Collections.Generic; -#elif (MONOMELON || MONOBEPINEX) +#elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) using S1DevUtilities = ScheduleOne.DevUtilities; using S1Interaction = ScheduleOne.Interaction; using S1Messaging = ScheduleOne.Messaging; @@ -29,6 +28,11 @@ using S1Vehicles = ScheduleOne.Vehicles; using S1Vision = ScheduleOne.Vision; using S1NPCs = ScheduleOne.NPCs; +#endif + +#if (IL2CPPBEPINEX || IL2CPPMELON) +using Il2CppSystem.Collections.Generic; +#else using System.Collections.Generic; #endif @@ -54,12 +58,12 @@ public abstract class NPC : Saveable, IEntity, IHealth // Protected members intended to be used by modders. // Intended to be used from within the class / derived classes ONLY. #region Protected Members - + /// /// A list of text responses you've added to your NPC. /// protected readonly System.Collections.Generic.List Responses = new System.Collections.Generic.List(); - + /// /// Base constructor for a new NPC. /// Not intended for instancing your NPC! @@ -70,18 +74,18 @@ public abstract class NPC : Saveable, IEntity, IHealth /// The last name for your NPC. /// The icon for your NPC for messages, realationships, etc. protected NPC( - string id, - string? firstName, - string? lastName, + string id, + string? firstName, + string? lastName, Sprite? icon = null ) { IsCustomNPC = true; gameObject = new GameObject(); - + // Deactivate game object til we're done gameObject.SetActive(false); - + // Setup the base NPC class S1NPC = gameObject.AddComponent(); S1NPC.FirstName = firstName; @@ -93,22 +97,22 @@ protected NPC( // ReSharper disable once UseObjectOrCollectionInitializer (IL2CPP COMPAT) S1NPC.ConversationCategories = new List(); S1NPC.ConversationCategories.Add(S1Messaging.EConversationCategory.Customer); - + // Create our MessageConversation #if (IL2CPPMELON || IL2CPPBEPINEX) S1NPC.CreateMessageConversation(); #elif (MONOMELON || MONOBEPINEX) MethodInfo createConvoMethod = AccessTools.Method(typeof(S1NPCs.NPC), "CreateMessageConversation"); createConvoMethod.Invoke(S1NPC, null); -#endif - +#endif + // Add UnityEvents for NPCHealth S1NPC.Health = gameObject.GetComponent(); S1NPC.Health.onDie = new UnityEvent(); S1NPC.Health.onKnockedOut = new UnityEvent(); S1NPC.Health.Invincible = true; S1NPC.Health.MaxHealth = 100f; - + // Awareness behaviour GameObject awarenessObject = new GameObject("NPCAwareness"); awarenessObject.transform.SetParent(gameObject.transform); @@ -122,31 +126,31 @@ protected NPC( S1NPC.awareness.onNoticedPlayerViolatingCurfew = new UnityEvent(); S1NPC.awareness.onNoticedSuspiciousPlayer = new UnityEvent(); S1NPC.awareness.Listener = gameObject.AddComponent(); - + /////// START BEHAVIOUR CODE //////// // NPCBehaviours behaviour GameObject behaviourObject = new GameObject("NPCBehaviour"); behaviourObject.transform.SetParent(gameObject.transform); S1Behaviour.NPCBehaviour behaviour = behaviourObject.AddComponent(); - + GameObject cowingBehaviourObject = new GameObject("CowingBehaviour"); cowingBehaviourObject.transform.SetParent(behaviourObject.transform); S1Behaviour.CoweringBehaviour coweringBehaviour = cowingBehaviourObject.AddComponent(); - + GameObject fleeBehaviourObject = new GameObject("FleeBehaviour"); fleeBehaviourObject.transform.SetParent(behaviourObject.transform); S1Behaviour.FleeBehaviour fleeBehaviour = fleeBehaviourObject.AddComponent(); - + behaviour.CoweringBehaviour = coweringBehaviour; behaviour.FleeBehaviour = fleeBehaviour; S1NPC.behaviour = behaviour; /////// END BEHAVIOUR CODE //////// - + // Response to actions like gunshots, drug deals, etc. GameObject responsesObject = new GameObject("NPCResponses"); responsesObject.transform.SetParent(gameObject.transform); S1NPC.awareness.Responses = responsesObject.AddComponent(); - + // Vision cone object and behaviour GameObject visionObject = new GameObject("VisionCone"); visionObject.transform.SetParent(gameObject.transform); @@ -156,11 +160,11 @@ protected NPC( state = S1PlayerScripts.PlayerVisualState.EVisualState.PettyCrime, RequiredNoticeTime = 0.1f }); S1NPC.awareness.VisionCone = visionCone; - - + + // Suspicious ? icon in world space S1NPC.awareness.VisionCone.QuestionMarkPopup = gameObject.AddComponent(); - + // Interaction behaviour #if (IL2CPPMELON || IL2CPPBEPINEX) S1NPC.intObj = gameObject.AddComponent(); @@ -168,38 +172,38 @@ protected NPC( FieldInfo intObjField = AccessTools.Field(typeof(S1NPCs.NPC), "intObj"); intObjField.SetValue(S1NPC, gameObject.AddComponent()); #endif - + // Relationship data S1NPC.RelationData = new S1Relation.NPCRelationData(); // Inventory behaviour S1NPCs.NPCInventory inventory = gameObject.AddComponent(); - + // Pickpocket behaviour inventory.PickpocketIntObj = gameObject.AddComponent(); - + // Defaulting to the local player for Avatar TODO: Change S1NPC.Avatar = S1AvatarFramework.MugshotGenerator.Instance.MugshotRig; - + // Enable our custom gameObjects so they can initialize gameObject.SetActive(true); - + All.Add(this); } - + /// /// Called when a response is loaded from the save file. /// Override this method for attaching your callbacks to your methods. /// /// The response that was loaded. protected virtual void OnResponseLoaded(Response response) { } - + #endregion - + // Public members intended to be used by modders. // Can be used inside your derived class, or outside via instance reference. #region Public Members - + /// /// INTERNAL: Tracking for the GameObject associated with this NPC. /// Not intended for use by modders! @@ -214,7 +218,7 @@ public Vector3 Position get => gameObject.transform.position; set => S1NPC.Movement.Warp(value); } - + /// /// The transform of the NPC. /// Please do not set the properties of this transform. @@ -226,7 +230,7 @@ public Vector3 Position /// List of all NPCs within the base game and modded. /// public static readonly System.Collections.Generic.List All = new System.Collections.Generic.List(); - + /// /// The first name of this NPC. /// @@ -235,7 +239,7 @@ public string FirstName get => S1NPC.FirstName; set => S1NPC.FirstName = value; } - + /// /// The last name of this NPC. /// @@ -244,14 +248,14 @@ public string LastName get => S1NPC.LastName; set => S1NPC.LastName = value; } - + /// /// The full name of this NPC. /// If there is no last name, it will just return the first name. /// - public string FullName => + public string FullName => S1NPC.fullName; - + /// /// The unique identifier to assign to this NPC. /// Used when saving and loading. Probably other things within the base game code. @@ -270,7 +274,7 @@ public Sprite Icon get => S1NPC.MugshotSprite; set => S1NPC.MugshotSprite = value; } - + /// /// Whether the NPC is currently conscious or not. /// @@ -294,13 +298,13 @@ public Sprite Icon /// public bool IsPanicking => S1NPC.IsPanicked; - + /// /// Whether the NPC is currently unsettled or not. /// public bool IsUnsettled => S1NPC.isUnsettled; - + /// /// UNCONFIRMED: Whether the NPC is currently visible to the player or not. /// If you confirm this, please let us know so we can update the documentation! @@ -321,9 +325,9 @@ public float Aggressiveness /// The region the NPC is associated with. /// Note: Not the region they're in currently. Just the region they're designated to. /// - public Region Region => + public Region Region => (Region)S1NPC.Region; - + /// /// UNCONFIRMED: How long the NPC will panic for. /// If you confirm this, please let us know so we can update the documentation! @@ -348,7 +352,7 @@ public float Scale /// public bool IsKnockedOut => S1NPC.Health.IsKnockedOut; - + /// /// UNCONFIRMED: Whether the NPC requires the region unlocked in order to deal to. /// If you confirm this, please let us know so we can update the documentation! @@ -358,13 +362,13 @@ public bool RequiresRegionUnlocked get => (bool)_requiresRegionUnlockedField.GetValue(S1NPC)!; set => _panicField.SetValue(S1NPC, value); } - + // TODO: Add CurrentBuilding (currently missing NPCEnterableBuilding abstraction) // public ??? CurrentBuilding { get; set; } - + // TODO: Add CurrentVehicle (currently missing LandVehicle abstraction) // public ??? CurrentVehicle { get; set; } - + // TODO: Add Inventory (currently missing NPCInventory abstraction) // public ??? Inventory { get; set; } @@ -412,7 +416,7 @@ public void Damage(int amount) { if (amount <= 0) return; - + S1NPC.Health.TakeDamage(amount, true); } @@ -443,7 +447,7 @@ public void Kill() => /// Length of time they should stay unsettled. public void Unsettle(float duration) => _unsettleMethod.Invoke(S1NPC, new object[] { duration }); - + /// /// Smoothly scales the NPC over lerpTime. /// @@ -477,37 +481,37 @@ public void KnockOut() => /// The position to travel to. public void Goto(Vector3 position) => S1NPC.Movement.SetDestination(position); - + // TODO: Add OnEnterVehicle listener (currently missing LandVehicle abstraction) // public event Action OnEnterVehicle { } - + // TODO: Add OnExitVehicle listener (currently missing LandVehicle abstraction) // public event Action OnExitVehicle { } - + // TODO: Add OnExplosionHeard listener (currently missing NoiseEvent abstraction) // public event Action OnExplosionHeard { } - + // TODO: Add OnGunshotHeard listener (currently missing NoiseEvent abstraction) // public event Action OnGunshotHeard { } - + // TODO: Add OnHitByCar listener (currently missing LandVehicle abstraction) // public event Action OnHitByCar { } - + // TODO: Add OnNoticedDrugDealing listener (currently missing Player abstraction) // public event Action OnNoticedDrugDealing { } - + // TODO: Add OnNoticedGeneralCrime listener (currently missing Player abstraction) // public event Action OnNoticedGeneralCrime { } - + // TODO: Add OnNoticedPettyCrime listener (currently missing Player abstraction) // public event Action OnNoticedPettyCrime { } - + // TODO: Add OnPlayerViolatingCurfew listener (currently missing Player abstraction) // public event Action OnPlayerViolatingCurfew { } - + // TODO: Add OnNoticedSuspiciousPlayer listener (currently missing Player abstraction) // public event Action OnNoticedSuspiciousPlayer { } - + /// /// Called when the NPC died. /// @@ -516,7 +520,7 @@ public event Action OnDeath add => EventHelper.AddListener(value, S1NPC.Health.onDie); remove => EventHelper.RemoveListener(value, S1NPC.Health.onDie); } - + /// /// Called when the NPC's inventory contents change. /// @@ -525,7 +529,7 @@ public event Action OnInventoryChanged add => EventHelper.AddListener(value, S1NPC.Inventory.onContentsChanged); remove => EventHelper.RemoveListener(value, S1NPC.Inventory.onContentsChanged); } - + /// /// Sends a text message from this NPC to the players. /// Supports responses with callbacks for additional logic. @@ -538,22 +542,22 @@ public void SendTextMessage(string message, Response[]? responses = null, float { S1NPC.SendTextMessage(message); S1NPC.MSGConversation.ClearResponses(); - + if (responses == null || responses.Length == 0) return; Responses.Clear(); - + List responsesList = new List(); - + foreach (Response response in responses) { Responses.Add(response); responsesList.Add(response.S1Response); } - + S1NPC.MSGConversation.ShowResponses( - responsesList, + responsesList, responseDelay, network ); @@ -568,18 +572,18 @@ public void SendTextMessage(string message, Response[]? responses = null, float /// public static NPC? Get() => All.FirstOrDefault(npc => npc.GetType() == typeof(T)); - + #endregion // Internal members used by S1API. // Please do not attempt to use these members! #region Internal Members - + /// /// INTERNAL: Reference to the NPC on the S1 side. /// internal readonly S1NPCs.NPC S1NPC; - + /// /// INTERNAL: Constructor used for base game NPCs. /// @@ -604,29 +608,29 @@ internal override void CreateInternal() Responses.Add(response); OnResponseLoaded(response); } - + base.CreateInternal(); } - + internal override void SaveInternal(string folderPath, ref List extraSaveables) { string npcPath = Path.Combine(folderPath, S1NPC.SaveFolderName); base.SaveInternal(npcPath, ref extraSaveables); } #endregion - + // Private members used by the NPC class. // Please do not attempt to use these members! #region Private Members - + internal readonly bool IsCustomNPC; - + private readonly FieldInfo _panicField = AccessTools.Field(typeof(S1NPCs.NPC), "PANIC_DURATION"); private readonly FieldInfo _requiresRegionUnlockedField = AccessTools.Field(typeof(S1NPCs.NPC), "RequiresRegionUnlocked"); - + private readonly MethodInfo _unsettleMethod = AccessTools.Method(typeof(S1NPCs.NPC), "SetUnsettled"); private readonly MethodInfo _removePanicMethod = AccessTools.Method(typeof(S1NPCs.NPC), "RemovePanicked"); #endregion } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/DanSamwell.cs b/S1API/Entities/NPCs/DanSamwell.cs index 45170f06..7b51d4d2 100644 --- a/S1API/Entities/NPCs/DanSamwell.cs +++ b/S1API/Entities/NPCs/DanSamwell.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class DanSamwell : NPC { internal DanSamwell() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "dan_samwell")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Docks/AnnaChesterfield.cs b/S1API/Entities/NPCs/Docks/AnnaChesterfield.cs index 8941322d..f86f89fc 100644 --- a/S1API/Entities/NPCs/Docks/AnnaChesterfield.cs +++ b/S1API/Entities/NPCs/Docks/AnnaChesterfield.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class AnnaChesterfield : NPC { internal AnnaChesterfield() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "anna_chesterfield")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Docks/BillyKramer.cs b/S1API/Entities/NPCs/Docks/BillyKramer.cs index 4c103ba5..a27d069f 100644 --- a/S1API/Entities/NPCs/Docks/BillyKramer.cs +++ b/S1API/Entities/NPCs/Docks/BillyKramer.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -15,4 +15,4 @@ public class BillyKramer : NPC { internal BillyKramer() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "billy_kramer")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Docks/CrankyFrank.cs b/S1API/Entities/NPCs/Docks/CrankyFrank.cs index d8bbd5db..606593d0 100644 --- a/S1API/Entities/NPCs/Docks/CrankyFrank.cs +++ b/S1API/Entities/NPCs/Docks/CrankyFrank.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class CrankyFrank : NPC { internal CrankyFrank() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "cranky_frank")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Docks/GenghisBarn.cs b/S1API/Entities/NPCs/Docks/GenghisBarn.cs index 0a015cf0..fa97929b 100644 --- a/S1API/Entities/NPCs/Docks/GenghisBarn.cs +++ b/S1API/Entities/NPCs/Docks/GenghisBarn.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class GenghisBarn : NPC { internal GenghisBarn() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "genghis_barn")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Docks/JaneLucero.cs b/S1API/Entities/NPCs/Docks/JaneLucero.cs index 3d041ac9..523e034a 100644 --- a/S1API/Entities/NPCs/Docks/JaneLucero.cs +++ b/S1API/Entities/NPCs/Docks/JaneLucero.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class JaneLucero : NPC { internal JaneLucero() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "jane_lucero")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Docks/JavierPerez.cs b/S1API/Entities/NPCs/Docks/JavierPerez.cs index a5bd941e..8163af7b 100644 --- a/S1API/Entities/NPCs/Docks/JavierPerez.cs +++ b/S1API/Entities/NPCs/Docks/JavierPerez.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class JavierPerez : NPC { internal JavierPerez() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "javier_perez")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Docks/LisaGardener.cs b/S1API/Entities/NPCs/Docks/LisaGardener.cs index 0e87ae8e..dd8b42e8 100644 --- a/S1API/Entities/NPCs/Docks/LisaGardener.cs +++ b/S1API/Entities/NPCs/Docks/LisaGardener.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class LisaGardener : NPC { internal LisaGardener() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "lisa_gardener")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Docks/MacCooper.cs b/S1API/Entities/NPCs/Docks/MacCooper.cs index ec01cc86..c4bdb013 100644 --- a/S1API/Entities/NPCs/Docks/MacCooper.cs +++ b/S1API/Entities/NPCs/Docks/MacCooper.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class MacCooper : NPC { internal MacCooper() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "mac_cooper")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Docks/MarcoBaron.cs b/S1API/Entities/NPCs/Docks/MarcoBaron.cs index 5c76f853..8e4eb0bc 100644 --- a/S1API/Entities/NPCs/Docks/MarcoBaron.cs +++ b/S1API/Entities/NPCs/Docks/MarcoBaron.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class MarcoBaron : NPC { internal MarcoBaron() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "marco_baron")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Docks/MelissaWood.cs b/S1API/Entities/NPCs/Docks/MelissaWood.cs index f60c8e1f..bbac72a9 100644 --- a/S1API/Entities/NPCs/Docks/MelissaWood.cs +++ b/S1API/Entities/NPCs/Docks/MelissaWood.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class MelissaWood : NPC { internal MelissaWood() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "melissa_wood")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Docks/SalvadorMoreno.cs b/S1API/Entities/NPCs/Docks/SalvadorMoreno.cs index 52b28808..0da716bc 100644 --- a/S1API/Entities/NPCs/Docks/SalvadorMoreno.cs +++ b/S1API/Entities/NPCs/Docks/SalvadorMoreno.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class SalvadorMoreno : NPC { internal SalvadorMoreno() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "salvador_moreno")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Downtown/BradCrosby.cs b/S1API/Entities/NPCs/Downtown/BradCrosby.cs index 3e80ad39..553480c0 100644 --- a/S1API/Entities/NPCs/Downtown/BradCrosby.cs +++ b/S1API/Entities/NPCs/Downtown/BradCrosby.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class BradCrosby : NPC { internal BradCrosby() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "brad_crosby")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Downtown/ElizabethHomley.cs b/S1API/Entities/NPCs/Downtown/ElizabethHomley.cs index 1f709e6a..309a22d0 100644 --- a/S1API/Entities/NPCs/Downtown/ElizabethHomley.cs +++ b/S1API/Entities/NPCs/Downtown/ElizabethHomley.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class ElizabethHomley : NPC { internal ElizabethHomley() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "elizabeth_homley")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Downtown/EugeneBuckley.cs b/S1API/Entities/NPCs/Downtown/EugeneBuckley.cs index 6cc2b80b..e598ed6b 100644 --- a/S1API/Entities/NPCs/Downtown/EugeneBuckley.cs +++ b/S1API/Entities/NPCs/Downtown/EugeneBuckley.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class EugeneBuckley : NPC { internal EugeneBuckley() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "eugene_buckley")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Downtown/GregFliggle.cs b/S1API/Entities/NPCs/Downtown/GregFliggle.cs index f37072ee..5cf2b476 100644 --- a/S1API/Entities/NPCs/Downtown/GregFliggle.cs +++ b/S1API/Entities/NPCs/Downtown/GregFliggle.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class GregFliggle : NPC { internal GregFliggle() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "greg_fliggle")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Downtown/JeffGilmore.cs b/S1API/Entities/NPCs/Downtown/JeffGilmore.cs index 38774f22..185ad1dc 100644 --- a/S1API/Entities/NPCs/Downtown/JeffGilmore.cs +++ b/S1API/Entities/NPCs/Downtown/JeffGilmore.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class JeffGilmore : NPC { internal JeffGilmore() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "jeff_gilmore")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Downtown/JenniferRivera.cs b/S1API/Entities/NPCs/Downtown/JenniferRivera.cs index 153638a4..0fe18257 100644 --- a/S1API/Entities/NPCs/Downtown/JenniferRivera.cs +++ b/S1API/Entities/NPCs/Downtown/JenniferRivera.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class JenniferRivera : NPC { internal JenniferRivera() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "jennifer_rivera")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Downtown/KevinOakley.cs b/S1API/Entities/NPCs/Downtown/KevinOakley.cs index 55d6f886..7a942ba3 100644 --- a/S1API/Entities/NPCs/Downtown/KevinOakley.cs +++ b/S1API/Entities/NPCs/Downtown/KevinOakley.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class KevinOakley : NPC { internal KevinOakley() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "kevin_oakley")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Downtown/LouisFourier.cs b/S1API/Entities/NPCs/Downtown/LouisFourier.cs index be7a9816..fbf8f582 100644 --- a/S1API/Entities/NPCs/Downtown/LouisFourier.cs +++ b/S1API/Entities/NPCs/Downtown/LouisFourier.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class LouisFourier : NPC { internal LouisFourier() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "louis_fourier")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Downtown/LucyPennington.cs b/S1API/Entities/NPCs/Downtown/LucyPennington.cs index 91cdb9f7..832765f2 100644 --- a/S1API/Entities/NPCs/Downtown/LucyPennington.cs +++ b/S1API/Entities/NPCs/Downtown/LucyPennington.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class LucyPennington : NPC { internal LucyPennington() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "lucy_pennington")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Downtown/PhilipWentworth.cs b/S1API/Entities/NPCs/Downtown/PhilipWentworth.cs index 2c136602..f14ec3b0 100644 --- a/S1API/Entities/NPCs/Downtown/PhilipWentworth.cs +++ b/S1API/Entities/NPCs/Downtown/PhilipWentworth.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class PhilipWentworth : NPC { internal PhilipWentworth() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "philip_wentworth")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Downtown/RandyCaulfield.cs b/S1API/Entities/NPCs/Downtown/RandyCaulfield.cs index db3c1c19..48914d63 100644 --- a/S1API/Entities/NPCs/Downtown/RandyCaulfield.cs +++ b/S1API/Entities/NPCs/Downtown/RandyCaulfield.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class RandyCaulfield : NPC { internal RandyCaulfield() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "randy_caulfield")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/IgorRomanovich.cs b/S1API/Entities/NPCs/IgorRomanovich.cs index 8ee77af1..cb440ca3 100644 --- a/S1API/Entities/NPCs/IgorRomanovich.cs +++ b/S1API/Entities/NPCs/IgorRomanovich.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class IgorRomanovich : NPC { internal IgorRomanovich() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "igor_romanovich")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/MannyOakfield.cs b/S1API/Entities/NPCs/MannyOakfield.cs index 928e373b..87331be5 100644 --- a/S1API/Entities/NPCs/MannyOakfield.cs +++ b/S1API/Entities/NPCs/MannyOakfield.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class MannyOakfield : NPC { internal MannyOakfield() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "manny_oakfield")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Northtown/AlbertHoover.cs b/S1API/Entities/NPCs/Northtown/AlbertHoover.cs index 23a30f0b..a740d58f 100644 --- a/S1API/Entities/NPCs/Northtown/AlbertHoover.cs +++ b/S1API/Entities/NPCs/Northtown/AlbertHoover.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class AlbertHoover : NPC { internal AlbertHoover() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "albert_hoover")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Northtown/AustinSteiner.cs b/S1API/Entities/NPCs/Northtown/AustinSteiner.cs index 2daa4e34..1587d7ea 100644 --- a/S1API/Entities/NPCs/Northtown/AustinSteiner.cs +++ b/S1API/Entities/NPCs/Northtown/AustinSteiner.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class AustinSteiner : NPC { internal AustinSteiner() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "austin_steiner")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Northtown/BenjiColeman.cs b/S1API/Entities/NPCs/Northtown/BenjiColeman.cs index 35b1deb6..504fb88a 100644 --- a/S1API/Entities/NPCs/Northtown/BenjiColeman.cs +++ b/S1API/Entities/NPCs/Northtown/BenjiColeman.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -17,4 +17,4 @@ public class BenjiColeman : NPC { internal BenjiColeman() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "benji_coleman")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Northtown/BethPenn.cs b/S1API/Entities/NPCs/Northtown/BethPenn.cs index 31914721..46602c11 100644 --- a/S1API/Entities/NPCs/Northtown/BethPenn.cs +++ b/S1API/Entities/NPCs/Northtown/BethPenn.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class BethPenn : NPC { internal BethPenn() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "beth_penn")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Northtown/ChloeBowers.cs b/S1API/Entities/NPCs/Northtown/ChloeBowers.cs index a4989c5a..8d32e57a 100644 --- a/S1API/Entities/NPCs/Northtown/ChloeBowers.cs +++ b/S1API/Entities/NPCs/Northtown/ChloeBowers.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class ChloeBowers : NPC { internal ChloeBowers() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "chloe_bowers")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Northtown/DonnaMartin.cs b/S1API/Entities/NPCs/Northtown/DonnaMartin.cs index b745d44f..87e96d2e 100644 --- a/S1API/Entities/NPCs/Northtown/DonnaMartin.cs +++ b/S1API/Entities/NPCs/Northtown/DonnaMartin.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class DonnaMartin : NPC { internal DonnaMartin() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "donna_martin")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Northtown/GeraldinePoon.cs b/S1API/Entities/NPCs/Northtown/GeraldinePoon.cs index 9c24b6b4..47c86507 100644 --- a/S1API/Entities/NPCs/Northtown/GeraldinePoon.cs +++ b/S1API/Entities/NPCs/Northtown/GeraldinePoon.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class GeraldinePoon : NPC { internal GeraldinePoon() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "geraldine_poon")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Northtown/JessiWaters.cs b/S1API/Entities/NPCs/Northtown/JessiWaters.cs index 8b227ff1..763fd641 100644 --- a/S1API/Entities/NPCs/Northtown/JessiWaters.cs +++ b/S1API/Entities/NPCs/Northtown/JessiWaters.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class JessiWaters : NPC { internal JessiWaters() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "jessi_waters")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Northtown/KathyHenderson.cs b/S1API/Entities/NPCs/Northtown/KathyHenderson.cs index 4ac0dcfe..b49b082d 100644 --- a/S1API/Entities/NPCs/Northtown/KathyHenderson.cs +++ b/S1API/Entities/NPCs/Northtown/KathyHenderson.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class KathyHenderson : NPC { internal KathyHenderson() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "kathy_henderson")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Northtown/KyleCooley.cs b/S1API/Entities/NPCs/Northtown/KyleCooley.cs index 523dcab7..824e1e15 100644 --- a/S1API/Entities/NPCs/Northtown/KyleCooley.cs +++ b/S1API/Entities/NPCs/Northtown/KyleCooley.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class KyleCooley : NPC { internal KyleCooley() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "kyle_cooley")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Northtown/LudwigMeyer.cs b/S1API/Entities/NPCs/Northtown/LudwigMeyer.cs index 21653c19..977d7b8e 100644 --- a/S1API/Entities/NPCs/Northtown/LudwigMeyer.cs +++ b/S1API/Entities/NPCs/Northtown/LudwigMeyer.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class LudwigMeyer : NPC { internal LudwigMeyer() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "ludwig_meyer")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Northtown/MickLubbin.cs b/S1API/Entities/NPCs/Northtown/MickLubbin.cs index 8ab5f9b6..5c283887 100644 --- a/S1API/Entities/NPCs/Northtown/MickLubbin.cs +++ b/S1API/Entities/NPCs/Northtown/MickLubbin.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class MickLubbin : NPC { internal MickLubbin() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "mick_lubbin")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Northtown/Ming.cs b/S1API/Entities/NPCs/Northtown/Ming.cs index ea1e1721..d2c59d84 100644 --- a/S1API/Entities/NPCs/Northtown/Ming.cs +++ b/S1API/Entities/NPCs/Northtown/Ming.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class Ming : NPC { internal Ming() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "ming")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Northtown/PeggyMyers.cs b/S1API/Entities/NPCs/Northtown/PeggyMyers.cs index ae7660a3..b9af550c 100644 --- a/S1API/Entities/NPCs/Northtown/PeggyMyers.cs +++ b/S1API/Entities/NPCs/Northtown/PeggyMyers.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class PeggyMyers : NPC { internal PeggyMyers() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "peggy_myers")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Northtown/PeterFile.cs b/S1API/Entities/NPCs/Northtown/PeterFile.cs index 6ae508d7..a285a1db 100644 --- a/S1API/Entities/NPCs/Northtown/PeterFile.cs +++ b/S1API/Entities/NPCs/Northtown/PeterFile.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class PeterFile : NPC { internal PeterFile() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "peter_file")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Northtown/SamThompson.cs b/S1API/Entities/NPCs/Northtown/SamThompson.cs index 4f349c23..548c3f69 100644 --- a/S1API/Entities/NPCs/Northtown/SamThompson.cs +++ b/S1API/Entities/NPCs/Northtown/SamThompson.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class SamThompson : NPC { internal SamThompson() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "sam_thompson")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/OscarHolland.cs b/S1API/Entities/NPCs/OscarHolland.cs index 3349bf8b..ce8e963d 100644 --- a/S1API/Entities/NPCs/OscarHolland.cs +++ b/S1API/Entities/NPCs/OscarHolland.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -15,4 +15,4 @@ public class OscarHolland : NPC { internal OscarHolland() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "oscar_holland")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/PoliceOfficers/OfficerBailey.cs b/S1API/Entities/NPCs/PoliceOfficers/OfficerBailey.cs index 46fb882f..787d2c86 100644 --- a/S1API/Entities/NPCs/PoliceOfficers/OfficerBailey.cs +++ b/S1API/Entities/NPCs/PoliceOfficers/OfficerBailey.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -15,4 +15,4 @@ public class OfficerBailey : NPC { internal OfficerBailey() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "officerbailey")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/PoliceOfficers/OfficerCooper.cs b/S1API/Entities/NPCs/PoliceOfficers/OfficerCooper.cs index 64555f6a..4bf3d9ab 100644 --- a/S1API/Entities/NPCs/PoliceOfficers/OfficerCooper.cs +++ b/S1API/Entities/NPCs/PoliceOfficers/OfficerCooper.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -15,4 +15,4 @@ public class OfficerCooper : NPC { internal OfficerCooper() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "officercooper")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/PoliceOfficers/OfficerGreen.cs b/S1API/Entities/NPCs/PoliceOfficers/OfficerGreen.cs index 1757e3c2..1200e427 100644 --- a/S1API/Entities/NPCs/PoliceOfficers/OfficerGreen.cs +++ b/S1API/Entities/NPCs/PoliceOfficers/OfficerGreen.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -15,4 +15,4 @@ public class OfficerGreen : NPC { internal OfficerGreen() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "officergreen")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/PoliceOfficers/OfficerHoward.cs b/S1API/Entities/NPCs/PoliceOfficers/OfficerHoward.cs index a2866ec7..c91a35d7 100644 --- a/S1API/Entities/NPCs/PoliceOfficers/OfficerHoward.cs +++ b/S1API/Entities/NPCs/PoliceOfficers/OfficerHoward.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -15,4 +15,4 @@ public class OfficerHoward : NPC { internal OfficerHoward() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "officerhoward")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/PoliceOfficers/OfficerJackson.cs b/S1API/Entities/NPCs/PoliceOfficers/OfficerJackson.cs index f07628da..664f61ba 100644 --- a/S1API/Entities/NPCs/PoliceOfficers/OfficerJackson.cs +++ b/S1API/Entities/NPCs/PoliceOfficers/OfficerJackson.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -15,4 +15,4 @@ public class OfficerJackson : NPC { internal OfficerJackson() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "officerjackson")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/PoliceOfficers/OfficerLee.cs b/S1API/Entities/NPCs/PoliceOfficers/OfficerLee.cs index 4048acab..6340fc3d 100644 --- a/S1API/Entities/NPCs/PoliceOfficers/OfficerLee.cs +++ b/S1API/Entities/NPCs/PoliceOfficers/OfficerLee.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -15,4 +15,4 @@ public class OfficerLee : NPC { internal OfficerLee() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "officerlee")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/PoliceOfficers/OfficerLopez.cs b/S1API/Entities/NPCs/PoliceOfficers/OfficerLopez.cs index f98ec696..b3af5ea0 100644 --- a/S1API/Entities/NPCs/PoliceOfficers/OfficerLopez.cs +++ b/S1API/Entities/NPCs/PoliceOfficers/OfficerLopez.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -15,4 +15,4 @@ public class OfficerLopez : NPC { internal OfficerLopez() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "officerlopez")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/PoliceOfficers/OfficerMurphy.cs b/S1API/Entities/NPCs/PoliceOfficers/OfficerMurphy.cs index 69cf7610..ab65fe91 100644 --- a/S1API/Entities/NPCs/PoliceOfficers/OfficerMurphy.cs +++ b/S1API/Entities/NPCs/PoliceOfficers/OfficerMurphy.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -15,4 +15,4 @@ public class OfficerMurphy : NPC { internal OfficerMurphy() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "officermurphy")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/PoliceOfficers/OfficerOakley.cs b/S1API/Entities/NPCs/PoliceOfficers/OfficerOakley.cs index 61a2159a..6c26584f 100644 --- a/S1API/Entities/NPCs/PoliceOfficers/OfficerOakley.cs +++ b/S1API/Entities/NPCs/PoliceOfficers/OfficerOakley.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -15,4 +15,4 @@ public class OfficerOakley : NPC { internal OfficerOakley() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "officeroakley")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/StanCarney.cs b/S1API/Entities/NPCs/StanCarney.cs index 196975e1..6cd74f3f 100644 --- a/S1API/Entities/NPCs/StanCarney.cs +++ b/S1API/Entities/NPCs/StanCarney.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class StanCarney : NPC { internal StanCarney() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "stan_carney")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Suburbia/AlisonKnight.cs b/S1API/Entities/NPCs/Suburbia/AlisonKnight.cs index b8023319..5aa4c5b8 100644 --- a/S1API/Entities/NPCs/Suburbia/AlisonKnight.cs +++ b/S1API/Entities/NPCs/Suburbia/AlisonKnight.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class AlisonKnight : NPC { internal AlisonKnight() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "alison_knight")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Suburbia/CarlBundy.cs b/S1API/Entities/NPCs/Suburbia/CarlBundy.cs index 663e1a59..c1195607 100644 --- a/S1API/Entities/NPCs/Suburbia/CarlBundy.cs +++ b/S1API/Entities/NPCs/Suburbia/CarlBundy.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class CarlBundy : NPC { internal CarlBundy() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "carl_bundy")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Suburbia/ChrisSullivan.cs b/S1API/Entities/NPCs/Suburbia/ChrisSullivan.cs index 0360fc4f..7c9297b7 100644 --- a/S1API/Entities/NPCs/Suburbia/ChrisSullivan.cs +++ b/S1API/Entities/NPCs/Suburbia/ChrisSullivan.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class ChrisSullivan : NPC { internal ChrisSullivan() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "chris_sullivan")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Suburbia/DennisKennedy.cs b/S1API/Entities/NPCs/Suburbia/DennisKennedy.cs index df287efb..89214bff 100644 --- a/S1API/Entities/NPCs/Suburbia/DennisKennedy.cs +++ b/S1API/Entities/NPCs/Suburbia/DennisKennedy.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class DennisKennedy : NPC { internal DennisKennedy() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "dennis_kennedy")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Suburbia/HankStevenson.cs b/S1API/Entities/NPCs/Suburbia/HankStevenson.cs index ea0bf972..2162a336 100644 --- a/S1API/Entities/NPCs/Suburbia/HankStevenson.cs +++ b/S1API/Entities/NPCs/Suburbia/HankStevenson.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class HankStevenson : NPC { internal HankStevenson() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "hank_stevenson")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Suburbia/HaroldColt.cs b/S1API/Entities/NPCs/Suburbia/HaroldColt.cs index e7442eb4..f450b6d6 100644 --- a/S1API/Entities/NPCs/Suburbia/HaroldColt.cs +++ b/S1API/Entities/NPCs/Suburbia/HaroldColt.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class HaroldColt : NPC { internal HaroldColt() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "harold_colt")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Suburbia/JackKnight.cs b/S1API/Entities/NPCs/Suburbia/JackKnight.cs index 36dbac8a..8dce26a0 100644 --- a/S1API/Entities/NPCs/Suburbia/JackKnight.cs +++ b/S1API/Entities/NPCs/Suburbia/JackKnight.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class JackKnight : NPC { internal JackKnight() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "jack_knight")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Suburbia/JackieStevenson.cs b/S1API/Entities/NPCs/Suburbia/JackieStevenson.cs index 76cee8c9..0386020e 100644 --- a/S1API/Entities/NPCs/Suburbia/JackieStevenson.cs +++ b/S1API/Entities/NPCs/Suburbia/JackieStevenson.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class JackieStevenson : NPC { internal JackieStevenson() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "jackie_stevenson")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Suburbia/JeremyWilkinson.cs b/S1API/Entities/NPCs/Suburbia/JeremyWilkinson.cs index 3ff5a30f..f61a3f0a 100644 --- a/S1API/Entities/NPCs/Suburbia/JeremyWilkinson.cs +++ b/S1API/Entities/NPCs/Suburbia/JeremyWilkinson.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class JeremyWilkinson : NPC { internal JeremyWilkinson() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "jeremy_wilkinson")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Suburbia/KarenKennedy.cs b/S1API/Entities/NPCs/Suburbia/KarenKennedy.cs index c6a0d6d9..77a1bcc1 100644 --- a/S1API/Entities/NPCs/Suburbia/KarenKennedy.cs +++ b/S1API/Entities/NPCs/Suburbia/KarenKennedy.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -17,4 +17,4 @@ public class KarenKennedy : NPC { internal KarenKennedy() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "karen_kennedy")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Suburbia/WeiLong.cs b/S1API/Entities/NPCs/Suburbia/WeiLong.cs index 2e82f1e9..c36a91e2 100644 --- a/S1API/Entities/NPCs/Suburbia/WeiLong.cs +++ b/S1API/Entities/NPCs/Suburbia/WeiLong.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class WeiLong : NPC { internal WeiLong() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "wei_long")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/UncleNelson.cs b/S1API/Entities/NPCs/UncleNelson.cs index 99cd30e5..9a5fcb23 100644 --- a/S1API/Entities/NPCs/UncleNelson.cs +++ b/S1API/Entities/NPCs/UncleNelson.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -15,4 +15,4 @@ public class UncleNelson : NPC { internal UncleNelson() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "uncle_nelson")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Uptown/FionaHancock.cs b/S1API/Entities/NPCs/Uptown/FionaHancock.cs index 0829fdb9..6325996c 100644 --- a/S1API/Entities/NPCs/Uptown/FionaHancock.cs +++ b/S1API/Entities/NPCs/Uptown/FionaHancock.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -17,4 +17,4 @@ public class FionaHancock : NPC { internal FionaHancock() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "fiona_hancock")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Uptown/HerbertBleuball.cs b/S1API/Entities/NPCs/Uptown/HerbertBleuball.cs index 9c34e326..b651a179 100644 --- a/S1API/Entities/NPCs/Uptown/HerbertBleuball.cs +++ b/S1API/Entities/NPCs/Uptown/HerbertBleuball.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -17,4 +17,4 @@ public class HerbertBleuball : NPC { internal HerbertBleuball() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "herbert_bleuball")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Uptown/JenHeard.cs b/S1API/Entities/NPCs/Uptown/JenHeard.cs index 9cf9ea11..db42f7ed 100644 --- a/S1API/Entities/NPCs/Uptown/JenHeard.cs +++ b/S1API/Entities/NPCs/Uptown/JenHeard.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -17,4 +17,4 @@ public class JenHeard : NPC { internal JenHeard() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "jen_heard")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Uptown/LeoRivers.cs b/S1API/Entities/NPCs/Uptown/LeoRivers.cs index d5fd88ea..02238e74 100644 --- a/S1API/Entities/NPCs/Uptown/LeoRivers.cs +++ b/S1API/Entities/NPCs/Uptown/LeoRivers.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -17,4 +17,4 @@ public class LeoRivers : NPC { internal LeoRivers() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "leo_rivers")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Uptown/LilyTurner.cs b/S1API/Entities/NPCs/Uptown/LilyTurner.cs index 3a26941e..4b63e18c 100644 --- a/S1API/Entities/NPCs/Uptown/LilyTurner.cs +++ b/S1API/Entities/NPCs/Uptown/LilyTurner.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -17,4 +17,4 @@ public class LilyTurner : NPC { internal LilyTurner() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "lily_turner")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Uptown/MichaelBoog.cs b/S1API/Entities/NPCs/Uptown/MichaelBoog.cs index 20798227..0e36017b 100644 --- a/S1API/Entities/NPCs/Uptown/MichaelBoog.cs +++ b/S1API/Entities/NPCs/Uptown/MichaelBoog.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -17,4 +17,4 @@ public class MichaelBoog : NPC { internal MichaelBoog() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "michael_boog")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Uptown/PearlMoore.cs b/S1API/Entities/NPCs/Uptown/PearlMoore.cs index 85075c02..01d17570 100644 --- a/S1API/Entities/NPCs/Uptown/PearlMoore.cs +++ b/S1API/Entities/NPCs/Uptown/PearlMoore.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -17,4 +17,4 @@ public class PearlMoore : NPC { internal PearlMoore() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "pearl_moore")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Uptown/RayHoffman.cs b/S1API/Entities/NPCs/Uptown/RayHoffman.cs index 3c5c6fc0..9dd7d83d 100644 --- a/S1API/Entities/NPCs/Uptown/RayHoffman.cs +++ b/S1API/Entities/NPCs/Uptown/RayHoffman.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -17,4 +17,4 @@ public class RayHoffman : NPC { internal RayHoffman() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "ray_hoffman")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Uptown/TobiasWentworth.cs b/S1API/Entities/NPCs/Uptown/TobiasWentworth.cs index 91064578..26f1cbcd 100644 --- a/S1API/Entities/NPCs/Uptown/TobiasWentworth.cs +++ b/S1API/Entities/NPCs/Uptown/TobiasWentworth.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -17,4 +17,4 @@ public class TobiasWentworth : NPC { internal TobiasWentworth() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "tobias_wentworth")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Uptown/WalterCussler.cs b/S1API/Entities/NPCs/Uptown/WalterCussler.cs index b870e8b7..11e363b6 100644 --- a/S1API/Entities/NPCs/Uptown/WalterCussler.cs +++ b/S1API/Entities/NPCs/Uptown/WalterCussler.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -17,4 +17,4 @@ public class WalterCussler : NPC { internal WalterCussler() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "walter_cussler")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Westville/CharlesRowland.cs b/S1API/Entities/NPCs/Westville/CharlesRowland.cs index 4c78605c..b74064b1 100644 --- a/S1API/Entities/NPCs/Westville/CharlesRowland.cs +++ b/S1API/Entities/NPCs/Westville/CharlesRowland.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class CharlesRowland : NPC { internal CharlesRowland() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "charles_rowland")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Westville/DeanWebster.cs b/S1API/Entities/NPCs/Westville/DeanWebster.cs index 381083bf..46967489 100644 --- a/S1API/Entities/NPCs/Westville/DeanWebster.cs +++ b/S1API/Entities/NPCs/Westville/DeanWebster.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class DeanWebster : NPC { internal DeanWebster() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "dean_webster")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Westville/DorisLubbin.cs b/S1API/Entities/NPCs/Westville/DorisLubbin.cs index 03ea2f64..48467959 100644 --- a/S1API/Entities/NPCs/Westville/DorisLubbin.cs +++ b/S1API/Entities/NPCs/Westville/DorisLubbin.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class DorisLubbin : NPC { internal DorisLubbin() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "doris_lubbin")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Westville/GeorgeGreene.cs b/S1API/Entities/NPCs/Westville/GeorgeGreene.cs index 31cebf2f..292a52fa 100644 --- a/S1API/Entities/NPCs/Westville/GeorgeGreene.cs +++ b/S1API/Entities/NPCs/Westville/GeorgeGreene.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class GeorgeGreene : NPC { internal GeorgeGreene() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "george_greene")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Westville/JerryMontero.cs b/S1API/Entities/NPCs/Westville/JerryMontero.cs index dd1ec080..41ce9ea4 100644 --- a/S1API/Entities/NPCs/Westville/JerryMontero.cs +++ b/S1API/Entities/NPCs/Westville/JerryMontero.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class JerryMontero : NPC { internal JerryMontero() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "jerry_montero")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Westville/JoyceBall.cs b/S1API/Entities/NPCs/Westville/JoyceBall.cs index c8b67a71..2a417a2b 100644 --- a/S1API/Entities/NPCs/Westville/JoyceBall.cs +++ b/S1API/Entities/NPCs/Westville/JoyceBall.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class JoyceBall : NPC { internal JoyceBall() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "joyce_ball")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Westville/KeithWagner.cs b/S1API/Entities/NPCs/Westville/KeithWagner.cs index 31c2a76e..8bc74432 100644 --- a/S1API/Entities/NPCs/Westville/KeithWagner.cs +++ b/S1API/Entities/NPCs/Westville/KeithWagner.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class KeithWagner : NPC { internal KeithWagner() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "keith_wagner")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Westville/KimDelaney.cs b/S1API/Entities/NPCs/Westville/KimDelaney.cs index 91d54980..ea526407 100644 --- a/S1API/Entities/NPCs/Westville/KimDelaney.cs +++ b/S1API/Entities/NPCs/Westville/KimDelaney.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class KimDelaney : NPC { internal KimDelaney() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "kim_delaney")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Westville/MegCooley.cs b/S1API/Entities/NPCs/Westville/MegCooley.cs index d3123ec1..6c283f68 100644 --- a/S1API/Entities/NPCs/Westville/MegCooley.cs +++ b/S1API/Entities/NPCs/Westville/MegCooley.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class MegCooley : NPC { internal MegCooley() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "meg_cooley")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Westville/MollyPresley.cs b/S1API/Entities/NPCs/Westville/MollyPresley.cs index 82c26c84..9aceb389 100644 --- a/S1API/Entities/NPCs/Westville/MollyPresley.cs +++ b/S1API/Entities/NPCs/Westville/MollyPresley.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class MollyPresley : NPC { internal MollyPresley() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "molly_presley")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Westville/ShirleyWatts.cs b/S1API/Entities/NPCs/Westville/ShirleyWatts.cs index 16f044da..15f1096c 100644 --- a/S1API/Entities/NPCs/Westville/ShirleyWatts.cs +++ b/S1API/Entities/NPCs/Westville/ShirleyWatts.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class ShirleyWatts : NPC { internal ShirleyWatts() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "shirley_watts")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/NPCs/Westville/TrentSherman.cs b/S1API/Entities/NPCs/Westville/TrentSherman.cs index 5536466e..94850e52 100644 --- a/S1API/Entities/NPCs/Westville/TrentSherman.cs +++ b/S1API/Entities/NPCs/Westville/TrentSherman.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.NPCs; #else using ScheduleOne.NPCs; @@ -16,4 +16,4 @@ public class TrentSherman : NPC { internal TrentSherman() : base(NPCManager.NPCRegistry.ToArray().First(n => n.ID == "trent_sherman")) { } } -} \ No newline at end of file +} diff --git a/S1API/Entities/Player.cs b/S1API/Entities/Player.cs index 835bcf82..22551b0d 100644 --- a/S1API/Entities/Player.cs +++ b/S1API/Entities/Player.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using S1PlayerScripts = Il2CppScheduleOne.PlayerScripts; using S1Health = Il2CppScheduleOne.PlayerScripts.Health; #else @@ -28,17 +28,17 @@ public class Player : IEntity, IHealth /// Hence, why we're doing it this way :). /// private const float InvincibleHealth = 1000000000f; - + /// /// The standard MAX_HEALTH of a player. /// private const float MortalHealth = 100f; - + /// /// All players currently in the game. /// public static readonly List All = new List(); - + /// /// INTERNAL: Tracking of the S1 instance of the player. /// @@ -87,7 +87,7 @@ public Vector3 Position get => ((IEntity)this).gameObject.transform.position; set => ((IEntity)this).gameObject.transform.position = value; } - + /// /// The transform of the player. /// Please do not set the properties of the Transform. @@ -137,7 +137,7 @@ public bool IsInvincible S1Player.Health.SetHealth(MaxHealth); } } - + /// /// Revives the player. /// @@ -152,7 +152,7 @@ public void Damage(int amount) { if (amount <= 0) return; - + S1Player.Health.TakeDamage(amount); } @@ -164,7 +164,7 @@ public void Heal(int amount) { if (amount <= 0) return; - + S1Player.Health.SetHealth(CurrentHealth + amount); } @@ -182,7 +182,7 @@ public event Action OnDeath add => EventHelper.AddListener(value, S1Player.Health.onDie); remove => EventHelper.RemoveListener(value, S1Player.Health.onDie); } - + /// /// INTERNAL: Field access for the MAX_HEALTH const. /// diff --git a/S1API/GameTime/GameDateTime.cs b/S1API/GameTime/GameDateTime.cs index 643ce06e..8dcbfa43 100644 --- a/S1API/GameTime/GameDateTime.cs +++ b/S1API/GameTime/GameDateTime.cs @@ -1,8 +1,8 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using S1GameDateTime = Il2CppScheduleOne.GameTime.GameDateTime; using S1TimeManager = Il2CppScheduleOne.GameTime.TimeManager; using S1GameDateTimeData = Il2CppScheduleOne.Persistence.Datas.GameDateTimeData; -#elif (MONOMELON || MONOBEPINEX) +#elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) using S1GameDateTime = ScheduleOne.GameTime.GameDateTime; using S1TimeManager = ScheduleOne.GameTime.TimeManager; using S1GameDateTimeData = ScheduleOne.Persistence.Datas.GameDateTimeData; @@ -147,4 +147,4 @@ public override string ToString() return a.GetMinSum() < b.GetMinSum(); } } -} \ No newline at end of file +} diff --git a/S1API/GameTime/TimeManager.cs b/S1API/GameTime/TimeManager.cs index e3670802..700d40a7 100644 --- a/S1API/GameTime/TimeManager.cs +++ b/S1API/GameTime/TimeManager.cs @@ -1,6 +1,6 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using S1GameTime = Il2CppScheduleOne.GameTime; -#elif (MONOMELON || MONOBEPINEX) +#elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) using S1GameTime = ScheduleOne.GameTime; #endif @@ -29,7 +29,7 @@ public static class TimeManager public static Action OnSleepStart = delegate { }; /// - /// Called when the player finishes sleeping. + /// Called when the player finishes sleeping. /// Parameter: total minutes skipped during sleep. /// public static Action OnSleepEnd = delegate { }; diff --git a/S1API/Internal/Abstraction/GUIDReferenceConverter.cs b/S1API/Internal/Abstraction/GUIDReferenceConverter.cs index 88c8796c..5ff5a0b2 100644 --- a/S1API/Internal/Abstraction/GUIDReferenceConverter.cs +++ b/S1API/Internal/Abstraction/GUIDReferenceConverter.cs @@ -63,4 +63,4 @@ public override void WriteJson(JsonWriter writer, object? value, JsonSerializer /// public override bool CanRead => true; } -} \ No newline at end of file +} diff --git a/S1API/Internal/Abstraction/Saveable.cs b/S1API/Internal/Abstraction/Saveable.cs index e40d390a..12a5fdf7 100644 --- a/S1API/Internal/Abstraction/Saveable.cs +++ b/S1API/Internal/Abstraction/Saveable.cs @@ -22,9 +22,9 @@ public abstract class Saveable : Registerable, ISaveable /// /// TODO /// - void ISaveable.LoadInternal(string folderPath) => + void ISaveable.LoadInternal(string folderPath) => LoadInternal(folderPath); - + /// /// TODO /// @@ -33,87 +33,85 @@ internal virtual void LoadInternal(string folderPath) FieldInfo[] saveableFields = GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo saveableField in saveableFields) { - SaveableField? saveableFieldAttribute = saveableField.GetCustomAttribute(); - if (saveableFieldAttribute == null) - continue; - - string filename = saveableFieldAttribute.SaveName.EndsWith(".json") - ? saveableFieldAttribute.SaveName - : $"{saveableFieldAttribute.SaveName}.json"; - - string saveDataPath = Path.Combine(folderPath, filename); - if (!File.Exists(saveDataPath)) - continue; - - string json = File.ReadAllText(saveDataPath); - Type type = saveableField.FieldType; - object? value = JsonConvert.DeserializeObject(json, type, ISaveable.SerializerSettings); - saveableField.SetValue(this, value); + SaveableField? saveableFieldAttribute = saveableField.GetCustomAttribute(); + if (saveableFieldAttribute == null) + continue; + + string filename = saveableFieldAttribute.SaveName.EndsWith(".json") + ? saveableFieldAttribute.SaveName + : $"{saveableFieldAttribute.SaveName}.json"; + + string saveDataPath = Path.Combine(folderPath, filename); + if (!File.Exists(saveDataPath)) + continue; + + string json = File.ReadAllText(saveDataPath); + Type type = saveableField.FieldType; + object? value = JsonConvert.DeserializeObject(json, type, ISaveable.SerializerSettings); + saveableField.SetValue(this, value); } OnLoaded(); } - + /// /// TODO /// - void ISaveable.SaveInternal(string folderPath, ref List extraSaveables) => + void ISaveable.SaveInternal(string folderPath, ref List extraSaveables) => SaveInternal(folderPath, ref extraSaveables); - + /// /// TODO /// internal virtual void SaveInternal(string folderPath, ref List extraSaveables) { - FieldInfo[] saveableFields = ReflectionUtils.GetAllFields(GetType(), BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); - foreach (FieldInfo saveableField in saveableFields) - { - SaveableField? saveableFieldAttribute = saveableField.GetCustomAttribute(); - if (saveableFieldAttribute == null) - continue; - - string saveFileName = saveableFieldAttribute.SaveName.EndsWith(".json") - ? saveableFieldAttribute.SaveName - : $"{saveableFieldAttribute.SaveName}.json"; - - string saveDataPath = Path.Combine(folderPath, saveFileName); - - object? value = saveableField.GetValue(this); - if (value == null) - // Remove the save if the field is null - File.Delete(saveDataPath); - else - { - // We add this to the extra saveables to prevent the game from deleting it - // Otherwise, it'll delete it after it finishes saving and does clean up - extraSaveables.Add(saveFileName); - - // Write our data - string data = JsonConvert.SerializeObject(value, Formatting.Indented, ISaveable.SerializerSettings); - File.WriteAllText(saveDataPath, data); - } - } - - OnSaved(); + FieldInfo[] saveableFields = ReflectionUtils.GetAllFields(GetType(), BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); + foreach (FieldInfo saveableField in saveableFields) + { + SaveableField? saveableFieldAttribute = saveableField.GetCustomAttribute(); + if (saveableFieldAttribute == null) + continue; + + string saveFileName = saveableFieldAttribute.SaveName.EndsWith(".json") + ? saveableFieldAttribute.SaveName + : $"{saveableFieldAttribute.SaveName}.json"; + + string saveDataPath = Path.Combine(folderPath, saveFileName); + + object? value = saveableField.GetValue(this); + if (value == null) + // Remove the save if the field is null + File.Delete(saveDataPath); + else + { + // We add this to the extra saveables to prevent the game from deleting it + // Otherwise, it'll delete it after it finishes saving and does clean up + extraSaveables.Add(saveFileName); + + // Write our data + string data = JsonConvert.SerializeObject(value, Formatting.Indented, ISaveable.SerializerSettings); + File.WriteAllText(saveDataPath, data); + } + } + + OnSaved(); } - + /// /// TODO /// - void ISaveable.OnLoaded() => - OnLoaded(); + void ISaveable.OnLoaded() => OnLoaded(); /// /// TODO /// protected virtual void OnLoaded() { } - + /// /// TODO /// - void ISaveable.OnSaved() => - OnSaved(); - + void ISaveable.OnSaved() => OnSaved(); + /// /// TODO /// diff --git a/S1API/Internal/Patches/HomeScreen.Start.cs b/S1API/Internal/Patches/HomeScreen.Start.cs index be76234d..8d97d913 100644 --- a/S1API/Internal/Patches/HomeScreen.Start.cs +++ b/S1API/Internal/Patches/HomeScreen.Start.cs @@ -6,7 +6,7 @@ using S1API.PhoneApp; using S1API.Logging; -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.UI.Phone; #else using ScheduleOne.UI.Phone; @@ -41,6 +41,8 @@ static void Postfix(HomeScreen __instance) var phoneApps = ReflectionUtils.GetDerivedClasses(); foreach (var type in phoneApps) { + Logger.Msg($"Found phone app: {type.FullName}"); + if (type.GetConstructor(Type.EmptyTypes) == null) continue; @@ -58,4 +60,4 @@ static void Postfix(HomeScreen __instance) } } } -} \ No newline at end of file +} diff --git a/S1API/Internal/Patches/NPCPatches.cs b/S1API/Internal/Patches/NPCPatches.cs index 0c06a5bf..ac2db7a9 100644 --- a/S1API/Internal/Patches/NPCPatches.cs +++ b/S1API/Internal/Patches/NPCPatches.cs @@ -1,10 +1,14 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using S1Loaders = Il2CppScheduleOne.Persistence.Loaders; using S1NPCs = Il2CppScheduleOne.NPCs; -using Il2CppSystem.Collections.Generic; -#elif (MONOMELON || MONOBEPINEX) +#elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) using S1Loaders = ScheduleOne.Persistence.Loaders; using S1NPCs = ScheduleOne.NPCs; +#endif + +#if (IL2CPPMELON || IL2CPPBEPINEX) +using Il2CppSystem.Collections.Generic; +#elif (MONOMELON || MONOBEPINEX) using System.Collections.Generic; #endif @@ -42,7 +46,7 @@ private static void NPCsLoadersLoad(S1Loaders.NPCsLoader __instance, string main // We skip any S1API NPCs, as they are base NPC wrappers. if (type.Assembly == Assembly.GetExecutingAssembly()) continue; - + string npcPath = Path.Combine(mainPath, customNPC.S1NPC.SaveFolderName); customNPC.LoadInternal(npcPath); } @@ -54,9 +58,9 @@ private static void NPCsLoadersLoad(S1Loaders.NPCsLoader __instance, string main /// Instance of the NPC [HarmonyPatch(typeof(S1NPCs.NPC), "Start")] [HarmonyPostfix] - private static void NPCStart(S1NPCs.NPC __instance) => + private static void NPCStart(S1NPCs.NPC __instance) => NPC.All.FirstOrDefault(npc => npc.IsCustomNPC && npc.S1NPC == __instance)?.CreateInternal(); - + /// /// Patching performed for when an NPC calls to save data. @@ -68,7 +72,7 @@ private static void NPCStart(S1NPCs.NPC __instance) => [HarmonyPostfix] private static void NPCWriteData(S1NPCs.NPC __instance, string parentFolderPath, ref List __result) => NPC.All.FirstOrDefault(npc => npc.IsCustomNPC && npc.S1NPC == __instance)?.SaveInternal(parentFolderPath, ref __result); - + /// /// Patching performed for when an NPC is destroyed. /// diff --git a/S1API/Internal/Patches/PlayerPatches.cs b/S1API/Internal/Patches/PlayerPatches.cs index 79395e16..49ae1228 100644 --- a/S1API/Internal/Patches/PlayerPatches.cs +++ b/S1API/Internal/Patches/PlayerPatches.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using S1PlayerScripts = Il2CppScheduleOne.PlayerScripts; #else using S1PlayerScripts = ScheduleOne.PlayerScripts; @@ -36,4 +36,4 @@ private static void PlayerAwake(S1PlayerScripts.Player __instance) => private static void PlayerOnDestroy(S1PlayerScripts.Player __instance) => Player.All.Remove(Player.All.First(player => player.S1Player == __instance)); } -} \ No newline at end of file +} diff --git a/S1API/Internal/Patches/QuestPatches.cs b/S1API/Internal/Patches/QuestPatches.cs index 035bbe64..b5e062dc 100644 --- a/S1API/Internal/Patches/QuestPatches.cs +++ b/S1API/Internal/Patches/QuestPatches.cs @@ -1,12 +1,16 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using S1Loaders = Il2CppScheduleOne.Persistence.Loaders; using S1Datas = Il2CppScheduleOne.Persistence.Datas; using S1Quests = Il2CppScheduleOne.Quests; -using Il2CppSystem.Collections.Generic; -#elif (MONOMELON || MONOBEPINEX) +#elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) using S1Loaders = ScheduleOne.Persistence.Loaders; using S1Datas = ScheduleOne.Persistence.Datas; using S1Quests = ScheduleOne.Quests; +#endif + +#if (IL2CPPMELON || IL2CPPBEPINEX) +using Il2CppSystem.Collections.Generic; +#elif (MONOMELON || MONOBEPINEX) using System.Collections.Generic; #endif @@ -39,11 +43,11 @@ internal class QuestPatches private static void QuestManagerWriteData(S1Quests.QuestManager __instance, string parentFolderPath, ref List __result) { string questsPath = Path.Combine(parentFolderPath, "Quests"); - + foreach (Quest quest in QuestManager.Quests) quest.SaveInternal(questsPath, ref __result); } - + /// /// Patching performed for when all quests are loaded. /// @@ -56,7 +60,7 @@ private static void QuestsLoaderLoad(S1Loaders.QuestsLoader __instance, string m // Make sure we have a quests directory (fresh saves don't at this point in runtime) if (!Directory.Exists(mainPath)) return; - + string[] questDirectories = Directory.GetDirectories(mainPath) .Select(Path.GetFileName) .Where(directory => directory != null && directory.StartsWith("Quest_")) @@ -108,10 +112,10 @@ private static void QuestManagerDeleteUnapprovedFiles(S1Quests.QuestManager __in foreach (string unapprovedQuestDirectory in unapprovedQuestDirectories) Directory.Delete(unapprovedQuestDirectory, true); } - + [HarmonyPatch(typeof(S1Quests.Quest), "Start")] [HarmonyPrefix] - private static void QuestStart(S1Quests.Quest __instance) => + private static void QuestStart(S1Quests.Quest __instance) => QuestManager.Quests.FirstOrDefault(quest => quest.S1Quest == __instance)?.CreateInternal(); /////// TODO: Quests doesn't have OnDestroy. Find another way to clean up @@ -123,7 +127,7 @@ private static void QuestStart(S1Quests.Quest __instance) => // NPC? npc = NPCs.FirstOrDefault(npc => npc.S1NPC == __instance); // if (npc == null) // return; - // + // // // npc.OnDestroyed(); // NPCs.Remove(npc); // } diff --git a/S1API/Internal/Patches/TimePatches.cs b/S1API/Internal/Patches/TimePatches.cs index 32712fbe..4e2ed6a7 100644 --- a/S1API/Internal/Patches/TimePatches.cs +++ b/S1API/Internal/Patches/TimePatches.cs @@ -1,6 +1,6 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using S1GameTime = Il2CppScheduleOne.GameTime; -#elif (MONOMELON || MONOBEPINEX) +#elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) using S1GameTime = ScheduleOne.GameTime; #endif diff --git a/S1API/Internal/Utils/ArrayExtensions.cs b/S1API/Internal/Utils/ArrayExtensions.cs new file mode 100644 index 00000000..4994d1b8 --- /dev/null +++ b/S1API/Internal/Utils/ArrayExtensions.cs @@ -0,0 +1,54 @@ +#if (IL2CPPMELON || IL2CPPBEPINEX) +using Il2CppInterop.Runtime.InteropTypes.Arrays; +#endif + +using System; + +namespace S1API.Internal.Utils +{ + /// + /// Extensions for Arrays + /// + public static class ArrayExtensions + { + /// + /// Add's an item to an existing array + /// + /// + /// + /// + public static T[] AddItemToArray(this T[]? array, T item) + { + array ??= Array.Empty(); + + Array.Resize(ref array, array.Length + 1); + array[^1] = item; + + return array; + } + +#if (IL2CPPMELON || IL2CPPBEPINEX) + /// + /// Add's an item to an existing instance. + /// + /// + /// + /// + public static Il2CppReferenceArray AddItemToArray(this Il2CppReferenceArray? array, params T[]? itemsToAdd) where T : Il2CppSystem.Object + { + var originalLength = array?.Length ?? 0; + var additionalLength = itemsToAdd?.Length ?? 0; + var newLength = originalLength + additionalLength; + + var result = new Il2CppReferenceArray(newLength); + for (var i = 0; i < originalLength; i++) + result[i] = array[i]; + + for (var i = 0; i < additionalLength; i++) + result[originalLength + i] = itemsToAdd[i]; + + return result; + } +#endif + } +} diff --git a/S1API/Internal/Utils/ReflectionUtils.cs b/S1API/Internal/Utils/ReflectionUtils.cs index 664c6e7d..62403610 100644 --- a/S1API/Internal/Utils/ReflectionUtils.cs +++ b/S1API/Internal/Utils/ReflectionUtils.cs @@ -1,4 +1,5 @@ -using System; +using S1API.Logging; +using System; using System.Collections.Generic; using System.Linq; using System.Reflection; @@ -24,14 +25,17 @@ internal static List GetDerivedClasses() !assembly.FullName!.StartsWith("Il2Cpp") && !assembly.FullName!.StartsWith("mscorlib") && !assembly.FullName!.StartsWith("Mono.") && - !assembly.FullName!.StartsWith("netstandard")) + !assembly.FullName!.StartsWith("netstandard") && + // Additional filters to resolve crashes in BepInEx + !assembly.FullName!.StartsWith("com.rlabrecque") && + !assembly.FullName!.StartsWith("__Generated")) .ToArray(); foreach (Assembly assembly in applicableAssemblies) derivedClasses.AddRange(assembly.GetTypes() - .Where(type => typeof(TBaseClass).IsAssignableFrom(type) - && type != typeof(TBaseClass) + .Where(type => typeof(TBaseClass).IsAssignableFrom(type) + && type != typeof(TBaseClass) && !type.IsAbstract)); - + return derivedClasses; } @@ -48,13 +52,13 @@ internal static List GetDerivedClasses() Type? foundType = assembly.GetTypes().FirstOrDefault(type => type.Name == typeName); if (foundType == null) continue; - + return foundType; } return null; } - + /// /// INTERNAL: Recursively gets fields from a class down to the object type. /// @@ -71,7 +75,7 @@ internal static FieldInfo[] GetAllFields(Type? type, BindingFlags bindingFlags) } return fieldInfos.ToArray(); } - + /// /// INTERNAL: Recursively searches for a method by name from a class down to the object type. /// @@ -86,11 +90,11 @@ internal static FieldInfo[] GetAllFields(Type? type, BindingFlags bindingFlags) MethodInfo? method = type.GetMethod(methodName, bindingFlags); if (method != null) return method; - + type = type.BaseType; } return null; } } -} \ No newline at end of file +} diff --git a/S1API/Items/ItemDefinition.cs b/S1API/Items/ItemDefinition.cs index cff1924b..b4ba934e 100644 --- a/S1API/Items/ItemDefinition.cs +++ b/S1API/Items/ItemDefinition.cs @@ -1,6 +1,6 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using S1ItemFramework = Il2CppScheduleOne.ItemFramework; -#elif (MONOMELON || MONOBEPINEX) +#elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) using S1ItemFramework = ScheduleOne.ItemFramework; #endif @@ -19,12 +19,12 @@ public class ItemDefinition : IGUIDReference /// INTERNAL: A reference to the item definition in the game. /// internal readonly S1ItemFramework.ItemDefinition S1ItemDefinition; - + /// /// Creates a new item definition from the game item definition instance. /// /// - internal ItemDefinition(S1ItemFramework.ItemDefinition s1ItemDefinition) => + internal ItemDefinition(S1ItemFramework.ItemDefinition s1ItemDefinition) => S1ItemDefinition = s1ItemDefinition; /// @@ -34,7 +34,7 @@ internal ItemDefinition(S1ItemFramework.ItemDefinition s1ItemDefinition) => /// The applicable item definition, if found. internal static ItemDefinition GetFromGUID(string guid) => ItemManager.GetItemDefinition(guid); - + /// /// Performs an equals check on the game item definition instance. /// @@ -61,7 +61,7 @@ public override int GetHashCode() => if (ReferenceEquals(left, right)) return true; return left?.S1ItemDefinition == right?.S1ItemDefinition; } - + /// /// Performs an != check on the game item definition instance. /// @@ -70,41 +70,41 @@ public override int GetHashCode() => /// Whether the item definitions are different or not. public static bool operator !=(ItemDefinition left, ItemDefinition right) => !(left == right); - + /// /// The unique identifier assigned to this item definition. /// - public virtual string GUID => + public virtual string GUID => S1ItemDefinition.ID; /// /// The unique identifier assigned to this item definition. /// - public string ID => + public string ID => S1ItemDefinition.ID; - + /// /// The display name for this item. /// - public string Name => + public string Name => S1ItemDefinition.Name; - + /// /// The description used for this item. /// - public string Description => + public string Description => S1ItemDefinition.Description; - + /// /// The category this item is assigned to. /// - public ItemCategory Category => + public ItemCategory Category => (ItemCategory)S1ItemDefinition.Category; - + /// /// The stack limit for this item. /// - public int StackLimit => + public int StackLimit => S1ItemDefinition.StackLimit; /// @@ -112,7 +112,7 @@ public override int GetHashCode() => /// /// How many of the item the instance will have. /// A new item instance within the game. - public virtual ItemInstance CreateInstance(int quantity = 1) => + public virtual ItemInstance CreateInstance(int quantity = 1) => new ItemInstance(S1ItemDefinition.GetDefaultInstance(quantity)); } } diff --git a/S1API/Items/ItemInstance.cs b/S1API/Items/ItemInstance.cs index 2fdb7f35..3f9bb0c2 100644 --- a/S1API/Items/ItemInstance.cs +++ b/S1API/Items/ItemInstance.cs @@ -1,6 +1,6 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using S1ItemFramework = Il2CppScheduleOne.ItemFramework; -#elif (MONOMELON || MONOBEPINEX) +#elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) using S1ItemFramework = ScheduleOne.ItemFramework; #endif @@ -18,18 +18,18 @@ public class ItemInstance /// INTERNAL: The reference to the instance of this item. /// internal readonly S1ItemFramework.ItemInstance S1ItemInstance; - + /// /// INTERNAL: Creates an item instance /// /// The instance of the item instance in-game. - internal ItemInstance(S1ItemFramework.ItemInstance itemInstance) => + internal ItemInstance(S1ItemFramework.ItemInstance itemInstance) => S1ItemInstance = itemInstance; - + /// /// The item definition of this item. /// - public ItemDefinition Definition => + public ItemDefinition Definition => new ItemDefinition(S1ItemInstance.Definition); } } diff --git a/S1API/Items/ItemManager.cs b/S1API/Items/ItemManager.cs index e886c6df..44b9e8aa 100644 --- a/S1API/Items/ItemManager.cs +++ b/S1API/Items/ItemManager.cs @@ -1,8 +1,8 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using S1 = Il2CppScheduleOne; using S1ItemFramework = Il2CppScheduleOne.ItemFramework; using S1Product = Il2CppScheduleOne.Product; -#elif (MONOMELON || MONOBEPINEX) +#elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) using S1 = ScheduleOne; using S1ItemFramework = ScheduleOne.ItemFramework; using S1Product = ScheduleOne.Product; @@ -35,7 +35,7 @@ public static ItemDefinition GetItemDefinition(string itemID) if (CrossType.Is(itemDefinition, out S1ItemFramework.CashDefinition cashDefinition)) return new CashDefinition(cashDefinition); - + return new ItemDefinition(itemDefinition); } } diff --git a/S1API/Items/ItemSlotInstance.cs b/S1API/Items/ItemSlotInstance.cs index ad51429d..2a8cb245 100644 --- a/S1API/Items/ItemSlotInstance.cs +++ b/S1API/Items/ItemSlotInstance.cs @@ -1,7 +1,7 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using S1ItemFramework = Il2CppScheduleOne.ItemFramework; using S1Product = Il2CppScheduleOne.Product; -#elif (MONOMELON || MONOBEPINEX) +#elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) using S1ItemFramework = ScheduleOne.ItemFramework; using S1Product = ScheduleOne.Product; #endif @@ -22,18 +22,18 @@ public class ItemSlotInstance /// INTERNAL: The reference to the item slot in the game. /// internal readonly S1ItemFramework.ItemSlot S1ItemSlot; - + /// /// Creates an item slot instance from the in game slot. /// /// - internal ItemSlotInstance(S1ItemFramework.ItemSlot itemSlot) => + internal ItemSlotInstance(S1ItemFramework.ItemSlot itemSlot) => S1ItemSlot = itemSlot; - + /// /// The quantity of item in this slot. /// - public int Quantity => + public int Quantity => S1ItemSlot.Quantity; /// @@ -46,11 +46,11 @@ public ItemInstance? ItemInstance if (CrossType.Is(S1ItemSlot.ItemInstance, out S1Product.ProductItemInstance productItemInstance)) return new ProductInstance(productItemInstance); - + if (CrossType.Is(S1ItemSlot.ItemInstance, out S1ItemFramework.CashInstance cashInstance)) return new CashInstance(cashInstance); - + if (CrossType.Is(S1ItemSlot.ItemInstance, out S1ItemFramework.ItemInstance itemInstance)) return new ItemInstance(itemInstance); @@ -58,13 +58,13 @@ public ItemInstance? ItemInstance return null; } } - + /// /// Adds a quantity to the item in this slot. /// NOTE: Negative numbers are supported and allowed. /// /// - public void AddQuantity(int amount) => - S1ItemSlot.ChangeQuantity(amount); + public void AddQuantity(int amount) => + S1ItemSlot.ChangeQuantity(amount); } } diff --git a/S1API/Leveling/LevelManager.cs b/S1API/Leveling/LevelManager.cs index 5bbc31a1..30463441 100644 --- a/S1API/Leveling/LevelManager.cs +++ b/S1API/Leveling/LevelManager.cs @@ -1,6 +1,6 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using S1Levelling = Il2CppScheduleOne.Levelling; -#elif (MONOMELON || MONOBEPINEX) +#elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) using S1Levelling = ScheduleOne.Levelling; #endif diff --git a/S1API/Messaging/Response.cs b/S1API/Messaging/Response.cs index d0a2d021..204c208c 100644 --- a/S1API/Messaging/Response.cs +++ b/S1API/Messaging/Response.cs @@ -1,6 +1,6 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using S1Messaging = Il2CppScheduleOne.Messaging; -#elif (MONOMELON || MONOBEPINEX) +#elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) using S1Messaging = ScheduleOne.Messaging; #endif using System; @@ -16,14 +16,14 @@ public class Response /// INTERNAL: The instance of the response in-game. /// internal readonly S1Messaging.Response S1Response; - + /// /// Creates a new response for displaying in-game. /// public Response() => S1Response = new S1Messaging.Response(); - + /// - /// INTERNAL: Creates a response from the in-game response instance. + /// INTERNAL: Creates a response from the in-game response instance. /// /// internal Response(S1Messaging.Response response) => S1Response = response; @@ -36,7 +36,7 @@ public Action? OnTriggered get => S1Response.callback == null ? null : new Action(() => S1Response.callback.Invoke()); set => S1Response.callback = value; } - + /// /// The unique identifier for this response. /// @@ -45,7 +45,7 @@ public string Label get => S1Response.label; set => S1Response.label = value; } - + /// /// The text displayed in-game for the player. /// @@ -55,4 +55,4 @@ public string Text set => S1Response.text = value; } } -} \ No newline at end of file +} diff --git a/S1API/Money/CashDefinition.cs b/S1API/Money/CashDefinition.cs index 47cc026d..41c4844b 100644 --- a/S1API/Money/CashDefinition.cs +++ b/S1API/Money/CashDefinition.cs @@ -1,6 +1,6 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using S1ItemFramework = Il2CppScheduleOne.ItemFramework; -#elif (MONOMELON || MONOBEPINEX) +#elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) using S1ItemFramework = ScheduleOne.ItemFramework; #endif @@ -18,21 +18,21 @@ public class CashDefinition : ItemDefinition /// /// INTERNAL: A reference to the cash definition in-game. /// - internal S1ItemFramework.CashDefinition S1CashDefinition => + internal S1ItemFramework.CashDefinition S1CashDefinition => CrossType.As(S1ItemDefinition); - + /// /// INTERNAL: Creates a cash definition from the game cash definition. /// /// internal CashDefinition(S1ItemFramework.CashDefinition s1ItemDefinition) : base(s1ItemDefinition) { } - + /// /// Creates an instance of the cash definition in-game. /// /// /// - public override ItemInstance CreateInstance(int quantity = 1) => + public override ItemInstance CreateInstance(int quantity = 1) => new CashInstance(S1CashDefinition.GetDefaultInstance(quantity)); } } diff --git a/S1API/Money/CashInstance.cs b/S1API/Money/CashInstance.cs index a9b96e9c..28463ed5 100644 --- a/S1API/Money/CashInstance.cs +++ b/S1API/Money/CashInstance.cs @@ -1,6 +1,6 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using S1ItemFramework = Il2CppScheduleOne.ItemFramework; -#elif (MONOMELON || MONOBEPINEX) +#elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) using S1ItemFramework = ScheduleOne.ItemFramework; #endif @@ -18,28 +18,28 @@ public class CashInstance : ItemInstance /// /// INTERNAL: The reference to the instanced cash in-game. /// - internal S1ItemFramework.CashInstance S1CashInstance => + internal S1ItemFramework.CashInstance S1CashInstance => CrossType.As(S1ItemInstance); - + /// /// INTERNAL: Creates an instance of cash from the in-game item instance. /// /// internal CashInstance(S1ItemFramework.ItemInstance itemInstance) : base(itemInstance) { } - + /// /// Adds to the quantity of cash for this instance. /// NOTE: Supports negative numbers to remove. /// /// Quantity to set the cash to. - public void AddQuantity(float amount) => + public void AddQuantity(float amount) => S1CashInstance.SetBalance(Mathf.Clamp(S1CashInstance.Balance + amount, 0, float.MaxValue)); - + /// /// Sets the quantity of cash for this instance. /// /// Quantity to set the cash to. - public void SetQuantity(float newQuantity) => + public void SetQuantity(float newQuantity) => S1CashInstance.SetBalance(newQuantity); } } diff --git a/S1API/Money/Money.cs b/S1API/Money/Money.cs index d886dc5b..34e254ad 100644 --- a/S1API/Money/Money.cs +++ b/S1API/Money/Money.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne; using S1ItemFramework = Il2CppScheduleOne.ItemFramework; using S1MoneyFramework = Il2CppScheduleOne.Money; @@ -6,7 +6,6 @@ using ScheduleOne; using S1ItemFramework = ScheduleOne.ItemFramework; using S1MoneyFramework = ScheduleOne.Money; - #endif using S1API.Internal.Utils; @@ -113,7 +112,7 @@ public static void RemoveNetworthCalculation(System.Action callback) /// A newly created instance of cash with the specified balance. public static CashInstance CreateCashInstance(float amount) { -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) var cashItem = Registry.GetItem("cash"); var instance = CrossType.As(cashItem.GetDefaultInstance(1)); var cashInstance = new CashInstance(instance); diff --git a/S1API/PhoneApp/PhoneApp.cs b/S1API/PhoneApp/PhoneApp.cs index f0b426fd..9bc32ac5 100644 --- a/S1API/PhoneApp/PhoneApp.cs +++ b/S1API/PhoneApp/PhoneApp.cs @@ -1,15 +1,14 @@ -using System.IO; +using System.IO; using UnityEngine; using UnityEngine.UI; using Object = UnityEngine.Object; using S1API.Internal.Abstraction; using S1API.Internal.Patches; + #if IL2CPPMELON using Il2CppScheduleOne.UI.Phone; using MelonLoader.Utils; -#elif IL2CPPBEPINEX -using Il2CppScheduleOne.UI.Phone; -#elif MONOBEPINEX +#elif MONOBEPINEX || IL2CPPBEPINEX using ScheduleOne.UI.Phone; #elif MONOMELON using ScheduleOne.UI.Phone; @@ -143,7 +142,7 @@ protected override void OnDestroyed() /// internal void SpawnUI(HomeScreen homeScreenInstance) { - GameObject? appsCanvas = homeScreenInstance.transform.parent.Find("AppsCanvas")?.gameObject; + GameObject? appsCanvas = homeScreenInstance.transform.parent.Find("AppsCanvas")?.gameObject; if (appsCanvas == null) { Logger.Error("AppsCanvas not found."); diff --git a/S1API/PhoneCalls/CallManager.cs b/S1API/PhoneCalls/CallManager.cs new file mode 100644 index 00000000..be5f136e --- /dev/null +++ b/S1API/PhoneCalls/CallManager.cs @@ -0,0 +1,23 @@ +#if (IL2CPPMELON) +using S1Calling = Il2CppScheduleOne.Calling; +#elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) +using S1Calling = ScheduleOne.Calling; +#endif + +namespace S1API.PhoneCalls +{ + /// + /// @TODO: DOCS + /// + public static class CallManager + { + /// + /// @TODO: DOCS + /// + /// + public static void QueueCall(PhoneCallDefinition phoneCallDefinition) + { + S1Calling.CallManager.Instance.QueueCall(phoneCallDefinition.S1PhoneCallData); + } + } +} diff --git a/S1API/PhoneCalls/CallStageEntry.cs b/S1API/PhoneCalls/CallStageEntry.cs new file mode 100644 index 00000000..2d9c3acf --- /dev/null +++ b/S1API/PhoneCalls/CallStageEntry.cs @@ -0,0 +1,89 @@ +#if (IL2CPPMELON) +using S1ScriptableObjects = Il2CppScheduleOne.ScriptableObjects; +using S1Quests = Il2CppScheduleOne.Quests; +using S1Variables = Il2CppScheduleOne.Variables; +#elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) +using S1ScriptableObjects = ScheduleOne.ScriptableObjects; +using S1Quests = ScheduleOne.Quests; +using S1Variables = ScheduleOne.Variables; +#endif + +#if (MONOMELON || MONOBEPINEX) +using System.Collections.Generic; +#elif (IL2CPPMELON || IL2CPPBEPINEX) +using Il2CppSystem.Collections.Generic; +#endif + +using System; + +using S1API.Conditions; +using S1API.Internal.Utils; +using S1API.PhoneCalls.Constants; + +namespace S1API.PhoneCalls +{ + /// + /// Represents a Stage entry in a call. + /// + public class CallStageEntry + { + // ReSharper disable once MemberCanBePrivate.Global + /// + /// INTERNAL: The stored reference to the Stage entry in-game; + /// + internal readonly S1ScriptableObjects.PhoneCallData.Stage S1Stage; + + // ReSharper disable once MemberCanBePrivate.Global + /// + /// @TODO: Docs + /// + protected readonly List StartTriggerEntries = new List(); + + // ReSharper disable once MemberCanBePrivate.Global + /// + /// @TODO: Docs + /// + protected readonly List DoneTriggerEntries = new List(); + + /// + /// INTERNAL: Creates a stage entry from an in-game stage instance. + /// + /// + internal CallStageEntry(S1ScriptableObjects.PhoneCallData.Stage stage) => + S1Stage = stage; + + /// + /// The text to display in this Stage + /// + public string Text + { + get => S1Stage.Text; + set => S1Stage.Text = value; + } + + /// + /// Adds a start trigger to the instance. + /// + /// The this trigger has to be added to + /// + public SystemTriggerEntry AddSystemTrigger(SystemTriggerType triggerType) + { + S1Quests.SystemTrigger originalTrigger = new S1Quests.SystemTrigger(); + SystemTriggerEntry systemTriggerEntry = new SystemTriggerEntry(originalTrigger); + + switch (triggerType) + { + case SystemTriggerType.StartTrigger: + S1Stage.OnStartTriggers = S1Stage.OnStartTriggers.AddItemToArray(originalTrigger); + StartTriggerEntries.Add(systemTriggerEntry); + break; + case SystemTriggerType.DoneTrigger: + S1Stage.OnDoneTriggers = S1Stage.OnDoneTriggers.AddItemToArray(originalTrigger); + DoneTriggerEntries.Add(systemTriggerEntry); + break; + } + + return systemTriggerEntry; + } + } +} diff --git a/S1API/PhoneCalls/CallerDefinition.cs b/S1API/PhoneCalls/CallerDefinition.cs new file mode 100644 index 00000000..977adedd --- /dev/null +++ b/S1API/PhoneCalls/CallerDefinition.cs @@ -0,0 +1,46 @@ +#if (IL2CPPMELON) +using S1CallerID = Il2CppScheduleOne.ScriptableObjects.CallerID; +#elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) +using S1CallerID = ScheduleOne.ScriptableObjects.CallerID; +#endif + +using UnityEngine; + +namespace S1API.PhoneCalls +{ + /// + /// Represents the definition of a instance. + /// + public class CallerDefinition + { + /// + /// INTERNAL: The stored reference to the caller entry in-game + /// + internal readonly S1CallerID S1CallerIDEntry; + + /// + /// INTERNAL: Creates a caller id entry from an in-game caller id instance. + /// + /// + internal CallerDefinition(S1CallerID s1CallerID) + => S1CallerIDEntry = s1CallerID; + + /// + /// The name of the caller. + /// + public string Name + { + get => S1CallerIDEntry.Name; + set => S1CallerIDEntry.Name = value; + } + + /// + /// The profile picture of the caller. + /// + public Sprite? ProfilePicture + { + get => S1CallerIDEntry.ProfilePicture; + set => S1CallerIDEntry.ProfilePicture = value; + } + } +} diff --git a/S1API/PhoneCalls/Constants/EvaluationType.cs b/S1API/PhoneCalls/Constants/EvaluationType.cs new file mode 100644 index 00000000..8bebbf78 --- /dev/null +++ b/S1API/PhoneCalls/Constants/EvaluationType.cs @@ -0,0 +1,8 @@ +namespace S1API.PhoneCalls.Constants +{ + public enum EvaluationType + { + PassOnTrue, + PassOnFalse + } +} diff --git a/S1API/PhoneCalls/Constants/SystemTriggerType.cs b/S1API/PhoneCalls/Constants/SystemTriggerType.cs new file mode 100644 index 00000000..3e51f05e --- /dev/null +++ b/S1API/PhoneCalls/Constants/SystemTriggerType.cs @@ -0,0 +1,8 @@ +namespace S1API.PhoneCalls.Constants +{ + public enum SystemTriggerType + { + StartTrigger, + DoneTrigger + } +} diff --git a/S1API/PhoneCalls/PhoneCallDefinition.cs b/S1API/PhoneCalls/PhoneCallDefinition.cs new file mode 100644 index 00000000..b025b7b5 --- /dev/null +++ b/S1API/PhoneCalls/PhoneCallDefinition.cs @@ -0,0 +1,133 @@ +#if (IL2CPPMELON) +using S1ScriptableObjects = Il2CppScheduleOne.ScriptableObjects; +#elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) +using S1ScriptableObjects = ScheduleOne.ScriptableObjects; +#endif + +#if (MONOMELON || MONOBEPINEX) +using System.Collections.Generic; +#elif (IL2CPPMELON || IL2CPPBEPINEX) +using Il2CppSystem.Collections.Generic; +#endif + +using System; +using S1API.Entities; +using S1API.Internal.Utils; +using UnityEngine; + +namespace S1API.PhoneCalls +{ + public abstract class PhoneCallDefinition + { + // ReSharper disable once MemberCanBePrivate.Global + /// + /// The caller of the instance + /// + public CallerDefinition? Caller; + + // ReSharper disable once MemberCanBePrivate.Global + /// + /// The original instance + /// + public readonly S1ScriptableObjects.PhoneCallData S1PhoneCallData; + + // ReSharper disable once MemberCanBePrivate.Global + /// + /// A list of all stage entries added to this phone call. + /// + protected readonly List StageEntries = new List(); + + /// + /// INTERNAL: Public constructor used for instancing a new + /// + /// The name of the caller + /// The sprite of the caller + protected PhoneCallDefinition(string name, Sprite? profilePicture = null) + { + S1PhoneCallData = ScriptableObject.CreateInstance(); + S1PhoneCallData.Stages ??= Array.Empty(); + + _ = AddCallerID(name, profilePicture); + } + + /// + /// INTERNAL: Public constructor used for instancing a new + /// + /// The instance to use for the caller + protected PhoneCallDefinition(NPC? npcCallerID) + { + S1PhoneCallData = ScriptableObject.CreateInstance(); + S1PhoneCallData.Stages ??= Array.Empty(); + + _ = AddCallerID(npcCallerID); + } + + /// + /// Set's a new CallerID definition to the PhoneCall + /// + /// The name of the caller + /// The sprite of the caller + /// A reference to the CallerID definition + protected CallerDefinition AddCallerID(string name, Sprite? profilePicture = null) + { + S1ScriptableObjects.CallerID originalCallerID = ScriptableObject.CreateInstance(); + originalCallerID.Name = name; + originalCallerID.ProfilePicture = profilePicture; + S1PhoneCallData.CallerID = originalCallerID; + + Caller = new CallerDefinition(originalCallerID) + { + Name = name, + ProfilePicture = profilePicture + }; + return Caller; + } + + /// + /// Set's a new CallerID definition based of an existing instance. + /// + /// The instance to use for the caller + /// A reference to the CallerID definition + protected CallerDefinition AddCallerID(NPC? npc) + { + S1ScriptableObjects.CallerID originalCallerID = ScriptableObject.CreateInstance(); + originalCallerID.Name = npc?.FullName ?? "Unknown Caller"; + originalCallerID.ProfilePicture = npc?.Icon; + S1PhoneCallData.CallerID = originalCallerID; + + Caller = new CallerDefinition(originalCallerID) + { + Name = npc?.FullName ?? "Unknown Caller", + ProfilePicture = npc?.Icon + }; + return Caller; + } + + /// + /// Add's a instance to the + /// + /// The text to display in this stage + /// A reference to the Stage entry + protected CallStageEntry AddStage(string text) + { + S1ScriptableObjects.PhoneCallData.Stage originalStage = new S1ScriptableObjects.PhoneCallData.Stage + { + Text = text + }; + S1PhoneCallData.Stages = S1PhoneCallData.Stages.AddItemToArray(originalStage); + + CallStageEntry callStageEntry = new CallStageEntry(originalStage) + { + Text = text + }; + StageEntries.Add(callStageEntry); + + return callStageEntry; + } + + /// + /// Completes the instance. + /// + public void Completed() => S1PhoneCallData.Completed(); + } +} diff --git a/S1API/Products/CocaineDefinition.cs b/S1API/Products/CocaineDefinition.cs index 5507e6f8..24feb99f 100644 --- a/S1API/Products/CocaineDefinition.cs +++ b/S1API/Products/CocaineDefinition.cs @@ -1,7 +1,7 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.Product; using S1CocaineDefinition = Il2CppScheduleOne.Product.CocaineDefinition; -#elif (MONOMELON || MONOBEPINEX) +#elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) using ScheduleOne.Product; using S1CocaineDefinition = ScheduleOne.Product.CocaineDefinition; #endif @@ -21,7 +21,6 @@ public class CocaineDefinition : ProductDefinition /// internal S1CocaineDefinition S1CocaineDefinition => CrossType.As(S1ItemDefinition); - /// /// Creates a new cocaine product definition. diff --git a/S1API/Products/MethDefinition.cs b/S1API/Products/MethDefinition.cs index 8904a616..ee8e16d1 100644 --- a/S1API/Products/MethDefinition.cs +++ b/S1API/Products/MethDefinition.cs @@ -1,7 +1,7 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.Product; using S1MethDefinition = Il2CppScheduleOne.Product.MethDefinition; -#elif (MONOMELON || MONOBEPINEX) +#elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) using ScheduleOne.Product; using S1MethDefinition = ScheduleOne.Product.MethDefinition; #endif @@ -21,7 +21,7 @@ public class MethDefinition : ProductDefinition /// internal S1MethDefinition S1MethDefinition => CrossType.As(S1ItemDefinition); - + /// /// Creates a new meth product definition. /// diff --git a/S1API/Products/PackagingDefinition.cs b/S1API/Products/PackagingDefinition.cs index 54052293..81d6aa84 100644 --- a/S1API/Products/PackagingDefinition.cs +++ b/S1API/Products/PackagingDefinition.cs @@ -1,7 +1,7 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using S1Packaging = Il2CppScheduleOne.Product.Packaging; using S1ItemFramework = Il2CppScheduleOne.ItemFramework; -#elif (MONOMELON || MONOBEPINEX) +#elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) using S1Packaging = ScheduleOne.Product.Packaging; using S1ItemFramework = ScheduleOne.ItemFramework; #endif @@ -19,20 +19,20 @@ public class PackagingDefinition : ItemDefinition /// /// INTERNAL: A reference to the packaging definition in-game. /// - internal S1Packaging.PackagingDefinition S1PackagingDefinition => + internal S1Packaging.PackagingDefinition S1PackagingDefinition => CrossType.As(S1ItemDefinition); - + /// /// INTERNAL: Creates an instance of this packaging definition from the in-game packaging definition instance. /// /// - internal PackagingDefinition(S1ItemFramework.ItemDefinition s1ItemDefinition) : + internal PackagingDefinition(S1ItemFramework.ItemDefinition s1ItemDefinition) : base(s1ItemDefinition) { } /// /// The quantity that this packaging can hold. /// - public int Quantity => + public int Quantity => S1PackagingDefinition.Quantity; } } diff --git a/S1API/Products/ProductDefinition.cs b/S1API/Products/ProductDefinition.cs index 3c4b7fb2..09751899 100644 --- a/S1API/Products/ProductDefinition.cs +++ b/S1API/Products/ProductDefinition.cs @@ -1,8 +1,7 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppInterop.Runtime.InteropTypes; - using S1Product = Il2CppScheduleOne.Product; -#elif (MONOMELON || MONOBEPINEX) +#elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) using S1Product = ScheduleOne.Product; #endif @@ -20,27 +19,27 @@ public class ProductDefinition : ItemDefinition /// /// INTERNAL: Stored reference to the game product definition. /// - internal S1Product.ProductDefinition S1ProductDefinition => + internal S1Product.ProductDefinition S1ProductDefinition => CrossType.As(S1ItemDefinition); - + /// /// INTERNAL: Creates a product definition from the in-game product definition. /// /// internal ProductDefinition(S1Product.ProductDefinition productDefinition) : base(productDefinition) { } - + /// /// The price associated with this product. /// - public float Price => + public float Price => S1ProductDefinition.Price; - + /// /// Creates an instance of this product in-game. /// /// The quantity of product. /// An instance of the product. - public override ItemInstance CreateInstance(int quantity = 1) => + public override ItemInstance CreateInstance(int quantity = 1) => new ProductInstance(CrossType.As(S1ProductDefinition.GetDefaultInstance(quantity))); /// diff --git a/S1API/Products/ProductDefinitionWrapper.cs b/S1API/Products/ProductDefinitionWrapper.cs index 2670adca..14e904b8 100644 --- a/S1API/Products/ProductDefinitionWrapper.cs +++ b/S1API/Products/ProductDefinitionWrapper.cs @@ -1,5 +1,6 @@ using S1API.Internal.Utils; -#if (IL2CPPMELON || IL2CPPBEPINEX) + +#if (IL2CPPMELON) using S1Product = Il2CppScheduleOne.Product; #else using S1Product = ScheduleOne.Product; diff --git a/S1API/Products/ProductInstance.cs b/S1API/Products/ProductInstance.cs index f3763101..f3fd7f4b 100644 --- a/S1API/Products/ProductInstance.cs +++ b/S1API/Products/ProductInstance.cs @@ -1,6 +1,6 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using S1Product = Il2CppScheduleOne.Product; -#elif (MONOMELON || MONOBEPINEX) +#elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) using S1Product = ScheduleOne.Product; #endif @@ -17,9 +17,9 @@ public class ProductInstance : ItemInstance /// /// INTERNAL: The stored reference to the in-game product instance. /// - internal S1Product.ProductItemInstance S1ProductInstance => + internal S1Product.ProductItemInstance S1ProductInstance => CrossType.As(S1ItemInstance); - + /// /// INTERNAL: Creates a product instance from the in-game product instance. /// @@ -29,13 +29,13 @@ internal ProductInstance(S1Product.ProductItemInstance productInstance) : base(p /// /// Whether this product is currently packaged or not. /// - public bool IsPackaged => + public bool IsPackaged => S1ProductInstance.AppliedPackaging; - + /// /// The type of packaging applied to this product. /// - public PackagingDefinition AppliedPackaging => + public PackagingDefinition AppliedPackaging => new PackagingDefinition(S1ProductInstance.AppliedPackaging); } } diff --git a/S1API/Products/ProductManager.cs b/S1API/Products/ProductManager.cs index 4c5625e1..c317d8f4 100644 --- a/S1API/Products/ProductManager.cs +++ b/S1API/Products/ProductManager.cs @@ -1,7 +1,7 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using S1Product = Il2CppScheduleOne.Product; using Il2CppSystem.Collections.Generic; -#elif (MONOMELON || MONOBEPINEX) +#elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) using S1Product = ScheduleOne.Product; #endif using System.Linq; diff --git a/S1API/Products/WeedDefinition.cs b/S1API/Products/WeedDefinition.cs index f467819e..8f334711 100644 --- a/S1API/Products/WeedDefinition.cs +++ b/S1API/Products/WeedDefinition.cs @@ -1,7 +1,7 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.Product; using S1WeedDefinition = Il2CppScheduleOne.Product.WeedDefinition; -#elif (MONOMELON || MONOBEPINEX) +#elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) using ScheduleOne.Product; using S1WeedDefinition = ScheduleOne.Product.WeedDefinition; #endif @@ -21,7 +21,7 @@ public class WeedDefinition : ProductDefinition /// internal S1WeedDefinition S1WeedDefinition => CrossType.As(S1ItemDefinition); - + /// /// Creates a new weed product definition. diff --git a/S1API/Quests/Constants/QuestAction.cs b/S1API/Quests/Constants/QuestAction.cs new file mode 100644 index 00000000..de7fcbbe --- /dev/null +++ b/S1API/Quests/Constants/QuestAction.cs @@ -0,0 +1,33 @@ +namespace S1API.Quests.Constants +{ + /// + /// A wrapper around EQuestAction + /// + public enum QuestAction + { + /// + /// Begin the quest + /// + Begin, + + /// + /// Succeed (complete) the quest + /// + Success, + + /// + /// Fail the quest + /// + Fail, + + /// + /// Expire the quest + /// + Expire, + + /// + /// Cancel the quest + /// + Cancel + } +} diff --git a/S1API/Quests/QuestState.cs b/S1API/Quests/Constants/QuestState.cs similarity index 93% rename from S1API/Quests/QuestState.cs rename to S1API/Quests/Constants/QuestState.cs index d907b328..f4de4917 100644 --- a/S1API/Quests/QuestState.cs +++ b/S1API/Quests/Constants/QuestState.cs @@ -1,4 +1,4 @@ -namespace S1API.Quests +namespace S1API.Quests.Constants { /// /// Represents all states a quest can be. Applicable to quest entries as well. @@ -9,30 +9,30 @@ public enum QuestState /// Represents a quest / quest entry that has not been started yet. /// Inactive, - + /// /// Represents a quest / quest entry that has been started but not ended. /// Active, - + /// /// Represents a quest / quest entry that has been completed successfully by the player. /// Completed, - + /// /// Represents a quest / quest entry that has been failed by the played. /// Failed, - + /// /// Represents a quest / quest entry that has been expired. /// Expired, - + /// /// Represents a quest / quest entry that has been cancelled. /// Cancelled } -} \ No newline at end of file +} diff --git a/S1API/Quests/Quest.cs b/S1API/Quests/Quest.cs index f281bccb..5b7568cc 100644 --- a/S1API/Quests/Quest.cs +++ b/S1API/Quests/Quest.cs @@ -1,25 +1,30 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using S1Quests = Il2CppScheduleOne.Quests; using S1Dev = Il2CppScheduleOne.DevUtilities; using S1Map = Il2CppScheduleOne.Map; using S1Data = Il2CppScheduleOne.Persistence.Datas; using S1Contacts = Il2CppScheduleOne.UI.Phone.ContactsApp; -using Il2CppSystem.Collections.Generic; -#elif (MONOMELON || MONOBEPINEX) +#elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) using S1Quests = ScheduleOne.Quests; using S1Dev = ScheduleOne.DevUtilities; using S1Map = ScheduleOne.Map; using S1Data = ScheduleOne.Persistence.Datas; using S1Contacts = ScheduleOne.UI.Phone.ContactsApp; +#endif + +#if (MONOMELON || MONOBEPINEX) using System.Reflection; using System.Collections.Generic; +using HarmonyLib; +#elif (IL2CPPMELON || IL2CPPBEPINEX) +using Il2CppSystem.Collections.Generic; #endif using System; using System.IO; -using HarmonyLib; using S1API.Internal.Abstraction; using S1API.Internal.Utils; +using S1API.Quests.Constants; using S1API.Saveables; using UnityEngine; using UnityEngine.Events; @@ -37,30 +42,35 @@ public abstract class Quest : Saveable /// The title of the quest to display for the player. /// protected abstract string Title { get; } - + /// /// The description provided to the player. /// protected abstract string Description { get; } - + /// /// Whether to automatically begin the quest once instanced. /// NOTE: If this is false, you must manually `.Begin()` this quest. /// protected virtual bool AutoBegin => true; - + + /// + /// The current quest state for this quest + /// + protected QuestState QuestState => (QuestState)S1Quest.QuestState; + // ReSharper disable once MemberCanBePrivate.Global /// /// A list of all quest entries added to this quest. /// - protected readonly QuestEntry[] QuestEntries = Array.Empty(); - - [SaveableField("QuestData")] + protected readonly List QuestEntries = new List(); + + [SaveableField("QuestData")] private readonly QuestData _questData; - + internal string? SaveFolder => S1Quest.SaveFolderName; /// - /// Optional icon sprite to display for the quest. + /// Optional icon sprite to display for the quest. /// Override to use a custom icon loaded at runtime (e.g., from a file). /// protected override Sprite? QuestIcon => ImageUtils.LoadImage("icon.png"); /// @@ -68,17 +78,23 @@ public abstract class Quest : Saveable internal readonly S1Quests.Quest S1Quest; private readonly GameObject _gameObject; - + /// /// INTERNAL: Public constructor used for instancing the quest. /// public Quest() { _questData = new QuestData(GetType().Name); - + _gameObject = new GameObject("Quest"); S1Quest = _gameObject.AddComponent(); S1Quest.StaticGUID = string.Empty; +#if (MONOMELON || MONOBEPINEX) + FieldInfo titleField = AccessTools.Field(typeof(S1Quests.Quest), "title"); + titleField.SetValue(S1Quest, Title); +#elif (IL2CPPMELON || IL2CPPBEPINEX) + S1Quest.title = Title; +#endif S1Quest.onActiveState = new UnityEvent(); S1Quest.onComplete = new UnityEvent(); S1Quest.onInitialComplete = new UnityEvent(); @@ -93,37 +109,37 @@ public Quest() #elif (IL2CPPMELON || IL2CPPBEPINEX) S1Quest.autoInitialize = false; #endif - + // Setup quest icon prefab - GameObject iconPrefabObject = new GameObject("IconPrefab", - CrossType.Of(), - CrossType.Of(), + GameObject iconPrefabObject = new GameObject("IconPrefab", + CrossType.Of(), + CrossType.Of(), CrossType.Of() ); iconPrefabObject.transform.SetParent(_gameObject.transform); Image iconImage = iconPrefabObject.GetComponent(); iconImage.sprite = QuestIcon ?? S1Dev.PlayerSingleton.Instance.AppIcon; S1Quest.IconPrefab = iconPrefabObject.GetComponent(); - + // Setup UI for POI prefab var uiPrefabObject = new GameObject("PoIUIPrefab", - CrossType.Of(), - CrossType.Of(), + CrossType.Of(), + CrossType.Of(), CrossType.Of(), CrossType.Of