public IEnumerator ResetArea() { Dictionary <string, Vector3> positions = new Dictionary <string, Vector3>(); if (!PhotonNetwork.isNonMasterClientInRoom) { foreach (PlayerSystem ps in Global.Lobby.PlayersInLobby) { Character c = ps.ControlledCharacter; positions.Add(c.UID, c.transform.position); } } BlackFade.Instance.StartFade(true); yield return(new WaitForSeconds(1f)); IsBonfireInteracting = false; Area area = AreaManager.Instance.GetAreaFromSceneName(SceneManagerHelper.ActiveSceneName); float origReset = (float)At.GetValue(typeof(Area), area, "m_resetTime"); At.SetValue(-999, typeof(Area), area, "m_resetTime"); NetworkLevelLoader.Instance.ReloadLevel(0, true, -1, 0, true); while (NetworkLevelLoader.Instance.IsGameplayPaused) { yield return(null); } foreach (KeyValuePair <string, Vector3> entry in positions) { if (CharacterManager.Instance.GetCharacter(entry.Key) is Character c) { c.Teleport(entry.Value, Quaternion.identity); c.CharacterControl.InputLocked = false; At.SetValue(false, typeof(Character), c, "m_invincible"); c.Stats.RestoreAllVitals(); c.ResetCastType(); c.ForceCancel(true, true); } } Debug.Log("Restoring original reset time to " + origReset); At.SetValue(origReset, typeof(Area), area, "m_resetTime"); yield return(null); }
public static bool Prefix(AISCombat __instance) { var self = __instance; Character c = At.GetValue(typeof(AIState), self as AIState, "m_character") as Character; foreach (Weapon w in self.RequiredWeapon) { if (!c.Inventory.OwnsItem(w.ItemID)) { Item i = ItemManager.Instance.GenerateItemNetwork(w.ItemID); c.Inventory.TakeItem(i, false); } } return(true); }