Exemplo n.º 1
0
        public static bool Prefix(Player __instance)
        {
            long         playerID        = __instance.GetPlayerID();
            HardcoreData hardcoreProfile = Hardcore.GetHardcoreDataForProfileID(playerID);

            if (hardcoreProfile != null && hardcoreProfile.isHardcore)
            {
                hardcoreProfile.hasDied = true;

                Traverse tPlayer = Traverse.Create(__instance);
                tPlayer.Field <bool>("m_firstSpawn").Value = true;

                ZNetView nview = tPlayer.Field <ZNetView>("m_nview").Value;
                nview.GetZDO().Set("dead", true);
                nview.InvokeRPC(ZNetView.Everybody, "OnDeath", Array.Empty <object>());
                tPlayer.Method("CreateDeathEffects").GetValue(new object[] { });
                tPlayer.Field <GameObject>("m_visual").Value.SetActive(false);
                tPlayer.Field <List <Player.Food> >("m_foods").Value.Clear();

                __instance.UnequipAllItems();
                __instance.GetInventory().RemoveAll();

                if (Hardcore.Settings.ClearCustomSpawn.Value)
                {
                    Game.instance.GetPlayerProfile().ClearCustomSpawnPoint();
                }
                Game.instance.RequestRespawn(10f);

                Gogan.LogEvent("Game", "Death", "biome: " + __instance.GetCurrentBiome().ToString(), 0L);

                return(false);
            }

            return(true);
        }
Exemplo n.º 2
0
        public static bool Prefix()
        {
            long         profileID       = Game.instance.GetPlayerProfile().GetPlayerID();
            HardcoreData hardcoreProfile = Hardcore.GetHardcoreDataForProfileID(profileID);

            return(!(hardcoreProfile != null && hardcoreProfile.skipIntro));
        }
Exemplo n.º 3
0
        public static bool Prefix(Player __instance)
        {
            long         profileID    = __instance.GetPlayerID();
            HardcoreData hardcoreData = Hardcore.GetHardcoreDataForProfileID(profileID);

            return(!(hardcoreData != null && hardcoreData.skipIntro));
        }
Exemplo n.º 4
0
 public static void Postfix(ref List <PlayerProfile> __result)
 {
     if (Hardcore.Settings.HardcoreOnly.Value)
     {
         __result.RemoveAll(profile =>
         {
             HardcoreData data = Hardcore.GetHardcoreDataForProfileID(profile.GetPlayerID());
             return(data == null || !data.isHardcore);
         });
     }
 }
Exemplo n.º 5
0
        public static bool Prefix()
        {
            long         profileID       = Game.instance.GetPlayerProfile().GetPlayerID();
            HardcoreData hardcoreProfile = Hardcore.GetHardcoreDataForProfileID(profileID);

            if (hardcoreProfile != null)
            {
                return(!(hardcoreProfile.skipIntro || hardcoreProfile.hasDied));
            }

            return(true);
        }
Exemplo n.º 6
0
        public static void Postfix()
        {
            PlayerProfile playerProfile   = Game.instance.GetPlayerProfile();
            HardcoreData  hardcoreProfile = Hardcore.GetHardcoreDataForProfileID(playerProfile.GetPlayerID());

            if (hardcoreProfile != null)
            {
                if (hardcoreProfile.isHardcore && hardcoreProfile.hasDied)
                {
                    Hardcore.ResetHardcorePlayer(playerProfile);
                    hardcoreProfile.hasDied = false;
                }
            }
        }
Exemplo n.º 7
0
        public static void Postfix(Vector3 __state)
        {
            PlayerProfile playerProfile   = Game.instance.GetPlayerProfile();
            HardcoreData  hardcoreProfile = Hardcore.GetHardcoreDataForProfileID(playerProfile.GetPlayerID());

            if (hardcoreProfile != null)
            {
                if (hardcoreProfile.skipIntro)
                {
                    Player.m_localPlayer.transform.position = new Vector3(__state.x, __state.y, __state.z);
                    if (hardcoreProfile.isHardcore && hardcoreProfile.hasDied)
                    {
                        Hardcore.ResetHardcorePlayer(playerProfile);
                        hardcoreProfile.hasDied = false;
                    }
                }
            }
        }
Exemplo n.º 8
0
        public static void Prefix(ref Vector3 __state, ref Valkyrie __instance)
        {
            long         profileID       = Game.instance.GetPlayerProfile().GetPlayerID();
            HardcoreData hardcoreProfile = Hardcore.GetHardcoreDataForProfileID(profileID);

            if (hardcoreProfile != null)
            {
                if (hardcoreProfile.skipIntro)
                {
                    Vector3 position = Player.m_localPlayer.transform.position;
                    __state = new Vector3(position.x, position.y, position.z);
                }
                else if (hardcoreProfile.hasDied)
                {
                    __instance.m_startPause = 0f;
                }
            }
        }