Quellcode durchsuchen

[ScrapYardLite] [2.0.3.8] init lite verion of ScrapYard

Zariteis vor 4 Jahren
Ursprung
Commit
edb5cb1cee

+ 117 - 0
ScrapYardLite/API/ShopPlatform.cs

@@ -0,0 +1,117 @@
+using System;
+using System.Collections.Generic;
+
+namespace ScrapYard.API
+{
+  public class ShopPlatform
+  {
+    public readonly ShopPlatformSpacingType Type;
+
+    public readonly string Title;
+
+    internal List<ShopPlatformEntry> Entries = new List<ShopPlatformEntry>();
+
+    internal static Dictionary<string, ShopPlatform> ShopPlatforms = new Dictionary<string, ShopPlatform>();
+
+    public static ShopPlatform DefaultObjects
+    {
+      get => ShopPlatforms["DefaultObjects"];
+    }
+
+    public static ShopPlatform DefaultBlocks
+    {
+      get => ShopPlatforms["DefaultBlocks"];
+    }
+
+    public static ShopPlatform DefaultWalls
+    {
+      get => ShopPlatforms["DefaultWalls"];
+    }
+
+    public ShopPlatform(string title, ShopPlatformSpacingType spacingType = ShopPlatformSpacingType.Normal)
+    {
+      this.Type = spacingType;
+      this.Title = title;
+    }
+
+    public virtual ShopPlatform Register()
+    {
+      return Register(this.Title);
+    }
+
+    public virtual ShopPlatform Register(string id)
+    {
+      if (ShopPlatforms.ContainsKey(id))
+        ShopPlatforms.Remove(id);
+
+      ShopPlatforms.Add(id, this);
+      return this;
+    }
+
+    public ShopPlatformSpacingType GetShopPlatformSpacingType()
+    {
+      return Type;
+    }
+
+    public void AddShopPlatformEntry(ShopPlatformEntry row)
+    {
+      foreach (var e in Entries)
+        if (e.CurrencyItemID == row.CurrencyItemID
+          && e.ItemID == row.ItemID
+          && e.Quantity == row.Quantity
+          && e.Price == row.Price)
+          return;
+      Entries.Add(row);
+    }
+
+    public void RemoveShopPlatformEntry(ShopPlatformEntry row)
+    {
+      Entries.Remove(row);
+    }
+
+    public ShopPlatformEntry[] GetShopPlatformEntries()
+    {
+      return Entries.ToArray();
+    }
+
+    public static ShopPlatform[] GetShopPlatforms()
+    {
+      return new List<ShopPlatform>(ShopPlatforms.Values).ToArray();
+    }
+
+    internal int GetSpacesPerRow()
+    {
+      int spaces = 0;
+      switch (Type)
+      {
+        case ShopPlatformSpacingType.Normal:
+          spaces = 7;
+          break;
+        case ShopPlatformSpacingType.Near:
+          spaces = 13;
+          break;
+        case ShopPlatformSpacingType.Far:
+          spaces = 3;
+          break;
+      }
+      return spaces;
+    }
+
+    internal int GetRowsNeeded()
+    {
+      return ((Entries.Count - 1) / GetSpacesPerRow()) + 1;
+    }
+
+    internal static void Reset()
+    {
+      ShopPlatforms = new Dictionary<string, ShopPlatform>();
+    }
+  }
+
+  public enum ShopPlatformSpacingType
+  {
+    Normal,
+    Near,
+    Far
+  }
+}

+ 18 - 0
ScrapYardLite/API/ShopPlatformEntry.cs

@@ -0,0 +1,18 @@
+namespace ScrapYard.API
+{
+  public class ShopPlatformEntry
+  {
+    public int ItemID { get; protected set; }
+    public int Price { get; protected set; }
+    public int Quantity { get; protected set; }
+    public int CurrencyItemID { get; protected set; }
+
+    public ShopPlatformEntry(int itemID, int price, int quantity = 1, int currencyItemID = 57)
+    {
+      this.ItemID = itemID;
+      this.Price = price;
+      this.CurrencyItemID = currencyItemID;
+      this.Quantity = quantity;
+    }
+  }
+}

