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.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using On;
using Unity.Netcode;
using Unity.Netcode.Components;
using UnityEngine;
using UnityEngine.Localization.Settings;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using WormAPI.NetcodePatcher;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("WormAPI")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("An API/Utility Library for modding Last Train Outta' Wormtown")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("WormAPI")]
[assembly: AssemblyTitle("WormAPI")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
static <Module>()
{
}
}
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace WormAPI
{
public class AssetHelper
{
internal static List<SceneAsset> assetQueue = new List<SceneAsset>();
public static void Initialize()
{
SceneManager.activeSceneChanged += UpdateAssetQueue;
}
public static void UpdateAssetQueue(Scene to, Scene from)
{
foreach (SceneAsset item in assetQueue)
{
item.LoadAsset();
}
assetQueue.RemoveAll((SceneAsset x) => x.hasLoadCompleted);
}
}
public class DirectLazyAsset<T> : SceneAsset where T : Object
{
public delegate T FetchAsset(Scene scene);
public delegate void LoadEvent();
public T Asset;
public FetchAsset AssetFinderDelegate;
public event LoadEvent onAssetLoad;
public override void LoadAsset()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
Asset = AssetFinderDelegate(SceneManager.GetActiveScene());
if (!((Object)(object)Asset == (Object)null))
{
hasLoadCompleted = true;
this.onAssetLoad?.Invoke();
}
}
public static implicit operator T(DirectLazyAsset<T> asset)
{
return asset.hasLoadCompleted ? asset.Asset : default(T);
}
public DirectLazyAsset(FetchAsset finderDelegate)
{
AssetFinderDelegate = finderDelegate;
AssetHelper.assetQueue.Add(this);
}
}
public class LazyAsset<T> : SceneAsset where T : Object
{
public delegate void LoadEvent();
public T Asset;
public string AssetKey;
public event LoadEvent onAssetLoad;
public static implicit operator T(LazyAsset<T> asset)
{
return asset.hasLoadCompleted ? asset.Asset : default(T);
}
public override void LoadAsset()
{
Object val = ((IEnumerable<Object>)Resources.FindObjectsOfTypeAll(typeof(T))).FirstOrDefault((Func<Object, bool>)((Object x) => x.name == AssetKey));
if (!(val == (Object)null))
{
Asset = (T)(object)((val is T) ? val : null);
hasLoadCompleted = true;
this.onAssetLoad?.Invoke();
}
}
public LazyAsset(string key)
{
AssetKey = key;
AssetHelper.assetQueue.Add(this);
}
}
public abstract class SceneAsset
{
public bool hasLoadCompleted = false;
public abstract void LoadAsset();
}
public static class PrefabAPI
{
private static GameObject RootPrefabHolder;
private static List<GameObject> prefabQueue = new List<GameObject>();
public static void MakePrefab(this GameObject target)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
if (!Object.op_Implicit((Object)(object)RootPrefabHolder))
{
RootPrefabHolder = new GameObject("PrefabAPI Root Holder");
RootPrefabHolder.AddComponent<NetworkObject>();
RootPrefabHolder.SetActive(false);
Object.DontDestroyOnLoad((Object)(object)RootPrefabHolder);
}
target.transform.SetParent(RootPrefabHolder.transform);
}
public static GameObject InstantiateClone(this GameObject target, string name)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
if (!Object.op_Implicit((Object)(object)RootPrefabHolder))
{
RootPrefabHolder = new GameObject("PrefabAPI Root Holder");
RootPrefabHolder.AddComponent<NetworkObject>();
RootPrefabHolder.SetActive(false);
Object.DontDestroyOnLoad((Object)(object)RootPrefabHolder);
}
GameObject val = Object.Instantiate<GameObject>(target, RootPrefabHolder.transform);
((Object)val).name = name;
return val;
}
internal static void Initialize()
{
SceneManager.activeSceneChanged += OnSceneUpdate;
}
private static void OnSceneUpdate(Scene arg0, Scene arg1)
{
if (!Object.op_Implicit((Object)(object)NetworkManager.Singleton))
{
return;
}
NetworkManager.Singleton.NetworkConfig.ForceSamePrefabs = false;
foreach (GameObject item in prefabQueue)
{
if (!NetworkManager.Singleton.NetworkConfig.Prefabs.Contains(item))
{
NetworkManager.Singleton.AddNetworkPrefab(item);
}
}
}
public static void MarkNetworkPrefab(this GameObject target)
{
if (!Object.op_Implicit((Object)(object)NetworkManager.Singleton))
{
prefabQueue.Add(target);
return;
}
NetworkManager.Singleton.NetworkConfig.ForceSamePrefabs = false;
NetworkManager.Singleton.AddNetworkPrefab(target);
prefabQueue.Add(target);
}
}
public class LanguageAPI
{
public enum Language
{
English,
Chinese,
French,
German,
Italian,
Japanese,
Korean,
Polish,
Portuguese,
Spanish
}
[CompilerGenerated]
private static class <>O
{
public static hook_GetStringFromTable <0>__CheckLanguage;
}
public static Dictionary<string, Dictionary<Language, string>> LanguageMap = new Dictionary<string, Dictionary<Language, string>>();
internal static void Initialize()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
object obj = <>O.<0>__CheckLanguage;
if (obj == null)
{
hook_GetStringFromTable val = CheckLanguage;
<>O.<0>__CheckLanguage = val;
obj = (object)val;
}
LocTableHelpers.GetStringFromTable += (hook_GetStringFromTable)obj;
}
private static string CheckLanguage(orig_GetStringFromTable orig, string _locTableKey)
{
if (LanguageMap.ContainsKey(_locTableKey))
{
Language key = (Language)LocalizationSettings.AvailableLocales.Locales.IndexOf(LocalizationSettings.SelectedLocale);
if (LanguageMap[_locTableKey].ContainsKey(key))
{
return LanguageMap[_locTableKey][key];
}
if (LanguageMap[_locTableKey].ContainsKey(Language.English))
{
return LanguageMap[_locTableKey][Language.English];
}
}
return orig.Invoke(_locTableKey);
}
public static void AddString(string token, string result, Language language = Language.English)
{
if (!LanguageMap.ContainsKey(token))
{
LanguageMap.Add(token, new Dictionary<Language, string>());
}
if (!LanguageMap[token].ContainsKey(language))
{
LanguageMap[token].Add(language, result);
}
else
{
LanguageMap[token][language] = result;
}
}
}
public class EquipmentAPI
{
[CompilerGenerated]
private static class <>O
{
public static hook_Start <0>__SetupLoot;
public static hook_Awake <1>__AddSpawnables;
}
private static List<EquipmentInfo> equipments = new List<EquipmentInfo>();
internal static void SetHooks()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Expected O, but got Unknown
object obj = <>O.<0>__SetupLoot;
if (obj == null)
{
hook_Start val = SetupLoot;
<>O.<0>__SetupLoot = val;
obj = (object)val;
}
LootManager.Start += (hook_Start)obj;
object obj2 = <>O.<1>__AddSpawnables;
if (obj2 == null)
{
hook_Awake val2 = AddSpawnables;
<>O.<1>__AddSpawnables = val2;
obj2 = (object)val2;
}
CheatsManager.Awake += (hook_Awake)obj2;
}
private static void AddSpawnables(orig_Awake orig, NetworkBehaviour self)
{
foreach (EquipmentInfo equipment in equipments)
{
((CheatsManager)((self is CheatsManager) ? self : null)).spawnablePrefabList.Add(equipment.Prefab);
}
orig.Invoke(self);
}
private static void SetupLoot(orig_Start orig, LootManager self)
{
List<GameObject> standardEquipmentPrefabs = self.standardEquipmentPrefabs;
foreach (EquipmentInfo equipment in equipments)
{
standardEquipmentPrefabs.Add(equipment.Prefab);
}
self.standardEquipmentPrefabs = standardEquipmentPrefabs;
orig.Invoke(self);
}
public static void AddEquipment(EquipmentInfo info)
{
if (!Object.op_Implicit((Object)(object)info.Prefab) || !Object.op_Implicit((Object)(object)info.Prefab.GetComponent<PardnerEquipment>()))
{
WormAPI.Log.LogError((object)"Attempted to add an equipment with no valid prefab! This is not allowed.");
return;
}
PardnerEquipment component = info.Prefab.GetComponent<PardnerEquipment>();
((Component)component).gameObject.tag = "PickUp";
if (!Object.op_Implicit((Object)(object)((Component)component).GetComponent<PickUppable>()))
{
PickUppable val = ((Component)component).gameObject.AddComponent<PickUppable>();
val.cannotBurnInFurnace = true;
val.cannotStoreInBag = true;
val.chompable = true;
val.fuelValue = 0;
val.isEquipment = true;
val.isInteractable = true;
val.useGravityByDefault = true;
val.itemName = ((Object)component).name;
Transform val2 = ((Component)component).transform.Find("Art");
if (Object.op_Implicit((Object)(object)val2))
{
val.art = ((Component)val2).gameObject;
val.art.gameObject.tag = "PickUp";
if (Object.op_Implicit((Object)(object)((Component)val2).GetComponent<MeshFilter>()))
{
val.meshFilter = ((Component)val2).GetComponent<MeshFilter>();
}
}
}
if (!Object.op_Implicit((Object)(object)((Component)component).GetComponent<Rigidbody>()))
{
Rigidbody val3 = ((Component)component).gameObject.AddComponent<Rigidbody>();
val3.useGravity = true;
val3.mass = 5f;
((Component)component).gameObject.AddComponent<NetworkRigidbody>();
}
if (!Object.op_Implicit((Object)(object)((Component)component).GetComponent<NetworkObject>()))
{
((Component)component).gameObject.AddComponent<NetworkObject>();
((Component)component).gameObject.AddComponent<NetworkTransform>();
}
((Component)component).GetComponent<PickUppable>().netTrans = ((Component)component).GetComponent<NetworkTransform>();
equipments.Add(info);
}
}
public class EquipmentInfo
{
public string Name;
public GameObject Prefab;
}
[BepInPlugin("WormTeam.WormAPI", "WormAPI", "1.0.0")]
public class WormAPI : BaseUnityPlugin
{
public const string PLUGIN_GUID = "WormTeam.WormAPI";
public const string PLUGIN_NAME = "WormAPI";
public const string PLUGIN_VERSION = "1.0.0";
internal static ManualLogSource Log;
public void Awake()
{
Log = ((BaseUnityPlugin)this).Logger;
WormAbilityAPI.SetHooks();
EquipmentAPI.SetHooks();
AssetHelper.Initialize();
LanguageAPI.Initialize();
PrefabAPI.Initialize();
}
}
internal class APITest
{
public void Test()
{
}
}
public class WormAbility_PropRegen : WormAbility
{
private float BarPercentagePerFuelPip = 0.1f;
private float RegenPerSecond = 0.2f;
private float FuelPerSecond = 0.2f;
private float MaxFuel = 100f;
private float CooldownReductionPerFuelPip = 0.025f;
private float CooldownReductionPerFuelPipLarge = 0.05f;
private float CooldownReductionPerFuelPipFlat = 1.5f;
private WormPlayer wormScript;
private float storedFuel = 0f;
private bool equipped = false;
private int whatSlotAreWe = 3;
public override void Start()
{
((WormAbility)this).Start();
wormScript = ((Component)base.ourWormAbilityManager).GetComponent<WormPlayer>();
}
public override void Update()
{
//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: Unknown result type (might be due to invalid IL or missing references)
((WormAbility)this).Update();
equipped = (Object)(object)base.ourWormAbilityManager.abilitySlot2 == (Object)(object)this || (Object)(object)base.ourWormAbilityManager.abilitySlot3 == (Object)(object)this;
whatSlotAreWe = (((Object)(object)base.ourWormAbilityManager.abilitySlot2 == (Object)(object)this) ? 2 : 3);
((Component)base.isActiveUIFillImage).gameObject.SetActive(equipped);
((Behaviour)base.isActiveUIFillImage).enabled = equipped;
storedFuel = Mathf.Clamp(storedFuel, 0f, MaxFuel);
Debug.Log((object)("are we equipped: " + equipped));
if (!equipped)
{
return;
}
base.isActiveUIFillImage.fillAmount = storedFuel / MaxFuel;
base.isActiveUIFillImage.fillMethod = (FillMethod)1;
if (wormScript.wormHealth < wormScript.wormHealth_Max)
{
float num = MaxFuel * FuelPerSecond * Time.deltaTime;
float num2 = wormScript.wormHealth_Max * RegenPerSecond * Time.deltaTime;
if (storedFuel >= num)
{
storedFuel -= num;
WormPlayer obj = wormScript;
obj.wormHealth += num2;
}
}
if (whatSlotAreWe == 2)
{
HudManager.Singleton.UpdateWormAbilityUI_Slot2(1f, base.ourWormAbilityManager.abilityIconColor_NotUsable, false, 0f);
}
else
{
HudManager.Singleton.UpdateWormAbilityUI_Slot3(1f, base.ourWormAbilityManager.abilityIconColor_NotUsable, false, 0f);
}
}
public void OnEatFuel(float fuelVal)
{
float num = MaxFuel * (BarPercentagePerFuelPip * fuelVal);
storedFuel += num;
LowerCDForSlot(base.ourWormAbilityManager.abilitySlot1, fuelVal);
LowerCDForSlot(base.ourWormAbilityManager.abilitySlot2, fuelVal);
LowerCDForSlot(base.ourWormAbilityManager.abilitySlot3, fuelVal);
LowerCDForSlot(base.ourWormAbilityManager.abilitySlot4, fuelVal);
}
public void LowerCDForSlot(WormAbility ability, float fuel)
{
float num = ability.cooldown * (CooldownReductionPerFuelPip * fuel);
ability.cooldown_Curr += num;
ability.cooldown_Curr = Mathf.Clamp(ability.cooldown_Curr, 0f, ability.cooldown);
}
protected override void __initializeVariables()
{
((WormAbility)this).__initializeVariables();
}
protected internal override string __getTypeName()
{
return "WormAbility_PropRegen";
}
}
public class WormAbilityAPI
{
[CompilerGenerated]
private static class <>O
{
public static hook_Start <0>__HandleWormPrefabUpdate;
public static hook_Start <1>__SetupAbilitiesOnPickerBank;
public static hook_Start <2>__SetupWormAbilitiesLobby;
}
internal static List<WormAbilityInfo> wormAbilities = new List<WormAbilityInfo>();
internal static bool HasPerformedAlready = false;
private static int index = 10;
private const int ICONS_PER_ROW = 8;
private const float BASE_HEIGHT_BACKER = 116.5f;
private static Vector3 BASE_SCALE_BACKER = new Vector3(1f, 1f, 1f);
private static Vector3 INC_SCALE_BACKER = new Vector3(0f, 0.6f, 0f);
private const float INC_HEIGHT_BACKER = 40f;
private const float BASE_HEIGHT_HEADER = 194.7f;
private const float INC_HEIGHT_HEADER = 120f;
private static float STARTING_ICON_X = -385f;
private static float STARTING_ICON_Y = 103f;
private static float INC_ICON_X = 110f;
private static float INC_ICON_Y = 110f;
private static GameObject MockWormPrefab = null;
public static event EventHandler onReadyForAbilities;
internal static void SetHooks()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Expected O, but got Unknown
//IL_0053: 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_005e: Expected O, but got Unknown
object obj = <>O.<0>__HandleWormPrefabUpdate;
if (obj == null)
{
hook_Start val = HandleWormPrefabUpdate;
<>O.<0>__HandleWormPrefabUpdate = val;
obj = (object)val;
}
GameManager.Start += (hook_Start)obj;
object obj2 = <>O.<1>__SetupAbilitiesOnPickerBank;
if (obj2 == null)
{
hook_Start val2 = SetupAbilitiesOnPickerBank;
<>O.<1>__SetupAbilitiesOnPickerBank = val2;
obj2 = (object)val2;
}
WormAbilityPickerBank.Start += (hook_Start)obj2;
object obj3 = <>O.<2>__SetupWormAbilitiesLobby;
if (obj3 == null)
{
hook_Start val3 = SetupWormAbilitiesLobby;
<>O.<2>__SetupWormAbilitiesLobby = val3;
obj3 = (object)val3;
}
HudManager.Start += (hook_Start)obj3;
SceneManager.activeSceneChanged += delegate
{
HasPerformedAlready = false;
};
}
private static void HandleWormPrefabUpdate(orig_Start orig, GameManager self)
{
orig.Invoke(self);
((MonoBehaviour)self).StartCoroutine(ThisIsStupid(self));
}
private static IEnumerator ThisIsStupid(GameManager self)
{
if (!Object.op_Implicit((Object)(object)MockWormPrefab))
{
GameObject clone = self.wormPrefab.InstantiateClone(((Object)self.wormPrefab).name + "MockPrefab");
NetworkManager.Singleton.RemoveNetworkPrefab(self.wormPrefab);
clone.MarkNetworkPrefab();
yield return (object)new WaitForEndOfFrame();
MockWormPrefab = clone;
SetupAbilitiesOnWorm(MockWormPrefab.GetComponent<WormAbilityManager>());
}
self.wormPrefab = MockWormPrefab;
}
public static WormAbilityInfo AddWormAbility(WormAbilityInfo info)
{
if ((Object)(object)info.WormAbilityObject == (Object)null || !Object.op_Implicit((Object)(object)info.WormAbilityObject.GetComponent<WormAbility>()))
{
WormAPI.Log.LogError((object)"Attempted to add a Worm Ability with no Worm Ability Object! This is not allowed.");
return null;
}
index++;
info.WormAbilityIndex = index;
WormAbility component = info.WormAbilityObject.GetComponent<WormAbility>();
if (component.abilityName != null)
{
info.AbilityName = component.abilityName;
}
if ((Object)(object)component.abilityImage != (Object)null)
{
info.AbilityImage = component.abilityImage;
}
if (component.abilityDescription != null)
{
info.AbilityDescription = component.abilityDescription;
}
info.WormAbilityObject.GetComponent<WormAbility>().abilityImage = info.AbilityImage;
wormAbilities.Add(info);
return info;
}
private static void SetupAbilitiesOnWorm(WormAbilityManager self)
{
List<WormAbility> list = self.abilityBank.ToList();
foreach (WormAbilityInfo wormAbility in wormAbilities)
{
WormAbility component = wormAbility.SetupOnWorm(((Component)self).gameObject).GetComponent<WormAbility>();
list.Add(component);
}
self.abilityBank = list.ToArray();
}
private static void SetupAbilitiesOnPickerBank(orig_Start orig, WormAbilityPickerBank self)
{
foreach (WormAbilityInfo wormAbility in wormAbilities)
{
wormAbility.SpawnWormAbilityUIPicker(((Component)self).gameObject);
}
orig.Invoke(self);
}
private static void SetupWormAbilitiesLobby(orig_Start orig, HudManager self)
{
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: 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_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self);
if (HasPerformedAlready)
{
return;
}
if (!HasPerformedAlready)
{
HasPerformedAlready = true;
WormAbilityAPI.onReadyForAbilities?.Invoke(null, null);
}
GameObject val = GameObject.Find("Hud Canvas");
Transform val2 = val.transform.Find("UIGroup_PreLobby").Find("Worm Ability List Pop Up UI").Find("Worm Abilities Panel");
GameObject gameObject = ((Component)val2.Find("Ability Pick Button 0 (Scream, We can hide this)")).gameObject;
Transform val3 = val2.Find("Worm Abilities Backer");
Transform val4 = val2.Find("Worm Abilities Header");
int num = ((wormAbilities.Count > 0) ? Math.Max(Mathf.CeilToInt((float)wormAbilities.Count / 8f), 1) : 0);
Vector3 localScale = BASE_SCALE_BACKER + INC_SCALE_BACKER * (float)num;
val3.localScale = localScale;
Transform transform = ((Component)val3).transform;
transform.localPosition += new Vector3(0f, 40f * (float)num, 0f);
Transform transform2 = ((Component)val4).transform;
transform2.localPosition += new Vector3(0f, 120f * (float)num, 0f);
int num2 = 1;
int num3 = 0;
for (int i = 0; i < wormAbilities.Count; i++)
{
if (num3 >= 8)
{
num3 = 0;
num2++;
}
WormAbilityInfo wormAbilityInfo = wormAbilities[i];
float offsetX = STARTING_ICON_X + (float)num3 * INC_ICON_X;
float offsetY = STARTING_ICON_Y + (float)num2 * INC_ICON_Y;
wormAbilityInfo.SpawnWormAbilityInLobby(((Component)val2).gameObject, gameObject, offsetX, offsetY);
num3++;
}
}
}
public class WormAbilityInfo
{
public string AbilityName;
public string AbilityDescription;
public Sprite AbilityImage;
public GameObject WormAbilityObject;
internal int WormAbilityIndex;
public List<string> AbilityNotes;
internal GameObject SetupOnWorm(GameObject worm)
{
Transform parent = worm.transform.Find("Worm Abilities (this holds all the abilities and we can set their icons and stuff)");
if ((Object)(object)WormAbilityObject != (Object)null)
{
GameObject val = Object.Instantiate<GameObject>(WormAbilityObject);
if (Object.op_Implicit((Object)(object)val.GetComponent<NetworkObject>()))
{
Object.DestroyImmediate((Object)(object)val.GetComponent<NetworkObject>());
}
val.transform.parent = parent;
val.GetComponent<WormAbility>().ourWormAbilityManager = worm.GetComponent<WormAbilityManager>();
return val;
}
return null;
}
internal void SpawnWormAbilityUIPicker(GameObject holder)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
GameObject val = new GameObject("UI Picker: " + AbilityName);
val.transform.SetParent(holder.transform);
WormAbilityUIPicker val2 = val.AddComponent<WormAbilityUIPicker>();
val2.abilityDescription = AbilityDescription;
val2.abilityName = AbilityName;
val2.abilityImage = AbilityImage;
val2.additionalAbilityNotes = ((AbilityNotes == null) ? new string[0] : AbilityNotes.ToArray());
WormAbilityPickerBank component = holder.GetComponent<WormAbilityPickerBank>();
List<WormAbilityUIPicker> list = component.pickerBank.ToList();
list.Add(val2);
component.pickerBank = list.ToArray();
}
internal GameObject SpawnWormAbilityInLobby(GameObject holder, GameObject reference, float offsetX, float offsetY)
{
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
GameObject val = Object.Instantiate<GameObject>(reference, holder.transform);
val.SetActive(true);
((Object)val).name = $"Ability Pick Button {WormAbilityIndex} ({AbilityName})";
WormAbilityEquipButton component = val.GetComponent<WormAbilityEquipButton>();
component.abilityIndex = WormAbilityIndex;
RectTransform component2 = val.GetComponent<RectTransform>();
component2.anchoredPosition = new Vector2(offsetX, offsetY);
return val;
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "WormAPI";
public const string PLUGIN_NAME = "WormAPI";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace WormAPI.Utils
{
public static class CommonAssets
{
public static class Shaders
{
public static Shader Clay => Shader.Find("Shader Graphs/Clay");
public static Shader Clay_WithDissolve => Shader.Find("Shader Graphs/Clay_WithDissolve");
public static Shader Sand => Shader.Find("Shader Graphs/Sand");
public static Shader Dissolvable => Shader.Find("Shader Graphs/Dissolvable");
public static Shader Clay_WithDither => Shader.Find("Shader Graphs/Clay_WithDither");
public static Shader StandardVertexColor => Shader.Find("Shader Graphs/Standard Vertex Color");
}
}
public static class LayerIndex
{
public static int Default = 0;
public static int TransparentFX = 1;
public static int IgnoreRaycast = 2;
public static int Environment = 6;
public static int Ground = 7;
public static int Player = 8;
public static int Worm = 9;
public static int Ghost = 10;
public static int PartsAndDebris = 11;
public static int WormOnlyCollide = 12;
public static int PlayerOnlyCollide = 13;
public static int TerrainGen = 14;
public static int Underground = 15;
public static int OnlyHumansSee = 16;
public static int OnlyWormsSee = 17;
public static int WormBody = 18;
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}
namespace WormAPI.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}