using System;
using System.Collections.Generic;
using System.Diagnostics;
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 ExitGames.Client.Photon;
using HarmonyLib;
using NodeCanvas.Framework;
using NodeCanvas.Tasks.Actions;
using Photon;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("1e1b9780-3aae-4daf-ac5a-64675df2db98")]
[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 RaidMode;
[HarmonyPatch(typeof(AreaManager), "IsCoopRestricted")]
public class AreaManager_IsCoopRestricted
{
public static void Postfix(ref bool __result)
{
__result = false;
}
}
[HarmonyPatch(typeof(CharacterManager), "SendStartFastTravel")]
public class CharacterManager_SendStartFastTravel
{
public static bool Prefix()
{
if (RaidModeConfig.LiveSettings.ReviveNoManLeftBehind)
{
foreach (PlayerSystem item in Global.Lobby.PlayersInLobby)
{
if (Object.op_Implicit((Object)(object)item.ControlledCharacter) && item.ControlledCharacter.IsDead)
{
return false;
}
}
}
return true;
}
}
[HarmonyPatch(typeof(DefeatPlayerSpawn), "GetScatterPoint")]
public class DefeatPlayerSpawn_GetScatterPoint
{
public static void Postfix(DefeatPlayerSpawn __instance, ref Transform __result, Transform[] positions)
{
if (positions != null && __instance.ID >= positions.Length)
{
__result = positions[^1];
}
}
}
[HarmonyPatch(typeof(GiveReward), "OnExecute")]
public class GiveReward_OnExecute
{
private enum RewardType
{
SideQuestArtifact,
SideQuestSkill,
StoryArtifact,
StorySkill,
WorldArtifact
}
private static Dictionary<int, RewardType> rewardDatabase = new Dictionary<int, RewardType>
{
[2140120] = RewardType.SideQuestArtifact,
[3000210] = RewardType.SideQuestArtifact,
[3000212] = RewardType.SideQuestArtifact,
[3000211] = RewardType.SideQuestArtifact,
[3000043] = RewardType.SideQuestArtifact,
[3000041] = RewardType.SideQuestArtifact,
[3000040] = RewardType.SideQuestArtifact,
[5300170] = RewardType.SideQuestArtifact,
[5300160] = RewardType.SideQuestArtifact,
[2300180] = RewardType.SideQuestArtifact,
[3000360] = RewardType.SideQuestArtifact,
[3000362] = RewardType.SideQuestArtifact,
[3000361] = RewardType.SideQuestArtifact,
[5110070] = RewardType.SideQuestArtifact,
[8200031] = RewardType.SideQuestSkill,
[8100090] = RewardType.SideQuestSkill,
[8200010] = RewardType.SideQuestSkill,
[8100300] = RewardType.SideQuestSkill,
[8100310] = RewardType.SideQuestSkill,
[8100070] = RewardType.SideQuestSkill,
[8100100] = RewardType.SideQuestSkill,
[8100290] = RewardType.SideQuestSkill,
[8100362] = RewardType.SideQuestSkill,
[8100320] = RewardType.SideQuestSkill,
[8100270] = RewardType.SideQuestSkill,
[8100380] = RewardType.SideQuestSkill,
[8100340] = RewardType.SideQuestSkill,
[8200190] = RewardType.SideQuestSkill,
[8200130] = RewardType.SideQuestSkill,
[8200170] = RewardType.SideQuestSkill,
[8200140] = RewardType.SideQuestSkill,
[8200110] = RewardType.SideQuestSkill,
[8200180] = RewardType.SideQuestSkill,
[8201020] = RewardType.SideQuestSkill,
[8201021] = RewardType.SideQuestSkill,
[8201022] = RewardType.SideQuestSkill,
[8201023] = RewardType.SideQuestSkill,
[8201024] = RewardType.SideQuestSkill,
[8400018] = RewardType.SideQuestSkill,
[8400014] = RewardType.SideQuestSkill,
[8400019] = RewardType.SideQuestSkill,
[8400013] = RewardType.SideQuestSkill,
[8400021] = RewardType.SideQuestSkill,
[8400011] = RewardType.SideQuestSkill,
[3100040] = RewardType.StoryArtifact,
[3100042] = RewardType.StoryArtifact,
[3100041] = RewardType.StoryArtifact,
[3100090] = RewardType.StoryArtifact,
[3100092] = RewardType.StoryArtifact,
[3100091] = RewardType.StoryArtifact,
[2200100] = RewardType.StoryArtifact,
[5110097] = RewardType.StoryArtifact,
[3100031] = RewardType.StoryArtifact,
[3100030] = RewardType.StoryArtifact,
[2000031] = RewardType.StoryArtifact,
[5100080] = RewardType.StoryArtifact,
[4300270] = RewardType.StoryArtifact,
[5100110] = RewardType.StoryArtifact,
[8200100] = RewardType.StorySkill,
[8200105] = RewardType.StorySkill,
[8200104] = RewardType.StorySkill,
[8202004] = RewardType.StorySkill,
[8202005] = RewardType.StorySkill,
[8205280] = RewardType.StorySkill,
[8205350] = RewardType.StorySkill,
[8205340] = RewardType.StorySkill,
[8205330] = RewardType.StorySkill,
[8205310] = RewardType.StorySkill,
[8205999] = RewardType.StorySkill,
[8205998] = RewardType.StorySkill,
[8205261] = RewardType.StorySkill,
[8205997] = RewardType.StorySkill,
[8205270] = RewardType.StorySkill,
[8205260] = RewardType.StorySkill,
[8205311] = RewardType.StorySkill,
[8205300] = RewardType.StorySkill,
[8205240] = RewardType.StorySkill,
[2000151] = RewardType.WorldArtifact,
[2150170] = RewardType.WorldArtifact,
[2000320] = RewardType.WorldArtifact,
[2120270] = RewardType.WorldArtifact,
[2110260] = RewardType.WorldArtifact,
[2020070] = RewardType.WorldArtifact,
[2200190] = RewardType.WorldArtifact,
[2120070] = RewardType.WorldArtifact,
[2010280] = RewardType.WorldArtifact,
[2020330] = RewardType.WorldArtifact,
[2130310] = RewardType.WorldArtifact,
[2010070] = RewardType.WorldArtifact,
[2140060] = RewardType.WorldArtifact,
[2160230] = RewardType.WorldArtifact,
[2160100] = RewardType.WorldArtifact,
[2130021] = RewardType.WorldArtifact,
[2300360] = RewardType.WorldArtifact,
[5110112] = RewardType.WorldArtifact,
[5110340] = RewardType.WorldArtifact,
[5110002] = RewardType.WorldArtifact,
[2300030] = RewardType.WorldArtifact,
[5110005] = RewardType.WorldArtifact,
[3200030] = RewardType.WorldArtifact,
[3200032] = RewardType.WorldArtifact,
[3200031] = RewardType.WorldArtifact,
[5300070] = RewardType.WorldArtifact,
[5300030] = RewardType.WorldArtifact,
[5300180] = RewardType.WorldArtifact,
[5300050] = RewardType.WorldArtifact,
[5100510] = RewardType.WorldArtifact
};
public static void Postfix(GiveReward __instance)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Invalid comparison between Unknown and I4
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Invalid comparison between Unknown and I4
if ((int)__instance.RewardReceiver == 2)
{
return;
}
Character val = CharacterManager.Instance.GetWorldHostCharacter();
if ((int)__instance.RewardReceiver == 1 && ((Task)__instance).blackboard != null)
{
Variable<Character> variable = ((Task)__instance).blackboard.GetVariable<Character>("gInstigator");
if (variable != null)
{
val = variable.value;
}
}
List<Character> list = new List<Character>();
for (int i = 0; i < CharacterManager.Instance.PlayerCharacters.Count; i++)
{
Character character = CharacterManager.Instance.GetCharacter(CharacterManager.Instance.PlayerCharacters.Values[i]);
if (Object.op_Implicit((Object)(object)character) && (Object)(object)character != (Object)(object)val)
{
list.Add(character);
}
}
foreach (ItemQuantity item in __instance.ItemReward)
{
if (!rewardDatabase.TryGetValue(item.Item.value.ItemID, out var value))
{
continue;
}
switch (value)
{
case RewardType.SideQuestArtifact:
if (!RaidModeConfig.LiveSettings.ShareSideQuestArtifacts)
{
continue;
}
break;
case RewardType.SideQuestSkill:
if (!RaidModeConfig.LiveSettings.ShareSideQuestSkills)
{
continue;
}
break;
case RewardType.StoryArtifact:
if (!RaidModeConfig.LiveSettings.ShareStoryArtifacts)
{
continue;
}
break;
case RewardType.StorySkill:
if (!RaidModeConfig.LiveSettings.ShareStorySkills)
{
continue;
}
break;
case RewardType.WorldArtifact:
if (!RaidModeConfig.LiveSettings.ShareWorldArtifacts)
{
continue;
}
break;
}
foreach (Character item2 in list)
{
int num = ((item.Quantity == null) ? 1 : item.Quantity.value);
bool flag = item.TryToEquip != null && item.TryToEquip.value;
if (item.Item.value.RefItem is Skill)
{
item2.Inventory.ReceiveSkillReward(item.Item.value.ItemID);
}
else
{
item2.Inventory.ReceiveItemReward(item.Item.value.ItemID, num, flag);
}
}
}
}
}
[HarmonyPatch(typeof(CharacterStats), "ApplyCoopStats")]
public class CharacterStats_ApplyCoopStats
{
public static bool Prefix(CharacterStats __instance)
{
if (NetworkLevelLoader.Instance.IsGameplayLoading)
{
__instance.m_delayedApplyCoopStats = true;
return false;
}
if (Object.op_Implicit((Object)(object)__instance.CoopStats))
{
if (!Object.op_Implicit((Object)(object)__instance.m_character))
{
__instance.m_character = ((Component)__instance).GetComponent<Character>();
}
float healthRatio = __instance.m_character.HealthRatio;
__instance.CoopStats.ApplyToCharacter(__instance.m_character, Global.Lobby.PlayersInLobbyCount);
__instance.m_character.Stats.UpdateStats();
__instance.m_character.Stats.SetHealth(healthRatio * __instance.m_character.Stats.ActiveMaxHealth);
}
return false;
}
}
[HarmonyPatch(typeof(InteractionRevive), "OnActivate")]
public class InteractionRevive_OnActivate
{
public static bool Prefix(InteractionBase __instance)
{
if (RaidModeConfig.LiveSettings.ReviveCombatRestrictions == RaidModeConfig.ReviveCombatSetting.OnlyReviver && Global.CombatManager.PlayersInCombat.Contains(__instance.LastCharacter))
{
if (__instance.LastCharacter.IsLocalPlayer)
{
__instance.LastCharacter.CharacterUI.ShowInfoNotification("Must be out of combat to revive a teammate!");
}
__instance.InterruptActivation();
return false;
}
if (RaidModeConfig.LiveSettings.ReviveCombatRestrictions == RaidModeConfig.ReviveCombatSetting.Party && Global.CombatManager.PlayersInCombat.Count > 0)
{
if (__instance.LastCharacter.IsLocalPlayer)
{
__instance.LastCharacter.CharacterUI.ShowInfoNotification("The party must be out of combat to revive a teammate!");
}
__instance.InterruptActivation();
return false;
}
if (RaidModeConfig.LiveSettings.ReviveItemNeeded)
{
if (!__instance.LastCharacter.Inventory.OwnsItem(4400010) && !__instance.LastCharacter.Inventory.OwnsItem(4300010) && !__instance.LastCharacter.Inventory.OwnsItem(4300240))
{
if (__instance.LastCharacter.IsLocalPlayer)
{
__instance.LastCharacter.CharacterUI.ShowInfoNotification("A healing item is required to revive a teammate.");
}
__instance.InterruptActivation();
return false;
}
if (__instance.LastCharacter.Inventory.OwnsItem(4400010))
{
if (PhotonNetwork.isMasterClient)
{
__instance.LastCharacter.Inventory.RemoveItem(4400010, 1);
}
if (__instance.LastCharacter.IsLocalPlayer)
{
__instance.LastCharacter.CharacterUI.ShowInfoNotification("Used a Bandage to revive teammate.");
}
}
else if (__instance.LastCharacter.Inventory.OwnsItem(4300010))
{
if (PhotonNetwork.isMasterClient)
{
__instance.LastCharacter.Inventory.RemoveItem(4300010, 1);
}
if (__instance.LastCharacter.IsLocalPlayer)
{
__instance.LastCharacter.CharacterUI.ShowInfoNotification("Used a Life Potion to revive teammate.");
}
}
else
{
if (PhotonNetwork.isMasterClient)
{
__instance.LastCharacter.Inventory.RemoveItem(4300240, 1);
}
if (__instance.LastCharacter.IsLocalPlayer)
{
__instance.LastCharacter.CharacterUI.ShowInfoNotification("Used a Great Life Potion to revive teammate.");
}
}
}
return true;
}
}
[HarmonyPatch(typeof(InteractionSwitchArea), "OnActivate")]
public class InteractionSwitchArea_OnActivate
{
public static bool Prefix(InteractionSwitchArea __instance)
{
if (RaidModeConfig.LiveSettings.ReviveNoManLeftBehind)
{
foreach (PlayerSystem item in Global.Lobby.PlayersInLobby)
{
if (Object.op_Implicit((Object)(object)item.ControlledCharacter) && item.ControlledCharacter.IsDead)
{
if (((InteractionBase)__instance).LastCharacter.IsLocalPlayer)
{
((InteractionBase)__instance).LastCharacter.CharacterUI.ShowInfoNotification("Can not leave area while there are downed teammates!");
}
((InteractionBase)__instance).InterruptActivation();
return false;
}
}
}
return true;
}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class PeerBase_CreatePeerBase
{
public static bool Prefix(PeerBase __instance, ref int __result)
{
__result = 60000;
return false;
}
}
[HarmonyPatch(typeof(InteractionSleep), "ProcessText")]
public class InteractionSleep_ProcessText
{
public static bool Prefix(InteractionSleep __instance)
{
if (RaidModeConfig.LiveSettings.CozyBeds && __instance.m_sleepableScript.IsInnsBed)
{
__instance.m_sleepableScript.Capacity = 2;
}
else
{
__instance.m_sleepableScript.Capacity = 1;
}
return true;
}
}
[HarmonyPatch(typeof(CurrentRoomNameDisplay), "OnEnable")]
public class CurrentRoomNameDisplay_OnEnable
{
public static void Postfix(CurrentRoomNameDisplay __instance)
{
if (RaidModeConfig.LiveSettings.HideRoomName)
{
__instance.m_lblRoomName.text = "-";
}
else
{
__instance.m_lblRoomName.text = PhotonNetwork.room.Name;
}
}
}
[HarmonyPatch(typeof(CharacterBarListener), "UpdateDisplay")]
public class CharacterBarListener_UpdateDisplay
{
public static void Postfix(CharacterBarListener __instance)
{
if (Object.op_Implicit((Object)(object)__instance.TargetCharacter) && Object.op_Implicit((Object)(object)__instance.TargetCharacter.OwnerPlayerSys) && (Object)(object)__instance.TargetCharacter != (Object)(object)((UIElement)__instance).CharacterUI.TargetCharacter && Object.op_Implicit((Object)(object)__instance.m_healthBar) && Object.op_Implicit((Object)(object)__instance.m_healthBar.m_lblValue))
{
__instance.m_healthBar.HideIfFull = !RaidModeConfig.LiveSettings.ShowNameplates;
((Component)__instance.m_healthBar.m_lblValue).gameObject.SetActive(RaidModeConfig.LiveSettings.ShowNameplates || (Object.op_Implicit((Object)(object)MenuManager.Instance) && MenuManager.Instance.DisplayDebugInfo));
if (RaidModeConfig.LiveSettings.ShowNameplates)
{
__instance.m_healthBar.m_lblValue.text = __instance.TargetCharacter.Name;
}
}
}
}
[HarmonyPatch(typeof(CharacterBarListener), "UpdateVisibility")]
public class CharacterBarListener_UpdateVisibility
{
public static void Postfix(CharacterBarListener __instance)
{
if (Object.op_Implicit((Object)(object)__instance.TargetCharacter) && Object.op_Implicit((Object)(object)__instance.TargetCharacter.OwnerPlayerSys) && (Object)(object)__instance.TargetCharacter != (Object)(object)((UIElement)__instance).CharacterUI.TargetCharacter && Object.op_Implicit((Object)(object)((UIElement)__instance).LocalCharacter) && ((UIElement)__instance).LocalCharacter.IsStartInitDone && Object.op_Implicit((Object)(object)__instance.m_targetCharacterBarManager) && Object.op_Implicit((Object)(object)((UIElement)__instance).LocalCharacter.CharacterCamera) && Object.op_Implicit((Object)(object)((UIElement)__instance).LocalCharacter.CharacterCamera.CameraScript))
{
__instance.m_targetCharacterBarManager.DisplayDistance = 100000f;
if (RaidModeConfig.LiveSettings.ShowNameplates && RaidModeConfig.LiveSettings.ShowNameplatesGlobally)
{
__instance.m_inRange = true;
__instance.UpdateSeenByCamera();
__instance.m_inSight = true;
}
else
{
__instance.m_inRange = __instance.m_sqrDistanceWithLocalPlayer <= 400f;
}
}
}
}
[HarmonyPatch(typeof(RepairEquipmentNodeAction), "OnExecute")]
public class RepairEquipmentNodeAction_OnExecute
{
public static bool Prefix()
{
if (RaidModeConfig.LiveSettings.ShareBlacksmithRepairs)
{
for (int i = 0; i < CharacterManager.Instance.PlayerCharacters.Count; i++)
{
Character character = CharacterManager.Instance.GetCharacter(CharacterManager.Instance.PlayerCharacters.Values[i]);
if (Object.op_Implicit((Object)(object)character) && Object.op_Implicit((Object)(object)character.Inventory))
{
character.Inventory.RepairEverything(false);
}
}
}
return true;
}
}
[HarmonyPatch(typeof(RoomCreationPanel), "Show", new Type[]
{
typeof(string),
typeof(UnityAction<string>),
typeof(UnityAction)
})]
public class RoomCreationPanel_Show
{
public static bool Prefix(RoomCreationPanel __instance)
{
if (RaidModeConfig.LiveSettings.HideRoomName)
{
__instance.m_txtRoomName.inputType = (InputType)2;
}
else
{
__instance.m_txtRoomName.inputType = (InputType)0;
}
return true;
}
}
[HarmonyPatch(typeof(NetworkCharacterControl), "Update")]
public class NetworkCharacterControl_Update
{
public static bool Prefix(NetworkCharacterControl __instance)
{
if (!((CharacterControl)__instance).m_character.IsAI && !((CharacterControl)__instance).m_character.SendInitDone && ((CharacterControl)__instance).m_character.Initialized && NetworkLevelLoader.Instance.IsOverallLoadingDone)
{
((MonoBehaviour)__instance).photonView.RPC("RequestInitInfo", ((MonoBehaviour)__instance).photonView.owner, new object[1] { PhotonNetwork.player });
((CharacterControl)__instance).m_character.SendInitDone = true;
}
return true;
}
}
[HarmonyPatch(typeof(Item), "UpdateProcessing")]
public class Item_UpdateProcessing
{
public static bool Prefix(Item __instance)
{
__instance.m_updateSpeed = 0f;
return true;
}
}
[HarmonyPatch(typeof(OtherPlayersCompass), "Update")]
public class OtherPlayersCompass_Update
{
public static bool Prefix(OtherPlayersCompass __instance)
{
for (int i = 0; i < ((CompassElement<Character>)(object)__instance).m_watchedElements.Length; i++)
{
((CompassElement<Character>)(object)__instance).m_watchedElements[i] = null;
}
return true;
}
}
public class NetworkLevelLoader_Patch : MonoBehaviour
{
[HarmonyPatch(typeof(NetworkLevelLoader), "UpdateCheckAllPlayerDoneLoading")]
public class NetworkLevelLoader_UpdateCheckAllPlayerDoneLoading
{
public static void Postfix(NetworkLevelLoader __instance)
{
if (!PhotonNetwork.isNonMasterClientInRoom || s_isSendingGameplayResumedRequest)
{
return;
}
if (s_lastGameplayResumedResult)
{
PhotonPlayer player = PhotonNetwork.player;
PhotonPlayer[] playerList = PhotonNetwork.playerList;
foreach (PhotonPlayer val in playerList)
{
if (val.ID != player.ID)
{
if (!__instance.m_doneLoadingPlayers.Contains(val.ID))
{
__instance.m_doneLoadingPlayers.Add(val.ID);
}
if (!__instance.m_readyToContinuePlayers.Contains(val.ID))
{
__instance.m_readyToContinuePlayers.Add(val.ID);
}
}
}
}
else
{
SendRequestIsGameplayResumed();
}
}
}
internal static NetworkLevelLoader_Patch Instance;
internal const int VIEW_ID = 980;
internal static bool s_isSendingGameplayResumedRequest;
internal static bool s_lastGameplayResumedResult;
public static void Init()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: 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)
GameObject val = new GameObject("RaidModeNetLevelLoaderRPC");
Object.DontDestroyOnLoad((Object)val);
((Object)val).hideFlags = (HideFlags)(((Object)val).hideFlags | 0x3D);
Instance = val.AddComponent<NetworkLevelLoader_Patch>();
val.AddComponent<PhotonView>().viewID = 980;
}
public static void SendRequestIsGameplayResumed()
{
if (!s_isSendingGameplayResumedRequest)
{
s_lastGameplayResumedResult = false;
s_isSendingGameplayResumedRequest = true;
((MonoBehaviour)Instance).photonView.RPC("ReceiveRequestIsGameplayResumed", (PhotonTargets)2, Array.Empty<object>());
}
}
[PunRPC]
public void ReceiveRequestIsGameplayResumed(PhotonMessageInfo info)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
PhotonView photonView = ((MonoBehaviour)Instance).photonView;
PhotonPlayer sender = info.sender;
object[] array = new object[1];
int num;
if (!NetworkLevelLoader.Instance.IsGameplayPaused)
{
CharacterManager instance = CharacterManager.Instance;
num = (Object.op_Implicit((Object)(object)((instance != null) ? instance.GetFirstLocalCharacter() : null)) ? 1 : 0);
}
else
{
num = 0;
}
array[0] = (byte)num != 0;
photonView.RPC("ReceiveIsGameplayResumed", sender, array);
}
[PunRPC]
public void ReceiveIsGameplayResumed(bool resumed)
{
s_lastGameplayResumedResult = resumed;
s_isSendingGameplayResumedRequest = false;
}
}
[HarmonyPatch(typeof(RPCManager), "SendItemSplitSyncToMaster")]
public class RPCManager_SendItemSplitSyncToMaster
{
public static bool Prefix(RPCManager __instance, string _itemInfos)
{
((MonoBehaviour)__instance).photonView.RPC("SendItemSyncRPC", (PhotonTargets)1, new object[2] { _itemInfos, true });
return false;
}
}
[HarmonyPatch(typeof(ItemManager), "UpdateSyncItem")]
public class ItemManager_UpdateSyncItem
{
public static bool Prefix(ItemManager __instance)
{
__instance.m_itemSyncTimer = 0f;
return true;
}
}
[HarmonyPatch(typeof(ItemManager), "LoadItemsForCharacter")]
public class ItemManager_LoadItemsForCharacter
{
public static void Postfix(ItemManager __instance, string _charUID, BasicSaveData[] _itemSaves)
{
string text = __instance.ItemSavesToString(_itemSaves);
if (!PhotonNetwork.inRoom || PhotonNetwork.isMasterClient)
{
__instance.DestroyAllItemsOfChar(_charUID);
__instance.OnReceiveItemSync(text, (ItemSyncType)2, (string)null);
}
else if (_itemSaves.Length != 0)
{
__instance.OnReceiveItemSync(text, (ItemSyncType)2, _charUID);
ItemManager.CompressDataToSend(text, ref ItemManager.m_pendingSyncItemInfos);
for (int i = 0; i < ItemManager.m_pendingSyncItemInfos.Count; i++)
{
((MonoBehaviour)__instance).photonView.RPC("SendLoadItemsForCharacter", (PhotonTargets)1, new object[4]
{
_charUID,
ItemManager.m_pendingSyncItemInfos[i],
i,
ItemManager.m_pendingSyncItemInfos.Count
});
}
}
}
}
[HarmonyPatch(typeof(ItemManager), "LoadStashForCharacter")]
public class ItemManager_LoadStashForCharacter
{
public static void Postfix(ItemManager __instance, string _charUID, BasicSaveData[] _stashedItems)
{
string text = __instance.ItemSavesToString(_stashedItems);
if (!PhotonNetwork.inRoom || PhotonNetwork.isMasterClient)
{
__instance.DestroyAllStashedItemsOfChar(_charUID);
__instance.OnReceiveItemSync(text, (ItemSyncType)5, _charUID);
}
else if (_stashedItems.Length != 0)
{
__instance.OnReceiveItemSync(text, (ItemSyncType)5, _charUID);
ItemManager.CompressDataToSend(text, ref ItemManager.m_pendingSyncItemInfos);
for (int i = 0; i < ItemManager.m_pendingSyncItemInfos.Count; i++)
{
((MonoBehaviour)__instance).photonView.RPC("SendLoadStashItemsForCharacter", (PhotonTargets)1, new object[4]
{
_charUID,
ItemManager.m_pendingSyncItemInfos[i],
i,
ItemManager.m_pendingSyncItemInfos.Count
});
}
}
}
}
[HarmonyPatch(typeof(Character), "SlowDown")]
public class Character_SlowDown
{
public static bool Prefix(Character __instance, ref float _slowVal, ref float _timeTo, ref float _timeStay, ref float _timeFrom)
{
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Invalid comparison between Unknown and I4
if (RaidModeConfig.LiveSettings.DifficultyMode == RaidModeConfig.DifficultyModeSetting.NoScaling || RaidModeConfig.LiveSettings.DifficultyMode == RaidModeConfig.DifficultyModeSetting.JustVanilla)
{
return true;
}
if (RaidModeConfig.LiveSettings.DifficultyMode == RaidModeConfig.DifficultyModeSetting.Custom && RaidModeConfig.LiveSettings.SlowdownScaling)
{
return true;
}
int manualDifficultyScaling = RaidModeConfig.LiveSettings.ManualDifficultyScaling;
int num = ((manualDifficultyScaling > 0) ? manualDifficultyScaling : Global.Lobby.PlayersInLobbyCount);
if (num == 0)
{
return true;
}
if ((int)__instance.Faction != 1)
{
float num2 = ((RaidModeConfig.LiveSettings.DifficultyMode == RaidModeConfig.DifficultyModeSetting.VanillaPlus) ? 1f : 0f);
float num3 = (1f + num2) / (float)num / (RaidModeConfig.LiveSettings.HardMode ? 2f : 1f);
_slowVal *= num3;
_timeTo *= num3;
_timeStay *= num3;
_timeFrom *= num3;
}
return true;
}
}
[HarmonyPatch(typeof(Character), "Resurrect", new Type[]
{
typeof(PlayerSaveData),
typeof(bool)
})]
public class Character_Resurrect
{
public static bool Prefix(Character __instance, PlayerSaveData _resurrectState, bool _playAnim)
{
if (_resurrectState != null && _playAnim)
{
_resurrectState.BurntHealth -= __instance.ActiveMaxHealth * 0.5f;
float num = __instance.ActiveMaxHealth * ((float)RaidModeConfig.LiveSettings.RevivalHealthBurn / 100f);
_resurrectState.BurntHealth += num;
float num2 = _resurrectState.Stamina * ((float)RaidModeConfig.LiveSettings.RevivalStaminaBurn / 100f);
_resurrectState.BurntStamina += num2;
}
return true;
}
}
[HarmonyPatch(typeof(Character), "Knock")]
public class Character_Knock
{
public static void Postfix(Character __instance, bool _down)
{
if (RaidModeConfig.LiveSettings.StabilityRework && _down && !__instance.Dodging)
{
__instance.StatusEffectMngr.CleanseStatusEffect("Confusion");
}
}
}
[HarmonyPatch(typeof(Character), "StabilityHit")]
public class Character_StabilityHit
{
public static bool Prefix(Character __instance, float _knockValue, float _angle, bool _block, Character _dealerChar)
{
//IL_0402: Unknown result type (might be due to invalid IL or missing references)
//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
if (!RaidModeConfig.LiveSettings.StabilityRework)
{
return true;
}
float stability = __instance.m_stability;
float num = _knockValue;
if (__instance.IsPetrified)
{
num = 0f;
}
if (num < 0f)
{
num = 0f;
}
if (!__instance.m_impactImmune && num > 0f && !__instance.m_pendingDeath)
{
if (__instance.Stats.CurrentStamina < 1f)
{
float num2 = __instance.m_shieldStability + __instance.m_stability - 49f;
if (num < num2)
{
num = num2;
}
}
__instance.m_timeOfLastStabilityHit = Time.time;
if ((Object)(object)__instance.CharacterCamera != (Object)null && num > 0f)
{
__instance.CharacterCamera.Hit(num * 6f);
}
if (_block && __instance.m_shieldStability > 0f)
{
if (num > __instance.m_shieldStability)
{
__instance.m_stability -= num - __instance.m_shieldStability;
}
__instance.m_shieldStability = Mathf.Clamp(__instance.m_shieldStability - num, 0f, 50f);
}
else
{
__instance.m_stability = Mathf.Clamp(__instance.m_stability - num, 0f, 100f);
}
if (__instance.m_stability <= 0f)
{
if ((!__instance.IsAI && ((MonoBehaviour)__instance).photonView.isMine) || (__instance.IsAI && ((Object)(object)_dealerChar == (Object)null || ((MonoBehaviour)_dealerChar).photonView.isMine)))
{
((MonoBehaviour)__instance).photonView.RPC("SendKnock", (PhotonTargets)0, new object[2] { true, __instance.m_stability });
}
else
{
__instance.Knock(true);
}
__instance.m_stability = 0f;
if (__instance.IsPhotonPlayerLocal)
{
__instance.BlockInput(false);
}
((MonoBehaviour)__instance).Invoke("DelayedCheckFootStep", 0.1f);
}
else if (__instance.m_stability <= 50f)
{
if (stability > 50f && __instance.m_knockbackCount == 0f)
{
if ((!__instance.IsAI && ((MonoBehaviour)__instance).photonView.isMine) || (__instance.IsAI && ((Object)(object)_dealerChar == (Object)null || ((MonoBehaviour)_dealerChar).photonView.isMine)))
{
((MonoBehaviour)__instance).photonView.RPC("SendKnock", (PhotonTargets)0, new object[2] { false, __instance.m_stability });
}
else
{
__instance.Knock(false);
}
}
else if (__instance.m_stability <= 33f && stability > 33f && __instance.m_knockbackCount <= 1f)
{
if ((!__instance.IsAI && ((MonoBehaviour)__instance).photonView.isMine) || (__instance.IsAI && ((Object)(object)_dealerChar == (Object)null || ((MonoBehaviour)_dealerChar).photonView.isMine)))
{
((MonoBehaviour)__instance).photonView.RPC("SendKnock", (PhotonTargets)0, new object[2] { false, __instance.m_stability });
}
else
{
__instance.Knock(false);
}
}
else if (__instance.m_stability <= 16f && stability > 16f && __instance.m_knockbackCount <= 2f)
{
if ((!__instance.IsAI && ((MonoBehaviour)__instance).photonView.isMine) || (__instance.IsAI && ((Object)(object)_dealerChar == (Object)null || ((MonoBehaviour)_dealerChar).photonView.isMine)))
{
((MonoBehaviour)__instance).photonView.RPC("SendKnock", (PhotonTargets)0, new object[2] { false, __instance.m_stability });
}
else
{
__instance.Knock(false);
}
}
if (__instance.IsPhotonPlayerLocal && _block)
{
__instance.BlockInput(false);
}
}
else if (!_block)
{
if (__instance.m_knockHurtAllowed)
{
__instance.m_hurtType = (HurtType)0;
if (__instance.m_currentlyChargingAttack)
{
__instance.CancelCharging();
}
__instance.m_animator.SetTrigger("Knockhurt");
if (__instance.knockhurt != null)
{
((MonoBehaviour)__instance).StopCoroutine(__instance.knockhurt);
}
__instance.knockhurt = ((MonoBehaviour)__instance).StartCoroutine(__instance.KnockhurtRoutine(num));
}
}
else
{
__instance.m_hurtType = (HurtType)3;
if (__instance.InLocomotion)
{
__instance.m_animator.SetTrigger("BlockHit");
}
}
__instance.m_animator.SetInteger("KnockAngle", (int)_angle);
UnityAction stabilityHitCall = __instance.StabilityHitCall;
if (stabilityHitCall != null)
{
stabilityHitCall.Invoke();
}
}
return false;
}
}
[HarmonyPatch(typeof(ConnectPhotonMaster), "CreateOrJoin")]
public class ConnectPhotonMaster_CreateOrJoin
{
public static bool Prefix(string _roomName)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: 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_002a: Expected O, but got Unknown
PhotonNetwork.JoinOrCreateRoom(_roomName, new RoomOptions
{
IsVisible = true,
MaxPlayers = (byte)(RaidModeConfig.LiveSettings.PlayerLimit + 1)
}, TypedLobby.Default);
return false;
}
}
[HarmonyPatch(typeof(ConnectPhotonMaster), "CreateRoom", new Type[]
{
typeof(string),
typeof(int),
typeof(string),
typeof(bool),
typeof(int)
})]
public class ConnectPhotonMaster_CreateRoom
{
public static bool Prefix(string _roomName, int _storeID, string _lobbyID, bool _hardcore, int _dlcid)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Expected O, but got Unknown
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
RoomOptions val = new RoomOptions();
Hashtable val2 = new Hashtable();
if (_storeID != -1 && !string.IsNullOrEmpty(_lobbyID))
{
((Dictionary<object, object>)(object)val2).Add((object)"Store", (object)_storeID);
((Dictionary<object, object>)(object)val2).Add((object)"LobbyID", (object)_lobbyID);
}
((Dictionary<object, object>)(object)val2).Add((object)"Hardcore", (object)_hardcore);
((Dictionary<object, object>)(object)val2).Add((object)"AreaDLC", (object)_dlcid);
val.CustomRoomProperties = val2;
val.IsVisible = true;
val.MaxPlayers = (byte)(RaidModeConfig.LiveSettings.PlayerLimit + 1);
PhotonNetwork.CreateRoom(_roomName, val, TypedLobby.Default);
return false;
}
}
[HarmonyPatch(typeof(CoopStats), "ApplyToCharacter")]
public class CoopStats_ApplyToCharacter
{
public static bool Prefix(Character _char)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0072: 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_0198: Unknown result type (might be due to invalid IL or missing references)
//IL_019f: Expected O, but got Unknown
//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
//IL_01af: Unknown result type (might be due to invalid IL or missing references)
//IL_01da: Unknown result type (might be due to invalid IL or missing references)
//IL_01e1: Expected O, but got Unknown
//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
//IL_021c: Unknown result type (might be due to invalid IL or missing references)
//IL_0223: Expected O, but got Unknown
//IL_022e: Unknown result type (might be due to invalid IL or missing references)
//IL_0233: Unknown result type (might be due to invalid IL or missing references)
//IL_0339: Unknown result type (might be due to invalid IL or missing references)
//IL_0340: Expected O, but got Unknown
//IL_034b: Unknown result type (might be due to invalid IL or missing references)
//IL_0350: Unknown result type (might be due to invalid IL or missing references)
CharacterStats stats = _char.Stats;
stats.RemoveStatStack(TagSourceManager.Instance.GetTag(UID.op_Implicit("77")), "Coop_Stat", true);
stats.RemoveStatStack(TagSourceManager.Instance.GetTag(UID.op_Implicit("95")), "Coop_Stat", true);
stats.RemoveStatStack(TagSourceManager.Instance.GetTag(UID.op_Implicit("96")), "Coop_Stat", true);
stats.RemoveStatStack(TagSourceManager.Instance.GetTag(UID.op_Implicit("84")), "Coop_Stat", false);
if (RaidModeConfig.LiveSettings.DifficultyMode == RaidModeConfig.DifficultyModeSetting.NoScaling)
{
return false;
}
if (RaidModeConfig.LiveSettings.DifficultyMode == RaidModeConfig.DifficultyModeSetting.JustVanilla)
{
if (Global.Lobby.PlayersInLobbyCount > 1)
{
return true;
}
return false;
}
int manualDifficultyScaling = RaidModeConfig.LiveSettings.ManualDifficultyScaling;
int num = ((manualDifficultyScaling > 0) ? (manualDifficultyScaling + 1) : Global.Lobby.PlayersInLobbyCount);
if (RaidModeConfig.LiveSettings.DifficultyMode == RaidModeConfig.DifficultyModeSetting.VanillaPlus)
{
VanillaPlus(_char, num, stats.CoopStats.StatData);
return false;
}
float num2 = 0.5f;
float num3 = 0.1f;
float num4 = 0.1f;
float num5 = 0.5f;
if (RaidModeConfig.LiveSettings.DifficultyMode == RaidModeConfig.DifficultyModeSetting.Custom)
{
num2 = (float)RaidModeConfig.LiveSettings.HealthScaling / 100f;
num3 = (float)RaidModeConfig.LiveSettings.ImpactDamageScaling / 100f;
num4 = (float)RaidModeConfig.LiveSettings.DamageScaling / 100f;
num5 = (float)RaidModeConfig.LiveSettings.EffectiveStabilityScaling / 100f;
}
float num6 = ((!RaidModeConfig.LiveSettings.HardMode) ? 1 : 2);
float num7 = num2 * ((float)num - 1f) * num6;
StatStack val = new StatStack("Coop_Stat", -1f, num7, (Tag[])null);
stats.AddStatStack(TagSourceManager.Instance.GetTag(UID.op_Implicit("77")), val, true);
float num8 = num3 * ((float)num - 1f) * num6;
StatStack val2 = new StatStack("Coop_Stat", -1f, num8, (Tag[])null);
stats.AddStatStack(TagSourceManager.Instance.GetTag(UID.op_Implicit("95")), val2, true);
float num9 = num4 * ((float)num - 1f) * num6;
StatStack val3 = new StatStack("Coop_Stat", -1f, num9, (Tag[])null);
stats.AddStatStack(TagSourceManager.Instance.GetTag(UID.op_Implicit("96")), val3, true);
float num10 = stats.ImpactResistanceStat.BaseValue + _char.Inventory.Equipment.GetEquipmentImpactResistance();
float num11 = 0f;
if (num10 < 100f)
{
float num12 = 1f - num10 / 100f;
float num13 = 1f / num12;
float num14 = (num13 / (1f / (float)num) - num13) * num5 * num6 + num13;
float num15 = 1f / num14;
num11 = (1f - num15) * 100f - num10;
}
else if (num10 - 25f < 100f)
{
float num16 = 1f - (num10 - 25f) / 100f;
float num17 = 1f / num16;
float num18 = (num17 / (1f / (float)num) - num17) * num5 * num6 + num17;
float num19 = 1f / num18;
num11 = (1f - num19) * 100f - num10 + 0.25f;
}
StatStack val4 = new StatStack("Coop_Stat", -1f, num11, (Tag[])null);
stats.AddStatStack(TagSourceManager.Instance.GetTag(UID.op_Implicit("84")), val4, false);
return false;
}
public static bool VanillaPlus(Character _char, float _playerCount, CoopStatData[] statData)
{
//IL_0036: 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_008d: Expected O, but got Unknown
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Expected O, but got Unknown
//IL_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_0163: Expected O, but got Unknown
//IL_016e: 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_01ac: Unknown result type (might be due to invalid IL or missing references)
//IL_01b3: Expected O, but got Unknown
//IL_01be: Unknown result type (might be due to invalid IL or missing references)
//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
//IL_02fd: Expected O, but got Unknown
//IL_0308: Unknown result type (might be due to invalid IL or missing references)
//IL_030d: Unknown result type (might be due to invalid IL or missing references)
CharacterStats stats = _char.Stats;
List<string> list = new List<string>();
float num = 0f;
float num2 = ((!RaidModeConfig.LiveSettings.HardMode) ? 1 : 2);
for (int i = 0; i < statData.Length; i++)
{
if (statData[i].Stat.Tag.TagName == "ImpactResistance" && _playerCount > 2f)
{
num = statData[i].Value[0];
continue;
}
float num3 = statData[i].Value[0] * (_playerCount - 1f) * num2;
StatStack val = new StatStack("Coop_Stat", -1f, num3, (Tag[])null);
stats.AddStatStack(statData[i].Stat.Tag, val, statData[i].Modifier);
list.Add(statData[i].Stat.Tag.TagName);
}
if (_playerCount > 2f)
{
if (!list.Contains("MaxHealth"))
{
float num4 = 0.5f * (_playerCount - 2f) * num2;
StatStack val2 = new StatStack("Coop_Stat", -1f, num4, (Tag[])null);
stats.AddStatStack(TagSourceManager.Instance.GetTag(UID.op_Implicit("77")), val2, true);
}
if (!list.Contains("Impact"))
{
float num5 = 0.75f * (_playerCount - 2f) * num2;
StatStack val3 = new StatStack("Coop_Stat", -1f, num5, (Tag[])null);
stats.AddStatStack(TagSourceManager.Instance.GetTag(UID.op_Implicit("95")), val3, true);
}
if (!list.Contains("AllDamages"))
{
float num6 = 0.15f * (_playerCount - 2f) * num2;
StatStack val4 = new StatStack("Coop_Stat", -1f, num6, (Tag[])null);
stats.AddStatStack(TagSourceManager.Instance.GetTag(UID.op_Implicit("96")), val4, true);
}
float num7 = stats.ImpactResistanceStat.BaseValue + _char.Inventory.Equipment.GetEquipmentImpactResistance();
float num13;
if (num7 < 100f)
{
float num8 = 1f - num7 / 100f;
float num9 = 1f / num8;
float num10 = 1f - (num7 + num) / 100f;
float num11 = (1f / num10 - num9) * (_playerCount - 1f) * num2 + num9;
float num12 = 1f / num11;
num13 = (1f - num12) * 100f - num7;
}
else if (num7 - 25f < 100f)
{
float num14 = 1f - (num7 - 25f) / 100f;
float num15 = 1f / num14;
float num16 = 1f - (num7 - 25f + num) / 100f;
float num17 = (1f / num16 - num15) * (_playerCount - 1f) * num2 + num15;
float num18 = 1f / num17;
num13 = (1f - num18) * 100f - num7 + 25f;
}
else
{
num13 = num;
}
StatStack val5 = new StatStack("Coop_Stat", -1f, num13, (Tag[])null);
stats.AddStatStack(TagSourceManager.Instance.GetTag(UID.op_Implicit("84")), val5, false);
}
return false;
}
}
[HarmonyPatch(typeof(PauseMenu), "Update")]
public class PauseMenu_Update
{
public static bool Prefix(PauseMenu __instance)
{
if (((UIElement)__instance).m_hideWanted && ((UIElement)__instance).IsDisplayed && Time.time - ((UIElement)__instance).m_lastToggleTime >= ((UIElement)__instance).MinActiveTime)
{
((UIElement)__instance).OnHide();
}
if (((Panel)__instance).m_displayTarget != 0)
{
((Panel)__instance).UpdateShowHide();
}
if (Object.op_Implicit((Object)(object)((UIElement)__instance).LocalCharacter))
{
if ((((UIElement)__instance).LocalCharacter.Alive && ((Selectable)__instance.m_btnSplit).interactable != PhotonNetwork.offlineMode) || PhotonNetwork.isMasterClient)
{
((Selectable)__instance.m_btnSplit).interactable = PhotonNetwork.offlineMode || PhotonNetwork.isMasterClient;
}
else if (!((UIElement)__instance).LocalCharacter.Alive && ((Selectable)__instance.m_btnSplit).interactable)
{
((Selectable)__instance.m_btnSplit).interactable = false;
}
if (!__instance.m_suicide && ((Input.GetKey((KeyCode)304) && Input.GetKey((KeyCode)308) && Input.GetKeyDown((KeyCode)117)) || ControlsInput.GamepadUnstuckCheat(((UIElement)__instance).PlayerID)))
{
__instance.m_suicide = true;
if (Object.op_Implicit((Object)(object)__instance.m_btnDie) && !((Component)__instance.m_btnDie).gameObject.activeSelf)
{
((Component)__instance.m_btnDie).gameObject.SetActive(true);
}
}
}
while (__instance.m_actionQueue.Count > 0)
{
__instance.m_actionQueue.Dequeue()?.Invoke();
}
return false;
}
}
[HarmonyPatch(typeof(PauseMenu), "Show")]
public class PauseMenu_Show
{
public static void Postfix(PauseMenu __instance)
{
((Selectable)__instance.m_btnSplit).interactable = PhotonNetwork.offlineMode || PhotonNetwork.isMasterClient;
((Selectable)__instance.m_btnToggleNetwork).interactable = StoreManager.Instance.AllowOnlineFeatures && !ConnectPhotonMaster.Instance.RequestingRooms;
}
}
[HarmonyPatch(typeof(PauseMenu), "OnToggleNetwork")]
public class PauseMenu_OnToggleNetwork
{
public static bool Prefix(PauseMenu __instance)
{
if (PhotonNetwork.offlineMode)
{
__instance.m_gameNamingWindow.Show(LocalizationManager.Instance.GetLoc("MessageBox_Online_RoomNameCreate"), (UnityAction<string>)__instance.OnConfirmRoomCreation);
return false;
}
return true;
}
}
[HarmonyPatch(typeof(QuestEventManager), "SetQuestEventStack")]
public class QuestEventManager_SetQuestEventStack
{
public static bool Prefix(QuestEventManager __instance, string _eventUID, int _stackAmount, bool _sendEvent, ref bool __result)
{
QuestEventData val = default(QuestEventData);
if (!QuestEventManager.m_questEvents.TryGetValue(_eventUID, ref val))
{
__result = __instance.AddEvent(_eventUID, _stackAmount, _sendEvent);
return false;
}
val.ResetTime();
val.SetStack(_stackAmount);
__instance.NotifyOnQEAddedListeners(val);
if (_sendEvent)
{
if (!PhotonNetwork.isNonMasterClientInRoom)
{
((MonoBehaviour)__instance).photonView.RPC("SendSyncQuestEventAdd", (PhotonTargets)1, new object[2]
{
_eventUID,
val.ToNetworkData()
});
}
else
{
((MonoBehaviour)__instance).photonView.RPC("SendSetQuestEventStack", (PhotonTargets)1, new object[2] { _eventUID, _stackAmount });
}
}
__result = true;
return false;
}
}
[HarmonyPatch(typeof(QuestEventManager), "AddEvent", new Type[]
{
typeof(string),
typeof(int),
typeof(bool)
})]
public class QuestEventManager_AddEvent
{
public static bool Prefix(QuestEventManager __instance, ref bool __result, string _eventUID, int _stackAmount, bool _sendEvent)
{
if (string.IsNullOrEmpty(_eventUID))
{
Debug.LogError((object)"Tryied to add event but received empty UID");
__result = false;
return false;
}
QuestEventData val = null;
if (!QuestEventManager.m_questEvents.TryGetValue(_eventUID, ref val))
{
val = QuestEventData.CreateEventData(_eventUID);
if (val == null)
{
__result = false;
return false;
}
val.SetStack(_stackAmount);
QuestEventManager.m_questEvents.Add(_eventUID, val);
}
else if (val.IsStackable)
{
val.IncreaseStack(_stackAmount);
}
if (val.IsEphemeral)
{
QuestEventManager.m_ephemeralEvents.Add(val.EventUID);
}
val.UpdateTime();
__instance.NotifyOnQEAddedListeners(val);
if (_sendEvent)
{
if (!PhotonNetwork.isNonMasterClientInRoom)
{
((MonoBehaviour)__instance).photonView.RPC("SendSyncQuestEventAdd", (PhotonTargets)1, new object[2]
{
_eventUID,
val.ToNetworkData()
});
}
else
{
((MonoBehaviour)__instance).photonView.RPC("SendAddQuestEvent", (PhotonTargets)1, new object[2] { _eventUID, _stackAmount });
}
}
__result = true;
return false;
}
}
public class RaidModeConfig : MonoBehaviour
{
public enum DifficultyModeSetting
{
Default,
Custom,
VanillaPlus,
JustVanilla,
NoScaling
}
public enum ReviveCombatSetting
{
Anytime,
OnlyReviver,
Party
}
public struct SettingsData
{
public bool HideRoomName;
public int PlayerLimit;
public bool ShowNameplates;
public bool ShowNameplatesGlobally;
public DifficultyModeSetting DifficultyMode;
public bool HardMode;
public int ManualDifficultyScaling;
public int RevivalHealthBurn;
public int RevivalStaminaBurn;
public bool StabilityRework;
public int DamageScaling;
public int EffectiveStabilityScaling;
public int HealthScaling;
public int ImpactDamageScaling;
public bool SlowdownScaling;
public ReviveCombatSetting ReviveCombatRestrictions;
public bool ReviveItemNeeded;
public bool ReviveNoManLeftBehind;
public bool CozyBeds;
public bool ShareBlacksmithRepairs;
public bool ShareSideQuestArtifacts;
public bool ShareSideQuestSkills;
public bool ShareStoryArtifacts;
public bool ShareStorySkills;
public bool ShareWorldArtifacts;
}
private static ConfigEntry<bool> HideRoomName;
private static ConfigEntry<int> PlayerLimit;
private static ConfigEntry<bool> ShowNameplates;
private static ConfigEntry<bool> ShowNameplatesGlobally;
private static ConfigEntry<DifficultyModeSetting> DifficultyMode;
private static ConfigEntry<bool> HardMode;
private static ConfigEntry<int> ManualDifficultyScaling;
private static ConfigEntry<int> RevivalHealthBurn;
private static ConfigEntry<int> RevivalStaminaBurn;
private static ConfigEntry<bool> StabilityRework;
private static ConfigEntry<int> DamageScaling;
private static ConfigEntry<int> EffectiveStabilityScaling;
private static ConfigEntry<int> HealthScaling;
private static ConfigEntry<int> ImpactDamageScaling;
private static ConfigEntry<bool> SlowdownScaling;
private static ConfigEntry<ReviveCombatSetting> ReviveCombatRestrictions;
private static ConfigEntry<bool> ReviveItemNeeded;
private static ConfigEntry<bool> ReviveNoManLeftBehind;
private static ConfigEntry<bool> CozyBeds;
private static ConfigEntry<bool> ShareBlacksmithRepairs;
private static ConfigEntry<bool> ShareSideQuestArtifacts;
private static ConfigEntry<bool> ShareSideQuestSkills;
private static ConfigEntry<bool> ShareStoryArtifacts;
private static ConfigEntry<bool> ShareStorySkills;
private static ConfigEntry<bool> ShareWorldArtifacts;
internal static RaidModeConfig Instance;
internal const int VIEW_ID = 981;
public static SettingsData LiveSettings;
private static bool settingsChanged = false;
private static bool updateChars = false;
private static int _playerCount = 1;
public static void Init(ConfigFile config)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: 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_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Expected O, but got Unknown
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_0189: Expected O, but got Unknown
//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
//IL_01c9: Expected O, but got Unknown
//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0209: Expected O, but got Unknown
//IL_0272: Unknown result type (might be due to invalid IL or missing references)
//IL_027c: Expected O, but got Unknown
//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
//IL_02bc: Expected O, but got Unknown
//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
//IL_02fc: Expected O, but got Unknown
//IL_0332: Unknown result type (might be due to invalid IL or missing references)
//IL_033c: Expected O, but got Unknown
GameObject val = new GameObject("RaidModeConfigRPC");
Object.DontDestroyOnLoad((Object)val);
((Object)val).hideFlags = (HideFlags)(((Object)val).hideFlags | 0x3D);
Instance = val.AddComponent<RaidModeConfig>();
val.AddComponent<PhotonView>().viewID = 981;
string text = "";
HideRoomName = config.Bind<bool>(text, "Hide Room Name", false, "Obfuscates the room name when entering it and hides it in the pause menu.\nThis option is for people that wanna hide from the world, or more specifically, their chat.");
HideRoomName.SettingChanged += SettingChanged;
PlayerLimit = config.Bind<int>(text, "Party Limit", 5, new ConfigDescription("The maximum number of players that can join your party.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 10), Array.Empty<object>()));
PlayerLimit.SettingChanged += SettingChanged;
ShowNameplates = config.Bind<bool>(text, "Show Nameplates", true, "Enable nameplates for other players.");
ShowNameplates.SettingChanged += SettingChanged;
ShowNameplatesGlobally = config.Bind<bool>(text, "Show Nameplates Globally", true, "Show player nameplates no matter how far away they are and through walls.");
ShowNameplatesGlobally.SettingChanged += SettingChanged;
string text2 = "Difficulty";
DifficultyMode = config.Bind<DifficultyModeSetting>(text2, "Difficulty Mode", DifficultyModeSetting.Default, "Choose what kind of difficulty scaling Raid Mode will use to balance the game as more players join.\n\n- Raid Mode - \n A new scaling mode that is less agressive than vanilla's scaling. But limits abusive tactics by players and is arguably the most balanced mode.\n\n- Custom Mode -\n Use the customization options below to tune your own experience.\n\n- Vanilla Plus - \n Based on the vanilla difficulty scaling. But extends it to work beyond just 2 players. Is the toughest mode and is way more aggressive than Raid Mode's Default mode.\n\n- Just Vanilla -\n Leaves the game's difficulty scaling alone. This is not advised when in parties of 3 or more. As the vanilla scaling doesn't generally handle anything beyond 2 players.\n\n- No Scaling -\n Completely disables all scaling. Good for players that wanna play with friends but don't want the game to be any tougher than when playing alone.");
DifficultyMode.SettingChanged += DifficultySettingChanged;
HardMode = config.Bind<bool>(text2, "Hard Mode", false, "Doubles the difficulty scaling per player for the Raid Mode, Custom Mode, and Vanilla Plus difficulty modes.");
HardMode.SettingChanged += DifficultySettingChanged;
ManualDifficultyScaling = config.Bind<int>(text2, "Manual Difficulty Scaling", 0, new ConfigDescription("Values above 0 will force the difficulty scaling to calculate the difficulty as if there was that many extra players in the party instead of the actual count.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>()));
ManualDifficultyScaling.SettingChanged += DifficultySettingChanged;
RevivalHealthBurn = config.Bind<int>(text2, "Revival Health Burn", 50, new ConfigDescription("Sets how much of a player's current max health is burned when they are revived by another player.\nIt is recommended to keep this value high to limit revive chaining abuse in tough fights.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
RevivalHealthBurn.SettingChanged += SettingChanged;
RevivalStaminaBurn = config.Bind<int>(text2, "Revival Stamina Burn", 50, new ConfigDescription("Sets how much of a player's current stamina is burned when they are revived by another player.\nIt is recommended to keep this value high to limit revive chaining abuse in tough fights.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
RevivalStaminaBurn.SettingChanged += SettingChanged;
StabilityRework = config.Bind<bool>(text2, "Stability Rework", true, "Changes some aspects of the stability system to make it less abusable, especially in multiplayer.\nIt is highly recommended to be left enabled in co-op. But it does make the game tougher.\nThe main change is that enemies are now only staggered when their stability is brought below the new 50%, 33%, and 16% breakpoints. And they are only knocked down when brought to 0% stability.");
StabilityRework.SettingChanged += SettingChanged;
string text3 = "Difficulty Custom Mode";
DamageScaling = config.Bind<int>(text3, "Damage Scaling", 10, new ConfigDescription("The damage bonus given to enemies for each extra player in the game.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
DamageScaling.SettingChanged += DifficultySettingChanged;
EffectiveStabilityScaling = config.Bind<int>(text3, "Effective Stability Scaling", 50, new ConfigDescription("The effective stability increase given to genemies for each extra player in the game.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
EffectiveStabilityScaling.SettingChanged += DifficultySettingChanged;
HealthScaling = config.Bind<int>(text3, "Health Scaling", 50, new ConfigDescription("The health bonus given to enemies for each extra player in the game.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
HealthScaling.SettingChanged += DifficultySettingChanged;
ImpactDamageScaling = config.Bind<int>(text3, "Impact Damage Scaling", 10, new ConfigDescription("The impact damage bonus given to enemies for each extra player in the game.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
ImpactDamageScaling.SettingChanged += DifficultySettingChanged;
SlowdownScaling = config.Bind<bool>(text3, "Slowdown Scaling", true, "Enables the scaling down of the animation slowdown effect on enemies when they are hit or hit others.\nThis stops a large group of players from effectively freezing enemies in place when hitting them all at once repeatedly.");
SlowdownScaling.SettingChanged += SettingChanged;
string text4 = "Revive Restrictions";
ReviveCombatRestrictions = config.Bind<ReviveCombatSetting>(text4, "Combat Resitrictions", ReviveCombatSetting.Anytime, "Sets whether there should be restrictions on reviving teammates when the revivor or any player in the party is in combat.");
ReviveCombatRestrictions.SettingChanged += SettingChanged;
ReviveItemNeeded = config.Bind<bool>(text4, "Healing Item Needed", true, "Sets whether a healing item is needed to revive a downed teammate.");
ReviveItemNeeded.SettingChanged += SettingChanged;
ReviveNoManLeftBehind = config.Bind<bool>(text4, "No Man Left Behind", true, "Sets whether an area can be left when there are downed teammates.\nIn vanilla, a sole surviving player could enter a different area and all their downed teammates would be transported with them.");
ReviveNoManLeftBehind.SettingChanged += SettingChanged;
string text5 = "Sharing Options";
CozyBeds = config.Bind<bool>(text5, "Cozy Beds", true, "Lets two players share the beds in player houses and inns.");
CozyBeds.SettingChanged += SettingChanged;
ShareBlacksmithRepairs = config.Bind<bool>(text5, "Blacksmith Repairs", true, "Blacksmiths will repair the equipment of all players.");
ShareBlacksmithRepairs.SettingChanged += SettingChanged;
ShareSideQuestArtifacts = config.Bind<bool>(text5, "Side Quest Artifacts", false, "Artifact items awarded by side-quests will be awarded to all players.");
ShareSideQuestArtifacts.SettingChanged += SettingChanged;
ShareSideQuestSkills = config.Bind<bool>(text5, "Side Quest Skills", true, "Skills and passives awarded by side-quests will be awarded to all players.");
ShareSideQuestSkills.SettingChanged += SettingChanged;
ShareStoryArtifacts = config.Bind<bool>(text5, "Story Artifacts", false, "Artifact items awarded by story quests will be awarded to all players.");
ShareStoryArtifacts.SettingChanged += SettingChanged;
ShareStorySkills = config.Bind<bool>(text5, "Story Skills", false, "Skills and passives awarded by story quests will be awarded to all players.");
ShareStorySkills.SettingChanged += SettingChanged;
ShareWorldArtifacts = config.Bind<bool>(text5, "World Artifacts", false, "Artifact items found in the world will be awarded to all players.");
ShareWorldArtifacts.SettingChanged += SettingChanged;
Instance.UpdateLiveSettings(PopulateSettingsData());
}
private void Update()
{
if (PhotonNetwork.isMasterClient && _playerCount != Global.Lobby.PlayersInLobbyCount)
{
_playerCount = Global.Lobby.PlayersInLobbyCount;
updateChars = true;
}
if (settingsChanged || updateChars)
{
if (!PhotonNetwork.inRoom)
{
Instance.UpdateLiveSettings(PopulateSettingsData());
}
else
{
((MonoBehaviour)Instance).photonView.RPC("UpdateLiveSettings", (PhotonTargets)0, PopulateSettingsData());
}
}
}
private static void SettingChanged(object sender, EventArgs e)
{
if (PhotonNetwork.isMasterClient)
{
settingsChanged = true;
}
}
private static void DifficultySettingChanged(object sender, EventArgs e)
{
if (PhotonNetwork.isMasterClient)
{
settingsChanged = true;
updateChars = true;
}
}
[PunRPC]
public void UpdateLiveSettings(object[] data)
{
SettingsData liveSettings = default(SettingsData);
liveSettings.HideRoomName = (bool)data[1];
liveSettings.PlayerLimit = (int)data[2];
liveSettings.ShowNameplates = (bool)data[3];
liveSettings.ShowNameplatesGlobally = (bool)data[4];
liveSettings.DifficultyMode = (DifficultyModeSetting)data[5];
liveSettings.HardMode = (bool)data[6];
liveSettings.ManualDifficultyScaling = (int)data[7];
liveSettings.RevivalHealthBurn = (int)data[8];
liveSettings.RevivalStaminaBurn = (int)data[9];
liveSettings.StabilityRework = (bool)data[10];
liveSettings.DamageScaling = (int)data[11];
liveSettings.EffectiveStabilityScaling = (int)data[12];
liveSettings.HealthScaling = (int)data[13];
liveSettings.ImpactDamageScaling = (int)data[14];
liveSettings.SlowdownScaling = (bool)data[15];
liveSettings.ReviveCombatRestrictions = (ReviveCombatSetting)data[16];
liveSettings.ReviveItemNeeded = (bool)data[17];
liveSettings.ReviveNoManLeftBehind = (bool)data[18];
liveSettings.CozyBeds = (bool)data[19];
liveSettings.ShareBlacksmithRepairs = (bool)data[20];
liveSettings.ShareSideQuestArtifacts = (bool)data[21];
liveSettings.ShareSideQuestSkills = (bool)data[22];
liveSettings.ShareStoryArtifacts = (bool)data[23];
liveSettings.ShareStorySkills = (bool)data[24];
liveSettings.ShareWorldArtifacts = (bool)data[25];
LiveSettings = liveSettings;
settingsChanged = false;
if ((bool)data[0])
{
UpdateCharacters();
updateChars = false;
}
}
private static object[] PopulateSettingsData()
{
return new object[26]
{
updateChars,
HideRoomName.Value,
PlayerLimit.Value,
ShowNameplates.Value,
ShowNameplatesGlobally.Value,
(int)DifficultyMode.Value,
HardMode.Value,
ManualDifficultyScaling.Value,
RevivalHealthBurn.Value,
RevivalStaminaBurn.Value,
StabilityRework.Value,
DamageScaling.Value,
EffectiveStabilityScaling.Value,
HealthScaling.Value,
ImpactDamageScaling.Value,
SlowdownScaling.Value,
(int)ReviveCombatRestrictions.Value,
ReviveItemNeeded.Value,
ReviveNoManLeftBehind.Value,
CozyBeds.Value,
ShareBlacksmithRepairs.Value,
ShareSideQuestArtifacts.Value,
ShareSideQuestSkills.Value,
ShareStoryArtifacts.Value,
ShareStorySkills.Value,
ShareWorldArtifacts.Value
};
}
private static void UpdateCharacters()
{
if (!Object.op_Implicit((Object)(object)CharacterManager.Instance))
{
return;
}
foreach (Character value in CharacterManager.Instance.Characters.Values)
{
if (Object.op_Implicit((Object)(object)value.Stats))
{
value.Stats.m_delayedApplyCoopStats = true;
}
}
}
}
[BepInPlugin("com.spicerXD.raidmode", "Raid Mode", "4.2.5")]
public class RaidModeMod : BaseUnityPlugin
{
public void Awake()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
new Harmony("com.spicerxd.raidmode").PatchAll();
NetworkLevelLoader_Patch.Init();
RaidModeConfig.Init(((BaseUnityPlugin)this).Config);
Debug.Log((object)"Raid Mode: 4.2.4 loaded!");
}
}
[HarmonyPatch(typeof(RestingMenu), "StartInit")]
public class RestingMenu_StartInit
{
public static void Postfix(RestingMenu __instance)
{
if (Object.op_Implicit((Object)(object)__instance.m_sldOtherPlayerCursorTemplate))
{
for (int i = 0; i < __instance.m_sldOtherPlayerCursors.Length; i++)
{
Object.Destroy((Object)(object)((Component)__instance.m_sldOtherPlayerCursors[i]).gameObject);
__instance.m_sldOtherPlayerCursors[i] = null;
}
__instance.m_sldOtherPlayerCursors = (Slider[])(object)new Slider[19];
((Component)__instance.m_sldOtherPlayerCursorTemplate).gameObject.SetActive(true);
for (int j = 0; j < __instance.m_sldOtherPlayerCursors.Length; j++)
{
__instance.m_sldOtherPlayerCursors[j] = Object.Instantiate<Slider>(__instance.m_sldOtherPlayerCursorTemplate);
((Component)__instance.m_sldOtherPlayerCursors[j]).transform.SetParent(((Component)__instance.m_sldOtherPlayerCursorTemplate).transform.parent);
UnityEngineExtensions.ResetRectTrans(((Component)__instance.m_sldOtherPlayerCursors[j]).transform);
((Component)__instance.m_sldOtherPlayerCursors[j]).transform.Translate(0f, (float)(j + 1), 0f);
}
((Component)__instance.m_sldOtherPlayerCursorTemplate).gameObject.SetActive(false);
__instance.ResetMenu();
}
}
}
[HarmonyPatch(typeof(Sleepable), "CheckProximity")]
public class Sleepable_CheckProximity
{
public static bool Prefix(Sleepable __instance, ref int __result, Character _character)
{
//IL_0047: 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)
if (RaidModeConfig.LiveSettings.CozyBeds && __instance.IsInnsBed)
{
__instance.Capacity = 2;
}
else
{
__instance.Capacity = 1;
}
int num = 0;
if ((Object)(object)CharacterManager.Instance.RestLeader != (Object)null && Vector3.Distance(((Component)CharacterManager.Instance.RestLeader).transform.position, ((Component)_character).transform.position) > 40f)
{
num = 1;
}
if (num == 0)
{
num = ((__instance.m_occupants.Count >= __instance.Capacity) ? 2 : 0);
}
__result = num;
return false;
}
}