using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using PEAKUnlimited;
using PEAKUnlimited.Patches;
using Photon.Pun;
using Photon.Realtime;
using PvPEAK.GameObjects;
using PvPEAK.Model;
using PvPEAK.Patches;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using Zorro.Core;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("com.github.HuFlungDu.PvPEAK")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0+8f8d26912eb326090f03f33c4102b249d50328f7")]
[assembly: AssemblyProduct("com.github.HuFlungDu.PvPEAK")]
[assembly: AssemblyTitle("PvPEAK")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
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;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace BepInEx
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class BepInAutoPluginAttribute : Attribute
{
public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace BepInEx.Preloader.Core.Patching
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class PatcherAutoPluginAttribute : Attribute
{
public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace PvPEAK
{
public class ConfigurationHandler
{
private ConfigFile _config;
public ConfigEntry<int> ConfigItemSafeDistance;
public InputAction MenuAction { get; set; }
public int ItemSafeDistance => ConfigItemSafeDistance.Value;
public ConfigurationHandler(ConfigFile configFile)
{
_config = configFile;
Plugin.Logger.LogInfo((object)"ConfigurationHandler initialising");
ConfigItemSafeDistance = _config.Bind<int>("General", "Item Safe Distance", 15, "The maximum distance you must be from a campfire to steal another team's items, in world units.");
Plugin.Logger.LogInfo((object)("ConfigurationHandler: Item Safe Distance Loaded: " + ConfigItemSafeDistance.Value));
Plugin.Logger.LogInfo((object)"ConfigurationHandler initialised");
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.github.HuFlungDu.PvPEAK", "PvPEAK", "1.1.0")]
public class Plugin : BaseUnityPlugin
{
internal static ManualLogSource Logger;
public static ConfigurationHandler ConfigurationHandler;
private readonly Harmony _harmony = new Harmony("com.github.HuFlungDu.PvPEAK");
public static List<Campfire> CampfireList = new List<Campfire>();
public static List<RespawnChest> StatueList = new List<RespawnChest>();
public static bool IsAfterAwake = false;
public static ItemTracker itemTracker = new ItemTracker();
public static TeamTracker teamTracker = new TeamTracker();
public static Team? touchedStatueTeam = null;
public static Dictionary<Campfire, List<Backpack>> campfireBackpackMapping = new Dictionary<Campfire, List<Backpack>>();
public static Dictionary<Campfire, List<Item>> campfireFoodMapping = new Dictionary<Campfire, List<Item>>();
public static TMP_FontAsset fontAsset = null;
public static Dictionary<Character, float> deathMapping = new Dictionary<Character, float>();
public static Team? winningTeam = null;
public static bool ItsPvPEAK = false;
public static Dictionary<string, Player> player_mapping = new Dictionary<string, Player>();
public static bool leavingLobby = false;
public static bool CheatsEnabled = false;
public static InputAction _toggleCheatsAction;
public const string Id = "com.github.HuFlungDu.PvPEAK";
public static string Name => "PvPEAK";
public static string Version => "1.1.0";
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
Logger.LogInfo((object)"Plugin com.github.HuFlungDu.PvPEAK is loaded!");
ConfigurationHandler = new ConfigurationHandler(((BaseUnityPlugin)this).Config);
_harmony.PatchAll(typeof(CampfireAwakePatch));
_harmony.PatchAll(typeof(OnPlayerLeftRoomPatch));
_harmony.PatchAll(typeof(OnPlayerEnteredRoomPatch));
Logger.LogInfo((object)"Marshmallow patches successful!");
_harmony.PatchAll(typeof(PlayerConnectionLogPatch));
_harmony.PatchAll(typeof(InitializationPatch));
_harmony.PatchAll(typeof(LeaveLobbyPatch));
Logger.LogInfo((object)"Player connection log patches successful!");
_harmony.PatchAll(typeof(SingleItemSpawnerTrySpawnItemsPatch));
_harmony.PatchAll(typeof(StartGamePatch));
_harmony.PatchAll(typeof(PlayerAddItemPatch));
_harmony.PatchAll(typeof(ItemInteractablePatch));
_harmony.PatchAll(typeof(ItemInteractPatch));
_harmony.PatchAll(typeof(NetworkingPatch));
_harmony.PatchAll(typeof(StatuePatch));
_harmony.PatchAll(typeof(CampfireZonePatch));
_harmony.PatchAll(typeof(RopePatch));
_harmony.PatchAll(typeof(EndGamePatch));
_harmony.PatchAll(typeof(MassAfflictionPatch));
_harmony.PatchAll(typeof(ProgressPatch));
_harmony.PatchAll(typeof(ScoutmasterPatch));
_harmony.PatchAll(typeof(MoraleBoostPatch));
Utility.CreateLocalization();
Logger.LogInfo((object)"PvPeak patches successful!");
Chainloader.PluginInfos.TryGetValue("PEAKUnlimited", out var value);
if (value != null)
{
Logger.LogInfo((object)$"PEAKUnlimited found: {value}. Patching for compatibility.");
_harmony.PatchAll(typeof(PeakUnlimitedCompatPatch));
}
else
{
Logger.LogInfo((object)"PEAKUnlimited not found; not patching");
}
}
public static void ToggleCheats()
{
CheatsEnabled = !CheatsEnabled;
}
public static void Reset()
{
campfireBackpackMapping.Clear();
campfireFoodMapping.Clear();
CampfireList.Clear();
IsAfterAwake = false;
itemTracker = new ItemTracker();
teamTracker = new TeamTracker();
touchedStatueTeam = null;
deathMapping.Clear();
winningTeam = null;
}
}
public enum CampfireFoods
{
Marshmallow = 46,
Glizzy = 154
}
public static class Utility
{
public static List<Vector3> GetEvenlySpacedPointsAroundCampfire(int numPoints, float innerRadius, float outerRadius, Vector3 campfirePosition, Vector3 campfireAngles, Segment advanceToSegment)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
List<Vector3> list = new List<Vector3>();
Quaternion val = Quaternion.Euler(campfireAngles);
Vector3 val2 = default(Vector3);
for (int i = 0; i < numPoints; i++)
{
float num = outerRadius;
if (i % 2 == 0)
{
num = innerRadius;
}
float num2 = (float)i * MathF.PI * 2f / (float)numPoints;
float num3 = num * Mathf.Cos(num2);
float num4 = num * Mathf.Sin(num2);
((Vector3)(ref val2))..ctor(num3, 0f, num4);
Vector3 val3 = val * val2;
Vector3 val4 = campfirePosition + val3;
val4.y += -0.05f;
Vector3 val5 = SetToGround(val4);
if (Vector3.Distance(val4, val5) <= 1f)
{
val4 = val5;
}
list.Add(val4);
}
return list;
}
public static List<Item> SpawnMarshmallows(int number, Vector3 campfirePosition, Vector3 campfireAngles, Segment advanceToSegment)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: 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_0026: 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_0071: 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_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: 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_0081: 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_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: 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_00bc: Unknown result type (might be due to invalid IL or missing references)
List<Item> list = new List<Item>();
foreach (Vector3 item in GetEvenlySpacedPointsAroundCampfire(number, 2f, 2.5f, campfirePosition, campfireAngles, advanceToSegment))
{
float num = Random.Range(0f, 1f);
CampfireFoods campfireFoods = ((!(num < 0.5f)) ? CampfireFoods.Marshmallow : CampfireFoods.Glizzy);
ushort key = (ushort)campfireFoods;
Item val = SingletonAsset<ItemDatabase>.Instance.itemLookup[key];
val.GetName();
Vector3 val2 = campfirePosition - item;
Vector3 normalized = ((Vector3)(ref val2)).normalized;
Quaternion val3 = Quaternion.LookRotation(normalized, Vector3.up);
val3 *= Quaternion.Euler(0f, Random.Range(-30f, -150f), 0f);
list.Add(Add(val, item, val3));
}
return list;
}
public static List<Backpack> SpawnBackpacks(int number, Vector3 campfirePosition, Vector3 campfireAngles, Segment advanceToSegment, Vector3? offset = null)
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
if (!offset.HasValue)
{
offset = Vector3.zero;
}
List<Backpack> list = new List<Backpack>();
Item item = SingletonAsset<ItemDatabase>.Instance.itemLookup[6];
foreach (Vector3 item2 in GetEvenlySpacedPointsAroundCampfire(number, 3.3f, 3.7f, campfirePosition, campfireAngles, advanceToSegment))
{
Vector3 position = item2 + offset.Value;
Quaternion rotation = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f);
Item val = Add(item, position, rotation);
list.Add((Backpack)(object)((val is Backpack) ? val : null));
}
return list;
}
private static Vector3 SetToGround(Vector3 vector)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
return HelperFunctions.GetGroundPos(vector, (LayerType)1, 0f);
}
public static Item Add(Item item, Vector3 position, Quaternion rotation)
{
//IL_0019: 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_0030: Unknown result type (might be due to invalid IL or missing references)
if (!PhotonNetwork.IsConnected)
{
return null;
}
Plugin.Logger.LogInfo((object)$"Spawn item: {((Object)item).name} at {position}");
return PhotonNetwork.InstantiateItemRoom(((Object)item).name, position, rotation).GetComponent<Item>();
}
public static float DistanceToCampfire(Vector3 position, out Campfire nearest)
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
float num = float.PositiveInfinity;
nearest = null;
foreach (Campfire campfire in Plugin.CampfireList)
{
if ((Object)(object)campfire != (Object)null)
{
float num2 = Vector3.Distance(position, ((Component)campfire).transform.position);
if (num2 < num)
{
num = num2;
nearest = campfire;
}
}
}
return num;
}
public static float DistanceToSatue(Vector3 position, out RespawnChest nearest)
{
//IL_001e: 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)
float num = float.PositiveInfinity;
nearest = null;
foreach (RespawnChest statue in Plugin.StatueList)
{
float num2 = Vector3.Distance(position, ((Component)statue).transform.position);
if (num2 < num)
{
num = num2;
nearest = statue;
}
}
return num;
}
public static bool ItemIsInSafeZone(Item item)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
Campfire nearest;
return DistanceToCampfire(item.Center(), out nearest) <= (float)Plugin.ConfigurationHandler.ItemSafeDistance;
}
public static void AddCampfireSpawners(Campfire __instance)
{
Plugin.Logger.LogInfo((object)"Backpackification enabled and starting!");
((Component)__instance).gameObject.AddComponent<CampfireBackpackSpawner>();
((Component)__instance).gameObject.AddComponent<CampfireFoodSpawner>();
}
public static void CreateLocalization()
{
LocalizedText.mainTable["CUT"] = new List<string>(15)
{
"cut", "couper", "taglio", "schneiden", "cortar", "cortar", "corte", "резать", "вирізати", "切",
"切", "カット", "자르다", "cięcie", "kesmek"
};
LocalizedText.mainTable["PVPEAK_GATHERYOURPARTY"] = new List<string>(15)
{
"Gather your party before adventuring forth", "Rassemblez votre groupe avant de partir à l'aventure", "Radunate il vostro gruppo prima di partire all'avventura", "Stellt eure Gruppe zusammen, bevor ihr euch auf das Abenteuer begebt", "Reúne a tu grupo antes de emprender la aventura", "Reúne a tu grupo antes de emprender la aventura", "Reúna seu grupo antes de partir para a aventura", "Соберите свою команду, прежде чем отправиться в приключение", "Зберіть свою групу, перш ніж вирушати в пригоди", "出发冒险之前,请先召集好你的队伍",
"在出發冒險之前,請先召集好你的隊伍", "冒険に出かける前に、仲間を集めましょう", "모험을 떠나기 전에 동료들을 모으세요", "Zbierz swoją drużynę, zanim wyruszysz na przygodę", "Maceraya atılmadan önce ekibinizi toplayın"
};
LocalizedText.mainTable["PVPEAK_SECONDS"] = new List<string>(15)
{
"seconds", "secondes", "secondi", "Sekunden", "segundos", "segundos", "segundos", "секунд", "секунд", "秒",
"秒", "秒お待ちください", "초 후에 다시 시도해 주세요", "sekund", "saniye bekleyin"
};
LocalizedText.mainTable["PVPEAK_DIEDTOORECENTLY"] = new List<string>(15)
{
"died too recently, wait", "est décédé trop récemment, veuillez attendre", "è morto troppo di recente, attendi", "ist erst vor Kurzem gestorben, bitte warten Sie", "falleció hace muy poco, espera", "falleció hace muy poco, espera", "morreu há pouco tempo, espere", "умер совсем недавно, подождите", "помер нещодавно, зачекайте", "去世时间太短,请等待",
"去世時間太短,請等待", "イアはつい最近亡くなったばかりです。", "사망한 지 얼마 되지 않았으니", "zmarł zbyt niedawno, proszę poczekać", "çok kısa süre önce öldü,"
};
}
}
}
namespace PvPEAK.Patches
{
public class CampfireAwakePatch
{
[HarmonyPatch(typeof(Campfire), "Awake")]
[HarmonyPostfix]
private static void Postfix(Campfire __instance)
{
if (__instance.nameOverride == "NAME_PORTABLE STOVE")
{
return;
}
Plugin.CampfireList.Add(__instance);
Plugin.IsAfterAwake = true;
if (Plugin.ItsPvPEAK)
{
if (PhotonNetwork.IsMasterClient && ((Object)((Component)((Component)__instance).gameObject.transform.parent).gameObject).name.ToLower().Contains("wings"))
{
SpawnBeachItems(__instance);
}
else
{
Utility.AddCampfireSpawners(__instance);
}
}
}
private static void SpawnBeachItems(Campfire campfire)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: Unknown result type (might be due to invalid IL or missing references)
int count = Plugin.teamTracker.Count;
Plugin.campfireBackpackMapping[campfire] = new List<Backpack>();
Item val = null;
List<Backpack> list = Utility.SpawnBackpacks(count, ((Component)campfire).gameObject.transform.position, ((Component)campfire).gameObject.transform.eulerAngles, campfire.advanceToSegment, (Vector3?)new Vector3(0f, 10f, 0f));
int num = 0;
foreach (KeyValuePair<Color, Team> team in Plugin.teamTracker.teams)
{
Backpack item = list[num];
Plugin.itemTracker.SetItemToTeam((Item)(object)item, team.Value);
num++;
}
if (!((Object)(object)val != (Object)null))
{
return;
}
foreach (Vector3 item2 in Utility.GetEvenlySpacedPointsAroundCampfire(count, 4f, 4f, ((Component)campfire).gameObject.transform.position, ((Component)campfire).gameObject.transform.eulerAngles, campfire.advanceToSegment))
{
Vector3 position = item2 + new Vector3(0f, 10f, 0f);
Quaternion rotation = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f);
Item val2 = Utility.Add(val, position, rotation);
}
}
}
public class CampfireZonePatch
{
[HarmonyPatch(typeof(CharacterAfflictions), "AddStatus")]
[HarmonyPrefix]
private static bool AddStatusPrefix(CharacterAfflictions __instance, STATUSTYPE statusType, float amount, bool fromRPC = false, bool playEffects = true)
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
if (!Plugin.ItsPvPEAK)
{
return true;
}
if (!Plugin.IsAfterAwake)
{
return true;
}
Character character = __instance.character;
Team playerTeam = Plugin.teamTracker.GetPlayerTeam(character.player);
if (playerTeam == null)
{
return true;
}
Campfire nearest;
float num = Utility.DistanceToCampfire(character.Center, out nearest);
if (num > 15f || (int)nearest.state != 0)
{
return true;
}
foreach (string player in playerTeam.players)
{
Player val = null;
foreach (KeyValuePair<int, Player> player2 in PhotonNetwork.CurrentRoom.Players)
{
if (player2.Value.UserId == player)
{
val = player2.Value;
break;
}
}
if (val != null)
{
Character playerCharacter = PlayerHandler.GetPlayerCharacter(val);
Campfire nearest2;
float num2 = Utility.DistanceToCampfire(playerCharacter.Center, out nearest2);
if (num2 > 15f || (Object)(object)nearest2 != (Object)(object)nearest)
{
return true;
}
}
}
return false;
}
[HarmonyPatch(typeof(Campfire), "Light_Rpc")]
[HarmonyPostfix]
private static void LightRPCPostfix(Campfire __instance)
{
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
if (!Plugin.ItsPvPEAK || !PhotonNetwork.IsMasterClient)
{
return;
}
foreach (Character allCharacter in Character.AllCharacters)
{
if (allCharacter.data.dead || allCharacter.data.fullyPassedOut)
{
((MonoBehaviourPun)allCharacter).photonView.RPC("RPCA_ReviveAtPosition", (RpcTarget)0, new object[2]
{
((Component)__instance).transform.position + ((Component)__instance).transform.up * 8f,
true
});
}
}
}
}
internal class EndGamePatch
{
private static bool TeamAtPeak(Character character, out List<Character> missingMembers)
{
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
missingMembers = new List<Character>();
Team playerTeam = Plugin.teamTracker.GetPlayerTeam(character.player);
if (playerTeam != null)
{
foreach (string player in playerTeam.players)
{
Player val = null;
foreach (KeyValuePair<int, Player> player2 in PhotonNetwork.CurrentRoom.Players)
{
if (player2.Value.UserId == player)
{
val = player2.Value;
break;
}
}
if (val != null)
{
Character playerCharacter = PlayerHandler.GetPlayerCharacter(val);
if (!((MonoBehaviourPun)playerCharacter).photonView.Owner.IsInactive && !playerCharacter.data.dead && !Singleton<MountainProgressHandler>.Instance.IsAtPeak(playerCharacter.Center))
{
missingMembers.Add(playerCharacter);
}
if (playerCharacter.data.dead && Plugin.deathMapping.ContainsKey(playerCharacter) && Time.time - Plugin.deathMapping[playerCharacter] < 60f)
{
missingMembers.Add(playerCharacter);
}
}
}
}
return missingMembers.Count == 0;
}
[HarmonyPatch(typeof(Flare), "TriggerHelicopter")]
[HarmonyPostfix]
private static void FlareTriggerHelicopterPostfix(Flare __instance)
{
if (!Plugin.ItsPvPEAK)
{
return;
}
Character holderCharacter = ((ItemComponent)__instance).item.holderCharacter;
if (Object.op_Implicit((Object)(object)holderCharacter))
{
Team playerTeam = Plugin.teamTracker.GetPlayerTeam(holderCharacter.player);
if (playerTeam != null)
{
Plugin.winningTeam = playerTeam;
}
}
}
[HarmonyPatch(typeof(Item), "CanUsePrimary")]
[HarmonyPrefix]
private static bool ItemCanUsePrimaryPrefix(ref bool __result, Item __instance)
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
if (!Plugin.ItsPvPEAK)
{
return true;
}
Character holderCharacter = __instance.holderCharacter;
if (!Object.op_Implicit((Object)(object)holderCharacter))
{
return true;
}
Flare component = ((Component)__instance).gameObject.GetComponent<Flare>();
if ((Object)(object)component == (Object)null)
{
return true;
}
if (Singleton<MountainProgressHandler>.Instance.IsAtPeak(holderCharacter.Center) && !Singleton<PeakHandler>.Instance.summonedHelicopter && !TeamAtPeak(holderCharacter, out List<Character> _))
{
__result = false;
return false;
}
return true;
}
[HarmonyPatch(typeof(Flare), "Update")]
[HarmonyPrefix]
private static bool FlareUpdatePrefix(Flare __instance)
{
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Invalid comparison between Unknown and I4
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_016d: Unknown result type (might be due to invalid IL or missing references)
if (!Plugin.ItsPvPEAK)
{
return true;
}
Character holderCharacter = ((ItemComponent)__instance).item.holderCharacter;
if (!Object.op_Implicit((Object)(object)holderCharacter))
{
return true;
}
if ((Object)(object)holderCharacter != (Object)(object)Character.localCharacter)
{
return true;
}
if ((int)((ItemComponent)__instance).item.itemState == 1 && Singleton<MountainProgressHandler>.Instance.IsAtPeak(holderCharacter.Center) && !Singleton<PeakHandler>.Instance.summonedHelicopter && !TeamAtPeak(holderCharacter, out List<Character> missingMembers))
{
string text = LocalizedText.GetText("PVPEAK_GATHERYOURPARTY", false);
if (text == "")
{
text = "Gather your party before adventuring forth";
}
string text2 = LocalizedText.GetText("PVPEAK_DIEDTOORECENTLY", false);
if (text2 == "")
{
text2 = "died too recently, wait";
}
string text3 = LocalizedText.GetText("PVPEAK_SECONDS", false);
if (text3 == "")
{
text3 = "seconds";
}
foreach (Character item in missingMembers)
{
if (Plugin.deathMapping.ContainsKey(item) && Time.time - Plugin.deathMapping[item] < 60f)
{
text += $"\n{((MonoBehaviourPun)item).photonView.Owner.NickName} {text2} {60 - Mathf.RoundToInt(Time.time - Plugin.deathMapping[item])} {text3}";
}
else
{
float num = Vector3.Distance(holderCharacter.Center, item.Center);
text += $"\n{((MonoBehaviourPun)item).photonView.Owner.NickName} {Mathf.RoundToInt(num * CharacterStats.unitsToMeters)}m";
}
}
NotificationsHandler.SetNotification(text, 0.5f);
}
return true;
}
[HarmonyPatch(typeof(Character), "RPCA_Die")]
[HarmonyPostfix]
private static void CharacterRPCA_DiePostfix(Character __instance, Vector3 itemSpawnPoint)
{
if (Plugin.ItsPvPEAK)
{
Plugin.deathMapping[__instance] = Time.time;
}
}
[HarmonyPatch(typeof(Character), "CheckWinCondition")]
[HarmonyPrefix]
private static bool CheckWinConditionPrefix(ref bool __result, Character c)
{
if (!Plugin.ItsPvPEAK)
{
return true;
}
if (Plugin.winningTeam == null)
{
return true;
}
if (!Plugin.winningTeam.HasPlayer(((MonoBehaviourPun)c.player).photonView.Owner))
{
__result = false;
return false;
}
return true;
}
[HarmonyPatch(typeof(PeakSequence), "Start")]
[HarmonyPrefix]
private static bool PeakSequenceStartPrefix(PeakSequence __instance)
{
if (!Plugin.ItsPvPEAK)
{
return true;
}
__instance.totalSeconds = __instance.totalWinningSeconds;
return true;
}
}
public class InitializationPatch
{
private static GameObject PvPEAKButton;
[HarmonyPatch(typeof(MainMenuMainPage), "PlayClicked")]
[HarmonyPostfix]
private static void Postfix(MainMenuMainPage __instance)
{
Plugin.Logger.LogInfo((object)"Play clicked, this player is the lobby host!");
}
[HarmonyPatch(typeof(AirportCheckInKiosk), "Awake")]
[HarmonyPostfix]
private static void AirportLoadPostfix()
{
Plugin.Reset();
}
[HarmonyPatch(typeof(MainMenuMainPage), "Start")]
[HarmonyPostfix]
private static void StartPostfix(MainMenuMainPage __instance)
{
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: 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_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: Unknown result type (might be due to invalid IL or missing references)
//IL_0178: Unknown result type (might be due to invalid IL or missing references)
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
//IL_020b: Unknown result type (might be due to invalid IL or missing references)
//IL_0215: Expected O, but got Unknown
MainMenuMainPage __instance2 = __instance;
Plugin.ItsPvPEAK = false;
Plugin.leavingLobby = false;
CanvasGroup component = ((Component)__instance2).GetComponent<CanvasGroup>();
GameObject gameObject = ((Component)((Component)__instance2).transform.Find("Menu/Buttons")).gameObject;
GameObject gameObject2 = ((Component)gameObject.transform.Find("Button_PlayWithFriends")).gameObject;
PvPEAKButton = Object.Instantiate<GameObject>(gameObject2, gameObject.transform);
((Object)PvPEAKButton).name = "Button_PvPEAK";
Transform transform = PvPEAKButton.transform;
RectTransform val = (RectTransform)(object)((transform is RectTransform) ? transform : null);
Transform transform2 = PvPEAKButton.transform;
Vector3 position = transform2.position;
Vector2 sizeDelta = val.sizeDelta;
float num = ((Vector2)(ref sizeDelta))[1];
Vector3 lossyScale = gameObject.transform.lossyScale;
transform2.position = position + new Vector3(0f, num * ((Vector3)(ref lossyScale))[1], 0f);
GameObject gameObject3 = ((Component)PvPEAKButton.transform.Find("Hinge")).gameObject;
GameObject gameObject4 = ((Component)gameObject3.transform.Find("Text")).gameObject;
GameObject gameObject5 = ((Component)gameObject3.transform.Find("Icons")).gameObject;
gameObject4.GetComponent<LocalizedText>().SetText("Host PvPEAK");
foreach (Image item in ((Component)gameObject5.transform).GetComponentsInChildren<Image>().Skip(2))
{
Transform transform3 = ((Component)item).transform;
transform3.localEulerAngles += new Vector3(0f, 180f, 0f);
}
RectTransform component2 = PvPEAKButton.GetComponent<RectTransform>();
((Transform)component2).eulerAngles = new Vector3(0f, 0f, 0f);
component2 = gameObject3.GetComponent<RectTransform>();
component2.offsetMax = new Vector2(-80f, 0f);
component2.offsetMin = new Vector2(30f, 0f);
((UnityEvent)PvPEAKButton.GetComponent<Button>().onClick).AddListener((UnityAction)delegate
{
PvPEAKClicked(__instance2);
});
}
private static void PvPEAKClicked(MainMenuMainPage main_menu)
{
Plugin.ItsPvPEAK = true;
main_menu.PlayClicked();
}
[HarmonyPatch(typeof(MainMenuMainPage), "Update")]
[HarmonyPostfix]
private static void MainMenuPageUpdatePostfix(MainMenuMainPage __instance)
{
GameObject gameObject = ((Component)PvPEAKButton.transform.Find("Hinge/Text")).gameObject;
gameObject.GetComponent<LocalizedText>().SetText("Host PvPEAK");
}
}
public class ItemInteractablePatch
{
[HarmonyPatch(typeof(Item), "IsInteractible")]
[HarmonyPrefix]
private static bool ItemIsInteractiblePrefix(ref bool __result, Item __instance, Character interactor)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
if (!Plugin.ItsPvPEAK)
{
return true;
}
if (!Plugin.IsAfterAwake)
{
return true;
}
if (!Plugin.itemTracker.ItemIsOwned(__instance) || !Utility.ItemIsInSafeZone(__instance))
{
if ((int)__instance.itemState != 0)
{
__result = false;
return false;
}
return true;
}
Team playerTeam = Plugin.teamTracker.GetPlayerTeam(interactor.player);
if (!Plugin.itemTracker.ItemCanBeGrabbedByTeam(__instance, playerTeam))
{
__result = false;
return false;
}
return true;
}
[HarmonyPatch(typeof(BackpackOnBackVisuals), "IsInteractible")]
[HarmonyPrefix]
private static bool BackpackOnBackVisualsIsIntreactablePrefix(ref bool __result, BackpackOnBackVisuals __instance, Character interactor)
{
if (!Plugin.ItsPvPEAK)
{
return true;
}
if (!Plugin.IsAfterAwake)
{
return true;
}
if (Plugin.teamTracker.GetPlayerTeam(__instance.character.player) != Plugin.teamTracker.GetPlayerTeam(interactor.player))
{
__result = false;
return false;
}
return true;
}
}
public class ItemInteractPatch
{
[HarmonyPatch(typeof(Item), "RequestPickup")]
[HarmonyPrefix]
private static bool RequestPickupPrefix(Item __instance, PhotonView characterView)
{
if (!Plugin.ItsPvPEAK)
{
return true;
}
Character component = ((Component)characterView).GetComponent<Character>();
if (!Plugin.itemTracker.ItemIsOwned(__instance) || !Utility.ItemIsInSafeZone(__instance))
{
return true;
}
Team playerTeam = Plugin.teamTracker.GetPlayerTeam(component.player);
if (!Plugin.itemTracker.ItemCanBeGrabbedByTeam(__instance, playerTeam))
{
__instance.view.RPC("DenyPickupRPC", ((MonoBehaviourPun)component.player).photonView.Owner, Array.Empty<object>());
return false;
}
return true;
}
[HarmonyPatch(typeof(Player), "AddItem")]
[HarmonyPostfix]
private static bool Postfix(bool __response, Player __instance, ushort itemID, ItemInstanceData instanceData, ItemSlot slot)
{
if (!Plugin.ItsPvPEAK)
{
return __response;
}
if (__response && Plugin.IsAfterAwake && instanceData != null)
{
Team playerTeam = Plugin.teamTracker.GetPlayerTeam(__instance);
if (playerTeam == null)
{
return __response;
}
foreach (KeyValuePair<Campfire, List<Backpack>> item in Plugin.campfireBackpackMapping)
{
Backpack val = null;
foreach (Backpack item2 in item.Value)
{
if (((Item)item2).data.guid == instanceData.guid)
{
val = item2;
}
}
if (!((Object)(object)val != (Object)null))
{
continue;
}
item.Value.Remove(val);
foreach (KeyValuePair<Color, Team> team in Plugin.teamTracker.teams)
{
Plugin.itemTracker.RemoveItemFromNotTeam((Item)(object)val, team.Value);
Plugin.itemTracker.RemoveItemFromTeam((Item)(object)val, team.Value);
}
foreach (Backpack item3 in item.Value)
{
Plugin.itemTracker.SetItemToNotTeam((Item)(object)item3, playerTeam);
}
}
}
return __response;
}
[HarmonyPatch(typeof(Backpack), "Interact")]
[HarmonyPrefix]
private static bool BackpackInteractPrefix(Backpack __instance, Character interactor)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
if (!Plugin.ItsPvPEAK)
{
return true;
}
if (!Plugin.itemTracker.ItemIsOwned((Item)(object)__instance) || (!Utility.ItemIsInSafeZone((Item)(object)__instance) && (int)((Item)__instance).itemState == 0))
{
return true;
}
Team playerTeam = Plugin.teamTracker.GetPlayerTeam(interactor.player);
if (!Plugin.itemTracker.ItemCanBeGrabbedByTeam((Item)(object)__instance, playerTeam))
{
return false;
}
return true;
}
}
public class LeaveLobbyPatch
{
[HarmonyPatch(typeof(SteamLobbyHandler), "LeaveLobby")]
[HarmonyPostfix]
private static void Postfix(SteamLobbyHandler __instance)
{
Plugin.Logger.LogInfo((object)"Left Lobby");
Plugin.leavingLobby = true;
Plugin.Reset();
}
}
internal class MassAfflictionPatch
{
[HarmonyPatch(typeof(Action_ApplyMassAffliction), "TryAddAfflictionToLocalCharacter")]
[HarmonyPrefix]
private static bool TryAddAfflictionToLocalCharacterPrefix(Action_ApplyMassAffliction __instance)
{
if (!Plugin.ItsPvPEAK)
{
return true;
}
if (((Object)__instance).name.ToLower().Contains("bugle_magic") && Plugin.teamTracker.GetPlayerTeam(((ItemActionBase)__instance).character.player) != Plugin.teamTracker.GetPlayerTeam(Character.localCharacter.player))
{
return false;
}
return true;
}
}
internal class MoraleBoostPatch
{
[HarmonyPatch(typeof(MoraleBoost), "SpawnMoraleBoost")]
[HarmonyPrefix]
private static bool SpawnMoraleBoostPrefix(ref bool __result, Vector3 origin, float radius, float baselineStaminaBoost, float staminaBoostPerAdditionalScout, bool sendToAll = false, int minScouts = 1)
{
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
if (!Plugin.ItsPvPEAK)
{
return true;
}
__result = false;
foreach (KeyValuePair<Color, Team> team in Plugin.teamTracker.teams)
{
List<Character> list = new List<Character>();
foreach (string player in team.Value.players)
{
if (Plugin.player_mapping.TryGetValue(player, out Player value) && (Object)(object)value.character != (Object)null && (radius == -1f || Vector3.Distance(value.character.Center, origin) <= radius))
{
list.Add(value.character);
}
}
if (list.Count < minScouts)
{
continue;
}
__result = true;
foreach (Character item in list)
{
item.MoraleBoost(baselineStaminaBoost, list.Count);
}
}
return false;
}
}
internal class NetworkingPatch
{
}
public class OnPlayerEnteredRoomPatch
{
[CompilerGenerated]
private sealed class <WarnIfNotPvPEAK>d__1 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public Player newPlayer;
public PlayerConnectionLog log;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <WarnIfNotPvPEAK>d__1(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
//IL_013a: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
Plugin.Logger.LogInfo((object)"Starting kick player");
<>2__current = (object)new WaitForSeconds(3f);
<>1__state = 1;
return true;
case 1:
{
<>1__state = -1;
string pvPEAKVersion = ((Component)Plugin.player_mapping[newPlayer.UserId]).GetComponent<Networking>().PvPEAKVersion;
if (pvPEAKVersion != Plugin.Version)
{
Plugin.Logger.LogInfo((object)"Starting warn player");
if (pvPEAKVersion == null)
{
log.AddMessage(log.GetColorTag(log.leftColor) + " Player " + log.GetColorTag(log.userColor) + " " + newPlayer.NickName + " " + log.GetColorTag(log.leftColor) + " dose not have PvPEAK installed! Behavior will be undefined, things will break.");
}
else
{
log.AddMessage(log.GetColorTag(log.leftColor) + " Player " + log.GetColorTag(log.userColor) + " " + newPlayer.NickName + " " + log.GetColorTag(log.leftColor) + " is using different version of PvPEAK. Your version: " + Plugin.Version + "; Their version: " + pvPEAKVersion + ". Behavior will be undefined, things may break.");
}
}
return false;
}
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[HarmonyPatch(typeof(PlayerConnectionLog), "OnPlayerEnteredRoom")]
[HarmonyPostfix]
private static void Postfix(PlayerConnectionLog __instance, Player newPlayer)
{
Plugin.Logger.LogInfo((object)"Player Joined");
if (PhotonNetwork.IsMasterClient && Plugin.ItsPvPEAK)
{
((MonoBehaviour)__instance).StartCoroutine(WarnIfNotPvPEAK(newPlayer, __instance));
}
}
[IteratorStateMachine(typeof(<WarnIfNotPvPEAK>d__1))]
private static IEnumerator WarnIfNotPvPEAK(Player newPlayer, PlayerConnectionLog log)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <WarnIfNotPvPEAK>d__1(0)
{
newPlayer = newPlayer,
log = log
};
}
[HarmonyPatch(typeof(Player), "Awake")]
[HarmonyPostfix]
private static void PlayerAwakePostfix(Player __instance)
{
Plugin.player_mapping[__instance.view.Owner.UserId] = __instance;
Networking networking = ((Component)__instance).gameObject.AddComponent<Networking>();
if (PhotonNetwork.IsMasterClient && __instance.view.IsMine)
{
networking.view.RPC("SetItsPvPEAK_RPC", (RpcTarget)3, new object[1] { Plugin.ItsPvPEAK });
}
else if (!PhotonNetwork.IsMasterClient && __instance.view.IsMine)
{
networking.view.RPC("SetPvPEAKVersion_RPC", (RpcTarget)2, new object[2]
{
__instance.view,
Plugin.Version
});
}
if (__instance.view.IsMine)
{
NotificationsHandler.Initialize();
}
}
[HarmonyPatch(typeof(ReconnectHandler), "RegisterPlayer")]
[HarmonyPostfix]
private static void RegisterPlayerPostfix(ReconnectHandler __instance, Player player)
{
Plugin.Logger.LogInfo((object)("Registering player: " + player.view.Owner.UserId));
Plugin.player_mapping[player.view.Owner.UserId] = player;
}
[HarmonyPatch(typeof(CharacterCustomization), "Start")]
[HarmonyPostfix]
private static void CharacterCustomizationStartPostfix(CharacterCustomization __instance)
{
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
if (!Plugin.IsAfterAwake)
{
return;
}
if (__instance.view.IsMine)
{
Plugin.teamTracker.CreateTeams();
}
if (!Plugin.ItsPvPEAK)
{
return;
}
int count = Plugin.teamTracker.Count;
if (!__instance.view.IsMine)
{
Team orCreateTeamByColor = Plugin.teamTracker.GetOrCreateTeamByColor(__instance.PlayerColor);
orCreateTeamByColor.AddPlayer(__instance.view.Owner);
if (PhotonNetwork.IsMasterClient)
{
Plugin.itemTracker.TrySyncItemData(__instance.view.Owner);
}
}
}
}
public class OnPlayerLeftRoomPatch : MonoBehaviour
{
[HarmonyPatch(typeof(ReconnectHandler), "OnPlayerLeftRoom")]
[HarmonyPostfix]
private static void Postfix(ReconnectHandler __instance, Player otherPlayer)
{
if (Plugin.IsAfterAwake)
{
Team playerTeam = Plugin.teamTracker.GetPlayerTeam(otherPlayer);
playerTeam.RemovePlayer(otherPlayer);
if (playerTeam.players.Count == 0)
{
Plugin.teamTracker.RemoveTeam(playerTeam);
}
}
}
[HarmonyPatch(typeof(ReconnectHandler), "OnMasterClientSwitched")]
[HarmonyPostfix]
private static void OnMasterClientSwitchedPostfix(ReconnectHandler __instance, Player newMasterClient)
{
if (PhotonNetwork.IsMasterClient)
{
((Component)Player.localPlayer).GetComponent<Networking>().view.RPC("SetItsPvPEAK_RPC", (RpcTarget)3, new object[1] { Plugin.ItsPvPEAK });
}
}
}
internal class PeakGamingPatch
{
[HarmonyPatch(typeof(CharacterMovement), "Update")]
[HarmonyPrefix]
public static void MovementAndJumpPrefix(CharacterMovement __instance)
{
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Expected O, but got Unknown
if (Plugin.CheatsEnabled)
{
Traverse.Create((object)__instance).Field("sprintMultiplier").SetValue((object)25f);
if (Input.GetKey((KeyCode)32))
{
Character val = (Character)Traverse.Create((object)__instance).Field("character").GetValue();
if (val.IsLocal)
{
val.refs.view.RPC("JumpRpc", (RpcTarget)0, new object[1] { false });
}
}
}
else
{
Traverse.Create((object)__instance).Field("sprintMultiplier").SetValue((object)2f);
}
}
[HarmonyPatch(typeof(CharacterMovement), "FallFactor")]
[HarmonyPostfix]
public static void RagdollPostfix(ref float __result)
{
if (Plugin.CheatsEnabled)
{
__result = 0f;
}
}
[HarmonyPatch(typeof(CharacterClimbing), "GetRequestedPostition")]
[HarmonyPrefix]
public static void ClimbingPrefix(CharacterClimbing __instance)
{
if (Plugin.CheatsEnabled)
{
__instance.climbSpeedMod = 30f;
}
}
[HarmonyPatch(typeof(Character), "GetTotalStamina")]
[HarmonyPrefix]
public static void StaminaPrefix(Character __instance)
{
if (Plugin.CheatsEnabled)
{
__instance.data.currentStamina = 100f;
}
}
[HarmonyPatch(typeof(CharacterMovement), "TryToJump")]
[HarmonyPrefix]
public static bool JumpPrefix()
{
if (Plugin.CheatsEnabled)
{
return false;
}
return true;
}
[HarmonyPatch(typeof(CharacterAfflictions), "Update")]
[HarmonyPrefix]
public static void CharacterAfflictionsUpdatePrefix(CharacterAfflictions __instance)
{
if (Plugin.CheatsEnabled)
{
Traverse.Create((object)__instance.character.data).Field("isInvincible").SetValue((object)true);
}
else
{
Traverse.Create((object)__instance.character.data).Field("isInvincible").SetValue((object)false);
}
}
}
internal class PeakUnlimitedCompatPatch
{
[HarmonyPatch(typeof(CampfireAwakePatch), "AddMarshmallows")]
[HarmonyPrefix]
private static bool AddMarshmallowsPrefix()
{
if (Plugin.ItsPvPEAK)
{
return false;
}
return true;
}
[HarmonyPatch(typeof(CampfireAwakePatch), "AddBackpacks")]
[HarmonyPrefix]
private static bool AddBackpacksPrefix()
{
if (Plugin.ItsPvPEAK)
{
return false;
}
return true;
}
[HarmonyPatch(typeof(Utility), "SpawnMarshmallows")]
[HarmonyPrefix]
private static bool SpawnMarshmallowsPrefix(ref List<GameObject> __result)
{
if (Plugin.ItsPvPEAK)
{
__result = new List<GameObject>();
return false;
}
return true;
}
[HarmonyPatch(typeof(OnPlayerEnteredRoomPatch), "Postfix")]
[HarmonyPrefix]
private static bool OnPlayerEnteredRoomPatchPostfixPrefix()
{
if (Plugin.ItsPvPEAK)
{
return false;
}
return true;
}
[HarmonyPatch(typeof(OnPlayerLeftRoomPatch), "Postfix")]
[HarmonyPrefix]
private static bool OnPlayerLeftRoomPatchPostfixPrefix()
{
if (Plugin.ItsPvPEAK)
{
return false;
}
return true;
}
}
public class PlayerAddItemPatch
{
}
public class PlayerConnectionLogPatch
{
[HarmonyPatch(typeof(PlayerConnectionLog), "Awake")]
[HarmonyPostfix]
private static void Postfix(PlayerConnectionLog __instance)
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)GameObject.Find("AirportGateKiosk") == (Object)null) && Plugin.ItsPvPEAK)
{
__instance.AddMessage(__instance.GetColorTag(__instance.joinedColor) + " It's PvPEAK!");
}
}
}
internal class ProgressPatch
{
[HarmonyPatch(typeof(MovingLava), "PlayersHaveMovedOn")]
[HarmonyPrefix]
private static bool MovingLavaPlayersHaveMovedOnPrefix(ref bool __result, MovingLava __instance)
{
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
if (!Plugin.ItsPvPEAK)
{
return true;
}
if (Character.AllCharacters.Count == 0)
{
return false;
}
__result = false;
float num = 879f;
foreach (KeyValuePair<Color, Team> team in Plugin.teamTracker.teams)
{
bool flag = true;
foreach (string player in team.Value.players)
{
if (Plugin.player_mapping.TryGetValue(player, out Player value) && (Object)(object)value.character != (Object)null)
{
Character character = value.character;
if (character.Center.y < num)
{
flag = false;
break;
}
}
}
__result |= flag;
}
if (__result)
{
Plugin.Logger.LogInfo((object)"Players have moved on");
}
return false;
}
[HarmonyPatch(typeof(Fog), "PlayersHaveMovedOn")]
[HarmonyPrefix]
private static bool FogPlayersHaveMovedOnPrefix(ref bool __result, Fog __instance)
{
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
if (!Plugin.ItsPvPEAK)
{
return true;
}
if (Character.AllCharacters.Count == 0)
{
return true;
}
__result = false;
float num = __instance.StopHeight() + __instance.startMoveHeightThreshold;
foreach (KeyValuePair<Color, Team> team in Plugin.teamTracker.teams)
{
bool flag = true;
foreach (string player in team.Value.players)
{
if (Plugin.player_mapping.TryGetValue(player, out Player value) && (Object)(object)value.character != (Object)null)
{
Character character = value.character;
if (character.Center.y < num)
{
flag = false;
break;
}
}
}
__result |= flag;
}
if (__result)
{
Plugin.Logger.LogInfo((object)"Players have moved on");
}
return false;
}
[HarmonyPatch(typeof(OrbFogHandler), "PlayersHaveMovedOn")]
[HarmonyPrefix]
private static bool OrbFogHandlerPlayersHaveMovedOnPrefix(ref bool __result, OrbFogHandler __instance)
{
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
if (!Plugin.ItsPvPEAK)
{
return true;
}
if (Character.AllCharacters.Count == 0)
{
return true;
}
if (Ascents.currentAscent < 0)
{
return true;
}
__result = false;
foreach (KeyValuePair<Color, Team> team in Plugin.teamTracker.teams)
{
bool flag = true;
bool flag2 = false;
if (team.Value.players.Count == 0)
{
flag = false;
}
foreach (string player in team.Value.players)
{
if (Plugin.player_mapping.TryGetValue(player, out Player value) && (Object)(object)value.character != (Object)null)
{
Character character = value.character;
flag2 = true;
if (character.Center.y < __instance.currentStartHeight || character.Center.z < __instance.currentStartForward)
{
flag = false;
break;
}
}
}
__result |= flag && flag2;
}
if (__result)
{
Plugin.Logger.LogInfo((object)"Players have moved on");
}
return false;
}
}
internal class RopePatch
{
[HarmonyPatch(typeof(RopeSegment), "IsInteractible")]
[HarmonyPrefix]
private static bool RopeSegmentIsInteractiblePrefix(ref bool __result, RopeSegment __instance, Character interactor)
{
if (!Plugin.ItsPvPEAK)
{
return true;
}
if ((Object)(object)((Component)__instance).GetComponent<RopeEnd>() != (Object)null)
{
__result = false;
return false;
}
return true;
}
[HarmonyPatch(typeof(Rope), "AttachToAnchor_Rpc")]
[HarmonyPostfix]
private static void AttachToAnchor_RpcPostfix(Rope __instance, PhotonView anchorView, float ropeLength)
{
}
[HarmonyPatch(typeof(Rope), "Update")]
[HarmonyPostfix]
private static void RopeUpdatePostfix(Rope __instance)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Invalid comparison between Unknown and I4
if (!Plugin.ItsPvPEAK || (int)__instance.attachmenState != 2)
{
return;
}
List<Transform> ropeSegments = __instance.GetRopeSegments();
if (ropeSegments.Count <= 0)
{
return;
}
Transform val = ropeSegments[0];
Transform val2 = ropeSegments[ropeSegments.Count - 1];
if ((Object)(object)((Component)val2).GetComponent<RopeEnd>() == (Object)null)
{
foreach (Transform item in ropeSegments.Skip(1))
{
if ((Object)(object)item != (Object)(object)val2)
{
RopeEnd component = ((Component)item).GetComponent<RopeEnd>();
if ((Object)(object)component != (Object)null)
{
Object.DestroyImmediate((Object)(object)component);
}
}
}
((Component)val2).gameObject.AddComponent<RopeEnd>();
}
if ((Object)(object)((Component)val).GetComponent<RopeEnd>() == (Object)null)
{
((Component)val).gameObject.AddComponent<RopeEnd>();
}
}
[HarmonyPatch(typeof(Rope), "Detach_Rpc")]
[HarmonyPostfix]
private static void Detach_RpcPostfix(Rope __instance, float segmentLength)
{
if (!Plugin.ItsPvPEAK || __instance.view.IsMine || !((Object)(object)__instance.spool == (Object)null))
{
return;
}
int count = __instance.remoteColliderSegments.Count;
if (count > 0)
{
__instance.Clear(true);
for (int i = 0; i < count; i++)
{
__instance.AddSegment();
}
}
}
public static Item GetInteractableItem(Transform transform)
{
Item[] componentsInParent = ((Component)transform).GetComponentsInParent<Item>();
Item[] array = componentsInParent;
foreach (Item val in array)
{
if (val.IsInteractible(Character.localCharacter))
{
return val;
}
}
return null;
}
public static IInteractible GetInteractableIInteractable(Transform transform)
{
IInteractible[] componentsInParent = ((Component)transform).GetComponentsInParent<IInteractible>();
IInteractible[] array = componentsInParent;
foreach (IInteractible val in array)
{
if (val.IsInteractible(Character.localCharacter))
{
return val;
}
}
return null;
}
[HarmonyPatch(typeof(Interaction), "DoInteractableRaycasts")]
[HarmonyTranspiler]
private static IEnumerable<CodeInstruction> DoInteractableRaycastsTranspiler(IEnumerable<CodeInstruction> instructions)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Expected O, but got Unknown
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Expected O, but got Unknown
CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null);
val.Start();
val.MatchStartForward((CodeMatch[])(object)new CodeMatch[1]
{
new CodeMatch((OpCode?)OpCodes.Callvirt, (object)null, (string)null)
});
while (val.IsValid)
{
if (val.Operand.ToString() == "IInteractible GetComponentInParent[IInteractible]()")
{
val.RemoveInstruction();
val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { CodeInstruction.Call<Transform, IInteractible>((Expression<Func<Transform, IInteractible>>)((Transform transform) => GetInteractableIInteractable(transform))) });
}
else if (val.Operand.ToString() == "Item GetComponentInParent[Item]()")
{
val.RemoveInstruction();
val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { CodeInstruction.Call<Transform, Item>((Expression<Func<Transform, Item>>)((Transform transform) => GetInteractableItem(transform))) });
}
else
{
val.Advance(1);
}
val.MatchStartForward((CodeMatch[])(object)new CodeMatch[1]
{
new CodeMatch((OpCode?)OpCodes.Callvirt, (object)null, (string)null)
});
}
return val.Instructions();
}
}
internal class ScoutmasterPatch
{
[HarmonyPatch(typeof(Scoutmaster), "ViableTargets")]
[HarmonyPrefix]
private static bool ScoutmasterViableTargetsPrefix(ref int __result, Scoutmaster __instance)
{
if (!Plugin.ItsPvPEAK)
{
return true;
}
__result = 0;
foreach (KeyValuePair<Color, Team> team in Plugin.teamTracker.teams)
{
int num = 0;
foreach (string player in team.Value.players)
{
if (Plugin.player_mapping.TryGetValue(player, out Player value) && (Object)(object)value.character != (Object)null)
{
Character character = value.character;
if (!character.isBot && !character.data.dead && !character.data.fullyPassedOut)
{
num++;
}
}
}
__result = Math.Max(__result, num);
}
return false;
}
[HarmonyPatch(typeof(Scoutmaster), "LookForTarget")]
[HarmonyPrefix]
private static bool LookForTargetPrefix(Scoutmaster __instance)
{
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: 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)
if (!Plugin.ItsPvPEAK)
{
return true;
}
if (__instance.ViableTargets() < 2 || __instance.sinceLookForTarget < 30f)
{
return false;
}
__instance.sinceLookForTarget = 0f;
Plugin.Logger.LogInfo((object)"Trying to spawn scoutmaster");
if (!(Random.value > 0.1f))
{
Character val = null;
foreach (KeyValuePair<Color, Team> team in Plugin.teamTracker.teams)
{
Character highestCharacterOnTeam = GetHighestCharacterOnTeam(team.Value, null);
Character highestCharacterOnTeam2 = GetHighestCharacterOnTeam(team.Value, highestCharacterOnTeam);
if (!((Object)(object)highestCharacterOnTeam2 == (Object)null) && highestCharacterOnTeam.Center.y > highestCharacterOnTeam2.Center.y + __instance.attackHeightDelta && highestCharacterOnTeam.Center.y < __instance.maxAggroHeight && ((Object)(object)val == (Object)null || highestCharacterOnTeam.Center.y > val.Center.y))
{
val = highestCharacterOnTeam;
}
}
if ((Object)(object)val != (Object)null)
{
__instance.SetCurrentTarget(val, 0f);
}
}
return false;
}
public static Character GetHighestCharacterOnTeam(Team team, Character ignoredCharacter)
{
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
Character val = null;
foreach (string player in team.players)
{
if (Plugin.player_mapping.TryGetValue(player, out Player value) && (Object)(object)value.character != (Object)null)
{
Character character = value.character;
if (!character.isBot && !character.data.dead && !character.data.fullyPassedOut && !((Object)(object)character == (Object)(object)ignoredCharacter) && ((Object)(object)character == (Object)null || character.Center.y > val.Center.y))
{
val = character;
}
}
}
return val;
}
[HarmonyPatch(typeof(Scoutmaster), "GetClosestOther")]
[HarmonyPrefix]
private static bool ScoutmasterGetClosestOtherPrefix(ref Character __result, Scoutmaster __instance, Character currentTarget)
{
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
if (!Plugin.ItsPvPEAK)
{
return true;
}
__result = null;
Team playerTeam = Plugin.teamTracker.GetPlayerTeam(currentTarget);
float num = float.MaxValue;
foreach (string player in playerTeam.players)
{
if (!Plugin.player_mapping.TryGetValue(player, out Player value) || !((Object)(object)value.character != (Object)null))
{
continue;
}
Character character = value.character;
if (!character.isBot && !((Object)(object)character == (Object)(object)currentTarget))
{
float num2 = Vector3.Distance(character.Center, currentTarget.Center);
if (num2 < num)
{
num = num2;
__result = character;
}
}
}
return false;
}
[HarmonyPatch(typeof(Scoutmaster), "VerifyTarget")]
[HarmonyPrefix]
private static bool ScoutmasterVerifyTargetPrefix(Scoutmaster __instance)
{
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
if (!Plugin.ItsPvPEAK)
{
return true;
}
if (__instance.ViableTargets() < 2)
{
__instance.SetCurrentTarget((Character)null, 0f);
return false;
}
Team playerTeam = Plugin.teamTracker.GetPlayerTeam(__instance.currentTarget);
Character closestOther = __instance.GetClosestOther(__instance.currentTarget);
Character highestCharacterOnTeam = GetHighestCharacterOnTeam(playerTeam, null);
Character highestCharacterOnTeam2 = GetHighestCharacterOnTeam(playerTeam, highestCharacterOnTeam);
if (highestCharacterOnTeam.Center.y > __instance.maxAggroHeight)
{
__instance.SetCurrentTarget((Character)null, 0f);
}
else if ((Object)(object)__instance.currentTarget != (Object)(object)highestCharacterOnTeam)
{
__instance.SetCurrentTarget((Character)null, 0f);
}
else if (highestCharacterOnTeam.Center.y < highestCharacterOnTeam2.Center.y + __instance.attackHeightDelta - 20f)
{
__instance.SetCurrentTarget((Character)null, 0f);
}
else if (Vector3.Distance(closestOther.Center, __instance.currentTarget.Center) < 15f)
{
__instance.SetCurrentTarget((Character)null, 0f);
}
return false;
}
}
public class SingleItemSpawnerTrySpawnItemsPatch
{
[HarmonyPatch(typeof(Spawner), "TrySpawnItems")]
[HarmonyPrefix]
private static bool Prefix(ref List<PhotonView> __result, Spawner __instance)
{
if (!Plugin.ItsPvPEAK)
{
return true;
}
List<PhotonView> list = new List<PhotonView>();
if (((Object)((Component)__instance).gameObject).name == "CampfireFoodSpawner")
{
__result = list;
return false;
}
if (((Object)((Component)__instance).gameObject).name.ToLower().Contains("luggage"))
{
if (((Object)((Component)((Component)__instance).gameObject.transform.parent).gameObject).name.ToLower().Contains("plane"))
{
PhotonNetwork.Destroy(((MonoBehaviourPun)__instance).photonView);
__result = list;
return false;
}
if (((Object)((Component)((Component)__instance).gameObject.transform.parent.parent).gameObject).name.ToLower().Contains("campfire") && !((Object)((Component)((Component)__instance).gameObject.transform.parent.parent).gameObject).name.ToLower().Contains("campfirespawner_volcano"))
{
PhotonNetwork.Destroy(((MonoBehaviourPun)__instance).photonView);
__result = list;
return false;
}
}
return true;
}
[HarmonyPatch(typeof(SingleItemSpawner), "TrySpawnItems")]
[HarmonyPrefix]
private static bool SinglePrefix(ref List<PhotonView> __result, SingleItemSpawner __instance)
{
if (!Plugin.ItsPvPEAK)
{
return true;
}
string name = ((Object)((Component)__instance).gameObject).name;
if ((name == "Backpack_Spawner" || name == "Backpack (2)_Spawner") ? true : false)
{
__result = new List<PhotonView>();
return false;
}
return true;
}
}
internal class SkipIntroPatch
{
[HarmonyPatch(typeof(Pretitle), "Start")]
[HarmonyPrefix]
private static bool Prefix(Pretitle __instance)
{
__instance.loadWait = 0f;
return true;
}
}
public class StartGamePatch
{
[HarmonyPatch(typeof(AirportCheckInKiosk), "BeginIslandLoadRPC")]
[HarmonyPostfix]
private static void BeginIslandLoadRPCPostfix()
{
if (Plugin.ItsPvPEAK)
{
Plugin.Reset();
Plugin.teamTracker.CreateTeams();
}
}
}
public class StatuePatch
{
[HarmonyPatch(typeof(RespawnChest), "Interact_CastFinished")]
[HarmonyPrefix]
private static bool Interact_CastFinishedPrefix(RespawnChest __instance, Character interactor)
{
_ = Plugin.ItsPvPEAK;
return true;
}
public static bool CheckSkipRespawn()
{
if (!Plugin.ItsPvPEAK)
{
return Ascents.canReviveDead;
}
return false;
}
[HarmonyPatch(typeof(RespawnChest), "SpawnItems")]
[HarmonyTranspiler]
private static IEnumerable<CodeInstruction> SpawnItemsTranspiler(IEnumerable<CodeInstruction> instructions)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Expected O, but got Unknown
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Expected O, but got Unknown
CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null);
List<Label> labels = val.MatchStartForward((CodeMatch[])(object)new CodeMatch[1]
{
new CodeMatch((OpCode?)OpCodes.Brfalse, (object)null, (string)null)
}).MatchStartBackwards((CodeMatch[])(object)new CodeMatch[1] { CodeMatch.op_Implicit(OpCodes.Call) }).Labels;
val.RemoveInstruction().Insert((CodeInstruction[])(object)new CodeInstruction[1] { CodeInstruction.Call((Expression<Action>)(() => CheckSkipRespawn())) }).AddLabels((IEnumerable<Label>)labels);
val.MatchStartForward((CodeMatch[])(object)new CodeMatch[1]
{
new CodeMatch((OpCode?)OpCodes.Pop, (object)null, (string)null)
}).SetOpcodeAndAdvance(OpCodes.Stloc_0);
return val.Instructions();
}
[HarmonyPatch(typeof(RespawnChest), "SpawnItems")]
[HarmonyPostfix]
private static void SpawnItemsPostfix(ref List<PhotonView> __result, RespawnChest __instance)
{
_ = Plugin.ItsPvPEAK;
}
[HarmonyPatch(typeof(RespawnChest), "GetInteractionText")]
[HarmonyPostfix]
private static void GetInteractionTextPostfix(ref string __result, RespawnChest __instance)
{
if (Plugin.ItsPvPEAK)
{
__result = LocalizedText.GetText("TOUCH", true);
}
}
}
}
namespace PvPEAK.Model
{
public class ItemTracker
{
public class TeamJsonConverter : JsonConverter
{
public override bool CanConvert(Type objectType)
{
return objectType == typeof(Team);
}
public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Invalid comparison between Unknown and I4
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
if ((int)reader.TokenType == 11)
{
return null;
}
List<float> list = JsonConvert.DeserializeObject<List<float>>(reader.Value as string);
Color color = default(Color);
((Color)(ref color))..ctor(list[0], list[1], list[2], list[3]);
return Plugin.teamTracker.GetOrCreateTeamByColor(color);
}
public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: 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)
if (value == null)
{
writer.WriteNull();
return;
}
Color teamColor = (value as Team).teamColor;
writer.WriteValue(JsonConvert.SerializeObject((object)new List<float>(new <>z__ReadOnlyArray<float>(new float[4] { teamColor.r, teamColor.g, teamColor.b, teamColor.a }))));
}
}
private Dictionary<int, Team> mappings = new Dictionary<int, Team>();
private Dictionary<int, List<Team>> not_mappings = new Dictionary<int, List<Team>>();
public void SetItemToTeam(Item item, Team team)
{
mappings[((MonoBehaviourPun)item).photonView.ViewID] = team;
TrySyncItemData();
}
public void SetItemToNotTeam(Item item, Team team)
{
if (!not_mappings.TryGetValue(((MonoBehaviourPun)item).photonView.ViewID, out List<Team> value))
{
value = new List<Team>();
not_mappings[((MonoBehaviourPun)item).photonView.ViewID] = value;
}
value.Add(team);
TrySyncItemData();
}
public void RemoveItemFromTeam(Item item, Team team)
{
mappings.Remove(((MonoBehaviourPun)item).photonView.ViewID);
TrySyncItemData();
}
public void RemoveItemFromNotTeam(Item item, Team team)
{
if (!not_mappings.TryGetValue(((MonoBehaviourPun)item).photonView.ViewID, out List<Team> value))
{
value = new List<Team>();
not_mappings[((MonoBehaviourPun)item).photonView.ViewID] = value;
}
value.Remove(team);
TrySyncItemData();
}
public void TrySyncItemData(Player? player = null)
{
JsonConverter[] array = (JsonConverter[])(object)new JsonConverter[1]
{
new TeamJsonConverter()
};
if ((Object)(object)Player.localPlayer != (Object)null)
{
Plugin.Logger.LogInfo((object)"Sending item ownership sync");
if (player != null)
{
((Component)Player.localPlayer).GetComponent<Networking>().view.RPC("SyncItems_RPC", player, new object[2]
{
Encoding.UTF8.GetBytes(JsonConvert.SerializeObject((object)mappings, array)),
Encoding.UTF8.GetBytes(JsonConvert.SerializeObject((object)not_mappings, array))
});
}
else
{
Plugin.Logger.LogInfo((object)$"Networking component: {((Component)Player.localPlayer).GetComponent<Networking>()}");
((Component)Player.localPlayer).GetComponent<Networking>().view.RPC("SyncItems_RPC", (RpcTarget)1, new object[2]
{
Encoding.UTF8.GetBytes(JsonConvert.SerializeObject((object)mappings, array)),
Encoding.UTF8.GetBytes(JsonConvert.SerializeObject((object)not_mappings, array))
});
}
}
}
public void AcceptSyncData(byte[] serializedMappings, byte[] serializedNotMappings)
{
JsonConverter[] array = (JsonConverter[])(object)new JsonConverter[1]
{
new TeamJsonConverter()
};
mappings = JsonConvert.DeserializeObject<Dictionary<int, Team>>(Encoding.UTF8.GetString(serializedMappings), array);
not_mappings = JsonConvert.DeserializeObject<Dictionary<int, List<Team>>>(Encoding.UTF8.GetString(serializedNotMappings), array);
}
public bool ItemCanBeGrabbedByTeam(Item item, Team team)
{
Character val = item.holderCharacter ?? item.lastHolderCharacter ?? item.lastThrownCharacter;
if ((Object)(object)val != (Object)null)
{
return team.HasPlayer(((MonoBehaviourPun)val.player).photonView.Owner);
}
if (not_mappings.TryGetValue(((MonoBehaviourPun)item).photonView.ViewID, out List<Team> value) && value.Contains(team))
{
return false;
}
if (mappings.TryGetValue(((MonoBehaviourPun)item).photonView.ViewID, out Team _))
{
return mappings[((MonoBehaviourPun)item).photonView.ViewID] == team;
}
return true;
}
public bool ItemIsOwned(Item item)
{
bool flag = false;
Character val = item.holderCharacter ?? item.lastHolderCharacter ?? item.lastThrownCharacter;
if ((Object)(object)val != (Object)null)
{
foreach (KeyValuePair<Color, Team> team in Plugin.teamTracker.teams)
{
flag |= team.Value.HasPlayer(((MonoBehaviourPun)val.player).photonView.Owner);
}
}
if (!flag && !mappings.ContainsKey(((MonoBehaviourPun)item).photonView.ViewID))
{
if (not_mappings.ContainsKey(((MonoBehaviourPun)item).photonView.ViewID))
{
return not_mappings[((MonoBehaviourPun)item).photonView.ViewID].Count > 0;
}
return false;
}
return true;
}
public void Reset()
{
mappings = new Dictionary<int, Team>();
}
}
public class NotificationsHandler
{
public static GameObject notificationsUI;
public static void Initialize()
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Expected O, but got Unknown
//IL_004b: 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_0075: Unknown result type (might be due to invalid IL or missing references)
Plugin.Logger.LogInfo((object)"Creating notificationsUI");
if ((Object)(object)notificationsUI != (Object)null)
{
Object.Destroy((Object)(object)notificationsUI);
}
notificationsUI = new GameObject("NotificationsUI");
RectTransform val = notificationsUI.AddComponent<RectTransform>();
val.anchorMin = new Vector2(0f, 1f);
val.anchorMax = new Vector2(0f, 1f);
val.pivot = new Vector2(0f, 1f);
notificationsUI.AddComponent<Notifications>();
}
public static void SetNotification(string text, float duration)
{
notificationsUI.GetComponent<Notifications>().SetNotification(text, duration);
}
}
public class Team
{
public HashSet<string> players = new HashSet<string>();
public Color teamColor;
public Team(Color color)
{
//IL_0012: 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)
teamColor = color;
}
public void AddPlayer(Character character)
{
AddPlayer(character.player.view.Owner);
}
public void AddPlayer(Player player)
{
AddPlayer(player.view.Owner);
}
public void AddPlayer(Player player)
{
players.Add(player.UserId);
}
public void RemovePlayer(Character character)
{
RemovePlayer(character.player.view.Owner);
}
public void RemovePlayer(Player player)
{
RemovePlayer(player.view.Owner);
}
public void RemovePlayer(Player player)
{
players.Remove(player.UserId);
}
public bool HasPlayer(Character character)
{
return HasPlayer(character.player.view.Owner);
}
public bool HasPlayer(Player player)
{
return HasPlayer(player.view.Owner);
}
public bool HasPlayer(Player player)
{
return players.Contains(player.UserId);
}
}
public class TeamTracker
{
public Dictionary<Color, Team> teams = new Dictionary<Color, Team>();
public int Count => teams.Count;
public Team GetPlayerTeam(Character character)
{
return GetPlayerTeam(character.player);
}
public Team GetPlayerTeam(Player player)
{
return GetPlayerTeam(player.view.Owner);
}
public Team GetPlayerTeam(Player player)
{
Team result = null;
foreach (KeyValuePair<Color, Team> team in teams)
{
if (team.Value.HasPlayer(player))
{
result = team.Value;
}
}
return result;
}
public Team GetOrCreateTeamByColor(Color color)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
Team team = null;
if (teams.ContainsKey(color))
{
team = teams[color];
}
if (team == null)
{
team = new Team(color);
teams[team.teamColor] = team;
}
return team;
}
public void RemoveTeam(Color color)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
Team orCreateTeamByColor = GetOrCreateTeamByColor(color);
RemoveTeam(orCreateTeamByColor);
}
public void RemoveTeam(Team team)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
teams.Remove(team.teamColor);
}
public void CreateTeams()
{
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
foreach (Character allPlayerCharacter in PlayerHandler.GetAllPlayerCharacters())
{
if (!allPlayerCharacter.isBot && !allPlayerCharacter.isScoutmaster && !allPlayerCharacter.isZombie)
{
Team orCreateTeamByColor = GetOrCreateTeamByColor(allPlayerCharacter.refs.customization.PlayerColor);
ManualLogSource logger = Plugin.Logger;
Color teamColor = orCreateTeamByColor.teamColor;
logger.LogInfo((object)("Created team: " + ((object)(Color)(ref teamColor)).ToString()));
orCreateTeamByColor.AddPlayer(allPlayerCharacter);
}
}
}
public void Clear()
{
teams.Clear();
}
}
}
namespace PvPEAK.GameObjects
{
public class CampfireBackpackSpawner : MonoBehaviour
{
private Campfire campfire;
private List<Backpack> backpacks;
public void Awake()
{
campfire = ((Component)this).GetComponent<Campfire>();
Plugin.Logger.LogInfo((object)$"Backpack Spawner awake: {campfire}");
backpacks = new List<Backpack>();
Plugin.campfireBackpackMapping[campfire] = backpacks;
}
public void Start()
{
Plugin.Logger.LogInfo((object)$"Backpack Spawner start: {campfire}");
}
public void OnEnable()
{
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
Plugin.Logger.LogInfo((object)$"Backpack Spawner onEnable: {campfire}");
if (!PhotonNetwork.IsMasterClient)
{
return;
}
int number = Plugin.teamTracker.Count - 1;
List<Backpack> list = Utility.SpawnBackpacks(number, ((Component)this).gameObject.transform.position, ((Component)this).gameObject.transform.eulerAngles, campfire.advanceToSegment, (Vector3?)new Vector3(0f, 5f, 0f));
foreach (Backpack item in list)
{
((Component)item).transform.parent = ((Component)this).transform.parent.parent;
}
backpacks.AddRange(list);
}
public void OnDisable()
{
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
Plugin.Logger.LogInfo((object)$"Backpack Spawner onDisable: {campfire}");
Plugin.Logger.LogInfo((object)$"Leaving lobby: {Plugin.leavingLobby}");
if (!PhotonNetwork.IsMasterClient)
{
return;
}
Scene scene = ((Component)this).gameObject.scene;
if (!((Scene)(ref scene)).isLoaded)
{
return;
}
Plugin.Logger.LogInfo((object)"Deleting objects");
foreach (Backpack item in backpacks.ToList())
{
if ((Object)(object)item != (Object)null && (Object)(object)(((Item)item).holderCharacter ?? ((Item)item).lastHolderCharacter ?? ((Item)item).lastThrownCharacter ?? null) == (Object)null)
{
PhotonNetwork.Destroy(((Component)item).gameObject);
backpacks.Remove(item);
}
}
}
}
public class CampfireFoodSpawner : MonoBehaviour
{
private Campfire campfire;
private List<Item> foods;
public void Awake()
{
campfire = ((Component)this).GetComponent<Campfire>();
Plugin.Logger.LogInfo((object)$"Food Spawner awake: {campfire}");
foods = new List<Item>();
Plugin.campfireFoodMapping[campfire] = foods;
}
public void Start()
{
Plugin.Logger.LogInfo((object)$"Food Spawner start: {campfire}");
}
public void OnEnable()
{
//IL_003b: 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: Unknown result type (might be due to invalid IL or missing references)
Plugin.Logger.LogInfo((object)$"Food Spawner onEnable: {campfire}");
if (!PhotonNetwork.IsMasterClient)
{
return;
}
int playerCount = PhotonNetwork.CurrentRoom.PlayerCount;
List<Item> list = Utility.SpawnMarshmallows(playerCount, ((Component)this).gameObject.transform.position, ((Component)this).gameObject.transform.eulerAngles, campfire.advanceToSegment);
int num = 0;
foreach (KeyValuePair<Color, Team> team in Plugin.teamTracker.teams)
{
foreach (string player in team.Value.players)
{
Plugin.itemTracker.SetItemToTeam(list[num], team.Value);
num++;
}
}
foods.AddRange(list);
}
public void OnDisable()
{
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
Plugin.Logger.LogInfo((object)$"Food Spawner onDisable: {campfire}");
Plugin.Logger.LogInfo((object)$"Leaving lobby: {Plugin.leavingLobby}");
if (!PhotonNetwork.IsMasterClient)
{
return;
}
Scene scene = ((Component)this).gameObject.scene;
if (!((Scene)(ref scene)).isLoaded)
{
return;
}
foreach (Item item in foods.ToList())
{
if ((Object)(object)item != (Object)null && (Object)(object)(item.holderCharacter ?? item.lastHolderCharacter ?? item.lastThrownCharacter ?? null) == (Object)null)
{
PhotonNetwork.Destroy(((Component)item).gameObject);
foods.Remove(item);
}
}
}
}
public class Networking : MonoBehaviourPunCallbacks
{
public PhotonView view;
public string? PvPEAKVersion;
public void Awake()
{
view = ((Component)this).GetComponent<PhotonView>();
}
[PunRPC]
public void SetItsPvPEAK_RPC(bool itis)
{
Plugin.ItsPvPEAK = itis;
if (!itis)
{
return;
}
foreach (Campfire campfire in Plugin.CampfireList)
{
if (!((Object)((Component)((Component)campfire).gameObject.transform.parent).gameObject).name.ToLower().Contains("wings") && (Object)(object)((Component)campfire).GetComponent<CampfireBackpackSpawner>() == (Object)null)
{
Utility.AddCampfireSpawners(campfire);
}
}
}
[PunRPC]
public void SyncItems_RPC(byte[] mappings, byte[] not_mappings)
{
Plugin.itemTracker.AcceptSyncData(mappings, not_mappings);
}
[PunRPC]
public void SetPvPEAKVersion_RPC(PhotonView characterView, string version)
{
((Component)characterView).GetComponent<Networking>().PvPEAKVersion = version;
}
}
public class Notifications : MonoBehaviour
{
public Canvas canvas;
public static int shadowMaterialID;
public TextMeshProUGUI notificationsGUI;
public int textPosX;
public int textPosY;
public float textSetTime;
public float textDuration;
public string text = "";
public void Awake()
{
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Expected O, but got Unknown
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Unknown result type (might be due to invalid IL or missing references)
//IL_0183: Expected O, but got Unknown
//IL_019d: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Expected O, but got Unknown
canvas = ((Component)this).gameObject.AddComponent<Canvas>();
canvas.renderMode = (RenderMode)0;
CanvasScaler val = ((Component)canvas).gameObject.AddComponent<CanvasScaler>();
val.uiScaleMode = (ScaleMode)1;
val.referenceResolution = new Vector2(1920f, 1080f);
Object[] array = Resources.FindObjectsOfTypeAll(typeof(Material));
Object[] array2 = array;
foreach (Object val2 in array2)
{
if (val2.name == "DarumaDropOne-Regular SDF Shadow")
{
shadowMaterialID = val2.GetInstanceID();
}
}
if ((Object)(object)Plugin.fontAsset == (Object)null)
{
Object[] array3 = (Object[])(object)Resources.FindObjectsOfTypeAll<TMP_FontAsset>();
Object[] array4 = array3;
Object[] array5 = array4;
for (int j = 0; j < array5.Length; j++)
{
TMP_FontAsset val3 = (TMP_FontAsset)array5[j];
if (((Object)val3).name.Equals("DarumaDropOne-Regular SDF"))
{
Plugin.fontAsset = val3;
}
}
}
GameObject val4 = new GameObject("NotificationsUI");
val4.transform.SetParent(((Component)canvas).transform, false);
notificationsGUI = val4.AddComponent<TextMeshProUGUI>();
Vector3 anchoredPos = default(Vector3);
anchoredPos.x = textPosX;
anchoredPos.y = textPosY;
((TMP_Text)notificationsGUI).text = "";
SetupText(notificationsGUI, anchoredPos);
((TMP_Text)notificationsGUI).font = Plugin.fontAsset;
((TMP_Text)notificationsGUI).fontMaterial = (Material)Resources.InstanceIDToObject(shadowMaterialID);
((Graphic)notificationsGUI).color = new Color(0.8745f, 0.8549f, 0.7608f, 1f);
((TMP_Text)notificationsGUI).fontSize = 25f;
}
public void LateUpdate()
{
if (text != "")
{
if (textDuration > 0f && Time.time > textSetTime + textDuration)
{
SetNotification("");
}
((TMP_Text)notificationsGUI).text = text;
}
}
public static void SetupText(TextMeshProUGUI text, Vector3 anchoredPos)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
RectTransform rectTransform = ((TMP_Text)text).rectTransform;
rectTransform.anchorMin = new Vector2(0.5f, 0.5f);
rectTransform.anchorMax = new Vector2(0.5f, 0.5f);
rectTransform.pivot = new Vector2(0.5f, 0.5f);
((Transform)rectTransform).position = ((Transform)rectTransform).position + anchoredPos;
rectTransform.sizeDelta = new Vector2(500f, 500f);
((TMP_Text)text).alignment = (TextAlignmentOptions)514;
}
public void SetNotification(string text, float timeout = 0f)
{
this.text = text;
textSetTime = Time.time;
textDuration = timeout;
}
}
public class RopeEnd : MonoBehaviour, IInteractibleConstant, IInteractible
{
public Rope rope;
public RopeSegment ropeSegment;
public float cutTime = 2f;
public bool holdOnFinish => false;
public void Awake()
{
rope = ((Component)this).GetComponentInParent<Rope>();
ropeSegment = ((Component)this).GetComponent<RopeSegment>();
}
public bool IsInteractible(Character interactor)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Invalid comparison between Unknown and I4
if ((int)rope.attachmenState != 2 || rope.isHelicopterRope)
{
return false;
}
if (interactor.data.isRopeClimbing)
{
return (Object)(object)interactor.data.heldRope != (Object)(object)rope;
}
return true;
}
public string GetInteractionText()
{
string text = LocalizedText.GetText("CUT", false);
if (text == "")
{
text = "cut";
}
return text;
}
public Vector3 Center()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
return ((Component)this).transform.position;
}
public Transform GetTransform()
{
return ((Component)this).transform;
}
public void HoverEnter()
{
}
public void HoverExit()
{
}
public void Interact(Character interactor)
{
}
public string GetName()
{
return ((Component)this).gameObject.GetComponent<RopeSegment>().GetName();
}
public bool IsConstantlyInteractable(Character interactor)
{
return IsInteractible(interactor);
}
public float GetInteractTime(Character interactor)
{
return cutTime;
}
public void Interact_CastFinished(Character interactor)
{
rope.view.RPC("Detach_Rpc", (RpcTarget)3, new object[1] { 0f });
}
public void CancelCast(Character interactor)
{
}
public void ReleaseInteract(Character interactor)
{
}
}
}
namespace PvPEAK.Configuration
{
public class Option
{
public enum OptionType
{
Bool,
Int,
String,
InputAction
}
public string Label { get; set; }
public OptionType Type { get; set; }
public ConfigEntry<bool> BoolEntry { get; set; }
public ConfigEntry<int> IntEntry { get; set; }
public ConfigEntry<string> StringEntry { get; set; }
public int MinInt { get; set; }
public int MaxInt { get; set; }
public int Step { get; set; }
public Func<bool> IsDisabled { get; set; } = () => false;
public Func<string> DisplayValue { get; set; } = () => "";
private Option(string label, OptionType type)
{
Label = label;
Type = type;
}
public static Option Bool(string label, ConfigEntry<bool> entry, Func<bool>? isDisabled = null)
{
ConfigEntry<bool> entry2 = entry;
return new Option(label, OptionType.Bool)
{
BoolEntry = entry2,
IsDisabled = (isDisabled ?? ((Func<bool>)(() => false))),
DisplayValue = () => (!entry2.Value) ? "OFF" : "ON"
};
}
public static Option InputAction(string label, ConfigEntry<string> entry, Func<bool>? isDisabled = null)
{
ConfigEntry<string> entry2 = entry;
return new Option(label, OptionType.InputAction)
{
StringEntry = entry2,
IsDisabled = (isDisabled ?? ((Func<bool>)(() => false))),
DisplayValue = delegate
{
string[] array = entry2.Value.Split("/");
return (array.Length <= 1) ? entry2.Value : array[^1].ToUpper();
}
};
}
public static Option Int(string label, ConfigEntry<int> entry, int min, int max, int step = 1, Func<bool>? isDisabled = null)
{
ConfigEntry<int> entry2 = entry;
return new Option(label, OptionType.Int)
{
IntEntry = entry2,
MinInt = min,
MaxInt = max,
Step = step,
IsDisabled = (isDisabled ?? ((Func<bool>)(() => false))),
DisplayValue = () => entry2.Value.ToString()
};
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}
[CompilerGenerated]
internal sealed class <>z__ReadOnlyArray<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T>
{
int ICollection.Count => _items.Length;
bool ICollection.IsSynchronized => false;
object ICollection.SyncRoot => this;
object IList.this[int index]
{
get
{
return _items[index];
}
set
{
throw new NotSupportedException();
}
}
bool IList.IsFixedSize => true;
bool IList.IsReadOnly => true;
int IReadOnlyCollection<T>.Count => _items.Length;
T IReadOnlyList<T>.this[int index] => _items[index];
int ICollection<T>.Count => _items.Length;
bool ICollection<T>.IsReadOnly => true;
T IList<T>.this[int index]
{
get
{
return _items[index];
}
set
{
throw new NotSupportedException();
}
}
public <>z__ReadOnlyArray(T[] items)
{
_items = items;
}
IEnumerator IEnumerable.GetEnumerator()
{
return ((IEnumerable)_items).GetEnumerator();
}
void ICollection.CopyTo(Array array, int index)
{
((ICollection)_items).CopyTo(array, index);
}
int IList.Add(object value)
{
throw new NotSupportedException();
}
void IList.Clear()
{
throw new NotSupportedException();
}
bool IList.Contains(object value)
{
return ((IList)_items).Contains(value);
}
int IList.IndexOf(object value)
{
return ((IList)_items).IndexOf(value);
}
void IList.Insert(int index, object value)
{
throw new NotSupportedException();
}
void IList.Remove(object value)
{
throw new NotSupportedException();
}
void IList.RemoveAt(int index)
{
throw new NotSupportedException();
}
IEnumerator<T> IEnumerable<T>.GetEnumerator()
{
return ((IEnumerable<T>)_items).GetEnumerator();
}
void ICollection<T>.Add(T item)
{
throw new NotSupportedException();
}
void ICollection<T>.Clear()
{
throw new NotSupportedException();
}
bool ICollection<T>.Contains(T item)
{
return ((ICollection<T>)_items).Contains(item);
}
void ICollection<T>.CopyTo(T[] array, int arrayIndex)
{
((ICollection<T>)_items).CopyTo(array, arrayIndex);
}
bool ICollection<T>.Remove(T item)
{
throw new NotSupportedException();
}
int IList<T>.IndexOf(T item)
{
return ((IList<T>)_items).IndexOf(item);
}
void IList<T>.Insert(int index, T item)
{
throw new NotSupportedException();
}
void IList<T>.RemoveAt(int index)
{
throw new NotSupportedException();
}
}