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 Gear;
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 SNetwork;
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+00c35c3ab7769fec74368689a1c595dd552cf413")]
[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.started = false;
}
}
[HarmonyPatch(typeof(CommunicationMenu), "PlayConfirmSound")]
[HarmonyPrefix]
public static void PlayConfirmSound(CommunicationMenu __instance)
{
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01ad: Expected O, but got Unknown
//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
//IL_02b1: Expected O, but got Unknown
//IL_03ab: Unknown result type (might be due to invalid IL or missing references)
//IL_03b2: 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))
{
continue;
}
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);
if (!SNet.IsMaster)
{
NetworkAPI.InvokeEvent<ZombifiedInitiative.ZINetInfo>("ZINetInfo", new ZombifiedInitiative.ZINetInfo(2, item2.Value.m_playerAgent.PlayerSlotIndex, 0, 0, 0), (SNet_ChannelType)2);
}
if (SNet.IsMaster)
{
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))
{
continue;
}
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);
if (!SNet.IsMaster)
{
NetworkAPI.InvokeEvent<ZombifiedInitiative.ZINetInfo>("ZINetInfo", new ZombifiedInitiative.ZINetInfo(1, item3.Value.m_playerAgent.PlayerSlotIndex, 0, 0, 0), (SNet_ChannelType)2);
}
if (SNet.IsMaster)
{
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);
if (!SNet.IsMaster)
{
NetworkAPI.InvokeEvent<ZombifiedInitiative.ZINetInfo>("ZINetInfo", new ZombifiedInitiative.ZINetInfo(5, item4.Value.m_playerAgent.PlayerSlotIndex, 0, 0, 0), (SNet_ChannelType)2);
}
if (SNet.IsMaster)
{
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());
}
if (!text2.Contains("sentry mode"))
{
return;
}
if (text == "AllBots")
{
ZombifiedInitiative.L.LogInfo((object)"all bots sentry mode");
{
foreach (KeyValuePair<string, PlayerAIBot> item5 in ZombifiedInitiative.BotTable)
{
((Component)item5.Value).GetComponent<ZombieComp>().allowedmove = !((Component)item5.Value).GetComponent<ZombieComp>().allowedmove;
if (((Component)item5.Value).GetComponent<ZombieComp>().allowedmove)
{
((Component)item5.Value).GetComponent<ZombieComp>().followaction.DescBase.Status = (StatusType)0;
}
if (((Component)item5.Value).GetComponent<ZombieComp>().allowedmove)
{
((Component)item5.Value).GetComponent<ZombieComp>().travelaction.DescBase.Status = (StatusType)0;
}
}
return;
}
}
ZombifiedInitiative.L.LogInfo((object)("bot " + text + " sentry mode"));
((Component)ZombifiedInitiative.BotTable[text]).GetComponent<ZombieComp>().allowedmove = !((Component)ZombifiedInitiative.BotTable[text]).GetComponent<ZombieComp>().allowedmove;
if (((Component)ZombifiedInitiative.BotTable[text]).GetComponent<ZombieComp>().allowedmove)
{
((Component)ZombifiedInitiative.BotTable[text]).GetComponent<ZombieComp>().followaction.DescBase.Status = (StatusType)0;
}
if (((Component)ZombifiedInitiative.BotTable[text]).GetComponent<ZombieComp>().allowedmove)
{
((Component)ZombifiedInitiative.BotTable[text]).GetComponent<ZombieComp>().travelaction.DescBase.Status = (StatusType)0;
}
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.hirnukuono.zombified_initiative", "Zombified Initiative", "0.9.5")]
public class ZombifiedInitiative : BasePlugin
{
public struct ZINetInfo
{
public int FUNC;
public int SLOT;
public int ITEMTYPE;
public int ITEMSERIAL;
public int AGENTID;
public static string NetworkIdentity => "ZINetInfo";
public ZINetInfo(int func, int slot, int itemtype, int itemserial, int agentid)
{
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Expected O, but got Unknown
this = default(ZINetInfo);
FUNC = func;
SLOT = slot;
ITEMTYPE = itemtype;
ITEMSERIAL = itemserial;
AGENTID = agentid;
ManualLogSource l = L;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(27, 5, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("sent a package ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(func);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" - ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(slot);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" - ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(itemtype);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" - ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(itemserial);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" - ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(agentid);
}
l.LogInfo(val);
}
}
public struct ZIInfo
{
public int FUNC;
public int SLOT;
public int ITEMTYPE;
public int ITEMSERIAL;
public int AGENTID;
public ZIInfo(int func, int slot, int itemtype, int itemserial, int agentid)
{
this = default(ZIInfo);
FUNC = func;
SLOT = slot;
ITEMTYPE = itemtype;
ITEMSERIAL = itemserial;
AGENTID = agentid;
}
public ZIInfo(ZINetInfo network)
{
this = default(ZIInfo);
FUNC = network.FUNC;
SLOT = network.SLOT;
ITEMTYPE = network.ITEMTYPE;
ITEMSERIAL = network.ITEMSERIAL;
AGENTID = network.AGENTID;
}
}
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>();
NetworkAPI.RegisterEvent<ZINetInfo>(ZINetInfo.NetworkIdentity, (Action<ulong, ZINetInfo>)ZombieController.ReceiveZINetInfo);
LG_Factory.OnFactoryBuildDone += Action.op_Implicit((Action)@object.OnFactoryBuildDone);
EventAPI.OnExpeditionStarted += @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;
private TextDataBlock textsentry;
public CommunicationNode mymenu;
public bool allowedpickups = true;
public bool allowedshare = true;
public bool allowedmove = true;
public bool started;
private List<PlayerBotActionBase> actionsToRemove = new List<PlayerBotActionBase>();
private PlayerAgent myself;
private PlayerAIBot myAI;
public PlayerBotActionBase pickupaction;
public PlayerBotActionBase shareaction;
public PlayerBotActionBase followaction;
public PlayerBotActionBase travelaction;
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_00b2: 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_00be: Expected O, but got Unknown
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Expected O, but got Unknown
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Expected O, but got Unknown
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Expected O, but got Unknown
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Expected O, but got Unknown
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Expected O, but got Unknown
//IL_013f: 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_0161: Expected O, but got Unknown
//IL_0161: Unknown result type (might be due to invalid IL or missing references)
//IL_0182: Expected O, but got Unknown
//IL_019f: Unknown result type (might be due to invalid IL or missing references)
//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
//IL_01bc: Expected O, but got Unknown
//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
//IL_01c3: Expected O, but got Unknown
//IL_01c3: 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_01e5: Expected O, but got Unknown
//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
//IL_0206: Expected O, but got Unknown
//IL_0223: Unknown result type (might be due to invalid IL or missing references)
//IL_0234: Unknown result type (might be due to invalid IL or missing references)
//IL_0239: Unknown result type (might be due to invalid IL or missing references)
//IL_0240: Expected O, but got Unknown
//IL_0240: Unknown result type (might be due to invalid IL or missing references)
//IL_0247: Expected O, but got Unknown
//IL_0247: Unknown result type (might be due to invalid IL or missing references)
//IL_024e: Unknown result type (might be due to invalid IL or missing references)
//IL_0269: Expected O, but got Unknown
//IL_0269: Unknown result type (might be due to invalid IL or missing references)
//IL_028a: Expected O, but got Unknown
//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
//IL_02c4: Expected O, but got Unknown
//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
//IL_02cb: Expected O, but got Unknown
//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
//IL_02ed: Expected O, but got Unknown
//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
//IL_030e: Expected O, but got Unknown
//IL_032b: Unknown result type (might be due to invalid IL or missing references)
//IL_033c: Unknown result type (might be due to invalid IL or missing references)
//IL_0341: Unknown result type (might be due to invalid IL or missing references)
//IL_0348: Expected O, but got Unknown
//IL_0348: Unknown result type (might be due to invalid IL or missing references)
//IL_034f: Expected O, but got Unknown
//IL_034f: Unknown result type (might be due to invalid IL or missing references)
//IL_0356: Unknown result type (might be due to invalid IL or missing references)
//IL_0371: Expected O, but got Unknown
//IL_0371: Unknown result type (might be due to invalid IL or missing references)
//IL_0392: Expected O, but got Unknown
//IL_03af: Unknown result type (might be due to invalid IL or missing references)
//IL_03c0: Unknown result type (might be due to invalid IL or missing references)
//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
//IL_03cc: Expected O, but got Unknown
//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
//IL_03d3: Expected O, but got Unknown
//IL_03d3: Unknown result type (might be due to invalid IL or missing references)
//IL_03da: Unknown result type (might be due to invalid IL or missing references)
//IL_03f5: Expected O, but got Unknown
//IL_03f5: Unknown result type (might be due to invalid IL or missing references)
//IL_0416: Expected O, but got Unknown
//IL_0433: Unknown result type (might be due to invalid IL or missing references)
//IL_0444: Unknown result type (might be due to invalid IL or missing references)
//IL_0449: Unknown result type (might be due to invalid IL or missing references)
//IL_0450: Expected O, but got Unknown
//IL_0450: Unknown result type (might be due to invalid IL or missing references)
//IL_0457: Expected O, but got Unknown
//IL_0457: Unknown result type (might be due to invalid IL or missing references)
//IL_045e: Unknown result type (might be due to invalid IL or missing references)
//IL_0479: Expected O, but got Unknown
//IL_0479: Unknown result type (might be due to invalid IL or missing references)
//IL_049a: Expected O, but got Unknown
//IL_04b7: Unknown result type (might be due to invalid IL or missing references)
//IL_04d6: Unknown result type (might be due to invalid IL or missing references)
//IL_04e0: Expected O, but got Unknown
//IL_0505: Unknown result type (might be due to invalid IL or missing references)
//IL_050f: Expected O, but got Unknown
//IL_0528: Unknown result type (might be due to invalid IL or missing references)
//IL_0532: Expected O, but got Unknown
//IL_054b: Unknown result type (might be due to invalid IL or missing references)
//IL_0555: Expected O, but got Unknown
//IL_056e: Unknown result type (might be due to invalid IL or missing references)
//IL_0578: Expected O, but got Unknown
//IL_0591: Unknown result type (might be due to invalid IL or missing references)
//IL_059b: Expected O, but got Unknown
//IL_05b4: Unknown result type (might be due to invalid IL or missing references)
//IL_05be: Expected O, but got Unknown
//IL_05d7: Unknown result type (might be due to invalid IL or missing references)
//IL_05e1: 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);
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));
TextDataBlock val10 = new TextDataBlock();
((GameDataBlockBase<TextDataBlock>)val10).persistentID = 0u;
((GameDataBlockBase<TextDataBlock>)val10).internalEnabled = true;
val10.SkipLocalization = true;
((GameDataBlockBase<TextDataBlock>)val10).name = myself.PlayerName + "sentry";
val10.English = myself.PlayerName + " toggle sentry mode";
textsentry = GameDataBlockBase<TextDataBlock>.AddBlock(val10, -1);
val2.m_texts.Add(((GameDataBlockBase<TextDataBlock>)(object)textsentry).persistentID, textsentry.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.Add(new CommunicationNode(((GameDataBlockBase<TextDataBlock>)(object)textsentry).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;
mymenu.m_ChildNodes[6].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_04a4: Unknown result type (might be due to invalid IL or missing references)
//IL_04ab: 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;
ZombifiedInitiative._menu.m_menu.CurrentNode.ChildNodes[5].m_ChildNodes[num].m_ChildNodes[j].IsLastNode = false;
}
}
if (!flag)
{
ZombifiedInitiative._menu.m_menu.CurrentNode.ChildNodes[5].m_ChildNodes[num].m_ChildNodes.Add(mymenu);
for (int k = 0; k < ZombifiedInitiative._menu.m_menu.CurrentNode.ChildNodes[5].m_ChildNodes[num].m_ChildNodes.Count; k++)
{
if (GameDataBlockBase<TextDataBlock>.GetBlock(ZombifiedInitiative._menu.m_menu.CurrentNode.ChildNodes[5].m_ChildNodes[num].m_ChildNodes[k].TextId).English == myself.PlayerName)
{
ZombifiedInitiative._menu.m_menu.CurrentNode.ChildNodes[5].m_ChildNodes[num].m_ChildNodes[k].IsLastNode = false;
}
}
}
menusetup = true;
}
if (!SNet.IsMaster || myAI.Actions.Count == 0)
{
return;
}
actionsToRemove.Clear();
Enumerator<PlayerBotActionBase> enumerator = myAI.Actions.GetEnumerator();
while (enumerator.MoveNext())
{
PlayerBotActionBase current = enumerator.Current;
if (((MemberInfo)((Object)current).GetIl2CppType()).Name == "PlayerBotActionFollow")
{
followaction = current;
}
if (((MemberInfo)((Object)current).GetIl2CppType()).Name == "PlayerBotActionTravel")
{
travelaction = current;
}
if (!allowedmove && ((MemberInfo)((Object)current).GetIl2CppType()).Name == "PlayerBotActionFollow")
{
current.DescBase.Status = (StatusType)1;
}
if (!allowedmove && ((MemberInfo)((Object)current).GetIl2CppType()).Name == "PlayerBotActionTravel")
{
current.DescBase.Status = (StatusType)1;
}
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)
{
myAI.Actions.Remove(item);
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);
}
actionsToRemove.Clear();
}
public void PreventManualActions()
{
//IL_015d: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: Expected O, but got Unknown
if (!started || myAI.Actions.Count == 0)
{
return;
}
if (pickupaction != null)
{
pickupaction.DescBase.SetCompletionStatus((StatusType)4);
}
if (shareaction != null)
{
shareaction.DescBase.SetCompletionStatus((StatusType)4);
}
pickupaction = null;
shareaction = null;
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 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 static void ReceiveZINetInfo(ulong sender, ZombifiedInitiative.ZINetInfo netInfo)
{
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Expected O, but got Unknown
//IL_01a5: 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)
//IL_0505: Unknown result type (might be due to invalid IL or missing references)
//IL_050a: Unknown result type (might be due to invalid IL or missing references)
//IL_0511: Unknown result type (might be due to invalid IL or missing references)
//IL_051d: Unknown result type (might be due to invalid IL or missing references)
//IL_0524: Unknown result type (might be due to invalid IL or missing references)
//IL_052e: Unknown result type (might be due to invalid IL or missing references)
//IL_0539: Unknown result type (might be due to invalid IL or missing references)
//IL_0565: Expected O, but got Unknown
//IL_0228: Unknown result type (might be due to invalid IL or missing references)
//IL_022e: Invalid comparison between Unknown and I4
//IL_0252: Unknown result type (might be due to invalid IL or missing references)
//IL_0258: Invalid comparison between Unknown and I4
//IL_05e5: Unknown result type (might be due to invalid IL or missing references)
//IL_05ea: Unknown result type (might be due to invalid IL or missing references)
//IL_05f2: Unknown result type (might be due to invalid IL or missing references)
//IL_05fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0605: Unknown result type (might be due to invalid IL or missing references)
//IL_0652: Expected O, but got Unknown
//IL_027c: Unknown result type (might be due to invalid IL or missing references)
//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
//IL_02ac: Invalid comparison between Unknown and I4
EnemyAgent val = null;
ItemInLevel val2 = null;
int num = 0;
int num2 = 0;
ZombieComp zombieComp = null;
string text = "";
Debug.Log(Object.op_Implicit("received data from sender " + sender + ": func:" + netInfo.FUNC + " slot:" + netInfo.SLOT + " itemtype:" + netInfo.ITEMTYPE + " itemserial:" + netInfo.ITEMSERIAL + " enemyid:" + netInfo.AGENTID));
if (!SNet.IsMaster)
{
return;
}
int num3 = 9;
for (int i = 0; i < PlayerManager.PlayerAgentsInLevel.Count; i++)
{
PlayerAgent val3 = PlayerManager.PlayerAgentsInLevel[i];
if (sender == ((Agent)val3).m_replicator.OwningPlayer.Lookup)
{
num3 = i;
}
}
if (num3 == 9)
{
return;
}
Agent val4 = null;
PlayerAgent val5 = PlayerManager.PlayerAgentsInLevel[num3];
ManualLogSource l = ZombifiedInitiative.L;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val6 = new BepInExInfoLogInterpolatedStringHandler(27, 3, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val6).AppendLiteral("player ");
((BepInExLogInterpolatedStringHandler)val6).AppendFormatted<string>(val5.PlayerName);
((BepInExLogInterpolatedStringHandler)val6).AppendLiteral(" is sender ");
((BepInExLogInterpolatedStringHandler)val6).AppendFormatted<ulong>(val5.Sync.Replicator.OwningPlayer.Lookup);
((BepInExLogInterpolatedStringHandler)val6).AppendLiteral(" in slot ");
((BepInExLogInterpolatedStringHandler)val6).AppendFormatted<int>(val5.PlayerSlotIndex);
}
l.LogInfo(val6);
if (netInfo.AGENTID > 0)
{
pReplicator pRep = default(pReplicator);
pRep.keyPlusOne = (ushort)netInfo.AGENTID;
pAgent val7 = default(pAgent);
val7.pRep = pRep;
((pAgent)(ref val7)).TryGet(ref val4);
}
num = netInfo.ITEMTYPE;
num2 = netInfo.ITEMSERIAL;
if (num > 0 && num2 > 0)
{
Enumerator<Dimension> enumerator = Builder.CurrentFloor.m_dimensions.GetEnumerator();
while (enumerator.MoveNext())
{
Enumerator<LG_Tile> enumerator2 = enumerator.Current.Tiles.GetEnumerator();
while (enumerator2.MoveNext())
{
foreach (ResourcePackPickup componentsInChild in ((Component)enumerator2.Current.m_geoRoot).GetComponentsInChildren<ResourcePackPickup>())
{
if ((int)componentsInChild.m_packType == 1 && netInfo.ITEMTYPE == 1 && componentsInChild.m_serialNumber == netInfo.ITEMSERIAL)
{
val2 = ((Il2CppObjectBase)componentsInChild).TryCast<ItemInLevel>();
}
if ((int)componentsInChild.m_packType == 2 && netInfo.ITEMTYPE == 2 && componentsInChild.m_serialNumber == netInfo.ITEMSERIAL)
{
val2 = ((Il2CppObjectBase)componentsInChild).TryCast<ItemInLevel>();
}
if ((int)componentsInChild.m_packType == 0 && netInfo.ITEMTYPE == 3 && componentsInChild.m_serialNumber == netInfo.ITEMSERIAL)
{
val2 = ((Il2CppObjectBase)componentsInChild).TryCast<ItemInLevel>();
}
if ((int)componentsInChild.m_packType == 9 && netInfo.ITEMTYPE == 4 && componentsInChild.m_serialNumber == netInfo.ITEMSERIAL)
{
val2 = ((Il2CppObjectBase)componentsInChild).TryCast<ItemInLevel>();
}
}
}
}
}
if (netInfo.SLOT < 8)
{
foreach (KeyValuePair<string, PlayerAIBot> item in ZombifiedInitiative.BotTable)
{
if (item.Value.Agent.PlayerSlotIndex == netInfo.SLOT)
{
zombieComp = ((Component)item.Value).GetComponent<ZombieComp>();
text = item.Value.Agent.PlayerName;
}
}
}
if (netInfo.FUNC == 0)
{
val = ((Il2CppObjectBase)val4).TryCast<EnemyAgent>();
if ((Object)(object)val == (Object)null)
{
return;
}
if (netInfo.SLOT == 8)
{
foreach (KeyValuePair<string, PlayerAIBot> item2 in ZombifiedInitiative.BotTable)
{
SendBotToKillEnemy(item2.Key, (Agent)(object)val, (StanceEnum)3, (AttackMeansEnum)31, (PostureEnum)1);
}
}
if (netInfo.SLOT < 8)
{
SendBotToKillEnemy(text, (Agent)(object)val, (StanceEnum)3, (AttackMeansEnum)31, (PostureEnum)1);
}
}
if (netInfo.FUNC == 1)
{
if (netInfo.SLOT == 8)
{
foreach (KeyValuePair<string, PlayerAIBot> item3 in ZombifiedInitiative.BotTable)
{
((Component)item3.Value).GetComponent<ZombieComp>().allowedshare = !((Component)item3.Value).GetComponent<ZombieComp>().allowedshare;
}
}
if (netInfo.SLOT < 8)
{
zombieComp.allowedshare = !zombieComp.allowedshare;
}
}
if (netInfo.FUNC == 2)
{
if (netInfo.SLOT == 8)
{
foreach (KeyValuePair<string, PlayerAIBot> item4 in ZombifiedInitiative.BotTable)
{
((Component)item4.Value).GetComponent<ZombieComp>().allowedpickups = !((Component)item4.Value).GetComponent<ZombieComp>().allowedpickups;
}
}
if (netInfo.SLOT < 8)
{
zombieComp.allowedpickups = !zombieComp.allowedpickups;
}
}
if (netInfo.FUNC == 3)
{
ExecuteBotAction(((Component)zombieComp).GetComponent<PlayerAIBot>(), (Descriptor)new Descriptor(((Component)zombieComp).GetComponent<PlayerAIBot>())
{
TargetItem = (Item)(object)val2,
TargetContainer = val2.container,
TargetPosition = ((Component)val2).transform.position,
Prio = _manualActionsPriority,
Haste = _manualActionsHaste
}, "Added collect item action to " + text, 4, ((Component)zombieComp).GetComponent<PlayerAgent>().PlayerSlotIndex, num, num2, 0);
}
if (netInfo.FUNC == 4)
{
PlayerAgent val8 = ((Il2CppObjectBase)val4).TryCast<PlayerAgent>();
if ((Object)(object)val8 == (Object)null)
{
return;
}
BackpackItem val9 = null;
if (!((Component)zombieComp).GetComponent<PlayerAIBot>().Backpack.HasBackpackItem((InventorySlot)4) || !((Component)zombieComp).GetComponent<PlayerAIBot>().Backpack.TryGetBackpackItem((InventorySlot)4, ref val9))
{
return;
}
ItemEquippable val10 = ((Il2CppObjectBase)val9.Instance).Cast<ItemEquippable>();
((Component)zombieComp).GetComponent<PlayerAIBot>().Inventory.DoEquipItem(val10);
ExecuteBotAction(((Component)zombieComp).GetComponent<PlayerAIBot>(), (Descriptor)new Descriptor(((Component)zombieComp).GetComponent<PlayerAIBot>())
{
Receiver = val8,
Item = val10,
Prio = _manualActionsPriority,
Haste = _manualActionsHaste
}, "Added share resource action to " + ((Component)zombieComp).GetComponent<PlayerAIBot>().Agent.PlayerName, 4, ((Component)zombieComp).GetComponent<PlayerAIBot>().m_playerAgent.PlayerSlotIndex, 0, 0, ((Agent)val8).m_replicator.Key + 1);
}
if (netInfo.FUNC != 5)
{
return;
}
if (netInfo.SLOT == 8)
{
foreach (KeyValuePair<string, PlayerAIBot> item5 in ZombifiedInitiative.BotTable)
{
((Component)item5.Value).GetComponent<ZombieComp>().PreventManualActions();
}
}
if (netInfo.SLOT < 8)
{
zombieComp.PreventManualActions();
}
}
public void Awake()
{
ZombifiedInitiative.BotTable.Clear();
}
public void OnFactoryBuildDone()
{
ZombifiedInitiative.BotTable.Clear();
Enumerator<PlayerAgent> enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator();
while (enumerator.MoveNext())
{
PlayerAgent current = enumerator.Current;
if (current.Owner.IsBot)
{
ZombifiedInitiative.BotTable.Add(current.PlayerName, ((Component)current).GetComponent<PlayerAIBot>());
}
}
ZombifiedInitiative._menu = Object.FindObjectOfType<PUI_CommunicationMenu>();
if (!_menuadded)
{
AddZombifiedText();
AddZombifiedMenu();
ZombifiedInitiative.rootmenusetup = true;
_menuadded = true;
}
}
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: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Expected O, but got Unknown
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Expected O, but got Unknown
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
//IL_0036: 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_0048: Expected O, but got Unknown
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Expected O, but got Unknown
//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: Expected O, but got Unknown
//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: Expected O, but got Unknown
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Expected O, but got Unknown
//IL_007e: 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: Expected O, but got Unknown
//IL_008a: 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_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Expected O, but got Unknown
//IL_00a8: 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_00b4: Expected O, but got Unknown
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Expected O, but got Unknown
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Expected O, but got Unknown
//IL_00d3: 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_00df: Expected O, but got Unknown
//IL_00df: 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_00f1: Expected O, but got Unknown
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Expected O, but got Unknown
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Expected O, but got Unknown
//IL_010a: 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_011c: Expected O, but got Unknown
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Expected O, but got Unknown
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_01d8: 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)
//IL_0250: Unknown result type (might be due to invalid IL or missing references)
//IL_028d: Unknown result type (might be due to invalid IL or missing references)
//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
//IL_0307: Unknown result type (might be due to invalid IL or missing references)
TextDataBlock val = new TextDataBlock();
((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).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).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).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).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).internalEnabled = true;
val11.SkipLocalization = true;
((GameDataBlockBase<TextDataBlock>)val11).name = "zombtext6";
val11.English = "All Bots";
TextDataBlock val12 = val11;
TextDataBlock val13 = new TextDataBlock();
((GameDataBlockBase<TextDataBlock>)val13).internalEnabled = true;
val13.SkipLocalization = true;
((GameDataBlockBase<TextDataBlock>)val13).name = "zombtext7";
val13.English = "AllBots toggle sentry mode";
TextDataBlock val14 = val13;
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(val12, -1);
GameDataBlockBase<TextDataBlock>.AddBlock(val14, -1);
GameDataTextLocalizationService val15 = ((Il2CppObjectBase)Text.TextLocalizationService).TryCast<GameDataTextLocalizationService>();
if (!val15.m_texts.ContainsKey(GameDataBlockBase<TextDataBlock>.GetBlockID("zombtext1")))
{
val15.m_texts.Add(GameDataBlockBase<TextDataBlock>.GetBlockID("zombtext1"), val2.GetText(val15.CurrentLanguage, false));
}
if (!val15.m_texts.ContainsKey(GameDataBlockBase<TextDataBlock>.GetBlockID("zombtext2")))
{
val15.m_texts.Add(GameDataBlockBase<TextDataBlock>.GetBlockID("zombtext2"), val4.GetText(val15.CurrentLanguage, false));
}
if (!val15.m_texts.ContainsKey(GameDataBlockBase<TextDataBlock>.GetBlockID("zombtext3")))
{
val15.m_texts.Add(GameDataBlockBase<TextDataBlock>.GetBlockID("zombtext3"), val6.GetText(val15.CurrentLanguage, false));
}
if (!val15.m_texts.ContainsKey(GameDataBlockBase<TextDataBlock>.GetBlockID("zombtext4")))
{
val15.m_texts.Add(GameDataBlockBase<TextDataBlock>.GetBlockID("zombtext4"), val8.GetText(val15.CurrentLanguage, false));
}
if (!val15.m_texts.ContainsKey(GameDataBlockBase<TextDataBlock>.GetBlockID("zombtext5")))
{
val15.m_texts.Add(GameDataBlockBase<TextDataBlock>.GetBlockID("zombtext5"), val10.GetText(val15.CurrentLanguage, false));
}
if (!val15.m_texts.ContainsKey(GameDataBlockBase<TextDataBlock>.GetBlockID("zombtext6")))
{
val15.m_texts.Add(GameDataBlockBase<TextDataBlock>.GetBlockID("zombtext6"), val12.GetText(val15.CurrentLanguage, false));
}
if (!val15.m_texts.ContainsKey(GameDataBlockBase<TextDataBlock>.GetBlockID("zombtext7")))
{
val15.m_texts.Add(GameDataBlockBase<TextDataBlock>.GetBlockID("zombtext7"), val14.GetText(val15.CurrentLanguage, false));
}
}
public void Initialize()
{
if (SNet.IsMaster)
{
return;
}
foreach (KeyValuePair<string, PlayerAIBot> item in ZombifiedInitiative.BotTable)
{
((Component)item.Value).gameObject.AddComponent<ZombieComp>().Initialize();
}
}
private void Update()
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Invalid comparison between Unknown and I4
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Invalid comparison between Unknown and I4
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Invalid comparison between Unknown and I4
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Invalid comparison between Unknown and I4
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Invalid comparison between Unknown and I4
//IL_016a: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Invalid comparison between Unknown and I4
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Invalid comparison between Unknown and I4
//IL_018e: Unknown result type (might be due to invalid IL or missing references)
//IL_0194: Invalid comparison between Unknown and I4
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Invalid comparison between Unknown and I4
//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
//IL_01b8: Invalid comparison between Unknown and I4
//IL_0196: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: Invalid comparison between Unknown and I4
//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
//IL_01df: Invalid comparison between Unknown and I4
//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
//IL_01c1: Invalid comparison between Unknown and I4
//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
//IL_01e8: Invalid comparison between Unknown and I4
if (Input.GetKeyDown((KeyCode)108) && ((int)FocusStateManager.CurrentState == 4 || (int)FocusStateManager.CurrentState == 12))
{
SwitchDebug();
}
if (Input.GetKeyDown((KeyCode)106) && ((int)FocusStateManager.CurrentState == 4 || (int)FocusStateManager.CurrentState == 12))
{
if (SNet.IsMaster)
{
foreach (KeyValuePair<string, PlayerAIBot> item in ZombifiedInitiative.BotTable)
{
((Component)item.Value).GetComponent<ZombieComp>().allowedpickups = !((Component)item.Value).GetComponent<ZombieComp>().allowedpickups;
}
}
if (!SNet.IsMaster)
{
NetworkAPI.InvokeEvent<ZombifiedInitiative.ZINetInfo>("ZINetInfo", new ZombifiedInitiative.ZINetInfo(2, 8, 0, 0, 0), (SNet_ChannelType)2);
}
Print("Automatic resource pickups toggled for all bots");
}
if (Input.GetKeyDown((KeyCode)107) && ((int)FocusStateManager.CurrentState == 4 || (int)FocusStateManager.CurrentState == 12))
{
if (SNet.IsMaster)
{
foreach (KeyValuePair<string, PlayerAIBot> item2 in ZombifiedInitiative.BotTable)
{
((Component)item2.Value).GetComponent<ZombieComp>().allowedshare = !((Component)item2.Value).GetComponent<ZombieComp>().allowedshare;
}
}
if (!SNet.IsMaster)
{
NetworkAPI.InvokeEvent<ZombifiedInitiative.ZINetInfo>("ZINetInfo", new ZombifiedInitiative.ZINetInfo(1, 8, 0, 0, 0), (SNet_ChannelType)2);
}
Print("Automatic resource uses toggled for all bots");
}
if (Input.GetKey((KeyCode)56) && ((int)FocusStateManager.CurrentState == 4 || (int)FocusStateManager.CurrentState == 12))
{
SendBot("Dauda");
}
if (Input.GetKey((KeyCode)57) && ((int)FocusStateManager.CurrentState == 4 || (int)FocusStateManager.CurrentState == 12))
{
SendBot("Hackett");
}
if (Input.GetKey((KeyCode)48) && ((int)FocusStateManager.CurrentState == 4 || (int)FocusStateManager.CurrentState == 12))
{
SendBot("Bishop");
}
if (Input.GetKey((KeyCode)287) && ((int)FocusStateManager.CurrentState == 4 || (int)FocusStateManager.CurrentState == 12))
{
SendBot("Woods");
}
static void SendBot(string bot)
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Invalid comparison between Unknown and I4
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Invalid comparison between Unknown and I4
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Invalid comparison between Unknown and I4
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Invalid comparison between Unknown and I4
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) && ((int)FocusStateManager.CurrentState == 4 || (int)FocusStateManager.CurrentState == 12))
{
ItemInLevel itemUnderPlayerAim = GetItemUnderPlayerAim();
if ((Object)(object)itemUnderPlayerAim != (Object)null)
{
SendBotToPickupItem(bot, itemUnderPlayerAim);
}
}
if (Input.GetKeyDown((KeyCode)105) && ((int)FocusStateManager.CurrentState == 4 || (int)FocusStateManager.CurrentState == 12))
{
SendBotToShareResourcePack(bot, GetHumanUnderPlayerAim());
}
}
}
public static void AddZombifiedMenu()
{
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Expected O, but got Unknown
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Expected O, but got Unknown
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Expected O, but got Unknown
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Expected O, but got Unknown
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Expected O, but got Unknown
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Expected O, but got Unknown
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: 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");
uint blockID6 = GameDataBlockBase<TextDataBlock>.GetBlockID("zombtext6");
uint blockID7 = GameDataBlockBase<TextDataBlock>.GetBlockID("zombtext7");
CommunicationNode val = new CommunicationNode(blockID6, (ScriptType)0, (List<CommunicationNode>)null, (Sprite)null);
val.IsLastNode = false;
val.TextId = blockID6;
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.Add(new CommunicationNode(blockID7, (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;
val.m_ChildNodes[4].DialogID = 314u;
CommunicationNode val2 = new CommunicationNode(blockID, (ScriptType)0, (List<CommunicationNode>)null, (Sprite)null);
val2.IsLastNode = false;
val2.TextId = blockID;
val2.m_ChildNodes.Add(val);
ZombifiedInitiative._menu.m_menu.CurrentNode.ChildNodes[5].m_ChildNodes.Add(val2);
}
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_0085: 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, 0, val.m_playerAgent.PlayerSlotIndex, 0, 0, enemy.m_replicator.Key + 1);
}
}
public static ItemInLevel GetItemUnderPlayerAim()
{
return GetComponentUnderPlayerAim((ItemInLevel item) => "Found item: " + ((Item)item).PublicName);
}
public static void SendBotToPickupItem(string chosenBot, ItemInLevel item)
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Invalid comparison between Unknown and I4
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Invalid comparison between Unknown and I4
//IL_0053: 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: Invalid comparison between Unknown and I4
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: 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_00a2: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Expected O, but got Unknown
int itemtype = 0;
int itemserial = 0;
PlayerAIBot val = ZombifiedInitiative.BotTable[chosenBot];
if (!((Object)(object)val == (Object)null))
{
ResourcePackPickup val2 = ((Il2CppObjectBase)item).TryCast<ResourcePackPickup>();
if ((Object)(object)val2 != (Object)null && (int)val2.m_packType == 1)
{
itemtype = 1;
}
if ((Object)(object)val2 != (Object)null && (int)val2.m_packType == 2)
{
itemtype = 2;
}
if ((Object)(object)val2 != (Object)null && (int)val2.m_packType == 0)
{
itemtype = 3;
}
if ((Object)(object)val2 != (Object)null && (int)val2.m_packType == 9)
{
itemtype = 4;
}
if ((Object)(object)val2 != (Object)null)
{
itemserial = val2.m_serialNumber;
}
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, 3, val.m_playerAgent.PlayerSlotIndex, itemtype, itemserial, 0);
}
}
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_00b2: 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, 4, val.m_playerAgent.PlayerSlotIndex, 0, 0, ((Agent)human).m_replicator.Key + 1);
}
}
}
public static void ExecuteBotAction(PlayerAIBot bot, Descriptor descriptor, string message, int func, int slot, int itemtype, int itemserial, int agentid)
{
if (SNet.IsMaster)
{
bot.StartAction(descriptor);
Print(message);
}
if (!SNet.IsMaster)
{
NetworkAPI.InvokeEvent<ZombifiedInitiative.ZINetInfo>("ZINetInfo", new ZombifiedInitiative.ZINetInfo(func, slot, itemtype, itemserial, agentid), (SNet_ChannelType)2);
}
}
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);
}
}
}
}