namespace Harmony.GameEventManagerPatches { [HarmonyPatch(typeof(GameEventManager))] [HarmonyPatch("HandleAction")] [HarmonyPatch(new Type[] { typeof(string), typeof(EntityPlayer), typeof(Entity), typeof(bool), typeof(Vector3), typeof(string), typeof(string), typeof(bool), typeof(bool), typeof(string), typeof(GameEventActionSequence) })] public class HandleActionPatch { private static bool Prefix(GameEventManager __instance, ref bool __result, string name, EntityPlayer requester, Entity entity, bool twitchActivated, Vector3 targetPosition, string extraData, string tag, bool crateShare, bool allowRefunds, string sequenceLink, GameEventActionSequence ownerSeq ) { //Log.Out("GameEventManagerPatches-HandleAction START, name: " + name); if (name == "game_first_spawn") { if (GameUtils.IsPlaytesting()) { return false; } int playerLevel = requester.Progression.GetLevel(); int xpToNextLevel = requester.Progression.ExpToNextLevel; //Log.Out("GameEventManagerPatches-HandleAction playerLevel: " + playerLevel); //Log.Out("GameEventManagerPatches-HandleAction xpToNextLevel: " + xpToNextLevel); if (playerLevel == 1 && xpToNextLevel == 11024) { string optionJumpstart = RebirthVariables.customJumpstart; //Log.Out("GameEventManagerPatches-HandleAction optionJumpstart: " + optionJumpstart); if (RebirthVariables.customBiomeSpawn != "random" && RebirthVariables.customScenario == "none") { if (optionJumpstart != "none") { //Log.Out("GameEventManagerPatches-HandleAction JUMPSTART"); name = "game_first_spawn_jumpstart"; } else if (RebirthVariables.customScenario == "purge") { } else { //Log.Out("GameEventManagerPatches-HandleAction NORMAL"); name = "game_first_spawn_fr"; } } else { if (RebirthVariables.customScenario == "purge") { //name = "intro_purge"; } else { name = "game_first_spawn_scenario_fr"; } } } } if (SingletonMonoBehaviour.Instance.IsClient) { __result = __instance.HandleActionClient(name, entity, twitchActivated, targetPosition, extraData, tag, crateShare, allowRefunds, sequenceLink); return false; } if (GameEventManager.GameEventSequences.ContainsKey(name)) { GameEventActionSequence gameEventActionSequence = GameEventManager.GameEventSequences[name]; if (gameEventActionSequence.CanPerform(entity)) { if (gameEventActionSequence.SingleInstance) { for (int i = 0; i < __instance.ActionSequenceUpdates.Count; i++) { if (__instance.ActionSequenceUpdates[i].Name == name) { __result = false; return false; } } } GameEventActionSequence gameEventActionSequence2 = gameEventActionSequence.Clone(); gameEventActionSequence2.Target = entity; gameEventActionSequence2.TargetPosition = targetPosition; if (ownerSeq == null && sequenceLink != "" && requester != null) { ownerSeq = __instance.GetSequenceLink(requester, sequenceLink); } if (ownerSeq != null) { gameEventActionSequence2.Requester = ownerSeq.Requester; gameEventActionSequence2.ExtraData = ownerSeq.ExtraData; gameEventActionSequence2.CrateShare = ownerSeq.CrateShare; gameEventActionSequence2.Tag = ownerSeq.Tag; gameEventActionSequence2.AllowRefunds = ownerSeq.AllowRefunds; gameEventActionSequence2.TwitchActivated = ownerSeq.TwitchActivated; } else { gameEventActionSequence2.Requester = requester; gameEventActionSequence2.ExtraData = extraData; gameEventActionSequence2.CrateShare = crateShare; gameEventActionSequence2.Tag = tag; gameEventActionSequence2.AllowRefunds = allowRefunds; gameEventActionSequence2.TwitchActivated = twitchActivated; } gameEventActionSequence2.OwnerSequence = ownerSeq; if (gameEventActionSequence2.TargetType != GameEventActionSequence.TargetTypes.Entity) { gameEventActionSequence2.POIPosition = new Vector3i(targetPosition); } gameEventActionSequence2.SetupTarget(); __instance.ActionSequenceUpdates.Add(gameEventActionSequence2); __result = true; return false; } } __result = false; return false; } } }