BIN
ScrapYardLite/Assets/iScrapTrophy.png


BIN
ScrapYardLite/Assets/platform


BIN
ScrapYardLite/Assets/scrapYardStand.png


BIN
ScrapYardLite/Assets/scrapYardStandInfo.png


BIN
ScrapYardLite/Assets/scrapyardstand


+ 9 - 0
ScrapYardLite/Core.cs

@@ -0,0 +1,9 @@
+using GadgetCore;
+
+namespace ScrapYard
+{
+  internal static class Core
+  {
+    public static GadgetLogger logger;
+  }
+}

+ 3 - 0
ScrapYardLite/Manifest.ini

@@ -0,0 +1,3 @@
+[Metadata]
+Name=Scrap Yard
+Assembly=ScrapYard.dll

+ 1 - 0
ScrapYardLite/ModInfo.txt

@@ -0,0 +1 @@
+A mod that adds a scryp yard planet. Lite Version.

+ 10 - 0
ScrapYardLite/Properties/AssemblyInfo.cs

@@ -0,0 +1,10 @@
+using System.Reflection;
+using static ScrapYard.ScrapYard;
+
+[assembly: AssemblyProduct("ScrapYard")] //Set this to the full name of the mod including spaces.
+[assembly: AssemblyTitle("ScrapYard")] //This is only used when mousing over a dll file in Windows explorer.
+[assembly: AssemblyDescription("A mod that adds a scryp yard planet. Lite Version.")] //This is a short description for your mod's assembly.
+[assembly: AssemblyCompany("")] //Set this to your name/nickname and/or website
+[assembly: AssemblyCopyright("© 2021 Zariteis. All rights reserved.")] //Set this to your copyright name.
+[assembly: AssemblyVersion(MOD_VERSION)]
+[assembly: AssemblyFileVersion(MOD_VERSION)]

+ 8 - 0
ScrapYardLite/Properties/launchSettings.json

@@ -0,0 +1,8 @@
+{
+  "profiles": {
+    "ScrapYard": {
+      "commandName": "Executable",
+      "executablePath": "C:\\Program Files (x86)\\Steam\\steamapps\\common\\Roguelands\\Roguelands.exe"
+    }
+  }
+}

+ 15 - 0
ScrapYardLite/README.txt

@@ -0,0 +1,15 @@
+In addition to changing all references to "Template" this and that to a more appropriate name,
+you need to add a file called "GamePaths.xml" to the folder ABOVE where you put this template, with the following content:
+
+<?xml version="1.0" encoding="utf-8"?>
+<Project>
+  <PropertyGroup>
+    <!-- Set this full path to your game folder. Must contain a slash at the end. -->
+    <GamePath>C:\Program Files (x86)\Steam\steamapps\common\Roguelands\</GamePath>
+
+    <!-- Set this partial path to the game's Managed folder. Must contain a slash at the end. -->
+    <ManagedFolder>Roguelands_Data\Managed\</ManagedFolder>
+  </PropertyGroup>
+</Project>
+
+Note that `GamePath` may need to be changed, depending on the nature of your installation.

+ 164 - 0
ScrapYardLite/ScrapYard.cs

