using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Jotunn; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.GUI; using Jotunn.Managers; using Jotunn.Utils; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("SuperVikingKart")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SuperVikingKart")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("688870bc-01cb-4450-aff0-29c44facc3a2")] [assembly: AssemblyFileVersion("0.0.4")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.4.0")] namespace SuperVikingKart; internal enum BuffTarget { Puller, Rider, Both } internal enum BlockType { Buff, Debuff, Mystery } internal enum BuffType { Buff, Debuff } internal class BuffDefinition { public string Name; public string StatusEffect; public BuffTarget Target; public BuffType Type; public BuffDefinition(string name, string statusEffect, BuffTarget target, BuffType type = BuffType.Buff) { Name = name; StatusEffect = statusEffect; Target = target; Type = type; } } internal class BuffBlockComponent : MonoBehaviour { public GameObject Visual; public BlockType BlockType; public GameObject CollectEffectPrefab; private const string ZdoKeyIsActive = "SuperVikingKart_BuffBlockActive"; private ZNetView _netView; private float _respawnTimer; private static readonly BuffDefinition[] Buffs = new BuffDefinition[13] { new BuffDefinition("Speed Boost", "SuperVikingKart_SpeedBoost", BuffTarget.Puller), new BuffDefinition("Stamina Regen", "SuperVikingKart_StaminaRegen", BuffTarget.Puller), new BuffDefinition("Stamina Burst", "SuperVikingKart_StaminaBurst", BuffTarget.Puller), new BuffDefinition("Ooze Bombs", "SuperVikingKart_OozeBombs", BuffTarget.Rider), new BuffDefinition("Bile Bombs", "SuperVikingKart_BileBombs", BuffTarget.Rider), new BuffDefinition("Smoke Bombs", "SuperVikingKart_SmokeBombs", BuffTarget.Rider), new BuffDefinition("Fire Arrows", "SuperVikingKart_FireArrows", BuffTarget.Rider), new BuffDefinition("Harpoon", "SuperVikingKart_Harpoon", BuffTarget.Rider), new BuffDefinition("Berserk", "SuperVikingKart_Berserk", BuffTarget.Rider), new BuffDefinition("Shield", "SuperVikingKart_Shield", BuffTarget.Both), new BuffDefinition("Health Regen", "SuperVikingKart_HealthRegen", BuffTarget.Both), new BuffDefinition("Health Burst", "SuperVikingKart_HealthBurst", BuffTarget.Both), new BuffDefinition("Living Dead", "SuperVikingKart_LivingDead", BuffTarget.Both) }; private static readonly BuffDefinition[] Debuffs = new BuffDefinition[10] { new BuffDefinition("Frost", "SuperVikingKart_Frost", BuffTarget.Puller, BuffType.Debuff), new BuffDefinition("Tarred", "SuperVikingKart_Tarred", BuffTarget.Puller, BuffType.Debuff), new BuffDefinition("Bouncy", "SuperVikingKart_Bounce", BuffTarget.Puller, BuffType.Debuff), new BuffDefinition("Poison", "SuperVikingKart_Poison", BuffTarget.Rider, BuffType.Debuff), new BuffDefinition("Burning", "SuperVikingKart_Burn", BuffTarget.Rider, BuffType.Debuff), new BuffDefinition("Stagger", "SuperVikingKart_Stagger", BuffTarget.Rider, BuffType.Debuff), new BuffDefinition("Disarm", "SuperVikingKart_Disarm", BuffTarget.Rider, BuffType.Debuff), new BuffDefinition("Weak", "SuperVikingKart_Weak", BuffTarget.Both, BuffType.Debuff), new BuffDefinition("Shock", "SuperVikingKart_Shock", BuffTarget.Both, BuffType.Debuff), new BuffDefinition("Blind", "SuperVikingKart_Blind", BuffTarget.Both, BuffType.Debuff) }; public static readonly BuffDefinition[] AllEffects = Buffs.Concat(Debuffs).ToArray(); private BuffDefinition[] ActiveEffects => BlockType switch { BlockType.Buff => Buffs, BlockType.Debuff => Debuffs, BlockType.Mystery => AllEffects, _ => Buffs, }; private void Awake() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) _netView = ((Component)this).GetComponent(); if (!Object.op_Implicit((Object)(object)_netView) || _netView.GetZDO() == null) { SuperVikingKart.DebugLog("BuffBlock Awake - no ZNetView or ZDO, disabling"); ((Behaviour)this).enabled = false; return; } SuperVikingKart.DebugLog($"BuffBlock Awake - ZDO: {_netView.GetZDO().m_uid}, Owner: {_netView.IsOwner()}"); _netView.Register("SuperVikingKart_RPC_RequestCollection", (Action)RPC_RequestCollection); _netView.Register("SuperVikingKart_RPC_BuffBlockCollected", (Action)RPC_BuffBlockCollected); _netView.Register("SuperVikingKart_RPC_BuffBlockRespawn", (Action)RPC_BuffBlockRespawn); _netView.Register("SuperVikingKart_RPC_ApplyBuff", (Action)RPC_ApplyBuff); bool @bool = _netView.GetZDO().GetBool("SuperVikingKart_BuffBlockActive", true); SuperVikingKart.DebugLog($"BuffBlock Awake - IsActive: {@bool}"); SetVisual(@bool); } private void Update() { if (_netView.IsOwner() && !IsActive()) { _respawnTimer -= Time.deltaTime; if (_respawnTimer <= 0f) { SuperVikingKart.DebugLog("BuffBlock - Respawn timer expired, sending respawn RPC"); _netView.InvokeRPC(ZNetView.Everybody, "SuperVikingKart_RPC_BuffBlockRespawn", Array.Empty()); } } } public void OnBuffBlockTriggerEnter(Collider other) { //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0193: 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) SuperVikingKart.DebugLog("BuffBlock trigger entered by: " + ((Object)other).name + " (parent: " + ((Object)((Component)other).transform.root).name + ")"); Player localPlayer = Player.m_localPlayer; if (!Object.op_Implicit((Object)(object)localPlayer)) { SuperVikingKart.DebugLog("BuffBlock - No local player"); return; } SuperVikingKartComponent componentInParent = ((Component)other).GetComponentInParent(); if (!Object.op_Implicit((Object)(object)componentInParent)) { SuperVikingKart.DebugLog("BuffBlock - No kart found on collider"); return; } if (!Object.op_Implicit((Object)(object)componentInParent.GetVagon())) { SuperVikingKart.DebugLog("BuffBlock - No vagon found on kart"); return; } Player puller = componentInParent.GetPuller(); SuperVikingKart.DebugLog("BuffBlock - Puller: " + (((puller != null) ? puller.GetPlayerName() : null) ?? "none") + ", LocalPlayer: " + localPlayer.GetPlayerName()); if ((Object)(object)puller != (Object)(object)localPlayer) { SuperVikingKart.DebugLog("BuffBlock - Local player is not the puller, ignoring"); return; } ZNetView componentInParent2 = ((Component)componentInParent).GetComponentInParent(); if (!Object.op_Implicit((Object)(object)componentInParent2)) { SuperVikingKart.DebugLog("BuffBlock - No ZNetView on kart"); return; } ZDOID uid = componentInParent2.GetZDO().m_uid; BuffDefinition[] array = ((componentInParent.GetRiderZDOID() == ZDOID.None) ? ActiveEffects.Where((BuffDefinition b) => b.Target == BuffTarget.Puller || b.Target == BuffTarget.Both).ToArray() : ActiveEffects); if (array.Length == 0) { SuperVikingKart.DebugLog("BuffBlock - No valid effects for current kart state, aborting"); return; } BuffDefinition value = array[Random.Range(0, array.Length)]; int num = Array.IndexOf(ActiveEffects, value); SuperVikingKart.DebugLog($"BuffBlock - Requesting collection! Effect: {ActiveEffects[num].Name} (index: {num}), kartId: {uid}"); _netView.InvokeRPC("SuperVikingKart_RPC_RequestCollection", new object[2] { num, uid }); } private void RPC_RequestCollection(long sender, int buffIndex, ZDOID kartId) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) SuperVikingKart.DebugLog($"BuffBlock RPC_RequestCollection - sender: {sender}, buffIndex: {buffIndex}, kartId: {kartId}, IsOwner: {_netView.IsOwner()}"); if (_netView.IsOwner()) { if (!IsActive()) { SuperVikingKart.DebugLog("BuffBlock RPC_RequestCollection - Already collected, rejecting"); return; } _netView.GetZDO().Set("SuperVikingKart_BuffBlockActive", false); _respawnTimer = SuperVikingKart.BuffBlockRespawnTimeConfig.Value; _netView.InvokeRPC(ZNetView.Everybody, "SuperVikingKart_RPC_ApplyBuff", new object[2] { buffIndex, kartId }); _netView.InvokeRPC(ZNetView.Everybody, "SuperVikingKart_RPC_BuffBlockCollected", new object[1] { buffIndex }); } } private void RPC_ApplyBuff(long sender, int buffIndex, ZDOID kartId) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) SuperVikingKart.DebugLog($"BuffBlock RPC_ApplyBuff - sender: {sender}, buffIndex: {buffIndex}, kartId: {kartId}"); BuffDefinition[] activeEffects = ActiveEffects; if (buffIndex < 0 || buffIndex >= activeEffects.Length) { Logger.LogWarning((object)$"BuffBlock RPC_ApplyBuff - Invalid buff index: {buffIndex}"); return; } Player localPlayer = Player.m_localPlayer; if (!Object.op_Implicit((Object)(object)localPlayer)) { SuperVikingKart.DebugLog("BuffBlock RPC_ApplyBuff - No local player"); return; } GameObject val = ZNetScene.instance.FindInstance(kartId); if (!Object.op_Implicit((Object)(object)val)) { SuperVikingKart.DebugLog($"BuffBlock RPC_ApplyBuff - Kart not found for ZDOID: {kartId}"); return; } SuperVikingKartComponent componentInChildren = val.GetComponentInChildren(); if (!Object.op_Implicit((Object)(object)componentInChildren)) { SuperVikingKart.DebugLog("BuffBlock RPC_ApplyBuff - No SuperVikingKartComponent on kart"); return; } Vagon vagon = componentInChildren.GetVagon(); if (!Object.op_Implicit((Object)(object)vagon)) { SuperVikingKart.DebugLog("BuffBlock RPC_ApplyBuff - No vagon on kart"); return; } BuffDefinition buffDefinition = activeEffects[buffIndex]; bool flag = vagon.IsAttached((Character)(object)localPlayer); bool flag2 = (Object)(object)componentInChildren.GetRider() == (Object)(object)localPlayer; SuperVikingKart.DebugLog($"BuffBlock RPC_ApplyBuff - Player: {localPlayer.GetPlayerName()}, IsPuller: {flag}, IsRider: {flag2}, BuffTarget: {buffDefinition.Target}"); string text = buffDefinition.Target switch { BuffTarget.Puller => "Puller", BuffTarget.Rider => "Rider", BuffTarget.Both => "Both", _ => "Unknown", }; string text2 = ((buffDefinition.Type == BuffType.Debuff) ? "Oh no" : "Yeah"); switch (buffDefinition.Target) { case BuffTarget.Puller: if (flag) { ApplyToPlayer(localPlayer, buffDefinition); } if (flag || flag2) { ((Character)localPlayer).Message((MessageType)2, text2 + "! " + buffDefinition.Name + " for " + text + "!", 0, (Sprite)null); } break; case BuffTarget.Rider: if (flag2) { ApplyToPlayer(localPlayer, buffDefinition); } if (flag || flag2) { ((Character)localPlayer).Message((MessageType)2, text2 + "! " + buffDefinition.Name + " for " + text + "!", 0, (Sprite)null); } break; case BuffTarget.Both: if (flag || flag2) { ApplyToPlayer(localPlayer, buffDefinition); ((Character)localPlayer).Message((MessageType)2, text2 + "! " + buffDefinition.Name + " for " + text + "!", 0, (Sprite)null); } break; } } private void ApplyToPlayer(Player player, BuffDefinition buff) { if (Object.op_Implicit((Object)(object)player)) { StatusEffect statusEffect = ObjectDB.instance.GetStatusEffect(StringExtensionMethods.GetStableHashCode(buff.StatusEffect)); if ((Object)(object)statusEffect == (Object)null) { Logger.LogWarning((object)("BuffBlock ApplyToPlayer - Could not find status effect: " + buff.StatusEffect)); return; } SuperVikingKart.DebugLog("BuffBlock ApplyToPlayer - Applying " + buff.Name + " (" + buff.StatusEffect + ") to " + player.GetPlayerName()); ((Character)player).GetSEMan().AddStatusEffect(statusEffect, true, 0, 0f); } } private bool IsActive() { ZDO zDO = _netView.GetZDO(); if (zDO == null) { return false; } return zDO.GetBool("SuperVikingKart_BuffBlockActive", true); } private void SetVisual(bool active) { if (Object.op_Implicit((Object)(object)Visual)) { Visual.SetActive(active); } } private void RPC_BuffBlockCollected(long sender, int buffIndex) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) SuperVikingKart.DebugLog($"BuffBlock RPC_BuffBlockCollected - sender: {sender}, buffIndex: {buffIndex}, IsOwner: {_netView.IsOwner()}"); if (Object.op_Implicit((Object)(object)CollectEffectPrefab)) { Object.Instantiate(CollectEffectPrefab, Visual.transform.position, Quaternion.identity); } SetVisual(active: false); } private void RPC_BuffBlockRespawn(long sender) { SuperVikingKart.DebugLog($"BuffBlock RPC_BuffBlockRespawn - sender: {sender}, IsOwner: {_netView.IsOwner()}"); if (_netView.IsOwner()) { _netView.GetZDO().Set("SuperVikingKart_BuffBlockActive", true); } SetVisual(active: true); } } internal class BuffBlockTrigger : MonoBehaviour { public BuffBlockComponent BuffBlock; private readonly HashSet _seen = new HashSet(); private void OnTriggerEnter(Collider other) { if (_seen.Add(other) && Object.op_Implicit((Object)(object)BuffBlock)) { BuffBlock.OnBuffBlockTriggerEnter(other); } } private void OnDisable() { _seen.Clear(); } } internal class BuffBlockSpin : MonoBehaviour { public float RotationSpeed = 50f; public float BobSpeed = 2f; public float BobHeight = 0.15f; private Vector3 _startPosition; private void Start() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) _startPosition = ((Component)this).transform.localPosition; } private void Update() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.Rotate(Vector3.up, RotationSpeed * Time.deltaTime); float num = Mathf.Sin(Time.time * BobSpeed) * BobHeight; ((Component)this).transform.localPosition = _startPosition + Vector3.up * num; } } internal static class Commands { public static void Register() { CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new ForceBuffCommand()); CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new RaceCommand()); CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new RaceAdminCommand()); } } internal class ForceBuffCommand : ConsoleCommand { public override string Name => "svk_buff"; public override string Help => "Force a specific buff. Usage: svk_buff or svk_buff list"; public override bool IsCheat => true; public override List CommandOptionList() { List list = new List { "list" }; BuffDefinition[] allEffects = BuffBlockComponent.AllEffects; foreach (BuffDefinition buffDefinition in allEffects) { list.Add(buffDefinition.Name); } return list; } public override void Run(string[] args, Terminal context) { if (args.Length == 0) { context.AddString("Usage: svk_buff or svk_buff list"); return; } Player localPlayer = Player.m_localPlayer; if (!Object.op_Implicit((Object)(object)localPlayer)) { context.AddString("No local player"); return; } BuffDefinition[] allEffects; if (args[0].ToLower() == "list") { context.AddString("Available effects:"); allEffects = BuffBlockComponent.AllEffects; foreach (BuffDefinition buffDefinition in allEffects) { context.AddString($" {buffDefinition.Name} ({buffDefinition.StatusEffect}) - {buffDefinition.Target} {buffDefinition.Type}"); } return; } string text = string.Join(" ", args).ToLower(); BuffDefinition buffDefinition2 = null; allEffects = BuffBlockComponent.AllEffects; foreach (BuffDefinition buffDefinition3 in allEffects) { if (buffDefinition3.Name.ToLower() == text || buffDefinition3.StatusEffect.ToLower() == text) { buffDefinition2 = buffDefinition3; break; } } if (buffDefinition2 == null) { context.AddString("Effect '" + text + "' not found. Use 'svk_buff list' to see available effects."); return; } StatusEffect statusEffect = ObjectDB.instance.GetStatusEffect(StringExtensionMethods.GetStableHashCode(buffDefinition2.StatusEffect)); if ((Object)(object)statusEffect == (Object)null) { context.AddString("Status effect '" + buffDefinition2.StatusEffect + "' not found in ObjectDB"); return; } ((Character)localPlayer).GetSEMan().AddStatusEffect(statusEffect, true, 0, 0f); context.AddString($"Applied {buffDefinition2.Name} ({buffDefinition2.Type}) to {localPlayer.GetPlayerName()}"); } } internal class RaceCommand : ConsoleCommand { private Terminal _context; public override string Name => "svk_race"; public override string Help => "Race participation. Usage: svk_race [args]"; public override List CommandOptionList() { List list = new List { "register", "leave", "start", "reset", "results", "list" }; foreach (Race allRace in RaceManager.GetAllRaces()) { list.Add(allRace.RaceId); } return list; } public override void Run(string[] args, Terminal context) { _context = context; if (args.Length == 0) { PrintUsage(); return; } Player localPlayer = Player.m_localPlayer; if (!Object.op_Implicit((Object)(object)localPlayer)) { context.AddString("No local player"); return; } switch (args[0].ToLower()) { case "list": ListRaces(); break; case "register": if (args.Length < 2) { context.AddString("Usage: svk_race register "); } else { RegisterPlayer(localPlayer, args[1]); } break; case "leave": if (args.Length < 2) { context.AddString("Usage: svk_race leave "); } else { LeaveRace(localPlayer, args[1]); } break; case "start": if (args.Length < 2) { context.AddString("Usage: svk_race start "); } else { StartRace(args[1]); } break; case "reset": if (args.Length < 2) { context.AddString("Usage: svk_race reset "); } else { ResetRace(args[1]); } break; case "results": if (args.Length < 2) { context.AddString("Usage: svk_race results "); } else { ShowResults(args[1]); } break; default: RegisterPlayer(localPlayer, args[0]); break; } } private void PrintUsage() { _context.AddString("Usage: svk_race [args]"); _context.AddString(" list - List all races"); _context.AddString(" register - Register for a race"); _context.AddString(" leave - Leave a race"); _context.AddString(" start - Start countdown"); _context.AddString(" reset - Reset a race"); _context.AddString(" results - Show results"); _context.AddString(" - Shorthand for register"); } private void ListRaces() { int num = 0; foreach (Race allRace in RaceManager.GetAllRaces()) { _context.AddString($" [{allRace.RaceId}] \"{allRace.Name}\" State: {allRace.State}, Contestants: {allRace.Contestants.Count}"); num++; } if (num == 0) { _context.AddString("No active races"); } } private void RegisterPlayer(Player player, string raceId) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) Race race = RaceManager.GetRace(raceId); if (race == null) { _context.AddString("Race [" + raceId + "] not found"); return; } if (race.State != 0) { _context.AddString("Race [" + raceId + "] is already underway"); return; } if (race.IsRegistered(((Character)player).GetZDOID())) { _context.AddString("Already registered for [" + raceId + "]"); return; } RaceManager.SendRegister(raceId, player.GetPlayerName(), ((Character)player).GetZDOID()); _context.AddString("Registered for [" + raceId + "]"); } private void LeaveRace(Player player, string raceId) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) Race race = RaceManager.GetRace(raceId); if (race == null) { _context.AddString("Race [" + raceId + "] not found"); return; } if (!race.IsRegistered(((Character)player).GetZDOID())) { _context.AddString("Not registered for [" + raceId + "]"); return; } if (race.State == RaceState.Countdown) { _context.AddString("Cannot leave [" + raceId + "] during countdown"); return; } if (race.State == RaceState.Finished) { _context.AddString("Race [" + raceId + "] is already finished"); return; } RaceManager.SendUnregister(raceId, ((Character)player).GetZDOID()); _context.AddString((race.State == RaceState.Racing) ? ("Left race [" + raceId + "] - DNF") : ("Left race [" + raceId + "]")); } private void StartRace(string raceId) { Race race = RaceManager.GetRace(raceId); if (race == null) { _context.AddString("Race [" + raceId + "] not found"); return; } if (race.State != 0) { _context.AddString($"Race [{raceId}] is not idle (State: {race.State})"); return; } if (race.Contestants.Count == 0) { _context.AddString("Race [" + raceId + "] has no contestants"); return; } RaceManager.SendStartCountdown(raceId); _context.AddString("Race [" + raceId + "] countdown started"); } private void ResetRace(string raceId) { if (RaceManager.GetRace(raceId) == null) { _context.AddString("Race [" + raceId + "] not found"); return; } RaceManager.SendReset(raceId); _context.AddString("Race [" + raceId + "] reset"); } private void ShowResults(string raceId) { Race race = RaceManager.GetRace(raceId); if (race == null) { _context.AddString("Race [" + raceId + "] not found"); } else { _context.AddString(race.GetResultsText()); } } } internal class RaceAdminCommand : ConsoleCommand { private Terminal _context; public override string Name => "svk_race_admin"; public override string Help => "Admin race management. Usage: svk_race_admin [args]"; public override bool IsCheat => true; public override List CommandOptionList() { return new List { "create", "remove", "addplayer", "setname", "setlaps", "forcestart", "forcereset", "checkpoint", "lap", "finish", "state" }; } public override void Run(string[] args, Terminal context) { _context = context; if (args.Length == 0) { PrintUsage(); return; } switch (args[0].ToLower()) { case "create": { if (args.Length < 2) { context.AddString("Usage: svk_race_admin create [laps] [name]"); break; } int result; int laps = ((args.Length <= 2 || !int.TryParse(args[2], out result)) ? 1 : result); string name = ((args.Length > 3) ? string.Join(" ", args, 3, args.Length - 3) : null); CreateRace(args[1], name, laps); break; } case "remove": if (args.Length < 2) { context.AddString("Usage: svk_race_admin remove "); } else { RemoveRace(args[1]); } break; case "addplayer": if (args.Length < 3) { context.AddString("Usage: svk_race_admin addplayer "); } else { AddPlayer(args[1], args[2]); } break; case "setname": if (args.Length < 3) { context.AddString("Usage: svk_race_admin setname "); } else { SetName(args[1], string.Join(" ", args, 2, args.Length - 2)); } break; case "setlaps": if (args.Length < 3) { context.AddString("Usage: svk_race_admin setlaps "); } else { SetLaps(args[1], args[2]); } break; case "setdescription": if (args.Length < 3) { context.AddString("Usage: svk_race_admin setdescription "); } else { SetDescription(args[1], string.Join(" ", args, 2, args.Length - 2)); } break; case "forcestart": if (args.Length < 2) { context.AddString("Usage: svk_race_admin forcestart "); } else { ForceStart(args[1]); } break; case "forcereset": if (args.Length < 2) { context.AddString("Usage: svk_race_admin forcereset "); } else { ForceReset(args[1]); } break; case "checkpoint": if (args.Length < 3) { context.AddString("Usage: svk_race_admin checkpoint [playerName]"); } else { SimulateCheckpoint(args); } break; case "lap": if (args.Length < 2) { context.AddString("Usage: svk_race_admin lap [playerName]"); } else { SimulateLap(args); } break; case "finish": if (args.Length < 2) { context.AddString("Usage: svk_race_admin finish [playerName]"); } else { SimulateFinish(args); } break; case "state": if (args.Length < 2) { context.AddString("Usage: svk_race_admin state "); } else { ShowState(args[1]); } break; default: PrintUsage(); break; } } private void PrintUsage() { _context.AddString("Usage: svk_race_admin [args]"); _context.AddString(" create - Create a new race"); _context.AddString(" remove - Remove a race"); _context.AddString(" addplayer - Add a player by name"); _context.AddString(" setname - Rename a race"); _context.AddString(" setlaps - Set lap count"); _context.AddString(" setdescription - Set lap count"); _context.AddString(" forcestart - Start race regardless of state"); _context.AddString(" forcereset - Reset race regardless of state"); _context.AddString(" lap [playerName] - Simulate a lap completion"); _context.AddString(" finish [playerName] - Simulate finishing all laps"); _context.AddString(" state - Show detailed race state"); } private void CreateRace(string raceId, string name = null, int laps = 1) { if (RaceManager.GetRace(raceId) != null) { _context.AddString("Race [" + raceId + "] already exists"); return; } string text = (string.IsNullOrEmpty(name) ? raceId : name); RaceManager.SendCreateRace(raceId, text, laps); _context.AddString($"Race [{raceId}] created - \"{text}\" ({laps} laps)"); } private void RemoveRace(string raceId) { if (RaceManager.GetRace(raceId) == null) { _context.AddString("Race [" + raceId + "] not found"); return; } RaceManager.SendRemoveRace(raceId); _context.AddString("Race [" + raceId + "] removed"); } private void AddPlayer(string raceId, string playerName) { //IL_007f: 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) Race race = RaceManager.GetRace(raceId); if (race == null) { _context.AddString("Race [" + raceId + "] not found"); return; } if (race.State != 0) { _context.AddString($"Race [{raceId}] is not idle (State: {race.State})"); return; } Player val = FindPlayerByName(playerName); if ((Object)(object)val == (Object)null) { _context.AddString("Player '" + playerName + "' not found"); return; } if (race.IsRegistered(((Character)val).GetZDOID())) { _context.AddString("Player '" + playerName + "' already registered"); return; } RaceManager.SendRegister(raceId, val.GetPlayerName(), ((Character)val).GetZDOID()); _context.AddString("Added " + val.GetPlayerName() + " to [" + raceId + "]"); } private void SetName(string raceId, string name) { if (RaceManager.GetRace(raceId) == null) { _context.AddString("Race [" + raceId + "] not found"); return; } RaceManager.SendSetName(raceId, name); _context.AddString("Race [" + raceId + "] renamed to \"" + name + "\""); } private void SetLaps(string raceId, string countStr) { if (!int.TryParse(countStr, out var result) || result < 1) { _context.AddString("Invalid lap count"); return; } if (RaceManager.GetRace(raceId) == null) { _context.AddString("Race [" + raceId + "] not found"); return; } RaceManager.SendSetLaps(raceId, result); _context.AddString($"Race [{raceId}] laps set to {result}"); } private void SetDescription(string raceId, string description) { if (RaceManager.GetRace(raceId) == null) { _context.AddString("Race [" + raceId + "] not found"); return; } RaceManager.SendSetDescription(raceId, description); _context.AddString("Race [" + raceId + "] description set to \"" + description + "\""); } private void ForceStart(string raceId) { Race race = RaceManager.GetRace(raceId); if (race == null) { _context.AddString("Race [" + raceId + "] not found"); return; } if (race.Contestants.Count == 0) { _context.AddString("Race [" + raceId + "] has no contestants"); return; } RaceManager.SendState(raceId, RaceState.Idle); RaceManager.SendStartCountdown(raceId); _context.AddString("Race [" + raceId + "] force started"); } private void ForceReset(string raceId) { if (RaceManager.GetRace(raceId) == null) { _context.AddString("Race [" + raceId + "] not found"); return; } RaceManager.SendState(raceId, RaceState.Finished); RaceManager.SendReset(raceId); _context.AddString("Race [" + raceId + "] force reset"); } private void SimulateCheckpoint(string[] args) { //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) string text = args[1]; Race race = RaceManager.GetRace(text); if (race == null) { _context.AddString("Race [" + text + "] not found"); return; } if (race.State != RaceState.Racing) { _context.AddString($"Race [{text}] is not racing (State: {race.State})"); return; } if (!int.TryParse(args[2], out var result) || result < 0) { _context.AddString("Invalid checkpoint index"); return; } Player val = ((args.Length > 3) ? FindPlayerByName(args[3]) : Player.m_localPlayer); if ((Object)(object)val == (Object)null) { _context.AddString((args.Length > 3) ? ("Player '" + args[3] + "' not found") : "No local player"); return; } RaceContestant contestant = race.GetContestant(((Character)val).GetZDOID()); if (contestant == null) { _context.AddString("Player '" + val.GetPlayerName() + "' not in race [" + text + "]"); } else if (contestant.Finished) { _context.AddString("Player '" + val.GetPlayerName() + "' already finished"); } else { RaceManager.SendCheckpoint(text, ((Character)val).GetZDOID(), result); _context.AddString($"Checkpoint {result} recorded for {val.GetPlayerName()}"); } } private void SimulateLap(string[] args) { //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) string text = args[1]; Race race = RaceManager.GetRace(text); if (race == null) { _context.AddString("Race [" + text + "] not found"); return; } if (race.State != RaceState.Racing) { _context.AddString($"Race [{text}] is not racing (State: {race.State})"); return; } Player val = ((args.Length > 2) ? FindPlayerByName(args[2]) : Player.m_localPlayer); if ((Object)(object)val == (Object)null) { _context.AddString((args.Length > 2) ? ("Player '" + args[2] + "' not found") : "No local player"); return; } RaceContestant contestant = race.GetContestant(((Character)val).GetZDOID()); if (contestant == null) { _context.AddString("Player '" + val.GetPlayerName() + "' not in race [" + text + "]"); } else if (contestant.Finished) { _context.AddString("Player '" + val.GetPlayerName() + "' already finished"); } else { RaceManager.SendLap(text, ((Character)val).GetZDOID()); _context.AddString("Lap recorded for " + val.GetPlayerName()); } } private void SimulateFinish(string[] args) { //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) string text = args[1]; Race race = RaceManager.GetRace(text); if (race == null) { _context.AddString("Race [" + text + "] not found"); return; } if (race.State != RaceState.Racing) { _context.AddString($"Race [{text}] is not racing (State: {race.State})"); return; } Player val = ((args.Length > 2) ? FindPlayerByName(args[2]) : Player.m_localPlayer); if ((Object)(object)val == (Object)null) { _context.AddString((args.Length > 2) ? ("Player '" + args[2] + "' not found") : "No local player"); return; } RaceContestant contestant = race.GetContestant(((Character)val).GetZDOID()); if (contestant == null) { _context.AddString("Player '" + val.GetPlayerName() + "' not in race [" + text + "]"); } else if (contestant.Finished) { _context.AddString("Player '" + val.GetPlayerName() + "' already finished"); } else { int num = race.TotalLaps - contestant.CurrentLap; for (int i = 0; i < num; i++) { RaceManager.SendLap(text, ((Character)val).GetZDOID()); } _context.AddString($"Finished {val.GetPlayerName()} ({num} laps sent)"); } } private void ShowState(string raceId) { //IL_0224: Unknown result type (might be due to invalid IL or missing references) Race race = RaceManager.GetRace(raceId); if (race == null) { _context.AddString("Race [" + raceId + "] not found"); return; } _context.AddString("Race [" + race.RaceId + "] \"" + race.Name + "\""); _context.AddString($" State: {race.State}"); _context.AddString($" Laps: {race.TotalLaps}"); _context.AddString($" Contestants: {race.Contestants.Count}"); if (race.State == RaceState.Racing) { _context.AddString(" Elapsed: " + RaceUtils.FormatTime(ZNet.instance.m_netTime - race.RaceStartTime)); } foreach (RaceContestant item in race.GetLiveRanking()) { string arg2; if (item.IsDnf) { string arg = ((item.LastCheckpointIndex > 0) ? $", CP {item.LastCheckpointIndex}" : ""); arg2 = $"DNF - Lap {item.CurrentLap}/{race.TotalLaps}{arg}"; } else if (item.Finished) { arg2 = $"P{item.Position} - {RaceUtils.FormatTime(item.FinishTime)}"; } else if (race.State == RaceState.Racing) { string text = ((item.LastCheckpointIndex > 0) ? $", CP {item.LastCheckpointIndex}" : ""); arg2 = $"Lap {item.CurrentLap}/{race.TotalLaps}{text} ({RaceUtils.FormatTime(item.LastCheckpointTime)})"; } else { arg2 = "Registered"; } _context.AddString($" {item.PlayerName} ({item.PlayerId}): {arg2}"); } } private Player FindPlayerByName(string name) { string value = name.ToLower(); foreach (Player allPlayer in Player.GetAllPlayers()) { if (allPlayer.GetPlayerName().ToLower().Contains(value)) { return allPlayer; } } return null; } } internal static class KartPiece { public static void CloneCart() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) PieceConfig val = new PieceConfig(); val.Name = "Super Viking Kart"; val.Description = "Mountable cart. Get ready to race."; val.PieceTable = PieceTables.Hammer; val.Category = PieceCategories.Misc; val.Requirements = (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("Wood", 4, 0, true) }; CustomPiece val2 = new CustomPiece("SuperVikingKart", "Cart", val); val2.Piece.m_canBeRemoved = true; PieceManager.Instance.AddPiece(val2); Transform transform = val2.PiecePrefab.transform; Object.DestroyImmediate((Object)(object)((Component)transform.Find("load")).gameObject); GameObject val3 = new GameObject("AttachPointPlayer"); val3.transform.SetParent(transform, false); val3.transform.SetAsFirstSibling(); val3.transform.localPosition = Vector3.up * 0.5f; GameObject gameObject = ((Component)transform.Find("Container")).gameObject; Object.DestroyImmediate((Object)(object)gameObject.GetComponent()); gameObject.AddComponent().AttachPoint = val3.transform; SuperVikingKart.DebugLog("SuperVikingKart prefab registered"); } } internal static class BuffBlockPieces { public static void CreateBuffBlock() { CreateBlock("BuffBlock", "Buff Block", "Drive through for a random buff!", CreateBuffBlockMaterial(), BlockType.Buff); SuperVikingKart.DebugLog("BuffBlock prefab registered"); } public static void CreateDebuffBlock() { CreateBlock("DebuffBlock", "Debuff Block", "Drive through for a random debuff!", CreateDebuffBlockMaterial(), BlockType.Debuff); SuperVikingKart.DebugLog("DebuffBlock prefab registered"); } public static void CreateMysteryBlock() { CreateBlock("MysteryBlock", "Mystery Block", "Drive through for a mystery effect!", CreateMysteryBlockMaterial(), BlockType.Mystery); SuperVikingKart.DebugLog("MysteryBlock prefab registered"); } private static void CreateBlock(string prefabName, string displayName, string description, Material material, BlockType blockType) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Expected O, but got Unknown //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Expected O, but got Unknown //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Expected O, but got Unknown GameObject val = new GameObject(prefabName); val.layer = LayerMask.NameToLayer("piece_nonsolid"); val.SetActive(false); ZNetView obj = val.AddComponent(); obj.m_persistent = true; obj.m_syncInitialScale = true; Piece obj2 = val.AddComponent(); obj2.m_canBeRemoved = true; obj2.m_craftingStation = Cache.GetPrefab(CraftingStations.Workbench); BoxCollider obj3 = val.AddComponent(); obj3.center = Vector3.up * 1f; obj3.size = Vector3.one * 0.8f; GameObject val2 = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)val2).name = "Visual"; val2.transform.SetParent(val.transform, false); val2.transform.localPosition = Vector3.up * 1.5f; val2.transform.localScale = Vector3.one * 0.8f; ((Renderer)val2.GetComponent()).material = material; BoxCollider component = val2.GetComponent(); ((Collider)component).isTrigger = true; component.size = Vector3.one * 1.5f; Rigidbody obj4 = val2.AddComponent(); obj4.isKinematic = true; obj4.useGravity = false; val2.AddComponent(); BuffBlockComponent buffBlockComponent = val.AddComponent(); buffBlockComponent.Visual = val2; buffBlockComponent.BlockType = blockType; GameObject prefab = PrefabManager.Instance.GetPrefab("vfx_Place_chest"); buffBlockComponent.CollectEffectPrefab = prefab; val2.AddComponent().BuffBlock = buffBlockComponent; Sprite icon = RenderManager.Instance.Render(val, RenderManager.IsometricRotation); PieceConfig val3 = new PieceConfig(); val3.Name = displayName; val3.Description = description; val3.PieceTable = PieceTables.Hammer; val3.Category = PieceCategories.Misc; val3.Icon = icon; val3.Requirements = (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("Wood", 1, 0, true) }; CustomPiece val4 = new CustomPiece(val, false, val3); PieceManager.Instance.AddPiece(val4); val.SetActive(true); } private static Material CreateBuffBlockMaterial() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) return CreateBlockMaterial(new Color(0.85f, 0.85f, 0f), new Color(0.6f, 0.5f, 0f), Color.black); } private static Material CreateDebuffBlockMaterial() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) return CreateBlockMaterial(new Color(0.8f, 0.2f, 0.2f), new Color(0.6f, 0.1f, 0.1f), Color.black); } private static Material CreateMysteryBlockMaterial() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) return CreateBlockMaterial(new Color(0.6f, 0.2f, 0.8f), new Color(0.4f, 0.1f, 0.5f), Color.black); } private static Material CreateBlockMaterial(Color bgColor, Color borderColor, Color markColor) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Expected O, but got Unknown //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) if (GUIManager.IsHeadless()) { return null; } Texture2D val = new Texture2D(64, 64); Color[] array = (Color[])(object)new Color[4096]; for (int i = 0; i < array.Length; i++) { array[i] = bgColor; } for (int j = 0; j < 64; j++) { for (int k = 0; k < 64; k++) { if (j < 4 || j >= 60 || k < 4 || k >= 60) { array[k * 64 + j] = borderColor; } } } for (int l = 22; l < 42; l++) { for (int m = 44; m < 52; m++) { array[m * 64 + l] = markColor; } } for (int n = 36; n < 42; n++) { for (int num = 36; num < 44; num++) { array[num * 64 + n] = markColor; } } for (int num2 = 28; num2 < 42; num2++) { for (int num3 = 28; num3 < 36; num3++) { array[num3 * 64 + num2] = markColor; } } for (int num4 = 28; num4 < 36; num4++) { for (int num5 = 20; num5 < 28; num5++) { array[num5 * 64 + num4] = markColor; } } for (int num6 = 28; num6 < 36; num6++) { for (int num7 = 10; num7 < 18; num7++) { array[num7 * 64 + num6] = markColor; } } val.SetPixels(array); val.Apply(); ((Texture)val).filterMode = (FilterMode)0; Material val2 = new Material(Cache.GetPrefab("Custom/Piece")) { mainTexture = (Texture)(object)val, color = new Color(0.8f, 0.8f, 0.8f) }; val2.SetFloat("_RippleDistance", 0f); val2.SetFloat("_ValueNoise", 0f); val2.SetFloat("_ValueNoiseVertex", 0f); val2.EnableKeyword("_EMISSION"); val2.SetColor("_EmissionColor", bgColor * 0.3f); return val2; } } internal static class RaceBoardPiece { public static void CreateRaceBoard() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: 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_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Expected O, but got Unknown //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_0305: 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_033f: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03ca: Expected O, but got Unknown //IL_0415: Unknown result type (might be due to invalid IL or missing references) //IL_041b: Expected O, but got Unknown //IL_0425: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Expected O, but got Unknown //IL_0432: Unknown result type (might be due to invalid IL or missing references) //IL_043c: Expected O, but got Unknown GameObject val = new GameObject("RaceBoard"); val.layer = LayerMask.NameToLayer("piece"); val.SetActive(false); ZNetView obj = val.AddComponent(); obj.m_persistent = true; obj.m_syncInitialScale = true; Piece obj2 = val.AddComponent(); obj2.m_canBeRemoved = true; obj2.m_craftingStation = Cache.GetPrefab(CraftingStations.Workbench); GameObject obj3 = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)obj3).name = "BoardVisual"; obj3.transform.SetParent(val.transform, false); obj3.transform.localPosition = new Vector3(0f, 2.6f, 0f); obj3.transform.localScale = new Vector3(2.4f, 2.8f, 0.1f); Object.DestroyImmediate((Object)(object)obj3.GetComponent()); ((Renderer)obj3.GetComponent()).material = CreateRaceBoardMaterial(); GameObject val2 = new GameObject("StatusDisplay"); val2.transform.SetParent(val.transform, false); val2.transform.localRotation = Quaternion.identity; val2.transform.localScale = Vector3.one; TextMeshPro val3 = val2.AddComponent(); ((TMP_Text)val3).font = Cache.GetPrefab("Valheim-AveriaSansLibre"); ((TMP_Text)val3).alignment = (TextAlignmentOptions)257; ((TMP_Text)val3).fontSize = 1f; ((Graphic)val3).color = Color.white; ((TMP_Text)val3).textWrappingMode = (TextWrappingModes)1; ((TMP_Text)val3).overflowMode = (TextOverflowModes)0; ((TMP_Text)val3).rectTransform.pivot = new Vector2(0.5f, 0.5f); ((TMP_Text)val3).rectTransform.anchorMin = new Vector2(0.5f, 0.5f); ((TMP_Text)val3).rectTransform.anchorMax = new Vector2(0.5f, 0.5f); ((TMP_Text)val3).rectTransform.sizeDelta = new Vector2(2f, 2.7f); ((TMP_Text)val3).rectTransform.anchoredPosition3D = new Vector3(0f, 2.4f, -0.06f); GameObject val4 = new GameObject("ButtonRow"); val4.transform.SetParent(val.transform, false); val4.transform.localPosition = Vector3.zero; GameObject go = CreateButtonObject("RegisterButton", val4.transform, new Vector3(-0.9f, 1.25f, -0.06f), "Register"); GameObject go2 = CreateButtonObject("StartButton", val4.transform, new Vector3(-0.3f, 1.25f, -0.06f), "Start"); GameObject go3 = CreateButtonObject("ResetButton", val4.transform, new Vector3(0.3f, 1.25f, -0.06f), "Reset"); GameObject go4 = CreateButtonObject("AdminButton", val4.transform, new Vector3(0.9f, 1.25f, -0.06f), "Admin"); BoxCollider obj4 = val.AddComponent(); obj4.center = Vector3.zero; obj4.size = new Vector3(0.01f, 0.01f, 0.01f); BoxCollider obj5 = val.AddComponent(); obj5.center = new Vector3(0f, 2.6f, 0f); obj5.size = new Vector3(2.4f, 2.8f, 0.1f); BoxCollider obj6 = val.AddComponent(); obj6.center = new Vector3(0f, 2.6f, 0f); obj6.size = new Vector3(2.4f, 2.8f, 0.1f); ((Collider)obj6).isTrigger = true; RaceBoardComponent raceBoardComponent = val.AddComponent(); raceBoardComponent.StatusDisplay = val3; raceBoardComponent.ButtonRow = val4; raceBoardComponent.RegisterButton = WireButton(go, RaceBoardButtonType.Register, raceBoardComponent); raceBoardComponent.StartButton = WireButton(go2, RaceBoardButtonType.Start, raceBoardComponent); raceBoardComponent.ResetButton = WireButton(go3, RaceBoardButtonType.Reset, raceBoardComponent); raceBoardComponent.AdminButton = WireButton(go4, RaceBoardButtonType.Admin, raceBoardComponent); Sprite icon = RenderManager.Instance.Render(val, RenderManager.IsometricRotation); PieceManager instance = PieceManager.Instance; PieceConfig val5 = new PieceConfig(); val5.Name = "Race Board"; val5.Description = "Place to configure and manage a race. Shows you race statistics in real time."; val5.PieceTable = PieceTables.Hammer; val5.Category = PieceCategories.Misc; val5.Icon = icon; val5.Requirements = (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("Wood", 4, 0, true), new RequirementConfig("Stone", 2, 0, true) }; instance.AddPiece(new CustomPiece(val, false, val5)); val.SetActive(true); SuperVikingKart.DebugLog("RaceBoard prefab registered"); } private static Material CreateRaceBoardMaterial() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) if (GUIManager.IsHeadless()) { return null; } Texture2D val = new Texture2D(64, 64); Color[] array = (Color[])(object)new Color[4096]; Color val2 = default(Color); ((Color)(ref val2))..ctor(0.15f, 0.1f, 0.05f); Color val3 = default(Color); ((Color)(ref val3))..ctor(0.6f, 0.4f, 0.1f); for (int i = 0; i < array.Length; i++) { array[i] = val2; } for (int j = 0; j < 64; j++) { for (int k = 0; k < 64; k++) { if (j < 3 || j >= 61 || k < 3 || k >= 61) { array[k * 64 + j] = val3; } } } val.SetPixels(array); val.Apply(); ((Texture)val).filterMode = (FilterMode)0; return new Material(Cache.GetPrefab("Custom/Piece")) { mainTexture = (Texture)(object)val, color = Color.white }; } private static GameObject CreateButtonObject(string name, Transform parent, Vector3 localPos, string label) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_014a: 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_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); val.transform.SetParent(parent, false); val.transform.localPosition = localPos; val.transform.localScale = Vector3.one; GameObject obj = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)obj).name = "Visual"; obj.transform.SetParent(val.transform, false); obj.transform.localScale = new Vector3(0.58f, 0.18f, 0.06f); Object.DestroyImmediate((Object)(object)obj.GetComponent()); ((Renderer)obj.GetComponent()).material = CreateButtonMaterial(); val.AddComponent().size = new Vector3(0.58f, 0.18f, 0.12f); GameObject val2 = new GameObject("Label"); val2.transform.SetParent(val.transform, false); val2.transform.localPosition = new Vector3(0f, 0f, -0.04f); val2.transform.localScale = Vector3.one; TextMeshPro obj2 = val2.AddComponent(); ((TMP_Text)obj2).font = Cache.GetPrefab("Valheim-AveriaSansLibre"); ((TMP_Text)obj2).text = label; ((TMP_Text)obj2).alignment = (TextAlignmentOptions)514; ((TMP_Text)obj2).fontSize = 1f; ((Graphic)obj2).color = Color.white; ((TMP_Text)obj2).textWrappingMode = (TextWrappingModes)1; ((TMP_Text)obj2).rectTransform.sizeDelta = new Vector2(0.54f, 0.16f); ((TMP_Text)obj2).rectTransform.pivot = new Vector2(0.5f, 0.5f); ((TMP_Text)obj2).rectTransform.anchorMin = new Vector2(0.5f, 0.5f); ((TMP_Text)obj2).rectTransform.anchorMax = new Vector2(0.5f, 0.5f); ((TMP_Text)obj2).rectTransform.anchoredPosition = Vector2.zero; return val; } private static Material CreateButtonMaterial() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) if (GUIManager.IsHeadless()) { return null; } Texture2D val = new Texture2D(32, 16); Color[] array = (Color[])(object)new Color[512]; Color val2 = default(Color); ((Color)(ref val2))..ctor(0.2f, 0.12f, 0.04f); Color val3 = default(Color); ((Color)(ref val3))..ctor(0.55f, 0.35f, 0.08f); for (int i = 0; i < array.Length; i++) { array[i] = val2; } for (int j = 0; j < 32; j++) { for (int k = 0; k < 16; k++) { if (j < 2 || j >= 30 || k < 2 || k >= 14) { array[k * 32 + j] = val3; } } } val.SetPixels(array); val.Apply(); ((Texture)val).filterMode = (FilterMode)0; return new Material(Cache.GetPrefab("Custom/Piece")) { mainTexture = (Texture)(object)val, color = Color.white }; } private static RaceBoardButton WireButton(GameObject go, RaceBoardButtonType type, RaceBoardComponent board) { RaceBoardButton raceBoardButton = go.AddComponent(); raceBoardButton.ButtonType = type; raceBoardButton.Board = board; return raceBoardButton; } } internal static class RaceLinePiece { public static void CreateRaceLine() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) //IL_03aa: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_042a: Unknown result type (might be due to invalid IL or missing references) //IL_0474: Unknown result type (might be due to invalid IL or missing references) //IL_0484: Unknown result type (might be due to invalid IL or missing references) //IL_0497: Unknown result type (might be due to invalid IL or missing references) //IL_049e: Expected O, but got Unknown //IL_04e9: Unknown result type (might be due to invalid IL or missing references) //IL_04ef: Expected O, but got Unknown //IL_04f6: Unknown result type (might be due to invalid IL or missing references) //IL_0500: Expected O, but got Unknown //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("RaceLine"); val.layer = LayerMask.NameToLayer("piece"); val.SetActive(false); ZNetView obj = val.AddComponent(); obj.m_persistent = true; obj.m_syncInitialScale = true; Piece obj2 = val.AddComponent(); obj2.m_canBeRemoved = true; obj2.m_craftingStation = Cache.GetPrefab(CraftingStations.Workbench); GameObject val2 = new GameObject("PlaceCollider"); val2.transform.SetParent(val.transform, false); BoxCollider obj3 = val2.AddComponent(); obj3.center = Vector3.zero; obj3.size = new Vector3(6f, 0.001f, 0.001f); GameObject val3 = new GameObject("TriggerCollider"); val3.transform.SetParent(val.transform, false); val3.transform.localPosition = new Vector3(0f, 0f, 0f); BoxCollider obj4 = val3.AddComponent(); ((Collider)obj4).isTrigger = true; obj4.size = new Vector3(6f, 6f, 1f); Rigidbody obj5 = val3.AddComponent(); obj5.isKinematic = true; obj5.useGravity = false; CreatePost("PostLeft", val.transform, new Vector3(-3f, 1.5f, 0f)); CreatePost("PostRight", val.transform, new Vector3(3f, 1.5f, 0f)); GameObject val4 = GameObject.CreatePrimitive((PrimitiveType)5); ((Object)val4).name = "GroundQuad"; val4.transform.SetParent(val.transform, false); val4.transform.localPosition = new Vector3(0f, 0.02f, 0f); val4.transform.localRotation = Quaternion.Euler(90f, 0f, 0f); val4.transform.localScale = new Vector3(6f, 1f, 1f); Object.DestroyImmediate((Object)(object)val4.GetComponent()); Material val5 = CreateChequeredMaterial(); if ((Object)(object)val5 != (Object)null) { val5.mainTextureScale = new Vector2(val4.transform.localScale.x / val4.transform.localScale.z, 1f); } ((Renderer)val4.GetComponent()).material = val5; GameObject obj6 = GameObject.CreatePrimitive((PrimitiveType)5); ((Object)obj6).name = "DirectionArrow"; obj6.transform.SetParent(val.transform, false); obj6.transform.localPosition = new Vector3(0f, 0.03f, 0.6f); obj6.transform.localRotation = Quaternion.Euler(90f, 270f, 0f); obj6.transform.localScale = new Vector3(1f, 1f, 1f); Object.DestroyImmediate((Object)(object)obj6.GetComponent()); ((Renderer)obj6.GetComponent()).material = CreateArrowMaterial(); GameObject val6 = new GameObject("Label"); val6.transform.SetParent(val.transform, false); val6.transform.localPosition = Vector3.zero; val6.transform.localScale = Vector3.one; TextMeshPro val7 = val6.AddComponent(); ((TMP_Text)val7).font = Cache.GetPrefab("Valheim-Norse"); ((TMP_Text)val7).alignment = (TextAlignmentOptions)514; ((TMP_Text)val7).fontSize = 3f; ((Graphic)val7).color = Color.black; ((TMP_Text)val7).fontStyle = (FontStyles)1; ((TMP_Text)val7).textWrappingMode = (TextWrappingModes)1; ((TMP_Text)val7).overflowMode = (TextOverflowModes)0; ((TMP_Text)val7).rectTransform.sizeDelta = new Vector2(6f, 1.5f); ((TMP_Text)val7).rectTransform.pivot = new Vector2(0.5f, 0.5f); ((TMP_Text)val7).rectTransform.anchorMin = new Vector2(0.5f, 0.5f); ((TMP_Text)val7).rectTransform.anchorMax = new Vector2(0.5f, 0.5f); ((TMP_Text)val7).rectTransform.anchoredPosition3D = new Vector3(0f, 3f, -0.05f); GameObject obj7 = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)obj7).name = "Banner"; obj7.transform.SetParent(val.transform, false); obj7.transform.localPosition = new Vector3(0f, 3f, 0f); obj7.transform.localScale = new Vector3(6f, 0.4f, 0.01f); ((Renderer)obj7.GetComponent()).material = CreateBannerMaterial(); RaceLineComponent raceLineComponent = val.AddComponent(); raceLineComponent.Label = val7; val3.AddComponent().Line = raceLineComponent; val.transform.localScale = new Vector3(1.2f, 1.2f, 1f); Sprite icon = RenderManager.Instance.Render(val, RenderManager.IsometricRotation); PieceManager instance = PieceManager.Instance; PieceConfig val8 = new PieceConfig(); val8.Name = "Race Line"; val8.Description = "Start and/or finish line for a race. Place the arrow facing the direction of travel."; val8.PieceTable = PieceTables.Hammer; val8.Category = PieceCategories.Misc; val8.Icon = icon; val8.Requirements = (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("Wood", 2, 0, true) }; instance.AddPiece(new CustomPiece(val, false, val8)); val.SetActive(true); SuperVikingKart.DebugLog("RaceLine prefab registered"); } private static void CreatePost(string name, Transform parent, Vector3 localPos) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) GameObject obj = GameObject.CreatePrimitive((PrimitiveType)2); ((Object)obj).name = name; obj.transform.SetParent(parent, false); obj.transform.localPosition = localPos; obj.transform.localScale = new Vector3(0.15f, 1.5f, 0.15f); ((Renderer)obj.GetComponent()).material = CreatePostMaterial(); } private static Material CreateChequeredMaterial() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) if (GUIManager.IsHeadless()) { return null; } Texture2D val = new Texture2D(64, 64); Color[] array = (Color[])(object)new Color[4096]; for (int i = 0; i < 64; i++) { for (int j = 0; j < 64; j++) { int num = i / 8; int num2 = j / 8; array[j * 64 + i] = (((num + num2) % 2 == 0) ? Color.white : Color.black); } } val.SetPixels(array); val.Apply(); ((Texture)val).filterMode = (FilterMode)0; return new Material(Cache.GetPrefab("Custom/Piece")) { mainTexture = (Texture)(object)val, color = new Color(0.6f, 0.6f, 0.6f) }; } private static Material CreateArrowMaterial() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Expected O, but got Unknown //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) if (GUIManager.IsHeadless()) { return null; } Texture2D val = new Texture2D(32, 32, (TextureFormat)4, false); Color[] array = (Color[])(object)new Color[1024]; for (int i = 0; i < array.Length; i++) { array[i] = new Color(1f, 0.6f, 0f, 0f); } for (int j = 2; j <= 17; j++) { for (int k = 12; k <= 19; k++) { array[k * 32 + j] = new Color(1f, 0.6f, 0f, 1f); } } for (int l = 18; l <= 29; l++) { int num = 29 - l; int num2 = Mathf.RoundToInt(15.5f - (float)num); int num3 = Mathf.RoundToInt(15.5f + (float)num); for (int m = num2; m <= num3; m++) { if (m >= 0 && m < 32) { array[m * 32 + l] = new Color(1f, 0.6f, 0f, 1f); } } } val.SetPixels(array); val.Apply(); ((Texture)val).filterMode = (FilterMode)0; Material val2 = new Material(Cache.GetPrefab("Custom/Piece")) { mainTexture = (Texture)(object)val, color = new Color(0.6f, 0.6f, 0.6f) }; val2.SetFloat("_Cutoff", 0.1f); return val2; } private static Material CreatePostMaterial() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_002e: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown if (GUIManager.IsHeadless()) { return null; } Texture2D val = new Texture2D(4, 4); Color[] array = (Color[])(object)new Color[16]; for (int i = 0; i < 16; i++) { array[i] = new Color(0.9f, 0.85f, 0.1f); } val.SetPixels(array); val.Apply(); return new Material(Cache.GetPrefab("Custom/Piece")) { mainTexture = (Texture)(object)val, color = new Color(0.6f, 0.6f, 0.6f) }; } private static Material CreateBannerMaterial() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) if (GUIManager.IsHeadless()) { return null; } Texture2D val = new Texture2D(64, 16); Color[] array = (Color[])(object)new Color[1024]; for (int i = 0; i < 64; i++) { for (int j = 0; j < 16; j++) { array[j * 64 + i] = ((i / 8 % 2 == 0) ? Color.red : Color.white); } } val.SetPixels(array); val.Apply(); ((Texture)val).filterMode = (FilterMode)0; return new Material(Cache.GetPrefab("Custom/Piece")) { mainTexture = (Texture)(object)val, color = new Color(0.6f, 0.6f, 0.6f) }; } } internal class SuperVikingKartComponent : MonoBehaviour, Hoverable, Interactable { public static readonly List Instances = new List(); public string Name = "SuperVikingKartAttach"; public float UseDistance = 2f; public Transform AttachPoint; private const string ZdoKeyAttachedPlayer = "SuperVikingKart_AttachedPlayer"; private const string ZdoKeyColorR = "SuperVikingKart_ColorR"; private const string ZdoKeyColorG = "SuperVikingKart_ColorG"; private const string ZdoKeyColorB = "SuperVikingKart_ColorB"; private ZNetView _netView; private Vagon _vagon; private Renderer[] _kartRenderers; private float _lastSitTime; private Player _attachedPlayerLocal; public void Awake() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) Instances.Add(this); _netView = ((Component)this).gameObject.GetComponentInParent(); if (!Object.op_Implicit((Object)(object)_netView) || _netView.GetZDO() == null) { SuperVikingKart.DebugLog("Kart Awake - no ZNetView or ZDO, disabling"); ((Behaviour)this).enabled = false; return; } SuperVikingKart.DebugLog($"Kart Awake - ZDO: {_netView.GetZDO().m_uid}, Owner: {_netView.IsOwner()}"); _netView.Register("SuperVikingKart_RPC_Attach", (Action)RPC_Attach); _netView.Register("SuperVikingKart_RPC_Detach", (Action)RPC_Detach); _netView.Register("SuperVikingKart_RPC_SetColor", (Action)RPC_SetColor); _netView.Register("SuperVikingKart_RPC_KartDestroyed", (Action)RPC_KartDestroyed); if (_netView.IsOwner()) { ZDO zDO = _netView.GetZDO(); ZDOID zDOID = zDO.GetZDOID("SuperVikingKart_AttachedPlayer"); if (zDOID != ZDOID.None && !Object.op_Implicit((Object)(object)ZNetScene.instance.FindInstance(zDOID))) { SuperVikingKart.DebugLog($"Kart Awake - Clearing stale attachment: {zDOID}"); zDO.Set("SuperVikingKart_AttachedPlayer", ZDOID.None); } } _vagon = ((Component)this).GetComponentInParent(); _vagon.m_baseMass = 10f; _vagon.SetMass(_vagon.m_baseMass); _kartRenderers = ((Component)_vagon).GetComponentsInChildren(true); ApplyColor(GetCurrentColor()); } public void Update() { //IL_008b: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)_attachedPlayerLocal)) { if (!Object.op_Implicit((Object)(object)AttachPoint)) { SuperVikingKart.DebugLog("Kart Update - AttachPoint lost, detaching"); Detach(); } else if (ZInput.GetButtonDown("Jump") || ((Character)_attachedPlayerLocal).IsDead()) { SuperVikingKart.DebugLog(string.Format("Kart Update - Detaching (Jump: {0}, Dead: {1})", ZInput.GetButtonDown("Jump"), ((Character)_attachedPlayerLocal).IsDead())); Detach(); } else { ((Component)_attachedPlayerLocal).transform.position = AttachPoint.position; } } } private void OnDestroy() { Instances.Remove(this); SuperVikingKart.DebugLog("Kart OnDestroy"); Detach(); } private void Attach(Player player) { //IL_000c: 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) SuperVikingKart.DebugLog($"Kart Attach - Player: {player.GetPlayerName()}, ZDOID: {((Character)player).GetZDOID()}"); _attachedPlayerLocal = player; if (Object.op_Implicit((Object)(object)_netView) && _netView.GetZDO() != null) { _netView.InvokeRPC("SuperVikingKart_RPC_Attach", new object[1] { ((Character)player).GetZDOID() }); } } private void Detach() { Player attachedPlayerLocal = _attachedPlayerLocal; SuperVikingKart.DebugLog("Kart Detach - Player: " + (((attachedPlayerLocal != null) ? attachedPlayerLocal.GetPlayerName() : null) ?? "none")); _attachedPlayerLocal = null; if (Object.op_Implicit((Object)(object)_netView) && _netView.GetZDO() != null) { _netView.InvokeRPC("SuperVikingKart_RPC_Detach", Array.Empty()); } } private void RPC_Attach(long sender, ZDOID playerId) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) SuperVikingKart.DebugLog($"Kart RPC_Attach - sender: {sender}, playerId: {playerId}, IsOwner: {_netView.IsOwner()}"); ZDO zDO = _netView.GetZDO(); if (zDO != null && _netView.IsOwner()) { zDO.Set("SuperVikingKart_AttachedPlayer", playerId); } } private void RPC_Detach(long sender) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) SuperVikingKart.DebugLog($"Kart RPC_Detach - sender: {sender}, IsOwner: {_netView.IsOwner()}"); ZDO zDO = _netView.GetZDO(); if (zDO != null && _netView.IsOwner()) { zDO.Set("SuperVikingKart_AttachedPlayer", ZDOID.None); } } public Color GetCurrentColor() { //IL_004c: 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) ZNetView netView = _netView; ZDO val = ((netView != null) ? netView.GetZDO() : null); if (val == null) { return Color.white; } return new Color(val.GetFloat("SuperVikingKart_ColorR", 1f), val.GetFloat("SuperVikingKart_ColorG", 1f), val.GetFloat("SuperVikingKart_ColorB", 1f)); } internal void ApplyColor(Color color) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) if (_kartRenderers == null) { return; } MaterialPropertyBlock val = new MaterialPropertyBlock(); Renderer[] kartRenderers = _kartRenderers; foreach (Renderer val2 in kartRenderers) { if (Object.op_Implicit((Object)(object)val2)) { val2.GetPropertyBlock(val); val.SetColor("_Color", color); val2.SetPropertyBlock(val); } } } public void SetColor(Color color) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) SuperVikingKart.DebugLog($"Kart SetColor - {color}"); _netView.InvokeRPC(ZNetView.Everybody, "SuperVikingKart_RPC_SetColor", new object[3] { color.r, color.g, color.b }); } private void RPC_SetColor(long sender, float r, float g, float b) { //IL_0087: Unknown result type (might be due to invalid IL or missing references) SuperVikingKart.DebugLog($"Kart RPC_SetColor - sender: {sender}, rgb: ({r},{g},{b})"); Color color = default(Color); ((Color)(ref color))..ctor(r, g, b); if (_netView.IsOwner()) { ZDO zDO = _netView.GetZDO(); if (zDO != null) { zDO.Set("SuperVikingKart_ColorR", r); zDO.Set("SuperVikingKart_ColorG", g); zDO.Set("SuperVikingKart_ColorB", b); } } ApplyColor(color); } private void RPC_KartDestroyed(long sender, Vector3 position, float rotY) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: 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) SuperVikingKart.DebugLog($"RPC_KartDestroyed - position: {position}, rotY: {rotY}"); GameObject val = new GameObject("KartRespawnComponent"); val.transform.position = position + Vector3.up * 0.5f; val.layer = LayerMask.NameToLayer("character"); val.AddComponent().Setup(SuperVikingKart.KartRespawnTimeConfig.Value); } public Vagon GetVagon() { return _vagon; } public Player GetPuller() { if (!Object.op_Implicit((Object)(object)_vagon)) { return null; } foreach (Player allPlayer in Player.GetAllPlayers()) { if (_vagon.IsAttached((Character)(object)allPlayer)) { return allPlayer; } } return null; } public Player GetRiderLocal() { return _attachedPlayerLocal; } public ZDOID GetRiderZDOID() { //IL_002e: 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_0042: Unknown result type (might be due to invalid IL or missing references) ZNetView netView = _netView; ZDOID? obj; if (netView == null) { obj = null; } else { ZDO zDO = netView.GetZDO(); obj = ((zDO != null) ? new ZDOID?(zDO.GetZDOID("SuperVikingKart_AttachedPlayer")) : null); } return (ZDOID)(((??)obj) ?? ZDOID.None); } public Player GetRider() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: 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) ZDOID riderZDOID = GetRiderZDOID(); if (riderZDOID == ZDOID.None) { return null; } GameObject val = ZNetScene.instance.FindInstance(riderZDOID); if (!Object.op_Implicit((Object)(object)val)) { return null; } return val.GetComponent(); } private bool IsInUse() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) return GetRiderZDOID() != ZDOID.None; } public bool Interact(Humanoid human, bool hold, bool alt) { if (hold) { return false; } Player val = (Player)(object)((human is Player) ? human : null); if (!Object.op_Implicit((Object)(object)val)) { return false; } if (!Object.op_Implicit((Object)(object)AttachPoint)) { return false; } if (!InUseDistance((Humanoid)(object)val)) { return false; } if (Time.time - _lastSitTime < 2f) { return false; } if (alt) { KartColorPickerUI.Open(this); return true; } if (Object.op_Implicit((Object)(object)_attachedPlayerLocal) && (Object)(object)val == (Object)(object)_attachedPlayerLocal) { SuperVikingKart.DebugLog("Kart Interact - Detaching player: " + val.GetPlayerName()); Detach(); _lastSitTime = Time.time; return true; } if (IsInUse()) { SuperVikingKart.DebugLog("Kart Interact - Already in use"); return false; } SuperVikingKart.DebugLog("Kart Interact - Attaching player: " + val.GetPlayerName()); Attach(val); _lastSitTime = Time.time; return true; } public bool UseItem(Humanoid user, ItemData item) { return false; } public string GetHoverText() { if (Time.time - _lastSitTime < 2f) { return ""; } Player localPlayer = Player.m_localPlayer; if (!Object.op_Implicit((Object)(object)localPlayer)) { return ""; } if (!InUseDistance((Humanoid)(object)localPlayer)) { return Localization.instance.Localize("$piece_toofar"); } if (!Object.op_Implicit((Object)(object)_attachedPlayerLocal) && IsInUse()) { return Localization.instance.Localize("In use"); } return Localization.instance.Localize(Name + "\n[$KEY_Use] $piece_use\n[$KEY_AltPlace + $KEY_Use] Change color"); } public string GetHoverName() { return Name; } private bool InUseDistance(Humanoid human) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)human) || !Object.op_Implicit((Object)(object)AttachPoint)) { return false; } return Vector3.Distance(((Component)human).transform.position, AttachPoint.position) < UseDistance; } } internal static class KartColorPickerUI { private static SuperVikingKartComponent _targetKart; public static void Open(SuperVikingKartComponent kart) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown //IL_006b: Expected O, but got Unknown if (!((Object)(object)kart == (Object)null)) { _targetKart = kart; GUIManager.Instance.CreateColorPicker(new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, 0f), kart.GetCurrentColor(), "Kart Color", new ColorEvent(OnColorChanged), new ColorEvent(OnColorSelected), false); GUIManager.BlockInput(true); } } private static void OnColorChanged(Color color) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_targetKart == (Object)null)) { _targetKart.ApplyColor(color); } } private static void OnColorSelected(Color color) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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) if (!((Object)(object)_targetKart == (Object)null)) { Color currentColor = _targetKart.GetCurrentColor(); if (color == currentColor) { _targetKart.ApplyColor(currentColor); } else { _targetKart.SetColor(color); } _targetKart = null; GUIManager.BlockInput(false); } } } [HarmonyPatch(typeof(WearNTear), "Highlight")] internal class KartColorHighlightPatch { private static bool Prefix(WearNTear __instance) { return !Object.op_Implicit((Object)(object)((Component)__instance).GetComponentInChildren()); } } internal class KartRespawnComponent : MonoBehaviour, Hoverable { private float _timeRemaining; private TextMesh _text; private Camera _camera; public void Setup(float duration) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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) _timeRemaining = duration; GameObject val = new GameObject("TimerText"); val.transform.SetParent(((Component)this).transform, false); val.transform.localPosition = Vector3.up * 2f; _text = val.AddComponent(); _text.alignment = (TextAlignment)1; _text.anchor = (TextAnchor)4; _text.characterSize = 0.3f; _text.fontSize = 48; _text.color = Color.white; SphereCollider obj = ((Component)this).gameObject.AddComponent(); obj.radius = 1f; obj.center = Vector3.up * 2f; } private void Update() { //IL_0084: Unknown result type (might be due to invalid IL or missing references) _timeRemaining -= Time.deltaTime; if (_timeRemaining <= 0f) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } _text.text = Mathf.CeilToInt(_timeRemaining).ToString(); if (!Object.op_Implicit((Object)(object)_camera)) { _camera = Camera.main; } if (Object.op_Implicit((Object)(object)_camera)) { ((Component)_text).transform.rotation = ((Component)_camera).transform.rotation; } } public string GetHoverText() { return $"Kart respawning in {Mathf.CeilToInt(_timeRemaining)}s"; } public string GetHoverName() { return "Kart Respawn"; } } [HarmonyPatch(typeof(WearNTear), "Destroy")] internal class KartRespawnPatch { [CompilerGenerated] private sealed class d__2 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Vector3 position; public Quaternion rotation; public Color color; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__2(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds((float)SuperVikingKart.KartRespawnTimeConfig.Value); <>1__state = 1; return true; case 1: { <>1__state = -1; GameObject prefab = PrefabManager.Instance.GetPrefab("SuperVikingKart"); if (!Object.op_Implicit((Object)(object)prefab)) { Logger.LogWarning((object)"KartRespawn - SuperVikingKart prefab not found"); return false; } SuperVikingKart.DebugLog($"KartRespawn - Spawning kart at {position}"); Object.Instantiate(prefab, position, rotation).GetComponentInChildren().SetColor(color); 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(); } } internal static bool IsBeingRemoved; private static void Prefix(WearNTear __instance) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) if (IsBeingRemoved) { return; } SuperVikingKartComponent componentInChildren = ((Component)__instance).GetComponentInChildren(); if (Object.op_Implicit((Object)(object)componentInChildren)) { ZNetView component = ((Component)__instance).GetComponent(); if (Object.op_Implicit((Object)(object)component) && component.IsOwner()) { Vector3 position = ((Component)__instance).transform.position; float y = ((Component)__instance).transform.eulerAngles.y; Quaternion rotation = Quaternion.Euler(0f, y, 0f); Color currentColor = componentInChildren.GetCurrentColor(); SuperVikingKart.DebugLog($"KartRespawn - Kart destroyed at {position}, broadcasting and scheduling respawn"); component.InvokeRPC(ZNetView.Everybody, "SuperVikingKart_RPC_KartDestroyed", new object[2] { position, y }); ((MonoBehaviour)SuperVikingKart.Instance).StartCoroutine(RespawnKart(position, rotation, currentColor)); } } } [IteratorStateMachine(typeof(d__2))] private static IEnumerator RespawnKart(Vector3 position, Quaternion rotation, Color color) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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_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) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__2(0) { position = position, rotation = rotation, color = color }; } } [HarmonyPatch(typeof(WearNTear), "Remove")] internal class KartRemovePatch { private static void Prefix() { KartRespawnPatch.IsBeingRemoved = true; } private static void Postfix() { KartRespawnPatch.IsBeingRemoved = false; } } [HarmonyPatch(typeof(WearNTear), "Damage")] internal class KartSelfDamagePatch { private static bool Prefix(WearNTear __instance, HitData hit) { if (!Object.op_Implicit((Object)(object)__instance.m_nview) || __instance.m_nview.GetZDO() == null) { return true; } if (__instance.m_nview.GetZDO().m_prefab != SuperVikingKart.KartPrefabHash) { return true; } Character attacker = hit.GetAttacker(); if (!Object.op_Implicit((Object)(object)attacker)) { return true; } SuperVikingKartComponent componentInChildren = ((Component)__instance).GetComponentInChildren(); if (!Object.op_Implicit((Object)(object)componentInChildren)) { return true; } return (Object)(object)attacker != (Object)(object)componentInChildren.GetRider(); } } [HarmonyPatch(typeof(Attack), "DoMeleeAttack")] internal class AttackThroughOwnKartPatch { private static void Prefix(Attack __instance, out List __state) { __state = null; Humanoid character = __instance.m_character; Player val = (Player)(object)((character is Player) ? character : null); if ((Object)(object)val == (Object)null || (Object)(object)val != (Object)(object)Player.m_localPlayer) { return; } foreach (SuperVikingKartComponent instance in SuperVikingKartComponent.Instances) { if ((Object)(object)instance.GetRiderLocal() != (Object)(object)val) { continue; } Vagon vagon = instance.GetVagon(); if (!Object.op_Implicit((Object)(object)vagon)) { continue; } __state = new List(); Collider[] componentsInChildren = ((Component)vagon).GetComponentsInChildren(); foreach (Collider val2 in componentsInChildren) { if (val2.enabled) { val2.enabled = false; __state.Add(val2); } } break; } } private static void Postfix(List __state) { if (__state == null) { return; } foreach (Collider item in __state) { if (Object.op_Implicit((Object)(object)item)) { item.enabled = true; } } } } [HarmonyPatch(typeof(Vagon), "LateUpdate")] internal class VagonDeathPatch { private static bool Prefix(Vagon __instance) { if ((Object)(object)__instance.m_attachJoin != (Object)null && (Object)(object)((Joint)__instance.m_attachJoin).connectedBody == (Object)null) { __instance.Detach(); return false; } return true; } } internal class SE_KartSpeedBoost : SE_Stats { public void OnEnable() { //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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown ((Object)this).name = "SuperVikingKart_SpeedBoost"; ((StatusEffect)this).m_ttl = 10f; ((StatusEffect)this).m_icon = Cache.GetPrefab("potion_hasty"); GameObject prefab = Cache.GetPrefab("vfx_MeadHasty"); GameObject prefab2 = Cache.GetPrefab("sfx_Potion_stamina_Start"); if (Object.op_Implicit((Object)(object)prefab) && Object.op_Implicit((Object)(object)prefab2)) { ((StatusEffect)this).m_startEffects.m_effectPrefabs = (EffectData[])(object)new EffectData[2] { new EffectData { m_prefab = prefab, m_enabled = true, m_attach = true }, new EffectData { m_prefab = prefab2, m_enabled = true, m_attach = true } }; } } public override void Setup(Character character) { ((SE_Stats)this).Setup(character); SuperVikingKart.DebugLog("SE_KartSpeedBoost - Applied to " + character.m_name); } public override void ModifySpeed(float baseSpeed, ref float speed, Character character, Vector3 dir) { speed *= 1.5f; } public override void Stop() { SuperVikingKart.DebugLog("SE_KartSpeedBoost - Stopped on " + ((StatusEffect)this).m_character?.m_name); ((StatusEffect)this).Stop(); } } internal class SE_KartStaminaRegen : SE_Stats { public void OnEnable() { //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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown ((Object)this).name = "SuperVikingKart_StaminaRegen"; ((StatusEffect)this).m_ttl = 10f; ((StatusEffect)this).m_icon = Cache.GetPrefab("potion_stamina_minor"); GameObject prefab = Cache.GetPrefab("vfx_Potion_stamina_medium"); GameObject prefab2 = Cache.GetPrefab("sfx_Potion_stamina_Start"); if (Object.op_Implicit((Object)(object)prefab) && Object.op_Implicit((Object)(object)prefab2)) { ((StatusEffect)this).m_startEffects.m_effectPrefabs = (EffectData[])(object)new EffectData[2] { new EffectData { m_prefab = prefab, m_enabled = true, m_attach = true }, new EffectData { m_prefab = prefab2, m_enabled = true, m_attach = true } }; } base.m_staminaOverTime = 0.5f; base.m_staminaOverTimeIsFraction = true; } public override void Setup(Character character) { ((SE_Stats)this).Setup(character); SuperVikingKart.DebugLog("SE_KartStaminaRegen - Applied to " + character.m_name); } public override void Stop() { SuperVikingKart.DebugLog("SE_KartStaminaRegen - Stopped on " + ((StatusEffect)this).m_character?.m_name); ((StatusEffect)this).Stop(); } } internal class SE_KartStaminaBurst : SE_Stats { public void OnEnable() { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown ((Object)this).name = "SuperVikingKart_StaminaBurst"; ((StatusEffect)this).m_ttl = 2f; GameObject prefab = Cache.GetPrefab("vfx_Potion_stamina_medium"); GameObject prefab2 = Cache.GetPrefab("sfx_Potion_stamina_Start_lingering"); if (Object.op_Implicit((Object)(object)prefab) && Object.op_Implicit((Object)(object)prefab2)) { ((StatusEffect)this).m_startEffects.m_effectPrefabs = (EffectData[])(object)new EffectData[2] { new EffectData { m_prefab = prefab, m_enabled = true, m_attach = true }, new EffectData { m_prefab = prefab2, m_enabled = true, m_attach = true } }; } } public override void Setup(Character character) { ((SE_Stats)this).Setup(character); character.AddStamina(character.GetMaxStamina()); SuperVikingKart.DebugLog("SE_KartStaminaBurst - Refilled stamina for " + character.m_name); } } internal class SE_KartOozeBombs : SE_Stats { public void OnEnable() { ((Object)this).name = "SuperVikingKart_OozeBombs"; ((StatusEffect)this).m_ttl = 0.1f; } public override void Setup(Character character) { ((SE_Stats)this).Setup(character); Player val = (Player)(object)((character is Player) ? character : null); if (Object.op_Implicit((Object)(object)val)) { GameObject prefab = ZNetScene.instance.GetPrefab("KartBombOoze"); if (Object.op_Implicit((Object)(object)prefab)) { SuperVikingKart.DebugLog("SE_KartOozeBombs - Adding ooze bombs to " + val.GetPlayerName()); ((Humanoid)val).GetInventory().AddItem(prefab, 5); } } } } internal class SE_KartBileBombs : SE_Stats { public void OnEnable() { ((Object)this).name = "SuperVikingKart_BileBombs"; ((StatusEffect)this).m_ttl = 0.1f; } public override void Setup(Character character) { ((SE_Stats)this).Setup(character); Player val = (Player)(object)((character is Player) ? character : null); if (Object.op_Implicit((Object)(object)val)) { GameObject prefab = ZNetScene.instance.GetPrefab("KartBombBile"); if (Object.op_Implicit((Object)(object)prefab)) { SuperVikingKart.DebugLog("SE_KartBileBombs - Adding bile bombs to " + val.GetPlayerName()); ((Humanoid)val).GetInventory().AddItem(prefab, 2); } } } } internal class SE_KartSmokeBombs : SE_Stats { public void OnEnable() { ((Object)this).name = "SuperVikingKart_SmokeBombs"; ((StatusEffect)this).m_ttl = 0.1f; } public override void Setup(Character character) { ((SE_Stats)this).Setup(character); Player val = (Player)(object)((character is Player) ? character : null); if (Object.op_Implicit((Object)(object)val)) { GameObject prefab = ZNetScene.instance.GetPrefab("KartBombSmoke"); if (Object.op_Implicit((Object)(object)prefab)) { SuperVikingKart.DebugLog("SE_KartSmokeBombs - Adding smoke bombs to " + val.GetPlayerName()); ((Humanoid)val).GetInventory().AddItem(prefab, 5); } } } } internal class SE_KartFireArrows : SE_Stats { public void OnEnable() { ((Object)this).name = "SuperVikingKart_FireArrows"; ((StatusEffect)this).m_ttl = 0.1f; } public override void Setup(Character character) { ((SE_Stats)this).Setup(character); Player val = (Player)(object)((character is Player) ? character : null); if (!Object.op_Implicit((Object)(object)val)) { return; } GameObject prefab = ZNetScene.instance.GetPrefab("ArrowFire"); if (Object.op_Implicit((Object)(object)prefab)) { GameObject prefab2 = ZNetScene.instance.GetPrefab("BowFineWood"); if (Object.op_Implicit((Object)(object)prefab2) && !((Humanoid)val).GetInventory().ContainsItemByName("$item_bow_finewood")) { ((Humanoid)val).GetInventory().AddItem(prefab2, 1); } SuperVikingKart.DebugLog("SE_KartFireArrows - Adding fire arrows to " + val.GetPlayerName()); ((Humanoid)val).GetInventory().AddItem(prefab, 20); } } } internal class SE_KartHarpoon : SE_Stats { public void OnEnable() { ((Object)this).name = "SuperVikingKart_Harpoon"; ((StatusEffect)this).m_ttl = 0.1f; } public override void Setup(Character character) { ((SE_Stats)this).Setup(character); Player val = (Player)(object)((character is Player) ? character : null); if (Object.op_Implicit((Object)(object)val)) { GameObject prefab = ZNetScene.instance.GetPrefab("SpearChitin"); if (Object.op_Implicit((Object)(object)prefab) && !((Humanoid)val).GetInventory().ContainsItemByName("$item_spear_chitin")) { SuperVikingKart.DebugLog("SE_KartHarpoon - Adding harpoon to " + val.GetPlayerName()); ((Humanoid)val).GetInventory().AddItem(prefab, 1); } } } } internal class SE_KartBerserk : SE_Stats { public void OnEnable() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown ((Object)this).name = "SuperVikingKart_Berserk"; ((StatusEffect)this).m_ttl = 30f; ((StatusEffect)this).m_icon = Cache.GetPrefab("potion_bzerker"); GameObject prefab = Cache.GetPrefab("vfx_MeadBzerker"); if (Object.op_Implicit((Object)(object)prefab)) { ((StatusEffect)this).m_startEffects.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { new EffectData { m_prefab = prefab, m_enabled = true, m_attach = true } }; } } public override void Setup(Character character) { ((SE_Stats)this).Setup(character); SuperVikingKart.DebugLog("SE_KartBerserk - Applied to " + character.m_name); } public override void ModifyAttack(SkillType skill, ref HitData hitData) { hitData.m_damage.m_damage *= 3f; hitData.m_damage.m_blunt *= 3f; hitData.m_damage.m_slash *= 3f; hitData.m_damage.m_pierce *= 3f; } public override void Stop() { SuperVikingKart.DebugLog("SE_KartBerserk - Stopped on " + ((StatusEffect)this).m_character?.m_name); ((StatusEffect)this).Stop(); } } internal class SE_KartShield : SE_Stats { public void OnEnable() { //IL_0070: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown ((Object)this).name = "SuperVikingKart_Shield"; ((StatusEffect)this).m_ttl = 30f; ((StatusEffect)this).m_icon = Cache.GetPrefab("TrophyBonemass"); GameObject prefab = Cache.GetPrefab("fx_GP_Activation"); if (Object.op_Implicit((Object)(object)prefab)) { ((StatusEffect)this).m_startEffects.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { new EffectData { m_prefab = prefab, m_enabled = true, m_attach = true } }; } base.m_mods = new List { new DamageModPair { m_type = (DamageType)1, m_modifier = (DamageModifier)1 }, new DamageModPair { m_type = (DamageType)2, m_modifier = (DamageModifier)1 }, new DamageModPair { m_type = (DamageType)4, m_modifier = (DamageModifier)1 } }; } public override void Setup(Character character) { ((SE_Stats)this).Setup(character); SuperVikingKart.DebugLog("SE_KartShield - Applied to " + character.m_name); } public override void Stop() { SuperVikingKart.DebugLog("SE_KartShield - Stopped on " + ((StatusEffect)this).m_character?.m_name); ((StatusEffect)this).Stop(); } } internal class SE_KartHealthRegen : SE_Stats { public void OnEnable() { //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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown ((Object)this).name = "SuperVikingKart_HealthRegen"; ((StatusEffect)this).m_ttl = 10f; ((StatusEffect)this).m_icon = Cache.GetPrefab("potion_health_minor"); GameObject prefab = Cache.GetPrefab("vfx_Potion_health_medium"); GameObject prefab2 = Cache.GetPrefab("sfx_Potion_health_minor"); if (Object.op_Implicit((Object)(object)prefab) && Object.op_Implicit((Object)(object)prefab2)) { ((StatusEffect)this).m_startEffects.m_effectPrefabs = (EffectData[])(object)new EffectData[2] { new EffectData { m_prefab = prefab, m_enabled = true, m_attach = true }, new EffectData { m_prefab = prefab2, m_enabled = true, m_attach = true } }; } base.m_healthOverTime = 100f; base.m_healthOverTimeInterval = 2f; } public override void Setup(Character character) { ((SE_Stats)this).Setup(character); SuperVikingKart.DebugLog("SE_KartStaminaRegen - Applied to " + character.m_name); } public override void Stop() { SuperVikingKart.DebugLog("SE_KartStaminaRegen - Stopped on " + ((StatusEffect)this).m_character?.m_name); ((StatusEffect)this).Stop(); } } internal class SE_KartHealthBurst : SE_Stats { public void OnEnable() { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown ((Object)this).name = "SuperVikingKart_HealthBurst"; ((StatusEffect)this).m_ttl = 2f; GameObject prefab = Cache.GetPrefab("vfx_Potion_health_medium"); GameObject prefab2 = Cache.GetPrefab("sfx_Potion_health_large"); if (Object.op_Implicit((Object)(object)prefab) && Object.op_Implicit((Object)(object)prefab2)) { ((StatusEffect)this).m_startEffects.m_effectPrefabs = (EffectData[])(object)new EffectData[2] { new EffectData { m_prefab = prefab, m_enabled = true, m_attach = true }, new EffectData { m_prefab = prefab2, m_enabled = true, m_attach = true } }; } } public override void Setup(Character character) { ((SE_Stats)this).Setup(character); character.Heal(character.GetMaxHealth(), true); SuperVikingKart.DebugLog("SE_KartHealthBurst - Fully healed " + character.m_name); } } internal class SE_KartLivingDead : SE_Stats { private bool _triggered; public void OnEnable() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown ((Object)this).name = "SuperVikingKart_LivingDead"; ((StatusEffect)this).m_ttl = 20f; ((StatusEffect)this).m_icon = Cache.GetPrefab("CorpseRun"); GameObject prefab = Cache.GetPrefab("vfx_corpse_destruction_medium"); if (Object.op_Implicit((Object)(object)prefab)) { ((StatusEffect)this).m_startEffects.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { new EffectData { m_prefab = prefab, m_enabled = true, m_attach = true } }; } } public override void Setup(Character character) { _triggered = false; ((SE_Stats)this).Setup(character); SuperVikingKart.DebugLog("SE_KartLivingDead - Applied to " + character.m_name); } public override void OnDamaged(HitData hit, Character attacker) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) if (!_triggered && ((StatusEffect)this).m_character.GetHealth() - hit.GetTotalDamage() <= 0f) { _triggered = true; hit.m_damage = default(DamageTypes); ((StatusEffect)this).m_character.SetHealth(1f); ((StatusEffect)this).m_character.Message((MessageType)2, "Living Dead saved you!", 0, (Sprite)null); SuperVikingKart.DebugLog("SE_KartLivingDead - Blocked death for " + ((StatusEffect)this).m_character.m_name); ((StatusEffect)this).Stop(); } } public override void Stop() { SuperVikingKart.DebugLog("SE_KartLivingDead - Stopped on " + ((StatusEffect)this).m_character?.m_name); ((StatusEffect)this).Stop(); } } internal class SE_KartFrost : SE_Stats { public void OnEnable() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown ((Object)this).name = "SuperVikingKart_Frost"; ((StatusEffect)this).m_ttl = 8f; ((StatusEffect)this).m_icon = Cache.GetPrefab("Frost"); GameObject prefab = Cache.GetPrefab("vfx_Frost"); if (Object.op_Implicit((Object)(object)prefab)) { ((StatusEffect)this).m_startEffects.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { new EffectData { m_prefab = prefab, m_enabled = true, m_attach = true } }; } } public override void Setup(Character character) { ((SE_Stats)this).Setup(character); SuperVikingKart.DebugLog("SE_KartFrost - Applied to " + character.m_name); } public override void ModifySpeed(float baseSpeed, ref float speed, Character character, Vector3 dir) { speed *= 0.5f; } public override void Stop() { SuperVikingKart.DebugLog("SE_KartFrost - Stopped on " + ((StatusEffect)this).m_character?.m_name); ((StatusEffect)this).Stop(); } } internal class SE_KartTarred : SE_Stats { public void OnEnable() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown ((Object)this).name = "SuperVikingKart_Tarred"; ((StatusEffect)this).m_ttl = 8f; ((StatusEffect)this).m_icon = Cache.GetPrefab("Tared"); GameObject prefab = Cache.GetPrefab("vfx_Tared"); if (Object.op_Implicit((Object)(object)prefab)) { ((StatusEffect)this).m_startEffects.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { new EffectData { m_prefab = prefab, m_enabled = true, m_attach = true } }; } } public override void Setup(Character character) { ((SE_Stats)this).Setup(character); SuperVikingKart.DebugLog("SE_KartTarred - Applied to " + character.m_name); } public override void ModifySpeed(float baseSpeed, ref float speed, Character character, Vector3 dir) { speed *= 0.3f; } public override void Stop() { SuperVikingKart.DebugLog("SE_KartTarred - Stopped on " + ((StatusEffect)this).m_character?.m_name); ((StatusEffect)this).Stop(); } } internal class SE_KartBounce : SE_Stats { public void OnEnable() { ((Object)this).name = "SuperVikingKart_Bounce"; ((StatusEffect)this).m_ttl = 0.1f; } public override void Setup(Character character) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) ((SE_Stats)this).Setup(character); Player val = (Player)(object)((character is Player) ? character : null); if (!Object.op_Implicit((Object)(object)val)) { return; } foreach (Vagon instance in Vagon.m_instances) { if (instance.IsAttached((Character)(object)val)) { Rigidbody[] bodies = instance.m_bodies; for (int i = 0; i < bodies.Length; i++) { bodies[i].AddForce(Vector3.up * 40f, (ForceMode)1); } SuperVikingKart.DebugLog("SE_KartBounce - Launched cart"); break; } } } } internal class SE_KartPoison : SE_Stats { private float _timer; public void OnEnable() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown ((Object)this).name = "SuperVikingKart_Poison"; ((StatusEffect)this).m_ttl = 10f; ((StatusEffect)this).m_icon = Cache.GetPrefab("Poison"); GameObject prefab = Cache.GetPrefab("vfx_Poison"); if (Object.op_Implicit((Object)(object)prefab)) { ((StatusEffect)this).m_startEffects.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { new EffectData { m_prefab = prefab, m_enabled = true, m_attach = true } }; } } public override void Setup(Character character) { ((SE_Stats)this).Setup(character); SuperVikingKart.DebugLog("SE_KartPoison - Applied to " + character.m_name); } public override void UpdateStatusEffect(float dt) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) ((SE_Stats)this).UpdateStatusEffect(dt); _timer -= dt; if (!(_timer > 0f)) { _timer = 1f; HitData val = new HitData(); val.m_point = ((StatusEffect)this).m_character.GetCenterPoint(); val.m_damage.m_poison = 2f; val.m_hitType = (HitType)7; ((StatusEffect)this).m_character.ApplyDamage(val, true, false, (DamageModifier)0); } } public override void Stop() { SuperVikingKart.DebugLog("SE_KartPoison - Stopped on " + ((StatusEffect)this).m_character?.m_name); ((StatusEffect)this).Stop(); } } internal class SE_KartBurn : SE_Stats { private float _timer; public void OnEnable() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown ((Object)this).name = "SuperVikingKart_Burn"; ((StatusEffect)this).m_ttl = 3f; ((StatusEffect)this).m_icon = Cache.GetPrefab("Burning"); GameObject prefab = Cache.GetPrefab("vfx_Burning"); if (Object.op_Implicit((Object)(object)prefab)) { ((StatusEffect)this).m_startEffects.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { new EffectData { m_prefab = prefab, m_enabled = true, m_attach = true } }; } } public override void Setup(Character character) { ((SE_Stats)this).Setup(character); SuperVikingKart.DebugLog("SE_KartBurn - Applied to " + character.m_name); } public override void UpdateStatusEffect(float dt) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) ((SE_Stats)this).UpdateStatusEffect(dt); _timer -= dt; if (!(_timer > 0f)) { _timer = 1f; HitData val = new HitData(); val.m_point = ((StatusEffect)this).m_character.GetCenterPoint(); val.m_damage.m_fire = 10f; val.m_hitType = (HitType)5; ((StatusEffect)this).m_character.ApplyDamage(val, true, false, (DamageModifier)0); } } public override void Stop() { SuperVikingKart.DebugLog("SE_KartBurn - Stopped on " + ((StatusEffect)this).m_character?.m_name); ((StatusEffect)this).Stop(); } } internal class SE_KartStagger : SE_Stats { public void OnEnable() { ((Object)this).name = "SuperVikingKart_Stagger"; ((StatusEffect)this).m_ttl = 0.1f; } public override void Setup(Character character) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) ((SE_Stats)this).Setup(character); character.Stagger(((Component)character).transform.forward * -1f); SuperVikingKart.DebugLog("SE_KartStagger - Staggered " + character.m_name); } } internal class SE_KartDisarm : SE_Stats { public void OnEnable() { ((Object)this).name = "SuperVikingKart_Disarm"; ((StatusEffect)this).m_ttl = 0.1f; } public override void Setup(Character character) { ((SE_Stats)this).Setup(character); Player val = (Player)(object)((character is Player) ? character : null); if (Object.op_Implicit((Object)(object)val)) { ItemData rightItem = ((Humanoid)val).GetRightItem(); if (rightItem != null) { SuperVikingKart.DebugLog("SE_KartDisarm - Dropping " + rightItem.m_shared.m_name + " from " + val.GetPlayerName()); ((Humanoid)val).DropItem(((Humanoid)val).GetInventory(), rightItem, 100); } ItemData leftItem = ((Humanoid)val).GetLeftItem(); if (leftItem != null) { SuperVikingKart.DebugLog("SE_KartDisarm - Dropping " + leftItem.m_shared.m_name + " from " + val.GetPlayerName()); ((Humanoid)val).DropItem(((Humanoid)val).GetInventory(), leftItem, 100); } } } } internal class SE_KartWeak : SE_Stats { public void OnEnable() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown ((Object)this).name = "SuperVikingKart_Weak"; ((StatusEffect)this).m_ttl = 30f; ((StatusEffect)this).m_icon = Cache.GetPrefab("Wet"); GameObject prefab = Cache.GetPrefab("vfx_Wet"); if (Object.op_Implicit((Object)(object)prefab)) { ((StatusEffect)this).m_startEffects.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { new EffectData { m_prefab = prefab, m_enabled = true, m_attach = true } }; } base.m_healthRegenMultiplier = 0.75f; base.m_staminaRegenMultiplier = 0.85f; base.m_eitrRegenMultiplier = 0.85f; } public override void Setup(Character character) { ((SE_Stats)this).Setup(character); SuperVikingKart.DebugLog("SE_KartWeak - Applied to " + character.m_name); } public override void Stop() { SuperVikingKart.DebugLog("SE_KartWeak - Stopped on " + ((StatusEffect)this).m_character?.m_name); ((StatusEffect)this).Stop(); } } internal class SE_KartShock : SE_Stats { private float _timer; public void OnEnable() { //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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown ((Object)this).name = "SuperVikingKart_Shock"; ((StatusEffect)this).m_ttl = 5f; ((StatusEffect)this).m_icon = Cache.GetPrefab("Lightning"); GameObject prefab = Cache.GetPrefab("vfx_FireWork_ThunderStone"); GameObject prefab2 = Cache.GetPrefab("fx_Lightning"); if (Object.op_Implicit((Object)(object)prefab) && Object.op_Implicit((Object)(object)prefab2)) { ((StatusEffect)this).m_startEffects.m_effectPrefabs = (EffectData[])(object)new EffectData[2] { new EffectData { m_prefab = prefab, m_enabled = true, m_attach = true }, new EffectData { m_prefab = prefab2, m_enabled = true, m_attach = true } }; } } public override void Setup(Character character) { ((SE_Stats)this).Setup(character); SuperVikingKart.DebugLog("SE_KartShock - Applied to " + character.m_name); } public override void UpdateStatusEffect(float dt) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) ((SE_Stats)this).UpdateStatusEffect(dt); _timer -= dt; if (!(_timer > 0f)) { _timer = 1f; HitData val = new HitData(); val.m_point = ((StatusEffect)this).m_character.GetCenterPoint(); val.m_damage.m_lightning = 5f; ((StatusEffect)this).m_character.ApplyDamage(val, true, false, (DamageModifier)0); } } public override void ModifySpeed(float baseSpeed, ref float speed, Character character, Vector3 dir) { speed *= 0.7f; } public override void Stop() { SuperVikingKart.DebugLog("SE_KartShock - Stopped on " + ((StatusEffect)this).m_character?.m_name); ((StatusEffect)this).Stop(); } } internal class SE_KartBlind : SE_Stats { private GameObject _overlay; private float _elapsed; private const float TarAlpha = 0.99f; private const float VignetteAlpha = 0.98f; private const float PulseSpeed = 0.6f; private const float PulseStrength = 0.06f; public void OnEnable() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown ((Object)this).name = "SuperVikingKart_Blind"; ((StatusEffect)this).m_ttl = 5f; ((StatusEffect)this).m_icon = Cache.GetPrefab("Smoked"); GameObject prefab = Cache.GetPrefab("vfx_Smoked"); if (Object.op_Implicit((Object)(object)prefab)) { ((StatusEffect)this).m_startEffects.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { new EffectData { m_prefab = prefab, m_enabled = true, m_attach = true } }; } } public override void Setup(Character character) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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) ((SE_Stats)this).Setup(character); if (!((Object)(object)character != (Object)(object)Player.m_localPlayer)) { _overlay = new GameObject("BlindOverlay"); Canvas obj = _overlay.AddComponent(); obj.renderMode = (RenderMode)0; obj.sortingOrder = 999; _overlay.AddComponent(); _overlay.AddComponent(); CreateFullscreenImage(_overlay.transform, "TarBase", new Color(0.05f, 0.03f, 0.01f, 0.99f)); CreateFullscreenImage(_overlay.transform, "Vignette", new Color(0f, 0f, 0f, 0.98f)).GetComponent().sprite = CreateVignetteSprite(256); CreateFullscreenImage(_overlay.transform, "TarSheen", new Color(0.02f, 0.06f, 0.01f, 0.75f)); _elapsed = 0f; SuperVikingKart.DebugLog("SE_KartBlind - Applied to " + character.m_name); } } public override void UpdateStatusEffect(float dt) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) ((SE_Stats)this).UpdateStatusEffect(dt); if (!((Object)(object)_overlay == (Object)null)) { _elapsed += dt; Transform val = _overlay.transform.Find("TarSheen"); if (Object.op_Implicit((Object)(object)val)) { Image component = ((Component)val).GetComponent(); float num = Mathf.Sin(_elapsed * 0.6f * (float)Math.PI * 2f) * 0.06f; Color color = ((Graphic)component).color; color.a = Mathf.Clamp01(0.25f + num); ((Graphic)component).color = color; } } } public override void Stop() { SuperVikingKart.DebugLog("SE_KartBlind - Stopped on " + ((StatusEffect)this).m_character?.m_name); if (Object.op_Implicit((Object)(object)_overlay)) { Object.Destroy((Object)(object)_overlay); } ((StatusEffect)this).Stop(); } private static GameObject CreateFullscreenImage(Transform parent, string goName, Color color) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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_0051: Expected O, but got Unknown GameObject val = new GameObject(goName); val.transform.SetParent(parent, false); RectTransform obj = val.AddComponent(); obj.anchorMin = Vector2.zero; obj.anchorMax = Vector2.one; obj.offsetMin = Vector2.zero; obj.offsetMax = Vector2.zero; ((Graphic)val.AddComponent()).color = color; return val; } private static Sprite CreateVignetteSprite(int size) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(size, size, (TextureFormat)4, false); ((Texture)val).wrapMode = (TextureWrapMode)1; Color32[] array = (Color32[])(object)new Color32[size * size]; float num = (float)size * 0.5f; for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { float num2 = ((float)j - num) / num; float num3 = ((float)i - num) / num; float num4 = Mathf.Clamp01(Mathf.Sqrt(num2 * num2 + num3 * num3)); float num5 = Mathf.SmoothStep(0.3f, 1f, num4); array[i * size + j] = new Color32((byte)0, (byte)0, (byte)0, (byte)(num5 * 255f)); } } val.SetPixels32(array); val.Apply(); return Sprite.Create(val, new Rect(0f, 0f, (float)size, (float)size), new Vector2(0.5f, 0.5f)); } } internal enum RaceBoardButtonType { Register, Start, Reset, Admin } internal class RaceBoardButton : MonoBehaviour, Hoverable, Interactable { public RaceBoardButtonType ButtonType; public RaceBoardComponent Board; public bool Interact(Humanoid user, bool hold, bool alt) { if (hold) { return false; } Player val = (Player)(object)((user is Player) ? user : null); if (!Object.op_Implicit((Object)(object)val) || (Object)(object)val != (Object)(object)Player.m_localPlayer) { return false; } Board.OnButtonInteract(ButtonType, val); return true; } public bool UseItem(Humanoid user, ItemData item) { return false; } public string GetHoverText() { if ((Object)(object)Board == (Object)null) { return ""; } Race race = RaceManager.GetRace(Board.GetRaceId()); Localization instance = Localization.instance; return instance.Localize(ButtonType switch { RaceBoardButtonType.Register => GetRegisterHoverText(race), RaceBoardButtonType.Start => GetStartHoverText(race), RaceBoardButtonType.Reset => GetResetHoverText(race), RaceBoardButtonType.Admin => "[$KEY_Use] Configure Board", _ => "", }); } public string GetHoverName() { return ButtonType switch { RaceBoardButtonType.Register => "Register", RaceBoardButtonType.Start => "Start Race", RaceBoardButtonType.Reset => "Reset Race", RaceBoardButtonType.Admin => "Configure Board", _ => "", }; } private string GetRegisterHoverText(Race race) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) if (race == null) { return "No race configured"; } if (race.State == RaceState.Countdown) { return "Race is about to begin"; } if (race.State == RaceState.Finished) { return "Race is already finished"; } Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return ""; } if (!race.IsRegistered(((Character)localPlayer).GetZDOID())) { return "[$KEY_Use] Register"; } return "[$KEY_Use] Leave Race"; } private string GetStartHoverText(Race race) { if (race == null) { return "No race configured"; } if (race.State == RaceState.Countdown) { return "Race is about to begin"; } if (race.State == RaceState.Racing) { return "Race is already running"; } if (race.State == RaceState.Finished) { return "Race is already finished"; } return "[$KEY_Use] Start Race"; } private string GetResetHoverText(Race race) { if (race == null) { return "No race configured"; } if (race.State != 0) { return "[$KEY_Use] Reset Race"; } return "Nothing to reset"; } } internal class RaceBoardComponent : MonoBehaviour, Hoverable { private const string ZdoKeyRaceId = "SuperVikingKart_RaceBoard_RaceId"; private const string ZdoKeyName = "SuperVikingKart_RaceBoard_Name"; private const string ZdoKeyLaps = "SuperVikingKart_RaceBoard_Laps"; private const string ZdoKeyDescription = "SuperVikingKart_RaceBoard_Description"; private const string ZdoKeyHideButtons = "SuperVikingKart_RaceBoard_HideButtons"; private const string ZdoKeyHideDescription = "SuperVikingKart_RaceBoard_HideDescription"; private const string ZdoKeyHideStatus = "SuperVikingKart_RaceBoard_HideStatus"; public TextMeshPro StatusDisplay; public RaceBoardButton RegisterButton; public RaceBoardButton StartButton; public RaceBoardButton ResetButton; public RaceBoardButton AdminButton; public GameObject ButtonRow; private ZNetView _netView; private void Awake() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) _netView = ((Component)this).GetComponent(); if (!Object.op_Implicit((Object)(object)_netView) || _netView.GetZDO() == null) { SuperVikingKart.DebugLog("RaceBoard Awake - no ZNetView or ZDO, disabling"); ((Behaviour)this).enabled = false; return; } SuperVikingKart.DebugLog($"RaceBoard Awake - ZDO: {_netView.GetZDO().m_uid}"); if (!_netView.IsOwner()) { return; } string raceId = GetRaceId(); if (!string.IsNullOrEmpty(raceId)) { Race race = RaceManager.GetRace(raceId); if (race == null) { string raceName = GetRaceName(); int laps = GetLaps(); string description = GetDescription(); SuperVikingKart.DebugLog($"RaceBoard Awake - Bootstrapping race [{raceId}] \"{raceName}\" ({laps} laps)"); RaceManager.SendCreateRace(raceId, raceName, laps, description); } else { _netView.GetZDO().Set("SuperVikingKart_RaceBoard_Name", race.Name); _netView.GetZDO().Set("SuperVikingKart_RaceBoard_Laps", race.TotalLaps); _netView.GetZDO().Set("SuperVikingKart_RaceBoard_Description", race.Description); SuperVikingKart.DebugLog("RaceBoard Awake - Synced ZDO from RaceManager for [" + raceId + "]"); } } } private void OnEnable() { RaceManager.OnRaceChanged += OnRaceChanged; ApplyHideButtons(); UpdateStatusDisplay(); UpdateRegisterButtonText(); } private void OnDisable() { RaceManager.OnRaceChanged -= OnRaceChanged; } private void ApplyHideButtons() { if (Object.op_Implicit((Object)(object)ButtonRow)) { ButtonRow.SetActive(!GetHideButtons()); } } private void OnRaceChanged(string raceId) { if (raceId != GetRaceId()) { return; } if (_netView.IsOwner()) { Race race = RaceManager.GetRace(raceId); if (race != null) { if (GetRaceName() != race.Name) { _netView.GetZDO().Set("SuperVikingKart_RaceBoard_Name", race.Name); } if (GetLaps() != race.TotalLaps) { _netView.GetZDO().Set("SuperVikingKart_RaceBoard_Laps", race.TotalLaps); } if (GetDescription() != race.Description) { _netView.GetZDO().Set("SuperVikingKart_RaceBoard_Description", race.Description); } } } UpdateStatusDisplay(); UpdateRegisterButtonText(); } private void UpdateStatusDisplay() { if (!Object.op_Implicit((Object)(object)StatusDisplay)) { return; } string raceId = GetRaceId(); if (string.IsNullOrEmpty(raceId)) { ((TMP_Text)StatusDisplay).text = "Not configured\nUse the Admin button to set up this board."; return; } Race race = RaceManager.GetRace(raceId); if (race == null) { ((TMP_Text)StatusDisplay).text = "[" + raceId + "]\nWaiting for race data..."; } else { ((TMP_Text)StatusDisplay).text = BuildStatusText(race); } } private string BuildStatusText(Race race) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("" + race.Name + ""); stringBuilder.AppendLine(string.Format("{0} {1}", race.TotalLaps, (race.TotalLaps == 1) ? "lap" : "laps")); if (!GetHideDescription() && !string.IsNullOrWhiteSpace(race.Description)) { stringBuilder.AppendLine(); stringBuilder.AppendLine("" + race.Description + ""); } if (!GetHideStatus()) { stringBuilder.AppendLine(); switch (race.State) { case RaceState.Idle: stringBuilder.AppendLine((race.Contestants.Count == 0) ? "Waiting for players..." : $"{race.Contestants.Count} registered"); foreach (RaceContestant contestant in race.Contestants) { stringBuilder.AppendLine(" " + contestant.PlayerName); } break; case RaceState.Countdown: stringBuilder.AppendLine("Get ready!"); break; case RaceState.Racing: stringBuilder.AppendLine("RACING"); stringBuilder.AppendLine(); foreach (RaceContestant item in race.GetLiveRanking()) { if (item.IsDnf) { string text = ((item.LastCheckpointIndex > 0) ? $" CP {item.LastCheckpointIndex}" : ""); stringBuilder.AppendLine($" DNF {item.PlayerName} (Lap {item.CurrentLap}/{race.TotalLaps}{text})"); } else if (item.Finished && item.Position > 0) { stringBuilder.AppendLine($" P{item.Position} {item.PlayerName} - {RaceUtils.FormatTime(item.FinishTime)}"); } else if (item.Finished) { stringBuilder.AppendLine(" Finished " + item.PlayerName + " - " + RaceUtils.FormatTime(item.FinishTime)); } else { string text2 = ((item.LastCheckpointIndex > 0) ? $" CP {item.LastCheckpointIndex}" : ""); stringBuilder.AppendLine($" Lap {item.CurrentLap}/{race.TotalLaps}{text2} ({RaceUtils.FormatTime(item.LastCheckpointTime)}) {item.PlayerName}"); } } break; case RaceState.Finished: stringBuilder.AppendLine("FINISHED"); stringBuilder.AppendLine(); stringBuilder.Append(race.GetResultsText()); break; } } return stringBuilder.ToString(); } private void UpdateRegisterButtonText() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)RegisterButton)) { TextMeshPro componentInChildren = ((Component)RegisterButton).GetComponentInChildren(); if (!((Object)(object)componentInChildren == (Object)null)) { Race race = RaceManager.GetRace(GetRaceId()); Player localPlayer = Player.m_localPlayer; bool flag = race != null && (Object)(object)localPlayer != (Object)null && race.IsRegistered(((Character)localPlayer).GetZDOID()); ((TMP_Text)componentInChildren).text = (flag ? "Unregister" : "Register"); } } } public void OnButtonInteract(RaceBoardButtonType buttonType, Player player) { string raceId = GetRaceId(); if (string.IsNullOrEmpty(raceId) && buttonType != RaceBoardButtonType.Admin) { ((Character)player).Message((MessageType)2, "This board is not configured yet", 0, (Sprite)null); return; } Race race = RaceManager.GetRace(raceId); if (race == null && buttonType != RaceBoardButtonType.Admin) { ((Character)player).Message((MessageType)2, "Race not found", 0, (Sprite)null); return; } switch (buttonType) { case RaceBoardButtonType.Register: HandleRegister(race, player); break; case RaceBoardButtonType.Start: HandleStart(race, player); break; case RaceBoardButtonType.Reset: HandleReset(race, player); break; case RaceBoardButtonType.Admin: HandleAdmin(race, player); break; } } private void HandleRegister(Race race, Player player) { //IL_0048: 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_005b: Unknown result type (might be due to invalid IL or missing references) if (race.State == RaceState.Countdown) { ((Character)player).Message((MessageType)2, race.Name + " is about to start", 0, (Sprite)null); } else if (race.State == RaceState.Finished) { ((Character)player).Message((MessageType)2, race.Name + " is already finished", 0, (Sprite)null); } else if (race.IsRegistered(((Character)player).GetZDOID())) { RaceManager.SendUnregister(race.RaceId, ((Character)player).GetZDOID()); } else { RaceManager.SendRegister(race.RaceId, player.GetPlayerName(), ((Character)player).GetZDOID()); } } private void HandleStart(Race race, Player player) { if (race.State == RaceState.Countdown) { ((Character)player).Message((MessageType)2, race.Name + " is about to start", 0, (Sprite)null); } else if (race.State == RaceState.Racing) { ((Character)player).Message((MessageType)2, race.Name + " is already running", 0, (Sprite)null); } else if (race.State == RaceState.Finished) { ((Character)player).Message((MessageType)2, race.Name + " is already finished", 0, (Sprite)null); } else if (race.Contestants.Count == 0) { ((Character)player).Message((MessageType)2, "No contestants registered", 0, (Sprite)null); } else { RaceManager.SendStartCountdown(race.RaceId); } } private void HandleReset(Race race, Player player) { if (race.State == RaceState.Idle) { ((Character)player).Message((MessageType)2, "Nothing to reset", 0, (Sprite)null); } else if (race.State == RaceState.Racing) { RaceBoardResetConfirmGui.Open(this); } else { RaceManager.SendReset(race.RaceId); } } private void HandleAdmin(Race race, Player player) { if (!SynchronizationManager.Instance.PlayerIsAdmin) { ((Character)player).Message((MessageType)2, "You need to be an admin to configure this board", 0, (Sprite)null); } else { RaceBoardAdminGui.Open(this); } } public void Configure(string raceId, string name, int laps, string description, bool hideButtons, bool hideDescription, bool hideStatus) { _netView.ClaimOwnership(); _netView.GetZDO().Set("SuperVikingKart_RaceBoard_RaceId", raceId); _netView.GetZDO().Set("SuperVikingKart_RaceBoard_Name", name); _netView.GetZDO().Set("SuperVikingKart_RaceBoard_Laps", laps); _netView.GetZDO().Set("SuperVikingKart_RaceBoard_Description", description); _netView.GetZDO().Set("SuperVikingKart_RaceBoard_HideButtons", hideButtons); _netView.GetZDO().Set("SuperVikingKart_RaceBoard_HideDescription", hideDescription); _netView.GetZDO().Set("SuperVikingKart_RaceBoard_HideStatus", hideStatus); ApplyHideButtons(); UpdateStatusDisplay(); Race race = RaceManager.GetRace(raceId); if (race == null) { RaceManager.SendCreateRace(raceId, name, laps, description); return; } if (race.Name != name) { RaceManager.SendSetName(raceId, name); } if (race.TotalLaps != laps) { RaceManager.SendSetLaps(raceId, laps); } if (race.Description != description) { RaceManager.SendSetDescription(raceId, description); } } public string GetRaceId() { ZNetView netView = _netView; object obj; if (netView == null) { obj = null; } else { ZDO zDO = netView.GetZDO(); obj = ((zDO != null) ? zDO.GetString("SuperVikingKart_RaceBoard_RaceId", "") : null); } if (obj == null) { obj = ""; } return (string)obj; } public string GetRaceName() { ZNetView netView = _netView; object obj; if (netView == null) { obj = null; } else { ZDO zDO = netView.GetZDO(); obj = ((zDO != null) ? zDO.GetString("SuperVikingKart_RaceBoard_Name", "") : null); } if (obj == null) { obj = ""; } return (string)obj; } public int GetLaps() { ZNetView netView = _netView; int? obj; if (netView == null) { obj = null; } else { ZDO zDO = netView.GetZDO(); obj = ((zDO != null) ? new int?(zDO.GetInt("SuperVikingKart_RaceBoard_Laps", 1)) : null); } int? num = obj; return num.GetValueOrDefault(1); } public string GetDescription() { ZNetView netView = _netView; object obj; if (netView == null) { obj = null; } else { ZDO zDO = netView.GetZDO(); obj = ((zDO != null) ? zDO.GetString("SuperVikingKart_RaceBoard_Description", "") : null); } if (obj == null) { obj = ""; } return (string)obj; } public bool GetHideButtons() { ZNetView netView = _netView; bool? obj; if (netView == null) { obj = null; } else { ZDO zDO = netView.GetZDO(); obj = ((zDO != null) ? new bool?(zDO.GetBool("SuperVikingKart_RaceBoard_HideButtons", false)) : null); } bool? flag = obj; return flag.GetValueOrDefault(); } public bool GetHideDescription() { ZNetView netView = _netView; bool? obj; if (netView == null) { obj = null; } else { ZDO zDO = netView.GetZDO(); obj = ((zDO != null) ? new bool?(zDO.GetBool("SuperVikingKart_RaceBoard_HideDescription", false)) : null); } bool? flag = obj; return flag.GetValueOrDefault(); } public bool GetHideStatus() { ZNetView netView = _netView; bool? obj; if (netView == null) { obj = null; } else { ZDO zDO = netView.GetZDO(); obj = ((zDO != null) ? new bool?(zDO.GetBool("SuperVikingKart_RaceBoard_HideStatus", false)) : null); } bool? flag = obj; return flag.GetValueOrDefault(); } public string GetHoverText() { string raceId = GetRaceId(); if (string.IsNullOrEmpty(raceId)) { return "Race Board\nNot configured"; } Race race = RaceManager.GetRace(raceId); if (race != null) { return "Race Board\n" + race.Name; } return "Race Board\n[" + raceId + "]"; } public string GetHoverName() { return "Race Board"; } } internal static class RaceBoardAdminGui { private static GameObject _panel; private static RaceBoardComponent _currentBoard; private static InputField _raceIdField; private static InputField _nameField; private static InputField _lapsField; private static InputField _descriptionField; private static Toggle _hideButtonsToggle; private static Toggle _hideDescriptionToggle; private static Toggle _hideStatusToggle; public static void Build() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Expected O, but got Unknown //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Expected O, but got Unknown //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: 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_032f: Expected O, but got Unknown //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Unknown result type (might be due to invalid IL or missing references) //IL_03d3: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)GUIManager.CustomGUIFront)) { if (Object.op_Implicit((Object)(object)_panel)) { Object.DestroyImmediate((Object)(object)_panel); _panel = null; } _panel = GUIManager.Instance.CreateWoodpanel(GUIManager.CustomGUIFront.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), Vector2.zero, 420f, 420f, true); _panel.SetActive(false); VerticalLayoutGroup obj = _panel.AddComponent(); ((LayoutGroup)obj).padding = new RectOffset(20, 20, 20, 20); ((HorizontalOrVerticalLayoutGroup)obj).spacing = 10f; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false; ((LayoutGroup)obj).childAlignment = (TextAnchor)0; GameObject obj2 = GUIManager.Instance.CreateText("Configure Race Board", _panel.transform, new Vector2(0f, 0.5f), new Vector2(1f, 0.5f), Vector2.zero, GUIManager.Instance.AveriaSerifBold, 20, GUIManager.Instance.ValheimOrange, true, Color.black, 380f, 30f, false); obj2.GetComponent().alignment = (TextAnchor)4; LayoutElement obj3 = obj2.AddComponent(); obj3.preferredHeight = 30f; obj3.minHeight = 30f; obj3.flexibleHeight = 0f; AddLabeledField("Race ID", out _raceIdField, (ContentType)0, "meadows_gp", 30f, multiLine: false); ((UnityEvent)(object)_raceIdField.onValueChanged).AddListener((UnityAction)OnRaceIdChanged); AddLabeledField("Name", out _nameField, (ContentType)0, "Meadows Grand Prix", 30f, multiLine: false); AddLabeledField("Laps", out _lapsField, (ContentType)2, "1", 30f, multiLine: false); AddLabeledField("Description", out _descriptionField, (ContentType)0, "Optional track description...", 60f, multiLine: true); AddToggleRow("Hide Buttons", out _hideButtonsToggle); AddToggleRow("Hide Desc.", out _hideDescriptionToggle); AddToggleRow("Hide Status", out _hideStatusToggle); GameObject val = new GameObject("ButtonRow", new Type[2] { typeof(RectTransform), typeof(HorizontalLayoutGroup) }); val.transform.SetParent(_panel.transform, false); LayoutElement obj4 = val.AddComponent(); obj4.preferredHeight = 40f; obj4.minHeight = 40f; obj4.flexibleHeight = 0f; HorizontalLayoutGroup component = val.GetComponent(); ((HorizontalOrVerticalLayoutGroup)component).spacing = 10f; ((HorizontalOrVerticalLayoutGroup)component).childForceExpandWidth = false; ((HorizontalOrVerticalLayoutGroup)component).childForceExpandHeight = false; ((LayoutGroup)component).childAlignment = (TextAnchor)4; GameObject obj5 = GUIManager.Instance.CreateButton("Cancel", val.transform, new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), Vector2.zero, 160f, 40f); LayoutElement obj6 = obj5.AddComponent(); obj6.preferredWidth = 160f; obj6.minWidth = 160f; obj6.flexibleWidth = 0f; obj6.preferredHeight = 40f; obj6.minHeight = 40f; obj6.flexibleHeight = 0f; ((UnityEvent)obj5.GetComponent