Decompiled source of DevTools v1.1.0
DevTools.dll
Decompiled a month ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using BepInEx.Unity.IL2CPP.UnityEngine; using HarmonyLib; using Il2CppSystem.Collections.Generic; using SOD.Common; using SOD.Common.Extensions; using Steamworks; using UnityEngine; using UnityEngine.UI; using UnityStandardAssets.Characters.FirstPerson; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("DevTools")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+fd18034234b1bc5b3744e48ee190066c38503ea8")] [assembly: AssemblyProduct("DevTools")] [assembly: AssemblyTitle("DevTools")] [assembly: AssemblyVersion("1.0.0.0")] [HarmonyPatch(typeof(SessionData))] [HarmonyPatch("PauseGame")] public class PauseGameManager { public static void Prefix(ref bool showPauseText, ref bool delayOverride, ref bool openDesktopMode) { GameStateVars.isPaused = true; } } [HarmonyPatch(typeof(SessionData))] [HarmonyPatch("ResumeGame")] public class ResumeGameManager { public static void Prefix() { GameStateVars.isPaused = false; } } public class GameStateVars { public static bool isPaused; } [HarmonyPatch(typeof(MurderController))] [HarmonyPatch("SpawnItem")] public class SpawnItemManager { public static void Prefix(ref Murder murder, ref InteractablePreset spawnItem, ref LeadSpawnWhere spawnWhere, ref LeadCitizen spawnBelongsTo, ref LeadCitizen spawnWriter, ref LeadCitizen spawnReceiver, ref int security, ref OwnedPlacementRule ownedRule, ref int priority, ref JobTag itemTag) { } } public class PlayerInfoProvider { private FirstPersonController playerObject = Object.FindObjectOfType<FirstPersonController>(); public Vector3Int GetPlayerLocation() { //IL_004f: 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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)playerObject != (Object)null) { Vector3 position = ((Component)playerObject).transform.position; return new Vector3Int(Mathf.RoundToInt(position.x), Mathf.RoundToInt(position.y), Mathf.RoundToInt(position.z)); } return new Vector3Int(0, 0, 0); } public void SetPlayerLocation(Vector3 loc) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) ((Component)playerObject).transform.position = loc; } public void SetPlayerNode(Vector3Int loc) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) Player instance = Player.Instance; ((Actor)instance).currentNodeCoord = loc; } public NewNode GetPlayerNode() { Player instance = Player.Instance; return ((Actor)instance).currentNode; } public Vector3 GetPlayerNodeCoord() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) Player instance = Player.Instance; return Vector3Int.op_Implicit(((Actor)instance).currentNodeCoord); } public bool GetIsRunning() { Player instance = Player.Instance; return ((Actor)instance).isRunning; } public void SetIsRunning(bool isRunning) { Player instance = Player.Instance; ((Actor)instance).isRunning = isRunning; } public bool GetHasJumped() { FirstPersonController val = Object.FindObjectOfType<FirstPersonController>(); return val.m_Jump; } public bool GetIsJumping() { FirstPersonController val = Object.FindObjectOfType<FirstPersonController>(); return val.m_Jumping; } public void SetIsJumping(bool jump) { FirstPersonController val = Object.FindObjectOfType<FirstPersonController>(); val.m_Jumping = jump; } public bool GetIsGrounded() { Player instance = Player.Instance; return instance.isGrounded; } public void SetIsGrounded(bool grounded) { Player instance = Player.Instance; instance.isGrounded = grounded; } public void AddPoisoned(float amount, Human who) { Player instance = Player.Instance; ((Human)instance).AddPoisoned(amount, (Human)(object)instance); } public float GetMovementRunSpeed() { GameplayControls instance = GameplayControls.Instance; return instance.playerRunSpeed; } public void SetMovementRunSpeed(float setMovementRunSpeed) { GameplayControls instance = GameplayControls.Instance; instance.playerRunSpeed = setMovementRunSpeed; } public float GetMovementWalkSpeed() { GameplayControls instance = GameplayControls.Instance; return instance.playerWalkSpeed; } public void SetMovementWalkSpeed(float setMovementWalkSpeed) { GameplayControls instance = GameplayControls.Instance; instance.playerWalkSpeed = setMovementWalkSpeed; } public float GetCurrentHealth() { Player instance = Player.Instance; return ((Actor)instance).currentHealth; } public void SetCurrentHealth(float health) { Player instance = Player.Instance; ((Actor)instance).currentHealth = health; } public string GetPassword() { Player instance = Player.Instance; List<int> digits = ((Human)instance).passcode.digits; StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < digits.Count; i++) { stringBuilder.Append(digits[i].ToString()); } return stringBuilder.ToString(); } public void SetPassword(string passcode) { Player instance = Player.Instance; ((Human)instance).passcode.digits.Clear(); for (int i = 0; i < passcode.Length; i++) { char c = passcode[i]; if (char.IsDigit(c)) { ((Human)instance).passcode.digits.Add(int.Parse(c.ToString())); continue; } break; } } public bool IsOnDuty() { Player instance = Player.Instance; return ((Actor)instance).isOnDuty; } public bool IsCurrentlyInAutoTravel() { Player instance = Player.Instance; return instance.autoTravelActive; } public float GetBlackEye() { Player instance = Player.Instance; return ((Human)instance).blackEye; } public void SetBlackEye(float amount) { Player instance = Player.Instance; ((Human)instance).blackEye = amount; } public float GetBlackedOut() { Player instance = Player.Instance; return ((Human)instance).blackedOut; } public void SetBlackedOut(float amount) { Player instance = Player.Instance; ((Human)instance).blackedOut = amount; } public float GetBleeding() { Player instance = Player.Instance; return ((Human)instance).bleeding; } public void SetBleeding(float amount) { Player instance = Player.Instance; ((Human)instance).bleeding = amount; } public void AddBleeding(float amount) { Player instance = Player.Instance; ((Human)instance).AddBleeding(amount); } public void AddDrunk(float amount) { Player instance = Player.Instance; ((Human)instance).AddDrunk(amount); } public void AddBruised(float amount) { Player instance = Player.Instance; ((Human)instance).AddBruised(amount); } public Telephone GetAnsweringPhone() { Player instance = Player.Instance; return instance.answeringPhone; } public List<NewAddress> ApartmentsOwned() { Player instance = Player.Instance; return instance.apartmentsOwned; } public float GetDrunk() { Player instance = Player.Instance; return ((Human)instance).drunk; } public void SetDrunk(float amount) { Player instance = Player.Instance; ((Human)instance).drunk = amount; } public float GetBruised() { Player instance = Player.Instance; return ((Human)instance).bruised; } public void SetBruised(float amount) { Player instance = Player.Instance; ((Human)instance).bruised = amount; } public float GetPoisoned() { Player instance = Player.Instance; return ((Human)instance).poisoned; } public void SetPoisoned(float amount) { Player instance = Player.Instance; ((Human)instance).poisoned = amount; } public bool GetIsDead() { Player instance = Player.Instance; return ((Actor)instance).isDead; } public void AddHealth(float amount) { Player instance = Player.Instance; ((Actor)instance).AddHealth(amount, true, false); } public void EndAutoTravel() { Player instance = Player.Instance; instance.EndAutoTravel(); } public void AddSick(float amount) { Player instance = Player.Instance; ((Human)instance).AddSick(amount); } public void AddHeadache(float amount) { Player instance = Player.Instance; ((Human)instance).AddHeadache(amount); } public void AddWet(float amount) { Player instance = Player.Instance; ((Human)instance).AddWet(amount); } public void AddBrokenLeg(float amount) { Player instance = Player.Instance; ((Human)instance).AddBrokenLeg(amount); } public void AddNumb(float amount) { Player instance = Player.Instance; ((Human)instance).AddNumb(amount); } public void KillPlayer() { Player instance = Player.Instance; instance.KillPlayer(); } public void Trip(float damage, bool forwards = false, bool playSound = true) { Player instance = Player.Instance; instance.Trip(damage, forwards, playSound); } public void SetMaxSpeed(float walkSpeed, float runSpeed) { Player instance = Player.Instance; instance.SetMaxSpeed(walkSpeed, runSpeed); } public void EnablePlayerMovement(bool val, bool updateCulling = true) { Player instance = Player.Instance; instance.EnablePlayerMovement(val, updateCulling); } public void EnablePlayerMouseLook(bool val, bool forceHideMouseOnDisable = false) { Player instance = Player.Instance; instance.EnablePlayerMouseLook(val, forceHideMouseOnDisable); } public void EnableCharacterController(bool val) { Player instance = Player.Instance; instance.EnableCharacterController(val); } public void SetLockpickingState(bool val) { Player instance = Player.Instance; instance.SetLockpickingState(val); } public void AddNourishment(float amount) { Player instance = Player.Instance; ((Human)instance).AddNourishment(amount); } public void AddHydration(float amount) { Player instance = Player.Instance; ((Human)instance).AddHydration(amount); } public void AddEnergy(float amount) { Player instance = Player.Instance; ((Human)instance).AddEnergy(amount); } public void AddHygiene(float amount) { Player instance = Player.Instance; ((Human)instance).AddHygiene(amount); } public void AddHeat(float amount) { Player instance = Player.Instance; ((Human)instance).AddHeat(amount); } public float GetPlayerHeightNormal() { Player instance = Player.Instance; return instance.GetPlayerHeightNormal(); } public float GetPlayerHeightCrouched() { Player instance = Player.Instance; return instance.GetPlayerHeightCrouched(); } public void SetPlayerHeight(float height, bool stayOnFloorPlane = true) { Player instance = Player.Instance; instance.SetPlayerHeight(height, stayOnFloorPlane); } public void SetCameraHeight(float height) { Player instance = Player.Instance; instance.SetCameraHeight(height); } public float GetNourishment() { Player instance = Player.Instance; return ((Human)instance).nourishment; } public float GetHydration() { Player instance = Player.Instance; return ((Human)instance).hydration; } public float GetEnergy() { Player instance = Player.Instance; return ((Human)instance).energy; } public float GetAlertness() { Player instance = Player.Instance; return ((Human)instance).alertness; } public float GetHygiene() { Player instance = Player.Instance; return ((Human)instance).hygiene; } public float GetHeat() { Player instance = Player.Instance; return ((Human)instance).heat; } public float GetHeadache() { Player instance = Player.Instance; return ((Human)instance).headache; } public float GetWet() { Player instance = Player.Instance; return ((Human)instance).wet; } public float GetBrokenLeg() { Player instance = Player.Instance; return ((Human)instance).brokenLeg; } public float GetNumb() { Player instance = Player.Instance; return ((Human)instance).numb; } public float GetSick() { Player instance = Player.Instance; return ((Human)instance).sick; } public bool GetIsLockpicking() { Player instance = Player.Instance; return instance.isLockpicking; } public bool GetIsHiding() { Player instance = Player.Instance; return ((Actor)instance).isHiding; } public bool GetIsCrouched() { Player instance = Player.Instance; return ((Actor)instance).isCrouched; } } namespace DevTools; [HarmonyPatch(typeof(BioScreenController), "UpdateDecorEditButton")] public class BioScreenControllerPatch { public static List<NewGameLocation> businessLocations = new List<NewGameLocation>(); public static bool Prefix(BioScreenController __instance) { if (SessionData.Instance.isFloorEdit) { return true; } bool flag = (Object)(object)((Actor)Player.Instance).currentGameLocation == (Object)(object)((Human)Player.Instance).home; bool flag2 = false; Enumerator<NewAddress> enumerator = Player.Instance.apartmentsOwned.GetEnumerator(); while (enumerator.MoveNext()) { NewAddress current = enumerator.Current; if ((Object)(object)current == (Object)(object)((Actor)Player.Instance).currentGameLocation) { flag2 = true; break; } } bool flag3 = businessLocations.Contains(((Actor)Player.Instance).currentGameLocation); bool flag4 = Game.Instance.sandboxMode || ChapterController.Instance.currentPart >= 30; if ((flag || flag2 || flag3) && flag4) { ((Component)__instance.editDecorButton).gameObject.SetActive(true); return false; } ((Component)__instance.editDecorButton).gameObject.SetActive(false); return false; } } [AttributeUsage(AttributeTargets.Method, Inherited = false)] public class CommandAttribute : Attribute { public string CommandName { get; } public CommandAttribute(string commandName) { CommandName = commandName; } } public static class CommandManager { private static Dictionary<string, Action<string[]>> commands; private static Dictionary<string, Vector3> teleportPoints; private static bool godmode; private static bool noclip; public static Human storedHuman; public static Interactable storedItem; public static MurderController murderController; public static Player player; public static PlayerInfoProvider playerInfoProvider; public static VictimInfoHelper victimInfoHelper; public static MurdererInfoProvider murdererInfoProvider; public static StoredHumanInfoProvider storedHumanInfoProvider; public static PurpInfoProvider purpInfoProvider; public static PosterInfoProvider posterInfoProvider; public static GameplayController controller; public static SideJob sideJob; static CommandManager() { commands = new Dictionary<string, Action<string[]>>(); teleportPoints = new Dictionary<string, Vector3>(); godmode = false; noclip = false; Initialize(); } public static void Initialize() { IEnumerable<MethodInfo> enumerable = from m in typeof(CommandManager).GetMethods(BindingFlags.Static | BindingFlags.NonPublic) where m.GetCustomAttribute<CommandAttribute>() != null select m; foreach (MethodInfo item in enumerable) { CommandAttribute customAttribute = item.GetCustomAttribute<CommandAttribute>(); RegisterCommands(customAttribute.CommandName, (Action<string[]>)Delegate.CreateDelegate(typeof(Action<string[]>), item)); } } public static void RegisterCommands(string commandName, Action<string[]> commandAction) { commands[commandName.ToLower()] = commandAction; } public static void ExecuteCommand(string command) { if (string.IsNullOrEmpty(command)) { return; } playerInfoProvider = new PlayerInfoProvider(); victimInfoHelper = new VictimInfoHelper(); purpInfoProvider = new PurpInfoProvider(); posterInfoProvider = new PosterInfoProvider(); murdererInfoProvider = new MurdererInfoProvider(); storedHumanInfoProvider = new StoredHumanInfoProvider(); player = Player.Instance; murderController = MurderController.Instance; string[] array = command.Split(new char[1] { ' ' }, StringSplitOptions.RemoveEmptyEntries); if (array.Length == 0) { return; } string text = array[0].ToLower(); string[] obj = array.Skip(1).ToArray(); if (commands.TryGetValue(text, out var value)) { try { value(obj); return; } catch (Exception ex) { Lib.GameMessage.ShowPlayerSpeech("Error executing command: " + ex.Message, 3f, true); return; } } Lib.GameMessage.ShowPlayerSpeech("Unknown command: " + text, 3f, true); } private static void SendChatMessage(string message) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown Lib.GameMessage.ShowPlayerSpeech(message, 5f, true); ManualLogSource logger = DevTools.Logger; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(19, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Chat Message Sent: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(message); } logger.LogInfo(val); ExtModLog.LogInfo("Chat Message Sent: " + message); } [Command("/say")] private static void SayCommand(string[] args) { //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown if (args.Length < 3) { Lib.GameMessage.ShowPlayerSpeech("Invalid usage. Use: /say <string> <float> <bool>", 2f, true); return; } string text = string.Join(" ", args.Take(args.Length - 2)); string s = args[^2]; string value = args[^1]; if (!float.TryParse(s, out var result)) { Lib.GameMessage.ShowPlayerSpeech("Invalid float value. Please provide a valid number.", 2f, true); return; } if (!bool.TryParse(value, out var result2)) { Lib.GameMessage.ShowPlayerSpeech("Invalid boolean value. Please provide 'true' or 'false'.", 2f, true); return; } Lib.GameMessage.ShowPlayerSpeech(text, result, result2); ManualLogSource logger = DevTools.Logger; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(35, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Command Executed: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", Float: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(result); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", Bool: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(result2); } logger.LogInfo(val); } [Command("/cloneMe")] private static void CloneMeCommand(string[] args) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) FirstPersonController val = Object.FindObjectOfType<FirstPersonController>(); if ((Object)(object)val != (Object)null) { GameObject val2 = Object.Instantiate<GameObject>(((Component)val).gameObject, new Vector3(1f, 1f, 1f), ((Component)val).transform.rotation); ((Object)val2).name = ((Object)val).name + "player_clone"; Lib.GameMessage.ShowPlayerSpeech("Cloning the player...", 2f, true); } else { Lib.GameMessage.ShowPlayerSpeech("Player not found!", 2f, true); } } [Command("/tp")] private static void TeleportCommand(string[] args) { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) if (args.Length < 3) { Lib.GameMessage.ShowPlayerSpeech("Invalid usage. Use: /tp <x> <y> <z>", 2f, true); return; } if (!float.TryParse(args[0], out var result) || !float.TryParse(args[1], out var result2) || !float.TryParse(args[2], out var result3)) { Lib.GameMessage.ShowPlayerSpeech("Invalid coordinates. Please provide valid numbers.", 2f, true); return; } Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(result, result2, result3); playerInfoProvider.SetPlayerLocation(val); Lib.GameMessage.ShowPlayerSpeech($"Teleported to {val}", 2f, true); } [Command("/tpe")] private static void TeleportEntityCommand(string[] args) { //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: 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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: 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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_0298: 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_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Unknown result type (might be due to invalid IL or missing references) if (args.Length != 2) { Lib.GameMessage.ShowPlayerSpeech("Invalid usage. Use: /tpe <source> <destination>", 5f, true); return; } string text = args[0].ToLower(); Vector3 val; switch (args[1].ToLower()) { case "player": val = Vector3Int.op_Implicit(playerInfoProvider.GetPlayerLocation()); break; case "murderer": val = Vector3Int.op_Implicit(murdererInfoProvider.GetMurdererLocation()); break; case "victim": val = Vector3Int.op_Implicit(victimInfoHelper.GetVictimLocation()); break; case "poster": val = ((Component)CasePanelController.Instance.activeCase.job.poster).transform.position; break; case "purp": val = ((Component)CasePanelController.Instance.activeCase.job.purp).transform.position; break; case "stored": if ((Object)(object)storedHuman != (Object)null) { val = ((Component)storedHuman).transform.position; break; } Lib.GameMessage.ShowPlayerSpeech("No current stored citizen!", 2f, true); return; default: Lib.GameMessage.ShowPlayerSpeech("Invalid destination. Use 'player', 'murderer', 'victim', 'poster' 'purp', or 'stored'.", 2f, true); return; } switch (text) { case "player": playerInfoProvider.SetPlayerLocation(val); Lib.GameMessage.ShowPlayerSpeech("Teleported player to new location.", 2f, true); break; case "murderer": murdererInfoProvider.SetMurdererLocation(val); Lib.GameMessage.ShowPlayerSpeech("Teleported murderer to new location.", 2f, true); break; case "victim": victimInfoHelper.SetVictimLocation(val); Lib.GameMessage.ShowPlayerSpeech("Teleported victim to new location.", 2f, true); break; case "poster": ((Component)CasePanelController.Instance.activeCase.job.poster).transform.position = val; break; case "purp": ((Component)CasePanelController.Instance.activeCase.job.purp).transform.position = val; break; case "stored": if ((Object)(object)storedHuman != (Object)null) { ((Component)storedHuman).transform.position = val; } else { Lib.GameMessage.ShowPlayerSpeech("No current stored citizen!", 2f, true); } break; case "all": { Enumerator<Citizen> enumerator = CityData.Instance.citizenDirectory.GetEnumerator(); while (enumerator.MoveNext()) { Citizen current = enumerator.Current; ((Component)current).transform.position = val; } Lib.GameMessage.ShowPlayerSpeech("Teleported all citizens to new location.", 2f, true); break; } default: Lib.GameMessage.ShowPlayerSpeech("Invalid source. Use 'player' or 'murderer', 'poster', 'purp', 'all' or 'stored'.", 2f, true); break; } } [Command("/poison")] private static void PoisonEntityCommand(string[] args) { if (args.Length != 2) { Lib.GameMessage.ShowPlayerSpeech("Invalid usage. Use: /poison <entity> <amount>", 2f, true); return; } string text = args[0].ToLower(); if (!float.TryParse(args[1], out var result)) { Lib.GameMessage.ShowPlayerSpeech("Invalid usage. Use: /poison <entity> <amount>.", 2f, true); } switch (text) { case "player": playerInfoProvider.AddPoisoned(result, (Human)(object)Player.Instance); break; case "murderer": murdererInfoProvider.AddPoisoned(result, (Human)(object)Player.Instance); break; case "victim": victimInfoHelper.AddPoisoned(result, (Human)(object)Player.Instance); break; case "stored": if ((Object)(object)storedHuman != (Object)null) { storedHuman.AddPoisoned(result, (Human)(object)Player.Instance); } else { Lib.GameMessage.ShowPlayerSpeech("No current stored citizen!", 2f, true); } break; case "all": { Enumerator<Citizen> enumerator = CityData.Instance.citizenDirectory.GetEnumerator(); while (enumerator.MoveNext()) { Citizen current = enumerator.Current; ((Human)current).AddPoisoned(result, murderController.currentMurderer); } break; } default: Lib.GameMessage.ShowPlayerSpeech("Invalid entity. Use 'player', 'murderer', 'victim' or 'all'.", 2f, true); break; } } [Command("/kill")] private static void KillEntityCommand(string[] args) { //IL_0095: 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_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) //IL_00fd: 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_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) if (args.Length != 1) { Lib.GameMessage.ShowPlayerSpeech("Invalid usage. Use: /kill <entity>", 2f, true); return; } switch (args[0].ToLower()) { case "player": player.TriggerPlayerKO(Vector3.zero, 0f, false); break; case "murderer": murdererInfoProvider.KillMurderer(); break; case "victim": victimInfoHelper.KillVictim(); break; case "poster": ((Actor)CasePanelController.Instance.activeCase.job.poster).RecieveDamage(99999f, (Actor)(object)murderController.currentMurderer, Vector2.op_Implicit(Vector2.zero), Vector2.op_Implicit(Vector2.zero), (SpatterPatternPreset)null, (SpatterPatternPreset)null, (EraseMode)3, true, false, 0f, 1f, true, true, 1f); break; case "purp": ((Actor)CasePanelController.Instance.activeCase.job.purp).RecieveDamage(99999f, (Actor)(object)murderController.currentMurderer, Vector2.op_Implicit(Vector2.zero), Vector2.op_Implicit(Vector2.zero), (SpatterPatternPreset)null, (SpatterPatternPreset)null, (EraseMode)3, true, false, 0f, 1f, true, true, 1f); break; case "stored": if ((Object)(object)storedHuman != (Object)null) { ((Actor)storedHuman).RecieveDamage(99999f, (Actor)(object)Player.Instance, Vector2.op_Implicit(Vector2.zero), Vector2.op_Implicit(Vector2.zero), (SpatterPatternPreset)null, (SpatterPatternPreset)null, (EraseMode)3, true, false, 0f, 1f, false, true, 1f); ((Actor)storedHuman).isDead = true; } else { Lib.GameMessage.ShowPlayerSpeech("No current stored citizen!", 2f, true); } break; default: Lib.GameMessage.ShowPlayerSpeech("Invalid entity. Use 'player', 'murderer', 'victim', 'poster or 'purp'.", 2f, true); break; } } [Command("/ko")] private static void KOEntityCommand(string[] args) { //IL_0095: 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_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) //IL_00fd: 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_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) if (args.Length != 1) { Lib.GameMessage.ShowPlayerSpeech("Invalid usage. Use: /ko <entity>", 2f, true); return; } switch (args[0].ToLower()) { case "player": player.TriggerPlayerKO(Vector3.zero, 0f, false); break; case "murderer": murdererInfoProvider.KOMurderer(); break; case "victim": victimInfoHelper.KOVictim(); break; case "poster": ((Actor)CasePanelController.Instance.activeCase.job.poster).RecieveDamage(99999f, (Actor)(object)murderController.currentMurderer, Vector2.op_Implicit(Vector2.zero), Vector2.op_Implicit(Vector2.zero), (SpatterPatternPreset)null, (SpatterPatternPreset)null, (EraseMode)3, true, false, 0f, 1f, false, true, 1f); break; case "purp": ((Actor)CasePanelController.Instance.activeCase.job.purp).RecieveDamage(99999f, (Actor)(object)murderController.currentMurderer, Vector2.op_Implicit(Vector2.zero), Vector2.op_Implicit(Vector2.zero), (SpatterPatternPreset)null, (SpatterPatternPreset)null, (EraseMode)3, true, false, 0f, 1f, false, true, 1f); break; case "stored": if ((Object)(object)storedHuman != (Object)null) { ((Actor)storedHuman).RecieveDamage(99999f, (Actor)(object)murderController.currentMurderer, Vector2.op_Implicit(Vector2.zero), Vector2.op_Implicit(Vector2.zero), (SpatterPatternPreset)null, (SpatterPatternPreset)null, (EraseMode)3, true, false, 0f, 1f, false, true, 1f); } else { Lib.GameMessage.ShowPlayerSpeech("No current stored citizen!", 2f, true); } break; default: Lib.GameMessage.ShowPlayerSpeech("Invalid entity. Use 'player', 'murderer', 'victim', 'poster or 'purp'", 2f, true); break; } } [Command("/mName")] private static void GetMurdererFullName(string[] args) { string text = murdererInfoProvider.GetMurdererFullName().ToString(); Lib.GameMessage.ShowPlayerSpeech("Full name of murderer: " + text, 2f, true); } [Command("/vName")] private static void GetVictimFullName(string[] args) { string text = victimInfoHelper.GetVictimFullName().ToString(); Lib.GameMessage.ShowPlayerSpeech("Full name of victim: " + text, 2f, true); } [Command("/sName")] private static void GetStoredFullName(string[] args) { string text = storedHumanInfoProvider.GetStoredFullName().ToString(); Lib.GameMessage.ShowPlayerSpeech("Full name of citizen: " + text, 2f, true); } [Command("/god")] private static void GodCommand(string[] args) { if (!godmode) { ((Actor)player).SetMaxHealth(100000000f, false); ((Actor)player).SetHealth(100000000f); Lib.GameMessage.ShowPlayerSpeech("Godmode enabled.", 2f, true); godmode = true; } else { ((Actor)player).SetMaxHealth(100f, false); ((Actor)player).SetHealth(100f); Lib.GameMessage.ShowPlayerSpeech("Godmode disabled.", 2f, true); godmode = false; } } [Command("/resetHealth")] private static void ResetHealthCommand(string[] args) { ((Actor)Player.Instance).ResetHealthToMaximum(); Lib.GameMessage.ShowPlayerSpeech("Health reset.", 2f, true); } [Command("/giveMoney")] private static void GiveMoneyCommand(string[] args) { if (args.Length != 1) { Lib.GameMessage.ShowPlayerSpeech("Invalid usage. Use: /givemoney <amount>", 2f, true); return; } if (!int.TryParse(args[0], out var result)) { Lib.GameMessage.ShowPlayerSpeech("Invalid amount. Please provide a valid number.", 2f, true); return; } controller = GameplayController.Instance; controller.AddMoney(result, true, "Dev Action"); Lib.GameMessage.ShowPlayerSpeech($"Given {result} crows.", 2f, true); } [Command("/currentNode")] private static void CurrentNodeCommand(string[] args) { Lib.GameMessage.ShowPlayerSpeech($"Current Node: {playerInfoProvider.GetPlayerNode()}", 2f, true); } [Command("/currentNodeCoord")] private static void CurrentNodeCoordCommand(string[] args) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) Lib.GameMessage.ShowPlayerSpeech($"Current Node: {playerInfoProvider.GetPlayerNodeCoord()}", 2f, true); } [Command("/pos")] private static void PosCommand(string[] args) { //IL_0006: 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) //IL_002f: Unknown result type (might be due to invalid IL or missing references) Vector3 value = Vector3Int.op_Implicit(playerInfoProvider.GetPlayerLocation()); Lib.GameMessage.ShowPlayerSpeech($"Current Position: {value}", 2f, true); } [Command("/killAll")] private static void KillAllCommand(string[] args) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) Enumerator<Citizen> enumerator = CityData.Instance.citizenDirectory.GetEnumerator(); while (enumerator.MoveNext()) { Citizen current = enumerator.Current; ((Actor)current).RecieveDamage(99999f, (Actor)(object)Player.Instance, Vector2.op_Implicit(Vector2.zero), Vector2.op_Implicit(Vector2.zero), (SpatterPatternPreset)null, (SpatterPatternPreset)null, (EraseMode)3, true, false, 0f, 1f, false, true, 1f); ((Actor)current).isDead = true; } Lib.GameMessage.ShowPlayerSpeech("Killed everyone.", 2f, true); } [Command("/koAll")] private static void KOAllCommand(string[] args) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) Enumerator<Citizen> enumerator = CityData.Instance.citizenDirectory.GetEnumerator(); while (enumerator.MoveNext()) { Citizen current = enumerator.Current; ((Actor)current).RecieveDamage(99999f, (Actor)(object)Player.Instance, Vector2.op_Implicit(Vector2.zero), Vector2.op_Implicit(Vector2.zero), (SpatterPatternPreset)null, (SpatterPatternPreset)null, (EraseMode)3, true, false, 0f, 1f, false, true, 1f); } Lib.GameMessage.ShowPlayerSpeech("KO'd everyone.", 2f, true); } [Command("/passcode")] private static void GetEntityPasscodeCommand(string[] args) { if (args.Length != 1) { Lib.GameMessage.ShowPlayerSpeech("Invalid usage. Use: /passcode <entity>", 2f, true); return; } switch (args[0].ToLower()) { case "player": Lib.GameMessage.ShowPlayerSpeech("Your passcode is: " + playerInfoProvider.GetPassword().ToString(), 2f, true); break; case "murderer": Lib.GameMessage.ShowPlayerSpeech("Murderer passcode is: " + murdererInfoProvider.GetPassword().ToString(), 2f, true); break; case "victim": Lib.GameMessage.ShowPlayerSpeech("Victim passcode is: " + victimInfoHelper.GetPassword().ToString(), 2f, true); break; case "poster": Lib.GameMessage.ShowPlayerSpeech("Poster passcode is: " + purpInfoProvider.GetPassword().ToString(), 2f, true); break; case "purp": Lib.GameMessage.ShowPlayerSpeech("Purp passcode is: " + purpInfoProvider.GetPassword().ToString(), 2f, true); break; case "stored": if ((Object)(object)storedHuman != (Object)null) { Lib.GameMessage.ShowPlayerSpeech("Stored citizen passcode is: " + storedHumanInfoProvider.GetPassword().ToString(), 2f, true); } else { Lib.GameMessage.ShowPlayerSpeech("No current stored citizen!", 2f, true); } break; default: Lib.GameMessage.ShowPlayerSpeech("Invalid entity. Use 'player', 'murderer', 'victim', 'poster' or 'purp'.", 2f, true); break; } } [Command("/setPasscode")] private static void SetPasscodeCommand(string[] args) { if (args.Length != 1 || string.IsNullOrEmpty(args[0])) { Lib.GameMessage.ShowPlayerSpeech("Invalid usage. Use: /setpasscode <passcode>", 2f, true); return; } string text = args[0]; if (!text.All(char.IsDigit)) { Lib.GameMessage.ShowPlayerSpeech("Passcode should only contain digits.", 2f, true); return; } playerInfoProvider.SetPassword(text); Lib.GameMessage.ShowPlayerSpeech("Passcode set to " + text + ".", 2f, true); } [Command("/allowEverywhere")] private static void AllowedEverywhereCommand(string[] args) { CityData instance = CityData.Instance; Enumerator<NewGameLocation> enumerator = instance.gameLocationDirectory.GetEnumerator(); while (enumerator.MoveNext()) { NewGameLocation current = enumerator.Current; ((Actor)Player.Instance).AddLocationOfAuthorty(current); } Lib.GameMessage.ShowPlayerSpeech("Authorising player everywhere.", 2f, true); } [Command("/room")] private static void GetCurrentRoomNameAndPreset(string[] args) { NewRoom currentRoom = ((Actor)Player.Instance).currentRoom; string value = ((currentRoom.name != null) ? currentRoom.name : "unnamed"); string value2 = (((SoCustomComparison)(object)currentRoom.preset != (SoCustomComparison)null) ? ((Object)currentRoom.preset).name : "no preset"); string text = (((Object)(object)currentRoom.building != (Object)null) ? ((Object)currentRoom.building).name : "unknown building"); string value3 = (((Object)(object)currentRoom.floor != (Object)null) ? ((Object)currentRoom.floor).name : "unknown floor"); string text2 = "unknown"; string text3 = "unknown"; if ((Object)(object)currentRoom.building != (Object)null) { Enumerator<NewGameLocation> enumerator = CityData.Instance.gameLocationDirectory.GetEnumerator(); while (enumerator.MoveNext()) { NewGameLocation current = enumerator.Current; if ((Object)(object)current != (Object)null && (Object)(object)current.thisAsAddress != (Object)null && ((NewGameLocation)current.thisAsAddress).building.buildingID == currentRoom.building.buildingID) { text2 = ((Object)current.thisAsAddress).name; text3 = ((Object)current).name; break; } } } Lib.GameMessage.ShowPlayerSpeech($"Room: {value}\nPreset: {value2}\nFloor: {value3}", 5f, true); } [Command("/furni")] private static void ListFurnitureInRoom(string[] args) { NewRoom currentRoom = ((Actor)Player.Instance).currentRoom; if ((Object)(object)currentRoom == (Object)null) { Lib.GameMessage.ShowPlayerSpeech("Could not determine current room.", 3f, true); return; } if (currentRoom.individualFurniture == null || currentRoom.individualFurniture.Count == 0) { Lib.GameMessage.ShowPlayerSpeech("No furniture found in this room.", 3f, true); return; } HashSet<string> hashSet = new HashSet<string>(); Enumerator<FurnitureLocation> enumerator = currentRoom.individualFurniture.GetEnumerator(); while (enumerator.MoveNext()) { FurnitureLocation current = enumerator.Current; if (current != null && (SoCustomComparison)(object)current.furniture != (SoCustomComparison)null) { hashSet.Add(((Object)current.furniture).name); } } string text = string.Join("\n", hashSet.OrderBy((string name) => name)); string text2 = string.Join("\", \"", hashSet.OrderBy((string name) => name)); text2 = (string.IsNullOrEmpty(text2) ? "[]" : ("[\"" + text2 + "\"]")); try { string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string text3 = Path.Combine(directoryName, "furniture_list.json"); File.WriteAllText(text3, text2); Lib.GameMessage.ShowPlayerSpeech("Furniture in " + currentRoom.name + " saved to: " + text3, 5f, true); } catch (Exception ex) { Lib.GameMessage.ShowPlayerSpeech("Furniture in " + currentRoom.name + " failed to save JSON: " + ex.Message, 5f, true); } } [Command("/allfloors")] private static void ListAllFloors(string[] args) { HashSet<string> hashSet = new HashSet<string>(); if ((Object)(object)CityData.Instance != (Object)null && CityData.Instance.floorDirectory != null) { Enumerator<NewFloor> enumerator = CityData.Instance.floorDirectory.GetEnumerator(); while (enumerator.MoveNext()) { NewFloor current = enumerator.Current; if ((Object)(object)current != (Object)null && !string.IsNullOrEmpty(((Object)current).name)) { hashSet.Add(((Object)current).name); } } } string text = string.Join("\", \"", hashSet.OrderBy((string name) => name)); text = (string.IsNullOrEmpty(text) ? "[]" : ("[\"" + text + "\"]")); try { string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string text2 = Path.Combine(directoryName, "all_floors_list.json"); File.WriteAllText(text2, text); Lib.GameMessage.ShowPlayerSpeech($"All floor presets ({hashSet.Count}) saved to: {text2}", 5f, true); } catch (Exception ex) { Lib.GameMessage.ShowPlayerSpeech("Failed to save floor presets to JSON: " + ex.Message, 5f, true); } } [Command("/disableBadEffects")] private static void DisableBadEffectsCommand(string[] args) { PlayerPatch.resetNegativeEffects = true; Lib.GameMessage.ShowPlayerSpeech("Negative effects disabled.", 2f, true); } [Command("/help")] private static void HelpCommand(string[] args) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown if (TryOpenSteamOverlay("https://github.com/ShaneeexD/DevTools-SOD/wiki/Commands")) { Lib.GameMessage.ShowPlayerSpeech("Opening DevTools wiki in Steam overlay...", 2f, true); return; } DevTools.Logger.LogWarning((object)"Steam overlay unavailable, opening in browser"); try { Application.OpenURL("https://github.com/ShaneeexD/DevTools-SOD/wiki/Commands"); Lib.GameMessage.ShowPlayerSpeech("Opening DevTools wiki in browser...", 2f, true); } catch (Exception ex) { ManualLogSource logger = DevTools.Logger; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(20, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Failed to open URL: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); } logger.LogError(val); Lib.GameMessage.ShowPlayerSpeech("Failed to open wiki - please visit: https://github.com/ShaneeexD/DevTools-SOD/wiki/Commands", 5f, true); } } [Command("/exec")] private static void ExecCommand(string[] args) { if (args.Length < 1) { Lib.GameMessage.ShowPlayerSpeech("Usage: /exec <configName>", 3f, true); return; } string configName = args[0]; ConfigManager.ExecuteConfig(configName); } [Command("/saveconfig")] private static void SaveConfigCommand(string[] args) { if (args.Length < 1) { Lib.GameMessage.ShowPlayerSpeech("Usage: /saveconfig <configName>", 3f, true); return; } string text = args[0]; ConfigManager.DevToolsConfig config = new ConfigManager.DevToolsConfig { God = godmode, DisableBadEffects = PlayerPatch.resetNegativeEffects, AllowEverywhere = false, CustomCommands = new List<string>() }; if (ConfigManager.SaveConfig(text, config)) { Lib.GameMessage.ShowPlayerSpeech("Saved current settings to config '" + text + "'", 3f, true); } else { Lib.GameMessage.ShowPlayerSpeech("Failed to save config '" + text + "'", 3f, true); } } private static bool TryOpenSteamOverlay(string url) { //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) bool flag = default(bool); try { DevTools.Logger.LogInfo((object)"Attempting Method 1: Force Steam API initialization"); if (!SteamAPI.Init()) { DevTools.Logger.LogWarning((object)"SteamAPI.Init() returned false"); } CSteamID steamID = SteamUser.GetSteamID(); if (((CSteamID)(ref steamID)).IsValid()) { ManualLogSource logger = DevTools.Logger; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(41, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Steam initialized successfully, User ID: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<CSteamID>(steamID); } logger.LogInfo(val); SteamFriends.ActivateGameOverlayToWebPage(url, (EActivateGameOverlayToWebPageMode)1); return true; } } catch (Exception ex) { ManualLogSource logger2 = DevTools.Logger; BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(17, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Method 1 failed: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message); } logger2.LogWarning(val2); } return false; } [Command("/noclip")] private static void NoClipCommand(string[] args) { if (!noclip) { noclip = true; Game.Instance.SetFreeCamMode(true); Lib.GameMessage.ShowPlayerSpeech("Noclip enabled.", 2f, true); } else { noclip = false; Game.Instance.SetFreeCamMode(false); Lib.GameMessage.ShowPlayerSpeech("Noclip disabled.", 2f, true); } } [Command("/compSideJob")] private static void CompleteSideJobCommand(string[] args) { CasePanelController.Instance.activeCase.job.Complete(); } [Command("/time")] private static void TimeSpeedCommand(string[] args) { //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) if (args.Length != 1) { Lib.GameMessage.ShowPlayerSpeech("Invalid usage. Use: /time <slow|normal|fast|veryFast|simulation>", 2f, true); return; } string text = args[0].ToLower(); TimeSpeed timeSpeed; switch (text) { case "slow": timeSpeed = (TimeSpeed)0; break; case "normal": timeSpeed = (TimeSpeed)1; break; case "fast": timeSpeed = (TimeSpeed)2; break; case "veryfast": timeSpeed = (TimeSpeed)3; break; case "simulation": timeSpeed = (TimeSpeed)4; break; default: Lib.GameMessage.ShowPlayerSpeech("Invalid time speed. Use: slow, normal, fast, veryFast, or simulation", 2f, true); return; } SessionData.Instance.SetTimeSpeed(timeSpeed); Lib.GameMessage.ShowPlayerSpeech("Time speed set to " + text, 2f, true); } [Command("/buy")] private static void BuyPropertyCommand(string[] args) { if (args.Length != 1) { Lib.GameMessage.ShowPlayerSpeech("Invalid usage. Use: /buy <mwork|vwork>", 2f, true); return; } string text = args[0].ToLower(); NewAddress val = null; string text2 = ""; string text3 = text; string text4 = text3; if (!(text4 == "mwork")) { if (!(text4 == "vwork")) { Lib.GameMessage.ShowPlayerSpeech("Invalid property type. Use: mwork (murderer's workplace) or vwork (victim's workplace)", 2f, true); return; } if (!((Object)(object)murderController.currentVictim != (Object)null) || murderController.currentVictim.job == null || murderController.currentVictim.job.employer == null || !((Object)(object)murderController.currentVictim.job.employer.placeOfBusiness != (Object)null) || !((Object)(object)murderController.currentVictim.job.employer.placeOfBusiness.thisAsAddress != (Object)null)) { Lib.GameMessage.ShowPlayerSpeech("Victim doesn't have a valid workplace address.", 2f, true); return; } val = murderController.currentVictim.job.employer.placeOfBusiness.thisAsAddress; text2 = murderController.currentVictim.firstName + " " + murderController.currentVictim.surName; } else { if (!((Object)(object)murderController.currentMurderer != (Object)null) || murderController.currentMurderer.job == null || murderController.currentMurderer.job.employer == null || !((Object)(object)murderController.currentMurderer.job.employer.placeOfBusiness != (Object)null) || !((Object)(object)murderController.currentMurderer.job.employer.placeOfBusiness.thisAsAddress != (Object)null)) { Lib.GameMessage.ShowPlayerSpeech("Murderer doesn't have a valid workplace address.", 2f, true); return; } val = murderController.currentMurderer.job.employer.placeOfBusiness.thisAsAddress; text2 = murderController.currentMurderer.firstName + " " + murderController.currentMurderer.surName; } if ((Object)(object)val != (Object)null) { bool flag = false; Enumerator<NewGameLocation> enumerator = CityData.Instance.gameLocationDirectory.GetEnumerator(); while (enumerator.MoveNext()) { NewGameLocation current = enumerator.Current; if ((Object)(object)current != (Object)null && (Object)(object)current.thisAsAddress == (Object)(object)val) { flag = true; break; } } if (flag) { ((Actor)Player.Instance).AddToKeyring(val, true); ((Actor)Player.Instance).AddLocationOfAuthorty((NewGameLocation)(object)val); Player.Instance.apartmentsOwned.Add(val); NewGameLocation val2 = null; Enumerator<NewGameLocation> enumerator2 = CityData.Instance.gameLocationDirectory.GetEnumerator(); while (enumerator2.MoveNext()) { NewGameLocation current2 = enumerator2.Current; if ((Object)(object)current2 != (Object)null && (Object)(object)current2.thisAsAddress == (Object)(object)val) { val2 = current2; break; } } if ((Object)(object)val2 != (Object)null && !BioScreenControllerPatch.businessLocations.Contains(val2)) { BioScreenControllerPatch.businessLocations.Add(val2); } Lib.GameMessage.ShowPlayerSpeech($"Successfully gained access to {text2}'s workplace at {((Object)val).name}. You can now edit the decor here.", 3f, true); } else { Lib.GameMessage.ShowPlayerSpeech("Unable to find the workplace location in the game world.", 2f, true); } } else { Lib.GameMessage.ShowPlayerSpeech("Unable to find a valid business location.", 2f, true); } } [Command("/giveSocialCredit")] private static void GiveSocialCreditCommand(string[] args) { if (args.Length != 1) { Lib.GameMessage.ShowPlayerSpeech("Invalid usage. Use: /giveSocialCredit <type>", 2f, true); return; } string text = args[0].ToLower(); switch (text) { case "murdercase": GameplayController.Instance.AddSocialCredit(GameplayControls.Instance.socialCreditForMurders, true, "cheat"); break; case "sidejob": GameplayController.Instance.AddSocialCredit(GameplayControls.Instance.socialCreditForSideJobs, true, "cheat"); break; case "lostandfound": GameplayController.Instance.AddSocialCredit(GameplayControls.Instance.socialCreditForLostAndFound, true, "cheat"); break; default: Lib.GameMessage.ShowPlayerSpeech("Unknown social credit type. Use: murdercase, sidejob, lostandfound", 2f, true); return; } Lib.GameMessage.ShowPlayerSpeech("Given social credit for " + text + ".", 2f, true); } [Command("/sideJobDetails")] private static void SideJobDetailsCommand(string[] args) { if (CasePanelController.Instance.activeCase != null) { string text = CasePanelController.Instance.activeCase.id.ToString(); string text2 = ((Object)CasePanelController.Instance.activeCase.job.purp).name.ToString(); string text3 = ((Object)CasePanelController.Instance.activeCase.job.poster).name.ToString(); if (text != null) { Lib.GameMessage.ShowPlayerSpeech("Case ID is: " + text, 2f, true); } if (text3 != null) { Lib.GameMessage.ShowPlayerSpeech("Poster is: " + text3, 2f, true); } if (text2 != null) { Lib.GameMessage.ShowPlayerSpeech("Purp is: " + text2, 2f, true); } } else { Lib.GameMessage.ShowPlayerSpeech("No active side job!", 2f, true); } } [Command("/removeAttackers")] private static void RemoveAttackers(string[] args) { Enumerator<Citizen> enumerator = CityData.Instance.citizenDirectory.GetEnumerator(); while (enumerator.MoveNext()) { Citizen current = enumerator.Current; ((Actor)current).ai.EndAttack(); ((Actor)current).ai.attackActive = false; ((Actor)current).ai.CancelCombat(); ((Actor)Player.Instance).RemovePersuedBy((Actor)(object)current); } } [Command("/itemTest")] private static void ItemTestCommand(string[] args) { if (storedItem != null) { player = Player.Instance; storedItem.IsSafeToDelete(true); GameObject gameObject = storedItem.furnitureParent.spawnedObject.gameObject; GameObject gameObject2 = storedItem.spawnedObject.gameObject; SpawnFurnitureAtLookPosition(gameObject); SpawnFurnitureAtLookPosition(gameObject2); } else { Lib.GameMessage.ShowPlayerSpeech("No item stored!", 2f, true); } } private static void SpawnFurnitureAtLookPosition(GameObject furniturePrefab) { //IL_0006: 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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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) RaycastHit playerCurrentRaycastHit = InteractionController.Instance.playerCurrentRaycastHit; if ((Object)(object)((RaycastHit)(ref playerCurrentRaycastHit)).collider != (Object)null) { Vector3 point = ((RaycastHit)(ref playerCurrentRaycastHit)).point; Object.Instantiate<GameObject>(furniturePrefab, point, Quaternion.identity); } else { Lib.GameMessage.ShowPlayerSpeech("No valid raycast hit.", 2f, true); } } [Command("/job")] private static void GetEntityJobCommand(string[] args) { if (args.Length != 1) { Lib.GameMessage.ShowPlayerSpeech("Invalid usage. Use: /job <entity>", 2f, true); return; } switch (args[0].ToLower()) { case "murderer": murdererInfoProvider.GetJob(); Lib.GameMessage.ShowPlayerSpeech(murdererInfoProvider.GetJob(), 2f, true); break; case "victim": victimInfoHelper.GetJob(); Lib.GameMessage.ShowPlayerSpeech(victimInfoHelper.GetJob(), 2f, true); break; case "poster": posterInfoProvider.GetJob(); Lib.GameMessage.ShowPlayerSpeech(posterInfoProvider.GetJob(), 2f, true); break; case "purp": purpInfoProvider.GetJob(); Lib.GameMessage.ShowPlayerSpeech(purpInfoProvider.GetJob(), 2f, true); break; case "stored": if ((Object)(object)storedHuman != (Object)null) { storedHumanInfoProvider.GetJob(); Lib.GameMessage.ShowPlayerSpeech(storedHumanInfoProvider.GetJob(), 2f, true); } else { Lib.GameMessage.ShowPlayerSpeech("No current stored citizen!", 2f, true); } break; default: Lib.GameMessage.ShowPlayerSpeech("Invalid entity. Use 'murderer', 'victim', 'Poster', 'Purp' or 'Stored'.", 2f, true); break; } } [Command("/testStoredScale")] private static void TestStored(string[] args) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (float.TryParse(args[0], out var result)) { ((Component)storedHuman).gameObject.transform.localScale = new Vector3(result, result, result); } } [Command("/testStoredSpawn")] private static void TestStoredClone(string[] args) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)storedHuman != (Object)null) { GameObject gameObject = ((Component)storedHuman).gameObject; Object.Instantiate<GameObject>(gameObject, new Vector3(1f, 1f, 1f), Quaternion.identity); Lib.GameMessage.ShowPlayerSpeech("Spawned Citizen!", 2f, true); } else { Lib.GameMessage.ShowPlayerSpeech("No current stored citizen!", 2f, true); } } [Command("/createTP")] private static void SetTeleport(string[] args) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: 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) //IL_009f: Unknown result type (might be due to invalid IL or missing references) if (args.Length < 1) { Lib.GameMessage.ShowPlayerSpeech("Please provide a name for the teleport point.", 2f, true); return; } string text = args[0]; Vector3 value = Vector3Int.op_Implicit(playerInfoProvider.GetPlayerLocation()); if (teleportPoints.ContainsKey(text)) { Lib.GameMessage.ShowPlayerSpeech($"Teleport point '{text}' updated to new position: {value}", 2f, true); teleportPoints[text] = value; } else { Lib.GameMessage.ShowPlayerSpeech($"Teleport point '{text}' created at position: {value}", 2f, true); teleportPoints.Add(text, value); } } [Command("/tpc")] private static void TeleportToPoint(string[] args) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) if (args.Length < 1) { Lib.GameMessage.ShowPlayerSpeech("Please provide the name of the teleport point.", 2f, true); return; } string text = args[0]; if (teleportPoints.TryGetValue(text, out var value)) { playerInfoProvider.SetPlayerLocation(value); Lib.GameMessage.ShowPlayerSpeech($"Teleported to '{text}' at position: {value}", 2f, true); } else { Lib.GameMessage.ShowPlayerSpeech("Teleport point '" + text + "' does not exist.", 2f, true); } } [Command("/showTPList")] private static void ShowTeleportPoints(string[] args) { //IL_0080: Unknown result type (might be due to invalid IL or missing references) if (teleportPoints.Count == 0) { Lib.GameMessage.ShowPlayerSpeech("No teleport points have been set.", 2f, true); return; } StringBuilder stringBuilder = new StringBuilder("Teleport Points:\n"); foreach (KeyValuePair<string, Vector3> teleportPoint in teleportPoints) { StringBuilder stringBuilder2 = stringBuilder; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(2, 2, stringBuilder2); handler.AppendFormatted(teleportPoint.Key); handler.AppendLiteral(": "); handler.AppendFormatted<Vector3>(teleportPoint.Value); stringBuilder2.AppendLine(ref handler); } Lib.GameMessage.ShowPlayerSpeech(stringBuilder.ToString(), 5f, true); } [Command("/deleteTP")] private static void DeleteTeleportPoint(string[] args) { if (args.Length < 1) { Lib.GameMessage.ShowPlayerSpeech("Please provide the name of the teleport point to delete.", 2f, true); return; } string text = args[0]; if (teleportPoints.Remove(text)) { Lib.GameMessage.ShowPlayerSpeech("Teleport point '" + text + "' has been deleted.", 2f, true); } else { Lib.GameMessage.ShowPlayerSpeech("Teleport point '" + text + "' does not exist.", 2f, true); } } [Command("/tpp")] private static void TeleportPresetCommand(string[] args) { if (args.Length < 1) { Lib.GameMessage.ShowPlayerSpeech("Invalid usage. Use: /tpp <presetname>", 2f, true); return; } NewNode val = null; switch (args[0].ToLower()) { case "home": if ((Object)(object)((Human)player).home != (Object)null) { val = ((Human)player).home.GetDestinationNode(); } break; case "mwork": { Human currentMurderer2 = murderController.currentMurderer; object obj7; if (currentMurderer2 == null) { obj7 = null; } else { Interactable workPosition4 = currentMurderer2.workPosition; obj7 = ((workPosition4 != null) ? workPosition4.node : null); } if (obj7 != null) { val = murderController.currentMurderer.workPosition.node; } break; } case "mhome": { Human currentMurderer = murderController.currentMurderer; if ((Object)(object)((currentMurderer != null) ? currentMurderer.home : null) != (Object)null) { val = murderController.currentMurderer.home.GetDestinationNode(); } break; } case "vwork": { Human currentVictim = murderController.currentVictim; object obj3; if (currentVictim == null) { obj3 = null; } else { Interactable workPosition = currentVictim.workPosition; obj3 = ((workPosition != null) ? workPosition.node : null); } if (obj3 != null) { val = murderController.currentVictim.workPosition.node; } break; } case "vhome": { Human currentVictim2 = murderController.currentVictim; if ((Object)(object)((currentVictim2 != null) ? currentVictim2.home : null) != (Object)null) { val = murderController.currentVictim.home.GetDestinationNode(); } break; } case "posterwork": { Case activeCase2 = CasePanelController.Instance.activeCase; object obj6; if (activeCase2 == null) { obj6 = null; } else { SideJob job2 = activeCase2.job; if (job2 == null) { obj6 = null; } else { Human poster = job2.poster; if (poster == null) { obj6 = null; } else { Interactable workPosition3 = poster.workPosition; obj6 = ((workPosition3 != null) ? workPosition3.node : null); } } } if (obj6 != null) { val = CasePanelController.Instance.activeCase.job.poster.workPosition.node; } break; } case "posterhome": { Case activeCase4 = CasePanelController.Instance.activeCase; object obj9; if (activeCase4 == null) { obj9 = null; } else { SideJob job4 = activeCase4.job; if (job4 == null) { obj9 = null; } else { Human poster2 = job4.poster; obj9 = ((poster2 != null) ? poster2.home : null); } } if ((Object)obj9 != (Object)null) { val = CasePanelController.Instance.activeCase.job.poster.home.GetDestinationNode(); } break; } case "purpwork": { Case activeCase3 = CasePanelController.Instance.activeCase; object obj8; if (activeCase3 == null) { obj8 = null; } else { SideJob job3 = activeCase3.job; if (job3 == null) { obj8 = null; } else { Human purp2 = job3.purp; if (purp2 == null) { obj8 = null; } else { Interactable workPosition5 = purp2.workPosition; obj8 = ((workPosition5 != null) ? workPosition5.node : null); } } } if (obj8 != null) { val = CasePanelController.Instance.activeCase.job.purp.workPosition.node; } break; } case "purphome": { Case activeCase = CasePanelController.Instance.activeCase; object obj2; if (activeCase == null) { obj2 = null; } else { SideJob job = activeCase.job; if (job == null) { obj2 = null; } else { Human purp = job.purp; obj2 = ((purp != null) ? purp.home : null); } } if ((Object)obj2 != (Object)null) { val = CasePanelController.Instance.activeCase.job.purp.home.GetDestinationNode(); } break; } case "swork": { Human obj4 = storedHuman; object obj5; if (obj4 == null) { obj5 = null; } else { Interactable workPosition2 = obj4.workPosition; obj5 = ((workPosition2 != null) ? workPosition2.node : null); } if (obj5 != null) { val = storedHuman.workPosition.node; } break; } case "shome": { Human obj = storedHuman; if ((Object)(object)((obj != null) ? obj.home : null) != (Object)null) { val = storedHuman.home.GetDestinationNode(); } break; } default: Lib.GameMessage.ShowPlayerSpeech("Unknown preset '" + args[0] + "'. Available presets: home, mwork, mhome, vwork, vhome, posterwork, posterhome, purpwork, purphome, swork, shome.", 2f, true); return; } if (val != null) { ((Actor)player).Teleport(val, (UsagePoint)null, true, false, true); Lib.GameMessage.ShowPlayerSpeech("Teleported to " + args[0], 2f, true); } else { Lib.GameMessage.ShowPlayerSpeech("Failed to teleport. The preset '" + args[0] + "' has no set destination.", 2f, true); } } [Command("/tpn")] private static void TeleportNodeCommand(string[] args) { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) if (args.Length < 3) { Lib.GameMessage.ShowPlayerSpeech("Invalid usage. Use: /tpn <x> <y> <z>", 2f, true); return; } if (!int.TryParse(args[0], out var result) || !int.TryParse(args[1], out var result2) || !int.TryParse(args[2], out var result3)) { Lib.GameMessage.ShowPlayerSpeech("Invalid coordinates. Please provide valid numbers.", 2f, true); return; } Vector3Int val = default(Vector3Int); ((Vector3Int)(ref val))..ctor(result, result2, result3); playerInfoProvider.SetPlayerNode(val); Lib.GameMessage.ShowPlayerSpeech($"Teleported to {val}", 2f, true); } [Command("/output")] private static void ExportCommand(string[] args) { if (args.Length < 1) { Lib.GameMessage.ShowPlayerSpeech("Invalid usage. Use: /export <murderer|victim|poster|purp|stored>", 2f, true); return; } string text = args[0].ToLower(); string text2 = string.Empty; switch (text) { case "murderer": if ((Object)(object)murderController.currentMurderer != (Object)null) { text2 = GetCitizenInfo(murderController.currentMurderer); } else { Lib.GameMessage.ShowPlayerSpeech("No murderer data found.", 2f, true); } break; case "victim": if ((Object)(object)murderController.currentVictim != (Object)null) { text2 = GetCitizenInfo(murderController.currentVictim); } else { Lib.GameMessage.ShowPlayerSpeech("No victim data found.", 2f, true); } break; case "poster": { Case activeCase2 = CasePanelController.Instance.activeCase; object obj2; if (activeCase2 == null) { obj2 = null; } else { SideJob job2 = activeCase2.job; obj2 = ((job2 != null) ? job2.poster : null); } if ((Object)obj2 != (Object)null) { text2 = GetCitizenInfo(CasePanelController.Instance.activeCase.job.poster); } else { Lib.GameMessage.ShowPlayerSpeech("No poster data found.", 2f, true); } break; } case "purp": { Case activeCase = CasePanelController.Instance.activeCase; object obj; if (activeCase == null) { obj = null; } else { SideJob job = activeCase.job; obj = ((job != null) ? job.purp : null); } if ((Object)obj != (Object)null) { text2 = GetCitizenInfo(CasePanelController.Instance.activeCase.job.purp); } else { Lib.GameMessage.ShowPlayerSpeech("No purp data found.", 2f, true); } break; } case "stored": if ((Object)(object)storedHuman != (Object)null) { text2 = GetCitizenInfo(storedHuman); } else { Lib.GameMessage.ShowPlayerSpeech("No stored data found.", 2f, true); } break; default: Lib.GameMessage.ShowPlayerSpeech("Unknown character type. Use one of: murderer, victim, poster, purp, stored.", 2f, true); return; } if (string.IsNullOrEmpty(text2)) { return; } string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string text3 = Path.Combine(directoryName, text + "_info.txt"); try { File.WriteAllText(text3, text2); Lib.GameMessage.ShowPlayerSpeech("Exported " + text + " info to " + text3, 2f, true); } catch (Exception ex) { Lib.GameMessage.ShowPlayerSpeech("Error exporting " + text + " info: " + ex.Message, 2f, true); } } private static string GetCitizenInfo(Human human) { string value = ((Object)human).name?.ToString() ?? "null"; string value2 = human.GetAge().ToString() ?? "null"; Occupation job = human.job; object obj; if (job == null) { obj = null; } else { Company employer = job.employer; obj = ((employer == null) ? null : employer.name?.ToString()); } if (obj == null) { obj = "null"; } string value3 = (string)obj; Occupation job2 = human.job; string value4 = ((job2 == null) ? null : job2.name?.ToString()) ?? "null"; NewAddress home = human.home; object obj2; if (home == null) { obj2 = null; } else { NewAddress thisAsAddress = ((NewGameLocation)home).thisAsAddress; obj2 = ((thisAsAddress == null) ? null : ((Object)thisAsAddress).name?.ToString()); } if (obj2 == null) { obj2 = "null"; } string value5 = (string)obj2; Passcode passcode = human.passcode; string value6 = ((((passcode != null) ? passcode.digits : null) != null) ? string.Join("", EnumerableExtensions.Select<int, string>(human.passcode.digits, (Func<int, string>)((int digit) => digit.ToString() ?? "null"))) : "null"); string value7 = ((((Actor)human).inventory != null) ? string.Join(", ", EnumerableExtensions.Select<Interactable, string>(((Actor)human).inventory, (Func<Interactable, string>)((Interactable item) => ((item == null) ? null : item.GetName()?.ToString()) ?? "null"))) : "null"); return $"Name: {value}\nAge: {value2}\nEmployer: {value3}\nOccupation: {value4}\nAddress: {value5}\nPasscode: {value6}\nInventory: {value7}\n"; } } public class CommandUI { public static void OpenDialogInputBox() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Expected O, but got Unknown //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0256: 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) if (!PlayerPatch.isUICreated) { PlayerPatch.canvas = new GameObject("CommandCanvas").AddComponent<Canvas>(); PlayerPatch.canvas.renderMode = (RenderMode)0; ((Component)PlayerPatch.canvas).gameObject.AddComponent<CanvasScaler>(); ((Component)PlayerPatch.canvas).gameObject.AddComponent<GraphicRaycaster>(); PlayerPatch.panelObject = new GameObject("InputPanel"); RectTransform val = PlayerPatch.panelObject.AddComponent<RectTransform>(); ((Transform)val).SetParent(((Component)PlayerPatch.canvas).transform); val.sizeDelta = new Vector2(400f, 40f); val.anchoredPosition = new Vector2(-750f, -487f); Image val2 = PlayerPatch.panelObject.AddComponent<Image>(); ((Graphic)val2).color = new Color(0f, 0f, 0f, 0.7f); ((Graphic)val2).color = new Color(1f, 0f, 0f, 0.7f); Shadow val3 = PlayerPatch.panelObject.AddComponent<Shadow>(); val3.effectColor = new Color(0f, 0f, 0f, 0.7f); val3.effectDistance = new Vector2(2f, -2f); PlayerPatch.inputFieldObject = new GameObject("CommandInputField"); PlayerPatch.inputFieldObject.transform.SetParent(PlayerPatch.panelObject.transform); RectTransform val4 = PlayerPatch.inputFieldObject.AddComponent<RectTransform>(); val4.sizeDelta = new Vector2(380f, 40f); val4.anchoredPosition = new Vector2(0f, 0f); PlayerPatch.inputField = PlayerPatch.inputFieldObject.AddComponent<InputField>(); Text val5 = new GameObject("InputText").AddComponent<Text>(); val5.font = Resources.GetBuiltinResource<Font>("Arial.ttf"); ((Graphic)val5).color = Color.white; val5.alignment = (TextAnchor)3; ((Graphic)val5).rectTransform.sizeDelta = new Vector2(380f, 40f); ((Component)val5).transform.SetParent(PlayerPatch.inputFieldObject.transform, false); PlayerPatch.inputField.textComponent = val5; Text val6 = new GameObject("Placeholder").AddComponent<Text>(); val6.font = Resources.GetBuiltinResource<Font>("Arial.ttf"); ((Graphic)val6).color = new Color(1f, 1f, 1f, 0.5f); val6.text = "Enter command..."; ((Graphic)val6).rectTransform.sizeDelta = new Vector2(380f, 40f); val6.alignment = (TextAnchor)3; ((Component)val6).transform.SetParent(PlayerPatch.inputFieldObject.transform, false); PlayerPatch.inputField.placeholder = (Graphic)(object)val6; ((Selectable)PlayerPatch.inputField).interactable = true; PlayerPatch.inputFieldObject.SetActive(true); PlayerPatch.inputField.ActivateInputField(); DevTools.Logger.LogInfo((object)"Command Input Field created."); PlayerPatch.isUICreated = true; } } public static Text CreateTextComponent(string name, Color color) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0021: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); Text val2 = val.AddComponent<Text>(); val2.font = Resources.GetBuiltinResource<Font>("Arial.ttf"); ((Graphic)val2).color = color; RectTransform component = val.GetComponent<RectTransform>(); if ((Object)(object)component == (Object)null) { component = val.AddComponent<RectTransform>(); } return val2; } public static void OnSubmitCommand() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown string text = PlayerPatch.inputField.text.Trim(); if (!string.IsNullOrEmpty(text)) { CommandManager.ExecuteCommand(text); ManualLogSource logger = DevTools.Logger; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(18, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Command Executed: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text); } logger.LogInfo(val); } CloseDialogInputBox(); } public static void CloseDialogInputBox() { if ((Object)(object)PlayerPatch.panelObject != (Object)null) { Player.Instance.EnableCharacterController(true); Player.Instance.EnablePlayerMouseLook(true, true); ((Behaviour)InputController.Instance).enabled = true; Object.Destroy((Object)(object)PlayerPatch.panelObject); PlayerPatch.sessionData.ResumeGame(); DevTools.Logger.LogInfo((object)"Command Input Field destroyed."); } PlayerPatch.isUICreated = false; PlayerPatch.isInputActive = false; } } public class ConfigManager { public class DevToolsConfig { public bool God { get; set; } = false; public bool DisableBadEffects { get; set; } = false; public bool AllowEverywhere { get; set; } = false; public List<string> CustomCommands { get; set; } = new List<string>(); } public static string GetPluginDirectory() { return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); } public static string GetConfigFilePath(string configName) { if (configName.Contains("..") || configName.Contains("/") || configName.Contains("\\")) { throw new ArgumentException("Invalid config name"); } configName = Path.GetFileNameWithoutExtension(configName); return Path.Combine(GetPluginDirectory(), configName + ".dt.txt"); } public static DevToolsConfig LoadConfig(string configName) { //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Expected O, but got Unknown //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Expected O, but got Unknown string configFilePath = GetConfigFilePath(configName); bool flag = default(bool); if (!File.Exists(configFilePath)) { ManualLogSource logger = DevTools.Logger; BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(23, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Config file not found: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(configFilePath); } logger.LogWarning(val); return null; } try { string[] array = File.ReadAllLines(configFilePath); DevToolsConfig devToolsConfig = new DevToolsConfig(); string[] array2 = array; foreach (string text in array2) { string text2 = text.Trim(); if (string.IsNullOrEmpty(text2) || text2.StartsWith("//") || !text2.Contains("=")) { continue; } string[] array3 = text2.Split(new char[1] { '=' }, 2); if (array3.Length != 2) { continue; } string text3 = array3[0].Trim(); string text4 = array3[1].Trim(); if (text3.Equals("God", StringComparison.OrdinalIgnoreCase)) { if (bool.TryParse(text4, out var result)) { devToolsConfig.God = result; } } else if (text3.Equals("DisableBadEffects", StringComparison.OrdinalIgnoreCase)) { if (bool.TryParse(text4, out var result2)) { devToolsConfig.DisableBadEffects = result2; } } else if (text3.Equals("AllowEverywhere", StringComparison.OrdinalIgnoreCase)) { if (bool.TryParse(text4, out var result3)) { devToolsConfig.AllowEverywhere = result3; } } else if (text3.Equals("Command", StringComparison.OrdinalIgnoreCase) && !string.IsNullOrEmpty(text4)) { devToolsConfig.CustomCommands.Add(text4); } } ManualLogSource logger2 = DevTools.Logger; BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(19, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Loaded config from "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(configFilePath); } logger2.LogInfo(val2); return devToolsConfig; } catch (Exception ex) { ManualLogSource logger3 = DevTools.Logger; BepInExErrorLogInterpolatedStringHandler val3 = new BepInExErrorLogInterpolatedStringHandler(23, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Failed to load config: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(ex.Message); } logger3.LogError(val3); return null; } } public static bool SaveConfig(string configName, DevToolsConfig config) { //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Expected O, but got Unknown //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Expected O, but got Unknown string configFilePath = GetConfigFilePath(configName); bool flag = default(bool); try { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("// DevTools configuration file"); stringBuilder.AppendLine("// Format: key = value"); stringBuilder.AppendLine(); StringBuilder stringBuilder2 = stringBuilder; StringBuilder stringBuilder3 = stringBuilder2; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(6, 1, stringBuilder2); handler.AppendLiteral("God = "); handler.AppendFormatted(config.God); stringBuilder3.AppendLine(ref handler); stringBuilder2 = stringBuilder; StringBuilder stringBuilder4 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(20, 1, stringBuilder2); handler.AppendLiteral("DisableBadEffects = "); handler.AppendFormatted(config.DisableBadEffects); stringBuilder4.AppendLine(ref handler); stringBuilder2 = stringBuilder; StringBuilder stringBuilder5 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(18, 1, stringBuilder2); handler.AppendLiteral("AllowEverywhere = "); handler.AppendFormatted(config.AllowEverywhere); stringBuilder5.AppendLine(ref handler); stringBuilder.AppendLine(); stringBuilder.AppendLine("// Custom commands to execute"); foreach (string customCommand in config.CustomCommands) { stringBuilder2 = stringBuilder; StringBuilder stringBuilder6 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(10, 1, stringBuilder2); handler.AppendLiteral("Command = "); handler.AppendFormatted(customCommand); stringBuilder6.AppendLine(ref handler); } File.WriteAllText(configFilePath, stringBuilder.ToString()); ManualLogSource logger = DevTools.Logger; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(16, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Saved config to "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(configFilePath); } logger.LogInfo(val); return true; } catch (Exception ex) { ManualLogSource logger2 = DevTools.Logger; BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(23, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Failed to save config: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message); } logger2.LogError(val2); return false; } } public static void ExecuteConfig(string configName) { DevToolsConfig devToolsConfig = LoadConfig(configName); if (devToolsConfig == null) { Lib.GameMessage.ShowPlayerSpeech("Config '" + configName + "' not found or invalid", 3f, true); return; } if (devToolsConfig.God) { CommandManager.ExecuteCommand("/god"); } if (devToolsConfig.DisableBadEffects) { CommandManager.ExecuteCommand("/disableBadEffects"); } if (devToolsConfig.AllowEverywhere) { CommandManager.ExecuteCommand("/allowEverywhere"); } foreach (string customCommand in devToolsConfig.CustomCommands) { if (!string.IsNullOrEmpty(customCommand)) { CommandManager.ExecuteCommand(customCommand); } } Lib.GameMessage.ShowPlayerSpeech("Executed config '" + configName + "'", 3f, true); } public static void CreateDefaultConfig() { string configFilePath = GetConfigFilePath("config"); if (!File.Exists(configFilePath)) { DevToolsConfig config = new DevToolsConfig { God = false, DisableBadEffects = true, AllowEverywhere = false, CustomCommands = new List<string> { "/noclip", "/speed 2" } }; SaveConfig("config", config); DevTools.Logger.LogInfo((object)"Created default config file"); } } } [HarmonyPatch(typeof(Game), "SetFreeCamMode")] public class FreecamPatch { [HarmonyPrefix] public static void Prefix_Awake(ref bool val) { } } public class GameInfoProvider { } public class MurdererInfoProvider { private MurderController murderController = MurderController.Instance; private Citizen citizen = new Citizen(); public Vector3Int GetMurdererLocation() { //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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)murderController != (Object)null) { Vector3 position = ((Component)murderController.currentMurderer).transform.position; return new Vector3Int(Mathf.RoundToInt(position.x), Mathf.RoundToInt(position.y), Mathf.RoundToInt(position.z)); } return new Vector3Int(0, 0, 0); } public void SetMurdererLocation(Vector3 loc) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) ((Component)murderController.currentMurderer).transform.position = loc; } public string GetMurdererFullName() { if ((Object)(object)murderController != (Object)null) { string text = murderController.currentMurderer.firstName.ToString(); string text2 = murderController.currentMurderer.surName.ToString(); return text + " " + text2; } return "murderController is null!"; } public void AddPoisoned(float amount, Human who) { Player instance = Player.Instance; murderController.currentMurderer.AddPoisoned(amount, (Human)(object)instance); } public void KillMurderer() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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) //IL_0025: Unknown result type (might be due to invalid IL or missing references) ((Actor)murderController.currentMurderer).RecieveDamage(99999f, (Actor)(object)Player.Instance, Vector2.op_Implicit(Vector2.zero), Vector2.op_Implicit(Vector2.zero), (SpatterPatternPreset)null, (SpatterPatternPreset)null, (EraseMode)3, true, false, 0f, 1f, true, true, 1f); } public void KOMurderer() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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) //IL_0025: Unknown result type (might be due to invalid IL or missing references) ((Actor)murderController.currentMurderer).RecieveDamage(99999f, (Actor)(object)Player.Instance, Vector2.op_Implicit(Vector2.zero), Vector2.op_Implicit(Vector2.zero), (SpatterPatternPreset)null, (SpatterPatternPreset)null, (EraseMode)3, true, false, 0f, 1f, false, true, 1f); } public string GetPassword() { MurderController instance = MurderController.Instance; List<int> digits = instance.currentMurderer.passcode.digits; StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < digits.Count; i++) { stringBuilder.Append(digits[i].ToString()); } return stringBuilder.ToString(); } public string GetJob() { string result = "Citizen is jobless."; if (murderController.currentMurderer.job.employer != null) { string text = murderController.currentMurderer.job.employer.name.ToString(); string text2 = murderController.currentMurderer.job.name.ToString(); string text3 = murderController.currentMurderer.job.salaryString.ToString(); return "Employer: " + text + Environment.NewLine + "Job: " + text2 + Environment.NewLine + "Salary: " + text3; } return result; } } public class NewGameHandler : MonoBehaviour { public static Murder murder; public static Toolbox toolbox; private GameObject cube; public NewGameHandler() { Lib.SaveGame.OnAfterLoad += HandleGameLoaded; Lib.SaveGame.OnAfterNewGame += HandleNewGameStarted; } private void HandleNewGameStarted(object sender, EventArgs e) { } private void HandleGameLoaded(object sender, EventArgs e) { } } [BepInPlugin("DevTools", "DevTools", "1.0.0")] public class DevTools : BasePlugin { public static ManualLogSource Logger; private Harmony harmony; public static ConfigEntry<bool> useSteamOverlayHelpCommand; public override void Load() { //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown Logger = ((BasePlugin)this).Log; NewGameHandler newGameHandler = new NewGameHandler(); Logger.LogInfo((object)"Loading DevTools..."); CommandManager.Initialize(); try { harmony = new Harmony("DevTools"); harmony.PatchAll(); Logger.LogInfo((object)"All patches applied."); useSteamOverlayHelpCommand = ((BasePlugin)this).Config.Bind<bool>("General", "UseSteamOverlayHelpCommand", true, "Use Steam Overlay to open help command."); } catch (Exception ex) { ManualLogSource logger = Logger; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(19, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Error during Load: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex); } logger.LogError(val); } } } [HarmonyPatch(typeof(Player), "Update")] public class PlayerPatch { public static bool isUICreated = false; public static bool isInputActive = false; public static bool resetNegativeEffects = false; public static GameObject inputFieldObject; public static InputField inputField; public static GameObject panelObject; public static Canvas canvas; public static SessionData sessionData; public static InputController inputController; public static Game game = new Game(); public static Player player = Player.Instance; [HarmonyPrefix] public static void Prefix(Player __instance) { if (Input.GetKeyInt((KeyCode)47) && !isInputActive && !MainMenuController.Instance.mainMenuActive && !((Actor)__instance).isInBed) { CommandUI.OpenDialogInputBox(); isInputActive = true; } if (Input.GetKeyInt((KeyCode)326) && (Object)(object)InteractionController.Instance.currentLookingAtInteractable != (Object)null) { Actor isActor = InteractionController.Instance.currentLookingAtInteractable.interactable.isActor; if (Object.op_Implicit((Object)(object)((isActor is Human) ? isActor : null))) { Actor isActor2 = InteractionController.Instance.currentLookingAtInteractable.interactable.isActor; CommandManager.storedHuman = (Human)(object)((isActor2 is Human) ? isActor2 : null); if ((Object)(object)CommandManager.storedHuman != (Object)null) { Lib.GameMessage.ShowPlayerSpeech("Stored citizen: " + CommandManager.storedHuman.GetCitizenName().ToString(), 2f, true); StoredHumanInfoProvider.human = CommandManager.storedHuman; } } else { CommandManager.storedItem = InteractionController.Instance.currentLookingAtInteractable.interactable; Lib.GameMessage.ShowPlayerSpeech("Stored item: " + InteractionController.Instance.currentLookingAtInteractable.interactable.name.ToString(), 2f, true); } } if (MainMenuController.Instance.mainMenuActive && isInputActive) { CommandUI.CloseDialogInputBox(); } if (isInputActive) { Player.Instance.EnablePlayerMouseLook(false, false); Player.Instance.EnableCharacterController(false); sessionData = SessionData.Instance; sessionData.PauseGame(false, false, false); ((Behaviour)InputController.Instance).enabled = false; if (Input.GetKeyInt((KeyCode)13)) { CommandUI.OnSubmitCommand(); } if (Input.GetKeyInt((KeyCode)27)) { CommandUI.CloseDialogInputBox(); } } if (resetNegativeEffects) { Player.Instance.ResetNegativeStatuses(10f); } } } public class PosterInfoProvider { public string GetPassword() { CasePanelController instance = CasePanelController.Instance; List<int> digits = instance.activeCase.job.poster.passcode.digits; StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < digits.Count; i++) { stringBuilder.Append(digits[i].ToString()); } return stringBuilder.ToString(); } public string GetJob() { string result = "Citizen is jobless."; if (CasePanelController.Instance.activeCase.job.poster.job.employer != null) { string text = CasePanelController.Instance.activeCase.job.poster.job.employer.name.ToString(); string text2 = CasePanelController.Instance.activeCase.job.poster.job.name.ToString(); string text3 = CasePanelController.Instance.activeCase.job.poster.job.salaryString.ToString(); return "Employer: " + text + Environment.NewLine + "Job: " + text2 + Environment.NewLine + "Salary: " + text3; } return result; } } public class PurpInfoProvider { public string GetPassword() { CasePanelController instance = CasePanelController.Instance; List<int> digits = instance.activeCase.job.purp.passcode.digits; StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < digits.Count; i++) { stringBuilder.Append(digits[i].ToString()); } return stringBuilder.ToString(); } public string GetJob() { string result = "Citizen is jobless."; if (CasePanelController.Instance.activeCase.job.purp.job.employer != null) { string text = CasePanelController.Instance.activeCase.job.purp.job.employer.name.ToString(); string text2 = CasePanelController.Instance.activeCase.job.purp.job.name.ToString(); string text3 = CasePanelController.Instance.activeCase.job.purp.job.salaryString.ToString(); return "Employer: " + text + Environment.NewLine + "Job: " + text2 + Environment.NewLine + "Salary: " + text3; } return result; } } public class StoredHumanInfoProvider { public static Human human; public string GetPassword() { List<int> digits = human.passcode.digits; StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < digits.Count; i++) { stringBuilder.Append(digits[i].ToString()); } return stringBuilder.ToString(); } public string GetStoredFullName() { if ((Object)(object)human != (Object)null) { string text = human.firstName.ToString(); string text2 = human.surName.ToString(); return text + " " + text2; } return "human is null!"; } public float GetBleeding() { return human.bleeding; } public void SetBleeding(float amount) { human.bleeding = amount; } public void SetTrespassing(bool trespassing) { ((Actor)human).isTrespassing = trespassing; } public string GetJob() { string result = "Citizen is jobless."; if (human.job.employer != null) { string text = human.job.employer.name.ToString(); string text2 = human.job.name.ToString(); string text3 = human.job.salaryString.ToString(); return "Employer: " + text + Environment.NewLine + "Job: " + text2 + Environment.NewLine + "Salary: " + text3; } return result; } } public class VictimInfoHelper { private MurderController murderController = MurderController.Instance; public Vector3Int GetVictimLocation() { //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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)murderController != (Object)null) { Vector3 position = ((Component)murderController.currentVictim).transform.position; return new Vector3Int(Mathf.RoundToInt(position.x), Mathf.RoundToInt(position.y), Mathf.RoundToInt(position.z)); } return new Vector3Int(0, 0, 0); } public void SetVictimLocation(Vector3 loc) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) ((Component)murderController.currentVictim).transform.position = loc; } public string GetVictimFullName() { if ((Object)(object)murderController != (Object)null) { string text = murderController.currentVictim.firstName.ToString(); string text2 = murderController.currentVictim.surName.ToString(); return text + " " + text2; } return "murderController is null!"; } public void AddPoisoned(float amount, Human who) { Player instance = Player.Instance; murderController.currentVictim.AddPoisoned(amount, (Human)(object)instance); } public void KillVictim() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missin
Steamworks.NET.dll
Decompiled a month ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Net; using System.Net.Sockets; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Text; using Microsoft.Win32.SafeHandles; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("Steamworks.NET")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Riley Labrecque")] [assembly: AssemblyProduct("Steamworks.NET")] [assembly: AssemblyCopyright("Copyright © Riley Labrecque 2013-2019")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("316ab144-2a2a-4847-857b-63317c980dda")] [assembly: AssemblyFileVersion("15.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.0", FrameworkDisplayName = ".NET Framework 4")] [assembly: AssemblyVersion("15.0.0.0")] namespace Steamworks; public static class SteamAppList { public static uint GetNumInstalledApps() { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamAppList_GetNumInstalledApps(CSteamAPIContext.GetSteamAppList()); } public static uint GetInstalledApps(AppId_t[] pvecAppID, uint unMaxAppIDs) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamAppList_GetInstalledApps(CSteamAPIContext.GetSteamAppList(), pvecAppID, unMaxAppIDs); } public static int GetAppName(AppId_t nAppID, out string pchName, int cchNameMax) { InteropHelp.TestIfAvailableClient(); IntPtr intPtr = Marshal.AllocHGlobal(cchNameMax); int num = NativeMethods.ISteamAppList_GetAppName(CSteamAPIContext.GetSteamAppList(), nAppID, intPtr, cchNameMax); pchName = ((num != -1) ? InteropHelp.PtrToStringUTF8(intPtr) : null); Marshal.FreeHGlobal(intPtr); return num; } public static int GetAppInstallDir(AppId_t nAppID, out string pchDirectory, int cchNameMax) { InteropHelp.TestIfAvailableClient(); IntPtr intPtr = Marshal.AllocHGlobal(cchNameMax); int num = NativeMethods.ISteamAppList_GetAppInstallDir(CSteamAPIContext.GetSteamAppList(), nAppID, intPtr, cchNameMax); pchDirectory = ((num != -1) ? InteropHelp.PtrToStringUTF8(intPtr) : null); Marshal.FreeHGlobal(intPtr); return num; } public static int GetAppBuildId(AppId_t nAppID) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamAppList_GetAppBuildId(CSteamAPIContext.GetSteamAppList(), nAppID); } } public static class SteamApps { public static bool BIsSubscribed() { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamApps_BIsSubscribed(CSteamAPIContext.GetSteamApps()); } public static bool BIsLowViolence() { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamApps_BIsLowViolence(CSteamAPIContext.GetSteamApps()); } public static bool BIsCybercafe() { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamApps_BIsCybercafe(CSteamAPIContext.GetSteamApps()); } public static bool BIsVACBanned() { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamApps_BIsVACBanned(CSteamAPIContext.GetSteamApps()); } public static string GetCurrentGameLanguage() { InteropHelp.TestIfAvailableClient(); return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamApps_GetCurrentGameLanguage(CSteamAPIContext.GetSteamApps())); } public static string GetAvailableGameLanguages() { InteropHelp.TestIfAvailableClient(); return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamApps_GetAvailableGameLanguages(CSteamAPIContext.GetSteamApps())); } public static bool BIsSubscribedApp(AppId_t appID) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamApps_BIsSubscribedApp(CSteamAPIContext.GetSteamApps(), appID); } public static bool BIsDlcInstalled(AppId_t appID) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamApps_BIsDlcInstalled(CSteamAPIContext.GetSteamApps(), appID); } public static uint GetEarliestPurchaseUnixTime(AppId_t nAppID) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamApps_GetEarliestPurchaseUnixTime(CSteamAPIContext.GetSteamApps(), nAppID); } public static bool BIsSubscribedFromFreeWeekend() { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamApps_BIsSubscribedFromFreeWeekend(CSteamAPIContext.GetSteamApps()); } public static int GetDLCCount() { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamApps_GetDLCCount(CSteamAPIContext.GetSteamApps()); } public static bool BGetDLCDataByIndex(int iDLC, out AppId_t pAppID, out bool pbAvailable, out string pchName, int cchNameBufferSize) { InteropHelp.TestIfAvailableClient(); IntPtr intPtr = Marshal.AllocHGlobal(cchNameBufferSize); bool flag = NativeMethods.ISteamApps_BGetDLCDataByIndex(CSteamAPIContext.GetSteamApps(), iDLC, out pAppID, out pbAvailable, intPtr, cchNameBufferSize); pchName = (flag ? InteropHelp.PtrToStringUTF8(intPtr) : null); Marshal.FreeHGlobal(intPtr); return flag; } public static void InstallDLC(AppId_t nAppID) { InteropHelp.TestIfAvailableClient(); NativeMethods.ISteamApps_InstallDLC(CSteamAPIContext.GetSteamApps(), nAppID); } public static void UninstallDLC(AppId_t nAppID) { InteropHelp.TestIfAvailableClient(); NativeMethods.ISteamApps_UninstallDLC(CSteamAPIContext.GetSteamApps(), nAppID); } public static void RequestAppProofOfPurchaseKey(AppId_t nAppID) { InteropHelp.TestIfAvailableClient(); NativeMethods.ISteamApps_RequestAppProofOfPurchaseKey(CSteamAPIContext.GetSteamApps(), nAppID); } public static bool GetCurrentBetaName(out string pchName, int cchNameBufferSize) { InteropHelp.TestIfAvailableClient(); IntPtr intPtr = Marshal.AllocHGlobal(cchNameBufferSize); bool flag = NativeMethods.ISteamApps_GetCurrentBetaName(CSteamAPIContext.GetSteamApps(), intPtr, cchNameBufferSize); pchName = (flag ? InteropHelp.PtrToStringUTF8(intPtr) : null); Marshal.FreeHGlobal(intPtr); return flag; } public static bool MarkContentCorrupt(bool bMissingFilesOnly) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamApps_MarkContentCorrupt(CSteamAPIContext.GetSteamApps(), bMissingFilesOnly); } public static uint GetInstalledDepots(AppId_t appID, DepotId_t[] pvecDepots, uint cMaxDepots) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamApps_GetInstalledDepots(CSteamAPIContext.GetSteamApps(), appID, pvecDepots, cMaxDepots); } public static uint GetAppInstallDir(AppId_t appID, out string pchFolder, uint cchFolderBufferSize) { InteropHelp.TestIfAvailableClient(); IntPtr intPtr = Marshal.AllocHGlobal((int)cchFolderBufferSize); uint num = NativeMethods.ISteamApps_GetAppInstallDir(CSteamAPIContext.GetSteamApps(), appID, intPtr, cchFolderBufferSize); pchFolder = ((num != 0) ? InteropHelp.PtrToStringUTF8(intPtr) : null); Marshal.FreeHGlobal(intPtr); return num; } public static bool BIsAppInstalled(AppId_t appID) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamApps_BIsAppInstalled(CSteamAPIContext.GetSteamApps(), appID); } public static CSteamID GetAppOwner() { InteropHelp.TestIfAvailableClient(); return (CSteamID)NativeMethods.ISteamApps_GetAppOwner(CSteamAPIContext.GetSteamApps()); } public static string GetLaunchQueryParam(string pchKey) { InteropHelp.TestIfAvailableClient(); using InteropHelp.UTF8StringHandle pchKey2 = new InteropHelp.UTF8StringHandle(pchKey); return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamApps_GetLaunchQueryParam(CSteamAPIContext.GetSteamApps(), pchKey2)); } public static bool GetDlcDownloadProgress(AppId_t nAppID, out ulong punBytesDownloaded, out ulong punBytesTotal) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamApps_GetDlcDownloadProgress(CSteamAPIContext.GetSteamApps(), nAppID, out punBytesDownloaded, out punBytesTotal); } public static int GetAppBuildId() { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamApps_GetAppBuildId(CSteamAPIContext.GetSteamApps()); } public static void RequestAllProofOfPurchaseKeys() { InteropHelp.TestIfAvailableClient(); NativeMethods.ISteamApps_RequestAllProofOfPurchaseKeys(CSteamAPIContext.GetSteamApps()); } public static SteamAPICall_t GetFileDetails(string pszFileName) { InteropHelp.TestIfAvailableClient(); using InteropHelp.UTF8StringHandle pszFileName2 = new InteropHelp.UTF8StringHandle(pszFileName); return (SteamAPICall_t)NativeMethods.ISteamApps_GetFileDetails(CSteamAPIContext.GetSteamApps(), pszFileName2); } public static int GetLaunchCommandLine(out string pszCommandLine, int cubCommandLine) { InteropHelp.TestIfAvailableClient(); IntPtr intPtr = Marshal.AllocHGlobal(cubCommandLine); int num = NativeMethods.ISteamApps_GetLaunchCommandLine(CSteamAPIContext.GetSteamApps(), intPtr, cubCommandLine); pszCommandLine = ((num != -1) ? InteropHelp.PtrToStringUTF8(intPtr) : null); Marshal.FreeHGlobal(intPtr); return num; } public static bool BIsSubscribedFromFamilySharing() { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamApps_BIsSubscribedFromFamilySharing(CSteamAPIContext.GetSteamApps()); } public static bool BIsTimedTrial(out uint punSecondsAllowed, out uint punSecondsPlayed) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamApps_BIsTimedTrial(CSteamAPIContext.GetSteamApps(), out punSecondsAllowed, out punSecondsPlayed); } } public static class SteamClient { public static HSteamPipe CreateSteamPipe() { InteropHelp.TestIfAvailableClient(); return (HSteamPipe)NativeMethods.ISteamClient_CreateSteamPipe(CSteamAPIContext.GetSteamClient()); } public static bool BReleaseSteamPipe(HSteamPipe hSteamPipe) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamClient_BReleaseSteamPipe(CSteamAPIContext.GetSteamClient(), hSteamPipe); } public static HSteamUser ConnectToGlobalUser(HSteamPipe hSteamPipe) { InteropHelp.TestIfAvailableClient(); return (HSteamUser)NativeMethods.ISteamClient_ConnectToGlobalUser(CSteamAPIContext.GetSteamClient(), hSteamPipe); } public static HSteamUser CreateLocalUser(out HSteamPipe phSteamPipe, EAccountType eAccountType) { InteropHelp.TestIfAvailableClient(); return (HSteamUser)NativeMethods.ISteamClient_CreateLocalUser(CSteamAPIContext.GetSteamClient(), out phSteamPipe, eAccountType); } public static void ReleaseUser(HSteamPipe hSteamPipe, HSteamUser hUser) { InteropHelp.TestIfAvailableClient(); NativeMethods.ISteamClient_ReleaseUser(CSteamAPIContext.GetSteamClient(), hSteamPipe, hUser); } public static IntPtr GetISteamUser(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableClient(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamUser(CSteamAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2); } public static IntPtr GetISteamGameServer(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableClient(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamGameServer(CSteamAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2); } public static void SetLocalIPBinding(ref SteamIPAddress_t unIP, ushort usPort) { InteropHelp.TestIfAvailableClient(); NativeMethods.ISteamClient_SetLocalIPBinding(CSteamAPIContext.GetSteamClient(), ref unIP, usPort); } public static IntPtr GetISteamFriends(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableClient(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamFriends(CSteamAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2); } public static IntPtr GetISteamUtils(HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableClient(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamUtils(CSteamAPIContext.GetSteamClient(), hSteamPipe, pchVersion2); } public static IntPtr GetISteamMatchmaking(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableClient(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamMatchmaking(CSteamAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2); } public static IntPtr GetISteamMatchmakingServers(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableClient(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamMatchmakingServers(CSteamAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2); } public static IntPtr GetISteamGenericInterface(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableClient(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamGenericInterface(CSteamAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2); } public static IntPtr GetISteamUserStats(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableClient(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamUserStats(CSteamAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2); } public static IntPtr GetISteamGameServerStats(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableClient(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamGameServerStats(CSteamAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2); } public static IntPtr GetISteamApps(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableClient(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamApps(CSteamAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2); } public static IntPtr GetISteamNetworking(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableClient(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamNetworking(CSteamAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2); } public static IntPtr GetISteamRemoteStorage(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableClient(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamRemoteStorage(CSteamAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2); } public static IntPtr GetISteamScreenshots(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableClient(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamScreenshots(CSteamAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2); } public static IntPtr GetISteamGameSearch(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableClient(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamGameSearch(CSteamAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2); } public static uint GetIPCCallCount() { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamClient_GetIPCCallCount(CSteamAPIContext.GetSteamClient()); } public static void SetWarningMessageHook(SteamAPIWarningMessageHook_t pFunction) { InteropHelp.TestIfAvailableClient(); NativeMethods.ISteamClient_SetWarningMessageHook(CSteamAPIContext.GetSteamClient(), pFunction); } public static bool BShutdownIfAllPipesClosed() { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamClient_BShutdownIfAllPipesClosed(CSteamAPIContext.GetSteamClient()); } public static IntPtr GetISteamHTTP(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableClient(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamHTTP(CSteamAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2); } public static IntPtr GetISteamController(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableClient(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamController(CSteamAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2); } public static IntPtr GetISteamUGC(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableClient(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamUGC(CSteamAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2); } public static IntPtr GetISteamAppList(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableClient(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamAppList(CSteamAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2); } public static IntPtr GetISteamMusic(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableClient(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamMusic(CSteamAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2); } public static IntPtr GetISteamMusicRemote(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableClient(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamMusicRemote(CSteamAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2); } public static IntPtr GetISteamHTMLSurface(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableClient(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamHTMLSurface(CSteamAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2); } public static IntPtr GetISteamInventory(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableClient(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamInventory(CSteamAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2); } public static IntPtr GetISteamVideo(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableClient(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamVideo(CSteamAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2); } public static IntPtr GetISteamParentalSettings(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableClient(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamParentalSettings(CSteamAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2); } public static IntPtr GetISteamInput(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableClient(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamInput(CSteamAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2); } public static IntPtr GetISteamParties(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableClient(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamParties(CSteamAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2); } public static IntPtr GetISteamRemotePlay(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableClient(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamRemotePlay(CSteamAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2); } } public static class SteamFriends { public static string GetPersonaName() { InteropHelp.TestIfAvailableClient(); return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamFriends_GetPersonaName(CSteamAPIContext.GetSteamFriends())); } public static SteamAPICall_t SetPersonaName(string pchPersonaName) { InteropHelp.TestIfAvailableClient(); using InteropHelp.UTF8StringHandle pchPersonaName2 = new InteropHelp.UTF8StringHandle(pchPersonaName); return (SteamAPICall_t)NativeMethods.ISteamFriends_SetPersonaName(CSteamAPIContext.GetSteamFriends(), pchPersonaName2); } public static EPersonaState GetPersonaState() { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_GetPersonaState(CSteamAPIContext.GetSteamFriends()); } public static int GetFriendCount(EFriendFlags iFriendFlags) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_GetFriendCount(CSteamAPIContext.GetSteamFriends(), iFriendFlags); } public static CSteamID GetFriendByIndex(int iFriend, EFriendFlags iFriendFlags) { InteropHelp.TestIfAvailableClient(); return (CSteamID)NativeMethods.ISteamFriends_GetFriendByIndex(CSteamAPIContext.GetSteamFriends(), iFriend, iFriendFlags); } public static EFriendRelationship GetFriendRelationship(CSteamID steamIDFriend) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_GetFriendRelationship(CSteamAPIContext.GetSteamFriends(), steamIDFriend); } public static EPersonaState GetFriendPersonaState(CSteamID steamIDFriend) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_GetFriendPersonaState(CSteamAPIContext.GetSteamFriends(), steamIDFriend); } public static string GetFriendPersonaName(CSteamID steamIDFriend) { InteropHelp.TestIfAvailableClient(); return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamFriends_GetFriendPersonaName(CSteamAPIContext.GetSteamFriends(), steamIDFriend)); } public static bool GetFriendGamePlayed(CSteamID steamIDFriend, out FriendGameInfo_t pFriendGameInfo) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_GetFriendGamePlayed(CSteamAPIContext.GetSteamFriends(), steamIDFriend, out pFriendGameInfo); } public static string GetFriendPersonaNameHistory(CSteamID steamIDFriend, int iPersonaName) { InteropHelp.TestIfAvailableClient(); return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamFriends_GetFriendPersonaNameHistory(CSteamAPIContext.GetSteamFriends(), steamIDFriend, iPersonaName)); } public static int GetFriendSteamLevel(CSteamID steamIDFriend) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_GetFriendSteamLevel(CSteamAPIContext.GetSteamFriends(), steamIDFriend); } public static string GetPlayerNickname(CSteamID steamIDPlayer) { InteropHelp.TestIfAvailableClient(); return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamFriends_GetPlayerNickname(CSteamAPIContext.GetSteamFriends(), steamIDPlayer)); } public static int GetFriendsGroupCount() { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_GetFriendsGroupCount(CSteamAPIContext.GetSteamFriends()); } public static FriendsGroupID_t GetFriendsGroupIDByIndex(int iFG) { InteropHelp.TestIfAvailableClient(); return (FriendsGroupID_t)NativeMethods.ISteamFriends_GetFriendsGroupIDByIndex(CSteamAPIContext.GetSteamFriends(), iFG); } public static string GetFriendsGroupName(FriendsGroupID_t friendsGroupID) { InteropHelp.TestIfAvailableClient(); return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamFriends_GetFriendsGroupName(CSteamAPIContext.GetSteamFriends(), friendsGroupID)); } public static int GetFriendsGroupMembersCount(FriendsGroupID_t friendsGroupID) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_GetFriendsGroupMembersCount(CSteamAPIContext.GetSteamFriends(), friendsGroupID); } public static void GetFriendsGroupMembersList(FriendsGroupID_t friendsGroupID, CSteamID[] pOutSteamIDMembers, int nMembersCount) { InteropHelp.TestIfAvailableClient(); NativeMethods.ISteamFriends_GetFriendsGroupMembersList(CSteamAPIContext.GetSteamFriends(), friendsGroupID, pOutSteamIDMembers, nMembersCount); } public static bool HasFriend(CSteamID steamIDFriend, EFriendFlags iFriendFlags) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_HasFriend(CSteamAPIContext.GetSteamFriends(), steamIDFriend, iFriendFlags); } public static int GetClanCount() { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_GetClanCount(CSteamAPIContext.GetSteamFriends()); } public static CSteamID GetClanByIndex(int iClan) { InteropHelp.TestIfAvailableClient(); return (CSteamID)NativeMethods.ISteamFriends_GetClanByIndex(CSteamAPIContext.GetSteamFriends(), iClan); } public static string GetClanName(CSteamID steamIDClan) { InteropHelp.TestIfAvailableClient(); return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamFriends_GetClanName(CSteamAPIContext.GetSteamFriends(), steamIDClan)); } public static string GetClanTag(CSteamID steamIDClan) { InteropHelp.TestIfAvailableClient(); return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamFriends_GetClanTag(CSteamAPIContext.GetSteamFriends(), steamIDClan)); } public static bool GetClanActivityCounts(CSteamID steamIDClan, out int pnOnline, out int pnInGame, out int pnChatting) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_GetClanActivityCounts(CSteamAPIContext.GetSteamFriends(), steamIDClan, out pnOnline, out pnInGame, out pnChatting); } public static SteamAPICall_t DownloadClanActivityCounts(CSteamID[] psteamIDClans, int cClansToRequest) { InteropHelp.TestIfAvailableClient(); return (SteamAPICall_t)NativeMethods.ISteamFriends_DownloadClanActivityCounts(CSteamAPIContext.GetSteamFriends(), psteamIDClans, cClansToRequest); } public static int GetFriendCountFromSource(CSteamID steamIDSource) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_GetFriendCountFromSource(CSteamAPIContext.GetSteamFriends(), steamIDSource); } public static CSteamID GetFriendFromSourceByIndex(CSteamID steamIDSource, int iFriend) { InteropHelp.TestIfAvailableClient(); return (CSteamID)NativeMethods.ISteamFriends_GetFriendFromSourceByIndex(CSteamAPIContext.GetSteamFriends(), steamIDSource, iFriend); } public static bool IsUserInSource(CSteamID steamIDUser, CSteamID steamIDSource) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_IsUserInSource(CSteamAPIContext.GetSteamFriends(), steamIDUser, steamIDSource); } public static void SetInGameVoiceSpeaking(CSteamID steamIDUser, bool bSpeaking) { InteropHelp.TestIfAvailableClient(); NativeMethods.ISteamFriends_SetInGameVoiceSpeaking(CSteamAPIContext.GetSteamFriends(), steamIDUser, bSpeaking); } public static void ActivateGameOverlay(string pchDialog) { InteropHelp.TestIfAvailableClient(); using InteropHelp.UTF8StringHandle pchDialog2 = new InteropHelp.UTF8StringHandle(pchDialog); NativeMethods.ISteamFriends_ActivateGameOverlay(CSteamAPIContext.GetSteamFriends(), pchDialog2); } public static void ActivateGameOverlayToUser(string pchDialog, CSteamID steamID) { InteropHelp.TestIfAvailableClient(); using InteropHelp.UTF8StringHandle pchDialog2 = new InteropHelp.UTF8StringHandle(pchDialog); NativeMethods.ISteamFriends_ActivateGameOverlayToUser(CSteamAPIContext.GetSteamFriends(), pchDialog2, steamID); } public static void ActivateGameOverlayToWebPage(string pchURL, EActivateGameOverlayToWebPageMode eMode = EActivateGameOverlayToWebPageMode.k_EActivateGameOverlayToWebPageMode_Default) { InteropHelp.TestIfAvailableClient(); using InteropHelp.UTF8StringHandle pchURL2 = new InteropHelp.UTF8StringHandle(pchURL); NativeMethods.ISteamFriends_ActivateGameOverlayToWebPage(CSteamAPIContext.GetSteamFriends(), pchURL2, eMode); } public static void ActivateGameOverlayToStore(AppId_t nAppID, EOverlayToStoreFlag eFlag) { InteropHelp.TestIfAvailableClient(); NativeMethods.ISteamFriends_ActivateGameOverlayToStore(CSteamAPIContext.GetSteamFriends(), nAppID, eFlag); } public static void SetPlayedWith(CSteamID steamIDUserPlayedWith) { InteropHelp.TestIfAvailableClient(); NativeMethods.ISteamFriends_SetPlayedWith(CSteamAPIContext.GetSteamFriends(), steamIDUserPlayedWith); } public static void ActivateGameOverlayInviteDialog(CSteamID steamIDLobby) { InteropHelp.TestIfAvailableClient(); NativeMethods.ISteamFriends_ActivateGameOverlayInviteDialog(CSteamAPIContext.GetSteamFriends(), steamIDLobby); } public static int GetSmallFriendAvatar(CSteamID steamIDFriend) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_GetSmallFriendAvatar(CSteamAPIContext.GetSteamFriends(), steamIDFriend); } public static int GetMediumFriendAvatar(CSteamID steamIDFriend) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_GetMediumFriendAvatar(CSteamAPIContext.GetSteamFriends(), steamIDFriend); } public static int GetLargeFriendAvatar(CSteamID steamIDFriend) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_GetLargeFriendAvatar(CSteamAPIContext.GetSteamFriends(), steamIDFriend); } public static bool RequestUserInformation(CSteamID steamIDUser, bool bRequireNameOnly) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_RequestUserInformation(CSteamAPIContext.GetSteamFriends(), steamIDUser, bRequireNameOnly); } public static SteamAPICall_t RequestClanOfficerList(CSteamID steamIDClan) { InteropHelp.TestIfAvailableClient(); return (SteamAPICall_t)NativeMethods.ISteamFriends_RequestClanOfficerList(CSteamAPIContext.GetSteamFriends(), steamIDClan); } public static CSteamID GetClanOwner(CSteamID steamIDClan) { InteropHelp.TestIfAvailableClient(); return (CSteamID)NativeMethods.ISteamFriends_GetClanOwner(CSteamAPIContext.GetSteamFriends(), steamIDClan); } public static int GetClanOfficerCount(CSteamID steamIDClan) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_GetClanOfficerCount(CSteamAPIContext.GetSteamFriends(), steamIDClan); } public static CSteamID GetClanOfficerByIndex(CSteamID steamIDClan, int iOfficer) { InteropHelp.TestIfAvailableClient(); return (CSteamID)NativeMethods.ISteamFriends_GetClanOfficerByIndex(CSteamAPIContext.GetSteamFriends(), steamIDClan, iOfficer); } public static uint GetUserRestrictions() { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_GetUserRestrictions(CSteamAPIContext.GetSteamFriends()); } public static bool SetRichPresence(string pchKey, string pchValue) { InteropHelp.TestIfAvailableClient(); using InteropHelp.UTF8StringHandle pchKey2 = new InteropHelp.UTF8StringHandle(pchKey); using InteropHelp.UTF8StringHandle pchValue2 = new InteropHelp.UTF8StringHandle(pchValue); return NativeMethods.ISteamFriends_SetRichPresence(CSteamAPIContext.GetSteamFriends(), pchKey2, pchValue2); } public static void ClearRichPresence() { InteropHelp.TestIfAvailableClient(); NativeMethods.ISteamFriends_ClearRichPresence(CSteamAPIContext.GetSteamFriends()); } public static string GetFriendRichPresence(CSteamID steamIDFriend, string pchKey) { InteropHelp.TestIfAvailableClient(); using InteropHelp.UTF8StringHandle pchKey2 = new InteropHelp.UTF8StringHandle(pchKey); return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamFriends_GetFriendRichPresence(CSteamAPIContext.GetSteamFriends(), steamIDFriend, pchKey2)); } public static int GetFriendRichPresenceKeyCount(CSteamID steamIDFriend) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_GetFriendRichPresenceKeyCount(CSteamAPIContext.GetSteamFriends(), steamIDFriend); } public static string GetFriendRichPresenceKeyByIndex(CSteamID steamIDFriend, int iKey) { InteropHelp.TestIfAvailableClient(); return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamFriends_GetFriendRichPresenceKeyByIndex(CSteamAPIContext.GetSteamFriends(), steamIDFriend, iKey)); } public static void RequestFriendRichPresence(CSteamID steamIDFriend) { InteropHelp.TestIfAvailableClient(); NativeMethods.ISteamFriends_RequestFriendRichPresence(CSteamAPIContext.GetSteamFriends(), steamIDFriend); } public static bool InviteUserToGame(CSteamID steamIDFriend, string pchConnectString) { InteropHelp.TestIfAvailableClient(); using InteropHelp.UTF8StringHandle pchConnectString2 = new InteropHelp.UTF8StringHandle(pchConnectString); return NativeMethods.ISteamFriends_InviteUserToGame(CSteamAPIContext.GetSteamFriends(), steamIDFriend, pchConnectString2); } public static int GetCoplayFriendCount() { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_GetCoplayFriendCount(CSteamAPIContext.GetSteamFriends()); } public static CSteamID GetCoplayFriend(int iCoplayFriend) { InteropHelp.TestIfAvailableClient(); return (CSteamID)NativeMethods.ISteamFriends_GetCoplayFriend(CSteamAPIContext.GetSteamFriends(), iCoplayFriend); } public static int GetFriendCoplayTime(CSteamID steamIDFriend) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_GetFriendCoplayTime(CSteamAPIContext.GetSteamFriends(), steamIDFriend); } public static AppId_t GetFriendCoplayGame(CSteamID steamIDFriend) { InteropHelp.TestIfAvailableClient(); return (AppId_t)NativeMethods.ISteamFriends_GetFriendCoplayGame(CSteamAPIContext.GetSteamFriends(), steamIDFriend); } public static SteamAPICall_t JoinClanChatRoom(CSteamID steamIDClan) { InteropHelp.TestIfAvailableClient(); return (SteamAPICall_t)NativeMethods.ISteamFriends_JoinClanChatRoom(CSteamAPIContext.GetSteamFriends(), steamIDClan); } public static bool LeaveClanChatRoom(CSteamID steamIDClan) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_LeaveClanChatRoom(CSteamAPIContext.GetSteamFriends(), steamIDClan); } public static int GetClanChatMemberCount(CSteamID steamIDClan) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_GetClanChatMemberCount(CSteamAPIContext.GetSteamFriends(), steamIDClan); } public static CSteamID GetChatMemberByIndex(CSteamID steamIDClan, int iUser) { InteropHelp.TestIfAvailableClient(); return (CSteamID)NativeMethods.ISteamFriends_GetChatMemberByIndex(CSteamAPIContext.GetSteamFriends(), steamIDClan, iUser); } public static bool SendClanChatMessage(CSteamID steamIDClanChat, string pchText) { InteropHelp.TestIfAvailableClient(); using InteropHelp.UTF8StringHandle pchText2 = new InteropHelp.UTF8StringHandle(pchText); return NativeMethods.ISteamFriends_SendClanChatMessage(CSteamAPIContext.GetSteamFriends(), steamIDClanChat, pchText2); } public static int GetClanChatMessage(CSteamID steamIDClanChat, int iMessage, out string prgchText, int cchTextMax, out EChatEntryType peChatEntryType, out CSteamID psteamidChatter) { InteropHelp.TestIfAvailableClient(); IntPtr intPtr = Marshal.AllocHGlobal(cchTextMax); int num = NativeMethods.ISteamFriends_GetClanChatMessage(CSteamAPIContext.GetSteamFriends(), steamIDClanChat, iMessage, intPtr, cchTextMax, out peChatEntryType, out psteamidChatter); prgchText = ((num != 0) ? InteropHelp.PtrToStringUTF8(intPtr) : null); Marshal.FreeHGlobal(intPtr); return num; } public static bool IsClanChatAdmin(CSteamID steamIDClanChat, CSteamID steamIDUser) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_IsClanChatAdmin(CSteamAPIContext.GetSteamFriends(), steamIDClanChat, steamIDUser); } public static bool IsClanChatWindowOpenInSteam(CSteamID steamIDClanChat) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_IsClanChatWindowOpenInSteam(CSteamAPIContext.GetSteamFriends(), steamIDClanChat); } public static bool OpenClanChatWindowInSteam(CSteamID steamIDClanChat) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_OpenClanChatWindowInSteam(CSteamAPIContext.GetSteamFriends(), steamIDClanChat); } public static bool CloseClanChatWindowInSteam(CSteamID steamIDClanChat) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_CloseClanChatWindowInSteam(CSteamAPIContext.GetSteamFriends(), steamIDClanChat); } public static bool SetListenForFriendsMessages(bool bInterceptEnabled) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_SetListenForFriendsMessages(CSteamAPIContext.GetSteamFriends(), bInterceptEnabled); } public static bool ReplyToFriendMessage(CSteamID steamIDFriend, string pchMsgToSend) { InteropHelp.TestIfAvailableClient(); using InteropHelp.UTF8StringHandle pchMsgToSend2 = new InteropHelp.UTF8StringHandle(pchMsgToSend); return NativeMethods.ISteamFriends_ReplyToFriendMessage(CSteamAPIContext.GetSteamFriends(), steamIDFriend, pchMsgToSend2); } public static int GetFriendMessage(CSteamID steamIDFriend, int iMessageID, out string pvData, int cubData, out EChatEntryType peChatEntryType) { InteropHelp.TestIfAvailableClient(); IntPtr intPtr = Marshal.AllocHGlobal(cubData); int num = NativeMethods.ISteamFriends_GetFriendMessage(CSteamAPIContext.GetSteamFriends(), steamIDFriend, iMessageID, intPtr, cubData, out peChatEntryType); pvData = ((num != 0) ? InteropHelp.PtrToStringUTF8(intPtr) : null); Marshal.FreeHGlobal(intPtr); return num; } public static SteamAPICall_t GetFollowerCount(CSteamID steamID) { InteropHelp.TestIfAvailableClient(); return (SteamAPICall_t)NativeMethods.ISteamFriends_GetFollowerCount(CSteamAPIContext.GetSteamFriends(), steamID); } public static SteamAPICall_t IsFollowing(CSteamID steamID) { InteropHelp.TestIfAvailableClient(); return (SteamAPICall_t)NativeMethods.ISteamFriends_IsFollowing(CSteamAPIContext.GetSteamFriends(), steamID); } public static SteamAPICall_t EnumerateFollowingList(uint unStartIndex) { InteropHelp.TestIfAvailableClient(); return (SteamAPICall_t)NativeMethods.ISteamFriends_EnumerateFollowingList(CSteamAPIContext.GetSteamFriends(), unStartIndex); } public static bool IsClanPublic(CSteamID steamIDClan) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_IsClanPublic(CSteamAPIContext.GetSteamFriends(), steamIDClan); } public static bool IsClanOfficialGameGroup(CSteamID steamIDClan) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_IsClanOfficialGameGroup(CSteamAPIContext.GetSteamFriends(), steamIDClan); } public static int GetNumChatsWithUnreadPriorityMessages() { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_GetNumChatsWithUnreadPriorityMessages(CSteamAPIContext.GetSteamFriends()); } public static void ActivateGameOverlayRemotePlayTogetherInviteDialog(CSteamID steamIDLobby) { InteropHelp.TestIfAvailableClient(); NativeMethods.ISteamFriends_ActivateGameOverlayRemotePlayTogetherInviteDialog(CSteamAPIContext.GetSteamFriends(), steamIDLobby); } public static bool RegisterProtocolInOverlayBrowser(string pchProtocol) { InteropHelp.TestIfAvailableClient(); using InteropHelp.UTF8StringHandle pchProtocol2 = new InteropHelp.UTF8StringHandle(pchProtocol); return NativeMethods.ISteamFriends_RegisterProtocolInOverlayBrowser(CSteamAPIContext.GetSteamFriends(), pchProtocol2); } public static void ActivateGameOverlayInviteDialogConnectString(string pchConnectString) { InteropHelp.TestIfAvailableClient(); using InteropHelp.UTF8StringHandle pchConnectString2 = new InteropHelp.UTF8StringHandle(pchConnectString); NativeMethods.ISteamFriends_ActivateGameOverlayInviteDialogConnectString(CSteamAPIContext.GetSteamFriends(), pchConnectString2); } } public static class SteamGameServer { public static void SetProduct(string pszProduct) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pszProduct2 = new InteropHelp.UTF8StringHandle(pszProduct); NativeMethods.ISteamGameServer_SetProduct(CSteamGameServerAPIContext.GetSteamGameServer(), pszProduct2); } public static void SetGameDescription(string pszGameDescription) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pszGameDescription2 = new InteropHelp.UTF8StringHandle(pszGameDescription); NativeMethods.ISteamGameServer_SetGameDescription(CSteamGameServerAPIContext.GetSteamGameServer(), pszGameDescription2); } public static void SetModDir(string pszModDir) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pszModDir2 = new InteropHelp.UTF8StringHandle(pszModDir); NativeMethods.ISteamGameServer_SetModDir(CSteamGameServerAPIContext.GetSteamGameServer(), pszModDir2); } public static void SetDedicatedServer(bool bDedicated) { InteropHelp.TestIfAvailableGameServer(); NativeMethods.ISteamGameServer_SetDedicatedServer(CSteamGameServerAPIContext.GetSteamGameServer(), bDedicated); } public static void LogOn(string pszToken) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pszToken2 = new InteropHelp.UTF8StringHandle(pszToken); NativeMethods.ISteamGameServer_LogOn(CSteamGameServerAPIContext.GetSteamGameServer(), pszToken2); } public static void LogOnAnonymous() { InteropHelp.TestIfAvailableGameServer(); NativeMethods.ISteamGameServer_LogOnAnonymous(CSteamGameServerAPIContext.GetSteamGameServer()); } public static void LogOff() { InteropHelp.TestIfAvailableGameServer(); NativeMethods.ISteamGameServer_LogOff(CSteamGameServerAPIContext.GetSteamGameServer()); } public static bool BLoggedOn() { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamGameServer_BLoggedOn(CSteamGameServerAPIContext.GetSteamGameServer()); } public static bool BSecure() { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamGameServer_BSecure(CSteamGameServerAPIContext.GetSteamGameServer()); } public static CSteamID GetSteamID() { InteropHelp.TestIfAvailableGameServer(); return (CSteamID)NativeMethods.ISteamGameServer_GetSteamID(CSteamGameServerAPIContext.GetSteamGameServer()); } public static bool WasRestartRequested() { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamGameServer_WasRestartRequested(CSteamGameServerAPIContext.GetSteamGameServer()); } public static void SetMaxPlayerCount(int cPlayersMax) { InteropHelp.TestIfAvailableGameServer(); NativeMethods.ISteamGameServer_SetMaxPlayerCount(CSteamGameServerAPIContext.GetSteamGameServer(), cPlayersMax); } public static void SetBotPlayerCount(int cBotplayers) { InteropHelp.TestIfAvailableGameServer(); NativeMethods.ISteamGameServer_SetBotPlayerCount(CSteamGameServerAPIContext.GetSteamGameServer(), cBotplayers); } public static void SetServerName(string pszServerName) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pszServerName2 = new InteropHelp.UTF8StringHandle(pszServerName); NativeMethods.ISteamGameServer_SetServerName(CSteamGameServerAPIContext.GetSteamGameServer(), pszServerName2); } public static void SetMapName(string pszMapName) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pszMapName2 = new InteropHelp.UTF8StringHandle(pszMapName); NativeMethods.ISteamGameServer_SetMapName(CSteamGameServerAPIContext.GetSteamGameServer(), pszMapName2); } public static void SetPasswordProtected(bool bPasswordProtected) { InteropHelp.TestIfAvailableGameServer(); NativeMethods.ISteamGameServer_SetPasswordProtected(CSteamGameServerAPIContext.GetSteamGameServer(), bPasswordProtected); } public static void SetSpectatorPort(ushort unSpectatorPort) { InteropHelp.TestIfAvailableGameServer(); NativeMethods.ISteamGameServer_SetSpectatorPort(CSteamGameServerAPIContext.GetSteamGameServer(), unSpectatorPort); } public static void SetSpectatorServerName(string pszSpectatorServerName) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pszSpectatorServerName2 = new InteropHelp.UTF8StringHandle(pszSpectatorServerName); NativeMethods.ISteamGameServer_SetSpectatorServerName(CSteamGameServerAPIContext.GetSteamGameServer(), pszSpectatorServerName2); } public static void ClearAllKeyValues() { InteropHelp.TestIfAvailableGameServer(); NativeMethods.ISteamGameServer_ClearAllKeyValues(CSteamGameServerAPIContext.GetSteamGameServer()); } public static void SetKeyValue(string pKey, string pValue) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pKey2 = new InteropHelp.UTF8StringHandle(pKey); using InteropHelp.UTF8StringHandle pValue2 = new InteropHelp.UTF8StringHandle(pValue); NativeMethods.ISteamGameServer_SetKeyValue(CSteamGameServerAPIContext.GetSteamGameServer(), pKey2, pValue2); } public static void SetGameTags(string pchGameTags) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pchGameTags2 = new InteropHelp.UTF8StringHandle(pchGameTags); NativeMethods.ISteamGameServer_SetGameTags(CSteamGameServerAPIContext.GetSteamGameServer(), pchGameTags2); } public static void SetGameData(string pchGameData) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pchGameData2 = new InteropHelp.UTF8StringHandle(pchGameData); NativeMethods.ISteamGameServer_SetGameData(CSteamGameServerAPIContext.GetSteamGameServer(), pchGameData2); } public static void SetRegion(string pszRegion) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pszRegion2 = new InteropHelp.UTF8StringHandle(pszRegion); NativeMethods.ISteamGameServer_SetRegion(CSteamGameServerAPIContext.GetSteamGameServer(), pszRegion2); } public static bool SendUserConnectAndAuthenticate(uint unIPClient, byte[] pvAuthBlob, uint cubAuthBlobSize, out CSteamID pSteamIDUser) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamGameServer_SendUserConnectAndAuthenticate(CSteamGameServerAPIContext.GetSteamGameServer(), unIPClient, pvAuthBlob, cubAuthBlobSize, out pSteamIDUser); } public static CSteamID CreateUnauthenticatedUserConnection() { InteropHelp.TestIfAvailableGameServer(); return (CSteamID)NativeMethods.ISteamGameServer_CreateUnauthenticatedUserConnection(CSteamGameServerAPIContext.GetSteamGameServer()); } public static void SendUserDisconnect(CSteamID steamIDUser) { InteropHelp.TestIfAvailableGameServer(); NativeMethods.ISteamGameServer_SendUserDisconnect(CSteamGameServerAPIContext.GetSteamGameServer(), steamIDUser); } public static bool BUpdateUserData(CSteamID steamIDUser, string pchPlayerName, uint uScore) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pchPlayerName2 = new InteropHelp.UTF8StringHandle(pchPlayerName); return NativeMethods.ISteamGameServer_BUpdateUserData(CSteamGameServerAPIContext.GetSteamGameServer(), steamIDUser, pchPlayerName2, uScore); } public static HAuthTicket GetAuthSessionTicket(byte[] pTicket, int cbMaxTicket, out uint pcbTicket) { InteropHelp.TestIfAvailableGameServer(); return (HAuthTicket)NativeMethods.ISteamGameServer_GetAuthSessionTicket(CSteamGameServerAPIContext.GetSteamGameServer(), pTicket, cbMaxTicket, out pcbTicket); } public static EBeginAuthSessionResult BeginAuthSession(byte[] pAuthTicket, int cbAuthTicket, CSteamID steamID) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamGameServer_BeginAuthSession(CSteamGameServerAPIContext.GetSteamGameServer(), pAuthTicket, cbAuthTicket, steamID); } public static void EndAuthSession(CSteamID steamID) { InteropHelp.TestIfAvailableGameServer(); NativeMethods.ISteamGameServer_EndAuthSession(CSteamGameServerAPIContext.GetSteamGameServer(), steamID); } public static void CancelAuthTicket(HAuthTicket hAuthTicket) { InteropHelp.TestIfAvailableGameServer(); NativeMethods.ISteamGameServer_CancelAuthTicket(CSteamGameServerAPIContext.GetSteamGameServer(), hAuthTicket); } public static EUserHasLicenseForAppResult UserHasLicenseForApp(CSteamID steamID, AppId_t appID) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamGameServer_UserHasLicenseForApp(CSteamGameServerAPIContext.GetSteamGameServer(), steamID, appID); } public static bool RequestUserGroupStatus(CSteamID steamIDUser, CSteamID steamIDGroup) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamGameServer_RequestUserGroupStatus(CSteamGameServerAPIContext.GetSteamGameServer(), steamIDUser, steamIDGroup); } public static void GetGameplayStats() { InteropHelp.TestIfAvailableGameServer(); NativeMethods.ISteamGameServer_GetGameplayStats(CSteamGameServerAPIContext.GetSteamGameServer()); } public static SteamAPICall_t GetServerReputation() { InteropHelp.TestIfAvailableGameServer(); return (SteamAPICall_t)NativeMethods.ISteamGameServer_GetServerReputation(CSteamGameServerAPIContext.GetSteamGameServer()); } public static SteamIPAddress_t GetPublicIP() { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamGameServer_GetPublicIP(CSteamGameServerAPIContext.GetSteamGameServer()); } public static bool HandleIncomingPacket(byte[] pData, int cbData, uint srcIP, ushort srcPort) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamGameServer_HandleIncomingPacket(CSteamGameServerAPIContext.GetSteamGameServer(), pData, cbData, srcIP, srcPort); } public static int GetNextOutgoingPacket(byte[] pOut, int cbMaxOut, out uint pNetAdr, out ushort pPort) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamGameServer_GetNextOutgoingPacket(CSteamGameServerAPIContext.GetSteamGameServer(), pOut, cbMaxOut, out pNetAdr, out pPort); } public static void EnableHeartbeats(bool bActive) { InteropHelp.TestIfAvailableGameServer(); NativeMethods.ISteamGameServer_EnableHeartbeats(CSteamGameServerAPIContext.GetSteamGameServer(), bActive); } public static void SetHeartbeatInterval(int iHeartbeatInterval) { InteropHelp.TestIfAvailableGameServer(); NativeMethods.ISteamGameServer_SetHeartbeatInterval(CSteamGameServerAPIContext.GetSteamGameServer(), iHeartbeatInterval); } public static void ForceHeartbeat() { InteropHelp.TestIfAvailableGameServer(); NativeMethods.ISteamGameServer_ForceHeartbeat(CSteamGameServerAPIContext.GetSteamGameServer()); } public static SteamAPICall_t AssociateWithClan(CSteamID steamIDClan) { InteropHelp.TestIfAvailableGameServer(); return (SteamAPICall_t)NativeMethods.ISteamGameServer_AssociateWithClan(CSteamGameServerAPIContext.GetSteamGameServer(), steamIDClan); } public static SteamAPICall_t ComputeNewPlayerCompatibility(CSteamID steamIDNewPlayer) { InteropHelp.TestIfAvailableGameServer(); return (SteamAPICall_t)NativeMethods.ISteamGameServer_ComputeNewPlayerCompatibility(CSteamGameServerAPIContext.GetSteamGameServer(), steamIDNewPlayer); } } public static class SteamGameServerClient { public static HSteamPipe CreateSteamPipe() { InteropHelp.TestIfAvailableGameServer(); return (HSteamPipe)NativeMethods.ISteamClient_CreateSteamPipe(CSteamGameServerAPIContext.GetSteamClient()); } public static bool BReleaseSteamPipe(HSteamPipe hSteamPipe) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamClient_BReleaseSteamPipe(CSteamGameServerAPIContext.GetSteamClient(), hSteamPipe); } public static HSteamUser ConnectToGlobalUser(HSteamPipe hSteamPipe) { InteropHelp.TestIfAvailableGameServer(); return (HSteamUser)NativeMethods.ISteamClient_ConnectToGlobalUser(CSteamGameServerAPIContext.GetSteamClient(), hSteamPipe); } public static HSteamUser CreateLocalUser(out HSteamPipe phSteamPipe, EAccountType eAccountType) { InteropHelp.TestIfAvailableGameServer(); return (HSteamUser)NativeMethods.ISteamClient_CreateLocalUser(CSteamGameServerAPIContext.GetSteamClient(), out phSteamPipe, eAccountType); } public static void ReleaseUser(HSteamPipe hSteamPipe, HSteamUser hUser) { InteropHelp.TestIfAvailableGameServer(); NativeMethods.ISteamClient_ReleaseUser(CSteamGameServerAPIContext.GetSteamClient(), hSteamPipe, hUser); } public static IntPtr GetISteamUser(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamUser(CSteamGameServerAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2); } public static IntPtr GetISteamGameServer(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamGameServer(CSteamGameServerAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2); } public static void SetLocalIPBinding(ref SteamIPAddress_t unIP, ushort usPort) { InteropHelp.TestIfAvailableGameServer(); NativeMethods.ISteamClient_SetLocalIPBinding(CSteamGameServerAPIContext.GetSteamClient(), ref unIP, usPort); } public static IntPtr GetISteamFriends(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamFriends(CSteamGameServerAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2); } public static IntPtr GetISteamUtils(HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamUtils(CSteamGameServerAPIContext.GetSteamClient(), hSteamPipe, pchVersion2); } public static IntPtr GetISteamMatchmaking(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamMatchmaking(CSteamGameServerAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2); } public static IntPtr GetISteamMatchmakingServers(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamMatchmakingServers(CSteamGameServerAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2); } public static IntPtr GetISteamGenericInterface(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamGenericInterface(CSteamGameServerAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2); } public static IntPtr GetISteamUserStats(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamUserStats(CSteamGameServerAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2); } public static IntPtr GetISteamGameServerStats(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamGameServerStats(CSteamGameServerAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2); } public static IntPtr GetISteamApps(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamApps(CSteamGameServerAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2); } public static IntPtr GetISteamNetworking(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamNetworking(CSteamGameServerAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2); } public static IntPtr GetISteamRemoteStorage(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamRemoteStorage(CSteamGameServerAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2); } public static IntPtr GetISteamScreenshots(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamScreenshots(CSteamGameServerAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2); } public static IntPtr GetISteamGameSearch(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamGameSearch(CSteamGameServerAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2); } public static uint GetIPCCallCount() { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamClient_GetIPCCallCount(CSteamGameServerAPIContext.GetSteamClient()); } public static void SetWarningMessageHook(SteamAPIWarningMessageHook_t pFunction) { InteropHelp.TestIfAvailableGameServer(); NativeMethods.ISteamClient_SetWarningMessageHook(CSteamGameServerAPIContext.GetSteamClient(), pFunction); } public static bool BShutdownIfAllPipesClosed() { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamClient_BShutdownIfAllPipesClosed(CSteamGameServerAPIContext.GetSteamClient()); } public static IntPtr GetISteamHTTP(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamHTTP(CSteamGameServerAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2); } public static IntPtr GetISteamController(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamController(CSteamGameServerAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2); } public static IntPtr GetISteamUGC(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamUGC(CSteamGameServerAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2); } public static IntPtr GetISteamAppList(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamAppList(CSteamGameServerAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2); } public static IntPtr GetISteamMusic(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamMusic(CSteamGameServerAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2); } public static IntPtr GetISteamMusicRemote(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamMusicRemote(CSteamGameServerAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2); } public static IntPtr GetISteamHTMLSurface(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamHTMLSurface(CSteamGameServerAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2); } public static IntPtr GetISteamInventory(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamInventory(CSteamGameServerAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2); } public static IntPtr GetISteamVideo(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamVideo(CSteamGameServerAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2); } public static IntPtr GetISteamParentalSettings(HSteamUser hSteamuser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamParentalSettings(CSteamGameServerAPIContext.GetSteamClient(), hSteamuser, hSteamPipe, pchVersion2); } public static IntPtr GetISteamInput(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamInput(CSteamGameServerAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2); } public static IntPtr GetISteamParties(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamParties(CSteamGameServerAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2); } public static IntPtr GetISteamRemotePlay(HSteamUser hSteamUser, HSteamPipe hSteamPipe, string pchVersion) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pchVersion2 = new InteropHelp.UTF8StringHandle(pchVersion); return NativeMethods.ISteamClient_GetISteamRemotePlay(CSteamGameServerAPIContext.GetSteamClient(), hSteamUser, hSteamPipe, pchVersion2); } } public static class SteamGameServerHTTP { public static HTTPRequestHandle CreateHTTPRequest(EHTTPMethod eHTTPRequestMethod, string pchAbsoluteURL) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pchAbsoluteURL2 = new InteropHelp.UTF8StringHandle(pchAbsoluteURL); return (HTTPRequestHandle)NativeMethods.ISteamHTTP_CreateHTTPRequest(CSteamGameServerAPIContext.GetSteamHTTP(), eHTTPRequestMethod, pchAbsoluteURL2); } public static bool SetHTTPRequestContextValue(HTTPRequestHandle hRequest, ulong ulContextValue) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamHTTP_SetHTTPRequestContextValue(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, ulContextValue); } public static bool SetHTTPRequestNetworkActivityTimeout(HTTPRequestHandle hRequest, uint unTimeoutSeconds) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamHTTP_SetHTTPRequestNetworkActivityTimeout(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, unTimeoutSeconds); } public static bool SetHTTPRequestHeaderValue(HTTPRequestHandle hRequest, string pchHeaderName, string pchHeaderValue) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pchHeaderName2 = new InteropHelp.UTF8StringHandle(pchHeaderName); using InteropHelp.UTF8StringHandle pchHeaderValue2 = new InteropHelp.UTF8StringHandle(pchHeaderValue); return NativeMethods.ISteamHTTP_SetHTTPRequestHeaderValue(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, pchHeaderName2, pchHeaderValue2); } public static bool SetHTTPRequestGetOrPostParameter(HTTPRequestHandle hRequest, string pchParamName, string pchParamValue) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pchParamName2 = new InteropHelp.UTF8StringHandle(pchParamName); using InteropHelp.UTF8StringHandle pchParamValue2 = new InteropHelp.UTF8StringHandle(pchParamValue); return NativeMethods.ISteamHTTP_SetHTTPRequestGetOrPostParameter(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, pchParamName2, pchParamValue2); } public static bool SendHTTPRequest(HTTPRequestHandle hRequest, out SteamAPICall_t pCallHandle) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamHTTP_SendHTTPRequest(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, out pCallHandle); } public static bool SendHTTPRequestAndStreamResponse(HTTPRequestHandle hRequest, out SteamAPICall_t pCallHandle) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamHTTP_SendHTTPRequestAndStreamResponse(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, out pCallHandle); } public static bool DeferHTTPRequest(HTTPRequestHandle hRequest) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamHTTP_DeferHTTPRequest(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest); } public static bool PrioritizeHTTPRequest(HTTPRequestHandle hRequest) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamHTTP_PrioritizeHTTPRequest(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest); } public static bool GetHTTPResponseHeaderSize(HTTPRequestHandle hRequest, string pchHeaderName, out uint unResponseHeaderSize) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pchHeaderName2 = new InteropHelp.UTF8StringHandle(pchHeaderName); return NativeMethods.ISteamHTTP_GetHTTPResponseHeaderSize(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, pchHeaderName2, out unResponseHeaderSize); } public static bool GetHTTPResponseHeaderValue(HTTPRequestHandle hRequest, string pchHeaderName, byte[] pHeaderValueBuffer, uint unBufferSize) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pchHeaderName2 = new InteropHelp.UTF8StringHandle(pchHeaderName); return NativeMethods.ISteamHTTP_GetHTTPResponseHeaderValue(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, pchHeaderName2, pHeaderValueBuffer, unBufferSize); } public static bool GetHTTPResponseBodySize(HTTPRequestHandle hRequest, out uint unBodySize) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamHTTP_GetHTTPResponseBodySize(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, out unBodySize); } public static bool GetHTTPResponseBodyData(HTTPRequestHandle hRequest, byte[] pBodyDataBuffer, uint unBufferSize) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamHTTP_GetHTTPResponseBodyData(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, pBodyDataBuffer, unBufferSize); } public static bool GetHTTPStreamingResponseBodyData(HTTPRequestHandle hRequest, uint cOffset, byte[] pBodyDataBuffer, uint unBufferSize) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamHTTP_GetHTTPStreamingResponseBodyData(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, cOffset, pBodyDataBuffer, unBufferSize); } public static bool ReleaseHTTPRequest(HTTPRequestHandle hRequest) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamHTTP_ReleaseHTTPRequest(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest); } public static bool GetHTTPDownloadProgressPct(HTTPRequestHandle hRequest, out float pflPercentOut) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamHTTP_GetHTTPDownloadProgressPct(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, out pflPercentOut); } public static bool SetHTTPRequestRawPostBody(HTTPRequestHandle hRequest, string pchContentType, byte[] pubBody, uint unBodyLen) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pchContentType2 = new InteropHelp.UTF8StringHandle(pchContentType); return NativeMethods.ISteamHTTP_SetHTTPRequestRawPostBody(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, pchContentType2, pubBody, unBodyLen); } public static HTTPCookieContainerHandle CreateCookieContainer(bool bAllowResponsesToModify) { InteropHelp.TestIfAvailableGameServer(); return (HTTPCookieContainerHandle)NativeMethods.ISteamHTTP_CreateCookieContainer(CSteamGameServerAPIContext.GetSteamHTTP(), bAllowResponsesToModify); } public static bool ReleaseCookieContainer(HTTPCookieContainerHandle hCookieContainer) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamHTTP_ReleaseCookieContainer(CSteamGameServerAPIContext.GetSteamHTTP(), hCookieContainer); } public static bool SetCookie(HTTPCookieContainerHandle hCookieContainer, string pchHost, string pchUrl, string pchCookie) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pchHost2 = new InteropHelp.UTF8StringHandle(pchHost); using InteropHelp.UTF8StringHandle pchUrl2 = new InteropHelp.UTF8StringHandle(pchUrl); using InteropHelp.UTF8StringHandle pchCookie2 = new InteropHelp.UTF8StringHandle(pchCookie); return NativeMethods.ISteamHTTP_SetCookie(CSteamGameServerAPIContext.GetSteamHTTP(), hCookieContainer, pchHost2, pchUrl2, pchCookie2); } public static bool SetHTTPRequestCookieContainer(HTTPRequestHandle hRequest, HTTPCookieContainerHandle hCookieContainer) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamHTTP_SetHTTPRequestCookieContainer(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, hCookieContainer); } public static bool SetHTTPRequestUserAgentInfo(HTTPRequestHandle hRequest, string pchUserAgentInfo) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pchUserAgentInfo2 = new InteropHelp.UTF8StringHandle(pchUserAgentInfo); return NativeMethods.ISteamHTTP_SetHTTPRequestUserAgentInfo(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, pchUserAgentInfo2); } public static bool SetHTTPRequestRequiresVerifiedCertificate(HTTPRequestHandle hRequest, bool bRequireVerifiedCertificate) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamHTTP_SetHTTPRequestRequiresVerifiedCertificate(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, bRequireVerifiedCertificate); } public static bool SetHTTPRequestAbsoluteTimeoutMS(HTTPRequestHandle hRequest, uint unMilliseconds) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamHTTP_SetHTTPRequestAbsoluteTimeoutMS(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, unMilliseconds); } public static bool GetHTTPRequestWasTimedOut(HTTPRequestHandle hRequest, out bool pbWasTimedOut) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamHTTP_GetHTTPRequestWasTimedOut(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, out pbWasTimedOut); } } public static class SteamGameServerInventory { public static EResult GetResultStatus(SteamInventoryResult_t resultHandle) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamInventory_GetResultStatus(CSteamGameServerAPIContext.GetSteamInventory(), resultHandle); } public static bool GetResultItems(SteamInventoryResult_t resultHandle, SteamItemDetails_t[] pOutItemsArray, ref uint punOutItemsArraySize) { InteropHelp.TestIfAvailableGameServer(); if (pOutItemsArray != null && pOutItemsArray.Length != punOutItemsArraySize) { throw new ArgumentException("pOutItemsArray must be the same size as punOutItemsArraySize!"); } return NativeMethods.ISteamInventory_GetResultItems(CSteamGameServerAPIContext.GetSteamInventory(), resultHandle, pOutItemsArray, ref punOutItemsArraySize); } public static bool GetResultItemProperty(SteamInventoryResult_t resultHandle, uint unItemIndex, string pchPropertyName, out string pchValueBuffer, ref uint punValueBufferSizeOut) { InteropHelp.TestIfAvailableGameServer(); IntPtr intPtr = Marshal.AllocHGlobal((int)punValueBufferSizeOut); using InteropHelp.UTF8StringHandle pchPropertyName2 = new InteropHelp.UTF8StringHandle(pchPropertyName); bool flag = NativeMethods.ISteamInventory_GetResultItemProperty(CSteamGameServerAPIContext.GetSteamInventory(), resultHandle, unItemIndex, pchPropertyName2, intPtr, ref punValueBufferSizeOut); pchValueBuffer = (flag ? InteropHelp.PtrToStringUTF8(intPtr) : null); Marshal.FreeHGlobal(intPtr); return flag; } public static uint GetResultTimestamp(SteamInventoryResult_t resultHandle) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamInventory_GetResultTimestamp(CSteamGameServerAPIContext.GetSteamInventory(), resultHandle); } public static bool CheckResultSteamID(SteamInventoryResult_t resultHandle, CSteamID steamIDExpected) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamInventory_CheckResultSteamID(CSteamGameServerAPIContext.GetSteamInventory(), resultHandle, steamIDExpected); } public static void DestroyResult(SteamInventoryResult_t resultHandle) { InteropHelp.TestIfAvailableGameServer(); NativeMethods.ISteamInventory_DestroyResult(CSteamGameServerAPIContext.GetSteamInventory(), resultHandle); } public static bool GetAllItems(out SteamInventoryResult_t pResultHandle) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamInventory_GetAllItems(CSteamGameServerAPIContext.GetSteamInventory(), out pResultHandle); } public static bool GetItemsByID(out SteamInventoryResult_t pResultHandle, SteamItemInstanceID_t[] pInstanceIDs, uint unCountInstanceIDs) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamInventory_GetItemsByID(CSteamGameServerAPIContext.GetSteamInventory(), out pResultHandle, pInstanceIDs, unCountInstanceIDs); } public static bool SerializeResult(SteamInventoryResult_t resultHandle, byte[] pOutBuffer, out uint punOutBufferSize) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamInventory_SerializeResult(CSteamGameServerAPIContext.GetSteamInventory(), resultHandle, pOutBuffer, out punOutBufferSize); } public static bool DeserializeResult(out SteamInventoryResult_t pOutResultHandle, byte[] pBuffer, uint unBufferSize, bool bRESERVED_MUST_BE_FALSE = false) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamInventory_DeserializeResult(CSteamGameServerAPIContext.GetSteamInventory(), out pOutResultHandle, pBuffer, unBufferSize, bRESERVED_MUST_BE_FALSE); } public static bool GenerateItems(out SteamInventoryResult_t pResultHandle, SteamItemDef_t[] pArrayItemDefs, uint[] punArrayQuantity, uint unArrayLength) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamInventory_GenerateItems(CSteamGameServerAPIContext.GetSteamInventory(), out pResultHandle, pArrayItemDefs, punArrayQuantity, unArrayLength); } public static bool GrantPromoItems(out SteamInventoryResult_t pResultHandle) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamInventory_GrantPromoItems(CSteamGameServerAPIContext.GetSteamInventory(), out pResultHandle); } public static bool AddPromoItem(out SteamInventoryResult_t pResultHandle, SteamItemDef_t itemDef) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamInventory_AddPromoItem(CSteamGameServerAPIContext.GetSteamInventory(), out pResultHandle, itemDef); } public static bool AddPromoItems(out SteamInventoryResult_t pResultHandle, SteamItemDef_t[] pArrayItemDefs, uint unArrayLength) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamInventory_AddPromoItems(CSteamGameServerAPIContext.GetSteamInventory(), out pResultHandle, pArrayItemDefs, unArrayLength); } public static bool ConsumeItem(out SteamInventoryResult_t pResultHandle, SteamItemInstanceID_t itemConsume, uint unQuantity) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamInventory_ConsumeItem(CSteamGameServerAPIContext.GetSteamInventory(), out pResultHandle, itemConsume, unQuantity); } public static bool ExchangeItems(out SteamInventoryResult_t pResultHandle, SteamItemDef_t[] pArrayGenerate, uint[] punArrayGenerateQuantity, uint unArrayGenerateLength, SteamItemInstanceID_t[] pArrayDestroy, uint[] punArrayDestroyQuantity, uint unArrayDestroyLength) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamInventory_ExchangeItems(CSteamGameServerAPIContext.GetSteamInventory(), out pResultHandle, pArrayGenerate, punArrayGenerateQuantity, unArrayGenerateLength, pArrayDestroy, punArrayDestroyQuantity, unArrayDestroyLength); } public static bool TransferItemQuantity(out SteamInventoryResult_t pResultHandle, SteamItemInstanceID_t itemIdSource, uint unQuantity, SteamItemInstanceID_t itemIdDest) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamInventory_TransferItemQuantity(CSteamGameServerAPIContext.GetSteamInventory(), out pResultHandle, itemIdSource, unQuantity, itemIdDest); } public static void SendItemDropHeartbeat() { InteropHelp.TestIfAvailableGameServer(); NativeMethods.ISteamInventory_SendItemDropHeartbeat(CSteamGameServerAPIContext.GetSteamInventory()); } public static bool TriggerItemDrop(out SteamInventoryResult_t pResultHandle, SteamItemDef_t dropListDefinition) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamInventory_TriggerItemDrop(CSteamGameServerAPIContext.GetSteamInventory(), out pResultHandle, dropListDefinition); } public static bool TradeItems(out SteamInventoryResult_t pResultHandle, CSteamID steamIDTradePartner, SteamItemInstanceID_t[] pArrayGive, uint[] pArrayGiveQuantity, uint nArrayGiveLength, SteamItemInstanceID_t[] pArrayGet, uint[] pArrayGetQuantity, uint nArrayGetLength) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamInventory_TradeItems(CSteamGameServerAPIContext.GetSteamInventory(), out pResultHandle, steamIDTradePartner, pArrayGive, pArrayGiveQuantity, nArrayGiveLength, pArrayGet, pArrayGetQuantity, nArrayGetLength); } public static bool LoadItemDefinitions() { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamInventory_LoadItemDefinitions(CSteamGameServerAPIContext.GetSteamInventory()); } public static bool GetItemDefinitionIDs(SteamItemDef_t[] pItemDefIDs, ref uint punItemDefIDsArraySize) { InteropHelp.TestIfAvailableGameServer(); if (pItemDefIDs != null && pItemDefIDs.Length != punItemDefIDsArraySize) { throw new ArgumentException("pItemDefIDs must be the same size as punItemDefIDsArraySize!"); } return NativeMethods.ISteamInventory_GetItemDefinitionIDs(CSteamGameServerAPIContext.GetSteamInventory(), pItemDefIDs, ref punItemDefIDsArraySize); } public static bool GetItemDefinitionProperty(SteamItemDef_t iDefinition, string pchPropertyName, out string pchValueBuffer, ref uint punValueBufferSizeOut) { InteropHelp.TestIfAvailableGameServer(); IntPtr intPtr = Marshal.AllocHGlobal((int)punValueBufferSizeOut); using InteropHelp.UTF8StringHandle pchPropertyName2 = new InteropHelp.UTF8StringHandle(pchPropertyName); bool flag = NativeMethods.ISteamInventory_GetItemDefinitionProperty(CSteamGameServerAPIContext.GetSteamInventory(), iDefinition, pchPropertyName2, intPtr, ref punValueBufferSizeOut); pchValueBuffer = (flag ? InteropHelp.PtrToStringUTF8(intPtr) : null); Marshal.FreeHGlobal(intPtr); return flag; } public static SteamAPICall_t RequestEligiblePromoItemDefinitionsIDs(CSteamID steamID) { InteropHelp.TestIfAvailableGameServer(); return (SteamAPICall_t)NativeMethods.ISteamInventory_RequestEligiblePromoItemDefinitionsIDs(CSteamGameServerAPIContext.GetSteamInventory(), steamID); } public static bool GetEligiblePromoItemDefinitionIDs(CSteamID steamID, SteamItemDef_t[] pItemDefIDs, ref uint punItemDefIDsArraySize) { InteropHelp.TestIfAvailableGameServer(); if (pItemDefIDs != null && pItemDefIDs.Length != punItemDefIDsArraySize) { throw new ArgumentException("pItemDefIDs must be the same size as punItemDefIDsArraySize!"); } return NativeMethods.ISteamInventory_GetEligiblePromoItemDefinitionIDs(CSteamGameServerAPIContext.GetSteamInventory(), steamID, pItemDefIDs, ref punItemDefIDsArraySize); } public static SteamAPICall_t StartPurchase(SteamItemDef_t[] pArrayItemDefs, uint[] punArrayQuantity, uint unArrayLength) { InteropHelp.TestIfAvailableGameServer(); return (SteamAPICall_t)NativeMethods.ISteamInventory_StartPurchase(CSteamGameServerAPIContext.GetSteamInventory(), pArrayItemDefs, punArrayQuantity, unArrayLength); } public static SteamAPICall_t RequestPrices() { InteropHelp.TestIfAvailableGameServer(); return (SteamAPICall_t)NativeMethods.ISteamInventory_RequestPrices(CSteamGameServerAPIContext.GetSteamInventory()); } public static uint GetNumItemsWithPrices() { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamInventory_GetNumItemsWithPrices(CSteamGameServerAPIContext.GetSteamInventory()); } public static bool GetItemsWithPrices(SteamItemDef_t[] pArrayItemDefs, ulong[] pCurrentPrices, ulong[] pBasePrices, uint unArrayLength) { InteropHelp.TestIfAvailableGameServer(); if (pArrayItemDefs != null && pArrayItemDefs.Length != unArrayLength) { throw new ArgumentException("pArrayItemDefs must be the same size as unArrayLength!"); } if (pCurrentPrices != null && pCurrentPrices.Length != unArrayLength) { throw new ArgumentException("pCurrentPrices must be the same size as unArrayLength!"); } if (pBasePrices != null && pBasePrices.Length != unArrayLength) { throw new ArgumentException("pBasePrices must be the same size as unArrayLength!"); } return NativeMethods.ISteamInventory_GetItemsWithPrices(CSteamGameServerAPIContext.GetSteamInventory(), pArrayItemDefs, pCurrentPrices, pBasePrices, unArrayLength); } public static bool GetItemPrice(SteamItemDef_t iDefinition, out ulong pCurrentPrice, out ulong pBasePrice) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamInventory_GetItemPrice(CSteamGameServerAPIContext.GetSteamInventory(), iDefinition, out pCurrentPrice, out pBasePrice); } public static SteamInventoryUpdateHandle_t StartUpdateProperties() { InteropHelp.TestIfAvailableGameServer(); return (SteamInventoryUpdateHandle_t)NativeMethods.ISteamInventory_StartUpdateProperties(CSteamGameServerAPIContext.GetSteamInventory()); } public static bool RemoveProperty(SteamInventoryUpdateHandle_t handle, SteamItemInstanceID_t nItemID, string pchPropertyName) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pchPropertyName2 = new InteropHelp.UTF8StringHandle(pchPropertyName); return NativeMethods.ISteamInventory_RemoveProperty(CSteamGameServerAPIContext.GetSteamInventory(), handle, nItemID, pchPropertyName2); } public static bool SetProperty(SteamInventoryUpdateHandle_t handle, SteamItemInstanceID_t nItemID, string pchPropertyName, string pchPropertyValue) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pchPropertyName2 = new InteropHelp.UTF8StringHandle(pchPropertyName); using InteropHelp.UTF8StringHandle pchPropertyValue2 = new InteropHelp.UTF8StringHandle(pchPropertyValue); return NativeMethods.ISteamInventory_SetPropertyString(CSteamGameServerAPIContext.GetSteamInventory(), handle, nItemID, pchPropertyName2, pchPropertyValue2); } public static bool SetProperty(SteamInventoryUpdateHandle_t handle, SteamItemInstanceID_t nItemID, string pchPropertyName, bool bValue) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pchPropertyName2 = new InteropHelp.UTF8StringHandle(pchPropertyName); return NativeMethods.ISteamInventory_SetPropertyBool(CSteamGameServerAPIContext.GetSteamInventory(), handle, nItemID, pchPropertyName2, bValue); } public static bool SetProperty(SteamInventoryUpdateHandle_t handle, SteamItemInstanceID_t nItemID, string pchPropertyName, long nValue) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pchPropertyName2 = new InteropHelp.UTF8StringHandle(pchPropertyName); return NativeMethods.ISteamInventory_SetPropertyInt64(CSteamGameServerAPIContext.GetSteamInventory(), handle, nItemID, pchPropertyName2, nValue); } public static bool SetProperty(SteamInventoryUpdateHandle_t handle, SteamItemInstanceID_t nItemID, string pchPropertyName, float flValue) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pchPropertyName2 = new InteropHelp.UTF8StringHandle(pchPropertyName); return NativeMethods.ISteamInventory_SetPropertyFloat(CSteamGameServerAPIContext.GetSteamInventory(), handle, nItemID, pchPropertyName2, flValue); } public static bool SubmitUpdateProperties(SteamInventoryUpdateHandle_t handle, out SteamInventoryResult_t pResultHandle) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamInventory_SubmitUpdateProperties(CSteamGameServerAPIContext.GetSteamInventory(), handle, out pResultHandle); } public static bool InspectItem(out SteamInventoryResult_t pResultHandle, string pchItemToken) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pchItemToken2 = new InteropHelp.UTF8StringHandle(pchItemToken); return NativeMethods.ISteamInventory_InspectItem(CSteamGameServerAPIContext.GetSteamInventory(), out pResultHandle, pchItemToken2); } } public static class SteamGameServerNetworking { public static bool SendP2PPacket(CSteamID steamIDRemote, byte[] pubData, uint cubData, EP2PSend eP2PSendType, int nChannel = 0) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamNetworking_SendP2PPacket(CSteamGameServerAPIContext.GetSteamNetworking(), steamIDRemote, pubData, cubData, eP2PSendType, nChannel); } public static bool IsP2PPacketAvailable(out uint pcubMsgSize, int nChannel = 0) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamNetworking_IsP2PPacketAvailable(CSteamGameServerAPIContext.GetSteamNetworking(), out pcubMsgSize, nChannel); } public static bool ReadP2PPacket(byte[] pubDest, uint cubDest, out uint pcubMsgSize, out CSteamID psteamIDRemote, int nChannel = 0) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamNetworking_ReadP2PPacket(CSteamGameServerAPIContext.GetSteamNetworking(), pubDest, cubDest, out pcubMsgSize, out psteamIDRemote, nChannel); } public static bool AcceptP2PSessionWithUser(CSteamID steamIDRemote) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamNetworking_AcceptP2PSessionWithUser(CSteamGameServerAPIContext.GetSteamNetworking(), steamIDRemote); } public static bool CloseP2PSessionWithUser(CSteamID steamIDRemote) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamNetworking_CloseP2PSessionWithUser(CSteamGameServerAPIContext.GetSteamNetworking(), steamIDRemote); } public static bool CloseP2PChannelWithUser(CSteamID steamIDRemote, int nChannel) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamNetworking_CloseP2PChannelWithUser(CSteamGameServerAPIContext.GetSteamNetworking(), steamIDRemote, nChannel); } public static bool GetP2PSessionState(CSteamID steamIDRemote, out P2PSessionState_t pConnectionState) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamNetworking_GetP2PSessionState(CSteamGameServerAPIContext.GetSteamNetworking(), steamIDRemote, out pConnectionState); } public static bool AllowP2PPacketRelay(bool bAllow) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamNetworking_AllowP2PPacketRelay(CSteamGameServerAPIContext.GetSteamNetworking(), bAllow); } public static SNetListenSocket_t CreateListenSocket(int nVirtualP2PPort, SteamIPAddress_t nIP, ushort nPort, bool bAllowUseOfPacketRelay) { InteropHelp.TestIfAvailableGameServer(); return (SNetListenSocket_t)NativeMethods.ISteamNetworking_CreateListenSocket(CSteamGameServerAPIContext.GetSteamNetworking(), nVirtualP2PPort, nIP, nPort, bAllowUseOfPacketRelay); } public static SNetSocket_t CreateP2PConnectionSocket(CSteamID steamIDTarget, int nVirtualPort, int nTimeoutSec, bool bAllowUseOfPacketRelay) { InteropHelp.TestIfAvailableGameServer(); return (SNetSocket_t)NativeMethods.ISteamNetworking_CreateP2PConnectionSocket(CSteamGameServerAPIContext.GetSteamNetworking(), steamIDTarget, nVirtualPort, nTimeoutSec, bAllowUseOfPacketRelay); } public static SNetSocket_t CreateConnectionSocket(SteamIPAddress_t nIP, ushort nPort, int nTimeoutSec) { InteropHelp.TestIfAvailableGameServer(); return (SNetSocket_t)NativeMethods.ISteamNetworking_CreateConnectionSocket(CSteamGameServerAPIContext.GetSteamNetworking(), nIP, nPort, nTimeoutSec); } public static bool DestroySocket(SNetSocket_t hSocket, bool bNotifyRemoteEnd) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamNetworking_DestroySocket(CSteamGameServerAPIContext.GetSteamNetworking(), hSocket, bNotifyRemoteEnd); } public static bool DestroyListenSocket(SNetListenSocket_t hSocket, bool bNotifyRemoteEnd) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamNetworking_DestroyListenSocket(CSteamGameServerAPIContext.GetSteamNetworking(), hSocket, bNotifyRemoteEnd); } public static bool SendDataOnSocket(SNetSocket_t hSocket, byte[] pubData, uint cubData, bool bReliable) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamNetworking_SendDataOnSocket(CSteamGameServerAPIContext.GetSteamNetworking(), hSocket, pubData, cubData, bReliable); } public static bool IsDataAvailableOnSocket(SNetSocket_t hSocket, out uint pcubMsgSize) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamNetworking_IsDataAvailableOnSocket(CSteamGameServerAPIContext.GetSteamNetworking(), hSocket, out pcubMsgSize); } public static bool RetrieveDataFromSocket(SNetSocket_t hSocket, byte[] pubDest, uint cubDest, out uint pcubMsgSize) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamNetworking_RetrieveDataFromSocket(CSteamGameServerAPIContext.GetSteamNetworking(), hSocket, pubDest, cubDest, out pcubMsgSize); } public static bool IsDataAvailable(SNetListenSocket_t hListenSocket, out uint pcubMsgSize, out SNetSocket_t phSocket) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamNetworking_IsDataAvailable(CSteamGameServerAPIContext.GetSteamNetworking(), hListenSocket, out pcubMsgSize, out phSocket); } public static bool RetrieveData(SNetListenSocket_t hListenSocket, byte[] pubDest, uint cubDest, out uint pcubMsgSize, out SNetSocket_t phSocket) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamNetworking_RetrieveData(CSteamGameServerAPIContext.GetSteamNetworking(), hListenSocket, pubDest, cubDest, out pcubMsgSize, out phSocket); } public static bool GetSocketInfo(SNetSocket_t hSocket, out CSteamID pSteamIDRemote, out int peSocketStatus, out SteamIPAddress_t punIPRemote, out ushort punPortRemote) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamNetworking_GetSocketInfo(CSteamGameServerAPIContext.GetSteamNetworking(), hSocket, out pSteamIDRemote, out peSocketStatus, out punIPRemote, out punPortRemote); } public static bool GetListenSocketInfo(SNetListenSocket_t hListenSocket, out SteamIPAddress_t pnIP, out ushort pnPort) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamNetworking_GetListenSocketInfo(CSteamGameServerAPIContext.GetSteamNetworking(), hListenSocket, out pnIP, out pnPort); } public static ESNetSocketConnectionType GetSocketConnectionType(SNetSocket_t hSocket) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamNetworking_GetSocketConnectionType(CSteamGameServerAPIContext.GetSteamNetworking(), hSocket); } public static int GetMaxPacketSize(SNetSocket_t hSocket) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamNetworking_GetMaxPacketSize(CSteamGameServerAPIContext.GetSteamNetworking(), hSocket); } } public static class SteamGameServerNetworkingSockets { public static HSteamListenSocket CreateListenSocketIP(ref SteamNetworkingIPAddr localAddress, int nOptions, SteamNetworkingConfigValue_t[] pOptions) { InteropHelp.TestIfAvailableGameServer(); return (HSteamListenSocket)NativeMethods.ISteamNetworkingSockets_CreateListenSocketIP(CSteamGameServerAPIContext.GetSteamNetworkingSockets(), ref localAddress, nOptions, pOptions); } public static HSteamNetConnection ConnectByIPAddress(ref SteamNetworkingIPAddr address, int nOptions, SteamNetworkingConfigValue_t[] pOptions) { InteropHelp.TestIfAvailableGameServer(); return (HSteamNetConnection)NativeMethods.ISteamNetworkingSockets_ConnectByIPAddress(CSteamGameServerAPIContext.GetSteamNetworkingSockets(), ref address, nOptions, pOptions); } public static HSteamListenSocket CreateListenSocketP2P(int nLocalVirtualPort, int nOptions, SteamNetworkingConfigValue_t[] pOptions) { InteropHelp.TestIfAvailableGameServer(); return (HSteamListenSocket)NativeMethods.ISteamNetworkingSockets_CreateListenSocketP2P(CSteamGameServerAPIContext.GetSteamNetworkingSockets(), nLocalVirtualPort, nOptions, pOptions); } public static HSteamNetConnection ConnectP2P(ref SteamNetworkingIdentity identityRemote, int nRemoteVirtualPort, int nOptions, SteamNetworkingConfigValue_t[] pOptions) { InteropHelp.TestIfAvailableGameServer(); return (HSteamNetConnection)NativeMethods.ISteamNetworkingSockets_ConnectP2P(CSteamGameServerAPIContext.GetSteamNetworkingSockets(), ref identityRemote, nRemoteVirtualPort, nOptions, pOptions); } public static EResult AcceptConnection(HSteamNetConnection hConn) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamNetworkingSockets_AcceptConnection(CSteamGameServerAPIContext.GetSteamNetworkingSockets(), hConn); } public static bool CloseConnection(HSteamNetConnection hPeer, int nReason, string pszDebug, bool bEnableLinger) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pszDebug2 = new InteropHelp.UTF8StringHandle(pszDebug); return NativeMethods.ISteamNetworkingSockets_CloseConnection(CSteamGameServerAPIContext.GetSteamNetworkingSockets(), hPeer, nReason, pszDebug2, bEnableLinger); } public static bool CloseListenSocket(HSteamListenSocket hSocket) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamNetworkingSockets_CloseListenSocket(CSteamGameServerAPIContext.GetSteamNetworkingSockets(), hSocket); } public static bool SetConnectionUserData(HSteamNetConnection hPeer, long nUserData) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamNetworkingSockets_SetConnectionUserData(CSteamGameServerAPIContext.GetSteamNetworkingSockets(), hPeer, nUserData); } public static long GetConnectionUserData(HSteamNetConnection hPeer) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamNetworkingSockets_GetConnectionUserData(CSteamGameServerAPIContext.GetSteamNetworkingSockets(), hPeer); } public static void SetConnectionName(HSteamNetConnection hPeer, string pszName) { InteropHelp.TestIfAvailableGameServer(); using InteropHelp.UTF8StringHandle pszName2 = new InteropHelp.UTF8StringHandle(pszName); NativeMethods.ISteamNetworkingSockets_SetConnectionName(CSteamGameServerAPIContext.GetSteamNetworkingSockets(), hPeer, pszName2); } public static bool GetConnectionName(HSteamNetConnection hPeer, out string pszName, int nMaxLen) { InteropHelp.TestIfAvailableGameServer(); IntPtr intPtr = Marshal.AllocHGlobal(nMaxLen); bool flag = NativeMethods.ISteamNetworkingSockets_GetConnectionName(CSteamGameServerAPIContext.GetSteamNetworkingSockets(), hPeer, intPtr, nMaxLen); pszName = (flag ? InteropHelp.PtrToStringUTF8(intPtr) : null); Marshal.FreeHGlobal(intPtr); return flag; } public static EResult SendMessageToConnection(HSteamNetConnection hConn, IntPtr pData, uint cbData, int nSendFlags, out long pOutMessageNumber) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamNetworkingSockets_SendMessageToConnection(CSteamGameServerAPIContext.GetSteamNetworkingSockets(), hConn, pData, cbData, nSendFlags, out pOutMessageNumber); } public static void SendMessages(int nMessages, SteamNetworkingMessage_t[] pMessages, long[] pOutMessageNumberOrResult) { InteropHelp.TestIfAvailableGameServer(); NativeMethods.ISteamNetworkingSockets_SendMessages(CSteamGameServerAPIContext.GetSteamNetworkingSockets(), nMessages, pMessages, pOutMessageNumberOrResult); } public static EResult FlushMessagesOnConnection(HSteamNetConnection hConn) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamNetworkingSockets_FlushMessagesOnConnection(CSteamGameServerAPIContext.GetSteamNetworkingSockets(), hConn); } public static int ReceiveMessagesOnConnection(HSteamNetConnection hConn, IntPtr[] ppOutMessages, int nMaxMessages) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamNetworkingSockets_ReceiveMessagesOnConnection(CSteamGameServerAPIContext.GetSteamNetworkingSockets(), hConn, ppOutMessages, nMaxMessages); } public static bool GetConnectionInfo(HSteamNetConnection hConn, out SteamNetConnectionInfo_t pInfo) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamNetworkingSockets_GetConnectionInfo(CSteamGameServerAPIContext.GetSteamNetworkingSockets(), hConn, out pInfo); } public static bool GetQuickConnectionStatus(HSteamNetConnection hConn, out SteamNetworkingQuickConnectionStatus pStats) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamNetworkingSockets_GetQuickConnectionStatus(CSteamGameServerAPIContext.GetSteamNetworkingSockets(), hConn, out pStats); } public static int GetDetailedConnectionStatus(HSteamNetConnection hConn, out string pszBuf, int cbBuf) { InteropHelp.TestIfAvailableGameServer(); IntPtr intPtr = Marshal.AllocHGlobal(cbBuf); int num = NativeMethods.ISteamNetworkingSockets_GetDetailedConnectionStatus(CSteamGameServerAPIContext.GetSteamNetworkingSockets(), hConn, intPtr, cbBuf); pszBuf = ((num != -1) ? InteropHelp.PtrToStringUTF8(intPtr) : null); Marshal.FreeHGlobal(intPtr); return num; } public static bool GetListenSocketAddress(HSteamListenSocket hSocket, out SteamNetworkingIPAddr address) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamNetworkingSockets_GetListenSocketAddress(CSteamGameServerAPIContext.GetSteamNetworkingSockets(), hSocket, out address); } public static bool CreateSocketPair(out HSteamNetConnection pOutConnection1, out HSteamNetConnection pOutConnection2, bool bUseNetworkLoopback, ref SteamNetworkingIdentity pIdentity1, ref SteamNetworkingIdentity pIdentity2) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamNetworkingSockets_CreateSocketPair(CSteamGameServerAPIContext.GetSteamNetworkingSockets(), out pOutConnection1, out pOutConnection2, bUseNetworkLoopback, ref pIdentity1, ref pIdentity2); } public static bool Ge