using System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using JetBrains.Annotations; using Microsoft.CodeAnalysis; using Splatform; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [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] [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 bool IsLoaded() { return false; } public static Guild? GetPlayerGuild(PlayerReference player) { 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) { return null; } public static Guild? GetGuild(int id) { return null; } public static List GetGuilds() { return new List(); } public static PlayerReference GetGuildLeader(Guild guild) { return guild.Members.FirstOrDefault>((KeyValuePair r) => r.Value.rank == Ranks.Leader).Key; } public static Guild? CreateGuild(string name, PlayerReference leader) { return null; } public static bool DeleteGuild(Guild guild) { return false; } public static bool RenameGuild(Guild guild, string newName) { return true; } public static bool SaveGuild(Guild guild) { return false; } public static bool AddPlayerToGuild(PlayerReference player, Guild guild) { if (GetPlayerGuild(player) == null) { guild.Members.Add(player, new GuildMember()); SaveGuild(guild); return true; } return false; } public static bool RemovePlayerFromGuild(PlayerReference player) { Guild playerGuild = GetPlayerGuild(player); if (playerGuild != null) { playerGuild.Members.Remove(player); SaveGuild(playerGuild); 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 GetOnlinePlayers(Guild? guild = null) { HashSet hashSet = new HashSet(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 null; } 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) { } public static T? GetCustomData(Guild guild) where T : class { return null; } public static void SetCustomData(Guild guild, T customData) where T : class { } public static void IncreaseAchievementProgress(Guild guild, string achievement, float increment = 1f) { } public static void RegisterOnAchievementCompleted(AchievementCompleted callback) { } public static void RegisterAchievement(string name, AchievementConfig config) { } internal static AchievementConfig? GetAchievementConfig(string achievement) { return null; } internal static IEnumerable> AllAchievementConfigs() { return Array.Empty>(); } public static Sprite? GetGuildIcon(Guild guild) { return null; } public static Sprite? GetGuildIconById(int iconId) { return null; } public static int GetAchievementStage(Guild guild, AchievementConfig achievement) { return 0; } public static void RegisterOnGuildJoined(GuildJoined callback) { } public static void RegisterOnGuildLeft(GuildLeft callback) { } public static void RegisterOnGuildCreated(GuildCreated callback) { } public static void RegisterOnGuildDeleted(GuildDeleted callback) { } } [PublicAPI] public class Guild { public string Name = ""; public GuildGeneral General = new GuildGeneral(); public Dictionary Members = new Dictionary(); public Dictionary Applications = new Dictionary(); public Dictionary Achievements = new Dictionary(); public CustomData customData = new CustomData(); } [PublicAPI] public class GuildMember { public Ranks rank = Ranks.Member; public DateTime lastOnline = DateTime.Now; public Dictionary> contribution = new Dictionary>(); } [PublicAPI] public class GuildGeneral { public int id = 0; public string description = ""; public int icon = 1; public int level = 0; 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 completed = new List(); } [PublicAPI] public class CustomData { internal Dictionary data = new Dictionary(); internal Dictionary unknown = new Dictionary(); } [PublicAPI] public class AchievementConfig { public string name = ""; public string description = ""; public List progress = new List { 1f }; public List? guild = null; public List level = new List(); public string icon = ""; public bool first; public Dictionary config = new Dictionary(); public T getConfigValue(string name, T defaultValue = default(T)) { return defaultValue; } } [PublicAPI] [TypeConverter(typeof(PlayerReferenceTypeConverter))] public struct PlayerReference { public string id; public string name; public unsafe static PlayerReference fromPlayerInfo(PlayerInfo playerInfo) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) return new PlayerReference { id = ((object)(*(PlatformUserID*)(&playerInfo.m_userInfo.m_id))/*cast due to .constrained prefix*/).ToString(), name = (playerInfo.m_name ?? "") }; } public static PlayerReference fromPlayer(Player player) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) return ((Object)(object)player == (Object)(object)Player.m_localPlayer) ? forOwnPlayer() : fromPlayerInfo(((IEnumerable)ZNet.instance.m_players).FirstOrDefault((Func)((PlayerInfo info) => info.m_characterID == ((Character)player).GetZDOID()))); } public static PlayerReference forOwnPlayer() { return new PlayerReference { id = ((object)Unsafe.As(ref UserInfo.GetLocalUser().UserId)/*cast due to .constrained prefix*/).ToString(), name = Game.instance.GetPlayerProfile().GetName() }; } public static bool operator !=(PlayerReference a, PlayerReference b) { return !(a == b); } public static bool operator ==(PlayerReference a, PlayerReference b) { return a.id == b.id && a.name == b.name; } public bool Equals(PlayerReference other) { return this == other; } public override bool Equals(object? obj) { return obj is PlayerReference other && Equals(other); } 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] { ':' }); return new PlayerReference { id = array[0], name = array[1] }; } } public class PlayerReferenceTypeConverter : 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 } }