@@ -0,0 +1,164 @@
+using GadgetCore.API;
+using ScrapYard.API;
+using System.Collections;
+using System.Collections.Generic;
+using System.Reflection;
+using UnityEngine;
+using UnityEngine.SceneManagement;
+
+namespace ScrapYard
+{
+  [Gadget("ScrapYard", GadgetVersionSpecificity: VersionSpecificity.NONBREAKING)]
+  public class ScrapYard : Gadget<ScrapYard>
+  {
+    public const string MOD_VERSION = "1.4.1"; // 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.
+
+    protected override void LoadConfig()
+    {
+      Config.Load();
+
+      string fileVersion = Config.ReadString("ConfigVersion", CONFIG_VERSION, comments: "The Config Version (not to be confused with mod version)");
+
+      if (fileVersion != CONFIG_VERSION)
+      {
+        Config.Reset();
+        Config.WriteString("ConfigVersion", CONFIG_VERSION, comments: "The Config Version (not to be confused with mod version)");
+      }
+
+      Config.Save();
+    }
+
+    public override string GetModDescription()
+    {
+      return "A mod that adds a scryp yard planet. Lite Version.";
+    }
+
+    protected override void Initialize()
+    {
+      Logger.Log("Scrap Yard Lite v" + Info.Mod.Version);
+      Core.logger = Logger;
+
+      Texture2D textureScrapTrophy = GadgetCoreAPI.LoadTexture2D("iScrapTrophy.png");
+
+      ItemInfo item = new ItemInfo(ItemType.GENERIC, "Scrap Trophy", "A rusty trophy.\nUsed for purchasing\nspecial items.", textureScrapTrophy);
+      int itemID = ItemRegistry.Singleton.Register(item, "Scrap Trophy");
+      if (itemID == -1)
+        throw new System.Exception("Could not register item " + "Scrap Trophy");
+
+      { // Shop Stand
+        var asset = GadgetCoreAPI.LoadAssetBundle("scrapyardstand");
+        scrapYardStand = UnityEngine.Object.Instantiate((GameObject)asset.LoadAsset("assets/resources/scrapyardstand.prefab"));
+        scrapYardStand.SetActive(false);
+        scrapYardStand.AddComponent<ScrapYardShopStandScript>();
+        scrapYardStand.name = "scrapyardstand";
+
+        scrapYardStand.transform.GetChild(0).GetComponent<Renderer>().material = new Material(Shader.Find("Unlit/Transparent"))
+        {
+          mainTexture = GadgetCoreAPI.LoadTexture2D("scrapYardStand.png")
+        };
+
+        scrapYardStand.transform.GetChild(2).GetComponent<Renderer>().material = new Material(Shader.Find("Unlit/Transparent"))
+        {
+          mainTexture = GadgetCoreAPI.LoadTexture2D("scrapYardStandInfo.png")
+        };
+
+        GadgetCoreAPI.AddCustomResource("prop/ScrapYard/stand", scrapYardStand);
+
+        ItemInfo tileItem = new ItemInfo(ItemType.GENERIC, "scrapyardstand", "Degug item.", null as Texture2D).Register();
+        TileInfo tile = new TileInfo(TileType.INTERACTIVE, null as Texture2D, new GameObject("scrapyardstand"), tileItem);
+        int tileID = TileRegistry.Singleton.Register(tile, "scrapyardstand");
+        if (tileID == -1)
+          throw new System.Exception("Could not register Tile " + "scrapyardstand");
+        tile.OnInteract += OnInteractStand;
+      }
+
+      ShopPlatform.Reset();
+
+      // Setting up default shop platforms
+      new ShopPlatform("Default Objects", ShopPlatformSpacingType.Near).Register("DefaultObjects");
+      new ShopPlatform("Default Blocks", ShopPlatformSpacingType.Near).Register("DefaultBlocks");
+      new ShopPlatform("Default Walls", ShopPlatformSpacingType.Near).Register("DefaultWalls");
+
+      SceneManager.sceneLoaded += OnSceneLoaded;
+
+    }
+
+    private static GameObject scrapYardStand;
+
+    internal static void OnSceneLoaded(Scene scene, LoadSceneMode mode)
+    {
+      if (scene.buildIndex == 1)
+      {
+        InstanceTracker.GameScript.StartCoroutine(CreateStands());
+        try
+        {
+          var storageMenu = GameObject.Find("Ship").transform.Find("SHIPPLACES").transform.Find("NPCs").transform.Find("npcFlora").localPosition = new Vector3(-134.58f, 11.72f, -0.19f);
+        }
+        catch (System.Exception e) { Core.logger.LogError(e.Message); }
+      }
+    }
+    private static IEnumerator CreateStands()
+    {
+      while (!Network.isServer && !Network.isClient)
+      {
+        yield return new WaitForSeconds(0.25f);
+      }
+      yield return new WaitForSeconds(0.75f);
+      try
+      {
+        {
+          var stand = (GameObject)Network.Instantiate((GameObject)Resources.Load("prop/ScrapYard/stand"), new Vector3(-250f + 4 * -5.5f, -5.99f - 2 + 0.5f, 0.19f), Quaternion.identity, 0);
+          stand.GetComponent<ScrapYardShopStandScript>().GetComponent<ScrapYardShopStandScript>().StartCallSet(ItemRegistry.GetItemIDByRegistryName("ScrapYard:Scrap Trophy"), 9999, 1, 57);
+        }
+        List<ShopPlatformEntry> blocks = new List<ShopPlatformEntry>();
+        List<ShopPlatformEntry> objects = new List<ShopPlatformEntry>();
+        foreach (var p in ShopPlatform.GetShopPlatforms())
+          if (p == ShopPlatform.DefaultBlocks || p == ShopPlatform.DefaultWalls)
+            foreach (var e in p.Entries)
+              blocks.Add(e);
+          else
+            foreach (var e in p.Entries)
+              objects.Add(e);
+        for (int i = 0; i < System.Math.Min(objects.Count, 3); i++)
+        {
+          var entry = objects[i];
+          var stand = (GameObject)Network.Instantiate((GameObject)Resources.Load("prop/ScrapYard/stand"), new Vector3(-250f + 4 * i, -5.99f - 2 + 0.5f, 0.19f), Quaternion.identity, 0);
+          stand.GetComponent<ScrapYardShopStandScript>().StartCallSet(entry.ItemID, entry.Price, entry.Quantity, entry.CurrencyItemID);
+        }
+        for (int i = 0; i < System.Math.Min(blocks.Count, 5); i++)
+        {
+          var entry = blocks[i];
+          var stand = (GameObject)Network.Instantiate((GameObject)Resources.Load("prop/ScrapYard/stand"), new Vector3(-250f + 4 * 7 + 4 * i, -5.99f + 6 + 0.5f, 0.19f), Quaternion.identity, 0);
+          stand.GetComponent<ScrapYardShopStandScript>().StartCallSet(entry.ItemID, entry.Price, entry.Quantity, entry.CurrencyItemID);
+        }
+        if (objects.Count > 3 || blocks.Count > 5)
+          Core.logger.LogWarning("There are more stands than can be added to your ship. U should use the non Lite version of Scrap Yard");
+      }
+      catch (System.Exception e)
+      {
+        Core.logger.LogError(e);
+      }
+      yield break;
+    }
+
+    public static readonly FieldInfo canInteractField = typeof(PlayerScript).GetField("canInteract", BindingFlags.NonPublic | BindingFlags.Instance);
+    public static readonly FieldInfo interactingField = typeof(PlayerScript).GetField("interacting", BindingFlags.NonPublic | BindingFlags.Instance);
+
+    private IEnumerator OnInteractStand()
+    {
+      try
+      {
+        PlayerScript.curInteractObj.SendMessage("Request");
+        canInteractField.SetValue(InstanceTracker.PlayerScript, true);
+        interactingField.SetValue(InstanceTracker.PlayerScript, false);
+        InstanceTracker.PlayerScript.w.SetActive(true);
+      }
+      catch (System.Exception e)
+      {
+        Core.logger.Log(e);
+      }
+      yield break;
+    }
+  }
+}

