using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text;
using System.Text.RegularExpressions;
using BepInEx;
using HarmonyLib;
using Mirror;
using UnityEngine;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("PropHelper")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PropHelper")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("4e2a566f-e30c-4334-9dd7-6fca0cb529da")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace PropHelper;
[BepInPlugin("cUtils.PropHelper", "PropHelper", "0.4.0")]
[BepInProcess("atlyss.exe")]
internal class Main : BaseUnityPlugin
{
internal const string PLUGIN_GUID = "cUtils.PropHelper";
internal const string PLUGIN_NAME = "PropHelper";
internal const string PLUGIN_VERSION = "0.4.0";
internal const string FILE_NAME = "PropHelper.json";
private readonly Harmony harmony = new Harmony("cUtils.PropHelper");
internal static bool showMenu = false;
private static Rect windowRect = new Rect(1600f, 100f, 300f, 750f);
private static readonly int windowId = new Random().Next(1000, 9999);
private void Awake()
{
harmony.PatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin PropHelper is loaded!");
}
private void OnGUI()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
if (showMenu)
{
WindowFunction val = new WindowFunction(WindowManager.DrawWindow);
windowRect = GUI.Window(windowId, windowRect, val, "Prop Helper");
}
}
}
[HarmonyPatch(typeof(ChatBehaviour), "Cmd_SendChatMessage")]
internal class ClientSide
{
internal static ChatBehaviour chat;
internal static bool Prefix(ChatBehaviour __instance, ref string _message)
{
chat = __instance;
if (_message == null || !_message.StartsWith("/") || _message.StartsWith("//"))
{
return true;
}
string[] array = _message.Split(new char[1] { ' ' });
string input = array[0].ToLower();
input = Regex.Replace(input, "<.*?>", "");
if (!Player._mainPlayer._isHostPlayer)
{
switch (input)
{
case "/prophelperhelp":
case "/phhelp":
case "/phh":
case "/saveprops":
case "/propsave":
case "/phs":
case "/loadprops":
case "/propload":
case "/phl":
case "/moveprop":
case "/propmove":
case "/phm":
case "/rotateprop":
case "/proprotate":
case "/phrotate":
case "/phr":
case "/scaleprop":
case "/propscale":
case "/phscale":
case "/prophelper":
case "/ph":
chat.New_ChatMessage("<color=yellow>cUtils.PropHelper 0.4.0</color>");
chat.New_ChatMessage("<color=yellow>Currently only works for HOST and SINGLEPLAYER</color>");
chat.New_ChatMessage("<color=yellow>WORK IN PROGRESS</color>");
return false;
default:
return true;
}
}
switch (input)
{
case "/prophelperhelp":
case "/phhelp":
case "/phh":
PropHelperHelp();
return false;
case "/saveprops":
case "/propsave":
case "/phs":
PropHelper.SaveProps();
return false;
case "/loadprops":
case "/propload":
case "/phl":
PropHelper.LoadProps();
return false;
case "/moveprop":
case "/propmove":
case "/phm":
PropHelper.MoveProp(array);
return false;
case "/rotateprop":
case "/proprotate":
case "/phrotate":
case "/phr":
PropHelper.RotateProp(array);
return false;
case "/scaleprop":
case "/propscale":
case "/phscale":
PropHelper.ScaleProp(array);
return false;
case "/prophelper":
case "/ph":
ToggleWindow();
return false;
default:
return true;
}
}
internal static void ToggleWindow()
{
if (!Main.showMenu)
{
chat._focusedInChat = true;
WindowManager.UpdateWindowData();
}
else
{
Utils.FlushTempToProps();
}
Main.showMenu = !Main.showMenu;
}
internal static void PropHelperHelp()
{
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.AppendLine("<color=yellow>cUtils.PropHelper 0.4.0</color> /phhelp:");
stringBuilder.AppendLine("<color=green>/prophelper:</color>");
stringBuilder.AppendLine("<color=green>/ph:</color> display prop helper window to manipulate your last placed prop.");
stringBuilder.AppendLine("Everything can be done from the window.");
stringBuilder.AppendLine("<color=green>/saveprops:</color>");
stringBuilder.AppendLine("<color=green>/propsave:</color>");
stringBuilder.AppendLine("<color=green>/phs:</color> save your placed props to a file in the config folder.");
stringBuilder.AppendLine("<color=green>/loadprops:</color>");
stringBuilder.AppendLine("<color=green>/propload:</color>");
stringBuilder.AppendLine("<color=green>/phl:</color> load and place previously saved props.");
stringBuilder.AppendLine("<color=green>/moveprop</color>");
stringBuilder.AppendLine("<color=green>/propmove</color>");
stringBuilder.AppendLine("<color=green>/phm</color> move your last placed prop to your current position.");
stringBuilder.AppendLine("<color=green>/moveprop [x y z]</color>");
stringBuilder.AppendLine("<color=green>/propmove [x y z]</color>");
stringBuilder.AppendLine("<color=green>/phm [x y z]</color> move your last placed prop by given coordinates.");
stringBuilder.AppendLine("<color=green>/rotateprop [x y z]</color>");
stringBuilder.AppendLine("<color=green>/proprotate [x y z]</color>");
stringBuilder.AppendLine("<color=green>/phrotate [x y z]</color>");
stringBuilder.AppendLine("<color=green>/phr [x y z]</color> rotate your last placed prop by given coordinates.");
stringBuilder.AppendLine("<color=green>/scaleprop [x y z]</color>");
stringBuilder.AppendLine("<color=green>/propscale [x y z]</color>");
stringBuilder.AppendLine("<color=green>/phscale [x y z]</color> scale your last placed prop by given coordinates.");
stringBuilder.AppendLine("<color=yellow>example:</color> /phm -3 2 1.5");
stringBuilder.AppendLine("y is the vertical position.");
stringBuilder.AppendLine("rotation is still a little wonky.");
stringBuilder.AppendLine("<color=green>use WASDQE inside a value field.</color>");
stringBuilder.AppendLine("<color=yellow>work in progress</color>");
chat.New_ChatMessage(stringBuilder.ToString());
}
}
internal class PropHelper
{
internal static void SaveProps()
{
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
string path = Path.Combine(Paths.ConfigPath, "PropHelper.json");
List<string> list = new List<string>();
PropWrapper propWrapper = new PropWrapper();
Utils.FlushTempToProps();
Stack<GameObject> placedProps = PropMod.propManagers[Player._mainPlayer].placedProps;
foreach (GameObject item in placedProps)
{
string propName = Utils.GetPropName(item);
Vector3 position = item.transform.position;
Quaternion rotation = item.transform.rotation;
Vector3 eulerAngles = ((Quaternion)(ref rotation)).eulerAngles;
Vector3 localScale = item.transform.localScale;
PropData propData = new PropData
{
name = propName,
position = position,
rotation = eulerAngles,
scale = localScale
};
list.Add(JsonUtility.ToJson((object)propData));
}
if (list.Count == 0)
{
ClientSide.chat.New_ChatMessage("no props to save");
return;
}
try
{
string text = File.ReadAllText(path);
PropWrapper propWrapper2 = JsonUtility.FromJson<PropWrapper>(text);
foreach (string prop in propWrapper2.propList)
{
if (!list.Contains(prop))
{
list.Add(prop);
}
}
}
catch (Exception)
{
}
propWrapper.propList = list;
string contents = JsonUtility.ToJson((object)propWrapper, true);
File.WriteAllText(path, contents);
ClientSide.chat.New_ChatMessage("props saved");
}
internal static void LoadProps()
{
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
if (!NetworkServer.active)
{
ClientSide.chat.New_ChatMessage("NetworkServer inactive");
return;
}
string text = Utils.GetText();
if (text == null)
{
return;
}
PropWrapper propWrapper;
try
{
propWrapper = JsonUtility.FromJson<PropWrapper>(text);
}
catch (Exception ex)
{
ClientSide.chat.New_ChatMessage("problem with savefile: " + ex.Message);
return;
}
if (propWrapper.propList.Count == 0)
{
ClientSide.chat.New_ChatMessage("no props found: wrapper empty: savefile problem?");
return;
}
foreach (string prop in propWrapper.propList)
{
try
{
PropData propData = JsonUtility.FromJson<PropData>(prop);
if (!PropMod.propPrefabs.ContainsKey(propData.name))
{
ClientSide.chat.New_ChatMessage("prop name " + propData.name + " not found.");
continue;
}
GameObject val = PropMod.propPrefabs[propData.name];
Quaternion rotation = Quaternion.Euler(propData.rotation);
PlaceProp(propData.name, propData.position, rotation, propData.scale);
}
catch (Exception ex2)
{
ClientSide.chat.New_ChatMessage("problem with savefile: " + ex2.Message);
ClientSide.chat.New_ChatMessage(prop);
}
}
ClientSide.chat.New_ChatMessage("props loaded");
}
internal static void MoveProp(string[] inputArray)
{
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
if (inputArray.Length != 1 && inputArray.Length != 4)
{
ClientSide.chat.New_ChatMessage("invalid input");
return;
}
GameObject lastProp = GetLastProp(pop: true);
if ((Object)(object)lastProp == (Object)null)
{
return;
}
string name = ((Object)lastProp).name;
Vector3 position;
Quaternion rotation;
Vector3 localScale;
if (inputArray.Length == 4)
{
float num;
float num2;
float num3;
try
{
num = float.Parse(inputArray[1]);
num2 = float.Parse(inputArray[2]);
num3 = float.Parse(inputArray[3]);
}
catch (Exception ex)
{
ClientSide.chat.New_ChatMessage("e: " + ex.Message);
PushLastProp(lastProp);
return;
}
position = lastProp.transform.position;
position.x += num;
position.y += num2;
position.z += num3;
rotation = lastProp.transform.rotation;
localScale = lastProp.transform.localScale;
}
else
{
Transform transform = ((Component)Player._mainPlayer).transform;
position = transform.position + transform.forward * 5f + transform.up * -1f;
rotation = transform.rotation;
localScale = lastProp.transform.localScale;
}
NetworkServer.Destroy(lastProp);
PlaceProp(name, position, rotation, localScale);
}
internal static void RotateProp(string[] inputArray)
{
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
if (inputArray.Length != 4)
{
ClientSide.chat.New_ChatMessage("invalid input");
return;
}
GameObject lastProp = GetLastProp(pop: true);
if (!((Object)(object)lastProp == (Object)null))
{
string name = ((Object)lastProp).name;
float num;
float num2;
float num3;
try
{
num = float.Parse(inputArray[1]);
num2 = float.Parse(inputArray[2]);
num3 = float.Parse(inputArray[3]);
}
catch (Exception ex)
{
ClientSide.chat.New_ChatMessage("e: " + ex.Message);
PushLastProp(lastProp);
return;
}
Quaternion rotation = lastProp.transform.rotation;
Vector3 eulerAngles = ((Quaternion)(ref rotation)).eulerAngles;
eulerAngles.x += num;
eulerAngles.y += num2;
eulerAngles.z += num3;
rotation = Quaternion.Euler(eulerAngles);
Vector3 position = lastProp.transform.position;
Vector3 localScale = lastProp.transform.localScale;
NetworkServer.Destroy(lastProp);
PlaceProp(name, position, rotation, localScale);
}
}
internal static void ScaleProp(string[] inputArray)
{
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
if (inputArray.Length != 4)
{
ClientSide.chat.New_ChatMessage("invalid input");
return;
}
GameObject lastProp = GetLastProp(pop: true);
if (!((Object)(object)lastProp == (Object)null))
{
string name = ((Object)lastProp).name;
float num;
float num2;
float num3;
try
{
num = float.Parse(inputArray[1]);
num2 = float.Parse(inputArray[2]);
num3 = float.Parse(inputArray[3]);
}
catch (Exception ex)
{
ClientSide.chat.New_ChatMessage("e: " + ex.Message);
PushLastProp(lastProp);
return;
}
Vector3 localScale = lastProp.transform.localScale;
localScale.x += num;
localScale.y += num2;
localScale.z += num3;
Vector3 position = lastProp.transform.position;
Quaternion rotation = lastProp.transform.rotation;
NetworkServer.Destroy(lastProp);
PlaceProp(name, position, rotation, localScale);
}
}
internal static void PlaceProp(string name, Vector3 position, Quaternion rotation, Vector3 scale)
{
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
name = Utils.SanitizeName(name);
PlayerPropManager val = PropMod.propManagers[Player._mainPlayer];
GameObject val2 = PropMod.propPrefabs[name];
if ((Object)(object)val2 == (Object)null)
{
ClientSide.chat.New_ChatMessage("no prop with name " + name + " found");
return;
}
GameObject val3 = Object.Instantiate<GameObject>(val2, position, rotation);
val3.transform.localScale = scale;
SceneManager.MoveGameObjectToScene(val3, val.owner._playerMapInstance._loadedScene);
val3.SetActive(true);
NetworkConnection val4 = null;
NetworkServer.Spawn(val3, val4);
val.placedProps.Push(val3);
}
internal static void PushLastProp(GameObject prop)
{
Stack<GameObject> placedProps = PropMod.propManagers[Player._mainPlayer].placedProps;
placedProps.Push(prop);
}
internal static GameObject GetLastProp(bool pop)
{
Stack<GameObject> stack = null;
try
{
stack = PropMod.propManagers[Player._mainPlayer].placedProps;
}
catch (Exception)
{
ClientSide.chat.New_ChatMessage("no prop found");
return null;
}
if (stack.Count == 0)
{
ClientSide.chat.New_ChatMessage("no prop found");
return null;
}
GameObject val = (pop ? stack.Pop() : stack.Peek());
if ((Object)(object)val == (Object)null)
{
ClientSide.chat.New_ChatMessage("no prop found");
return null;
}
return val;
}
internal static void UpdateCurrentProp(Vector3 position, Vector3 rotation, Vector3 scale)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
GameObject lastProp = GetLastProp(pop: true);
string propName = Utils.GetPropName(lastProp);
NetworkServer.Destroy(lastProp);
Quaternion rotation2 = Quaternion.Euler(rotation);
PlaceProp(propName, position, rotation2, scale);
}
}
[Serializable]
public class PropWrapper
{
public List<string> propList;
}
[Serializable]
public class PropData
{
public string name;
public Vector3 position;
public Vector3 rotation;
public Vector3 scale;
}
internal class WindowManager
{
internal static GameObject prop;
private static Vector3 position;
private static Vector3 rotation;
private static Vector3 scale;
private static float px;
private static float py;
private static float pz;
private static float rx;
private static float ry;
private static float rz;
private static float sx;
private static float sy;
private static float sz;
private static string[] inputArray;
private static string pxt;
private static string pyt;
private static string pzt;
private static string rxt;
private static string ryt;
private static string rzt;
private static string sxt;
private static string syt;
private static string szt;
private static int propCount;
private static int newCount = 0;
internal static Stack<GameObject> tempProps = new Stack<GameObject>();
private static bool showPropList = false;
private static Vector2 propListScrollPosition;
private static PropWrapper wrapper;
internal static void UpdateWindowData()
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
prop = PropHelper.GetLastProp(pop: false);
if (!((Object)(object)prop == (Object)null))
{
position = prop.transform.position;
Quaternion val = prop.transform.rotation;
rotation = ((Quaternion)(ref val)).eulerAngles;
scale = prop.transform.localScale;
px = position.x;
py = position.y;
pz = position.z;
rx = rotation.x;
ry = rotation.y;
rz = rotation.z;
sx = scale.x;
sy = scale.y;
sz = scale.z;
pxt = px.ToString("0.00");
pyt = py.ToString("0.00");
pzt = pz.ToString("0.00");
rxt = rx.ToString("0.00");
ryt = ry.ToString("0.00");
rzt = rz.ToString("0.00");
sxt = sx.ToString("0.00");
syt = sy.ToString("0.00");
szt = sz.ToString("0.00");
}
}
internal static void DrawWindow(int id)
{
if (GUILayout.Button("exit", Array.Empty<GUILayoutOption>()))
{
ClientSide.ToggleWindow();
}
newCount = PropMod.propManagers[Player._mainPlayer].placedProps.Count;
if (newCount != propCount)
{
UpdateWindowData();
propCount = newCount;
}
showPropList = GUILayout.Toggle(showPropList, "show prop list", Array.Empty<GUILayoutOption>());
if (showPropList)
{
DrawPropList();
}
else if ((Object)(object)prop != (Object)null)
{
DrawManipulateProp();
}
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
if ((Object)(object)prop != (Object)null && GUILayout.Button("save all", Array.Empty<GUILayoutOption>()))
{
PropHelper.SaveProps();
}
if (GUILayout.Button("load all", Array.Empty<GUILayoutOption>()))
{
PropHelper.LoadProps();
wrapper = JsonUtility.FromJson<PropWrapper>(Utils.GetText());
}
GUILayout.EndHorizontal();
if ((Object)(object)prop != (Object)null)
{
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
if (GUILayout.Button(".undo", Array.Empty<GUILayoutOption>()))
{
PropMod.propManagers[Player._mainPlayer].UndoProp();
}
if (GUILayout.Button(".clear", Array.Empty<GUILayoutOption>()))
{
while (tempProps.Count > 0)
{
PropMod.propManagers[Player._mainPlayer].placedProps.Push(tempProps.Pop());
}
PropMod.propManagers[Player._mainPlayer].ClearProps();
}
GUILayout.EndHorizontal();
}
if (GUILayout.Button("help", Array.Empty<GUILayoutOption>()))
{
ClientSide.PropHelperHelp();
}
GUILayout.Space(10f);
GUILayout.Label("use WASDQE inside a value field.", Array.Empty<GUILayoutOption>());
GUI.DragWindow();
}
private static void DrawPropList()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
propListScrollPosition = GUILayout.BeginScrollView(propListScrollPosition, Array.Empty<GUILayoutOption>());
foreach (string key in PropMod.propPrefabs.Keys)
{
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUILayout.Label(key, Array.Empty<GUILayoutOption>());
if (GUILayout.Button(".place", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) }))
{
PropMod.propManagers[Player._mainPlayer].TryPlaceAction(key);
showPropList = false;
}
GUILayout.EndHorizontal();
}
GUILayout.EndScrollView();
}
private static void DrawManipulateProp()
{
//IL_0275: Unknown result type (might be due to invalid IL or missing references)
//IL_027a: Unknown result type (might be due to invalid IL or missing references)
//IL_027f: Unknown result type (might be due to invalid IL or missing references)
//IL_05b7: Unknown result type (might be due to invalid IL or missing references)
//IL_05bc: Unknown result type (might be due to invalid IL or missing references)
//IL_05c1: Unknown result type (might be due to invalid IL or missing references)
//IL_0863: Unknown result type (might be due to invalid IL or missing references)
//IL_0868: Unknown result type (might be due to invalid IL or missing references)
//IL_086d: Unknown result type (might be due to invalid IL or missing references)
DrawPropSelect();
GUILayout.Label("position", Array.Empty<GUILayoutOption>());
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUILayout.Label("X", Array.Empty<GUILayoutOption>());
if (GUILayout.Button("-", Array.Empty<GUILayoutOption>()))
{
px -= 1f;
pxt = px.ToString();
}
pxt = GUILayout.TextField(pxt, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(65f) });
if (GUILayout.Button("+", Array.Empty<GUILayoutOption>()))
{
px += 1f;
pxt = px.ToString();
}
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUILayout.Label("Y", Array.Empty<GUILayoutOption>());
if (GUILayout.Button("-", Array.Empty<GUILayoutOption>()))
{
py -= 1f;
pyt = px.ToString();
}
pyt = GUILayout.TextField(pyt, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(65f) });
if (GUILayout.Button("+", Array.Empty<GUILayoutOption>()))
{
py += 1f;
pyt = px.ToString();
}
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUILayout.Label("Z", Array.Empty<GUILayoutOption>());
if (GUILayout.Button("-", Array.Empty<GUILayoutOption>()))
{
pz -= 1f;
pzt = px.ToString();
}
pzt = GUILayout.TextField(pzt, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(65f) });
if (GUILayout.Button("+", Array.Empty<GUILayoutOption>()))
{
pz += 1f;
pzt = px.ToString();
}
GUILayout.EndHorizontal();
if (GUILayout.Button("move", Array.Empty<GUILayoutOption>()))
{
float.TryParse(pxt, out position.x);
float.TryParse(pyt, out position.y);
float.TryParse(pzt, out position.z);
PropHelper.UpdateCurrentProp(position, rotation, scale);
UpdateWindowData();
}
GUILayout.Label("rotation", Array.Empty<GUILayoutOption>());
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUILayout.Label("X", Array.Empty<GUILayoutOption>());
if (GUILayout.Button("-", Array.Empty<GUILayoutOption>()))
{
rx = ((rx - 1f < 0f) ? 360f : (rx - 1f));
rxt = rx.ToString();
}
rxt = GUILayout.TextField(rxt, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(65f) });
if (GUILayout.Button("+", Array.Empty<GUILayoutOption>()))
{
rx = ((rx + 1f > 360f) ? 0f : (rx + 1f));
rxt = rx.ToString();
}
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUILayout.Label("Y", Array.Empty<GUILayoutOption>());
if (GUILayout.Button("-", Array.Empty<GUILayoutOption>()))
{
ry = ((ry - 1f < 0f) ? 360f : (ry - 1f));
ryt = ry.ToString();
}
ryt = GUILayout.TextField(ryt, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(65f) });
if (GUILayout.Button("+", Array.Empty<GUILayoutOption>()))
{
ry = ((ry + 1f > 360f) ? 0f : (ry + 1f));
ryt = ry.ToString();
}
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUILayout.Label("Z", Array.Empty<GUILayoutOption>());
if (GUILayout.Button("-", Array.Empty<GUILayoutOption>()))
{
rz = ((rz - 1f < 0f) ? 360f : (rz - 1f));
rzt = rz.ToString();
}
rzt = GUILayout.TextField(rzt, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(65f) });
if (GUILayout.Button("+", Array.Empty<GUILayoutOption>()))
{
rz = ((rz + 1f > 360f) ? 0f : (rz + 1f));
rzt = rz.ToString();
}
GUILayout.EndHorizontal();
if (GUILayout.Button("rotate", Array.Empty<GUILayoutOption>()))
{
float.TryParse(rxt, out rx);
float.TryParse(ryt, out ry);
float.TryParse(rzt, out rz);
rotation.x = rx;
rotation.y = ry;
rotation.z = rz;
PropHelper.UpdateCurrentProp(position, rotation, scale);
UpdateWindowData();
}
GUILayout.Label("scale", Array.Empty<GUILayoutOption>());
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUILayout.Label("X", Array.Empty<GUILayoutOption>());
if (GUILayout.Button("-", Array.Empty<GUILayoutOption>()))
{
sx -= 0.5f;
sxt = sx.ToString();
}
sxt = GUILayout.TextField(sxt, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(65f) });
if (GUILayout.Button("+", Array.Empty<GUILayoutOption>()))
{
sx += 0.5f;
sxt = sx.ToString();
}
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUILayout.Label("Y", Array.Empty<GUILayoutOption>());
if (GUILayout.Button("-", Array.Empty<GUILayoutOption>()))
{
sy -= 0.5f;
syt = sy.ToString();
}
syt = GUILayout.TextField(syt, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(65f) });
if (GUILayout.Button("+", Array.Empty<GUILayoutOption>()))
{
sy += 0.5f;
syt = sy.ToString();
}
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUILayout.Label("Z", Array.Empty<GUILayoutOption>());
if (GUILayout.Button("-", Array.Empty<GUILayoutOption>()))
{
sz -= 0.5f;
szt = sz.ToString();
}
szt = GUILayout.TextField(szt, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(65f) });
if (GUILayout.Button("+", Array.Empty<GUILayoutOption>()))
{
sz += 0.5f;
szt = sz.ToString();
}
GUILayout.EndHorizontal();
if (GUILayout.Button("scale", Array.Empty<GUILayoutOption>()))
{
float.TryParse(sxt, out sx);
float.TryParse(syt, out sy);
float.TryParse(szt, out sz);
scale.x = sx;
scale.y = sy;
scale.z = sz;
PropHelper.UpdateCurrentProp(position, rotation, scale);
UpdateWindowData();
}
if (GUILayout.Button("move to player", Array.Empty<GUILayoutOption>()))
{
inputArray = new string[1] { "" };
PropHelper.MoveProp(inputArray);
UpdateWindowData();
}
ScanInputsForKeys();
EscapeInputs();
DrawSaveOptions();
}
private static void DrawPropSelect()
{
if (PropMod.propManagers[Player._mainPlayer].placedProps.Count > 1 || tempProps.Count > 0)
{
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
if (GUILayout.Button("<", Array.Empty<GUILayoutOption>()))
{
if (PropMod.propManagers[Player._mainPlayer].placedProps.Count == 1)
{
while (tempProps.Count > 0)
{
PropMod.propManagers[Player._mainPlayer].placedProps.Push(tempProps.Pop());
}
}
else
{
tempProps.Push(PropHelper.GetLastProp(pop: true));
}
}
GUILayout.Label(Utils.GetPropName(prop), Array.Empty<GUILayoutOption>());
if (GUILayout.Button(">", Array.Empty<GUILayoutOption>()))
{
if (tempProps.Count == 0)
{
while (PropMod.propManagers[Player._mainPlayer].placedProps.Count > 1)
{
tempProps.Push(PropMod.propManagers[Player._mainPlayer].placedProps.Pop());
}
}
else
{
PropMod.propManagers[Player._mainPlayer].placedProps.Push(tempProps.Pop());
}
}
GUILayout.EndHorizontal();
}
else
{
GUILayout.Label(Utils.GetPropName(prop), Array.Empty<GUILayoutOption>());
}
}
private static void ScanInputsForKeys()
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_0195: Unknown result type (might be due to invalid IL or missing references)
//IL_019a: Unknown result type (might be due to invalid IL or missing references)
//IL_019f: Unknown result type (might be due to invalid IL or missing references)
//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0247: Unknown result type (might be due to invalid IL or missing references)
//IL_024c: Unknown result type (might be due to invalid IL or missing references)
//IL_0251: Unknown result type (might be due to invalid IL or missing references)
//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0303: Unknown result type (might be due to invalid IL or missing references)
//IL_0352: Unknown result type (might be due to invalid IL or missing references)
//IL_0357: Unknown result type (might be due to invalid IL or missing references)
//IL_035c: Unknown result type (might be due to invalid IL or missing references)
//IL_03ab: Unknown result type (might be due to invalid IL or missing references)
//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
//IL_03b5: Unknown result type (might be due to invalid IL or missing references)
//IL_0404: Unknown result type (might be due to invalid IL or missing references)
//IL_0409: Unknown result type (might be due to invalid IL or missing references)
//IL_040e: Unknown result type (might be due to invalid IL or missing references)
//IL_045d: Unknown result type (might be due to invalid IL or missing references)
//IL_0462: Unknown result type (might be due to invalid IL or missing references)
//IL_0467: Unknown result type (might be due to invalid IL or missing references)
//IL_04b6: Unknown result type (might be due to invalid IL or missing references)
//IL_04bb: Unknown result type (might be due to invalid IL or missing references)
//IL_04c0: Unknown result type (might be due to invalid IL or missing references)
//IL_050f: Unknown result type (might be due to invalid IL or missing references)
//IL_0514: Unknown result type (might be due to invalid IL or missing references)
//IL_0519: Unknown result type (might be due to invalid IL or missing references)
//IL_0568: Unknown result type (might be due to invalid IL or missing references)
//IL_056d: Unknown result type (might be due to invalid IL or missing references)
//IL_0572: Unknown result type (might be due to invalid IL or missing references)
//IL_05c1: Unknown result type (might be due to invalid IL or missing references)
//IL_05c6: Unknown result type (might be due to invalid IL or missing references)
//IL_05cb: Unknown result type (might be due to invalid IL or missing references)
//IL_0617: Unknown result type (might be due to invalid IL or missing references)
//IL_061c: Unknown result type (might be due to invalid IL or missing references)
//IL_0621: Unknown result type (might be due to invalid IL or missing references)
if ((pxt + pyt + pzt).Contains("s"))
{
position.z += 1f;
PropHelper.UpdateCurrentProp(position, rotation, scale);
UpdateWindowData();
}
else if ((pxt + pyt + pzt).Contains("w"))
{
position.z -= 1f;
PropHelper.UpdateCurrentProp(position, rotation, scale);
UpdateWindowData();
}
else if ((pxt + pyt + pzt).Contains("a"))
{
position.x += 1f;
PropHelper.UpdateCurrentProp(position, rotation, scale);
UpdateWindowData();
}
else if ((pxt + pyt + pzt).Contains("d"))
{
position.x -= 1f;
PropHelper.UpdateCurrentProp(position, rotation, scale);
UpdateWindowData();
}
else if ((pxt + pyt + pzt).Contains("e"))
{
position.y += 1f;
PropHelper.UpdateCurrentProp(position, rotation, scale);
UpdateWindowData();
}
else if ((pxt + pyt + pzt).Contains("q"))
{
position.y -= 1f;
PropHelper.UpdateCurrentProp(position, rotation, scale);
UpdateWindowData();
}
else if ((rxt + ryt + rzt).Contains("w"))
{
rotation.x += 1f;
PropHelper.UpdateCurrentProp(position, rotation, scale);
UpdateWindowData();
}
else if ((rxt + ryt + rzt).Contains("s"))
{
rotation.x -= 1f;
PropHelper.UpdateCurrentProp(position, rotation, scale);
UpdateWindowData();
}
else if ((rxt + ryt + rzt).Contains("q"))
{
rotation.z += 1f;
PropHelper.UpdateCurrentProp(position, rotation, scale);
UpdateWindowData();
}
else if ((rxt + ryt + rzt).Contains("e"))
{
rotation.z -= 1f;
PropHelper.UpdateCurrentProp(position, rotation, scale);
UpdateWindowData();
}
else if ((rxt + ryt + rzt).Contains("d"))
{
rotation.y += 1f;
PropHelper.UpdateCurrentProp(position, rotation, scale);
UpdateWindowData();
}
else if ((rxt + ryt + rzt).Contains("a"))
{
rotation.y -= 1f;
PropHelper.UpdateCurrentProp(position, rotation, scale);
UpdateWindowData();
}
else if ((sxt + syt + szt).Contains("d"))
{
scale.x += 0.5f;
PropHelper.UpdateCurrentProp(position, rotation, scale);
UpdateWindowData();
}
else if ((sxt + syt + szt).Contains("a"))
{
scale.x -= 0.5f;
PropHelper.UpdateCurrentProp(position, rotation, scale);
UpdateWindowData();
}
else if ((sxt + syt + szt).Contains("w"))
{
scale.z += 0.5f;
PropHelper.UpdateCurrentProp(position, rotation, scale);
UpdateWindowData();
}
else if ((sxt + syt + szt).Contains("s"))
{
scale.z -= 0.5f;
PropHelper.UpdateCurrentProp(position, rotation, scale);
UpdateWindowData();
}
else if ((sxt + syt + szt).Contains("e"))
{
scale.y += 0.5f;
PropHelper.UpdateCurrentProp(position, rotation, scale);
UpdateWindowData();
}
else if ((sxt + syt + szt).Contains("q"))
{
scale.y -= 0.5f;
PropHelper.UpdateCurrentProp(position, rotation, scale);
UpdateWindowData();
}
}
private static void EscapeInputs()
{
if (!float.TryParse(pxt, out var result))
{
pxt = px.ToString();
}
if (!float.TryParse(pyt, out result))
{
pyt = py.ToString();
}
if (!float.TryParse(pzt, out result))
{
pzt = pz.ToString();
}
if (!float.TryParse(rxt, out result))
{
rxt = rx.ToString();
}
if (!float.TryParse(ryt, out result))
{
ryt = ry.ToString();
}
if (!float.TryParse(rzt, out result))
{
rzt = rz.ToString();
}
if (!float.TryParse(sxt, out result))
{
sxt = sx.ToString();
}
if (!float.TryParse(syt, out result))
{
syt = sy.ToString();
}
if (!float.TryParse(szt, out result))
{
szt = sz.ToString();
}
}
private static void DrawSaveOptions()
{
//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
bool flag = false;
if (wrapper != null)
{
foreach (string prop in wrapper.propList)
{
PropData propData = JsonUtility.FromJson<PropData>(prop);
if (!(Utils.GetPropName(WindowManager.prop) == propData.name) || !(propData.position == position) || !(propData.rotation == rotation) || !(propData.scale == scale))
{
continue;
}
flag = true;
bool flag2 = false;
bool flag3 = false;
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
if (GUILayout.Button("remove from savefile", Array.Empty<GUILayoutOption>()))
{
flag2 = true;
}
if (GUILayout.Button("remove and delete", Array.Empty<GUILayoutOption>()))
{
flag2 = true;
flag3 = true;
}
GUILayout.EndHorizontal();
if (flag2)
{
if (flag3)
{
PropMod.propManagers[Player._mainPlayer].UndoProp();
UpdateWindowData();
}
wrapper.propList.Remove(prop);
string contents = JsonUtility.ToJson((object)wrapper, true);
File.WriteAllText(Path.Combine(Paths.ConfigPath, "PropHelper.json"), contents);
ClientSide.chat.New_ChatMessage("prop removed");
}
break;
}
}
if (!flag && GUILayout.Button("save prop", Array.Empty<GUILayoutOption>()))
{
wrapper = JsonUtility.FromJson<PropWrapper>(Utils.GetText());
PropData propData2 = new PropData
{
name = Utils.GetPropName(WindowManager.prop),
position = position,
rotation = rotation,
scale = scale
};
wrapper.propList.Add(JsonUtility.ToJson((object)propData2));
string contents2 = JsonUtility.ToJson((object)wrapper, true);
File.WriteAllText(Path.Combine(Paths.ConfigPath, "PropHelper.json"), contents2);
ClientSide.chat.New_ChatMessage("prop saved");
}
}
}
internal class Utils
{
internal static string GetPropName(GameObject prop)
{
return SanitizeName(((Object)prop).name.ToString());
}
internal static string SanitizeName(string name)
{
name = name.ToLower();
if (name.Contains("(clone)"))
{
name = name.Substring(0, name.IndexOf("("));
}
return name;
}
internal static void FlushTempToProps()
{
while (WindowManager.tempProps.Count > 0)
{
PropMod.propManagers[Player._mainPlayer].placedProps.Push(WindowManager.tempProps.Pop());
}
}
internal static string[] GetLines()
{
string path = Path.Combine(Paths.ConfigPath, "PropHelper.json");
if (!File.Exists(path))
{
ClientSide.chat.New_ChatMessage("savefile not found");
return null;
}
string[] array = File.ReadAllLines(path);
if (array.Length < 1)
{
ClientSide.chat.New_ChatMessage("savefile empty");
return null;
}
return array;
}
internal static string GetText()
{
string path = Path.Combine(Paths.ConfigPath, "PropHelper.json");
if (!File.Exists(path))
{
ClientSide.chat.New_ChatMessage("savefile not found");
return null;
}
string text = File.ReadAllText(path);
if (text == "")
{
ClientSide.chat.New_ChatMessage("savefile empty");
return null;
}
return text;
}
}