using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Photon.Pun;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using Zorro.Core;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Peak_NoEndGame")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Peak_NoEndGame")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("b253a047-7de8-4c49-8e85-524405e8513d")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Peak_NoEndGame;
[BepInPlugin("com.Xiaohai.CampfireRespawn", "Campfire Respawn", "1.1.0")]
public class Plugin : BaseUnityPlugin
{
public const string GUID = "com.Xiaohai.CampfireRespawn";
public const string NAME = "Campfire Respawn";
public const string VERSION = "1.1.0";
public static Plugin instance;
public static ManualLogSource logger;
public ConfigEntry<bool> campfireClearStatus;
public ConfigEntry<bool> reviveAddCurse;
public ConfigEntry<int> respawnItemChance;
public ConfigEntry<KeyCode> respawnHotkey;
public ConfigEntry<int> respawnMaxTimes;
public ConfigEntry<bool> recordItemsAtCampfire;
public void Awake()
{
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
instance = this;
logger = ((BaseUnityPlugin)this).Logger;
campfireClearStatus = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "CampfireClearStatus", false, "If enabled, campfire will clear all negative player status effects (e.g., curses, poison). 如果启用,在营火休息时会清除所有负面状态效果(例如诅咒、中毒)。");
reviveAddCurse = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "ReviveClearStatus", false, "If enabled, player will add Curse upon respawning. 如果启用,玩家复活时将获得一层诅咒。");
respawnHotkey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Settings", "RespawnHotkey", (KeyCode)292, "Keybind to force trigger a respawn. 强制触发重生的按键绑定。");
respawnMaxTimes = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "RespawnMaxTimes", 99, "The maximum number of times the player is allowed to respawn. 允许玩家复活的最大次数。");
recordItemsAtCampfire = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "recordItemsAtCampfire", true, "If TRUE: Item recording triggers at campfire. If FALSE: Item recording triggers upon player death. 如果为TRUE:物品记录在营火处触发。如果为FALSE:物品记录在玩家死亡时触发。");
respawnItemChance = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "RespawnItemChance", 88, "The percentage chance (0-100) for each recorded item to be restored upon respawning. 复活时,每个被记录的物品被恢复的百分比几率(0-100)。");
new Harmony("com.Xiaohai.CampfireRespawn").PatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Campfire Respawn v1.1.0 loaded successfully!篝火复活MOD v1.1.0 已加载!");
}
}
public static class CampfireTracker
{
public static Vector3? LastCampfirePosition
{
get
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected I4, but got Unknown
//IL_003e: 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)
int num = (int)Singleton<MapHandler>.Instance.GetCurrentSegment();
if (num == 5)
{
return Singleton<MapHandler>.Instance.respawnThePeak.position;
}
return Singleton<MapHandler>.Instance.segments[num].reconnectSpawnPos.position;
}
}
}
public static class PlayerInventoryHelper
{
public class RecordedItem
{
public Item item;
public Character player;
public string itemName;
public ItemInstanceData data;
public RecordedItem(Item _item, Character character, string _itemName, ItemInstanceData _data = null)
{
item = _item;
player = character;
itemName = _itemName;
data = _data;
}
}
public static List<RecordedItem> GetPlayerAllItems(Character player)
{
List<RecordedItem> list = new List<RecordedItem>();
ItemSlot[] itemSlots = player.player.itemSlots;
ItemSlot[] array = itemSlots;
foreach (ItemSlot val in array)
{
if (!val.IsEmpty())
{
ItemInstanceData data = CreateDeepCopy(val.data);
list.Add(new RecordedItem(null, player, ((Object)val.prefab).name, data));
}
}
return list;
}
public static List<RecordedItem> GetAllItems(bool recordedAtCampfire)
{
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Invalid comparison between Unknown and I4
List<RecordedItem> list = new List<RecordedItem>();
if (!recordedAtCampfire)
{
List<Item> list2 = Object.FindObjectsByType<Item>((FindObjectsSortMode)0).ToList();
Plugin.logger.LogInfo((object)$"找到Item有{list2.Count}个");
foreach (Item item in list2)
{
if ((Object)(object)item.lastThrownCharacter != (Object)null && (int)item.itemState == 0)
{
list.Add(new RecordedItem(item, item.lastThrownCharacter, ((Object)item).name));
Plugin.logger.LogInfo((object)("记录物品:" + ((Object)item).name + ",记录玩家" + item.lastThrownCharacter.characterName));
}
}
}
else
{
foreach (Character allCharacter in Character.AllCharacters)
{
list.AddRange(GetPlayerAllItems(allCharacter));
}
}
return list;
}
public static ItemInstanceData CreateDeepCopy(ItemInstanceData original)
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Expected O, but got Unknown
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
if (original == null)
{
return null;
}
ItemInstanceData val = new ItemInstanceData(original.guid);
val.data = new Dictionary<DataEntryKey, DataEntryValue>();
foreach (KeyValuePair<DataEntryKey, DataEntryValue> datum in original.data)
{
DataEntryValue value = CreateDataEntryValueCopy(datum.Value);
val.data.Add(datum.Key, value);
}
return val;
}
private static DataEntryValue CreateDataEntryValueCopy(DataEntryValue original)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected O, but got Unknown
if (original == null)
{
return null;
}
DataEntryValue val = (DataEntryValue)Activator.CreateInstance(((object)original).GetType());
FieldInfo[] fields = ((object)original).GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
FieldInfo[] array = fields;
foreach (FieldInfo fieldInfo in array)
{
object value = fieldInfo.GetValue(original);
if (value == null || value.GetType().IsValueType || value is string)
{
fieldInfo.SetValue(val, value);
continue;
}
object value2 = CreateDeepCopyForObject(value);
fieldInfo.SetValue(val, value2);
}
return val;
}
private static object CreateDeepCopyForObject(object obj)
{
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
if (obj == null)
{
return null;
}
Type type = obj.GetType();
if (type == typeof(Dictionary<DataEntryKey, DataEntryValue>))
{
Dictionary<DataEntryKey, DataEntryValue> dictionary = new Dictionary<DataEntryKey, DataEntryValue>();
foreach (object item in (dynamic)obj)
{
KeyValuePair<DataEntryKey, DataEntryValue> keyValuePair = (KeyValuePair<DataEntryKey, DataEntryValue>)(dynamic)item;
dictionary.Add(keyValuePair.Key, CreateDataEntryValueCopy(keyValuePair.Value));
}
return dictionary;
}
if (type.IsArray)
{
Array array = (Array)obj;
Array array2 = Array.CreateInstance(type.GetElementType(), array.Length);
for (int i = 0; i < array.Length; i++)
{
array2.SetValue(CreateDeepCopyForObject(array.GetValue(i)), i);
}
return array2;
}
if (type.IsValueType || type == typeof(string))
{
return obj;
}
object obj2 = Activator.CreateInstance(type);
FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
FieldInfo[] array3 = fields;
foreach (FieldInfo fieldInfo in array3)
{
object value = fieldInfo.GetValue(obj);
fieldInfo.SetValue(obj2, CreateDeepCopyForObject(value));
}
return obj2;
}
}
[HarmonyPatch]
public static class Patch
{
[HarmonyPatch(typeof(OrbFogHandler))]
public static class OrbFogHandlerrPatch
{
[HarmonyPatch("InitNewSphere")]
[HarmonyPostfix]
private static void InitNewSpherePatch(FogSphereOrigin newOrigin)
{
OrbFogHandler instance = Singleton<OrbFogHandler>.Instance;
if ((Object)(object)instance == (Object)null)
{
Plugin.logger.LogError((object)"MountainProgressHandlerPatch: OrbFogHandler is null 实例未找到!");
return;
}
fogSize = newOrigin.size;
Plugin.logger.LogInfo((object)$"MountainProgressHandlerPatch: 雾的初始大小为 fogsize= {fogSize}");
}
}
[HarmonyPatch(typeof(Campfire))]
private static class CampfirePatch
{
private static float clearTimer;
[HarmonyPatch("Light_Rpc")]
private static void Postfix(Campfire __instance)
{
if (PhotonNetwork.IsMasterClient && Plugin.instance.recordItemsAtCampfire.Value)
{
ReviewHandler.Instance.allPlayerRecordedItems = PlayerInventoryHelper.GetAllItems(Plugin.instance.recordItemsAtCampfire.Value);
}
}
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void UpdatePostfix(Campfire __instance)
{
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: 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_00b4: Invalid comparison between Unknown and I4
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Invalid comparison between Unknown and I4
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Invalid comparison between Unknown and I4
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Invalid comparison between Unknown and I4
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Invalid comparison between Unknown and I4
clearTimer += Time.deltaTime;
if (!Plugin.instance.campfireClearStatus.Value)
{
return;
}
Character localCharacter = Character.localCharacter;
if (!((Object)(object)localCharacter != (Object)null) || !((Object)(object)((Component)localCharacter).transform != (Object)null) || localCharacter.data.dead || localCharacter.refs.afflictions.currentStatuses.Length == 0 || !(Vector3.Distance(((Component)__instance).transform.position, Character.localCharacter.Center) <= __instance.moraleBoostRadius))
{
return;
}
int num = Enum.GetNames(typeof(STATUSTYPE)).Length;
for (int i = 0; i < num; i++)
{
STATUSTYPE val = (STATUSTYPE)i;
if ((int)val != 7 && (int)val != 4 && (int)val != 9 && (int)val != 5 && (int)val != 8 && clearTimer >= 3f)
{
localCharacter.refs.afflictions.SetStatus(val, 0f, true);
clearTimer = 0f;
}
}
}
}
[HarmonyPatch(typeof(MountainProgressHandler))]
private static class PatchMountainProgressHandler
{
[HarmonyPatch("CheckAreaAchievement")]
public static void Prefix(MountainProgressHandler __instance, ref ProgressPoint pointReached)
{
if (!(pointReached.title.ToLower() != "shore"))
{
ReviewHandler.Instance.ResetReviveTimes();
ReviewUI.ActivateDisplay();
gameStarted = true;
}
}
}
[HarmonyPatch(typeof(Character))]
public static class CharacterPatch
{
[HarmonyPatch("RPCEndGame")]
[HarmonyPostfix]
private static void RPCEndGamePostfix(Character __instance)
{
ReviewUI.isActive = false;
Plugin.logger.LogInfo((object)"复活次数已重置,篝火位置已清除");
gameStarted = false;
}
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void UpdatePostfix()
{
//IL_0064: 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_008c: Expected I4, but got Unknown
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
if (!PhotonNetwork.IsMasterClient || !gameStarted || (Object)(object)ReviewHandler.Instance == (Object)null || (Object)(object)Singleton<MapHandler>.Instance == (Object)null || (Object)(object)Singleton<MountainProgressHandler>.Instance == (Object)null || (Object)(object)Character.localCharacter == (Object)null)
{
return;
}
if (Input.GetKeyUp(Plugin.instance.respawnHotkey.Value))
{
ReviewHandler.Instance.RespawnAllAtCampfire();
}
int num = (int)Singleton<MapHandler>.Instance.GetCurrentSegment();
ProgressPoint val = Singleton<MountainProgressHandler>.Instance.progressPoints[num];
if (!Plugin.instance.recordItemsAtCampfire.Value || !CampfireTracker.LastCampfirePosition.HasValue || !(val.title.ToLower() == "shore"))
{
return;
}
float num2 = Vector3.Distance(Character.localCharacter.Center, CampfireTracker.LastCampfirePosition.Value);
if (num2 > 120f && ReviewHandler.Instance.allPlayerRecordedItems.Count == 0)
{
List<PlayerInventoryHelper.RecordedItem> allItems = PlayerInventoryHelper.GetAllItems(Plugin.instance.recordItemsAtCampfire.Value);
if (allItems.Count > 0)
{
ReviewHandler.Instance.SetHeroTitle("已记录玩家物品!", " Items Recorded");
}
ReviewHandler.Instance.allPlayerRecordedItems = allItems;
}
}
[HarmonyPatch("FixedUpdate")]
[HarmonyPostfix]
private static void FixedUpdatePostfix(Character __instance)
{
if (AllPlayerDeadOrDown() && PhotonNetwork.IsMasterClient && CampfireTracker.LastCampfirePosition.HasValue)
{
ReviewHandler.Instance.RespawnAllAtCampfire();
}
}
private static bool AllPlayerDeadOrDown()
{
foreach (Character allCharacter in Character.AllCharacters)
{
if ((Object)(object)allCharacter != (Object)null && !allCharacter.data.dead && !allCharacter.data.fullyPassedOut)
{
return false;
}
}
return true;
}
}
[HarmonyPatch(typeof(GUIManager))]
private static class GUIManagerPatch
{
[HarmonyPatch("Awake")]
[HarmonyPostfix]
private static void AwakePatch(GUIManager __instance)
{
InitUI(__instance);
}
private static void InitUI(GUIManager __instance)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Expected O, but got Unknown
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
AscentUI componentInChildren = ((Component)__instance).GetComponentInChildren<AscentUI>();
if ((Object)(object)componentInChildren == (Object)null)
{
return;
}
Transform val = (Transform)(RectTransform)Object.Instantiate<Transform>(((Component)componentInChildren).transform, ((Component)componentInChildren).transform.parent);
((Object)val).name = "ReviewUI";
Object.Destroy((Object)(object)((Component)val).GetComponent<AscentUI>());
((Component)val).gameObject.AddComponent<ReviewUI>();
RectTransform val2 = (RectTransform)(object)((val is RectTransform) ? val : null);
if ((Object)(object)val2 != (Object)null)
{
val2.anchorMin = new Vector2(0.5f, 0f);
val2.anchorMax = new Vector2(0.5f, 0f);
val2.pivot = new Vector2(0.5f, 0f);
val2.anchoredPosition = new Vector2(0f, 10f);
val2.sizeDelta = new Vector2(400f, 120f);
TMP_Text componentInChildren2 = ((Component)val2).GetComponentInChildren<TMP_Text>();
if ((Object)(object)componentInChildren2 != (Object)null)
{
componentInChildren2.alignment = (TextAlignmentOptions)257;
componentInChildren2.fontSize = 40f;
((Graphic)componentInChildren2).color = Color.white;
}
}
else
{
Plugin.logger.LogError((object)"ReviewUI必须挂载在RectTransform上");
}
}
}
[HarmonyPatch(typeof(RunManager))]
private static class RunManagerPatch
{
[HarmonyPatch("Awake")]
[HarmonyPostfix]
private static void AwakePostfix(RunManager __instance)
{
if ((Object)(object)((Component)__instance).gameObject.GetComponent<ReviewHandler>() == (Object)null)
{
((Component)__instance).gameObject.AddComponent<ReviewHandler>();
Plugin.logger.LogInfo((object)"RunManager中添加了ReviewHandler组件");
}
else
{
Plugin.logger.LogInfo((object)"RunManager中已存在ReviewHandler组件");
}
}
}
[HarmonyPatch(typeof(CharacterItems))]
private static class CharacterItemsPatch
{
[HarmonyPatch("DropItemFromSlotRPC")]
[HarmonyPrefix]
private static bool DropItemFromSlotRPCPatch(CharacterItems __instance, ref byte slotID, ref Vector3 spawnPosition)
{
//IL_013d: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
Plugin.logger.LogInfo((object)("正在尝试清空物品栏: " + slotID));
ItemSlot itemSlot = __instance.character.player.GetItemSlot(slotID);
if (!itemSlot.IsEmpty())
{
if (PhotonNetwork.IsMasterClient)
{
GameObject val = PhotonNetwork.Instantiate("0_Items/" + itemSlot.GetPrefabName(), spawnPosition, Quaternion.identity, (byte)0, (object[])null);
PhotonView component = val.GetComponent<PhotonView>();
component.RPC("SetItemInstanceDataRPC", (RpcTarget)0, new object[1] { itemSlot.data });
component.RPC("SetKinematicRPC", (RpcTarget)0, new object[3]
{
false,
((Component)component).transform.position,
((Component)component).transform.rotation
});
Item component2 = val.GetComponent<Item>();
if (Object.op_Implicit((Object)(object)component2))
{
((MonoBehaviourPun)component2).photonView.RPC("RPC_SetThrownData", (RpcTarget)0, new object[2]
{
((MonoBehaviourPun)__instance.character).photonView.ViewID,
1.1f
});
}
}
__instance.character.player.EmptySlot(Optionable<byte>.Some(slotID));
}
__instance.character.refs.afflictions.UpdateWeight();
return false;
}
}
public static float fogSize = 300f;
public static bool gameStarted = false;
}
public class ReviewUI : MonoBehaviourPun
{
private float displayTimer = 0f;
public TMP_Text text;
public static bool isActive;
public float timer = 0f;
public static ReviewUI instance;
private void Awake()
{
instance = this;
text = ((Component)this).GetComponentInChildren<TMP_Text>();
text.richText = true;
}
private void Update()
{
if (isActive)
{
text.text = $"<color=red><size=45>♥</color></size>{Plugin.instance.respawnMaxTimes.Value - ReviewHandler.Instance.reviveTimes}";
displayTimer -= Time.deltaTime;
if (displayTimer <= 0f)
{
isActive = false;
}
}
else
{
text.text = " ";
}
}
public static void ActivateDisplay()
{
isActive = true;
instance.displayTimer = 10f;
}
}
public class ReviewHandler : MonoBehaviourPun
{
[CompilerGenerated]
private sealed class <>c__DisplayClass12_0
{
public Item item;
internal bool <RespawnAllItem>b__0()
{
return (Object)(object)((MonoBehaviourPun)item).photonView != (Object)null && ((MonoBehaviourPun)item).photonView.ViewID != 0;
}
}
[CompilerGenerated]
private sealed class <IERestLava>d__18 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public ReviewHandler <>4__this;
private LavaRising <lava>5__1;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <IERestLava>d__18(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<lava>5__1 = null;
<>1__state = -2;
}
private bool MoveNext()
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<lava>5__1 = Singleton<LavaRising>.Instance;
if ((Object)(object)<lava>5__1 != (Object)null)
{
<lava>5__1.started = true;
<lava>5__1.ended = false;
<lava>5__1.timeTraveled = 0f;
<lava>5__1.secondsWaitedToStart = 0f;
<>2__current = null;
<>1__state = 1;
return true;
}
goto IL_00c7;
case 1:
<>1__state = -1;
<lava>5__1.started = false;
<lava>5__1.shownLavaRisingMessage = false;
<lava>5__1.syncTime = 14f;
goto IL_00c7;
case 2:
{
<>1__state = -1;
return false;
}
IL_00c7:
<>2__current = null;
<>1__state = 2;
return true;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <RespawnAllItem>d__12 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public ReviewHandler <>4__this;
private List<Backpack> <backpacks>5__1;
private List<PlayerInventoryHelper.RecordedItem>.Enumerator <>s__2;
private PlayerInventoryHelper.RecordedItem <recordedItem>5__3;
private int <num>5__4;
private <>c__DisplayClass12_0 <>8__5;
private Character <player>5__6;
private List<Backpack>.Enumerator <>s__7;
private Backpack <backpack>5__8;
private Vector3 <pos>5__9;
private List<Item> <items>5__10;
private List<Item>.Enumerator <>s__11;
private Item <item>5__12;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <RespawnAllItem>d__12(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
int num = <>1__state;
if (num == -3 || (uint)(num - 2) <= 1u)
{
try
{
}
finally
{
<>m__Finally1();
}
}
<backpacks>5__1 = null;
<>s__2 = default(List<PlayerInventoryHelper.RecordedItem>.Enumerator);
<recordedItem>5__3 = null;
<>8__5 = null;
<player>5__6 = null;
<>s__7 = default(List<Backpack>.Enumerator);
<backpack>5__8 = null;
<items>5__10 = null;
<>s__11 = default(List<Item>.Enumerator);
<item>5__12 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0236: Unknown result type (might be due to invalid IL or missing references)
//IL_0240: Expected O, but got Unknown
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Expected O, but got Unknown
//IL_0321: Unknown result type (might be due to invalid IL or missing references)
//IL_019f: Unknown result type (might be due to invalid IL or missing references)
//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
//IL_01df: Unknown result type (might be due to invalid IL or missing references)
//IL_01e9: Expected O, but got Unknown
//IL_0350: Unknown result type (might be due to invalid IL or missing references)
//IL_0355: Unknown result type (might be due to invalid IL or missing references)
//IL_037d: Unknown result type (might be due to invalid IL or missing references)
//IL_038a: Unknown result type (might be due to invalid IL or missing references)
//IL_044d: Unknown result type (might be due to invalid IL or missing references)
//IL_0453: Invalid comparison between Unknown and I4
try
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
if (!Plugin.instance.recordItemsAtCampfire.Value)
{
<>4__this.allPlayerRecordedItems = PlayerInventoryHelper.GetAllItems(Plugin.instance.recordItemsAtCampfire.Value);
}
goto IL_009c;
case 1:
<>1__state = -1;
goto IL_009c;
case 2:
<>1__state = -3;
((MonoBehaviourPun)<>8__5.item).photonView.RPC("SetItemInstanceDataRPC", (RpcTarget)0, new object[1] { <recordedItem>5__3.data });
break;
case 3:
{
<>1__state = -3;
<>8__5.item.RequestPickup(((MonoBehaviourPun)<player>5__6).photonView);
Plugin.logger.LogInfo((object)("已将物品:" + <recordedItem>5__3.itemName + "返还给了" + ((Object)<player>5__6.player).name));
<>8__5 = null;
<player>5__6 = null;
goto IL_02b6;
}
IL_009c:
if (<>4__this.AllPlayerDeadOrDown())
{
<>2__current = (object)new WaitForSeconds(0.5f);
<>1__state = 1;
return true;
}
Plugin.logger.LogInfo((object)"开始恢复所有物品....");
<>s__2 = <>4__this.allPlayerRecordedItems.GetEnumerator();
<>1__state = -3;
goto IL_02be;
IL_02b6:
<recordedItem>5__3 = null;
goto IL_02be;
IL_02be:
do
{
if (<>s__2.MoveNext())
{
<recordedItem>5__3 = <>s__2.Current;
<num>5__4 = Random.Range(0, 100);
continue;
}
<>m__Finally1();
<>s__2 = default(List<PlayerInventoryHelper.RecordedItem>.Enumerator);
<backpacks>5__1 = Object.FindObjectsByType<Backpack>((FindObjectsSortMode)0).ToList();
<>s__7 = <backpacks>5__1.GetEnumerator();
try
{
while (<>s__7.MoveNext())
{
<backpack>5__8 = <>s__7.Current;
if ((int)((Item)<backpack>5__8).itemState == 0 && !((Object)(object)((Item)<backpack>5__8).lastThrownCharacter == (Object)null))
{
<pos>5__9 = ((Item)<backpack>5__8).lastThrownCharacter.Center;
((MonoBehaviourPun)<backpack>5__8).photonView.RPC("SetKinematicRPC", (RpcTarget)3, new object[3]
{
false,
<pos>5__9,
Quaternion.identity
});
Plugin.logger.LogInfo((object)"已将背包返还.");
<backpack>5__8 = null;
}
}
}
finally
{
((IDisposable)<>s__7).Dispose();
}
<>s__7 = default(List<Backpack>.Enumerator);
if (Plugin.instance.recordItemsAtCampfire.Value)
{
<items>5__10 = Object.FindObjectsByType<Item>((FindObjectsSortMode)0).ToList();
<>s__11 = <items>5__10.GetEnumerator();
try
{
while (<>s__11.MoveNext())
{
<item>5__12 = <>s__11.Current;
if ((Object)(object)<item>5__12.lastThrownCharacter != (Object)null && (int)<item>5__12.itemState == 0)
{
Plugin.logger.LogInfo((object)("正在清除遗留物品:" + ((Object)<item>5__12).name));
Object.Destroy((Object)(object)((Component)<item>5__12).gameObject);
}
<item>5__12 = null;
}
}
finally
{
((IDisposable)<>s__11).Dispose();
}
<>s__11 = default(List<Item>.Enumerator);
<items>5__10 = null;
}
<>4__this.allPlayerRecordedItems.Clear();
return false;
}
while (<num>5__4 >= Plugin.instance.respawnItemChance.Value);
if ((Object)(object)<recordedItem>5__3.player != (Object)null && !<recordedItem>5__3.player.data.dead)
{
<>8__5 = new <>c__DisplayClass12_0();
<player>5__6 = <recordedItem>5__3.player;
<>8__5.item = <recordedItem>5__3.item ?? PhotonNetwork.InstantiateItemRoom(<recordedItem>5__3.itemName, <player>5__6.Center, Quaternion.identity).GetComponent<Item>();
if (<recordedItem>5__3.data != null)
{
<>2__current = (object)new WaitUntil((Func<bool>)(() => (Object)(object)((MonoBehaviourPun)<>8__5.item).photonView != (Object)null && ((MonoBehaviourPun)<>8__5.item).photonView.ViewID != 0));
<>1__state = 2;
return true;
}
break;
}
goto IL_02b6;
}
<>2__current = (object)new WaitForSeconds(0.5f);
<>1__state = 3;
return true;
}
catch
{
//try-fault
((IDisposable)this).Dispose();
throw;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
private void <>m__Finally1()
{
<>1__state = -1;
((IDisposable)<>s__2).Dispose();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private static float lastRespawnTime;
public List<PlayerInventoryHelper.RecordedItem> allPlayerRecordedItems = new List<PlayerInventoryHelper.RecordedItem>();
public int reviveTimes;
public static ReviewHandler Instance { get; private set; }
private void Awake()
{
Instance = this;
}
public void AddReviveTimes()
{
reviveTimes++;
if (reviveTimes >= Plugin.instance.respawnMaxTimes.Value)
{
ReviewUI.isActive = false;
}
else
{
ReviewUI.ActivateDisplay();
}
((MonoBehaviourPun)this).photonView.RPC("RPCA_SetReviveTimes", (RpcTarget)0, new object[1] { reviveTimes });
}
public void ResetReviveTimes()
{
lastRespawnTime = 0f;
reviveTimes = 0;
((MonoBehaviourPun)this).photonView.RPC("RPCA_SetReviveTimes", (RpcTarget)0, new object[1] { reviveTimes });
}
[PunRPC]
public void RPCA_SetReviveTimes(int times)
{
reviveTimes = times;
}
public void RespawnAllAtCampfire()
{
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: 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_0177: 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)
if (!CampfireTracker.LastCampfirePosition.HasValue || !PhotonNetwork.IsMasterClient || Time.time - lastRespawnTime < 5f || Instance.reviveTimes >= Plugin.instance.respawnMaxTimes.Value)
{
return;
}
lastRespawnTime = Time.time;
ResetFog();
ResetLava();
float num = Random.Range(-3f, 3f);
float num2 = Random.Range(-3f, 3f);
Vector3 value = CampfireTracker.LastCampfirePosition.Value;
((Vector3)(ref value))..ctor(value.x + num, value.y + 1f, value.z + num2);
Plugin.logger.LogInfo((object)$"在篝火位置复活所有玩家: {CampfireTracker.LastCampfirePosition.Value}");
foreach (Character allCharacter in Character.AllCharacters)
{
if ((Object)(object)allCharacter != (Object)null)
{
if (allCharacter.data.dead)
{
((MonoBehaviourPun)allCharacter).photonView.RPC("RPCA_ReviveAtPosition", (RpcTarget)3, new object[2]
{
value,
Plugin.instance.reviveAddCurse.Value
});
}
else
{
allCharacter.WarpPlayer(CampfireTracker.LastCampfirePosition.Value, true);
}
allCharacter.refs.afflictions.ClearAllStatus(true);
}
}
SetHeroTitle("继续加油", "Nice Try");
Instance.AddReviveTimes();
((MonoBehaviour)this).StartCoroutine(RespawnAllItem());
}
[IteratorStateMachine(typeof(<RespawnAllItem>d__12))]
public IEnumerator RespawnAllItem()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <RespawnAllItem>d__12(0)
{
<>4__this = this
};
}
private bool AllPlayerDeadOrDown()
{
foreach (Character allCharacter in Character.AllCharacters)
{
if ((Object)(object)allCharacter != (Object)null && !allCharacter.data.dead && !allCharacter.data.fullyPassedOut)
{
return false;
}
}
return true;
}
public void SetHeroTitle(string CNtitle, string ENtitle)
{
((MonoBehaviourPun)this).photonView.RPC("RpcSetHeroTitle", (RpcTarget)0, new object[2] { CNtitle, ENtitle });
}
[PunRPC]
private void RpcSetHeroTitle(string CNtitle, string ENtitle)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected I4, but got Unknown
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Invalid comparison between Unknown and I4
int num = (int)Singleton<MapHandler>.Instance.GetCurrentSegment();
ProgressPoint val = Singleton<MountainProgressHandler>.Instance.progressPoints[num];
if ((int)LocalizedText.CURRENT_LANGUAGE == 9)
{
GUIManager.instance.SetHeroTitle(CNtitle, val.clip);
}
else
{
GUIManager.instance.SetHeroTitle(ENtitle, val.clip);
}
}
public static void ResetFog()
{
OrbFogHandler instance = Singleton<OrbFogHandler>.Instance;
if ((Object)(object)instance != (Object)null)
{
instance.currentSize = Patch.fogSize;
instance.photonView.RPC("RPCA_SyncFog", (RpcTarget)0, new object[2]
{
Patch.fogSize,
instance.isMoving
});
}
}
public void ResetLava()
{
((MonoBehaviour)this).StartCoroutine(IERestLava());
}
[IteratorStateMachine(typeof(<IERestLava>d__18))]
private IEnumerator IERestLava()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <IERestLava>d__18(0)
{
<>4__this = this
};
}
}