+ 298 - 0
ScrapYardLite/ScrapYard.csproj

@@ -0,0 +1,298 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project Sdk="Microsoft.NET.Sdk">
+  <ImportGroup>
+    <Import Project="../GamePaths.xml" />
+  </ImportGroup>
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
+    <ProjectGuid>{91AB81DE-EAEE-47D1-93DD-541179208219}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>ScrapYard</RootNamespace>
+    <AssemblyName>ScrapYard</AssemblyName>
+    <TargetFrameworks>net35</TargetFrameworks>
+    <FileAlignment>512</FileAlignment>
+    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
+    <Configurations>Release</Configurations>
+    <Authors>Zariteis</Authors>
+    <ApplicationIcon />
+    <StartupObject />
+    <Platforms>x86</Platforms>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+    <PlatformTarget>x86</PlatformTarget>
+    <DebugType>none</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net35|x86'">
+    <NoWarn>1701;1702</NoWarn>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="0Harmony">
+      <HintPath>$(GamePath)$(ManagedFolder)0Harmony.dll</HintPath>
+      <SpecificVersion>false</SpecificVersion>
+      <Private>false</Private>
+      <RequiredTargetFramework>net35</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="Assembly-CSharp">
+      <HintPath>$(GamePath)$(ManagedFolder)Assembly-CSharp.dll</HintPath>
+      <SpecificVersion>false</SpecificVersion>
+      <RequiredTargetFramework>net35</RequiredTargetFramework>
+      <Private>false</Private>
+    </Reference>
+    <Reference Include="GadgetCore">
+      <HintPath>$(GamePath)$(ManagedFolder)GadgetCore.dll</HintPath>
+      <SpecificVersion>false</SpecificVersion>
+      <RequiredTargetFramework>net35</RequiredTargetFramework>
+      <Private>false</Private>
+    </Reference>
+    <Reference Include="UnityEngine">
+      <HintPath>$(GamePath)$(ManagedFolder)UnityEngine.dll</HintPath>
+      <SpecificVersion>false</SpecificVersion>
+      <RequiredTargetFramework>net35</RequiredTargetFramework>
+      <Private>false</Private>
+    </Reference>
+    <Reference Include="WindowsBase" />
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="ModInfo.txt">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
+  </ItemGroup>
+  <UsingTask TaskName="GetFileVersion" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
+    <ParameterGroup>
+      <AssemblyPath ParameterType="System.String" Required="true" />
+      <Version ParameterType="System.String" Output="true" />
+      <TrimmedVersion ParameterType="System.String" Output="true" />
+    </ParameterGroup>
+    <Task>
+      <Using Namespace="System.Diagnostics" />
+      <Using Namespace="System.Text" />
+      <Using Namespace="System.Linq" />
+      <Code Type="Fragment" Language="cs">
+        <![CDATA[
+      this.Version = FileVersionInfo.GetVersionInfo(this.AssemblyPath).FileVersion;  
+      this.TrimmedVersion = this.Version.Split('.').TakeWhile(x => !x.Equals("0")).Aggregate(new StringBuilder(), (a, b) => { if (a.Length > 0) a.Append("."); a.Append(b); return a; }).ToString();
+      if (this.TrimmedVersion.IndexOf('.') == -1) this.TrimmedVersion += ".0";
+    ]]>
+      </Code>
+    </Task>
+  </UsingTask>
+  <Target Name="PostBuild" AfterTargets="PostBuildEvent">
+    <GetFileVersion AssemblyPath="$(TargetPath)">
+      <Output TaskParameter="Version" PropertyName="ModFullVersion" />
+      <Output TaskParameter="TrimmedVersion" PropertyName="AssemblyFileVersion" />
+    </GetFileVersion>
+    <ItemGroup>
+      <OldZip Include="$(TargetDir)$(AssemblyName)_v*.zip" />
+      <OldZip Include="$(GamePath)GadgetCore\Mods\$(AssemblyName)_v*.zip" />
+    </ItemGroup>
+    <Delete Files="@(OldZip)" />
+    <MakeDir Directories="$(TargetDir)..\BuildCache\" />
+    <ZipDirectory SourceDirectory="$(TargetDir)" DestinationFile="$(TargetDir)..\BuildCache\$(AssemblyName)_v$(AssemblyFileVersion).zip" />
+    <Copy SourceFiles="$(TargetDir)..\BuildCache\$(AssemblyName)_v$(AssemblyFileVersion).zip" DestinationFiles="$(TargetDir)$(AssemblyName)_v$(AssemblyFileVersion).zip" />
+    <RemoveDir Directories="$(TargetDir)..\BuildCache\" />
+    <MakeDir Directories="$(GamePath)GadgetCore\Mods\" />
+    <Copy SourceFiles="$(TargetDir)$(AssemblyName)_v$(AssemblyFileVersion).zip" DestinationFiles="$(GamePath)GadgetCore\Mods\$(AssemblyName)_v$(AssemblyFileVersion).zip" />
+    <Message Importance="High" Text="Mod Exported to $(GamePath)GadgetCore\Mods\$(AssemblyName)_v$(AssemblyFileVersion).zip" />
+  </Target>
+  <ItemGroup>
+    <None Update="Assets\bgScrapYard.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\bgScrapYardExtension.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\bgScrapYardTop.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\bScrapYardbg0.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\bScrapYardbg1.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\bScrapYardbg2.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\bScrapYardbg3.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\cGreenLamp.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\charBG.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\cOrangeLamp.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\cPlatform.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\cPurpleLamp.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\cWhiteLamp.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\cYellowLamp.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\entranceScrapYard.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\First\one">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\iAirCore.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\iCore.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\iEarthCore.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\iFireCore.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\iGreenLamp.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\iOrangeLamp.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\iPlatform.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\iPurpleLamp.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\iScrapTrophy.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\iWaterCore.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\iWhiteLamp.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\iYellowLamp.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\merchantBody.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\merchantHead.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\merchantPortrait.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\metalPlatform.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\midCoverChunk0.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\midHiddenChunk0.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\midScrapYardChunk0.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\midScrapYardChunk1.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\one">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\parallax.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\planetScrapYard.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\planetScrapYardPrev.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\platform">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\scrapyardstand">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\scrapYardStand.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\scrapYardStandInfo.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\shopStand.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\sideBigScrapYard.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\sidesmallScrapYard.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Assets\signScrapYard.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="Manifest.ini">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+  </ItemGroup>
+  <ItemGroup>
+    <Reference Update="System">
+      <Private>false</Private>
+      <SpecificVersion>true</SpecificVersion>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <Reference Update="System.Data">
+      <EmbedInteropTypes>false</EmbedInteropTypes>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <Reference Update="System.Drawing">
+      <EmbedInteropTypes>false</EmbedInteropTypes>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <Reference Update="System.IO.Compression.FileSystem">
+      <EmbedInteropTypes>false</EmbedInteropTypes>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <Reference Update="System.Numerics">
+      <EmbedInteropTypes>false</EmbedInteropTypes>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <Reference Update="System.Runtime.Serialization">
+      <EmbedInteropTypes>false</EmbedInteropTypes>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <Reference Update="System.Xml">
+      <EmbedInteropTypes>false</EmbedInteropTypes>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <Reference Update="System.Xml.Linq">
+      <EmbedInteropTypes>false</EmbedInteropTypes>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <Folder Include="Patches\" />
+  </ItemGroup>
+</Project>

