using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using Agents;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using Enemies;
using GTFO.API;
using GameData;
using HarmonyLib;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using Il2CppSystem.Reflection;
using LevelGeneration;
using Localization;
using Microsoft.CodeAnalysis;
using Player;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("Zombified_Initiative")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Zombified_Initiative")]
[assembly: AssemblyTitle("Zombified_Initiative")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
}
namespace Zombified_Initiative
{
[HarmonyPatch]
public class ZombifiedPatches
{
[HarmonyPatch(typeof(PlayerAIBot), "SetEnabled")]
[HarmonyPostfix]
public static void AddComp(PlayerAIBot __instance, bool state)
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Expected O, but got Unknown
if (state && !Object.op_Implicit((Object)(object)((Component)__instance).gameObject.GetComponent<ZombieComp>()))
{
ManualLogSource l = ZombifiedInitiative.L;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(33, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("adding zombified component to ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(__instance.Agent.PlayerName);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ..");
}
l.LogInfo(val);
((Component)__instance.Agent).gameObject.AddComponent<ZombieComp>().Initialize();
}
}
[HarmonyPatch(typeof(PlayerAgent), "OnDestroy")]
[HarmonyPrefix]
public static void DestroyMenu(PlayerAgent __instance)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Expected O, but got Unknown
ZombieComp component = ((Component)__instance).gameObject.GetComponent<ZombieComp>();
if ((Object)(object)component != (Object)null)
{
ManualLogSource l = ZombifiedInitiative.L;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(29, 0, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("zombiebot leaving, buh byeeee");
}
l.LogInfo(val);
component.OnDestroy();
}
}
[HarmonyPatch(typeof(CommunicationMenu), "PlayConfirmSound")]
[HarmonyPrefix]
public static void PlayConfirmSound(CommunicationMenu __instance)
{
//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
//IL_01aa: Expected O, but got Unknown
//IL_0271: Unknown result type (might be due to invalid IL or missing references)
//IL_0278: Expected O, but got Unknown
//IL_033c: Unknown result type (might be due to invalid IL or missing references)
//IL_0343: Expected O, but got Unknown
ZombieComp zombieComp = null;
CommunicationNode currentNode = ZombifiedInitiative._menu.m_menu.CurrentNode;
if (!currentNode.IsLastNode)
{
return;
}
string english = GameDataBlockBase<TextDataBlock>.GetBlock(currentNode.TextId).English;
ZombifiedInitiative.L.LogDebug((object)("teksti on " + english));
string text = english.Split(new char[1] { ' ' })[0].Trim();
string text2 = english.Substring(text.Length).Trim();
ZombifiedInitiative.L.LogDebug((object)("teksti on " + english + ", who on " + text + " ja wha on " + text2));
if (text2 == "attack my target")
{
EnemyAgent monsterUnderPlayerAim = ZombieController.GetMonsterUnderPlayerAim();
if ((Object)(object)monsterUnderPlayerAim != (Object)null)
{
if (text == "AllBots")
{
ZombifiedInitiative.L.LogInfo((object)"all bots attack");
foreach (KeyValuePair<string, PlayerAIBot> item in ZombifiedInitiative.BotTable)
{
ZombieController.SendBotToKillEnemy(item.Key, (Agent)(object)monsterUnderPlayerAim, (StanceEnum)3, (AttackMeansEnum)31, (PostureEnum)1);
}
}
else
{
ZombifiedInitiative.L.LogInfo((object)("bot" + text + " attack"));
ZombieController.SendBotToKillEnemy(text, (Agent)(object)monsterUnderPlayerAim, (StanceEnum)3, (AttackMeansEnum)31, (PostureEnum)1);
}
}
}
bool flag = default(bool);
if (text2.Contains("pickup permission"))
{
foreach (KeyValuePair<string, PlayerAIBot> item2 in ZombifiedInitiative.BotTable)
{
if (text == "AllBots" || text == item2.Key)
{
ManualLogSource l = ZombifiedInitiative.L;
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(24, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(item2.Key);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" toggle resource pickups");
}
l.LogInfo(val);
zombieComp = ((Component)item2.Value).GetComponent<ZombieComp>();
if (zombieComp.pickupaction != null)
{
zombieComp.pickupaction.DescBase.SetCompletionStatus((StatusType)4);
}
zombieComp.allowedpickups = !zombieComp.allowedpickups;
}
}
}
if (text2.Contains("share permission"))
{
foreach (KeyValuePair<string, PlayerAIBot> item3 in ZombifiedInitiative.BotTable)
{
if (text == "AllBots" || text == item3.Key)
{
ManualLogSource l2 = ZombifiedInitiative.L;
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(20, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(item3.Key);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" toggle resource use");
}
l2.LogInfo(val);
zombieComp = ((Component)item3.Value).GetComponent<ZombieComp>();
if (zombieComp.shareaction != null)
{
zombieComp.shareaction.DescBase.SetCompletionStatus((StatusType)4);
}
zombieComp.allowedshare = !zombieComp.allowedshare;
}
}
}
if (text2 == "clear command queue")
{
foreach (KeyValuePair<string, PlayerAIBot> item4 in ZombifiedInitiative.BotTable)
{
if (text == "AllBots" || text == item4.Key)
{
ManualLogSource l3 = ZombifiedInitiative.L;
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(12, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(item4.Key);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" stop action");
}
l3.LogInfo(val);
zombieComp = ((Component)item4.Value).GetComponent<ZombieComp>();
zombieComp.PreventManualActions();
}
}
}
if (text2 == "pickup resource under my aim")
{
ZombifiedInitiative.L.LogInfo((object)("bot " + text + " pickup resource"));
ItemInLevel itemUnderPlayerAim = ZombieController.GetItemUnderPlayerAim();
if ((Object)(object)itemUnderPlayerAim != (Object)null)
{
ZombieController.SendBotToPickupItem(text, itemUnderPlayerAim);
}
}
if (text2 == "supply resource (aimed or me)")
{
ZombifiedInitiative.L.LogInfo((object)("bot " + text + " share resource"));
ZombieController.SendBotToShareResourcePack(text, ZombieController.GetHumanUnderPlayerAim());
}
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("org.bepinex.plugins.zombified-ZombieController", "Zombified ZombieController", "0.9.4")]
public class ZombifiedInitiative : BasePlugin
{
public static Dictionary<string, PlayerAIBot> BotTable = new Dictionary<string, PlayerAIBot>();
public static PUI_CommunicationMenu _menu;
public static bool rootmenusetup = false;
public static ManualLogSource L;
public static float _manualActionsHaste = 1f;
public override void Load()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
new Harmony("ZombieController").PatchAll();
ClassInjector.RegisterTypeInIl2Cpp<ZombieComp>();
ZombieController @object = ((BasePlugin)this).AddComponent<ZombieController>();
EventAPI.OnManagersSetup += ZombieController.AddZombifiedText;
LG_Factory.OnFactoryBuildDone += Action.op_Implicit((Action)@object.FindMenu);
LG_Factory.OnFactoryBuildDone += Action.op_Implicit((Action)@object.Initialize);
L = ((BasePlugin)this).Log;
}
}
public class ZombieComp : MonoBehaviour
{
private bool menusetup;
private TextDataBlock textmenuroot;
private TextDataBlock textallowedpickups;
private TextDataBlock textallowedshare;
private TextDataBlock textstopcommand;
private TextDataBlock textattack;
private TextDataBlock textpickup;
private TextDataBlock textsupply;
public CommunicationNode mymenu;
public bool allowedpickups = true;
public bool allowedshare = true;
private bool started;
private List<PlayerBotActionBase> actionsToRemove = new List<PlayerBotActionBase>();
private PlayerAgent myself;
private PlayerAIBot myAI;
public PlayerBotActionBase pickupaction;
public PlayerBotActionBase shareaction;
public void Initialize()
{
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Expected O, but got Unknown
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Expected O, but got Unknown
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Expected O, but got Unknown
//IL_00d6: 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_00f8: Expected O, but got Unknown
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Expected O, but got Unknown
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Expected O, but got Unknown
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Expected O, but got Unknown
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Expected O, but got Unknown
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_0193: Expected O, but got Unknown
//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
//IL_01cd: Expected O, but got Unknown
//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
//IL_01d4: Expected O, but got Unknown
//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
//IL_01db: Unknown result type (might be due to invalid IL or missing references)
//IL_01f6: Expected O, but got Unknown
//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0217: Expected O, but got Unknown
//IL_0234: 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_024a: Unknown result type (might be due to invalid IL or missing references)
//IL_0251: Expected O, but got Unknown
//IL_0251: Unknown result type (might be due to invalid IL or missing references)
//IL_0258: Expected O, but got Unknown
//IL_0258: Unknown result type (might be due to invalid IL or missing references)
//IL_025f: Unknown result type (might be due to invalid IL or missing references)
//IL_027a: Expected O, but got Unknown
//IL_027a: Unknown result type (might be due to invalid IL or missing references)
//IL_029b: Expected O, but got Unknown
//IL_02b8: 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_02d5: Expected O, but got Unknown
//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
//IL_02dc: Expected O, but got Unknown
//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
//IL_02fe: Expected O, but got Unknown
//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
//IL_031f: Expected O, but got Unknown
//IL_033c: Unknown result type (might be due to invalid IL or missing references)
//IL_034d: Unknown result type (might be due to invalid IL or missing references)
//IL_0352: Unknown result type (might be due to invalid IL or missing references)
//IL_0359: Expected O, but got Unknown
//IL_0359: Unknown result type (might be due to invalid IL or missing references)
//IL_0360: Expected O, but got Unknown
//IL_0360: Unknown result type (might be due to invalid IL or missing references)
//IL_0367: Unknown result type (might be due to invalid IL or missing references)
//IL_0382: Expected O, but got Unknown
//IL_0382: Unknown result type (might be due to invalid IL or missing references)
//IL_03a3: Expected O, but got Unknown
//IL_03c0: Unknown result type (might be due to invalid IL or missing references)
//IL_03d1: Unknown result type (might be due to invalid IL or missing references)
//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
//IL_03dd: Expected O, but got Unknown
//IL_03dd: Unknown result type (might be due to invalid IL or missing references)
//IL_03e4: Expected O, but got Unknown
//IL_03e4: Unknown result type (might be due to invalid IL or missing references)
//IL_03eb: Unknown result type (might be due to invalid IL or missing references)
//IL_0406: Expected O, but got Unknown
//IL_0406: Unknown result type (might be due to invalid IL or missing references)
//IL_0427: Expected O, but got Unknown
//IL_0444: Unknown result type (might be due to invalid IL or missing references)
//IL_0463: Unknown result type (might be due to invalid IL or missing references)
//IL_046d: Expected O, but got Unknown
//IL_0492: Unknown result type (might be due to invalid IL or missing references)
//IL_049c: Expected O, but got Unknown
//IL_04b5: Unknown result type (might be due to invalid IL or missing references)
//IL_04bf: Expected O, but got Unknown
//IL_04d8: Unknown result type (might be due to invalid IL or missing references)
//IL_04e2: Expected O, but got Unknown
//IL_04fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0505: Expected O, but got Unknown
//IL_051e: Unknown result type (might be due to invalid IL or missing references)
//IL_0528: Expected O, but got Unknown
//IL_0541: Unknown result type (might be due to invalid IL or missing references)
//IL_054b: Expected O, but got Unknown
myself = ((Component)this).gameObject.GetComponent<PlayerAgent>();
if ((Object)(object)myself == (Object)null)
{
return;
}
if (!myself.Owner.IsBot)
{
Object.Destroy((Object)(object)this);
return;
}
myAI = ((Component)this).gameObject.GetComponent<PlayerAIBot>();
ManualLogSource l = ZombifiedInitiative.L;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(39, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("initializing zombified comp on ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(myself.PlayerName);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" slot ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(myself.PlayerSlotIndex);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("..");
}
l.LogInfo(val);
myAI = ((Component)this).gameObject.GetComponent<PlayerAIBot>();
GameDataTextLocalizationService val2 = ((Il2CppObjectBase)Text.TextLocalizationService).TryCast<GameDataTextLocalizationService>();
try
{
TextDataBlock val3 = new TextDataBlock();
((GameDataBlockBase<TextDataBlock>)val3).persistentID = 0u;
((GameDataBlockBase<TextDataBlock>)val3).internalEnabled = true;
val3.SkipLocalization = true;
((GameDataBlockBase<TextDataBlock>)val3).name = myself.PlayerName + "menuroot";
val3.English = myself.PlayerName;
textmenuroot = GameDataBlockBase<TextDataBlock>.AddBlock(val3, -1);
val2.m_texts.Add(((GameDataBlockBase<TextDataBlock>)(object)textmenuroot).persistentID, textmenuroot.GetText(val2.CurrentLanguage, false));
TextDataBlock val4 = new TextDataBlock();
((GameDataBlockBase<TextDataBlock>)val4).persistentID = 0u;
((GameDataBlockBase<TextDataBlock>)val4).internalEnabled = true;
val4.SkipLocalization = true;
((GameDataBlockBase<TextDataBlock>)val4).name = myself.PlayerName + "pickupperm";
val4.English = myself.PlayerName + " toggle pickup permission";
textallowedpickups = GameDataBlockBase<TextDataBlock>.AddBlock(val4, -1);
val2.m_texts.Add(((GameDataBlockBase<TextDataBlock>)(object)textallowedpickups).persistentID, textallowedpickups.GetText(val2.CurrentLanguage, false));
TextDataBlock val5 = new TextDataBlock();
((GameDataBlockBase<TextDataBlock>)val5).persistentID = 0u;
((GameDataBlockBase<TextDataBlock>)val5).internalEnabled = true;
val5.SkipLocalization = true;
((GameDataBlockBase<TextDataBlock>)val5).name = myself.PlayerName + "shareperm";
val5.English = myself.PlayerName + " toggle share permission";
textallowedshare = GameDataBlockBase<TextDataBlock>.AddBlock(val5, -1);
val2.m_texts.Add(((GameDataBlockBase<TextDataBlock>)(object)textallowedshare).persistentID, textallowedshare.GetText(val2.CurrentLanguage, false));
TextDataBlock val6 = new TextDataBlock();
((GameDataBlockBase<TextDataBlock>)val6).persistentID = 0u;
((GameDataBlockBase<TextDataBlock>)val6).internalEnabled = true;
val6.SkipLocalization = true;
((GameDataBlockBase<TextDataBlock>)val6).name = myself.PlayerName + "stopcommand";
val6.English = myself.PlayerName + " stop what you are doing";
textstopcommand = GameDataBlockBase<TextDataBlock>.AddBlock(val6, -1);
val2.m_texts.Add(((GameDataBlockBase<TextDataBlock>)(object)textstopcommand).persistentID, textstopcommand.GetText(val2.CurrentLanguage, false));
TextDataBlock val7 = new TextDataBlock();
((GameDataBlockBase<TextDataBlock>)val7).persistentID = 0u;
((GameDataBlockBase<TextDataBlock>)val7).internalEnabled = true;
val7.SkipLocalization = true;
((GameDataBlockBase<TextDataBlock>)val7).name = myself.PlayerName + "attack";
val7.English = myself.PlayerName + " attack my target";
textattack = GameDataBlockBase<TextDataBlock>.AddBlock(val7, -1);
val2.m_texts.Add(((GameDataBlockBase<TextDataBlock>)(object)textattack).persistentID, textattack.GetText(val2.CurrentLanguage, false));
TextDataBlock val8 = new TextDataBlock();
((GameDataBlockBase<TextDataBlock>)val8).persistentID = 0u;
((GameDataBlockBase<TextDataBlock>)val8).internalEnabled = true;
val8.SkipLocalization = true;
((GameDataBlockBase<TextDataBlock>)val8).name = myself.PlayerName + "pickup";
val8.English = myself.PlayerName + " pickup resource under my aim";
textpickup = GameDataBlockBase<TextDataBlock>.AddBlock(val8, -1);
val2.m_texts.Add(((GameDataBlockBase<TextDataBlock>)(object)textpickup).persistentID, textpickup.GetText(val2.CurrentLanguage, false));
TextDataBlock val9 = new TextDataBlock();
((GameDataBlockBase<TextDataBlock>)val9).persistentID = 0u;
((GameDataBlockBase<TextDataBlock>)val9).internalEnabled = true;
val9.SkipLocalization = true;
((GameDataBlockBase<TextDataBlock>)val9).name = myself.PlayerName + "supply";
val9.English = myself.PlayerName + " supply resource (aimed or me)";
textsupply = GameDataBlockBase<TextDataBlock>.AddBlock(val9, -1);
val2.m_texts.Add(((GameDataBlockBase<TextDataBlock>)(object)textsupply).persistentID, textsupply.GetText(val2.CurrentLanguage, false));
mymenu = new CommunicationNode(((GameDataBlockBase<TextDataBlock>)(object)textmenuroot).persistentID, (ScriptType)0, (List<CommunicationNode>)null, (Sprite)null);
mymenu.IsLastNode = false;
mymenu.m_ChildNodes.Add(new CommunicationNode(((GameDataBlockBase<TextDataBlock>)(object)textallowedpickups).persistentID, (ScriptType)0, (List<CommunicationNode>)null, (Sprite)null));
mymenu.m_ChildNodes.Add(new CommunicationNode(((GameDataBlockBase<TextDataBlock>)(object)textallowedshare).persistentID, (ScriptType)0, (List<CommunicationNode>)null, (Sprite)null));
mymenu.m_ChildNodes.Add(new CommunicationNode(((GameDataBlockBase<TextDataBlock>)(object)textstopcommand).persistentID, (ScriptType)0, (List<CommunicationNode>)null, (Sprite)null));
mymenu.m_ChildNodes.Add(new CommunicationNode(((GameDataBlockBase<TextDataBlock>)(object)textattack).persistentID, (ScriptType)0, (List<CommunicationNode>)null, (Sprite)null));
mymenu.m_ChildNodes.Add(new CommunicationNode(((GameDataBlockBase<TextDataBlock>)(object)textpickup).persistentID, (ScriptType)0, (List<CommunicationNode>)null, (Sprite)null));
mymenu.m_ChildNodes.Add(new CommunicationNode(((GameDataBlockBase<TextDataBlock>)(object)textsupply).persistentID, (ScriptType)0, (List<CommunicationNode>)null, (Sprite)null));
mymenu.m_ChildNodes[0].DialogID = 314u;
mymenu.m_ChildNodes[1].DialogID = 314u;
mymenu.m_ChildNodes[2].DialogID = 314u;
mymenu.m_ChildNodes[3].DialogID = 314u;
mymenu.m_ChildNodes[4].DialogID = 314u;
mymenu.m_ChildNodes[5].DialogID = 314u;
}
catch
{
}
if (ZombifiedInitiative.BotTable.Count == 0)
{
ZombifiedInitiative.BotTable.Add(myself.PlayerName, myAI);
}
if (!ZombifiedInitiative.BotTable.ContainsKey(myself.PlayerName))
{
ZombifiedInitiative.BotTable.Add(myself.PlayerName, myAI);
}
started = true;
}
public void OnDestroy()
{
if (ZombifiedInitiative.BotTable.ContainsKey(myself.PlayerName))
{
ZombifiedInitiative.BotTable.Remove(myself.PlayerName);
}
mymenu.IsLastNode = true;
}
private void Update()
{
//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
//IL_02ed: Expected O, but got Unknown
if (!started)
{
return;
}
if (!menusetup && ZombifiedInitiative.rootmenusetup)
{
int num = 0;
bool flag = false;
for (int i = 0; i < ZombifiedInitiative._menu.m_menu.CurrentNode.ChildNodes[5].m_ChildNodes.Count; i++)
{
if (GameDataBlockBase<TextDataBlock>.GetBlock(ZombifiedInitiative._menu.m_menu.CurrentNode.ChildNodes[5].m_ChildNodes[i].TextId).English == "Zombified Initiative")
{
num = i;
}
}
for (int j = 0; j < ZombifiedInitiative._menu.m_menu.CurrentNode.ChildNodes[5].m_ChildNodes[num].m_ChildNodes.Count; j++)
{
if (GameDataBlockBase<TextDataBlock>.GetBlock(ZombifiedInitiative._menu.m_menu.CurrentNode.ChildNodes[5].m_ChildNodes[num].m_ChildNodes[j].TextId).English == myself.PlayerName)
{
flag = true;
}
}
if (!flag)
{
ZombifiedInitiative._menu.m_menu.CurrentNode.ChildNodes[5].m_ChildNodes[num].m_ChildNodes.Add(mymenu);
}
menusetup = true;
}
if (myAI.Actions.Count == 0)
{
return;
}
actionsToRemove.Clear();
Enumerator<PlayerBotActionBase> enumerator = myAI.Actions.GetEnumerator();
while (enumerator.MoveNext())
{
PlayerBotActionBase current = enumerator.Current;
if (!allowedpickups && ((MemberInfo)((Object)current).GetIl2CppType()).Name == "PlayerBotActionCollectItem")
{
Descriptor obj = ((Il2CppObjectBase)current.DescBase).Cast<Descriptor>();
bool flag2 = obj.TargetItem.PublicName == "Disinfection Pack";
bool flag3 = obj.TargetItem.PublicName == "MediPack";
bool flag4 = obj.TargetItem.PublicName == "Ammo Pack";
bool flag5 = obj.TargetItem.PublicName == "Tool Refill Pack" || flag4 || flag3 || flag2;
if (obj.Haste < ZombifiedInitiative._manualActionsHaste && flag5)
{
pickupaction = current;
actionsToRemove.Add(current);
}
}
if (!allowedshare && ((MemberInfo)((Object)current).GetIl2CppType()).Name == "PlayerBotActionShareResourcePack" && ((Il2CppObjectBase)current.DescBase).Cast<Descriptor>().Haste < ZombifiedInitiative._manualActionsHaste)
{
shareaction = current;
actionsToRemove.Add(current);
}
}
if (actionsToRemove.Count == 0)
{
return;
}
bool flag6 = default(bool);
foreach (PlayerBotActionBase item in actionsToRemove)
{
ManualLogSource l = ZombifiedInitiative.L;
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(22, 2, ref flag6);
if (flag6)
{
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(myself.PlayerName);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" action ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((MemberInfo)((Object)item).GetIl2CppType()).Name);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" was cancelled");
}
l.LogInfo(val);
myAI.Actions.Remove(item);
}
actionsToRemove.Clear();
}
public void PreventManualActions()
{
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Expected O, but got Unknown
if (!started || myAI.Actions.Count == 0)
{
return;
}
List<PlayerBotActionBase> list = new List<PlayerBotActionBase>();
float num = ZombifiedInitiative._manualActionsHaste - 0.01f;
Enumerator<PlayerBotActionBase> enumerator = myAI.Actions.GetEnumerator();
while (enumerator.MoveNext())
{
PlayerBotActionBase current = enumerator.Current;
if (((MemberInfo)((Object)current).GetIl2CppType()).Name == "PlayerBotActionAttack" && ((Il2CppObjectBase)current.DescBase).Cast<Descriptor>().Haste > num)
{
list.Add(current);
}
else if (((MemberInfo)((Object)current).GetIl2CppType()).Name == "PlayerBotActionCollectItem" && ((Il2CppObjectBase)current.DescBase).Cast<Descriptor>().Haste > num)
{
list.Add(current);
}
else if (((MemberInfo)((Object)current).GetIl2CppType()).Name == "PlayerBotActionShareResourcePack" && ((Il2CppObjectBase)current.DescBase).Cast<Descriptor>().Haste > num)
{
list.Add(current);
}
}
bool flag = default(bool);
foreach (PlayerBotActionBase item in list)
{
myAI.Actions.Remove(item);
ManualLogSource l = ZombifiedInitiative.L;
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(32, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(myself.PlayerName);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("'s manual actions were cancelled");
}
l.LogInfo(val);
}
list.Clear();
}
public void ExecuteBotAction(Descriptor descriptor, string message)
{
myAI.StartAction(descriptor);
ZombifiedInitiative.L.LogInfo((object)message);
}
}
public class ZombieController : MonoBehaviour
{
public List<PlayerAgent> _plrs;
public static CommunicationNode zombmenu;
public static int _highlightedMenuButtonIndex = 0;
public static float _manualActionsPriority = 5f;
public static float _manualActionsHaste = 1f;
public static bool _preventAutoPickups = true;
public static bool _preventAutoUses = true;
public static bool _preventManual = false;
public static bool _debug = true;
public static bool _menuadded = false;
public void Awake()
{
ZombifiedInitiative.BotTable.Clear();
}
public static void AddZombifiedText()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Expected O, but got Unknown
//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: Expected O, but got Unknown
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Expected O, but got Unknown
//IL_0031: 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_003d: Expected O, but got Unknown
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Expected O, but got Unknown
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Expected O, but got Unknown
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Expected O, but got Unknown
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Expected O, but got Unknown
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Expected O, but got Unknown
//IL_0075: 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_0087: Expected O, but got Unknown
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Expected O, but got Unknown
//IL_0093: 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_009f: Expected O, but got Unknown
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Expected O, but got Unknown
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Expected O, but got Unknown
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Expected O, but got Unknown
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Expected O, but got Unknown
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Expected O, but got Unknown
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Expected O, but got Unknown
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Expected O, but got Unknown
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Expected O, but got Unknown
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Expected O, but got Unknown
//IL_0109: 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_011b: Expected O, but got Unknown
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: Expected O, but got Unknown
//IL_018e: 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_0206: Unknown result type (might be due to invalid IL or missing references)
//IL_0242: Unknown result type (might be due to invalid IL or missing references)
//IL_027f: Unknown result type (might be due to invalid IL or missing references)
//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
TextDataBlock val = new TextDataBlock();
((GameDataBlockBase<TextDataBlock>)val).persistentID = 0u;
((GameDataBlockBase<TextDataBlock>)val).internalEnabled = true;
val.SkipLocalization = true;
((GameDataBlockBase<TextDataBlock>)val).name = "zombtext1";
val.English = "Zombified Initiative";
TextDataBlock val2 = val;
TextDataBlock val3 = new TextDataBlock();
((GameDataBlockBase<TextDataBlock>)val3).persistentID = 0u;
((GameDataBlockBase<TextDataBlock>)val3).internalEnabled = true;
val3.SkipLocalization = true;
((GameDataBlockBase<TextDataBlock>)val3).name = "zombtext2";
val3.English = "AllBots attack my target";
TextDataBlock val4 = val3;
TextDataBlock val5 = new TextDataBlock();
((GameDataBlockBase<TextDataBlock>)val5).persistentID = 0u;
((GameDataBlockBase<TextDataBlock>)val5).internalEnabled = true;
val5.SkipLocalization = true;
((GameDataBlockBase<TextDataBlock>)val5).name = "zombtext3";
val5.English = "AllBots toggle pickup permission";
TextDataBlock val6 = val5;
TextDataBlock val7 = new TextDataBlock();
((GameDataBlockBase<TextDataBlock>)val7).persistentID = 0u;
((GameDataBlockBase<TextDataBlock>)val7).internalEnabled = true;
val7.SkipLocalization = true;
((GameDataBlockBase<TextDataBlock>)val7).name = "zombtext4";
val7.English = "AllBots clear command queue";
TextDataBlock val8 = val7;
TextDataBlock val9 = new TextDataBlock();
((GameDataBlockBase<TextDataBlock>)val9).persistentID = 0u;
((GameDataBlockBase<TextDataBlock>)val9).internalEnabled = true;
val9.SkipLocalization = true;
((GameDataBlockBase<TextDataBlock>)val9).name = "zombtext5";
val9.English = "AllBots toggle share permission";
TextDataBlock val10 = val9;
TextDataBlock val11 = new TextDataBlock();
((GameDataBlockBase<TextDataBlock>)val11).persistentID = 0u;
((GameDataBlockBase<TextDataBlock>)val11).internalEnabled = true;
val11.SkipLocalization = true;
((GameDataBlockBase<TextDataBlock>)val11).name = "zombtext6";
val11.English = "All Bots";
GameDataBlockBase<TextDataBlock>.AddBlock(val2, -1);
GameDataBlockBase<TextDataBlock>.AddBlock(val4, -1);
GameDataBlockBase<TextDataBlock>.AddBlock(val6, -1);
GameDataBlockBase<TextDataBlock>.AddBlock(val8, -1);
GameDataBlockBase<TextDataBlock>.AddBlock(val10, -1);
GameDataBlockBase<TextDataBlock>.AddBlock(val11, -1);
GameDataTextLocalizationService val12 = ((Il2CppObjectBase)Text.TextLocalizationService).TryCast<GameDataTextLocalizationService>();
if (!val12.m_texts.ContainsKey(GameDataBlockBase<TextDataBlock>.GetBlockID("zombtext1")))
{
val12.m_texts.Add(GameDataBlockBase<TextDataBlock>.GetBlockID("zombtext1"), val2.GetText(val12.CurrentLanguage, false));
}
if (!val12.m_texts.ContainsKey(GameDataBlockBase<TextDataBlock>.GetBlockID("zombtext2")))
{
val12.m_texts.Add(GameDataBlockBase<TextDataBlock>.GetBlockID("zombtext2"), val4.GetText(val12.CurrentLanguage, false));
}
if (!val12.m_texts.ContainsKey(GameDataBlockBase<TextDataBlock>.GetBlockID("zombtext3")))
{
val12.m_texts.Add(GameDataBlockBase<TextDataBlock>.GetBlockID("zombtext3"), val6.GetText(val12.CurrentLanguage, false));
}
if (!val12.m_texts.ContainsKey(GameDataBlockBase<TextDataBlock>.GetBlockID("zombtext4")))
{
val12.m_texts.Add(GameDataBlockBase<TextDataBlock>.GetBlockID("zombtext4"), val8.GetText(val12.CurrentLanguage, false));
}
if (!val12.m_texts.ContainsKey(GameDataBlockBase<TextDataBlock>.GetBlockID("zombtext5")))
{
val12.m_texts.Add(GameDataBlockBase<TextDataBlock>.GetBlockID("zombtext5"), val10.GetText(val12.CurrentLanguage, false));
}
if (!val12.m_texts.ContainsKey(GameDataBlockBase<TextDataBlock>.GetBlockID("zombtext6")))
{
val12.m_texts.Add(GameDataBlockBase<TextDataBlock>.GetBlockID("zombtext6"), val10.GetText(val12.CurrentLanguage, false));
}
}
public void Initialize()
{
if (!_menuadded)
{
AddZombifiedMenu();
_menuadded = true;
}
}
private void Update()
{
if (Input.GetKeyDown((KeyCode)108))
{
SwitchDebug();
}
if (Input.GetKeyDown((KeyCode)106))
{
_preventAutoPickups = !_preventAutoPickups;
Print("Automatic resource pickups " + (_preventAutoPickups ? "disabled" : "enabled"));
}
if (Input.GetKeyDown((KeyCode)107))
{
_preventAutoUses = !_preventAutoUses;
Print("Automatic resource uses " + (_preventAutoUses ? "disabled" : "enabled"));
}
if (Input.GetKey((KeyCode)56))
{
SendBot("Dauda");
}
if (Input.GetKey((KeyCode)57))
{
SendBot("Hackett");
}
if (Input.GetKey((KeyCode)48))
{
SendBot("Bishop");
}
if (Input.GetKey((KeyCode)287))
{
SendBot("Woods");
}
static void SendBot(string bot)
{
if (Input.GetMouseButtonDown(2))
{
EnemyAgent monsterUnderPlayerAim = GetMonsterUnderPlayerAim();
if ((Object)(object)monsterUnderPlayerAim != (Object)null)
{
SendBotToKillEnemy(bot, (Agent)(object)monsterUnderPlayerAim, (StanceEnum)3, (AttackMeansEnum)31, (PostureEnum)1);
}
}
if (Input.GetKeyDown((KeyCode)117))
{
ItemInLevel itemUnderPlayerAim = GetItemUnderPlayerAim();
if ((Object)(object)itemUnderPlayerAim != (Object)null)
{
SendBotToPickupItem(bot, itemUnderPlayerAim);
}
}
if (Input.GetKeyDown((KeyCode)105))
{
SendBotToShareResourcePack(bot, GetHumanUnderPlayerAim());
}
}
}
public void FindMenu()
{
ZombifiedInitiative._menu = Object.FindObjectOfType<PUI_CommunicationMenu>();
Print("Found menu");
}
public static void AddZombifiedMenu()
{
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Expected O, but got Unknown
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Expected O, but got Unknown
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Expected O, but got Unknown
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Expected O, but got Unknown
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Expected O, but got Unknown
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Expected O, but got Unknown
uint blockID = GameDataBlockBase<TextDataBlock>.GetBlockID("zombtext1");
uint blockID2 = GameDataBlockBase<TextDataBlock>.GetBlockID("zombtext2");
uint blockID3 = GameDataBlockBase<TextDataBlock>.GetBlockID("zombtext3");
uint blockID4 = GameDataBlockBase<TextDataBlock>.GetBlockID("zombtext4");
uint blockID5 = GameDataBlockBase<TextDataBlock>.GetBlockID("zombtext5");
CommunicationNode val = new CommunicationNode(GameDataBlockBase<TextDataBlock>.GetBlockID("zombtext6"), (ScriptType)0, (List<CommunicationNode>)null, (Sprite)null);
val.IsLastNode = false;
val.m_ChildNodes.Add(new CommunicationNode(blockID2, (ScriptType)0, (List<CommunicationNode>)null, (Sprite)null));
val.m_ChildNodes.Add(new CommunicationNode(blockID3, (ScriptType)0, (List<CommunicationNode>)null, (Sprite)null));
val.m_ChildNodes.Add(new CommunicationNode(blockID4, (ScriptType)0, (List<CommunicationNode>)null, (Sprite)null));
val.m_ChildNodes.Add(new CommunicationNode(blockID5, (ScriptType)0, (List<CommunicationNode>)null, (Sprite)null));
val.m_ChildNodes[0].DialogID = 314u;
val.m_ChildNodes[1].DialogID = 314u;
val.m_ChildNodes[2].DialogID = 314u;
val.m_ChildNodes[3].DialogID = 314u;
CommunicationNode val2 = new CommunicationNode(blockID, (ScriptType)0, (List<CommunicationNode>)null, (Sprite)null);
val2.IsLastNode = false;
val2.m_ChildNodes.Add(val);
ZombifiedInitiative._menu.m_menu.CurrentNode.ChildNodes[5].m_ChildNodes.Add(val2);
ZombifiedInitiative.rootmenusetup = true;
}
public static EnemyAgent GetMonsterUnderPlayerAim()
{
return GetComponentUnderPlayerAim((EnemyAgent enemy) => "Found monster: " + ((GameDataBlockBase<EnemyDataBlock>)(object)enemy.EnemyData).name, raycastAll: false);
}
public static void SendBotToKillEnemy(string chosenBot, Agent enemy, StanceEnum stance, AttackMeansEnum means, PostureEnum posture)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//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_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_0033: 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_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Expected O, but got Unknown
PlayerAIBot val = ZombifiedInitiative.BotTable[chosenBot];
if (!((Object)(object)val == (Object)null))
{
ExecuteBotAction(val, (Descriptor)new Descriptor(val)
{
Stance = stance,
Means = means,
Posture = posture,
TargetAgent = enemy,
Prio = _manualActionsPriority,
Haste = _manualActionsHaste
}, "Added kill enemy action to " + val.Agent.PlayerName);
}
}
public static ItemInLevel GetItemUnderPlayerAim()
{
return GetComponentUnderPlayerAim((ItemInLevel item) => "Found item: " + ((Item)item).PublicName);
}
public static void SendBotToPickupItem(string chosenBot, ItemInLevel item)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: 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_0037: 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_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Expected O, but got Unknown
PlayerAIBot val = ZombifiedInitiative.BotTable[chosenBot];
if (!((Object)(object)val == (Object)null))
{
ExecuteBotAction(val, (Descriptor)new Descriptor(val)
{
TargetItem = (Item)(object)item,
TargetContainer = item.container,
TargetPosition = ((Component)item).transform.position,
Prio = _manualActionsPriority,
Haste = _manualActionsHaste
}, "Added collect item action to " + val.Agent.PlayerName);
}
}
public static PlayerAgent GetHumanUnderPlayerAim()
{
PlayerAIBot componentUnderPlayerAim = GetComponentUnderPlayerAim((PlayerAIBot bot) => "Found bot: " + bot.Agent.PlayerName);
if ((Object)(object)componentUnderPlayerAim != (Object)null)
{
return componentUnderPlayerAim.Agent;
}
PlayerAgent componentUnderPlayerAim2 = GetComponentUnderPlayerAim((PlayerAgent player) => "Found other player: " + player.PlayerName);
if ((Object)(object)componentUnderPlayerAim2 != (Object)null)
{
return componentUnderPlayerAim2;
}
PlayerAgent localPlayerAgent = PlayerManager.GetLocalPlayerAgent();
Print("Found local player: " + localPlayerAgent.PlayerName);
return localPlayerAgent;
}
public static void SendBotToShareResourcePack(string chosenBot, PlayerAgent human)
{
//IL_0054: 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_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: 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_0097: Expected O, but got Unknown
PlayerAIBot val = ZombifiedInitiative.BotTable[chosenBot];
if (!((Object)(object)val == (Object)null))
{
BackpackItem val2 = null;
if (val.Backpack.HasBackpackItem((InventorySlot)4) && val.Backpack.TryGetBackpackItem((InventorySlot)4, ref val2))
{
ItemEquippable val3 = ((Il2CppObjectBase)val2.Instance).Cast<ItemEquippable>();
val.Inventory.DoEquipItem(val3);
ExecuteBotAction(val, (Descriptor)new Descriptor(val)
{
Receiver = human,
Item = val3,
Prio = _manualActionsPriority,
Haste = _manualActionsHaste
}, "Added share resource action to " + val.Agent.PlayerName);
}
}
}
public static void ExecuteBotAction(PlayerAIBot bot, Descriptor descriptor, string message)
{
bot.StartAction(descriptor);
Print(message);
}
public static T GetComponentUnderPlayerAim<T>(Func<T, string> message, bool raycastAll = true) where T : class
{
//IL_0063: 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_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)
if (raycastAll)
{
foreach (RaycastHit item in (Il2CppArrayBase<RaycastHit>)(object)RaycastHits())
{
RaycastHit current = item;
T componentInParent = ((Component)((RaycastHit)(ref current)).collider).GetComponentInParent<T>();
if (componentInParent != null)
{
Print(message(componentInParent));
return componentInParent;
}
}
}
else
{
RaycastHit? val = RaycastHit();
if (val.HasValue)
{
RaycastHit value = val.Value;
T componentInParent2 = ((Component)((RaycastHit)(ref value)).collider).GetComponentInParent<T>();
if (componentInParent2 == null)
{
return null;
}
Print(message(componentInParent2));
return componentInParent2;
}
}
return null;
}
public static RaycastHit? RaycastHit()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
RaycastHit value = default(RaycastHit);
if (Physics.Raycast(Camera.current.ScreenPointToRay(Input.mousePosition), ref value))
{
return value;
}
return null;
}
public static Il2CppStructArray<RaycastHit> RaycastHits()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
return Physics.RaycastAll(Camera.current.ScreenPointToRay(Input.mousePosition));
}
public static void SwitchDebug()
{
_debug = !_debug;
Print("Debug log " + (_debug ? "enabled" : "disabled"), forced: true);
}
public static void Print(string text, bool forced = false)
{
if (_debug || forced)
{
ZombifiedInitiative.L.LogInfo((object)text);
}
}
}
}