Quellcode durchsuchen

[AncientReassembler] [2.0.3.6] ScrapYard.API link

Zariteis vor 4 Jahren
Ursprung
Commit
2f22b5f114

+ 5 - 2
AncientReassembler/AncientReassembler.cs

@@ -1,15 +1,16 @@
 using GadgetCore.API;
 using GadgetCore.API.ConfigMenu;
+using ScrapYard.API;
 using System;
 using UnityEngine;
 using UnityEngine.SceneManagement;
 
 namespace AncientReassembler
 {
-  [Gadget("AncientReassembler")]
+  [Gadget("AncientReassembler", LoadAfter: new string[] { "ScrapYard" }, Dependencies: new string[] { "ScrapYard" })]
   public class AncientReassembler : Gadget<AncientReassembler>
   {
-    public const string MOD_VERSION = "1.1"; // Set this to the version of your mod.
+    public const string MOD_VERSION = "1.2"; // Set this to the version of your mod.
     public const string CONFIG_VERSION = "1.0"; // Increment this whenever you change your mod's config file.
 
     public override IGadgetConfigMenu GetConfigMenu() { return null; }
@@ -41,6 +42,8 @@ namespace AncientReassembler
 
       Core.menu = new MenuInfo(MenuType.SIMPLE, menuAncient, tile);
       Core.menu.Register("Ancient Reassembler");
+
+      ShopPlatform.DefaultObjects.AddShopPlatformEntry(new ShopPlatformEntry(Core.itemAncientReassemblerId, 2, 1, ItemRegistry.GetItemIDByRegistryName("ScrapYard:Scrap Trophy")));
     }
   }
 }

+ 5 - 0
AncientReassembler/AncientReassembler.csproj

@@ -46,6 +46,11 @@
       <HintPath>$(GamePath)$(ManagedFolder)GadgetCore.dll</HintPath>
       <Private>false</Private>
     </Reference>
+    <Reference Include="ScrapYard">
+      <HintPath>..\ScrapYard\Release\ScrapYard.dll</HintPath>
+      <Private>false</Private>
+      <SpecificVersion>false</SpecificVersion>
+    </Reference>
     <Reference Include="UnityEngine">
       <HintPath>$(GamePath)$(ManagedFolder)UnityEngine.dll</HintPath>
       <Private>false</Private>

+ 2 - 1
AncientReassembler/Manifest.ini

@@ -1,3 +1,4 @@
 [Metadata]
 Name=Ancient Reassembler
-Assembly=AncientReassembler.dll
+Assembly=AncientReassembler.dll
+Dependencies=Scrap Yard

+ 0 - 37
AncientReassembler/Patches/Patch_KylockeStand_Awake.cs

@@ -1,37 +0,0 @@
-using System;
-using System.Collections;
-using GadgetCore.API;
-using HarmonyLib;
-using UnityEngine;
-
-namespace AncientReassembler.Patches
-{
-  [HarmonyPatch(typeof(KylockeStand))]
-  [HarmonyPatch("Awake")]
-  [HarmonyGadget("AncientReassembler")]
-  public static class Patch_KylockeStand_Awake
-  {
-    [HarmonyPrefix]
-    public static void Prefix(KylockeStand __instance)
-    {
-      __instance.StartCoroutine(Patch_KylockeStand_Awake.WaitAndCreate(__instance));
-    }
-
-    private static IEnumerator WaitAndCreate(KylockeStand instance)
-    {
-      if (instance.itemID == 2403)
-      {
-        while (!Network.isServer && !Network.isClient)
-        {
-          yield return new WaitForSeconds(0f);
-        }
-        if (Network.isServer)
-        {
-          var obj = ((GameObject)Network.Instantiate(Resources.Load("npc/buildStand"), new Vector3(-250f + 4, -5.99f, 0.19f), instance.transform.rotation, 0));
-          obj.GetComponent<KylockeStand>().GetComponent<NetworkView>().RPC("Set", RPCMode.AllBuffered, new object[] { new int[] { Core.itemAncientReassemblerId, 1000 } });
-        }
-      }
-      yield break;
-    }
-  }
-}

+ 0 - 42
AncientReassembler/Patches/Patch_KylockeStand_Set.cs

@@ -1,42 +0,0 @@
-using System;
-using System.Collections;
-using GadgetCore.API;
-using HarmonyLib;
-using UnityEngine;
-
-namespace AncientReassembler.Patches
-{
-	[HarmonyPatch(typeof(KylockeStand))]
-	[HarmonyPatch("Set")]
-	[HarmonyGadget("AncientReassembler")]
-	public static class Patch_KylockeStand_Set
-	{
-
-		[HarmonyPostfix]
-		public static bool Prefix(KylockeStand __instance, int[] p)
-		{
-			if (p[0] == Core.itemAncientReassemblerId)
-			{
-				__instance.itemID = p[0];
-				__instance.cost = p[1];
-				__instance.icon.GetComponent<Renderer>().material = (Material)Resources.Load("i/i" + __instance.itemID.ToString());
-				__instance.txtCost[0].text = string.Empty + __instance.cost.ToString();
-				__instance.txtCost[1].text = __instance.txtCost[0].text;
-				__instance.txtName[0].text = string.Empty + ItemRegistry.GetItem(__instance.itemID).GetName();
-				__instance.txtName[1].text = __instance.txtName[0].text;
-				__instance.StartCoroutine(Patch_KylockeStand_Set.DoUpdatePlatformStand(__instance));
-				return false;
-			}
-			return true;
-		}
-
-		private static IEnumerator DoUpdatePlatformStand(KylockeStand instance)
-		{
-			instance.isBuild = true;
-			instance.isCredits = false;
-			instance.isTrophies = false;
-			instance.currency.GetComponent<Renderer>().material = (Material)Resources.Load("i/i57");
-			yield break;
-		}
-	}
-}