+ 141 - 0
ScrapYardLite/ScrapYardShopStandScript.cs

@@ -0,0 +1,141 @@
+using GadgetCore.API;
+using System.Collections;
+using System.Reflection;
+using UnityEngine;
+
+namespace ScrapYard
+{
+  public class ScrapYardShopStandScript : MonoBehaviour
+  {
+    public static readonly FieldInfo inventoryField = typeof(GameScript).GetField("inventory", BindingFlags.NonPublic | BindingFlags.Instance);
+
+    private void Awake()
+    {
+      UpdateUI();
+    }
+
+    [RPC]
+    private void Set(int itemID, int price, int quantity, int currencyItemID)
+    {
+      this.itemID = ItemRegistry.Singleton.ConvertIDToLocal(itemID);
+      this.currencyItemID = ItemRegistry.Singleton.ConvertIDToLocal(currencyItemID);
+      this.price = price;
+      this.quantity = quantity;
+      UpdateUI();
+    }
+
+    internal void StartCallSet(int itemID, int price, int quantity, int currencyItemID)
+    {
+      StartCoroutine(CallSet(itemID, price, quantity, currencyItemID));
+    }
+
+    private IEnumerator CallSet(int itemID, int price, int quantity, int currencyItemID)
+    {
+      yield return new WaitForSeconds(0.1f);
+      itemID = ItemRegistry.Singleton.ConvertIDToHost(itemID);
+      currencyItemID = ItemRegistry.Singleton.ConvertIDToHost(currencyItemID);
+      gameObject.GetComponent<NetworkView>().RPC("Set", RPCMode.AllBuffered, new object[] { itemID, price, quantity, currencyItemID });
+      yield break;
+    }
+
+    private void UpdateUI()
+    {
+      gameObject.transform.GetChild(1).GetComponent<Animation>().Play("animationStand");
+      gameObject.transform.GetChild(1).GetComponent<Renderer>().material = (Material)Resources.Load("i/i" + itemID);
+      gameObject.transform.GetChild(2).GetChild(1).GetComponent<Renderer>().material = (Material)Resources.Load("i/i" + currencyItemID);
+
+      ItemInfo info = ItemRegistry.GetItem(itemID);
+
+      string title = (quantity > 1 ? quantity + "x " : "") + info.Name;
+
+      gameObject.transform.GetChild(2).GetChild(0).GetComponent<TextMesh>().text = title;
+      gameObject.transform.GetChild(2).GetChild(0).GetChild(0).GetComponent<TextMesh>().text = title;
+      gameObject.transform.GetChild(2).GetChild(2).GetComponent<TextMesh>().text = "" + price;
+      gameObject.transform.GetChild(2).GetChild(2).GetChild(0).GetComponent<TextMesh>().text = "" + price;
+    }
+
+    private void OnTriggerEnter(Collider c)
+    {
+      if (c.gameObject.layer == 8)
+      {
+        gameObject.transform.GetChild(2).gameObject.SetActive(true);
+      }
+    }
+
+    private void OnTriggerExit(Collider c)
+    {
+      if (c.gameObject.layer == 8)
+      {
+        gameObject.transform.GetChild(2).gameObject.SetActive(false);
+      }
+    }
+
+    private int GetItemAmount(GameScript gameScript, int id)
+    {
+      if (id == 0) return 0;
+      int num = 0;
+      Item[] inventory = (Item[])inventoryField.GetValue(gameScript);
+      for (int i = 0; i < 45; i++)
+      {
+        if (inventory[i].id == id)
+        {
+          num += inventory[i].q;
+        }
+      }
+      return num;
+    }
+
+    private void RemoveItemAmount(GameScript gameScript, int id, int amount)
+    {
+      Item[] inventory = (Item[])inventoryField.GetValue(gameScript);
+      for (int i = 0; i < 45; i++)
+      {
+        if (inventory[i].id == id)
+        {
+          if (amount - inventory[i].q > 0)
+          {
+            amount -= inventory[i].q;
+            inventory[i] = gameScript.EmptyItem();
+            gameScript.RefreshSlot(i);
+          }
+          else
+          {
+            if (amount - inventory[i].q == 0)
+            {
+              inventory[i] = gameScript.EmptyItem();
+              gameScript.RefreshSlot(i);
+              break;
+            }
+            inventory[i].q -= amount;
+            gameScript.RefreshSlot(i);
+            break;
+          }
+        }
+      }
+    }
+
+    private void Request()
+    {
+      var gameScript = (GameScript)Camera.main.GetComponent("GameScript");
+      int num = GetItemAmount(gameScript, currencyItemID);
+
+      if (num >= price)
+      {
+        base.GetComponent<AudioSource>().PlayOneShot((AudioClip)Resources.Load("Au/purchase"), Menuu.soundLevel / 10f);
+        RemoveItemAmount(gameScript, currencyItemID, price);
+        Item item = new Item(itemID, quantity, 0, 0, 0, new int[3], new int[3]);
+        GadgetCoreAPI.SpawnItem(base.transform.position, item);
+      }
+      else
+      {
+        GameObject gameObject = (GameObject)Object.Instantiate(Resources.Load("txtError"), MenuScript.player.transform.position, Quaternion.identity);
+        gameObject.SendMessage("InitError", "Insufficient Currency!");
+      }
+    }
+
+    public int itemID = 1;
+    public int price = 1;
+    public int quantity = 1;
+    public int currencyItemID = 1;
+  }
+}