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.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Xml;
using System.Xml.Serialization;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using OutwardBasicChatCommands.Events;
using OutwardBasicChatCommands.Events.Publishers;
using OutwardBasicChatCommands.Managers;
using OutwardBasicChatCommands.Utility.Data;
using OutwardBasicChatCommands.Utility.Enemies.Visuals;
using OutwardBasicChatCommands.Utility.Enums;
using OutwardBasicChatCommands.Utility.Helpers;
using OutwardModsCommunicator;
using OutwardModsCommunicator.EventBus;
using OutwardModsCommunicator.Managers;
using SideLoader;
using UnityEngine;
using UnityEngine.AI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("OutwardBasicChatCommands")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OutwardBasicChatCommands")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c5450fe0-edcf-483f-b9ea-4b1ef9d36da7")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace OutwardBasicChatCommands
{
[BepInPlugin("gymmed.basic_chat_commands", "Basic Chat Commands", "0.1.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class OBCC : BaseUnityPlugin
{
public const string GUID = "gymmed.basic_chat_commands";
public const string NAME = "Basic Chat Commands";
public const string VERSION = "0.1.0";
public static string prefix = "[Basic-Chat-Command]";
public const string EVENTS_LISTENER_GUID = "gymmed.basic_chat_commands_*";
internal static ManualLogSource Log;
public static ConfigEntry<int> MaxDistanceToStartFollow;
internal void Awake()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
Log = ((BaseUnityPlugin)this).Logger;
LogMessage("Hello world from Basic Chat Commands 0.1.0!");
new Harmony("gymmed.basic_chat_commands").PatchAll();
EventBusPublisher.SendCommands();
}
internal void Update()
{
}
public static void LogMessage(string message)
{
Log.LogMessage((object)(prefix + " " + message));
}
public static void LogStatusMessage(string message, ChatLogStatus status = ChatLogStatus.Info)
{
LogMessage($"[{status}] {message}");
}
public static void LogSL(string message)
{
SL.Log(prefix + " " + message);
}
public static string GetProjectLocation()
{
return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
}
}
}
namespace OutwardBasicChatCommands.Utility.Helpers
{
public static class CharacterHelpers
{
public static Character TryToFindOtherCharacterInLobby(Character mainCharacter, string otherCharName)
{
//IL_002b: 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)
Character val = null;
foreach (PlayerSystem item in Global.Lobby.PlayersInLobby)
{
val = item.ControlledCharacter;
if ((Object)(object)val != (Object)null && val.UID != mainCharacter.UID && string.Equals(otherCharName, val.Name))
{
return val;
}
}
return null;
}
public static Character TryToFindOtherCharacterInLobby(Character mainCharacter)
{
//IL_002b: 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)
Character val = null;
foreach (PlayerSystem item in Global.Lobby.PlayersInLobby)
{
val = item.ControlledCharacter;
if ((Object)(object)val != (Object)null && val.UID != mainCharacter.UID)
{
return val;
}
}
return val;
}
public static bool IsCharacterInDistance(Character firstCharacter, Character secondCharacter, float minimumDistance)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//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)
Vector3 val = ((Component)firstCharacter).transform.position - ((Component)secondCharacter).transform.position;
float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude;
float num = minimumDistance * minimumDistance;
if (sqrMagnitude > num)
{
return false;
}
return true;
}
public static bool HasManualMovement(Character character)
{
CharacterControl characterControl = character.CharacterControl;
LocalCharacterControl val = (LocalCharacterControl)(object)((characterControl is LocalCharacterControl) ? characterControl : null);
if (val == null)
{
return false;
}
if (((Vector2)(ref ((CharacterControl)val).m_moveInput)).sqrMagnitude > 0.01f)
{
return true;
}
return false;
}
}
public static class ChatHelpers
{
public static void SendChatLog(ChatPanel panel, string message, ChatLogStatus status = ChatLogStatus.Info)
{
panel.ChatMessageReceived("System", ChatLogStatusHelper.GetChatLogText(message, status));
}
public static void SendChatLog(Character character, string message, ChatLogStatus status = ChatLogStatus.Info)
{
CharacterUI characterUI = character.CharacterUI;
if ((Object)(object)((characterUI != null) ? characterUI.ChatPanel : null) == (Object)null)
{
OBCC.LogMessage("ChatHelpers@SendChatLog provided character with missing chatPanel!");
}
else
{
SendChatLog(character.CharacterUI.ChatPanel, message, status);
}
}
public static void SendChatOrLog(Character character, string message, ChatLogStatus status = ChatLogStatus.Info)
{
CharacterUI characterUI = character.CharacterUI;
if ((Object)(object)((characterUI != null) ? characterUI.ChatPanel : null) == (Object)null)
{
OBCC.LogStatusMessage(message, status);
}
else
{
SendChatLog(character.CharacterUI.ChatPanel, message, status);
}
}
}
public static class ConfigExporter
{
public static ConfigOverrides ExportAllConfigs()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Expected O, but got Unknown
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Expected O, but got Unknown
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Expected O, but got Unknown
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: 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_0149: Expected O, but got Unknown
ConfigOverrides val = new ConfigOverrides();
foreach (PluginInfo value in Chainloader.PluginInfos.Values)
{
BaseUnityPlugin instance = value.Instance;
ConfigFile val2 = ((instance != null) ? instance.Config : null);
if (val2 == null || val2.Count == 0)
{
continue;
}
ModOverride val3 = new ModOverride
{
ModGUID = value.Metadata.GUID
};
foreach (string section in val2.Keys.Select((ConfigDefinition k) => k.Section).Distinct())
{
SectionOverride val4 = new SectionOverride
{
Name = section
};
foreach (KeyValuePair<ConfigDefinition, ConfigEntryBase> item in ((IEnumerable<KeyValuePair<ConfigDefinition, ConfigEntryBase>>)val2).Where((KeyValuePair<ConfigDefinition, ConfigEntryBase> k) => k.Key.Section == section))
{
val4.Entries.Add(new EntryOverride
{
Key = item.Key.Key,
Value = (item.Value.BoxedValue?.ToString() ?? "")
});
}
val3.Sections.Add(val4);
}
if (val3.Sections.Count > 0)
{
val.Mods.Add(val3);
}
}
return val;
}
}
public static class EnchantmentRecipesHelpers
{
public static HashSet<EnchantmentRecipeItem> GetAllEnchantmentRecipeItems()
{
HashSet<EnchantmentRecipeItem> hashSet = new HashSet<EnchantmentRecipeItem>();
foreach (KeyValuePair<string, Item> iTEM_PREFAB in ResourcesPrefabManager.ITEM_PREFABS)
{
Item value = iTEM_PREFAB.Value;
EnchantmentRecipeItem val = (EnchantmentRecipeItem)(object)((value is EnchantmentRecipeItem) ? value : null);
if (val != null)
{
hashSet.Add(val);
}
}
return hashSet;
}
public static void PrintBrokenEnchantmentRecipeItems(ChatPanel panel, IEnumerable<EnchantmentRecipeItem> enchantmentItems)
{
if ((Object)(object)panel == (Object)null)
{
OBCC.LogMessage("EnchantmentCommandsPublisher@PrintBrokenEnchantmentRecipeItems Tried to use missing chatPanel.");
return;
}
ChatHelpers.SendChatLog(panel, "EnchantmentRecipeItems");
ChatHelpers.SendChatLog(panel, "Name RecipesCount ID!", ChatLogStatus.Success);
foreach (EnchantmentRecipeItem enchantmentItem in enchantmentItems)
{
if (enchantmentItem.Recipes.Count() < 1)
{
ChatHelpers.SendChatLog(panel, $"{((Item)enchantmentItem).GetLocalizedName()} {enchantmentItem.Recipes.Count()} {((Item)enchantmentItem).ItemID}!", ChatLogStatus.Warning);
}
}
}
public static void PrintBrokenEnchantmentRecipeItemsCount(ChatPanel panel, IEnumerable<EnchantmentRecipeItem> enchantmentItems)
{
if ((Object)(object)panel == (Object)null)
{
OBCC.LogMessage("EnchantmentCommandsPublisher@PrintBrokenEnchantmentRecipeItemsCount Tried to use missing chatPanel.");
return;
}
int num = 0;
foreach (EnchantmentRecipeItem enchantmentItem in enchantmentItems)
{
if (enchantmentItem.Recipes.Count() < 1)
{
num++;
}
}
ChatHelpers.SendChatLog(panel, $"Total {num} broken EnchantmentRecipeItems");
}
public static HashSet<EnchantmentRecipe> GetBrokenEnchantmentRecipes()
{
HashSet<EnchantmentRecipe> hashSet = new HashSet<EnchantmentRecipe>();
foreach (EnchantmentRecipe enchantmentRecipe in RecipeManager.Instance.GetEnchantmentRecipes())
{
if ((Object)(object)ResourcesPrefabManager.Instance.GetEnchantmentPrefab(enchantmentRecipe.ResultID) == (Object)null)
{
hashSet.Add(enchantmentRecipe);
}
}
return hashSet;
}
public static void PrintBrokenEnchantmentRecipes(ChatPanel panel, IEnumerable<EnchantmentRecipe> enchantmentRecipes)
{
if ((Object)(object)panel == (Object)null)
{
OBCC.LogMessage("EnchantmentCommandsPublisher@PrintBrokenEnchantmentRecipes Tried to use missing chatPanel.");
return;
}
ChatHelpers.SendChatLog(panel, "EnchantmentRecipes");
ChatHelpers.SendChatLog(panel, "Name ID!", ChatLogStatus.Success);
foreach (EnchantmentRecipe enchantmentRecipe in enchantmentRecipes)
{
ChatHelpers.SendChatLog(panel, $"{((Object)enchantmentRecipe).name} {enchantmentRecipe.ResultID}!", ChatLogStatus.Warning);
}
}
public static void PrintEnchantmentRecipeItems(ChatPanel panel, IEnumerable<EnchantmentRecipeItem> enchantmentItems)
{
if ((Object)(object)panel == (Object)null)
{
OBCC.LogMessage("EnchantmentCommandsPublisher@PrintEnchantmentRecipeItems Tried to use missing chatPanel.");
return;
}
ChatHelpers.SendChatLog(panel, "Name RecipesCount ID!");
foreach (EnchantmentRecipeItem enchantmentItem in enchantmentItems)
{
ChatHelpers.SendChatLog(panel, $"{((Item)enchantmentItem).GetLocalizedName()} {enchantmentItem.Recipes.Count()} {((Item)enchantmentItem).ItemID}!");
}
}
public static void PrintEnchantmentRecipes(ChatPanel panel, IEnumerable<EnchantmentRecipe> enchantmentRecipes)
{
if ((Object)(object)panel == (Object)null)
{
OBCC.LogMessage("EnchantmentCommandsPublisher@PrintEnchantmentRecipes Tried to use missing chatPanel.");
return;
}
ChatHelpers.SendChatLog(panel, "Name RecipeID | Enchantment EnchantmentID!");
foreach (EnchantmentRecipe enchantmentRecipe in enchantmentRecipes)
{
Enchantment enchantmentPrefab = ResourcesPrefabManager.Instance.GetEnchantmentPrefab(enchantmentRecipe.ResultID);
if ((Object)(object)enchantmentPrefab != (Object)null)
{
ChatHelpers.SendChatLog(panel, $"{((Object)enchantmentRecipe).name} {enchantmentRecipe.RecipeID} | {enchantmentPrefab.Name} {enchantmentRecipe.ResultID}!");
}
else
{
ChatHelpers.SendChatLog(panel, $"{((Object)enchantmentRecipe).name} {enchantmentRecipe.RecipeID} | null {enchantmentRecipe.ResultID}!");
}
}
}
public static void PrintEnchantments(ChatPanel panel, IEnumerable<Enchantment> enchantments)
{
if ((Object)(object)panel == (Object)null)
{
OBCC.LogMessage("EnchantmentCommandsPublisher@PrintEnchantments Tried to use missing chatPanel.");
return;
}
ChatHelpers.SendChatLog(panel, "Name ID | Description!");
foreach (Enchantment enchantment in enchantments)
{
if (!string.IsNullOrEmpty(enchantment.Description))
{
ChatHelpers.SendChatLog(panel, $"{enchantment.Name} {((EffectPreset)enchantment).PresetID} | {enchantment.Description}!");
}
else
{
ChatHelpers.SendChatLog(panel, $"{enchantment.Name} {((EffectPreset)enchantment).PresetID}!");
}
}
}
}
public static class SkillsHelpers
{
public static void LogSkillsData(ChatPanel panel, SkillTypes category)
{
switch (category)
{
case SkillTypes.Active:
{
List<Skill> activeSkills = GetActiveSkills();
PrintSkillsAsData(panel, activeSkills);
ChatHelpers.SendChatLog(panel, $"Total {activeSkills.Count()} active skills!", ChatLogStatus.Success);
return;
}
case SkillTypes.Passive:
{
List<Skill> passiveSkills = GetPassiveSkills();
PrintSkillsAsData(panel, passiveSkills);
ChatHelpers.SendChatLog(panel, $"Total {passiveSkills.Count()} passive skills!", ChatLogStatus.Success);
return;
}
case SkillTypes.Cosmetic:
{
List<Skill> cosmeticSkills = GetCosmeticSkills();
PrintSkillsAsData(panel, cosmeticSkills);
ChatHelpers.SendChatLog(panel, $"Total {cosmeticSkills.Count()} cosmetic skills!", ChatLogStatus.Success);
return;
}
}
SkillsData skillsData = GetSkillsData();
int num = skillsData.ActiveSkills.Count();
int num2 = skillsData.PassiveSkills.Count();
int num3 = skillsData.CosmeticSkills.Count();
ChatHelpers.SendChatLog(panel, $"Total {num} active skills!", ChatLogStatus.Success);
ChatHelpers.SendChatLog(panel, $"Total {num2} passive skills!", ChatLogStatus.Success);
ChatHelpers.SendChatLog(panel, $"Total {num3} cosmetic skills!", ChatLogStatus.Success);
ChatHelpers.SendChatLog(panel, $"Total {num + num2 + num3} skills!", ChatLogStatus.Success);
}
public static void PrintSkillsAsData(ChatPanel panel, IEnumerable<Skill> skills)
{
foreach (Skill skill in skills)
{
ChatHelpers.SendChatLog(panel, $"{((Item)skill).Name} {((Item)skill).ItemID}!");
}
}
public static SkillsData GetSkillsData()
{
List<Skill> list = new List<Skill>();
List<Skill> list2 = new List<Skill>();
List<Skill> list3 = new List<Skill>();
foreach (KeyValuePair<string, Item> iTEM_PREFAB in ResourcesPrefabManager.ITEM_PREFABS)
{
Item value = iTEM_PREFAB.Value;
Skill val = (Skill)(object)((value is Skill) ? value : null);
if (val != null)
{
if (val.IsPassive)
{
list2.Add(val);
}
else if (val.IsCosmetic)
{
list3.Add(val);
}
else
{
list.Add(val);
}
}
}
return new SkillsData(list, list2, list3);
}
public static List<Skill> GetActiveSkills()
{
List<Skill> list = new List<Skill>();
foreach (KeyValuePair<string, Item> iTEM_PREFAB in ResourcesPrefabManager.ITEM_PREFABS)
{
Item value = iTEM_PREFAB.Value;
Skill val = (Skill)(object)((value is Skill) ? value : null);
if (val != null && !val.IsPassive && !val.IsCosmetic)
{
list.Add(val);
}
}
return list;
}
public static List<Skill> GetPassiveSkills()
{
List<Skill> list = new List<Skill>();
foreach (KeyValuePair<string, Item> iTEM_PREFAB in ResourcesPrefabManager.ITEM_PREFABS)
{
Item value = iTEM_PREFAB.Value;
Skill val = (Skill)(object)((value is Skill) ? value : null);
if (val != null && val.IsPassive)
{
list.Add(val);
}
}
return list;
}
public static List<Skill> GetCosmeticSkills()
{
List<Skill> list = new List<Skill>();
foreach (KeyValuePair<string, Item> iTEM_PREFAB in ResourcesPrefabManager.ITEM_PREFABS)
{
Item value = iTEM_PREFAB.Value;
Skill val = (Skill)(object)((value is Skill) ? value : null);
if (val != null && val.IsCosmetic)
{
list.Add(val);
}
}
return list;
}
}
public static class TimeHelpers
{
public static void SetTime(int hours, int minutes)
{
minutes = Mathf.Clamp(minutes, 0, 59);
hours = Mathf.Clamp(hours, 0, 23);
float num = (float)hours + (float)minutes / 60f;
float timeJump = num - TOD_Sky.Instance.Cycle.Hour;
TOD_Sky.Instance.Cycle.Hour = num;
EnvironmentConditions.Instance.m_timeJump = timeJump;
EnvironmentConditions.Instance.m_dayReset = true;
}
public static void SetMinutes(int minutes)
{
minutes = Mathf.Clamp(minutes, 0, 59);
float hour = TOD_Sky.Instance.Cycle.Hour;
float num = (float)Mathf.FloorToInt(hour) + (float)minutes / 60f;
float timeJump = num - hour;
TOD_Sky.Instance.Cycle.Hour = num;
EnvironmentConditions.Instance.m_timeJump = timeJump;
EnvironmentConditions.Instance.m_dayReset = true;
}
}
}
namespace OutwardBasicChatCommands.Utility.Enums
{
public enum ChatCommandsManagerParams
{
CommandName,
CommandParameters,
CommandAction,
IsCheatCommand,
CommandDescription,
CommandRequiresDebugMode
}
public static class ChatCommandsManagerParamsHelper
{
private static readonly Dictionary<ChatCommandsManagerParams, (string key, Type type)> _registry = new Dictionary<ChatCommandsManagerParams, (string, Type)>
{
[ChatCommandsManagerParams.CommandName] = ("command", typeof(string)),
[ChatCommandsManagerParams.CommandParameters] = ("parameters", typeof(Dictionary<string, (string, string)>)),
[ChatCommandsManagerParams.CommandAction] = ("function", typeof(Action<Character, Dictionary<string, string>>)),
[ChatCommandsManagerParams.IsCheatCommand] = ("isCheatCommand", typeof(bool)),
[ChatCommandsManagerParams.CommandDescription] = ("description", typeof(string)),
[ChatCommandsManagerParams.CommandRequiresDebugMode] = ("debugMode", typeof(bool))
};
public static (string key, Type type) Get(ChatCommandsManagerParams param)
{
return _registry[param];
}
}
public enum ChatLogStatus
{
Info,
Success,
Warning,
Error
}
public static class ChatLogStatusHelper
{
public static string GetChatLogText(string message, ChatLogStatus status = ChatLogStatus.Info)
{
//IL_0019: 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_0040: Unknown result type (might be due to invalid IL or missing references)
return status switch
{
ChatLogStatus.Success => Global.SetTextColor(message, Global.LIGHT_GREEN),
ChatLogStatus.Warning => Global.SetTextColor(message, Global.LIGHT_ORANGE),
ChatLogStatus.Error => "<color=#" + UnityEngineExtensions.ToHex(Global.LIGHT_RED) + ">" + message + "</color>",
_ => message,
};
}
}
public enum Races
{
Auraian,
Tramon,
Kazite
}
public static class RacesHelper
{
public static readonly Dictionary<Races, RaceData> races = new Dictionary<Races, RaceData>
{
{
Races.Auraian,
new RaceData(new GenderData(15, 11, 8), new GenderData(15, 11, 6))
},
{
Races.Tramon,
new RaceData(new GenderData(15, 11, 6), new GenderData(15, 11, 6))
},
{
Races.Kazite,
new RaceData(new GenderData(15, 11, 7), new GenderData(15, 11, 6))
}
};
}
public enum SkillTypes
{
All,
Active,
Passive,
Cosmetic
}
}
namespace OutwardBasicChatCommands.Utility.Enemies.Visuals
{
public struct GenderData
{
public int TotalHairStyles;
public int TotalHairColors;
public int TotalHeadVariations;
public GenderData(int totalHairStyles = 0, int totalHairColors = 0, int totalHeadVariations = 0)
{
TotalHairStyles = totalHairStyles;
TotalHairColors = totalHairColors;
TotalHeadVariations = totalHeadVariations;
}
}
public struct RaceData
{
public GenderData Male;
public GenderData Female;
public RaceData(GenderData male, GenderData female)
{
Male = male;
Female = female;
}
public GenderData GetGender(Gender gender)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
if ((int)gender == 0)
{
return Male;
}
return Female;
}
}
}
namespace OutwardBasicChatCommands.Utility.Data
{
public class FollowerData
{
private int _cornerIndex;
private float _lastPathTime;
private LocalCharacterControl _localControl;
private bool _isFollowing;
public static float InitialMaxDistance = 20f;
private const float StopFollowingDistance = 5f;
private const float PathRecalcInterval = 0.5f;
private const float CornerReachDistance = 0.6f;
private const float RotationSpeed = 7f;
public Character Follower { get; }
public Character CharacterToFollow { get; set; }
public NavMeshPath NavMeshPath { get; }
public bool IsFollowing
{
get
{
return _isFollowing;
}
set
{
_isFollowing = value;
}
}
public FollowerData(Character follower, Character characterToFollow)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Expected O, but got Unknown
Follower = follower;
CharacterToFollow = characterToFollow;
NavMeshPath = new NavMeshPath();
ref LocalCharacterControl localControl = ref _localControl;
CharacterControl characterControl = follower.CharacterControl;
localControl = (LocalCharacterControl)(object)((characterControl is LocalCharacterControl) ? characterControl : null);
}
public bool StartFollow()
{
if ((Object)(object)Follower == (Object)null || (Object)(object)CharacterToFollow == (Object)null)
{
OBCC.LogMessage("Follower is null or you are trying to follow null character.");
return false;
}
if (!CharacterHelpers.IsCharacterInDistance(Follower, CharacterToFollow, InitialMaxDistance))
{
ChatHelpers.SendChatLog(Follower, "Target is too far away to start following.", ChatLogStatus.Warning);
return false;
}
CharacterControl characterControl = Follower.CharacterControl;
LocalCharacterControl val = (LocalCharacterControl)(object)((characterControl is LocalCharacterControl) ? characterControl : null);
if (val == null)
{
ChatHelpers.SendChatLog(Follower, "Auto-follow only works on local characters.", ChatLogStatus.Warning);
return false;
}
_localControl = val;
IsFollowing = true;
_cornerIndex = 0;
RecalculatePath();
ChatHelpers.SendChatLog(Follower, "Now following " + CharacterToFollow.Name + ".");
return true;
}
public void Update()
{
if (IsFollowing && !((Object)(object)_localControl == (Object)null) && !((Object)(object)CharacterToFollow == (Object)null))
{
if ((Object)(object)Follower == (Object)null || Follower.IsDead || PlayerProvidedMovementInput())
{
StopFollow();
}
else if (((CharacterControl)_localControl).InputLocked)
{
StopFollow();
}
else
{
ApplyFollowMovement();
}
}
}
private void RecalculatePath()
{
//IL_000b: 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)
NavMesh.CalculatePath(((Component)Follower).transform.position, ((Component)CharacterToFollow).transform.position, -1, NavMeshPath);
_cornerIndex = 0;
}
private void ApplyFollowMovement()
{
//IL_003e: 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_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
if (NavMeshPath.corners == null || NavMeshPath.corners.Length == 0)
{
ChatHelpers.SendChatLog(Follower, "Couldn't find navigation path! Recalculating.", ChatLogStatus.Warning);
RecalculatePath();
return;
}
if (Vector3.Distance(((Component)Follower).transform.position, ((Component)CharacterToFollow).transform.position) <= 5f)
{
((CharacterControl)_localControl).m_moveInput = Vector2.zero;
_localControl.m_modifMoveInput = Vector2.op_Implicit(Vector2.zero);
if (((CharacterControl)_localControl).m_character.Sprinting)
{
((CharacterControl)_localControl).m_character.SprintInput(false);
}
return;
}
if (Time.time - _lastPathTime > 0.5f)
{
RecalculatePath();
_lastPathTime = Time.time;
}
RotateTowardsPath();
MoveTowardsPath();
}
private void RotateTowardsPath()
{
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: 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)
if (NavMeshPath.corners != null && NavMeshPath.corners.Length != 0)
{
while (_cornerIndex < NavMeshPath.corners.Length - 1 && Vector3.Distance(((Component)Follower).transform.position, NavMeshPath.corners[_cornerIndex]) < 0.6f)
{
_cornerIndex++;
}
Vector3 val = NavMeshPath.corners[_cornerIndex] - ((Component)Follower).transform.position;
val.y = 0f;
if (!(((Vector3)(ref val)).sqrMagnitude < 0.001f))
{
Quaternion val2 = Quaternion.LookRotation(((Vector3)(ref val)).normalized, Vector3.up);
((Component)Follower).transform.rotation = Quaternion.Slerp(((Component)Follower).transform.rotation, val2, 7f * Time.deltaTime);
}
}
}
private void MoveTowardsPath()
{
//IL_0034: 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_0053: 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)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: 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_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_0163: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
if (NavMeshPath.corners != null && _cornerIndex < NavMeshPath.corners.Length)
{
Vector3 val = NavMeshPath.corners[_cornerIndex] - ((Component)((CharacterControl)_localControl).m_character).transform.position;
Vector3 normalized = ((Vector3)(ref val)).normalized;
normalized.y = 0f;
Vector3 forward = ((Component)((CharacterControl)_localControl).m_character.CharacterCamera).transform.forward;
Vector3 right = ((Component)((CharacterControl)_localControl).m_character.CharacterCamera).transform.right;
forward.y = (right.y = 0f);
((Vector3)(ref forward)).Normalize();
((Vector3)(ref right)).Normalize();
float num = Vector3.Dot(normalized, forward);
float num2 = Vector3.Dot(normalized, right);
Vector2 val2 = default(Vector2);
((Vector2)(ref val2))..ctor(num2, num);
if (((Vector2)(ref val2)).magnitude > 1f)
{
((Vector2)(ref val2)).Normalize();
}
float num3 = ((CharacterControl)_localControl).m_character.Speed * 1.75f;
if (((CharacterControl)_localControl).m_character.IsSuperSpeedActive)
{
num3 *= 4f;
}
num3 *= _localControl.MovementMultiplier * ((CharacterControl)_localControl).m_character.Stats.MovementSpeed;
_localControl.m_modifMoveInput = Vector2.op_Implicit(val2 * num3);
((CharacterControl)_localControl).m_moveInput = val2;
if (!((CharacterControl)_localControl).m_character.Sprinting && ((CharacterControl)_localControl).m_character.Stats.CanSprint())
{
((CharacterControl)_localControl).m_character.SprintInput(true);
}
_localControl.m_autoRun = false;
}
}
private void StopFollow()
{
//IL_007b: 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_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
IsFollowing = false;
if ((Object)(object)_localControl != (Object)null)
{
((CharacterControl)_localControl).m_moveInput = Vector2.zero;
_localControl.m_modifMoveInput = Vector2.op_Implicit(Vector2.zero);
if ((Object)(object)((CharacterControl)_localControl).m_character != (Object)null && ((CharacterControl)_localControl).m_character.Sprinting)
{
((CharacterControl)_localControl).m_character.SprintInput(false);
}
}
FollowerDataManager.Instance.RemoveFollower(Follower.UID);
ChatHelpers.SendChatLog(Follower, "Auto-follow stopped (movement input detected).");
}
private bool PlayerProvidedMovementInput()
{
int playerID = Follower.OwnerPlayerSys.PlayerID;
float num = ControlsInput.MoveHorizontal(playerID);
float num2 = ControlsInput.MoveVertical(playerID);
if (!(Mathf.Abs(num) > 0.01f))
{
return Mathf.Abs(num2) > 0.01f;
}
return true;
}
}
public struct SkillsData
{
public IEnumerable<Skill> ActiveSkills;
public IEnumerable<Skill> PassiveSkills;
public IEnumerable<Skill> CosmeticSkills;
public SkillsData(IEnumerable<Skill> activeSkills, IEnumerable<Skill> passiveSkills, IEnumerable<Skill> cosmeticSkills)
{
ActiveSkills = activeSkills;
PassiveSkills = passiveSkills;
CosmeticSkills = cosmeticSkills;
}
}
}
namespace OutwardBasicChatCommands.Patches
{
[HarmonyPatch(typeof(LocalCharacterControl), "DetectMovementInputs")]
public static class Patch_LocalCharacterControl_DetectMovementInputs
{
private static void Postfix(LocalCharacterControl __instance)
{
if (FollowerDataManager.Instance.IsCharacterFollowing(((CharacterControl)__instance).Character, out var data))
{
data.Update();
}
}
}
}
namespace OutwardBasicChatCommands.Managers
{
public class DataSerializer
{
private static DataSerializer _instance;
public static DataSerializer Instance
{
get
{
if (_instance == null)
{
_instance = new DataSerializer();
}
return _instance;
}
}
private DataSerializer()
{
}
public static bool TryLoadFromXml<T>(string filePath, out T result)
{
result = default(T);
if (!File.Exists(filePath))
{
return false;
}
try
{
XmlSerializer xmlSerializer = new XmlSerializer(typeof(T));
XmlReaderSettings settings = new XmlReaderSettings
{
IgnoreComments = true
};
using XmlReader xmlReader = XmlReader.Create(filePath, settings);
result = (T)xmlSerializer.Deserialize(xmlReader);
return result != null;
}
catch (Exception ex)
{
OBCC.LogMessage("DataSerializer@TryLoadFromXml Error: \"" + ex.Message + "\"");
return false;
}
}
public static bool SaveToXml<T>(T data, string filePath)
{
try
{
string directoryName = Path.GetDirectoryName(filePath);
if (!string.IsNullOrEmpty(directoryName) && !Directory.Exists(directoryName))
{
Directory.CreateDirectory(directoryName);
}
XmlSerializer xmlSerializer = new XmlSerializer(typeof(T));
XmlWriterSettings settings = new XmlWriterSettings
{
Indent = true,
Encoding = Encoding.UTF8,
NewLineOnAttributes = false
};
using XmlWriter xmlWriter = XmlWriter.Create(filePath, settings);
xmlSerializer.Serialize(xmlWriter, data);
return true;
}
catch (Exception arg)
{
OBCC.LogMessage($"DataSerializer@SaveToXml Error: \"{arg}\"");
return false;
}
}
}
public class FollowerDataManager
{
private static FollowerDataManager _instance;
private Dictionary<UID, FollowerData> _followerData = new Dictionary<UID, FollowerData>();
public static FollowerDataManager Instance
{
get
{
if (_instance == null)
{
_instance = new FollowerDataManager();
}
return _instance;
}
}
public Dictionary<UID, FollowerData> FollowerData
{
get
{
return _followerData;
}
set
{
_followerData = value;
}
}
private FollowerDataManager()
{
}
public bool IsCharacterFollowing(Character follower, out FollowerData data)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
if (!FollowerData.TryGetValue(follower.UID, out data))
{
return false;
}
if (!data.IsFollowing)
{
return false;
}
return true;
}
public void TryToFollow(Character follower, Character charToFollow)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: 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_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
if (string.Equals(UID.op_Implicit(follower.UID), UID.op_Implicit(charToFollow.UID)))
{
ChatHelpers.SendChatLog(follower, "You cannot follow yourself! Try other target.", ChatLogStatus.Warning);
return;
}
FollowerData value = null;
if (!FollowerData.TryGetValue(follower.UID, out value))
{
value = new FollowerData(follower, charToFollow);
FollowerData.Add(follower.UID, value);
}
else if (value.CharacterToFollow.UID != charToFollow.UID)
{
value.CharacterToFollow = charToFollow;
}
value.StartFollow();
}
public void RemoveFollower(UID uid)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
FollowerData.Remove(uid);
}
}
public class PathsManager
{
private static PathsManager _instance;
public string configPath = "";
public string xmlFilePath = "";
public static PathsManager Instance
{
get
{
if (_instance == null)
{
_instance = new PathsManager();
}
return _instance;
}
}
private PathsManager()
{
configPath = Path.Combine(PathsManager.ConfigPath, "Basic_Chat_Commands");
xmlFilePath = Path.Combine(configPath, "PlayerConfigs.xml");
}
}
}
namespace OutwardBasicChatCommands.Events
{
public static class EventBusPublisher
{
public const string Event_AddCommand = "ChatCommandsManager@AddChatCommand";
public const string Event_RemoveCommand = "ChatCommandsManager@RemoveChatCommand";
public const string ChatCommands_Listener = "gymmed.chat_commands_manager_*";
public static void SendCommands()
{
EnchantmentCommandsPublisher.SendAddEnchantmentRecipeItemsCommand();
EnchantmentCommandsPublisher.SendAddEnchantmentRecipesCommand();
EnchantmentCommandsPublisher.SendAddEnchantmentsCommand();
EnchantmentCommandsPublisher.SendAddBrokenEnchantmentsCommand();
FollowCommandsPublisher.SendAddFollowChatCommand();
TimeCommandsPublisher.SendAddSetTimeCommand();
TimeCommandsPublisher.SendAddSetMinutesCommand();
ChatCommandsPublisher.SendAddMaxChatMessagesCommand();
SkillCommandsPublisher.SendAddSkillsCommand();
CharacterVisualsPublisher.SendAddSetVisualsCommand();
ModsCommunicatorPublisher.SendCfgToXmlCommand();
}
}
public static class EventBusRegister
{
public static void RegisterEvents()
{
}
}
public static class EventBusSubscriber
{
public const string Event_AddedChatCommand = "ChatCommandsManager@AddChatCommand_After";
public const string Event_RemovedChatCommand = "ChatCommandsManager@RemoveChatCommand_After";
public static void AddSubscribers()
{
EventBus.Subscribe("gymmed.chat_commands_manager_*", "ChatCommandsManager@AddChatCommand_After", (Action<EventPayload>)AddedChatCommand);
EventBus.Subscribe("gymmed.chat_commands_manager_*", "ChatCommandsManager@RemoveChatCommand_After", (Action<EventPayload>)RemovedChatCommand);
}
public static void AddedChatCommand(EventPayload payload)
{
if (payload != null)
{
(string, Type) tuple = ChatCommandsManagerParamsHelper.Get(ChatCommandsManagerParams.CommandName);
payload.Get<string>(tuple.Item1, (string)null);
OBCC.LogMessage("Added command " + tuple.Item1);
}
}
public static void RemovedChatCommand(EventPayload payload)
{
if (payload != null)
{
(string, Type) tuple = ChatCommandsManagerParamsHelper.Get(ChatCommandsManagerParams.CommandName);
payload.Get<string>(tuple.Item1, (string)null);
OBCC.LogMessage("Removed command " + tuple.Item1);
}
}
}
}
namespace OutwardBasicChatCommands.Events.Publishers
{
public class CharacterVisualsPublisher
{
public static void SendAddSetVisualsCommand()
{
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Expected O, but got Unknown
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Expected O, but got Unknown
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Expected O, but got Unknown
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Expected O, but got Unknown
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Expected O, but got Unknown
//IL_0100: Expected O, but got Unknown
Dictionary<string, (string, string)> value = new Dictionary<string, (string, string)>
{
{
"race",
("Required. Changes character race. 1 - Auraian | 2 - Tramon | 3 - Kazite. Ex.:/setVisuals 2", null)
},
{
"hairStyle",
("Required. Changes character hair style. Ex.:/setVisuals 2 15", null)
},
{
"hairColor",
("Required. Changes character hair color. Ex.:/setVisuals 2 15 11", null)
},
{
"headVariation",
("Required. Changes character hair variation. Ex.:/setVisuals 2 15 11 6", null)
},
{
"gender",
("Optional. Changes character gender. 1 - Female | 2 - Male. Ex.:/setVisuals 2 15 11 6 1", null)
}
};
Action<Character, Dictionary<string, string>> value2 = SetVisuals;
EventPayload val = new EventPayload { };
string item;
((Dictionary<string, object>)val)[item] = "setVisuals";
string item2 = ChatCommandsManagerParamsHelper.Get(ChatCommandsManagerParams.CommandParameters).key;
((Dictionary<string, object>)val)[item2] = value;
string item3 = ChatCommandsManagerParamsHelper.Get(ChatCommandsManagerParams.CommandAction).key;
((Dictionary<string, object>)val)[item3] = value2;
string item4 = ChatCommandsManagerParamsHelper.Get(ChatCommandsManagerParams.CommandDescription).key;
((Dictionary<string, object>)val)[item4] = "Changes how your character looks.";
string item5 = ChatCommandsManagerParamsHelper.Get(ChatCommandsManagerParams.CommandRequiresDebugMode).key;
((Dictionary<string, object>)val)[item5] = true;
EventPayload val2 = val;
EventBus.Publish("gymmed.chat_commands_manager_*", "ChatCommandsManager@AddChatCommand", val2);
}
public static void SetVisuals(Character character, Dictionary<string, string> arguments)
{
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Invalid comparison between Unknown and I4
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Invalid comparison between Unknown and I4
//IL_0309: Unknown result type (might be due to invalid IL or missing references)
try
{
object obj;
if (character == null)
{
obj = null;
}
else
{
CharacterUI characterUI = character.CharacterUI;
obj = ((characterUI != null) ? characterUI.ChatPanel : null);
}
ChatPanel val = (ChatPanel)obj;
if ((Object)(object)val == (Object)null)
{
OBCC.LogMessage("CharacterVisualsPublisher@SetVisuals Tried to use missing chatPanel.");
return;
}
arguments.TryGetValue("race", out var value);
ChatHelpers.SendChatLog(val, "Race " + value, ChatLogStatus.Warning);
if (!ValidateIntFromString(val, value, "Race", out var result, 3, 1))
{
return;
}
RacesHelper.races.TryGetValue((Races)(result - 1), out var value2);
GenderData genderData = default(GenderData);
arguments.TryGetValue("gender", out var value3);
if (ValidateIntFromString(val, value3, "Gender", out var result2, 2, 1, silent: true))
{
switch (result2)
{
case 1:
genderData = value2.GetGender((Gender)1);
result2 = 1;
break;
case 2:
genderData = value2.GetGender((Gender)0);
result2 = 0;
break;
default:
genderData = value2.GetGender(character.VisualData.Gender);
result2 = (((int)character.VisualData.Gender == 1) ? 1 : 0);
break;
}
}
else
{
genderData = value2.GetGender(character.VisualData.Gender);
result2 = (((int)character.VisualData.Gender == 1) ? 1 : 0);
}
arguments.TryGetValue("hairStyle", out var value4);
ChatHelpers.SendChatLog(val, "hairStyle " + value4, ChatLogStatus.Warning);
if (!ValidateIntFromString(val, value4, "Hair Style", out var result3, genderData.TotalHairStyles, 1))
{
return;
}
arguments.TryGetValue("hairColor", out var value5);
ChatHelpers.SendChatLog(val, "hairColor " + value5, ChatLogStatus.Warning);
if (!ValidateIntFromString(val, value5, "Hair Color", out var result4, genderData.TotalHairColors, 1))
{
return;
}
arguments.TryGetValue("headVariation", out var value6);
ChatHelpers.SendChatLog(val, "headVariation " + value6, ChatLogStatus.Warning);
if (ValidateIntFromString(val, value6, "Head Variation", out var result5, genderData.TotalHeadVariations, 1))
{
ArmorVisuals defaultHairVisuals = character.Visuals.DefaultHairVisuals;
GameObject val2 = ((defaultHairVisuals != null) ? ((Component)defaultHairVisuals).gameObject : null);
ArmorVisuals defaultHeadVisuals = character.Visuals.DefaultHeadVisuals;
GameObject val3 = ((defaultHeadVisuals != null) ? ((Component)defaultHeadVisuals).gameObject : null);
ArmorVisuals defaultBodyVisuals = character.Visuals.DefaultBodyVisuals;
GameObject val4 = ((defaultBodyVisuals != null) ? ((Component)defaultBodyVisuals).gameObject : null);
ArmorVisuals defaultFootVisuals = character.Visuals.DefaultFootVisuals;
GameObject val5 = ((defaultFootVisuals != null) ? ((Component)defaultFootVisuals).gameObject : null);
ArmorVisuals activeVisualsBody = character.Visuals.ActiveVisualsBody;
GameObject val6 = ((activeVisualsBody != null) ? ((Component)activeVisualsBody).gameObject : null);
ArmorVisuals activeVisualsFoot = character.Visuals.ActiveVisualsFoot;
GameObject val7 = ((activeVisualsFoot != null) ? ((Component)activeVisualsFoot).gameObject : null);
if ((Object)(object)val2 != (Object)null)
{
val2.SetActive(false);
}
if ((Object)(object)val3 != (Object)null)
{
val3.SetActive(false);
}
if ((Object)(object)val4 != (Object)null)
{
val4.SetActive(false);
}
if ((Object)(object)val5 != (Object)null)
{
val5.SetActive(false);
}
if ((Object)(object)val6 != (Object)null)
{
val6.SetActive(false);
}
if ((Object)(object)val7 != (Object)null)
{
val7.SetActive(false);
}
int num = result - 1;
int num2 = result3 - 1;
int num3 = result4 - 1;
int num4 = result5 - 1;
character.Visuals.ResetDataCharacterCreation();
character.VisualData.Gender = (Gender)result2;
ChatHelpers.SendChatLog(val, $"Set gender: {(object)(Gender)result2}", ChatLogStatus.Success);
character.Visuals.LoadCharacterCreationHead(num, result2, num4);
character.Visuals.LoadCharacterCreationHair(num2, num3);
character.Visuals.LoadCharacterCreationBody(result2, num);
character.Visuals.LoadCharacterCreationBoots(result2, num);
character.VisualData.SkinIndex = num;
character.VisualData.HairStyleIndex = num2;
character.VisualData.HairColorIndex = num3;
character.VisualData.HeadVariationIndex = num4;
character.Visuals.m_helmVisualChanged = true;
character.Visuals.m_armorVisualChanged = true;
character.Visuals.m_footVisualChanged = true;
ChatHelpers.SendChatLog(val, "Changed Character Visual Data.", ChatLogStatus.Success);
}
}
catch (Exception ex)
{
OBCC.LogMessage("While setting visuals we encontered an error:" + ex.Message);
}
}
public static bool ValidateIntFromString(ChatPanel panel, string variable, string variableName, out int result, int max = 3, int min = 0, bool silent = false)
{
result = -1;
if (string.IsNullOrWhiteSpace(variable))
{
if (!silent)
{
ChatHelpers.SendChatLog(panel, variableName + " argument is required!", ChatLogStatus.Error);
}
return false;
}
int.TryParse(variable, out var result2);
result = result2;
if (result2 < min)
{
if (!silent)
{
ChatHelpers.SendChatLog(panel, $"{variableName} argument value is too small! Minimum {min} is allowed.", ChatLogStatus.Error);
}
return false;
}
if (result2 > max)
{
if (!silent)
{
ChatHelpers.SendChatLog(panel, $"{variableName} argument value is too big! Maximum {max} is allowed.", ChatLogStatus.Error);
}
return false;
}
return true;
}
}
public static class ChatCommandsPublisher
{
public static void SendAddMaxChatMessagesCommand()
{
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Expected O, but got Unknown
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Expected O, but got Unknown
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Expected O, but got Unknown
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Expected O, but got Unknown
//IL_00ab: Expected O, but got Unknown
Dictionary<string, (string, string)> value = new Dictionary<string, (string, string)>
{
{
"show",
("Optional. Can be provided as bool(true, flase). Should show how many messages are set?", "true")
},
{
"amount",
("Optional. Can be provided as number. Amount of messages chat panel can contain.", "30")
}
};
Action<Character, Dictionary<string, string>> value2 = SetMaxChatMessages;
EventPayload val = new EventPayload { };
string item;
((Dictionary<string, object>)val)[item] = "maxChatMessages";
string item2 = ChatCommandsManagerParamsHelper.Get(ChatCommandsManagerParams.CommandParameters).key;
((Dictionary<string, object>)val)[item2] = value;
string item3 = ChatCommandsManagerParamsHelper.Get(ChatCommandsManagerParams.CommandAction).key;
((Dictionary<string, object>)val)[item3] = value2;
string item4 = ChatCommandsManagerParamsHelper.Get(ChatCommandsManagerParams.CommandDescription).key;
((Dictionary<string, object>)val)[item4] = "Changes the amount of messages chat panel can contain.";
EventPayload val2 = val;
EventBus.Publish("gymmed.chat_commands_manager_*", "ChatCommandsManager@AddChatCommand", val2);
}
public static void SetMaxChatMessages(Character character, Dictionary<string, string> arguments)
{
object obj;
if (character == null)
{
obj = null;
}
else
{
CharacterUI characterUI = character.CharacterUI;
obj = ((characterUI != null) ? characterUI.ChatPanel : null);
}
ChatPanel val = (ChatPanel)obj;
if ((Object)(object)val == (Object)null)
{
OBCC.LogMessage("EventBusPublisher@SetMaxChatMessages Tried to use missing chatPanel.");
return;
}
arguments.TryGetValue("show", out var value);
if (string.IsNullOrWhiteSpace(value) || string.Equals(value, "true"))
{
ChatHelpers.SendChatLog(val, $"Currently chat panel can contain {val.MaxMessageCount} messages!", ChatLogStatus.Warning);
}
arguments.TryGetValue("amount", out var value2);
if (string.IsNullOrWhiteSpace(value2))
{
ChatHelpers.SendChatLog(val, "Argument for amount parameter was not provided! No changes made.", ChatLogStatus.Warning);
return;
}
int.TryParse(value2, out var result);
if (result < 0)
{
ChatHelpers.SendChatLog(val, "Argument amount cannot be negative number!", ChatLogStatus.Error);
return;
}
val.MaxMessageCount = result;
ChatHelpers.SendChatLog(val, $"Chat panel now will hold {result} messages!", ChatLogStatus.Success);
}
}
public static class EnchantmentCommandsPublisher
{
public static void SendAddEnchantmentsCommand()
{
//IL_002d: 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_004a: Expected O, but got Unknown
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Expected O, but got Unknown
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Expected O, but got Unknown
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Expected O, but got Unknown
//IL_0091: Expected O, but got Unknown
Dictionary<string, (string, string)> value = new Dictionary<string, (string, string)> {
{
"short",
("Optional. Can be provided as true or anything else. If it is true provides count of all available Enchantments count", "false")
} };
Action<Character, Dictionary<string, string>> value2 = EnchantmentsInformation;
EventPayload val = new EventPayload { };
string item;
((Dictionary<string, object>)val)[item] = "enchantments";
string item2 = ChatCommandsManagerParamsHelper.Get(ChatCommandsManagerParams.CommandParameters).key;
((Dictionary<string, object>)val)[item2] = value;
string item3 = ChatCommandsManagerParamsHelper.Get(ChatCommandsManagerParams.CommandAction).key;
((Dictionary<string, object>)val)[item3] = value2;
string item4 = ChatCommandsManagerParamsHelper.Get(ChatCommandsManagerParams.CommandDescription).key;
((Dictionary<string, object>)val)[item4] = "Provides information about all enchantments.";
EventPayload val2 = val;
EventBus.Publish("gymmed.chat_commands_manager_*", "ChatCommandsManager@AddChatCommand", val2);
}
public static void EnchantmentsInformation(Character character, Dictionary<string, string> arguments)
{
object obj;
if (character == null)
{
obj = null;
}
else
{
CharacterUI characterUI = character.CharacterUI;
obj = ((characterUI != null) ? characterUI.ChatPanel : null);
}
ChatPanel val = (ChatPanel)obj;
if ((Object)(object)val == (Object)null)
{
OBCC.LogMessage("EventBusPublisher@EnchantmentsInformation Tried to use missing chatPanel.");
return;
}
arguments.TryGetValue("short", out var value);
List<Enchantment> list = ResourcesPrefabManager.ENCHANTMENT_PREFABS.Values.ToList();
if (string.IsNullOrWhiteSpace(value) || !string.Equals(value, "true"))
{
EnchantmentRecipesHelpers.PrintEnchantments(val, list);
}
ChatHelpers.SendChatLog(val, $"Total {list.Count()} Enchantments.");
}
public static void SendAddEnchantmentRecipesCommand()
{
//IL_002d: 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_004a: Expected O, but got Unknown
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Expected O, but got Unknown
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Expected O, but got Unknown
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Expected O, but got Unknown
//IL_0091: Expected O, but got Unknown
Dictionary<string, (string, string)> value = new Dictionary<string, (string, string)> {
{
"short",
("Optional. Can be provided as true or anything else. If it is true provides count of all available EnchantmentRecipes count", "false")
} };
Action<Character, Dictionary<string, string>> value2 = EnchantmentRecipesInformation;
EventPayload val = new EventPayload { };
string item;
((Dictionary<string, object>)val)[item] = "enchantmentRecipes";
string item2 = ChatCommandsManagerParamsHelper.Get(ChatCommandsManagerParams.CommandParameters).key;
((Dictionary<string, object>)val)[item2] = value;
string item3 = ChatCommandsManagerParamsHelper.Get(ChatCommandsManagerParams.CommandAction).key;
((Dictionary<string, object>)val)[item3] = value2;
string item4 = ChatCommandsManagerParamsHelper.Get(ChatCommandsManagerParams.CommandDescription).key;
((Dictionary<string, object>)val)[item4] = "Provides information about all enchantment recipes.";
EventPayload val2 = val;
EventBus.Publish("gymmed.chat_commands_manager_*", "ChatCommandsManager@AddChatCommand", val2);
}
public static void EnchantmentRecipesInformation(Character character, Dictionary<string, string> arguments)
{
object obj;
if (character == null)
{
obj = null;
}
else
{
CharacterUI characterUI = character.CharacterUI;
obj = ((characterUI != null) ? characterUI.ChatPanel : null);
}
ChatPanel val = (ChatPanel)obj;
if ((Object)(object)val == (Object)null)
{
OBCC.LogMessage("EventBusPublisher@EnchantmentRecipesInformation Tried to use missing chatPanel.");
return;
}
arguments.TryGetValue("short", out var value);
List<EnchantmentRecipe> enchantmentRecipes = RecipeManager.Instance.GetEnchantmentRecipes();
if (string.IsNullOrWhiteSpace(value) || !string.Equals(value, "true"))
{
EnchantmentRecipesHelpers.PrintEnchantmentRecipes(val, enchantmentRecipes);
}
ChatHelpers.SendChatLog(val, $"Total {enchantmentRecipes.Count()} EnchantmentRecipes.");
}
public static void SendAddEnchantmentRecipeItemsCommand()
{
//IL_002d: 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_004a: Expected O, but got Unknown
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Expected O, but got Unknown
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Expected O, but got Unknown
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Expected O, but got Unknown
//IL_0091: Expected O, but got Unknown
Dictionary<string, (string, string)> value = new Dictionary<string, (string, string)> {
{
"short",
("Optional. Can be provided as true or anything else. If it is true provides count of all available EnchantmentRecipeItems count", "false")
} };
Action<Character, Dictionary<string, string>> value2 = EnchantmentRecipeItemsInformation;
EventPayload val = new EventPayload { };
string item;
((Dictionary<string, object>)val)[item] = "enchantmentRecipeItems";
string item2 = ChatCommandsManagerParamsHelper.Get(ChatCommandsManagerParams.CommandParameters).key;
((Dictionary<string, object>)val)[item2] = value;
string item3 = ChatCommandsManagerParamsHelper.Get(ChatCommandsManagerParams.CommandAction).key;
((Dictionary<string, object>)val)[item3] = value2;
string item4 = ChatCommandsManagerParamsHelper.Get(ChatCommandsManagerParams.CommandDescription).key;
((Dictionary<string, object>)val)[item4] = "Provides information about all enchantment recipe items.";
EventPayload val2 = val;
EventBus.Publish("gymmed.chat_commands_manager_*", "ChatCommandsManager@AddChatCommand", val2);
}
public static void EnchantmentRecipeItemsInformation(Character character, Dictionary<string, string> arguments)
{
object obj;
if (character == null)
{
obj = null;
}
else
{
CharacterUI characterUI = character.CharacterUI;
obj = ((characterUI != null) ? characterUI.ChatPanel : null);
}
ChatPanel val = (ChatPanel)obj;
if ((Object)(object)val == (Object)null)
{
OBCC.LogMessage("EventBusPublisher@EnchantmentRecipeItemsInformation Tried to use missing chatPanel.");
return;
}
arguments.TryGetValue("short", out var value);
HashSet<EnchantmentRecipeItem> allEnchantmentRecipeItems = EnchantmentRecipesHelpers.GetAllEnchantmentRecipeItems();
if (string.IsNullOrWhiteSpace(value) || !string.Equals(value, "true"))
{
EnchantmentRecipesHelpers.PrintEnchantmentRecipeItems(val, allEnchantmentRecipeItems);
}
ChatHelpers.SendChatLog(val, $"Total {allEnchantmentRecipeItems.Count()} EnchantmentRecipeItems.");
}
public static void SendAddBrokenEnchantmentsCommand()
{
//IL_002d: 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_004a: Expected O, but got Unknown
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Expected O, but got Unknown
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Expected O, but got Unknown
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Expected O, but got Unknown
//IL_0091: Expected O, but got Unknown
Dictionary<string, (string, string)> value = new Dictionary<string, (string, string)> {
{
"short",
("Optional. Can be provided as true or anything else. If it is true provides count of all broken enchantments", "false")
} };
Action<Character, Dictionary<string, string>> value2 = FindBrokenEnchantments;
EventPayload val = new EventPayload { };
string item;
((Dictionary<string, object>)val)[item] = "brokenEnchantments";
string item2 = ChatCommandsManagerParamsHelper.Get(ChatCommandsManagerParams.CommandParameters).key;
((Dictionary<string, object>)val)[item2] = value;
string item3 = ChatCommandsManagerParamsHelper.Get(ChatCommandsManagerParams.CommandAction).key;
((Dictionary<string, object>)val)[item3] = value2;
string item4 = ChatCommandsManagerParamsHelper.Get(ChatCommandsManagerParams.CommandDescription).key;
((Dictionary<string, object>)val)[item4] = "Provides information about all incorrectly added enchantments by modders.";
EventPayload val2 = val;
EventBus.Publish("gymmed.chat_commands_manager_*", "ChatCommandsManager@AddChatCommand", val2);
}
public static void FindBrokenEnchantments(Character character, Dictionary<string, string> arguments)
{
object obj;
if (character == null)
{
obj = null;
}
else
{
CharacterUI characterUI = character.CharacterUI;
obj = ((characterUI != null) ? characterUI.ChatPanel : null);
}
ChatPanel val = (ChatPanel)obj;
if ((Object)(object)val == (Object)null)
{
OBCC.LogMessage("EventBusPublisher@FindBrokenEnchantments Tried to use missing chatPanel.");
return;
}
arguments.TryGetValue("short", out var value);
HashSet<EnchantmentRecipeItem> allEnchantmentRecipeItems = EnchantmentRecipesHelpers.GetAllEnchantmentRecipeItems();
HashSet<EnchantmentRecipe> brokenEnchantmentRecipes = EnchantmentRecipesHelpers.GetBrokenEnchantmentRecipes();
if (!string.IsNullOrWhiteSpace(value) && string.Equals(value, "true"))
{
EnchantmentRecipesHelpers.PrintBrokenEnchantmentRecipeItemsCount(val, allEnchantmentRecipeItems);
ChatHelpers.SendChatLog(val, $"Total {brokenEnchantmentRecipes.Count()} broken EnchantmentRecipes.");
}
else
{
EnchantmentRecipesHelpers.PrintBrokenEnchantmentRecipeItems(val, allEnchantmentRecipeItems);
EnchantmentRecipesHelpers.PrintBrokenEnchantmentRecipes(val, brokenEnchantmentRecipes);
}
}
}
public static class FollowCommandsPublisher
{
public static void SendAddFollowChatCommand()
{
//IL_0029: 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_0046: Expected O, but got Unknown
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Expected O, but got Unknown
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Expected O, but got Unknown
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Expected O, but got Unknown
//IL_008d: Expected O, but got Unknown
Dictionary<string, (string, string)> value = new Dictionary<string, (string, string)> {
{
"characterName",
("Optional. Tries to follow character by name. If not provided tries to find first local character or lobby character.", null)
} };
Action<Character, Dictionary<string, string>> value2 = FollowCharacter;
EventPayload val = new EventPayload { };
string item;
((Dictionary<string, object>)val)[item] = "follow";
string item2 = ChatCommandsManagerParamsHelper.Get(ChatCommandsManagerParams.CommandParameters).key;
((Dictionary<string, object>)val)[item2] = value;
string item3 = ChatCommandsManagerParamsHelper.Get(ChatCommandsManagerParams.CommandAction).key;
((Dictionary<string, object>)val)[item3] = value2;
string item4 = ChatCommandsManagerParamsHelper.Get(ChatCommandsManagerParams.CommandDescription).key;
((Dictionary<string, object>)val)[item4] = "Tries to find a player to follow. Searching is done starting from local characters and moving to lobby characters.";
EventPayload val2 = val;
EventBus.Publish("gymmed.chat_commands_manager_*", "ChatCommandsManager@AddChatCommand", val2);
}
public static void FollowCharacter(Character follower, Dictionary<string, string> arguments)
{
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
object obj;
if (follower == null)
{
obj = null;
}
else
{
CharacterUI characterUI = follower.CharacterUI;
obj = ((characterUI != null) ? characterUI.ChatPanel : null);
}
ChatPanel val = (ChatPanel)obj;
if ((Object)(object)val == (Object)null)
{
OBCC.LogMessage("EventBusPublisher@SendAddFollowChatCommand Tried to use missing chatPanel.");
return;
}
arguments.TryGetValue("characterName", out var value);
if (string.IsNullOrWhiteSpace(value))
{
UID uID = ((UIElement)val).LocalCharacter.UID;
Character firstLocalCharacter = CharacterManager.Instance.GetFirstLocalCharacter();
if ((Object)(object)firstLocalCharacter != (Object)null && firstLocalCharacter.UID != uID)
{
FollowerDataManager.Instance.TryToFollow(((UIElement)val).LocalCharacter, firstLocalCharacter);
return;
}
Character secondLocalCharacter = CharacterManager.Instance.GetSecondLocalCharacter();
if ((Object)(object)secondLocalCharacter != (Object)null && secondLocalCharacter.UID != uID)
{
FollowerDataManager.Instance.TryToFollow(((UIElement)val).LocalCharacter, secondLocalCharacter);
return;
}
Character val2 = CharacterHelpers.TryToFindOtherCharacterInLobby(((UIElement)val).LocalCharacter);
if ((Object)(object)val2 != (Object)null)
{
FollowerDataManager.Instance.TryToFollow(((UIElement)val).LocalCharacter, val2);
}
else
{
ChatHelpers.SendChatLog(val, "You are playing alone. There is nothing to follow.");
}
}
else
{
Character val3 = CharacterHelpers.TryToFindOtherCharacterInLobby(((UIElement)val).LocalCharacter, value);
if ((Object)(object)val3 != (Object)null)
{
FollowerDataManager.Instance.TryToFollow(((UIElement)val).LocalCharacter, val3);
}
else
{
ChatHelpers.SendChatLog(val, "Could not find other player by name " + value + "!");
}
}
}
}
public static class ModsCommunicatorPublisher
{
public static void SendCfgToXmlCommand()
{
//IL_0029: 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_0046: Expected O, but got Unknown
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Expected O, but got Unknown
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Expected O, but got Unknown
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Expected O, but got Unknown
//IL_008d: Expected O, but got Unknown
Dictionary<string, (string, string)> value = new Dictionary<string, (string, string)> {
{
"filePath",
("Optional. Stores xml to provided file path.", null)
} };
Action<Character, Dictionary<string, string>> value2 = ConvertConfigsToXml;
EventPayload val = new EventPayload { };
string item;
((Dictionary<string, object>)val)[item] = "cfgToXml";
string item2 = ChatCommandsManagerParamsHelper.Get(ChatCommandsManagerParams.CommandParameters).key;
((Dictionary<string, object>)val)[item2] = value;
string item3 = ChatCommandsManagerParamsHelper.Get(ChatCommandsManagerParams.CommandAction).key;
((Dictionary<string, object>)val)[item3] = value2;
string item4 = ChatCommandsManagerParamsHelper.Get(ChatCommandsManagerParams.CommandDescription).key;
((Dictionary<string, object>)val)[item4] = "Saves your current configuration as an XML file for the ModsCommunicator mod. Intended mainly for mod developers. Regular users should only lock the values they need, as locking everything may lead to unintended gameplay changes.";
EventPayload val2 = val;
EventBus.Publish("gymmed.chat_commands_manager_*", "ChatCommandsManager@AddChatCommand", val2);
}
public static void ConvertConfigsToXml(Character owner, Dictionary<string, string> arguments)
{
object obj;
if (owner == null)
{
obj = null;
}
else
{
CharacterUI characterUI = owner.CharacterUI;
obj = ((characterUI != null) ? characterUI.ChatPanel : null);
}
ChatPanel val = (ChatPanel)obj;
if ((Object)(object)val == (Object)null)
{
OBCC.LogMessage("ModsCommunicatorPublisher@ConvertConfigsToXml Tried to use missing chatPanel.");
return;
}
arguments.TryGetValue("filePath", out var value);
if (string.IsNullOrWhiteSpace(value))
{
ChatHelpers.SendChatLog(val, "You did not provide filePath varialbe. We will store xml to \"" + PathsManager.Instance.xmlFilePath + "\"", ChatLogStatus.Warning);
value = PathsManager.Instance.xmlFilePath;
}
if (DataSerializer.SaveToXml<ConfigOverrides>(ConfigExporter.ExportAllConfigs(), value))
{
ChatHelpers.SendChatLog(val, "XML file successfully saved to \"" + value + "\". Refer to the ModsCommunicator documentation for instructions on where to place it to reliably sync or override mod configurations.", ChatLogStatus.Success);
}
else
{
ChatHelpers.SendChatLog(val, "Failed to store xml to \"" + value + "\"! Check Logs for more information.", ChatLogStatus.Error);
}
}
}
public static class SkillCommandsPublisher
{
public static void SendAddSkillsCommand()
{
//IL_002d: 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_004a: Expected O, but got Unknown
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Expected O, but got Unknown
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Expected O, but got Unknown
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Expected O, but got Unknown
//IL_0091: Expected O, but got Unknown
Dictionary<string, (string, string)> value = new Dictionary<string, (string, string)> {
{
"type",
("Optional. Can be provided as int. types: 0 - general data | 1 - active | 2 - passive | 3 - cosmetic", "0")
} };
Action<Character, Dictionary<string, string>> value2 = ShowSkillsData;
EventPayload val = new EventPayload { };
string item;
((Dictionary<string, object>)val)[item] = "skills";
string item2 = ChatCommandsManagerParamsHelper.Get(ChatCommandsManagerParams.CommandParameters).key;
((Dictionary<string, object>)val)[item2] = value;
string item3 = ChatCommandsManagerParamsHelper.Get(ChatCommandsManagerParams.CommandAction).key;
((Dictionary<string, object>)val)[item3] = value2;
string item4 = ChatCommandsManagerParamsHelper.Get(ChatCommandsManagerParams.CommandDescription).key;
((Dictionary<string, object>)val)[item4] = "Shows skills information.";
EventPayload val2 = val;
EventBus.Publish("gymmed.chat_commands_manager_*", "ChatCommandsManager@AddChatCommand", val2);
}
public static void ShowSkillsData(Character character, Dictionary<string, string> arguments)
{
object obj;
if (character == null)
{
obj = null;
}
else
{
CharacterUI characterUI = character.CharacterUI;
obj = ((characterUI != null) ? characterUI.ChatPanel : null);
}
ChatPanel val = (ChatPanel)obj;
if ((Object)(object)val == (Object)null)
{
OBCC.LogMessage("EventBusPublisher@SetMaxChatMessages Tried to use missing chatPanel.");
return;
}
arguments.TryGetValue("type", out var value);
SkillTypes category = (SkillTypes)int.Parse(value);
if (string.IsNullOrWhiteSpace(value))
{
category = SkillTypes.All;
}
SkillsHelpers.LogSkillsData(val, category);
}
}
public static class TimeCommandsPublisher
{
public static void SendPictureModeCommand()
{
//IL_0029: 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_0046: Expected O, but got Unknown
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Expected O, but got Unknown
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Expected O, but got Unknown
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Expected O, but got Unknown
//IL_008d: Expected O, but got Unknown
Dictionary<string, (string, string)> value = new Dictionary<string, (string, string)> {
{
"isActive",
("Optional. By default sets opposite mode. Removes/adds character and pauses the game for picture capture. Ex.:/setPictureMode true", null)
} };
Action<Character, Dictionary<string, string>> value2 = SetPictureMode;
EventPayload val = new EventPayload { };
string item;
((Dictionary<string, object>)val)[item] = "setPictureMode";
string item2 = ChatCommandsManagerParamsHelper.Get(ChatCommandsManagerParams.CommandParameters).key;
((Dictionary<string, object>)val)[item2] = value;
string item3 = ChatCommandsManagerParamsHelper.Get(ChatCommandsManagerParams.CommandAction).key;
((Dictionary<string, object>)val)[item3] = value2;
string item4 = ChatCommandsManagerParamsHelper.Get(ChatCommandsManagerParams.CommandDescription).key;
((Dictionary<string, object>)val)[item4] = "Pauses/resumes the game time.";
EventPayload val2 = val;
EventBus.Publish("gymmed.chat_commands_manager_*", "ChatCommandsManager@AddChatCommand", val2);
}
public static void SetPictureMode(Character character, Dictionary<string, string> arguments)
{
object obj;
if (character == null)
{
obj = null;
}
else
{
CharacterUI characterUI = character.CharacterUI;
obj = ((characterUI != null) ? characterUI.ChatPanel : null);
}
ChatPanel val = (ChatPanel)obj;
if ((Object)(object)val == (Object)null)
{
OBCC.LogMessage("TimeCommandsPublisher@SetPictureMode Tried to use missing chatPanel.");
return;
}
arguments.TryGetValue("isActive", out var value);
if (string.IsNullOrWhiteSpace(value))
{
float num = 1E-06f;
string text = ((Time.timeScale != num) ? "paused" : "resumed");
character.CharacterUI.PauseMenu.TogglePause();
character.CharacterUI.PauseMenu.OnToggleChat();
ChatHelpers.SendChatLog(val, "Successfully " + text + " world time!", ChatLogStatus.Success);
return;
}
if (string.Equals(value, "true"))
{
((Component)character).gameObject.SetActive(false);
PauseMenu.Pause(true);
ChatHelpers.SendChatLog(val, "Successfully paused the game!", ChatLogStatus.Success);
}
else
{
((Component)character).gameObject.SetActive(true);
PauseMenu.Pause(false);
ChatHelpers.SendChatLog(val, "Successfully resumed the game!", ChatLogStatus.Success);
}
character.CharacterUI.PauseMenu.OnToggleChat();
}
public static void SendAddSetTimeCommand()
{
//IL_0029: 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_0046: Expected O, but got Unknown
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Expected O, but got Unknown
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Expected O, but got Unknown
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Expected O, but got Unknown
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Expected O, but got Unknown
//IL_00a8: Expected O, but got Unknown
Dictionary<string, (string, string)> value = new Dictionary<string, (string, string)> {
{
"time",
("Required. Set minutes for current time. Ex.: setTime 05:50", null)
} };
Action<Character, Dictionary<string, string>> value2 = SetTime;
EventPayload val = new EventPayload { };
string item;
((Dictionary<string, object>)val)[item] = "setTime";
string item2 = ChatCommandsManagerParamsHelper.Get(ChatCommandsManagerParams.CommandParameters).key;
((Dictionary<string, object>)val)[item2] = value;
string item3 = ChatCommandsManagerParamsHelper.Get(ChatCommandsManagerParams.CommandAction).key;
((Dictionary<string, object>)val)[item3] = value2;
string item4 = ChatCommandsManagerParamsHelper.Get(ChatCommandsManagerParams.CommandDescription).key;
((Dictionary<string, object>)val)[item4] = "Sets current time.";
string item5 = ChatCommandsManagerParamsHelper.Get(ChatCommandsManagerParams.CommandRequiresDebugMode).key;
((Dictionary<string, object>)val)[item5] = true;
EventPayload val2 = val;
EventBus.Publish("gymmed.chat_commands_manager_*", "ChatCommandsManager@AddChatCommand", val2);
}
public static void SetTime(Character character, Dictionary<string, string> arguments)
{
object obj;
if (character == null)
{
obj = null;
}
else
{
CharacterUI characterUI = character.CharacterUI;
obj = ((characterUI != null) ? characterUI.ChatPanel : null);
}
ChatPanel val = (ChatPanel)obj;
if ((Object)(object)val == (Object)null)
{
OBCC.LogMessage("TimeCommandsPublisher@SetTime Tried to use missing chatPanel.");
return;
}
arguments.TryGetValue("time", out var value);
if (string.IsNullOrWhiteSpace(value))
{
ChatHelpers.SendChatLog(val, "Time argument is required!", ChatLogStatus.Error);
return;
}
string[] array = value.Split(new char[1] { ':' });
if (array.Length > 2)
{
ChatHelpers.SendChatLog(val, "Time argument only needs hours:minutes!", ChatLogStatus.Error);
return;
}
if (array.Length < 1)
{
ChatHelpers.SendChatLog(val, "Time argument lacks on of the parameters hours:minutes!", ChatLogStatus.Error);
return;
}
int.TryParse(array[0], out var result);
if (TryValidateNumber(val, result, 23, 0, "Hours"))
{
int.TryParse(array[1], out var result2);
if (TryValidateNumber(val, result2, 59, 0, "Minutes"))
{
TimeHelpers.SetTime(result, result2);
ChatHelpers.SendChatLog(val, $"Successfully set time to {result}:{result2}!", ChatLogStatus.Success);
}
}
}
public static bool TryValidateNumber(ChatPanel panel, int number, int max, int min, string variableName)
{
if (number < min)
{
ChatHelpers.SendChatLog(panel, $"{variableName} can not be lower than {min}!", ChatLogStatus.Error);
return false;
}
if (number > max)
{
ChatHelpers.SendChatLog(panel, $"{variableName} can not exceed {max}!", ChatLogStatus.Error);
return false;
}
return true;
}
public static void SendAddSetMinutesCommand()
{
//IL_0029: 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_0046: Expected O, but got Unknown
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Expected O, but got Unknown
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Expected O, but got Unknown
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Expected O, but got Unknown
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Expected O, but got Unknown
//IL_00a8: Expected O, but got Unknown
Dictionary<string, (string, string)> value = new Dictionary<string, (string, string)> {
{
"minutes",
("Required. Set minutes for current time. Ex.: /setMinutes 55", null)
} };
Action<Character, Dictionary<string, string>> value2 = SetMinutes;
EventPayload val = new EventPayload { };
string item;
((Dictionary<string, object>)val)[item] = "setMinutes";
string item2 = ChatCommandsManagerParamsHelper.Get(ChatCommandsManagerParams.CommandParameters).key;
((Dictionary<string, object>)val)[item2] = value;
string item3 = ChatCommandsManagerParamsHelper.Get(ChatCommandsManagerParams.CommandAction).key;
((Dictionary<string, object>)val)[item3] = value2;
string item4 = ChatCommandsManagerParamsHelper.Get(ChatCommandsManagerParams.CommandDescription).key;
((Dictionary<string, object>)val)[item4] = "Sets current hour minutes.";
string item5 = ChatCommandsManagerParamsHelper.Get(ChatCommandsManagerParams.CommandRequiresDebugMode).key;
((Dictionary<string, object>)val)[item5] = true;
EventPayload val2 = val;
EventBus.Publish("gymmed.chat_commands_manager_*", "ChatCommandsManager@AddChatCommand", val2);
}
public static void SetMinutes(Character character, Dictionary<string, string> arguments)
{
object obj;
if (character == null)
{
obj = null;
}
else
{
CharacterUI characterUI = character.CharacterUI;
obj = ((characterUI != null) ? characterUI.ChatPanel : null);
}
ChatPanel val = (ChatPanel)obj;
if ((Object)(object)val == (Object)null)
{
OBCC.LogMessage("TimeCommandsPublisher@SetMinutes Tried to use missing chatPanel.");
return;
}
arguments.TryGetValue("minutes", out var value);
if (string.IsNullOrWhiteSpace(value))
{
ChatHelpers.SendChatLog(val, "Minutes argument is required!", ChatLogStatus.Error);
return;
}
int.TryParse(value, out var result);
if (result < 0)
{
ChatHelpers.SendChatLog(val, "Minutes can not be negative!", ChatLogStatus.Error);
return;
}
if (result > 60)
{
ChatHelpers.SendChatLog(val, "Minutes can not exceed 60!", ChatLogStatus.Error);
return;
}
TimeHelpers.SetMinutes(result);
ChatHelpers.SendChatLog(val, "Successfully set minutes to " + value + "!", ChatLogStatus.Success);
}
}
}