Decompiled source of Guilds v1.1.13

Guilds.dll

Decompiled 6 months ago
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using APIManager;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Preloader;
using BepInEx.Preloader.Patching;
using HarmonyLib;
using JetBrains.Annotations;
using LocalizationManager;
using Microsoft.CodeAnalysis;
using Mono.Cecil;
using Mono.Cecil.Cil;
using Mono.Collections.Generic;
using ServerSync;
using Splatform;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using YamlDotNet.Core;
using YamlDotNet.Core.Events;
using YamlDotNet.Core.ObjectPool;
using YamlDotNet.Core.Tokens;
using YamlDotNet.Helpers;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.BufferedDeserialization;
using YamlDotNet.Serialization.BufferedDeserialization.TypeDiscriminators;
using YamlDotNet.Serialization.Callbacks;
using YamlDotNet.Serialization.Converters;
using YamlDotNet.Serialization.EventEmitters;
using YamlDotNet.Serialization.NamingConventions;
using YamlDotNet.Serialization.NodeDeserializers;
using YamlDotNet.Serialization.NodeTypeResolvers;
using YamlDotNet.Serialization.ObjectFactories;
using YamlDotNet.Serialization.ObjectGraphTraversalStrategies;
using YamlDotNet.Serialization.ObjectGraphVisitors;
using YamlDotNet.Serialization.Schemas;
using YamlDotNet.Serialization.TypeInspectors;
using YamlDotNet.Serialization.TypeResolvers;
using YamlDotNet.Serialization.Utilities;
using YamlDotNet.Serialization.ValueDeserializers;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("Guilds")]
[assembly: AssemblyDescription("https://valheim.thunderstore.io/package/Smoothbrain/Guilds")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Guilds")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("4090002D-833C-47D1-B33D-2AD719E969F5")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Guilds
{
	[PublicAPI]
	public static class API
	{
		public delegate void AchievementCompleted(PlayerReference player, string achievment);

		public delegate void GuildJoined(Guild guild, PlayerReference player);

		public delegate void GuildLeft(Guild guild, PlayerReference player);

		public delegate void GuildCreated(Guild guild);

		public delegate void GuildDeleted(Guild guild);

		public static List<GuildJoined> OnGuildJoined = new List<GuildJoined>();

		public static List<GuildLeft> OnGuildLeft = new List<GuildLeft>();

		public static List<GuildCreated> OnGuildCreated = new List<GuildCreated>();

		public static List<GuildDeleted> OnGuildDeleted = new List<GuildDeleted>();

		public static bool IsLoaded()
		{
			return true;
		}

		public static Guild? GetPlayerGuild(PlayerReference player)
		{
			KeyValuePair<string, Guild> keyValuePair = GuildList.guildList.FirstOrDefault<KeyValuePair<string, Guild>>((KeyValuePair<string, Guild> s) => s.Value.Members.ContainsKey(player));
			if (!Utility.IsNullOrWhiteSpace(keyValuePair.Key))
			{
				return keyValuePair.Value;
			}
			return null;
		}

		public static Guild? GetPlayerGuild(Player player)
		{
			return GetPlayerGuild(PlayerReference.fromPlayer(player));
		}

		public static Guild? GetOwnGuild()
		{
			return GetPlayerGuild(PlayerReference.forOwnPlayer());
		}

		public static Guild? GetGuild(string name)
		{
			if (GuildList.guildList.TryGetValue(name, out Guild value))
			{
				return value;
			}
			return null;
		}

		public static Guild? GetGuild(int id)
		{
			if (GuildList.guildsById.TryGetValue(id, out Guild value))
			{
				return value;
			}
			return null;
		}

		public static List<Guild> GetGuilds()
		{
			return GuildList.guildList.Values.ToList();
		}

		public static PlayerReference GetGuildLeader(Guild guild)
		{
			return guild.Members.FirstOrDefault<KeyValuePair<PlayerReference, GuildMember>>((KeyValuePair<PlayerReference, GuildMember> r) => r.Value.rank == Ranks.Leader).Key;
		}

		public static Guild? CreateGuild(string name, PlayerReference leader)
		{
			if (GuildList.guildList.TryGetValue(name, out Guild _))
			{
				return null;
			}
			int id = GuildList.guildsById.Keys.DefaultIfEmpty().Max() + 1;
			Guild guild = new Guild
			{
				General = new GuildGeneral
				{
					id = id
				},
				Name = name
			};
			guild.Members.Add(leader, new GuildMember
			{
				rank = Ranks.Leader
			});
			GuildList.guildList[name] = guild;
			GuildList.updateGuild(name);
			return guild;
		}

		public static bool DeleteGuild(Guild guild)
		{
			if (GuildList.guildList.ContainsKey(guild.Name))
			{
				GuildList.removeGuild(guild.Name);
				return true;
			}
			return false;
		}

		public static bool RenameGuild(Guild guild, string newName)
		{
			if (GuildList.guildList.ContainsKey(newName))
			{
				return false;
			}
			GuildList.guildList[newName] = GuildList.guildList[guild.Name];
			GuildList.guildList.Remove(guild.Name);
			GuildList.renameGuild(guild.Name, newName);
			return true;
		}

		public static bool SaveGuild(Guild guild)
		{
			if (GuildList.guildList.ContainsKey(guild.Name))
			{
				GuildList.guildList[guild.Name] = guild;
				GuildList.updateGuild(guild.Name);
				return true;
			}
			return false;
		}

		public static bool AddPlayerToGuild(PlayerReference player, Guild guild)
		{
			if (GetPlayerGuild(player) == null)
			{
				guild.Members.Add(player, new GuildMember());
				SaveGuild(guild);
				InvokeGuildJoined(guild, player);
				return true;
			}
			return false;
		}

		public static bool RemovePlayerFromGuild(PlayerReference player)
		{
			Guild playerGuild = GetPlayerGuild(player);
			if (playerGuild != null)
			{
				playerGuild.Members.Remove(player);
				SaveGuild(playerGuild);
				InvokeGuildLeft(playerGuild, player);
				return true;
			}
			return false;
		}

		public static Ranks GetPlayerRank(PlayerReference player)
		{
			return GetPlayerGuild(player)?.Members[player].rank ?? Ranks.Leader;
		}

		public static bool UpdatePlayerRank(PlayerReference player, Ranks newRank)
		{
			Guild playerGuild = GetPlayerGuild(player);
			if (playerGuild != null)
			{
				GuildMember guildMember = playerGuild.Members[player];
				guildMember.rank = newRank;
				playerGuild.Members[player] = guildMember;
				SaveGuild(playerGuild);
				return true;
			}
			return false;
		}

		public static IEnumerable<PlayerReference> GetOnlinePlayers(Guild? guild = null)
		{
			HashSet<PlayerReference> hashSet = new HashSet<PlayerReference>(ZNet.instance.m_players.Select(PlayerReference.fromPlayerInfo));
			if (guild != null)
			{
				return guild.Members.Keys.Where(hashSet.Contains);
			}
			foreach (PlayerReference item in GetGuilds().SelectMany((Guild g) => g.Members.Keys))
			{
				hashSet.Remove(item);
			}
			return hashSet;
		}

		public static Guild? GetOwnAppliedGuild()
		{
			return GetPlayerAppliedGuild(PlayerReference.forOwnPlayer());
		}

		public static Guild? GetPlayerAppliedGuild(PlayerReference player)
		{
			return GuildList.guildList.FirstOrDefault<KeyValuePair<string, Guild>>((KeyValuePair<string, Guild> s) => s.Value.Applications.ContainsKey(player)).Value;
		}

		public static bool ApplyToGuild(PlayerReference player, string description, Guild guild)
		{
			RemovePlayerApplication(player);
			guild.Applications[player] = new Application
			{
				description = description
			};
			return SaveGuild(guild);
		}

		public static bool RemovePlayerApplication(PlayerReference player, Guild? guild = null)
		{
			Guild playerAppliedGuild = GetPlayerAppliedGuild(player);
			if (playerAppliedGuild != null && (guild == null || playerAppliedGuild == guild))
			{
				playerAppliedGuild.Applications.Remove(player);
				return SaveGuild(playerAppliedGuild);
			}
			return true;
		}

		public static void RegisterCustomData(Type type)
		{
			CustomDataConverter.RegisteredCustomTypes.Add(type.FullName, type);
		}

		public static T? GetCustomData<T>(Guild guild) where T : class
		{
			guild.customData.data.TryGetValue(typeof(T), out object value);
			return (T)value;
		}

		public static void SetCustomData<T>(Guild guild, T customData) where T : class
		{
			guild.customData.data[typeof(T)] = customData;
		}

		public static void IncreaseAchievementProgress(Guild guild, string achievement, float increment = 1f)
		{
			if (guild.Achievements.TryGetValue(achievement, out AchievementData value))
			{
				float? progress = value.progress;
				if (!progress.HasValue)
				{
					return;
				}
			}
			GuildList.increaseAchievement(guild.General.id, achievement, increment);
		}

		public static void RegisterOnAchievementCompleted(AchievementCompleted callback)
		{
			Achievements.achievementCompletedCallbacks.Add(callback);
		}

		public static void RegisterAchievement(string name, AchievementConfig config)
		{
			Achievements.dynamicAchievementConfigs.Add(name, config);
		}

		internal static AchievementConfig? GetAchievementConfig(string achievement)
		{
			return Achievements.GetAchievementConfig(achievement);
		}

		internal static IEnumerable<KeyValuePair<string, AchievementConfig>> AllAchievementConfigs()
		{
			return Achievements.AllAchievementConfigs();
		}

		public static Sprite? GetGuildIcon(Guild guild)
		{
			if (!Interface.GuildIcons.TryGetValue(guild.General.icon, out Sprite value))
			{
				return Interface.GuildIcons[1];
			}
			return value;
		}

		public static Sprite? GetGuildIconById(int iconId)
		{
			if (!Interface.GuildIcons.TryGetValue(iconId, out Sprite value))
			{
				return Interface.GuildIcons[1];
			}
			return value;
		}

		public static int GetAchievementStage(Guild guild, AchievementConfig achievement)
		{
			if (guild.Achievements.TryGetValue(achievement.name, out AchievementData value))
			{
				return value.completed.Count;
			}
			return 0;
		}

		public static void RegisterOnGuildJoined(GuildJoined callback)
		{
			OnGuildJoined.Add(callback);
		}

		public static void RegisterOnGuildLeft(GuildLeft callback)
		{
			OnGuildLeft.Add(callback);
		}

		public static void RegisterOnGuildCreated(GuildCreated callback)
		{
			OnGuildCreated.Add(callback);
		}

		public static void RegisterOnGuildDeleted(GuildDeleted callback)
		{
			OnGuildDeleted.Add(callback);
		}

		internal static void InvokeGuildJoined(Guild guild, PlayerReference player)
		{
			Guild guild2 = guild;
			OnGuildJoined.ForEach(delegate(GuildJoined cb)
			{
				cb(guild2, player);
			});
		}

		internal static void InvokeGuildLeft(Guild guild, PlayerReference player)
		{
			Guild guild2 = guild;
			OnGuildLeft.ForEach(delegate(GuildLeft cb)
			{
				cb(guild2, player);
			});
		}

		internal static void InvokeGuildCreated(Guild guild)
		{
			Guild guild2 = guild;
			OnGuildCreated.ForEach(delegate(GuildCreated cb)
			{
				cb(guild2);
			});
		}

		internal static void InvokeGuildDeleted(Guild guild)
		{
			Guild guild2 = guild;
			OnGuildDeleted.ForEach(delegate(GuildDeleted cb)
			{
				cb(guild2);
			});
		}
	}
	[PublicAPI]
	public class Guild
	{
		public string Name = "";

		public GuildGeneral General = new GuildGeneral();

		public Dictionary<PlayerReference, GuildMember> Members = new Dictionary<PlayerReference, GuildMember>();

		public Dictionary<PlayerReference, Application> Applications = new Dictionary<PlayerReference, Application>();

		public Dictionary<string, AchievementData> Achievements = new Dictionary<string, AchievementData>();

		public CustomData customData = new CustomData();
	}
	[PublicAPI]
	public class GuildMember
	{
		public Ranks rank = Ranks.Member;

		[<cba6ec40-2546-4a46-9577-18d27987fd9e>YamlMember(Alias = "last online", ApplyNamingConventions = false)]
		public DateTime lastOnline = DateTime.Now;

		public Dictionary<int, Dictionary<string, int>> contribution = new Dictionary<int, Dictionary<string, int>>();
	}
	[PublicAPI]
	public class GuildGeneral
	{
		public int id;

		public string description = "";

		[<cba6ec40-2546-4a46-9577-18d27987fd9e>YamlMember(Alias = "icon id", ApplyNamingConventions = false)]
		public int icon = 1;

		public int level;

		[<cba6ec40-2546-4a46-9577-18d27987fd9e>YamlMember(Alias = "guild color", ApplyNamingConventions = false)]
		public string color = "";
	}
	[PublicAPI]
	public class Application
	{
		public DateTime applied = DateTime.Now;

		public string description = "";
	}
	[PublicAPI]
	public class AchievementData
	{
		public float? progress = 0f;

		public List<DateTime> completed = new List<DateTime>();
	}
	[PublicAPI]
	public class CustomData
	{
		internal Dictionary<Type, object> data = new Dictionary<Type, object>();

		internal Dictionary<string, object> unknown = new Dictionary<string, object>();
	}
	[PublicAPI]
	public class AchievementConfig
	{
		public string name = "";

		public string description = "";

		public List<float> progress = new List<float> { 1f };

		public List<int>? guild;

		public List<int> level = new List<int>();

		public string icon = "";

		public bool first;

		public Dictionary<string, string> config = new Dictionary<string, string>();

		public T getConfigValue<T>(string name, T defaultValue = default(T))
		{
			if (config.TryGetValue(name, out string value))
			{
				if (typeof(T) == typeof(int))
				{
					if (int.TryParse(value, out var result))
					{
						return (T)(object)result;
					}
				}
				else
				{
					if (!(typeof(T) == typeof(float)))
					{
						return (T)(object)value;
					}
					if (float.TryParse(value, NumberStyles.Float, CultureInfo.InvariantCulture, out var result2))
					{
						return (T)(object)result2;
					}
				}
			}
			return defaultValue;
		}

		internal int GetLevel(int completed)
		{
			if (completed > level.Count)
			{
				return level.Max();
			}
			return level[completed - 1];
		}

		internal Sprite? GetIcon()
		{
			if (!Interface.AchievementIcons.TryGetValue(icon, out Sprite value))
			{
				return null;
			}
			return value;
		}
	}
	[PublicAPI]
	[TypeConverter(typeof(PlayerReferenceTypeConverter))]
	public struct PlayerReference
	{
		public string id;

		public string name;

		public static PlayerReference fromPlayerInfo(PlayerInfo playerInfo)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			PlayerReference result = default(PlayerReference);
			result.id = ((object)(PlatformUserID)(ref playerInfo.m_userInfo.m_id)).ToString();
			result.name = playerInfo.m_name ?? "";
			return result;
		}

		public static PlayerReference fromPlayer(Player player)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			Player player2 = player;
			if (!((Object)(object)player2 == (Object)(object)Player.m_localPlayer))
			{
				return fromPlayerInfo(((IEnumerable<PlayerInfo>)ZNet.instance.m_players).FirstOrDefault((Func<PlayerInfo, bool>)((PlayerInfo info) => info.m_characterID == ((Character)player2).GetZDOID())));
			}
			return forOwnPlayer();
		}

		public static PlayerReference forOwnPlayer()
		{
			//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)
			PlayerReference result = default(PlayerReference);
			IDistributionPlatform distributionPlatform = PlatformManager.DistributionPlatform;
			object obj;
			if (distributionPlatform == null)
			{
				obj = null;
			}
			else
			{
				PlatformUserID platformUserID = ((IUser)distributionPlatform.LocalUser).PlatformUserID;
				obj = ((object)(PlatformUserID)(ref platformUserID)).ToString();
			}
			if (obj == null)
			{
				obj = "";
			}
			result.id = (string)obj;
			result.name = Game.instance.GetPlayerProfile().GetName();
			return result;
		}

		public static PlayerReference fromRPC(ZRpc? rpc)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			ZRpc rpc2 = rpc;
			if (rpc2 != null)
			{
				return fromPlayerInfo(ZNet.instance.m_players.First((PlayerInfo p) => ((object)(PlatformUserID)(ref p.m_userInfo.m_id)).ToString().EndsWith(rpc2.m_socket.GetHostName())));
			}
			return forOwnPlayer();
		}

		public static bool operator !=(PlayerReference a, PlayerReference b)
		{
			return !(a == b);
		}

		public static bool operator ==(PlayerReference a, PlayerReference b)
		{
			if (a.id == b.id)
			{
				return a.name == b.name;
			}
			return false;
		}

		public bool Equals(PlayerReference other)
		{
			return this == other;
		}

		public override bool Equals(object? obj)
		{
			if (obj is PlayerReference other)
			{
				return Equals(other);
			}
			return false;
		}

		public override int GetHashCode()
		{
			return (id.GetHashCode() * 397) ^ name.GetHashCode();
		}

		public override string ToString()
		{
			return id + ":" + name;
		}

		public static PlayerReference fromString(string str)
		{
			string[] array = str.Split(new char[1] { ':' });
			PlayerReference result = default(PlayerReference);
			result.id = array[0];
			result.name = array[1];
			return result;
		}
	}
	public class PlayerReferenceTypeConverter : System.ComponentModel.TypeConverter
	{
		public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object? value)
		{
			return PlayerReference.fromString(value?.ToString() ?? ":");
		}
	}
	public enum Toggle
	{
		On = 1,
		Off = 0
	}
	public enum Ranks
	{
		Leader,
		Coleader,
		Officer,
		Member
	}
	public class AchievementStorage
	{
		public readonly Dictionary<string, DateTime> lastBossKillTimes = new Dictionary<string, DateTime>();

		public readonly List<string> guildBossKills = new List<string>();

		[<cba6ec40-2546-4a46-9577-18d27987fd9e>YamlIgnore]
		private Guild? guild;

		public static AchievementStorage get(Guild? guild = null)
		{
			if (guild == null)
			{
				guild = API.GetOwnGuild();
			}
			if (guild != null)
			{
				AchievementStorage customData = API.GetCustomData<AchievementStorage>(guild);
				if (customData != null)
				{
					customData.guild = guild;
					return customData;
				}
				customData = new AchievementStorage
				{
					guild = guild
				};
				API.SetCustomData(guild, customData);
				return customData;
			}
			return new AchievementStorage();
		}

		public void Save()
		{
			if (guild != null)
			{
				API.SetCustomData(guild, this);
			}
		}
	}
	public static class Achievements
	{
		[HarmonyPatch(typeof(PlayerProfile), "IncrementStat")]
		private static class IncreaseGuildAchievementProgress
		{
			private static void Postfix(PlayerStatType stat, float amount)
			{
				Guild ownGuild = API.GetOwnGuild();
				if (ownGuild != null)
				{
					API.IncreaseAchievementProgress(ownGuild, ((object)(PlayerStatType)(ref stat)).ToString().ToLowerInvariant(), amount);
				}
			}
		}

		private static readonly CustomSyncedValue<string> achievementConfigData = new CustomSyncedValue<string>(Guilds.configSync, "achievementConfig", "");

		private static Dictionary<string, AchievementConfig> achievementConfigs = new Dictionary<string, AchievementConfig>();

		internal static readonly Dictionary<string, AchievementConfig> dynamicAchievementConfigs = new Dictionary<string, AchievementConfig>();

		private static string achievementConfigPath = null;

		internal static readonly List<API.AchievementCompleted> achievementCompletedCallbacks = new List<API.AchievementCompleted>();

		internal static void Init()
		{
			string? directoryName = Path.GetDirectoryName(((BaseUnityPlugin)Guilds.self).Config.ConfigFilePath);
			char directorySeparatorChar = Path.DirectorySeparatorChar;
			achievementConfigPath = directoryName + directorySeparatorChar + "AchievementConfig.yml";
			achievementConfigData.ValueChanged += ConfigChanged;
			Guilds.guildAchievementConfig.SettingChanged += delegate
			{
				ConfigChanged();
			};
			readAchievementConfigFile();
			Guilds.addFileWatchEvent(new FileSystemWatcher(Path.GetDirectoryName(achievementConfigPath), Path.GetFileName(achievementConfigPath)), delegate
			{
				readAchievementConfigFile();
			});
			API.RegisterOnAchievementCompleted(delegate(PlayerReference player, string achievement)
			{
				AchievementConfig achievementConfig = GetAchievementConfig(achievement);
				if (achievementConfig != null)
				{
					Guild ownGuild = API.GetOwnGuild();
					if (ownGuild != null && ownGuild.Members.ContainsKey(player) && ownGuild.Achievements.TryGetValue(achievement, out AchievementData value))
					{
						AchievementPopup.Queue(player, achievementConfig, value.completed.Count);
					}
				}
			});
			static void ConfigChanged()
			{
				if (Guilds.guildAchievementConfig.Value == Guilds.GuildAchievements.Disabled)
				{
					achievementConfigs = new Dictionary<string, AchievementConfig>();
					return;
				}
				try
				{
					Dictionary<string, AchievementConfig> dictionary = deserializeConfig(achievementConfigData.Value);
					if (Guilds.guildAchievementConfig.Value != Guilds.GuildAchievements.External)
					{
						achievementConfigs = deserializeConfig(Encoding.UTF8.GetString(Tools.ReadEmbeddedFileBytes("AchievementConfig.yml")));
						{
							foreach (KeyValuePair<string, AchievementConfig> item in dictionary)
							{
								achievementConfigs[item.Key] = item.Value;
							}
							return;
						}
					}
					achievementConfigs = dictionary;
				}
				catch (Exception arg)
				{
					Debug.LogError((object)$"Failed to deserialize achievementConfig: {arg}");
				}
			}
		}

		private static Dictionary<string, AchievementConfig> deserializeConfig(string data)
		{
			Dictionary<string, AchievementConfig> dictionary = new Dictionary<string, AchievementConfig>(new <cba6ec40-2546-4a46-9577-18d27987fd9e>DeserializerBuilder().WithNamingConvention(<cba6ec40-2546-4a46-9577-18d27987fd9e>CamelCaseNamingConvention.Instance).Build().Deserialize<Dictionary<string, AchievementConfig>>(data) ?? new Dictionary<string, AchievementConfig>(), StringComparer.InvariantCultureIgnoreCase);
			foreach (AchievementConfig value in dictionary.Values)
			{
				AchievementConfig current;
				AchievementConfig achievementConfig = (current = value);
				if (current.progress == null)
				{
					current.progress = new List<float> { 1f };
				}
				current = achievementConfig;
				if (current.level == null)
				{
					current.level = new List<int>();
				}
				current = achievementConfig;
				if (current.config == null)
				{
					current.config = new Dictionary<string, string>();
				}
			}
			return dictionary;
		}

		internal static AchievementConfig? GetAchievementConfig(string achievement)
		{
			if (!achievementConfigs.TryGetValue(achievement, out AchievementConfig value))
			{
				dynamicAchievementConfigs.TryGetValue(achievement, out value);
			}
			return value;
		}

		internal static IEnumerable<KeyValuePair<string, AchievementConfig>> AllAchievementConfigs()
		{
			return achievementConfigs.Concat(dynamicAchievementConfigs);
		}

		private static void readAchievementConfigFile()
		{
			achievementConfigData.AssignLocalValue(File.Exists(achievementConfigPath) ? File.ReadAllText(achievementConfigPath) : "");
		}
	}
	public static class AchievementTracker
	{
		[HarmonyPatch(typeof(Character), "OnDeath")]
		public static class TrackBossKills
		{
			private static void Prefix(Character __instance)
			{
				Guild ownGuild = API.GetOwnGuild();
				if (ownGuild == null || !bosses.Contains(Utils.GetPrefabName(((Component)__instance).gameObject)))
				{
					return;
				}
				AchievementStorage achievementStorage = AchievementStorage.get(ownGuild);
				if (!achievementStorage.guildBossKills.Contains(Utils.GetPrefabName(((Component)__instance).gameObject)))
				{
					AchievementConfig achievementConfig = API.GetAchievementConfig("Guild Boss Kills");
					if (achievementConfig != null && Tools.GetNearbyGuildMembers(Player.m_localPlayer, 40f, includeSelf: true).Count >= achievementConfig.getConfigValue("required members", 3))
					{
						achievementStorage.guildBossKills.Add(((Object)__instance).name);
						achievementStorage.Save();
						if (achievementStorage.guildBossKills.Count == bosses.Count)
						{
							API.IncreaseAchievementProgress(ownGuild, "Guild Boss Kills");
						}
					}
				}
				AchievementConfig timedKillsConfig = API.GetAchievementConfig("Guild Boss Kills Timed");
				if (timedKillsConfig != null)
				{
					if (achievementStorage.lastBossKillTimes.All<KeyValuePair<string, DateTime>>((KeyValuePair<string, DateTime> k) => k.Value < DateTime.Now.Subtract(new TimeSpan(0, 0, timedKillsConfig.getConfigValue("maximum time between kills", 10)))))
					{
						achievementStorage.lastBossKillTimes.Clear();
					}
					achievementStorage.lastBossKillTimes[((Object)__instance).name] = DateTime.Now;
					if (achievementStorage.lastBossKillTimes.Count == bosses.Count)
					{
						API.IncreaseAchievementProgress(ownGuild, "Guild Boss Kills Timed");
					}
					achievementStorage.Save();
				}
			}
		}

		[HarmonyPatch(typeof(Trader), "Interact")]
		private static class TrackTraderDiscovery
		{
			private static void Postfix(Trader __instance)
			{
				Guild ownGuild = API.GetOwnGuild();
				if (ownGuild != null)
				{
					if (Utils.GetPrefabName(((Component)__instance).gameObject) == "Haldor")
					{
						API.IncreaseAchievementProgress(ownGuild, "Found Haldor");
					}
					if (Utils.GetPrefabName(((Component)__instance).gameObject) == "Hildir")
					{
						API.IncreaseAchievementProgress(ownGuild, "Found Hildir");
					}
				}
			}
		}

		[HarmonyPatch(typeof(Trader), "OnBought")]
		private static class TrackCoinsSpend
		{
			private static void Postfix(TradeItem item)
			{
				Guild ownGuild = API.GetOwnGuild();
				if (ownGuild != null)
				{
					API.IncreaseAchievementProgress(ownGuild, "Spend Coins", item.m_price);
				}
			}
		}

		private static readonly List<string> bosses = new List<string> { "Eikthyr", "gd_king", "Bonemass", "Dragon", "GoblinKing", "SeekerQueen", "Fader" };
	}
	[PublicAPI]
	public class AchievementPopup : MonoBehaviour
	{
		private struct QueuedPopup
		{
			public PlayerReference Player;

			public AchievementConfig Config;

			public int Level;
		}

		[CompilerGenerated]
		private sealed class <<Queue>g__Dequeue|41_0>d : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public AchievementPopup <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <<Queue>g__Dequeue|41_0>d(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d0: Expected O, but got Unknown
				//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00aa: Expected O, but got Unknown
				int num = <>1__state;
				AchievementPopup achievementPopup = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					break;
				case 1:
					<>1__state = -1;
					achievementPopup.Hide();
					<>2__current = (object)new WaitForSeconds(2f);
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					break;
				}
				if (achievementPopup.queue.Count > 0)
				{
					QueuedPopup queuedPopup = achievementPopup.queue.Dequeue();
					achievementPopup.achievementIconImg.sprite = queuedPopup.Config.GetIcon() ?? achievementPopup.defaultIcon;
					((TMP_Text)achievementPopup.aiDescription).text = queuedPopup.Config.name;
					((TMP_Text)achievementPopup.guildLevelText).text = queuedPopup.Config.GetLevel(queuedPopup.Level).ToString();
					achievementPopup.Show();
					<>2__current = (object)new WaitForSeconds(5f);
					<>1__state = 1;
					return true;
				}
				((Component)achievementPopup).gameObject.SetActive(false);
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[Header("Row Root")]
		public RectTransform rowRootTransform;

		public AchievementPopup rowInstance;

		public GameObject rowRootGameObject;

		public RectTransform back;

		public Image backImage;

		public Image borderImage;

		public GameObject rowNotCompleted;

		[Header("Content Area")]
		public RectTransform contentAreaRectTransform;

		[Header("Left Column")]
		public RectTransform leftColumnRect;

		public HorizontalLayoutGroup leftColumnHLayoutGroup;

		[Header("Left Column - Icon Container")]
		public RectTransform achievementIconContainerRect;

		public Image achievementIconContainerImg;

		public RectTransform achievementIconImgRect;

		public RectTransform achievementIconBorderRect;

		public Image achievementIconBorderImg;

		public Image achievementIconImg;

		[Header("Right Column - Rank Area")]
		public RectTransform rightCol;

		public Image rightColBg;

		public RectTransform rightColIconContainer;

		public Image rightColIconContainerSelectedIcon;

		public Image rightColIconcontainerBorder;

		public RectTransform guildLevelRect;

		public TextMeshProUGUI guildLevelText;

		[Header("Right Column - AchievementInformation")]
		public RectTransform aiRect;

		public RectTransform aiHeader;

		public HorizontalLayoutGroup aiHeaderHLG;

		public TextMeshProUGUI aiHeaderTitle;

		public TextMeshProUGUI aiHeaderDate;

		public TextMeshProUGUI aiDescription;

		public RectTransform progressBar;

		public Image progressBarBg;

		public Image progressBarBgGreen;

		public TextMeshProUGUI progressText;

		[Header("Animator")]
		public Animator animatorComp;

		public Sprite defaultIcon;

		private Queue<QueuedPopup> queue = new Queue<QueuedPopup>();

		public void Awake()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			RectTransform component = ((Component)this).GetComponent<RectTransform>();
			Vector2 val = default(Vector2);
			((Vector2)(ref val))..ctor(0.5f, 0.25f);
			component.anchorMax = val;
			component.anchorMin = val;
			defaultIcon = achievementIconImg.sprite;
		}

		public void Show()
		{
			animatorComp.SetBool("visible", true);
		}

		public void Hide()
		{
			if (animatorComp.GetBool("visible"))
			{
				animatorComp.SetBool("visible", false);
			}
		}

		public static void Queue(PlayerReference player, AchievementConfig config, int level)
		{
			if (Object.op_Implicit((Object)(object)Interface.AchievementPopup))
			{
				Interface.AchievementPopup.GetComponent<AchievementPopup>().Queue(new QueuedPopup
				{
					Player = player,
					Config = config,
					Level = level
				});
			}
		}

		private void Queue(QueuedPopup popup)
		{
			queue.Enqueue(popup);
			if (!((Component)this).gameObject.activeSelf)
			{
				((Component)this).gameObject.SetActive(true);
				((MonoBehaviour)this).StartCoroutine(Dequeue());
			}
			[IteratorStateMachine(typeof(<<Queue>g__Dequeue|41_0>d))]
			IEnumerator Dequeue()
			{
				//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
				return new <<Queue>g__Dequeue|41_0>d(0)
				{
					<>4__this = this
				};
			}
		}
	}
	[PublicAPI]
	public class AchievementUI : MonoBehaviour
	{
		public Canvas canvas;

		public RectTransform root;

		public Image BackgroundBack;

		public Button ButtonClose;

		public Image ButtonCloseImage;

		public TextMeshProUGUI ButtonCloseTMP;

		public Image Background;

		public RectTransform Header;

		public HorizontalLayoutGroup HeaderHLG;

		public Image HeaderImageLeft;

		public Image HeaderImageRight;

		public TextMeshProUGUI HeaderTMP;

		public RectTransform content;

		public ScrollRect contentScrollRect;

		public Image contentScrollRectImage;

		public RectTransform contentList;

		public VerticalLayoutGroup contentListVLG;

		public ContentSizeFitter contentListContentSizeFitter;

		public TextMeshProUGUI guildLevel;

		public TextMeshProUGUI achievementsCompleted;

		[Header("Placeholder")]
		public RectTransform RowPlaceholder;

		public AchievementUIRow PlaceholderInstance;

		public RectTransform PlaceholderBack;

		public RectTransform PlaceholderBackBg;

		public RectTransform PlaceholderBackBgImg;

		public RectTransform PlaceholderBackBorder;

		public RectTransform PlaceholderBackBorderImg;

		public RectTransform PlaceholderContent;

		public RectTransform PlaceholderContentLeftCol;

		public HorizontalLayoutGroup PlaceholderContentLeftColHLG;

		public RectTransform PlaceholderContentLeftColIcon;

		public Image PlaceholderContentLeftColIconImage;

		public Image PlaceholderContentLeftColIconImageSelected;

		public Image PlaceholderContentLeftColIconImageBorder;

		public RectTransform PlaceholderContentRightColIcon;

		public Image PlaceholderContentRightColIconImage;

		public Image PlaceholderContentRightColIconImageSelected;

		public Image PlaceholderContentRightColIconImageBorder;

		public TextMeshProUGUI PlaceholderContentRightColIconGuildLevelTMP;

		public RectTransform PlaceholderContentAchievementInformationRect;

		public RectTransform PlaceholderContentAchievementInformationHeader;

		public HorizontalLayoutGroup PlaceholderContentAchievementInformationHeaderHLG;

		public TextMeshProUGUI PlaceholderContentAchievementInformationHeaderTitle;

		public TextMeshProUGUI PlaceholderContentAchievementInformationHeaderDate;

		public TextMeshProUGUI PlaceholderContentAchievementInformationHeaderDesc;

		public RectTransform PlaceholderContentAchievementInformationProgressBar;

		public Image PlaceholderContentAchievementInformationProgressBarBg;

		public Image PlaceholderContentAchievementInformationProgressBarGreen;

		public TextMeshProUGUI PlaceholderContentAchievementInformationProgressBarText;

		public RectTransform PlaceholderContentRightCol;

		public Image PlaceholderContentRightColBg;

		[Header("Content - Scroll")]
		public Scrollbar contentScrollbar;

		public RectTransform contentScrollbarSlidingArea;

		public Image contentScrollbarImage;

		public RectTransform contentScrollbarHandle;

		public Image contentScrollbarHandleImage;

		private List<AchievementUIRow> _activeRows = new List<AchievementUIRow>();

		private Queue<AchievementUIRow> _pooledRows = new Queue<AchievementUIRow>();

		public void OnEnable()
		{
			UpdateRows();
		}

		public void UpdateRows()
		{
			if (((Component)this).gameObject.activeSelf)
			{
				if (API.GetOwnGuild() == null)
				{
					Interface.SwitchUI(Interface.NoGuildUI);
				}
				else
				{
					PopulateRows(API.GetOwnGuild().Achievements);
				}
			}
		}

		public void PopulateRows(Dictionary<string, AchievementData> achievements)
		{
			int num = 0;
			foreach (AchievementUIRow activeRow in _activeRows)
			{
				((Component)activeRow).gameObject.SetActive(false);
				_pooledRows.Enqueue(activeRow);
			}
			_activeRows.Clear();
			foreach (KeyValuePair<string, AchievementConfig> kv in Achievements.AllAchievementConfigs())
			{
				if (achievements.TryGetValue(kv.Key, out AchievementData value) && value.completed.Count >= kv.Value.progress.Count)
				{
					num++;
				}
				if (!kv.Value.first || (value?.completed.Count ?? 0) >= 1 || !GuildList.guildList.Values.Any((Guild g) => g.Achievements.TryGetValue(kv.Key, out AchievementData value2) && value2.completed.Count > 0))
				{
					AchievementUIRow row = GetRow();
					row.Setup(kv.Value, value);
					_activeRows.Add(row);
				}
			}
			((TMP_Text)guildLevel).text = Localization.instance.Localize("$guilds_guildlevel", new string[1] { API.GetOwnGuild().General.level.ToString() });
			((TMP_Text)achievementsCompleted).text = Localization.instance.Localize("$guilds_achievements_completed", new string[1] { num.ToString() });
		}

		private AchievementUIRow GetRow()
		{
			AchievementUIRow obj = ((_pooledRows.Count > 0) ? _pooledRows.Dequeue() : Object.Instantiate<GameObject>(((Component)RowPlaceholder).gameObject, (Transform)(object)contentList).GetComponent<AchievementUIRow>());
			((Component)obj).gameObject.SetActive(true);
			return obj;
		}

		private void ReturnRowToPool(AchievementUIRow row)
		{
			((Component)row).gameObject.SetActive(false);
			_pooledRows.Enqueue(row);
		}

		public void OnButtonClosed_Clicked()
		{
			Interface.HideUI();
		}

		public void OnButtonGoBack_Clicked()
		{
			Interface.SwitchUI(Interface.GuildManagementUI);
		}
	}
	[PublicAPI]
	public class AchievementUIRow : MonoBehaviour
	{
		[Header("Row Root")]
		public RectTransform rowRootTransform;

		public AchievementUIRow rowInstance;

		public GameObject rowRootGameObject;

		public RectTransform back;

		public Image backImage;

		public Image borderImage;

		public GameObject rowNotCompleted;

		[Header("Content Area")]
		public RectTransform contentAreaRectTransform;

		[Header("Left Column")]
		public RectTransform leftColumnRect;

		public HorizontalLayoutGroup leftColumnHLayoutGroup;

		[Header("Left Column - Icon Container")]
		public RectTransform achievementIconContainerRect;

		public Image achievementIconContainerImg;

		public RectTransform achievementIconImgRect;

		public RectTransform achievementIconBorderRect;

		public Image achievementIconBorderImg;

		public Image achievementIconImg;

		[Header("Right Column - Rank Area")]
		public RectTransform rightCol;

		public Image rightColBg;

		public RectTransform rightColIconContainer;

		public Image rightColIconContainerSelectedIcon;

		public Image rightColIconcontainerBorder;

		public RectTransform guildLevelRect;

		public TextMeshProUGUI guildLevelText;

		[Header("Right Column - AchievementInformation")]
		public RectTransform aiRect;

		public RectTransform aiHeader;

		public HorizontalLayoutGroup aiHeaderHLG;

		public TextMeshProUGUI aiHeaderTitle;

		public TextMeshProUGUI aiHeaderDate;

		public TextMeshProUGUI aiDescription;

		public RectTransform progressBar;

		public Image progressBarBg;

		public Image progressBarBgGreen;

		public TextMeshProUGUI progressText;

		public Sprite defaultIcon;

		public void Awake()
		{
			defaultIcon = achievementIconImg.sprite;
		}

		public void Setup(AchievementConfig config, AchievementData? data)
		{
			if (data == null)
			{
				data = new AchievementData();
			}
			int num = Math.Min(data.completed.Count, config.progress.Count - 1);
			float num2 = config.progress[num];
			((TMP_Text)aiDescription).text = config.config.Aggregate<KeyValuePair<string, string>, string>(Localization.instance.Localize(config.description), (string text, KeyValuePair<string, string> kv) => text.Replace("{" + kv.Key + "}", kv.Value));
			((TMP_Text)aiHeaderTitle).text = config.name;
			achievementIconImg.sprite = config.GetIcon() ?? defaultIcon;
			((TMP_Text)guildLevelText).text = config.GetLevel(num + 1).ToString();
			((Component)progressBar).gameObject.SetActive(num2 > 1f);
			if (config.progress.Count > data.completed.Count)
			{
				float? progress = data.progress;
				if (progress.HasValue)
				{
					progressBarBgGreen.fillAmount = data.progress.Value / num2;
					((TMP_Text)progressText).text = $"{data.progress} / {num2}";
					goto IL_0182;
				}
			}
			float num3 = config.progress.Last();
			progressBarBgGreen.fillAmount = 1f;
			((TMP_Text)progressText).text = $"{num3} / {num3}";
			goto IL_0182;
			IL_0182:
			((TMP_Text)aiHeaderDate).text = ((data.completed.Count > 0) ? data.completed.Last().ToString("yyyy-MM-dd HH:mm") : "");
			rowNotCompleted.SetActive(data.completed.Count == 0);
		}
	}
	[PublicAPI]
	public class ApplicationsUI : MonoBehaviour
	{
		[Header("Placeholder Variables")]
		public ApplicationsUIRow rowPlaceHolderPrefab;

		public Transform rowPlaceHolderParentList;

		public List<ApplicationsUIRow> rowElements;

		[Header("Root UI")]
		public RectTransform rootTransform;

		public Image backgroundBack;

		public Image background;

		[Header("Header UI")]
		public RectTransform headerTransform;

		public HorizontalLayoutGroup headerHlg;

		public Image headerImageLeft;

		public TextMeshProUGUI headerTextTMP;

		public Image headerImageRight;

		[Header("Close Button UI")]
		public Button buttonClose;

		public Image buttonCloseImage;

		public TextMeshProUGUI buttonCloseText;

		[Header("Content UI")]
		public RectTransform contentTransform;

		public ScrollRect contentScrollRect;

		public Image contentScrollRectImage;

		public RectTransform contentList;

		public VerticalLayoutGroup contentListVlg;

		public ContentSizeFitter contentListSizeFitter;

		[Header("Row Placeholder UI")]
		public RectTransform rowTransform;

		public Image rowBackImage;

		public Image rowBorderImage;

		public HorizontalLayoutGroup contentHlg;

		[Header("Row Content UI - Name Area")]
		public RectTransform nameAreaRect;

		public VerticalLayoutGroup nameAreaVlg;

		public TextMeshProUGUI nameAreaNameTextTMP;

		[Header("Row Content UI - WhyMe Area")]
		public RectTransform whyMeArea;

		public VerticalLayoutGroup whyMeAreaVlg;

		public Button whyMeButton;

		public Image whyMeButtonImg;

		public TextMeshProUGUI whyMeAreaText;

		[Header("Row Content UI - Applied Area")]
		public RectTransform appliedAreaRect;

		public VerticalLayoutGroup appliedAreaVlg;

		public TextMeshProUGUI appliedAreaAppliedStatusTextTMP;

		[Header("Row Content UI - Action Area")]
		public RectTransform actionArea;

		public Button actionAreaAcceptMemberButton;

		public Image actionAreaAcceptMemberButtonImage;

		public Image actionAreaAcceptMemberButtonCheckmark;

		public Button actionAreaDenyMemberButton;

		public TextMeshProUGUI actionAreaDenyMemberButtonTextTMP;

		public Image actionAreaDenyMemberButtonImage;

		[Header("Root UI Global Scrollbar")]
		public Scrollbar scrollbar;

		public RectTransform scrollbarRect;

		public RectTransform scrollbarSlidingArea;

		public RectTransform scrollbarHandle;

		public Image scrollbarHandleImage;

		[Header("Back Button")]
		public Button backButton;

		public Image backButtonImage;

		public TextMeshProUGUI backButtonText;

		[Header("Accept Guild Member Button")]
		public Button acceptGuildMemberButton;

		public Image acceptGuildMemberButtonImage;

		public Image acceptGuildMemberButtonCheckmark;

		[Header("Deny Guild Member Button")]
		public Button denyGuildMemberButton;

		public Image denyGuildMemberImage;

		public TextMeshProUGUI denyGuildMemberText;

		[Header("Popup")]
		public RectTransform popupRootRect;

		public RectTransform popupBkgBlocking;

		public Image popupBkgBlockingImg;

		public CanvasGroup popupCanvasGroup;

		public RectTransform popupBkg;

		public Image popupBkgImg;

		public RectTransform popupScrollviewRect;

		public ScrollRect popupScrollview;

		public Image popupScrollviewImage;

		public RectTransform popupViewport;

		public Image popupViewportImage;

		public RectTransform popupViewportContentRect;

		public RectTransform popupViewportContentBodyTextRect;

		public TextMeshProUGUI popupViewportContentBodyText;

		public RectTransform popupScrollbarRect;

		public Scrollbar popupScrollbar;

		public Image popupScrollbarImg;

		public RectTransform popupSlidingAreaRect;

		public RectTransform popupHandleRect;

		public Image popupHandleImg;

		public RectTransform popupHeaderTextRect;

		public TextMeshProUGUI popupHeaderText;

		public RectTransform popupButtonGroupRect;

		public HorizontalLayoutGroup popupButtonGroup;

		public RectTransform popupButtonOkRect;

		public Button popupButtonOk;

		public Image popupButtonOkImg;

		public RectTransform popupButtonOkTextRect;

		public Text popupButtonOkText;

		private List<ApplicationsUIRow> _activeRows = new List<ApplicationsUIRow>();

		private Queue<ApplicationsUIRow> _pooledRows = new Queue<ApplicationsUIRow>();

		public void OnEnable()
		{
			UpdateRows();
		}

		public void UpdateRows()
		{
			if (((Component)this).gameObject.activeSelf)
			{
				if (API.GetOwnGuild() == null)
				{
					Interface.SwitchUI(Interface.NoGuildUI);
				}
				else
				{
					PopulateRows(API.GetOwnGuild().Applications);
				}
			}
		}

		public void PopulateRows(Dictionary<PlayerReference, Application> members)
		{
			foreach (ApplicationsUIRow activeRow in _activeRows)
			{
				((Component)activeRow).gameObject.SetActive(false);
				_pooledRows.Enqueue(activeRow);
			}
			_activeRows.Clear();
			foreach (KeyValuePair<PlayerReference, Application> member in members)
			{
				ApplicationsUIRow row = GetRow();
				row.Setup(this, member.Key, member.Value);
				_activeRows.Add(row);
			}
		}

		private ApplicationsUIRow GetRow()
		{
			ApplicationsUIRow obj = ((_pooledRows.Count > 0) ? _pooledRows.Dequeue() : Object.Instantiate<GameObject>(((Component)rowPlaceHolderPrefab).gameObject, rowPlaceHolderParentList).GetComponent<ApplicationsUIRow>());
			((Component)obj).gameObject.SetActive(true);
			return obj;
		}

		private void ReturnRowToPool(ApplicationsUIRow row)
		{
			((Component)row).gameObject.SetActive(false);
			_pooledRows.Enqueue(row);
		}

		public void whyMeAreaClicked()
		{
		}

		public void OnButtonClosed_Clicked()
		{
			Interface.HideUI();
		}

		public void ButtonBackClicked()
		{
			Interface.SwitchUI(Interface.GuildManagementUI);
		}

		public void ButtonEditGuildClicked()
		{
		}

		public void ButtonApplicationsClicked()
		{
		}
	}
	[PublicAPI]
	public class ApplicationsUIRow : MonoBehaviour
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static PopupButtonCallback <0>__Pop;
		}

		private PlayerReference applicant;

		private Application application;

		private int guildId = -1;

		[Header("Row Root")]
		public RectTransform rowRootTransform;

		public GameObject rowRootGameObject;

		public RectTransform back;

		public Image backImage;

		public Image borderImage;

		[Header("Content Area")]
		public RectTransform contentAreaRectTransform;

		public HorizontalLayoutGroup contentAreaHorizontalLayoutGroup;

		[Header("Name Area")]
		public RectTransform nameAreaTransform;

		public VerticalLayoutGroup nameAreaVerticalLayoutGroup;

		public TextMeshProUGUI nameText;

		[Header("WhyMe Area")]
		public RectTransform whyMeArea;

		public VerticalLayoutGroup whyMeAreaVlg;

		public Button whyMeButton;

		public Image whyMeButtonImg;

		public TextMeshProUGUI whyMeAreaText;

		[Header("Applied Area")]
		public RectTransform appliedAreaTransform;

		public VerticalLayoutGroup appliedAreaLayoutGroup;

		public RectTransform statusTextTransform;

		public TextMeshProUGUI statusText;

		[Header("Action Area")]
		public RectTransform actionAreaTransform;

		public HorizontalLayoutGroup actionAreaLayoutGroup;

		public Button actionAreaAcceptMemberButton;

		public Image actionAreaAcceptMemberButtonImage;

		public Image actionAreaAcceptMemberButtonCheckmark;

		public Button actionAreaDenyMemberButton;

		public Image actionAreaDenyMemberButtonImage;

		public TextMeshProUGUI actionAreaDenyMemberButtonTextTMP;

		public ApplicationsUI applicationsUI;

		public void Setup(ApplicationsUI applicationsUI, PlayerReference applicant, Application application)
		{
			this.applicationsUI = applicationsUI;
			this.applicant = applicant;
			this.application = application;
			((TMP_Text)nameText).text = applicant.name;
			((TMP_Text)whyMeAreaText).text = application.description;
			((TMP_Text)statusText).text = Localization.instance.Localize("$guilds_apply_applied", new string[1] { Tools.GetHumanFriendlyTime((int)(DateTime.Now - application.applied).TotalSeconds) });
			guildId = API.GetOwnGuild().General.id;
		}

		public void OnDenyMember_ButtonClicked()
		{
			Guild guild = API.GetGuild(guildId);
			if (guild != null)
			{
				API.RemovePlayerApplication(applicant, guild);
				Guilds.SendMessageToPlayer(applicant, Localization.instance.Localize("$guilds_application_declined", new string[1] { guild.Name }));
			}
		}

		public void OnAcceptMember_ButtonClicked()
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			Guild guild = API.GetGuild(guildId);
			if (guild == null)
			{
				return;
			}
			if (Guilds.maximumGuildMembers.Value != 0 && guild.Members.Count >= Guilds.maximumGuildMembers.Value)
			{
				object obj = <>O.<0>__Pop;
				if (obj == null)
				{
					PopupButtonCallback val = UnifiedPopup.Pop;
					<>O.<0>__Pop = val;
					obj = (object)val;
				}
				UnifiedPopup.Push((PopupBase)new WarningPopup("$guilds_guild_full", "$guilds_guild_full_details", (PopupButtonCallback)obj, true));
			}
			else
			{
				API.RemovePlayerApplication(applicant, guild);
				guild = API.GetGuild(guildId);
				if (guild != null)
				{
					API.AddPlayerToGuild(applicant, guild);
					Guilds.SendMessageToPlayer(applicant, Localization.instance.Localize("$guilds_application_accepted", new string[1] { guild.Name }));
				}
			}
		}

		public void OnWhyMe_ButtonClicked()
		{
			((Component)applicationsUI.popupRootRect).gameObject.SetActive(true);
			((TMP_Text)applicationsUI.popupHeaderText).text = applicant.name;
			((TMP_Text)applicationsUI.popupViewportContentBodyText).text = application.description;
		}
	}
	[PublicAPI]
	public class ApplyUI : MonoBehaviour
	{
		public Guild guild;

		[Header("Root Objects")]
		public RectTransform root;

		public Image Background;

		public Image BackgroundBack;

		[Header("Close Button")]
		public Image BackgroundBackButtonImage;

		public Button BackgroundBackButton;

		public TextMeshProUGUI BackgroundBackButtonTextMeshProUGui;

		[Header("Header Area")]
		public RectTransform header;

		public HorizontalLayoutGroup headerHLayoutGroup;

		public Image headerLeftImage;

		public Image headerRightImage;

		public TextMeshProUGUI headerTMP;

		[Header("Content Area")]
		public RectTransform content;

		public HorizontalLayoutGroup contentHLayoutGroup;

		[Header("Content - Text Entry Area")]
		public RectTransform textArea;

		public VerticalLayoutGroup textAreaVLayoutGroup;

		public RectTransform textAreaContainerRect;

		public TMP_InputField textAreaInputField;

		public Image textAreaInputFieldBkg;

		public TextMeshProUGUI textareaInputPlaceholderText;

		public TextMeshProUGUI textAreaInputText;

		[Header("Content - Action Area")]
		public RectTransform actionAreaRect;

		public HorizontalLayoutGroup actionAreaHLayoutGroup;

		public Button actionAreaButtonCancel;

		public Image actionAreaButtonCancelImg;

		public TextMeshProUGUI actionAreaButtonCancelText;

		public Button actionAreaButtonApply;

		public Image actionAreaButtonApplyImg;

		public TextMeshProUGUI actionAreaButtonApplyText;

		public void Setup(Guild guild)
		{
			this.guild = guild;
			((TMP_Text)headerTMP).text = Localization.instance.Localize("$guilds_applyguildui_title", new string[1] { guild.Name });
		}

		public void OnButtonClose_Clicked()
		{
			Interface.HideUI();
		}

		public void OnButtonCancel_Clicked()
		{
			Interface.SwitchUI(Interface.SearchGuildUI);
		}

		public void OnButtonApply_Clicked()
		{
			API.ApplyToGuild(PlayerReference.forOwnPlayer(), textAreaInputField.text, guild);
			Interface.HideUI();
		}

		public void OnTextAreaInputField_ValueChanged()
		{
		}

		public void OnTextAreaInputField_EndEdit()
		{
		}

		public void OnTextAreaInputField_Select()
		{
		}

		public void OnTextAreaInputField_Deselect()
		{
		}
	}
	[PublicAPI]
	public class CreateGuildUI : MonoBehaviour
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static PopupButtonCallback <0>__Pop;
		}

		private int guildIconId;

		[Header("Root Objects")]
		public Canvas canvas;

		public RectTransform root;

		public Image Background;

		public Image BackgroundBack;

		[Header("Close Button")]
		public Image BackgroundBackButtonImage;

		public Button BackgroundBackButton;

		public TextMeshProUGUI BackgroundBackButtonTextMeshProUGui;

		[Header("GuildsColorPicker - Instance")]
		public GameObject guildsColorPicker;

		public RectTransform guildsColorPickerRect;

		public GuildColorPicker guildsColorPickerInstance;

		[Header("Header Area")]
		public RectTransform header;

		public HorizontalLayoutGroup headerHLayoutGroup;

		public Image headerLeftImage;

		public Image headerRightImage;

		public TextMeshProUGUI headerTMP;

		[Header("Content Area")]
		public RectTransform content;

		[Header("Column 1")]
		public RectTransform Col1;

		public VerticalLayoutGroup Col1VLayoutGroup;

		public RectTransform Col1IconContainerRect;

		public Image Col1IconContainerIcon;

		public RectTransform Col1IconContainerIconRect;

		public Image Col1IconContainerBorder;

		public RectTransform Col1IconContainerBorderRect;

		public Button Col1ButtonSelect;

		public Image Col1ButtonSelectImage;

		public TextMeshProUGUI Col1ButtonTMP;

		[Header("Column 2")]
		public RectTransform Col2;

		public VerticalLayoutGroup Col2VLG;

		public RectTransform Col2InputFieldGuildNameRect;

		public TMP_InputField Col2InputFieldGuildName;

		public TextMeshProUGUI Col2InputFieldGuildNamePlaceHolder;

		public TextMeshProUGUI Col2InputFieldGuildNameText;

		public TMP_InputField Col2InputFieldGuildDescription;

		public RectTransform Col2InputFieldGuildDescriptionRect;

		public TextMeshProUGUI Col2InputFieldGuildDescriptionPlaceholder;

		public TextMeshProUGUI Col2InputFieldGuildDescriptionText;

		public RectTransform Col2ButtonCreateRect;

		public Image Col2ButtonCreateImg;

		public Button Col2ButtonCreate;

		public TextMeshProUGUI Col2ButtonCreateTMP;

		public RectTransform Col3;

		public Image Col3Icon;

		public TextMeshProUGUI Col3RequirementsText;

		[Header("GuildIconUI - Instance")]
		public GameObject guildIconUI;

		public RectTransform guildIconUIRect;

		public GuildIconUI guildIconUIInstance;

		public Image guildsColorPlaceholderImg;

		public void Awake()
		{
			Col2InputFieldGuildName.characterValidation = (CharacterValidation)8;
			Col2InputFieldGuildName.inputValidator = (TMP_InputValidator)(object)ScriptableObject.CreateInstance<Tools.NameValidator>();
			((Component)Col3RequirementsText).gameObject.SetActive(false);
			guildsColorPickerInstance.chosenColorPreview = guildsColorPlaceholderImg;
		}

		public void OnButtonClosed_Clicked()
		{
			Interface.HideUI();
		}

		public void OnButtonSelectIcon_Clicked()
		{
			guildIconUIInstance.selectedGuildIcon = delegate(int idx)
			{
				guildIconId = idx;
				Col1IconContainerIcon.sprite = Interface.GuildIcons[idx];
			};
		}

		public void OnButtonCreate_Clicked()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//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_002d: Expected O, but got Unknown
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Expected O, but got Unknown
			//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_00a4: Expected O, but got Unknown
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Expected O, but got Unknown
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Expected O, but got Unknown
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Expected O, but got Unknown
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Expected O, but got Unknown
			if (guildIconId == 0)
			{
				object obj = <>O.<0>__Pop;
				if (obj == null)
				{
					PopupButtonCallback val = UnifiedPopup.Pop;
					<>O.<0>__Pop = val;
					obj = (object)val;
				}
				UnifiedPopup.Push((PopupBase)new WarningPopup("$guilds_no_icon_selected", "$guilds_no_icon_selected_details", (PopupButtonCallback)obj, true));
				return;
			}
			if (Col2InputFieldGuildName.text.Trim().Length > Guilds.maximumGuildNameLength.Value)
			{
				string text = Localization.instance.Localize("$guilds_name_too_long_details", new string[1] { Guilds.maximumGuildNameLength.Value.ToString() });
				object obj2 = <>O.<0>__Pop;
				if (obj2 == null)
				{
					PopupButtonCallback val2 = UnifiedPopup.Pop;
					<>O.<0>__Pop = val2;
					obj2 = (object)val2;
				}
				UnifiedPopup.Push((PopupBase)new WarningPopup("$guilds_name_too_long", text, (PopupButtonCallback)obj2, true));
				return;
			}
			if (Col2InputFieldGuildName.text.Trim().Length < Guilds.minimumGuildNameLength.Value)
			{
				string text2 = Localization.instance.Localize("$guilds_name_too_short_details", new string[1] { Guilds.minimumGuildNameLength.Value.ToString() });
				object obj3 = <>O.<0>__Pop;
				if (obj3 == null)
				{
					PopupButtonCallback val3 = UnifiedPopup.Pop;
					<>O.<0>__Pop = val3;
					obj3 = (object)val3;
				}
				UnifiedPopup.Push((PopupBase)new WarningPopup("$guilds_name_too_short", text2, (PopupButtonCallback)obj3, true));
				return;
			}
			Guild guild = API.CreateGuild(Col2InputFieldGuildName.text.Trim(), PlayerReference.forOwnPlayer());
			if (guild == null)
			{
				object obj4 = <>O.<0>__Pop;
				if (obj4 == null)
				{
					PopupButtonCallback val4 = UnifiedPopup.Pop;
					<>O.<0>__Pop = val4;
					obj4 = (object)val4;
				}
				UnifiedPopup.Push((PopupBase)new WarningPopup("$guilds_name_taken", "$guilds_name_taken_details", (PopupButtonCallback)obj4, true));
			}
			else
			{
				API.RemovePlayerApplication(PlayerReference.forOwnPlayer());
				guild.General.description = Col2InputFieldGuildDescription.text;
				guild.General.icon = guildIconId;
				guild.General.color = guildsColorPickerInstance.chosenColor;
				API.SaveGuild(guild);
				Interface.HideUI();
				Interface.GuildManagementUI.SetActive(true);
			}
		}

		public void OnCol2InputField_GuildName_ValueChanged()
		{
		}

		public void OnCol2InputField_GuildName_EndEdit()
		{
		}

		public void OnCol2InputField_GuildName_Select()
		{
		}

		public void OnCol2InputField_GuildName_Deselect()
		{
		}

		public void OnCol2InputField_GuildDescription_ValueChanged()
		{
		}

		public void OnCol2InputField_GuildDescription_EndEdit()
		{
		}

		public void OnCol2InputField_GuildDescription_Select()
		{
		}

		public void OnCol2InputField_GuildDescription_Deselect()
		{
		}
	}
	[PublicAPI]
	public class EditGuildUI : MonoBehaviour
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static PopupButtonCallback <0>__Pop;
		}

		private int guildIconId;

		[Header("Root Objects")]
		public Canvas canvas;

		public RectTransform root;

		public Image Background;

		public Image BackgroundBack;

		[Header("GuildsColorPicker - Instance")]
		public GameObject guildsColorPicker;

		public RectTransform guildsColorPickerRect;

		public GuildColorPicker guildsColorPickerInstance;

		[Header("Close Button")]
		public Image BackgroundBackButtonImage;

		public Button BackgroundBackButton;

		public TextMeshProUGUI BackgroundBackButtonTextMeshProUGui;

		[Header("Header Area")]
		public RectTransform header;

		public HorizontalLayoutGroup headerHLayoutGroup;

		public Image headerLeftImage;

		public Image headerRightImage;

		public TextMeshProUGUI headerTMP;

		[Header("Content Area")]
		public RectTransform content;

		[Header("Column 1")]
		public RectTransform Col1;

		public VerticalLayoutGroup Col1VLayoutGroup;

		public RectTransform Col1IconContainerRect;

		public Image Col1IconContainerIcon;

		public RectTransform Col1IconContainerIconRect;

		public Image Col1IconContainerBorder;

		public RectTransform Col1IconContainerBorderRect;

		public Button Col1ButtonSelect;

		public Image Col1ButtonSelectImage;

		public TextMeshProUGUI Col1ButtonTMP;

		[Header("Column 2")]
		public RectTransform Col2;

		public VerticalLayoutGroup Col2VLG;

		public RectTransform Col2InputFieldGuildNameRect;

		public TMP_InputField Col2InputFieldGuildName;

		public TextMeshProUGUI Col2InputFieldGuildNamePlaceHolder;

		public TextMeshProUGUI Col2InputFieldGuildNameText;

		public TMP_InputField Col2InputFieldGuildDescription;

		public RectTransform Col2InputFieldGuildDescriptionRect;

		public TextMeshProUGUI Col2InputFieldGuildDescriptionPlaceholder;

		public TextMeshProUGUI Col2InputFieldGuildDescriptionText;

		public RectTransform Col2ButtonEditRect;

		public Image Col2ButtonEditImg;

		public Button Col2ButtonEdit;

		public TextMeshProUGUI Col2ButtonEditTMP;

		public RectTransform Col3;

		public Image Col3Icon;

		public TextMeshProUGUI Col3RequirementsText;

		[Header("GuildIconUI - Instance")]
		public GameObject guildIconUI;

		public RectTransform guildIconUIRect;

		public GuildIconUI guildIconUIInstance;

		public Image guildsColorPlaceholderImg;

		public void Awake()
		{
			Col2InputFieldGuildName.characterValidation = (CharacterValidation)8;
			Col2InputFieldGuildName.inputValidator = (TMP_InputValidator)(object)ScriptableObject.CreateInstance<Tools.NameValidator>();
			((Component)Col3RequirementsText).gameObject.SetActive(false);
			guildsColorPickerInstance.chosenColorPreview = guildsColorPlaceholderImg;
		}

		public void OnEnable()
		{
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			Guild ownGuild = API.GetOwnGuild();
			Col2InputFieldGuildName.text = ownGuild.Name;
			Col2InputFieldGuildDescription.text = ownGuild.General.description;
			Col1IconContainerIcon.sprite = API.GetGuildIcon(ownGuild);
			guildIconId = ownGuild.General.icon;
			guildsColorPickerInstance.chosenColor = ownGuild.General.color;
			Color color = default(Color);
			if (ColorUtility.TryParseHtmlString(guildsColorPickerInstance.chosenColor, ref color))
			{
				((Graphic)guildsColorPlaceholderImg).color = color;
			}
		}

		public void OnButtonClosed_Clicked()
		{
			Interface.HideUI();
		}

		public void OnButtonSelectIcon_Clicked()
		{
			guildIconUIInstance.selectedGuildIcon = delegate(int idx)
			{
				guildIconId = idx;
				Col1IconContainerIcon.sprite = Interface.GuildIcons[idx];
			};
		}

		public void OnButtonEdit_Clicked()
		{
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Expected O, but got Unknown
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Expected O, but got Unknown
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Expected O, but got Unknown
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Expected O, but got Unknown
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Expected O, but got Unknown
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Expected O, but got Unknown
			Guild ownGuild = API.GetOwnGuild();
			if (ownGuild.General.description != Col2InputFieldGuildDescription.text)
			{
				ownGuild.General.description = Col2InputFieldGuildDescription.text;
				API.SaveGuild(ownGuild);
			}
			if (ownGuild.General.icon != guildIconId)
			{
				ownGuild.General.icon = guildIconId;
				API.SaveGuild(ownGuild);
			}
			if (ownGuild.General.color != guildsColorPickerInstance.chosenColor)
			{
				ownGuild.General.color = guildsColorPickerInstance.chosenColor;
				API.SaveGuild(ownGuild);
			}
			if (Col2InputFieldGuildName.text.Trim().Length > Guilds.maximumGuildNameLength.Value)
			{
				string text = Localization.instance.Localize("$guilds_name_too_long_details", new string[1] { Guilds.maximumGuildNameLength.Value.ToString() });
				object obj = <>O.<0>__Pop;
				if (obj == null)
				{
					PopupButtonCallback val = UnifiedPopup.Pop;
					<>O.<0>__Pop = val;
					obj = (object)val;
				}
				UnifiedPopup.Push((PopupBase)new WarningPopup("$guilds_name_too_long", text, (PopupButtonCallback)obj, true));
			}
			else if (Col2InputFieldGuildName.text.Trim().Length < Guilds.minimumGuildNameLength.Value)
			{
				string text2 = Localization.instance.Localize("$guilds_name_too_short_details", new string[1] { Guilds.minimumGuildNameLength.Value.ToString() });
				object obj2 = <>O.<0>__Pop;
				if (obj2 == null)
				{
					PopupButtonCallback val2 = UnifiedPopup.Pop;
					<>O.<0>__Pop = val2;
					obj2 = (object)val2;
				}
				UnifiedPopup.Push((PopupBase)new WarningPopup("$guilds_name_too_short", text2, (PopupButtonCallback)obj2, true));
			}
			else if (ownGuild.Name != Col2InputFieldGuildName.text && !API.RenameGuild(ownGuild, Col2InputFieldGuildName.text.Trim()))
			{
				object obj3 = <>O.<0>__Pop;
				if (obj3 == null)
				{
					PopupButtonCallback val3 = UnifiedPopup.Pop;
					<>O.<0>__Pop = val3;
					obj3 = (object)val3;
				}
				UnifiedPopup.Push((PopupBase)new WarningPopup("$guilds_name_taken", "$guilds_name_taken_details", (PopupButtonCallback)obj3, true));
			}
			else
			{
				Interface.SwitchUI(Interface.GuildManagementUI);
			}
		}

		public void OnCol2InputField_GuildName_ValueChanged()
		{
		}

		public void OnCol2InputField_GuildName_EndEdit()
		{
		}

		public void OnCol2InputField_GuildName_Select()
		{
		}

		public void OnCol2InputField_GuildName_Deselect()
		{
		}

		public void OnCol2InputField_GuildDescription_ValueChanged()
		{
		}

		public void OnCol2InputField_GuildDescription_EndEdit()
		{
		}

		public void OnCol2InputField_GuildDescription_Select()
		{
		}

		public void OnCol2InputField_GuildDescription_Deselect()
		{
		}
	}
	public class GuildColorPicker : MonoBehaviour
	{
		private delegate void ColorEvent(Color c);

		private sealed class HSV
		{
			public double H;

			public double S = 1.0;

			public double V = 1.0;

			private const byte A = byte.MaxValue;

			public HSV()
			{
			}

			public HSV(double h, double s, double v)
			{
				H = h;
				S = s;
				V = v;
			}

			public HSV(Color color)
			{
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_002a: 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_0041: Unknown result type (might be due to invalid IL or missing references)
				//IL_0047: Unknown result type (might be due to invalid IL or missing references)
				//IL_004d: Unknown result type (might be due to invalid IL or missing references)
				//IL_006b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0088: Unknown result type (might be due to invalid IL or missing references)
				//IL_0073: Unknown result type (might be due to invalid IL or missing references)
				//IL_0079: Unknown result type (might be due to invalid IL or missing references)
				//IL_00af: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
				//IL_0095: Unknown result type (might be due to invalid IL or missing references)
				//IL_009b: Unknown result type (might be due to invalid IL or missing references)
				float num = Mathf.Max(color.r, Mathf.Max(color.g, color.b));
				float num2 = Mathf.Min(color.r, Mathf.Min(color.g, color.b));
				float num3 = (float)H;
				if (num2 != num)
				{
					num3 = ((num == color.r) ? ((color.g - color.b) / (num - num2)) : ((num != color.g) ? (4f + (color.r - color.g) / (num - num2)) : (2f + (color.b - color.r) / (num - num2)))) * 60f;
					if (num3 < 0f)
					{
						num3 += 360f;
					}
				}
				H = num3;
				S = ((num == 0f) ? 0.0 : (1.0 - (double)num2 / (double)num));
				V = num;
			}

			public Color32 ToColor()
			{
				//IL_00df: 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_00fd: Unknown result type (might be due to invalid IL or missing references)
				//IL_010c: Unknown result type (might be due to invalid IL or missing references)
				//IL_011b: Unknown result type (might be due to invalid IL or missing references)
				//IL_012a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0132: Unknown result type (might be due to invalid IL or missing references)
				//IL_0138: Unknown result type (might be due to invalid IL or missing references)
				int num = Convert.ToInt32(Math.Floor(H / 60.0)) % 6;
				double num2 = H / 60.0 - Math.Floor(H / 60.0);
				double num3 = V * 255.0;
				byte b = (byte)Convert.ToInt32(num3);
				byte b2 = (byte)Convert.ToInt32(num3 * (1.0 - S));
				byte b3 = (byte)Convert.ToInt32(num3 * (1.0 - num2 * S));
				byte b4 = (byte)Convert.ToInt32(num3 * (1.0 - (1.0 - num2) * S));
				return (Color32)(num switch
				{
					0 => new Color32(b, b4, b2, byte.MaxValue), 
					1 => new Color32(b3, b, b2, byte.MaxValue), 
					2 => new Color32(b2, b, b4, byte.MaxValue), 
					3 => new Color32(b2, b3, b, byte.MaxValue), 
					4 => new Color32(b4, b2, b, byte.MaxValue), 
					5 => new Color32(b, b2, b3, byte.MaxValue), 
					_ => default(Color32), 
				});
			}
		}

		private static GuildColorPicker? self;

		private static bool done = true;

		private static ColorEvent? onCC;

		private static ColorEvent? onCS;

		private static Color32 originalColor;

		private static Color32 modifiedColor;

		private static HSV modifiedHsv = null;

		public string chosenColor = "#000000";

		private bool interact;

		public RectTransform positionIndicator;

		public Slider mainComponent;

		public Slider rComponent;

		public Slider gComponent;

		public Slider bComponent;

		public TMP_InputField hexComponent;

		public RawImage colorComponent;

		public Image chosenColorPreview;

		private void Awake()
		{
			self = this;
		}

		public void OnColorButtonClicked()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			Color original = default(Color);
			ColorUtility.TryParseHtmlString(chosenColor, ref original);
			Create(original, SetColor, ColorFinished);
		}

		private void SetColor(Color currentColor)
		{
		}

		private void ColorFinished(Color finishedColor)
		{
			//IL_0006: 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)
			((Graphic)chosenColorPreview).color = finishedColor;
			chosenColor = "#" + ColorUtility.ToHtmlStringRGBA(finishedColor);
		}

		private static void Create(Color original, ColorEvent onColorChanged, ColorEvent onColorSelected)
		{
			//IL_0015: 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)
			//IL_0020: 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)
			if (self != null)
			{
				if (done)
				{
					done = false;
					originalColor = Color32.op_Implicit(original);
					modifiedColor = Color32.op_Implicit(original);
					onCC = onColorChanged;
					onCS = onColorSelected;
					((Component)self).gameObject.SetActive(true);
					self.RecalculateMenu(recalculateHSV: true);
					((TMP_Text)((Component)self.hexComponent.placeholder).GetComponent<TextMeshProUGUI>()).text = "RRGGBB";
				}
				else
				{
					Done();
				}
			}
		}

		private void RecalculateMenu(bool recalculateHSV)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: 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_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0315: Unknown result type (might be due to invalid IL or missing references)
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			//IL_032a: Unknown result type (might be due to invalid IL or missing references)
			//IL_033f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0344: Unknown result type (might be due to invalid IL or missing references)
			//IL_0359: Unknown result type (might be due to invalid IL or missing references)
			//IL_035e: Unknown result type (might be due to invalid IL or missing references)
			interact = false;
			if (recalculateHSV)
			{
				modifiedHsv = new HSV(Color32.op_Implicit(modifiedColor));
			}
			else
			{
				modifiedColor = modifiedHsv.ToColor();
			}
			rComponent.value = (int)modifiedColor.r;
			((Component)((Component)rComponent).transform.GetChild(3)).GetComponent<TMP_InputField>().text = modifiedColor.r.ToString();
			gComponent.value = (int)modifiedColor.g;
			((Component)((Component)gComponent).transform.GetChild(3)).GetComponent<TMP_InputField>().text = modifiedColor.g.ToString();
			bComponent.value = (int)modifiedColor.b;
			((Component)((Component)bComponent).transform.GetChild(3)).GetComponent<TMP_InputField>().text = modifiedColor.b.ToString();
			mainComponent.value = (float)modifiedHsv.H;
			((Graphic)((Component)((Component)rComponent).transform.GetChild(0)).GetComponent<RawImage>()).color = Color32.op_Implicit(new Color32(byte.MaxValue, modifiedColor.g, modifiedColor.b, byte.MaxValue));
			((Graphic)((Component)((Component)rComponent).transform.GetChild(0).GetChild(0)).GetComponent<RawImage>()).color = Color32.op_Implicit(new Color32((byte)0, modifiedColor.g, modifiedColor.b, byte.MaxValue));
			((Graphic)((Component)((Component)gComponent).transform.GetChild(0)).GetComponent<RawImage>()).color = Color32.op_Implicit(new Color32(modifiedColor.r, byte.MaxValue, modifiedColor.b, byte.MaxValue));
			((Graphic)((Component)((Component)gComponent).transform.GetChild(0).GetChild(0)).GetComponent<RawImage>()).color = Color32.op_Implicit(new Color32(modifiedColor.r, (byte)0, modifiedColor.b, byte.MaxValue));
			((Graphic)((Component)((Component)bComponent).transform.GetChild(0)).GetComponent<RawImage>()).color = Color32.op_Implicit(new Color32(modifiedColor.r, modifiedColor.g, byte.MaxValue, byte.MaxValue));
			((Graphic)((Component)((Component)bComponent).transform.GetChild(0).GetChild(0)).GetComponent<RawImage>()).color = Color32.op_Implicit(new Color32(modifiedColor.r, modifiedColor.g, (byte)0, byte.MaxValue));
			((Graphic)((Component)((Transform)positionIndicator).parent.GetChild(0)).GetComponent<RawImage>()).color = Color32.op_Implicit(new HSV(modifiedHsv.H, 1.0, 1.0).ToColor());
			positionIndicator.anchorMin = new Vector2((float)modifiedHsv.S, (float)modifiedHsv.V);
			positionIndicator.anchorMax = positionIndicator.anchorMin;
			hexComponent.text = ColorUtility.ToHtmlStringRGB(Color32.op_Implicit(modifiedColor));
			((Graphic)colorComponent).color = Color32.op_Implicit(modifiedColor);
			onCC?.Invoke(Color32.op_Implicit(modifiedColor));
			interact = true;
		}

		public void SetChooser()
		{
			//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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: 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_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: 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: 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_0080: Unknown result type (might be due to invalid IL or missing references)
			Transform parent = ((Transform)positionIndicator).parent;
			Vector2 val = default(Vector2);
			RectTransformUtility.ScreenPointToLocalPointInRectangle((RectTransform)(object)((parent is RectTransform) ? parent : null), Vector2.op_Implicit(Input.mousePosition), ((Component)this).GetComponentInParent<Canvas>().worldCamera, ref val);
			val = Rect.PointToNormalized(((RectTransform)((parent is RectTransform) ? parent : null)).rect, val);
			if (positionIndicator.anchorMin != val)
			{
				positionIndicator.anchorMin = val;
				positionIndicator.anchorMax = val;
				modifiedHsv.S = val.x;
				modifiedHsv.V = val.y;
				RecalculateMenu(recalculateHSV: false);
			}
		}

		public void SetMain(float value)
		{
			if (interact)
			{
				modifiedHsv.H = value;
				RecalculateMenu(recalculateHSV: false);
			}
		}

		public void SetR(float value)
		{
			if (interact)
			{
				modifiedColor.r = (byte)value;
				RecalculateMenu(recalculateHSV: true);
			}
		}

		public void SetR(string value)
		{
			if (interact)
			{
				modifiedColor.r = (byte)Mathf.Clamp(int.Parse(value), 0, 255);
				RecalculateMenu(recalculateHSV: true);
			}
		}

		public void SetG(float value)
		{
			if (interact)
			{
				modifiedColor.g = (byte)value;
				RecalculateMenu(recalculateHSV: true);
			}
		}

		public void SetG(string value)
		{
			if (interact)
			{
				modifiedColor.g = (byte)Mathf.Clamp(int.Parse(value), 0, 255);
				RecalculateMenu(recalculateHSV: true);
			}
		}

		public void SetB(float value)
		{
			if (interact)
			{
				modifiedColor.b = (byte)value;
				RecalculateMenu(recalculateHSV: true);
			}
		}

		public void SetB(string value)
		{
			if (interact)
			{
				modifiedColor.b = (byte)Mathf.Clamp(int.Parse(value), 0, 255);
				RecalculateMenu(recalculateHSV: true);
			}
		}

		public void SetHexa(string value)
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: 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_0029: 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)
			if (interact)
			{
				Color val = default(Color);
				if (ColorUtility.TryParseHtmlString("#" + value, ref val))
				{
					val.a = 1f;
					modifiedColor = Color32.op_Implicit(val);
					RecalculateMenu(recalculateHSV: true);
				}
				else
				{
					hexComponent.text = ColorUtility.ToHtmlStringRGB(Color32.op_Implicit(modifiedColor));
				}
			}
		}

		public void CCancel()
		{
			Cancel();
		}

		private static void Cancel()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			modifiedColor = originalColor;
			Done();
		}

		public void CDone()
		{
			Done();
		}

		private static void Done()
		{
			//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_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)
			done = true;
			onCC?.Invoke(Color32.op_Implicit(modifiedColor));
			onCS?.Invoke(Color32.op_Implicit(modifiedColor));
			((Component)((Component)self).transform).gameObject.SetActive(false);
		}
	}
	[PublicAPI]
	public class GuildIconElement : MonoBehaviour
	{
		public Button guildIconButton;

		public RectTransform guildIconButtonRect;

		public Image guildIconBkg;

		public RectTransform guildIconBkgRect;

		public Image guildIcon;

		public RectTransform guildIconRect;

		public GuildIconUI guildIconUI;

		public int guildIconId;

		public void OnGuildIconElement_Clicked()
		{
			guildIconUI.selectedGuildIcon(guildIconId);
			((Component)guildIconUI).gameObject.SetActive(false);
		}
	}
	[PublicAPI]
	public class GuildIconUI : MonoBehaviour
	{
		[Header("Root UI")]
		public RectTransform rootTransform;

		public GameObject rootGameObject;

		public Image backgroundBack;

		public Image background;

		[Header("Header UI")]
		public RectTransform headerTransform;

		public HorizontalLayoutGroup headerHlg;

		public Image headerImageLeft;

		public TextMeshProUGUI headerTextTMP;

		public Image headerImageRight;

		[Header("Close Button UI")]
		public Button buttonClose;

		public Image buttonCloseImage;

		public TextMeshProUGUI buttonCloseText;

		[Header("Content UI")]
		public RectTransform contentTransform;

		public ScrollRect contentScrollRect;

		public Image contentScrollRectImage;

		public Scrollbar guildIconListScroll;

		public Image guildIconListScrollImage;

		public RectTransform guildIconListScrollSlidingArea;

		public RectTransform guildIconListScrollHandle;

		public Image guildIconListScrollHandleImage;

		[Header("Content UI - Guild Icons")]
		public RectTransform guildIconListRoot;

		public GridLayoutGroup guildIconListRootGlg;

		public ContentSizeFitter guildIconListRootSizeFitter;

		[Header("Guild Icon Placeholder")]
		public GameObject guidIconElementPrefab;

		public GuildIconElement guildIconElementPrefabComponent;

		public Button guildIconElementButton;

		public Image guildIconElementButtonImage;

		public Image guildIconElementButtonIconBackground;

		public Image guildIconElementButtonIcon;

		public List<GameObject> guildIconList = new List<GameObject>();

		public Action<int> selectedGuildIcon;

		public void Awake()
		{
			FillTrophyList();
		}

		public void FillTrophyList()
		{
			foreach (KeyValuePair<int, Sprite> guildIcon in Interface.GuildIcons)
			{
				GuildIconElement component = Object.Instantiate<GameObject>(guidIconElementPrefab, (Transform)(object)guildIconListRoot).GetComponent<GuildIconElement>();
				component.guildIcon.sprite = guildIcon.Value;
				((Component)component).gameObject.SetActive(true);
				component.guildIconUI = this;
				component.guildIconId = guildIcon.Key;
			}
		}

		public void OnButtonClosed_Clicked()
		{
			((Component)this).gameObject.SetActive(false);
		}
	}
	[PublicAPI]
	public class GuildManagementUI : MonoBehaviour
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static PopupButtonCallback <0>__Pop;
		}

		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static PopupButtonCallback <>9__80_0;

			public static PopupButtonCallback <>9__80_1;

			internal void <ButtonLeaveGuildClicked>b__80_0()
			{
				API.DeleteGuild(API.GetOwnGuild());
				UnifiedPopup.Pop();
			}

			internal void <ButtonLeaveGuildClicked>b__80_1()
			{
				API.RemovePlayerFromGuild(PlayerReference.forOwnPlayer());
				UnifiedPopup.Pop();
			}
		}

		[Header("Placeholder Variables")]
		public GuildManagementUIRow rowPlaceHolderPrefab;

		public Transform rowPlaceHolderParentList;

		public List<GuildManagementUIRow> rowElements;

		[Header("Root UI")]
		public RectTransform rootTransform;

		public Image backgroundBack;

		public Image background;

		[Header("Header UI")]
		public RectTransform headerTransform;

		public HorizontalLayoutGroup headerHlg;

		public Image headerImageLeft;

		public TextMeshProUGUI headerTextTMP;

		public Image headerImageRight;

		[Header("Close Button UI")]
		public Button buttonClose;

		public Image buttonCloseImage;

		public TextMeshProUGUI buttonCloseText;

		[Header("Content UI")]
		public RectTransform contentTransform;

		public ScrollRect contentScrollRect;

		public Image contentScrollRectImage;

		public RectTransform contentList;

		public VerticalLayoutGroup contentListVlg;

		public ContentSizeFitter contentListSizeFitter;

		[Header("Row Placeholder UI")]
		public RectTransform rowTransform;

		public Image rowBackImage;

		public Image rowBorderImage;

		public HorizontalLayoutGroup contentHlg;

		[Header("Row Content UI - Name Area")]
		public RectTransform nameAreaRect;

		public VerticalLayoutGroup nameAreaVlg;

		public TextMeshProUGUI nameAreaNameTextTMP;

		[Header("Row Content UI - Rank Area")]
		public RectTransform rankArea;

		public VerticalLayoutGroup rankAreaVlg;

		public TMP_Dropdown rankAreaDropdown;

		public Image rankAreaDropdownImage;

		public TextMeshProUGUI rankAreaDropdownLabel;

		public Image rankAreaDropdownArrow;

		public RectTransform rankAreaDropdownTemplate;

		public ScrollRect rankAreaDropdownTemplateScrollRect;

		public Image rankAreaDropdownTemplateScrollRectImage;

		public RectTransform rankAreaDropdownTemplateViewport;

		public Image rankAreaDropdownTemplateViewportImage;

		public RectTransform rankAreaDropdownTemplateContent;

		public RectTransform rankAreaDropdownTemplateItem;

		public Image rankAreaDropdownTemplateItemBackgroundImage;

		public Image rankAreaDropdownTemplateItemCheckmarkImage;

		public TextMeshProUGUI rankAreaDropdownTemplateItemLabel;

		public Scrollbar rankAreaDropdownTemplateScrollbar;

		public Image rankAreaDropdownTemplateScrollbarImage;

		public RectTransform rankAreaDropdownTemplateSlidingAreaRect;

		public RectTransform rankAreaDropdownTemplateHandle;

		public Image rankAreaDropdownTemplateHandleImage;

		[Header("Row Content UI - Online Area")]
		public RectTransform onlineAreaRect;

		public VerticalLayoutGroup onlineAreaVlg;

		public TextMeshProUGUI onlineAreaOnlineStatusTextTMP;

		[Header("Row Content UI - Action Area")]
		public RectTransform actionArea;

		public Button actionAreaRemoveMemberButton;

		public TextMeshProUGUI actionAreaRemoveMemberButtonTextTMP;

		public Image actionAreaRemoveMemberButtonImage;

		[Header("Root UI Global Scrollbar")]
		public Scrollbar scrollbar;

		public RectTransform scrollbarRect;

		public RectTransform scrollbarSlidingArea;

		public RectTransform scrollbarHandle;

		public Image scrollbarHandleImage;

		[Header("Leave Guild Button")]
		public Button leaveGuildButton;

		public Image leaveGuildButtonImage;

		public TextMeshProUGUI leaveGuildButtonText;

		[Header("Achievements Button")]
		public Button achievementsButton;

		public Image achievementsButtonImage;

		public TextMeshProUGUI achievementsButtonText;

		[Header("Edit Guild Button")]
		public Button editGuildButton;

		public Image editGuildButtonImage;

		public TextMeshProUGUI editGuildButtonText;

		[Header("Applications Button")]
		public Button applicationsButton;

		public Image applicationsButtonImage;

		public TextMeshProUGUI applicationsButtonText;

		private List<GuildManagementUIRow> _activeRows = new List<GuildManagementUIRow>();

		private Queue<GuildManagementUIRow> _pooledRows = new Queue<GuildManagementUIRow>();

		public void OnEnable()
		{
			UpdateRows();
			((TMP_Text)headerTextTMP).text = API.GetOwnGuild().Name;
		}

		public void Awake()
		{
			((TMP_Text)headerTextTMP).text = "";
			((Component)rowPlaceHolderPrefab).gameObject.SetActive(false);
		}

		public void UpdateRows()
		{
			if (((Component)this).gameObject.activeSelf)
			{
				if (API.GetOwnGuild() == null)
				{
					Interface.SwitchUI(Interface.NoGuildUI);
					return;
				}
				PopulateRows(API.GetOwnGuild().Members);
				GameObject gameObject = ((Component)applicationsButton).gameObject;
				Ranks playerRank = API.GetPlayerRank(PlayerReference.forOwnPlayer());
				bool active = (uint)playerRank <= 2u;
				gameObject.SetActive(active);
				gameObject = ((Component)editGuildButton).gameObject;
				playerRank = API.GetPlayerRank(PlayerReference.forOwnPlayer());
				active = (uint)playerRank <= 1u;
				gameObject.SetActive(active);
			}
		}

		private void PopulateRows(Dictionary<PlayerReference, GuildMember> members)
		{
			foreach (GuildManagementUIRow activeRow in _activeRows)
			{
				((Component)activeRow).gameObject.SetActive(false);
				_pooledRows.Enqueue(activeRow);
			}
			_activeRows.Clear();
			foreach (KeyValuePair<PlayerReference, GuildMember> member in members)
			{
				GuildManagementUIRow row = GetRow();
				row.Setup(member);
				_activeRows.Add(row);
			}
		}

		private GuildManagementUIRow GetRow()
		{
			GuildManagementUIRow obj = ((_pooledRows.Count > 0) ? _pooledRows.Dequeue() : Object.Instantiate<GameObject>(((Component)rowTransform).gameObject, rowPlaceHolderParentList).GetComponent<GuildManagementUIRow>());
			((Component)obj).gameObject.SetActive(true);
			return obj;
		}

		private void ReturnRowToPool(GuildManagementUIRow row)
		{
			((Component)row).gameObject.SetActive(false);
			_pooledRows.Enqueue(row);
		}

		public void ButtonLeaveGuildClicked()
		{
			//IL_00c0: 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_00cb: Expected O, but got Unknown
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Expected O, but got Unknown
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Expected O, but got Unknown
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected O, but got Unknown
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Expected O, but got Unknown
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Expected O, but got Unknown
			if (API.GetPlayerRank(PlayerReference.forOwnPlayer()) == Ranks.Leader)
			{
				if (API.GetOwnGuild().Members.Count == 1)
				{
					object obj = <>c.<>9__80_0;
					if (obj == null)
					{
						PopupButtonCallback val = delegate
						{
							API.DeleteGuild(API.GetOwnGuild());
							UnifiedPopup.Pop();
						};
						<>c.<>9__80_0 = val;
						obj = (object)val;
					}
					object obj2 = <>O.<0>__Pop;
					if (obj2 == null)
					{
						PopupButtonCallback val2 = UnifiedPopup.Pop;
						<>O.<0>__Pop = val2;
						obj2 = (object)val2;
					}
					UnifiedPopup.Push((PopupBase)new YesNoPopup("$guilds_confirm_deletion", "$guilds_confirm_deletion_details", (PopupButtonCallback)obj, (PopupButtonCallback)obj2, true));
				}
				else
				{
					object obj3 = <>O.<0>__Pop;
					if (obj3 == null)
					{
						PopupButtonCallback val3 = UnifiedPopup.Pop;
						<>O.<0>__Pop = val3;
						obj3 = (object)val3;
					}
					UnifiedPopup.Push((PopupBase)new WarningPopup("$guilds_leader_left", "$guilds_leader_left_details", (PopupButtonCallback)obj3, true));
				}
				return;
			}
			object obj4 = <>c.<>9__80_1;
			if (obj4 == null)
			{
				PopupButtonCallback val4 = delegate
				{
					API.RemovePlayerFromGuild(PlayerReference.forOwnPlayer());
					UnifiedPopup.Pop();
				};
				<>c.<>9__80_1 = val4;
				obj4 = (object)val4;
			}
			object obj5 = <>O.<0>__Pop;
			if (obj5 == null)
			{
				PopupButtonCallback val5 = UnifiedPopup.Pop;
				<>O.<0>__Pop = val5;
				obj5 = (object)val5;
			}
			UnifiedPopup.Push((PopupBase)new YesNoPopup("$guilds_confirm_leave", "$guilds_confirm_leave_details", (PopupButtonCallback)obj4, (PopupButtonCallback)obj5, true));
		}

		public void ButtonEditGuildClicked()
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			if (Guilds.allowGuildEdit.Value == Toggle.Off && !Guilds.configSync.IsAdmin)
			{
				object obj = <>O.<0>__Pop;
				if (obj == null)
				{
					PopupButtonCallback val = UnifiedPopup.Pop;
					<>O.<0>__Pop = val;
					obj = (object)val;
				}
				UnifiedPopup.Push((PopupBase)new WarningPopup("$guilds_edit_disabled", "$guilds_edit_disabled_details", (PopupButtonCallback)obj, true));
			}
			else
			{
				Interface.SwitchUI(Interface.EditGuildUI);
			}
		}

		public void ButtonApplicationsClicked()
		{
			Interface.SwitchUI(Interface.ApplicationsUI);
		}

		public void ButtonCloseClicked()
		{
			Interface.HideUI();
		}

		public void ButtonAchievementsClicked()
		{
			Interface.SwitchUI(Interface.AchievementUI);
		}
	}
	[PublicAPI]
	public class GuildManagementUIRow : MonoBehaviour
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static PopupButtonCallback <0>__Pop;
		}

		public PlayerReference player;

		[Header("Row Root")]
		public RectTransform rowRootTransform;

		public GameObject rowRootGameObject;

		public RectTransform back;

		public Image backImage;

		public Image borderImage;

		[Header("Content Area")]
		public RectTransform contentAreaRectTransform;

		public HorizontalLayoutGroup contentAreaHorizontalLayoutGroup;

		[Header("Name Area")]
		public RectTransform nameAreaTransform;

		public VerticalLayoutGroup nameAreaVerticalLayoutGroup;

		public TextMeshProUGUI nameText;

		[Header("Rank Area")]
		public RectTransform rankAreaTransform;

		public VerticalLayoutGroup rankAreaVerticalLayoutGroup;

		public TMP_Dropdown rankDropdown;

		public Image rankDropdownImage;

		public TextMeshProUGUI rankDropdownLabel;

		public Image rankDropdownArrow;

		public RectTransform rankDropdownTemplate;

		public ScrollRect rankDropdownTemplateScrollRect;

		public Image rankDropdownTemplateScrollRectImage;

		public RectTransform rankDropdownTemplateViewport;

		public Image rankDropdownTemplateViewportImage;

		public RectTransform rankDropdownTemplateContent;

		public RectTransform rankDropdownTemplateItem;

		public Image rankDropdownTemplateItemBackgroundImage;

		public Image rankDropdownTemplateItemCheckmarkImage;

		public TextMeshProUGUI rankDropdownTemplateItemLabel;

		[Header("Rank Dropdown Scrollbar")]
		public RectTransform rankScrollbarTransform;

		public Scrollbar rankScrollbar;

		public Image rankScrollbarImage;

		public RectTransform slidingArea;

		public RectTransform handle;

		public Image handleImage;

		[Header("Online Area")]
		public RectTransform onlineAreaTransform;

		public VerticalLayoutGroup onlineAreaLayoutGroup;

		public RectTransform statusTextTransform;

		public TextMeshProUGUI statusText;

		[Header("Action Area")]
		public RectTransform actionAreaTransform;

		public VerticalLayoutGroup actionAreaLayoutGroup;

		public Button removeMemberButton;

		public Image actionAreaButtonImage;

		public TextMeshProUGUI actionAreaButtonText;

		public void Awake()
		{
			rankDropdown.options = ((IEnumerable<Ranks>)(Ranks[])typeof(Ranks).GetEnumValues()).Select((Func<Ranks, OptionData>)((Ranks rank) => new OptionData(Localization.instance.Localize("$guilds_rank_" + rank.ToString().ToLower())))).ToList();
		}

		public void Setup(KeyValuePair<PlayerReference, GuildMember> memberData)
		{
			((TMP_Text)nameText).text = memberData.Key.name;
			rankDropdown.SetValueWithoutNotify((int)memberData.Value.rank);
			((TMP_Text)statusText).text = (ZNet.instance.m_players.Any((PlayerInfo p) => PlayerReference.fromPlayerInfo(p) == memberData.Key) ? Localization.instance.Localize("$guilds_online") : Localization.instance.Localize("$guilds_last_online", new string[1] { Tools.GetHumanFriendlyTime((int)(DateTime.Now - memberData.Value.lastOnline).TotalSeconds) }));
			player = memberData.Key;
			TMP_Dropdown val = rankDropdown;
			Ranks playerRank = API.GetPlayerRank(PlayerReference.forOwnPlayer());
			bool interactable = (uint)playerRank <= 1u;
			((Selectable)val).interactable = interactable;
			GameObject gameObject = ((Component)removeMemberButton).gameObject;
			playerRank = API.GetPlayerRank(PlayerReference.forOwnPlayer());
			interactable = (uint)playerRank <= 2u;
			gameObject.SetActive(interactable);
		}

		public void OnRemoveMember_ButtonClicked()
		{
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			//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_0037: Expected O, but got Unknown
			//IL_00fe: Expected O, but got Unknown
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Expected O, but got Unknown
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Expected O, but got Unknown
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Expected O, but got Unknown
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Expected O, but got Unknown
			if (player == PlayerReference.forOwnPlayer