D:\ValheimDev\Dumps\Old\assembly_valheim\Player.cs D:\ValheimDev\Dumps\Latest\assembly_valheim\Player.cs
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
.  using System.Reflection;
  using System.Text;
using UnityEngine; using UnityEngine;
using UnityEngine.Rendering; using UnityEngine.Rendering;
using Valheim.SettingsGui; using Valheim.SettingsGui;
using Valheim.UI; using Valheim.UI;
   
public class Player : Humanoid public class Player : Humanoid
{ {
    protected override void Awake()     protected override void Awake()
    {     {
        base.Awake();         base.Awake();
        Player.s_players.Add(this);         Player.s_players.Add(this);
        this.m_skills = base.GetComponent<Skills>();         this.m_skills = base.GetComponent<Skills>();
        this.SetupAwake();         this.SetupAwake();
.          this.m_equipmentModifierValues = new float[Player.s_equipmentModifierSources.Length];
          if (Player.s_equipmentModifierSourceFields == null)
          {
              Player.s_equipmentModifierSourceFields = new FieldInfo[Player.s_equipmentModifierSources.Length];
              for (int i = 0; i < Player.s_equipmentModifierSources.Length; i++)
              {
                  Player.s_equipmentModifierSourceFields[i] = typeof(ItemDrop.ItemData.SharedData).GetField(Player.s_equipmentModifierSources[i], BindingFlags.Instance | BindingFlags.Public);
              }
              if (Player.s_equipmentModifierSources.Length != Player.s_equipmentModifierTooltips.Length)
              {
                  ZLog.LogError("Equipment modifier tooltip missmatch in player!");
              }
          }
        if (this.m_nview.GetZDO() == null)         if (this.m_nview.GetZDO() == null)
        {         {
            return;             return;
        }         }
        this.m_placeRayMask = LayerMask.GetMask(new string[] { "Default", "static_solid", "Default_small", "piece", "piece_nonsolid", "terrain", "vehicle" });         this.m_placeRayMask = LayerMask.GetMask(new string[] { "Default", "static_solid", "Default_small", "piece", "piece_nonsolid", "terrain", "vehicle" });
        this.m_placeWaterRayMask = LayerMask.GetMask(new string[] { "Default", "static_solid", "Default_small", "piece", "piece_nonsolid", "terrain", "Water", "vehicle" });         this.m_placeWaterRayMask = LayerMask.GetMask(new string[] { "Default", "static_solid", "Default_small", "piece", "piece_nonsolid", "terrain", "Water", "vehicle" });
        this.m_removeRayMask = LayerMask.GetMask(new string[] { "Default", "static_solid", "Default_small", "piece", "piece_nonsolid", "terrain", "vehicle" });         this.m_removeRayMask = LayerMask.GetMask(new string[] { "Default", "static_solid", "Default_small", "piece", "piece_nonsolid", "terrain", "vehicle" });
        this.m_interactMask = LayerMask.GetMask(new string[] { "item", "piece", "piece_nonsolid", "Default", "static_solid", "Default_small", "character", "character_net", "terrain", "vehicle" });         this.m_interactMask = LayerMask.GetMask(new string[] { "item", "piece", "piece_nonsolid", "Default", "static_solid", "Default_small", "character", "character_net", "terrain", "vehicle" });
        this.m_autoPickupMask = LayerMask.GetMask(new string[] { "item" });         this.m_autoPickupMask = LayerMask.GetMask(new string[] { "item" });
        Inventory inventory = this.m_inventory;         Inventory inventory = this.m_inventory;
        inventory.m_onChanged = (Action)Delegate.Combine(inventory.m_onChanged, new Action(this.OnInventoryChanged));         inventory.m_onChanged = (Action)Delegate.Combine(inventory.m_onChanged, new Action(this.OnInventoryChanged));
        if (Player.s_attackMask == 0)         if (Player.s_attackMask == 0)
        {         {
            Player.s_attackMask = LayerMask.GetMask(new string[]             Player.s_attackMask = LayerMask.GetMask(new string[]
            {             {
                "Default", "static_solid", "Default_small", "piece", "piece_nonsolid", "terrain", "character", "character_net", "character_ghost", "hitbox",                 "Default", "static_solid", "Default_small", "piece", "piece_nonsolid", "terrain", "character", "character_net", "character_ghost", "hitbox",
                "character_noenv", "vehicle"                  "character_noenv", "vehicle" 
            });             });
        }         }
        this.m_nview.Register("OnDeath", new Action<long>(this.RPC_OnDeath));         this.m_nview.Register("OnDeath", new Action<long>(this.RPC_OnDeath));
        if (this.m_nview.IsOwner())         if (this.m_nview.IsOwner())
        {         {
            this.m_nview.Register<int, string, int>("Message", new Action<long, int, string, int>(this.RPC_Message));             this.m_nview.Register<int, string, int>("Message", new Action<long, int, string, int>(this.RPC_Message));
            this.m_nview.Register<bool, bool>("OnTargeted", new Action<long, bool, bool>(this.RPC_OnTargeted));             this.m_nview.Register<bool, bool>("OnTargeted", new Action<long, bool, bool>(this.RPC_OnTargeted));
            this.m_nview.Register<float>("UseStamina", new Action<long, float>(this.RPC_UseStamina));             this.m_nview.Register<float>("UseStamina", new Action<long, float>(this.RPC_UseStamina));
            if (MusicMan.instance)             if (MusicMan.instance)
            {             {
                MusicMan.instance.TriggerMusic("Wakeup");                 MusicMan.instance.TriggerMusic("Wakeup");
            }             }
            this.UpdateKnownRecipesList();             this.UpdateKnownRecipesList();
            this.UpdateAvailablePiecesList();             this.UpdateAvailablePiecesList();
            this.SetupPlacementGhost();             this.SetupPlacementGhost();
        }         }
        this.m_placeRotation = UnityEngine.Random.Range(0, 16);         this.m_placeRotation = UnityEngine.Random.Range(0, 16);
        float num = UnityEngine.Random.Range(0f, 6.2831855f);         float num = UnityEngine.Random.Range(0f, 6.2831855f);
        base.SetLookDir(new Vector3(Mathf.Cos(num), 0f, Mathf.Sin(num)), 0f);         base.SetLookDir(new Vector3(Mathf.Cos(num), 0f, Mathf.Sin(num)), 0f);
        this.FaceLookDirection();         this.FaceLookDirection();
        this.AddQueuedKeys();         this.AddQueuedKeys();
        this.UpdateCurrentSeason();         this.UpdateCurrentSeason();
.          this.m_attackTowardsPlayerLookDir = PlatformPrefs.GetInt("AttackTowardsPlayerLookDir", 1) == 1;
    }     }
   
    protected override void OnEnable()     protected override void OnEnable()
    {     {
        base.OnEnable();         base.OnEnable();
    }     }
   
    protected override void OnDisable()     protected override void OnDisable()
    {     {
        base.OnDisable();         base.OnDisable();
    }     }
   
    public void SetLocalPlayer()     public void SetLocalPlayer()
    {     {
        if (Player.m_localPlayer == this)         if (Player.m_localPlayer == this)
        {         {
            return;             return;
        }         }
        Player.m_localPlayer = this;         Player.m_localPlayer = this;
        Game.instance.IncrementPlayerStat(PlayerStatType.WorldLoads, 1f);         Game.instance.IncrementPlayerStat(PlayerStatType.WorldLoads, 1f);
        ZNet.instance.SetReferencePosition(base.transform.position);         ZNet.instance.SetReferencePosition(base.transform.position);
        EnvMan.instance.SetForceEnvironment("");         EnvMan.instance.SetForceEnvironment("");
        this.AddQueuedKeys();         this.AddQueuedKeys();
    }     }
   
    private void AddQueuedKeys()     private void AddQueuedKeys()
    {     {
        if (Player.m_addUniqueKeyQueue.Count > 0)         if (Player.m_addUniqueKeyQueue.Count > 0)
        {         {
            foreach (string text in Player.m_addUniqueKeyQueue)             foreach (string text in Player.m_addUniqueKeyQueue)
            {             {
                this.AddUniqueKey(text);                 this.AddUniqueKey(text);
            }             }
            Player.m_addUniqueKeyQueue.Clear();             Player.m_addUniqueKeyQueue.Clear();
        }         }
    }     }
   
    public void SetPlayerID(long playerID, string name)     public void SetPlayerID(long playerID, string name)
    {     {
        if (this.m_nview.GetZDO() == null)         if (this.m_nview.GetZDO() == null)
        {         {
            return;             return;
        }         }
        if (this.GetPlayerID() != 0L)         if (this.GetPlayerID() != 0L)
        {         {
            return;             return;
        }         }
        this.m_nview.GetZDO().Set(ZDOVars.s_playerID, playerID);         this.m_nview.GetZDO().Set(ZDOVars.s_playerID, playerID);
        this.m_nview.GetZDO().Set(ZDOVars.s_playerName, name);         this.m_nview.GetZDO().Set(ZDOVars.s_playerName, name);
    }     }
   
    public long GetPlayerID()     public long GetPlayerID()
    {     {
        if (!this.m_nview.IsValid())         if (!this.m_nview.IsValid())
        {         {
            return 0L;             return 0L;
        }         }
        return this.m_nview.GetZDO().GetLong(ZDOVars.s_playerID, 0L);         return this.m_nview.GetZDO().GetLong(ZDOVars.s_playerID, 0L);
    }     }
   
    public string GetPlayerName()     public string GetPlayerName()
    {     {
        if (!this.m_nview.IsValid())         if (!this.m_nview.IsValid())
        {         {
            return "";             return "";
        }         }
        return this.m_nview.GetZDO().GetString(ZDOVars.s_playerName, "...");         return this.m_nview.GetZDO().GetString(ZDOVars.s_playerName, "...");
    }     }
   
    public override string GetHoverText()     public override string GetHoverText()
    {     {
        return "";         return "";
    }     }
   
    public override string GetHoverName()     public override string GetHoverName()
    {     {
        return CensorShittyWords.FilterUGC(this.GetPlayerName(), UGCType.CharacterName, null, this.GetPlayerID());         return CensorShittyWords.FilterUGC(this.GetPlayerName(), UGCType.CharacterName, null, this.GetPlayerID());
    }     }
   
    protected override void Start()     protected override void Start()
    {     {
        base.Start();         base.Start();
        base.InvalidateCachedLiquidDepth();         base.InvalidateCachedLiquidDepth();
    }     }
   
    protected override void OnDestroy()     protected override void OnDestroy()
    {     {
        ZDO zdo = this.m_nview.GetZDO();         ZDO zdo = this.m_nview.GetZDO();
        if (zdo != null && ZNet.instance != null)         if (zdo != null && ZNet.instance != null)
        {         {
            ZLog.LogWarning(string.Concat(new string[]             ZLog.LogWarning(string.Concat(new string[]
            {             {
                "Player destroyed sec:",                 "Player destroyed sec:",
                zdo.GetSector().ToString(),                 zdo.GetSector().ToString(),
                "  pos:",                 "  pos:",
                base.transform.position.ToString(),                 base.transform.position.ToString(),
                "  zdopos:",                 "  zdopos:",
                zdo.GetPosition().ToString(),                 zdo.GetPosition().ToString(),
                "  ref ",                 "  ref ",
                ZNet.instance.GetReferencePosition().ToString()                 ZNet.instance.GetReferencePosition().ToString()
            }));             }));
        }         }
        if (this.m_placementGhost)         if (this.m_placementGhost)
        {         {
            UnityEngine.Object.Destroy(this.m_placementGhost);             UnityEngine.Object.Destroy(this.m_placementGhost);
            this.m_placementGhost = null;             this.m_placementGhost = null;
        }         }
        base.OnDestroy();         base.OnDestroy();
        Player.s_players.Remove(this);         Player.s_players.Remove(this);
        if (Player.m_localPlayer == this)         if (Player.m_localPlayer == this)
        {         {
            ZLog.LogWarning("Local player destroyed");             ZLog.LogWarning("Local player destroyed");
            Player.m_localPlayer = null;             Player.m_localPlayer = null;
        }         }
    }     }
   
    private void FixedUpdate()     private void FixedUpdate()
    {     {
        float fixedDeltaTime = Time.fixedDeltaTime;         float fixedDeltaTime = Time.fixedDeltaTime;
        this.UpdateAwake(fixedDeltaTime);         this.UpdateAwake(fixedDeltaTime);
        if (this.m_nview.GetZDO() == null)         if (this.m_nview.GetZDO() == null)
        {         {
            return;             return;
        }         }
        this.UpdateTargeted(fixedDeltaTime);         this.UpdateTargeted(fixedDeltaTime);
        if (this.m_nview.IsOwner())         if (this.m_nview.IsOwner())
        {         {
            if (Player.m_localPlayer != this)             if (Player.m_localPlayer != this)
            {             {
                ZLog.Log("Destroying old local player");                 ZLog.Log("Destroying old local player");
                ZNetScene.instance.Destroy(base.gameObject);                 ZNetScene.instance.Destroy(base.gameObject);
                return;                 return;
            }             }
            if (this.IsDead())             if (this.IsDead())
            {             {
                return;                 return;
            }             }
            this.UpdateActionQueue(fixedDeltaTime);             this.UpdateActionQueue(fixedDeltaTime);
            this.PlayerAttackInput(fixedDeltaTime);             this.PlayerAttackInput(fixedDeltaTime);
            this.UpdateAttach();             this.UpdateAttach();
            this.UpdateDoodadControls(fixedDeltaTime);             this.UpdateDoodadControls(fixedDeltaTime);
            this.UpdateCrouch(fixedDeltaTime);             this.UpdateCrouch(fixedDeltaTime);
            this.UpdateDodge(fixedDeltaTime);             this.UpdateDodge(fixedDeltaTime);
            this.UpdateCover(fixedDeltaTime);             this.UpdateCover(fixedDeltaTime);
            this.UpdateStations(fixedDeltaTime);             this.UpdateStations(fixedDeltaTime);
            this.UpdateGuardianPower(fixedDeltaTime);             this.UpdateGuardianPower(fixedDeltaTime);
            this.UpdateBaseValue(fixedDeltaTime);             this.UpdateBaseValue(fixedDeltaTime);
            this.UpdateStats(fixedDeltaTime);             this.UpdateStats(fixedDeltaTime);
            this.UpdateTeleport(fixedDeltaTime);             this.UpdateTeleport(fixedDeltaTime);
            this.AutoPickup(fixedDeltaTime);             this.AutoPickup(fixedDeltaTime);
            this.EdgeOfWorldKill(fixedDeltaTime);             this.EdgeOfWorldKill(fixedDeltaTime);
            this.UpdateBiome(fixedDeltaTime);             this.UpdateBiome(fixedDeltaTime);
            this.UpdateStealth(fixedDeltaTime);             this.UpdateStealth(fixedDeltaTime);
            if (GameCamera.instance && this.m_attachPointCamera == null && Vector3.Distance(GameCamera.instance.transform.position, base.transform.position) < 2f)             if (GameCamera.instance && this.m_attachPointCamera == null && Vector3.Distance(GameCamera.instance.transform.position, base.transform.position) < 2f)
            {             {
                base.SetVisible(false);                 base.SetVisible(false);
            }             }
.            AudioMan.instance.SetIndoor(this.InShelter());             AudioMan.instance.SetIndoor(this.InShelter() || ShieldGenerator.IsInsideShield(base.transform.position));
        }         }
    }     }
   
    private void Update()     private void Update()
    {     {
        bool flag = InventoryGui.IsVisible();         bool flag = InventoryGui.IsVisible();
        if (ZInput.InputLayout != InputLayout.Default && ZInput.IsGamepadActive() && !flag && (ZInput.GetButtonUp("JoyAltPlace") && ZInput.GetButton("JoyAltKeys")))         if (ZInput.InputLayout != InputLayout.Default && ZInput.IsGamepadActive() && !flag && (ZInput.GetButtonUp("JoyAltPlace") && ZInput.GetButton("JoyAltKeys")))
        {         {
            this.m_altPlace = !this.m_altPlace;             this.m_altPlace = !this.m_altPlace;
            if (MessageHud.instance != null)             if (MessageHud.instance != null)
            {             {
                string text = Localization.instance.Localize("$hud_altplacement");                 string text = Localization.instance.Localize("$hud_altplacement");
                string text2 = (this.m_altPlace ? Localization.instance.Localize("$hud_on") : Localization.instance.Localize("$hud_off"));                 string text2 = (this.m_altPlace ? Localization.instance.Localize("$hud_on") : Localization.instance.Localize("$hud_off"));
                MessageHud.instance.ShowMessage(MessageHud.MessageType.TopLeft, text + " " + text2, 0, null);                 MessageHud.instance.ShowMessage(MessageHud.MessageType.TopLeft, text + " " + text2, 0, null);
            }             }
        }         }
.          this.UpdateClothFix();
        if (!this.m_nview.IsValid())         if (!this.m_nview.IsValid())
        {         {
            return;             return;
        }         }
        if (!this.m_nview.IsOwner())         if (!this.m_nview.IsOwner())
        {         {
            return;             return;
        }         }
        bool flag2 = this.TakeInput();         bool flag2 = this.TakeInput();
        this.UpdateHover();         this.UpdateHover();
        if (flag2)         if (flag2)
        {         {
            if (Player.m_debugMode && global::Console.instance.IsCheatsEnabled())             if (Player.m_debugMode && global::Console.instance.IsCheatsEnabled())
            {             {
                if (ZInput.GetKeyDown(KeyCode.Z, true))                 if (ZInput.GetKeyDown(KeyCode.Z, true))
                {                 {
                    this.ToggleDebugFly();                     this.ToggleDebugFly();
                }                 }
                if (ZInput.GetKeyDown(KeyCode.B, true))                 if (ZInput.GetKeyDown(KeyCode.B, true))
                {                 {
                    this.ToggleNoPlacementCost();                     this.ToggleNoPlacementCost();
                }                 }
                if (ZInput.GetKeyDown(KeyCode.K, true))                 if (ZInput.GetKeyDown(KeyCode.K, true))
                {                 {
                    global::Console.instance.TryRunCommand("killenemies", false, false);                     global::Console.instance.TryRunCommand("killenemies", false, false);
                }                 }
                if (ZInput.GetKeyDown(KeyCode.L, true))                 if (ZInput.GetKeyDown(KeyCode.L, true))
                {                 {
                    global::Console.instance.TryRunCommand("removedrops", false, false);                     global::Console.instance.TryRunCommand("removedrops", false, false);
                }                 }
            }             }
            bool flag3 = ((ZInput.IsNonClassicFunctionality() && ZInput.IsGamepadActive()) ? ZInput.GetButton("JoyAltKeys") : (ZInput.GetButton("AltPlace") || ZInput.GetButton("JoyAltPlace")));             bool flag3 = ((ZInput.IsNonClassicFunctionality() && ZInput.IsGamepadActive()) ? ZInput.GetButton("JoyAltKeys") : (ZInput.GetButton("AltPlace") || ZInput.GetButton("JoyAltPlace")));
            if ((ZInput.GetButtonDown("Use") || ZInput.GetButtonDown("JoyUse")) && !Hud.InRadial())             if ((ZInput.GetButtonDown("Use") || ZInput.GetButtonDown("JoyUse")) && !Hud.InRadial())
            {             {
                if (this.m_hovering)                 if (this.m_hovering)
                {                 {
                    this.Interact(this.m_hovering, false, flag3);                     this.Interact(this.m_hovering, false, flag3);
                }                 }
                else if (this.m_doodadController != null)                 else if (this.m_doodadController != null)
                {                 {
                    this.StopDoodadControl();                     this.StopDoodadControl();
                }                 }
            }             }
            else if ((ZInput.GetButton("Use") || ZInput.GetButton("JoyUse")) && !Hud.InRadial() && this.m_hovering)             else if ((ZInput.GetButton("Use") || ZInput.GetButton("JoyUse")) && !Hud.InRadial() && this.m_hovering)
            {             {
                this.Interact(this.m_hovering, true, flag3);                 this.Interact(this.m_hovering, true, flag3);
            }             }
            bool flag4 = ZInput.GetButtonUp("JoyHide") && ZInput.GetButtonLastPressedTimer("JoyHide") < 0.33f;             bool flag4 = ZInput.GetButtonUp("JoyHide") && ZInput.GetButtonLastPressedTimer("JoyHide") < 0.33f;
            if ((ZInput.InputLayout != InputLayout.Default && ZInput.IsGamepadActive()) ? (!this.InPlaceMode() && flag4 && !ZInput.GetButton("JoyAltKeys")) : (ZInput.GetButtonDown("Hide") || (flag4 && !ZInput.GetButton("JoyAltKeys") && !this.InPlaceMode())))             if ((ZInput.InputLayout != InputLayout.Default && ZInput.IsGamepadActive()) ? (!this.InPlaceMode() && flag4 && !ZInput.GetButton("JoyAltKeys")) : (ZInput.GetButtonDown("Hide") || (flag4 && !ZInput.GetButton("JoyAltKeys") && !this.InPlaceMode())))
            {             {
                if (base.GetRightItem() != null || base.GetLeftItem() != null)                 if (base.GetRightItem() != null || base.GetLeftItem() != null)
                {                 {
                    if (!this.InAttack() && !this.InDodge())                     if (!this.InAttack() && !this.InDodge())
                    {                     {
                        base.HideHandItems();                         base.HideHandItems();
                    }                     }
                }                 }
                else if ((!base.IsSwimming() || base.IsOnGround()) && !this.InDodge())                 else if ((!base.IsSwimming() || base.IsOnGround()) && !this.InDodge())
                {                 {
                    base.ShowHandItems();                     base.ShowHandItems();
                }                 }
            }             }
            if (ZInput.GetButtonDown("ToggleWalk") && !Hud.InRadial())             if (ZInput.GetButtonDown("ToggleWalk") && !Hud.InRadial())
            {             {
                base.SetWalk(!base.GetWalk());                 base.SetWalk(!base.GetWalk());
                if (base.GetWalk())                 if (base.GetWalk())
                {                 {
                    this.Message(MessageHud.MessageType.TopLeft, "$msg_walk $hud_on", 0, null);                     this.Message(MessageHud.MessageType.TopLeft, "$msg_walk $hud_on", 0, null);
                }                 }
                else                 else
                {                 {
                    this.Message(MessageHud.MessageType.TopLeft, "$msg_walk $hud_off", 0, null);                     this.Message(MessageHud.MessageType.TopLeft, "$msg_walk $hud_off", 0, null);
                }                 }
            }             }
            if (UISettings.UseRadials)             if (UISettings.UseRadials)
            {             {
                this.HandleRadialInput();                 this.HandleRadialInput();
            }             }
            else if ((!this.InPlaceMode() && !ZInput.GetButton("JoyAltKeys") && ZInput.GetButtonUp("JoySit")) || ZInput.GetButtonDown("Sit"))             else if ((!this.InPlaceMode() && !ZInput.GetButton("JoyAltKeys") && ZInput.GetButtonUp("JoySit")) || ZInput.GetButtonDown("Sit"))
            {             {
                if (this.InEmote() && this.IsSitting())                 if (this.InEmote() && this.IsSitting())
                {                 {
                    this.StopEmote();                     this.StopEmote();
                }                 }
                else                 else
                {                 {
                    this.StartEmote("sit", false);                     this.StartEmote("sit", false);
                }                 }
            }             }
            bool flag5 = ZInput.IsGamepadActive() && !ZInput.GetButton("JoyAltKeys");             bool flag5 = ZInput.IsGamepadActive() && !ZInput.GetButton("JoyAltKeys");
            bool flag6 = ZInput.InputLayout == InputLayout.Default && ZInput.GetButtonDown("JoyGP");             bool flag6 = ZInput.InputLayout == InputLayout.Default && ZInput.GetButtonDown("JoyGP");
            bool flag7 = ZInput.IsNonClassicFunctionality() && ZInput.GetButton("JoyLStick") && ZInput.GetButton("JoyRStick");             bool flag7 = ZInput.IsNonClassicFunctionality() && ZInput.GetButton("JoyLStick") && ZInput.GetButton("JoyRStick");
            if (!Hud.InRadial() && !Hud.IsPieceSelectionVisible() && (ZInput.GetButtonDown("GP") || (flag5 && (flag6 || flag7))))             if (!Hud.InRadial() && !Hud.IsPieceSelectionVisible() && (ZInput.GetButtonDown("GP") || (flag5 && (flag6 || flag7))))
            {             {
                this.StartGuardianPower();                 this.StartGuardianPower();
            }             }
            bool flag8 = ZInput.GetButtonDown("JoyAutoPickup") && ZInput.GetButton("JoyAltKeys");             bool flag8 = ZInput.GetButtonDown("JoyAutoPickup") && ZInput.GetButton("JoyAltKeys");
            if (ZInput.GetButtonDown("AutoPickup") || flag8)             if (ZInput.GetButtonDown("AutoPickup") || flag8)
            {             {
.                this.m_enableAutoPickup = !this.m_enableAutoPickup;                 Player.m_enableAutoPickup = !Player.m_enableAutoPickup;
                this.Message(MessageHud.MessageType.TopLeft, "$hud_autopickup:" + (this.m_enableAutoPickup ? "$hud_on" : "$hud_off"), 0, null);                 this.Message(MessageHud.MessageType.TopLeft, "$hud_autopickup:" + (Player.m_enableAutoPickup ? "$hud_on" : "$hud_off"), 0, null);
            }             }
            if (ZInput.GetButtonDown("Hotbar1"))             if (ZInput.GetButtonDown("Hotbar1"))
            {             {
                this.UseHotbarItem(1);                 this.UseHotbarItem(1);
            }             }
            if (ZInput.GetButtonDown("Hotbar2"))             if (ZInput.GetButtonDown("Hotbar2"))
            {             {
                this.UseHotbarItem(2);                 this.UseHotbarItem(2);
            }             }
            if (ZInput.GetButtonDown("Hotbar3"))             if (ZInput.GetButtonDown("Hotbar3"))
            {             {
                this.UseHotbarItem(3);                 this.UseHotbarItem(3);
            }             }
            if (ZInput.GetButtonDown("Hotbar4"))             if (ZInput.GetButtonDown("Hotbar4"))
            {             {
                this.UseHotbarItem(4);                 this.UseHotbarItem(4);
            }             }
            if (ZInput.GetButtonDown("Hotbar5"))             if (ZInput.GetButtonDown("Hotbar5"))
            {             {
                this.UseHotbarItem(5);                 this.UseHotbarItem(5);
            }             }
            if (ZInput.GetButtonDown("Hotbar6"))             if (ZInput.GetButtonDown("Hotbar6"))
            {             {
                this.UseHotbarItem(6);                 this.UseHotbarItem(6);
            }             }
            if (ZInput.GetButtonDown("Hotbar7"))             if (ZInput.GetButtonDown("Hotbar7"))
            {             {
                this.UseHotbarItem(7);                 this.UseHotbarItem(7);
            }             }
            if (ZInput.GetButtonDown("Hotbar8"))             if (ZInput.GetButtonDown("Hotbar8"))
            {             {
                this.UseHotbarItem(8);                 this.UseHotbarItem(8);
            }             }
        }         }
        this.UpdatePlacement(flag2, Time.deltaTime);         this.UpdatePlacement(flag2, Time.deltaTime);
        this.UpdateStats();         this.UpdateStats();
    }     }
   
.      private void UpdateClothFix()
      {
          float magnitude = base.GetVelocity().magnitude;
          if (magnitude > 0.01f && this.m_lastVelocity < 0.01f)
          {
              base.ResetCloth();
              Terminal.Increment("resetcloth", 1);
          }
          this.m_lastVelocity = magnitude;
      }
   
    private void HandleRadialInput()     private void HandleRadialInput()
    {     {
        if (!Hud.InRadial())         if (!Hud.InRadial())
        {         {
            if (!Hud.instance.m_radialMenu.CanOpen)             if (!Hud.instance.m_radialMenu.CanOpen)
            {             {
                DynamicRadialMenu radialMenu = Hud.instance.m_radialMenu;                 DynamicRadialMenu radialMenu = Hud.instance.m_radialMenu;
                InputLayout inputLayout = ZInput.InputLayout;                 InputLayout inputLayout = ZInput.InputLayout;
                bool flag;                 bool flag;
                if (inputLayout != InputLayout.Alternative1)                 if (inputLayout != InputLayout.Alternative1)
                {                 {
                    flag = inputLayout == InputLayout.Alternative2 && ZInput.GetButtonDown("JoyLBumper");                     flag = inputLayout == InputLayout.Alternative2 && ZInput.GetButtonDown("JoyLBumper");
                }                 }
                else                 else
                {                 {
                    flag = ZInput.GetButtonDown("JoyLTrigger");                     flag = ZInput.GetButtonDown("JoyLTrigger");
                }                 }
                radialMenu.CanOpen = flag;                 radialMenu.CanOpen = flag;
            }             }
            if (!ZInput.GetButton("JoyAltKeys") && ((ZInput.InputLayout == InputLayout.Alternative1 && ZInput.GetButtonPressedTimer("JoyLTrigger") > 0.33f) || (ZInput.InputLayout == InputLayout.Alternative2 && ZInput.GetButtonPressedTimer("JoyLBumper") > 0.33f)))             if (!ZInput.GetButton("JoyAltKeys") && ((ZInput.InputLayout == InputLayout.Alternative1 && ZInput.GetButtonPressedTimer("JoyLTrigger") > 0.33f) || (ZInput.InputLayout == InputLayout.Alternative2 && ZInput.GetButtonPressedTimer("JoyLBumper") > 0.33f)))
            {             {
                Hud.instance.m_radialMenu.Open(Hud.instance.m_config, null);                 Hud.instance.m_radialMenu.Open(Hud.instance.m_config, null);
            }             }
            if ((!ZInput.GetButton("JoyAltKeys") && ZInput.GetButtonPressedTimer("JoySit") > 0.33f) || ZInput.GetKeyDown(KeyCode.BackQuote, true))             if ((!ZInput.GetButton("JoyAltKeys") && ZInput.GetButtonPressedTimer("JoySit") > 0.33f) || ZInput.GetKeyDown(KeyCode.BackQuote, true))
            {             {
                Hud.instance.m_radialMenu.CanOpen = true;                 Hud.instance.m_radialMenu.CanOpen = true;
                Hud.instance.m_radialMenu.Open(Hud.instance.m_config, null);                 Hud.instance.m_radialMenu.Open(Hud.instance.m_config, null);
                return;                 return;
            }             }
            if ((!ZInput.GetButton("JoyAltKeys") && ZInput.GetButtonUp("JoySit")) || ZInput.GetButtonDown("Sit"))             if ((!ZInput.GetButton("JoyAltKeys") && ZInput.GetButtonUp("JoySit")) || ZInput.GetButtonDown("Sit"))
            {             {
                if (this.InEmote() && this.IsSitting())                 if (this.InEmote() && this.IsSitting())
                {                 {
                    this.StopEmote();                     this.StopEmote();
                    return;                     return;
                }                 }
                this.StartEmote("sit", false);                 this.StartEmote("sit", false);
            }             }
        }         }
    }     }
   
    private void UpdateStats()     private void UpdateStats()
    {     {
        if (this.IsDebugFlying())         if (this.IsDebugFlying())
        {         {
            return;             return;
        }         }
        this.m_statCheck += Time.deltaTime;         this.m_statCheck += Time.deltaTime;
        if (this.m_statCheck < 0.5f)         if (this.m_statCheck < 0.5f)
        {         {
            return;             return;
        }         }
        this.m_statCheck = 0f;         this.m_statCheck = 0f;
        PlayerProfile playerProfile = Game.instance.GetPlayerProfile();         PlayerProfile playerProfile = Game.instance.GetPlayerProfile();
        playerProfile.IncrementStat(this.IsSafeInHome() ? PlayerStatType.TimeInBase : PlayerStatType.TimeOutOfBase, 0.5f);         playerProfile.IncrementStat(this.IsSafeInHome() ? PlayerStatType.TimeInBase : PlayerStatType.TimeOutOfBase, 0.5f);
        float num = Vector3.Distance(base.transform.position, this.m_lastDistCheck);         float num = Vector3.Distance(base.transform.position, this.m_lastDistCheck);
        if (num > 1f)         if (num > 1f)
        {         {
            if (num < 20f)             if (num < 20f)
            {             {
                playerProfile.IncrementStat(PlayerStatType.DistanceTraveled, num);                 playerProfile.IncrementStat(PlayerStatType.DistanceTraveled, num);
                if (Ship.GetLocalShip() != null)                 if (Ship.GetLocalShip() != null)
                {                 {
                    playerProfile.IncrementStat(PlayerStatType.DistanceSail, 1f);                     playerProfile.IncrementStat(PlayerStatType.DistanceSail, 1f);
                }                 }
                else if (base.IsOnGround())                 else if (base.IsOnGround())
                {                 {
                    playerProfile.IncrementStat(base.IsRunning() ? PlayerStatType.DistanceRun : PlayerStatType.DistanceWalk, num);                     playerProfile.IncrementStat(base.IsRunning() ? PlayerStatType.DistanceRun : PlayerStatType.DistanceWalk, num);
                }                 }
                else                 else
                {                 {
                    playerProfile.IncrementStat(PlayerStatType.DistanceAir, num);                     playerProfile.IncrementStat(PlayerStatType.DistanceAir, num);
                }                 }
            }             }
            this.m_lastDistCheck = base.transform.position;             this.m_lastDistCheck = base.transform.position;
        }         }
    }     }
   
    private void UpdatePlacement(bool takeInput, float dt)     private void UpdatePlacement(bool takeInput, float dt)
    {     {
        this.UpdateWearNTearHover();         this.UpdateWearNTearHover();
        if (this.InPlaceMode() && !this.IsDead())         if (this.InPlaceMode() && !this.IsDead())
        {         {
            if (!takeInput)             if (!takeInput)
            {             {
                return;                 return;
            }             }
            this.UpdateBuildGuiInput();             this.UpdateBuildGuiInput();
            if (Hud.IsPieceSelectionVisible())             if (Hud.IsPieceSelectionVisible())
            {             {
                return;                 return;
            }             }
            ItemDrop.ItemData rightItem = base.GetRightItem();             ItemDrop.ItemData rightItem = base.GetRightItem();
            if ((ZInput.GetButton("AltPlace") || ZInput.GetButton("JoyAltKeys")) && (ZInput.GetButtonDown("JoyLStick") || ZInput.GetButtonDown("JoyRStick") || ZInput.GetButtonDown("JoyButtonA") || ZInput.GetButtonDown("JoyButtonB") || ZInput.GetButtonDown("JoyButtonX") || ZInput.GetButtonDown("JoyButtonY") || ZInput.GetButtonDown("JoyDPadUp") || ZInput.GetButtonDown("JoyDPadDown") || ZInput.GetButtonDown("JoyDPadLeft") || ZInput.GetButtonDown("JoyDPadRight")))             if ((ZInput.GetButton("AltPlace") || ZInput.GetButton("JoyAltKeys")) && (ZInput.GetButtonDown("JoyLStick") || ZInput.GetButtonDown("JoyRStick") || ZInput.GetButtonDown("JoyButtonA") || ZInput.GetButtonDown("JoyButtonB") || ZInput.GetButtonDown("JoyButtonX") || ZInput.GetButtonDown("JoyButtonY") || ZInput.GetButtonDown("JoyDPadUp") || ZInput.GetButtonDown("JoyDPadDown") || ZInput.GetButtonDown("JoyDPadLeft") || ZInput.GetButtonDown("JoyDPadRight")))
            {             {
                this.m_blockRemove = true;                 this.m_blockRemove = true;
            }             }
            if ((ZInput.GetButtonDown("Remove") || ZInput.GetButtonDown("JoyRemove")) && (ZInput.GetButton("AltPlace") || ZInput.GetButton("JoyAltKeys")) && (ZInput.InputLayout == InputLayout.Default || !ZInput.IsGamepadActive()))             if ((ZInput.GetButtonDown("Remove") || ZInput.GetButtonDown("JoyRemove")) && (ZInput.GetButton("AltPlace") || ZInput.GetButton("JoyAltKeys")) && (ZInput.InputLayout == InputLayout.Default || !ZInput.IsGamepadActive()))
            {             {
                this.CopyPiece();                 this.CopyPiece();
                this.m_blockRemove = true;                 this.m_blockRemove = true;
            }             }
            else if (!this.m_blockRemove && (ZInput.GetButtonUp("Remove") || ZInput.GetButtonUp("JoyRemove")))             else if (!this.m_blockRemove && (ZInput.GetButtonUp("Remove") || ZInput.GetButtonUp("JoyRemove")))
            {             {
                this.m_removePressedTime = Time.time;                 this.m_removePressedTime = Time.time;
            }             }
            if (!ZInput.GetButton("AltPlace") && !ZInput.GetButton("JoyAltKeys"))             if (!ZInput.GetButton("AltPlace") && !ZInput.GetButton("JoyAltKeys"))
            {             {
                this.m_blockRemove = false;                 this.m_blockRemove = false;
            }             }
            if (Time.time - this.m_removePressedTime < 0.2f && rightItem.m_shared.m_buildPieces.m_canRemovePieces && Time.time - this.m_lastToolUseTime > this.m_removeDelay)             if (Time.time - this.m_removePressedTime < 0.2f && rightItem.m_shared.m_buildPieces.m_canRemovePieces && Time.time - this.m_lastToolUseTime > this.m_removeDelay)
            {             {
                this.m_removePressedTime = -9999f;                 this.m_removePressedTime = -9999f;
                if (this.HaveStamina(rightItem.m_shared.m_attack.m_attackStamina))                 if (this.HaveStamina(rightItem.m_shared.m_attack.m_attackStamina))
                {                 {
                    if (this.RemovePiece())                     if (this.RemovePiece())
                    {                     {
                        this.m_lastToolUseTime = Time.time;                         this.m_lastToolUseTime = Time.time;
                        base.AddNoise(50f);                         base.AddNoise(50f);
                        this.UseStamina(rightItem.m_shared.m_attack.m_attackStamina, true);                         this.UseStamina(rightItem.m_shared.m_attack.m_attackStamina, true);
                        if (rightItem.m_shared.m_useDurability)                         if (rightItem.m_shared.m_useDurability)
                        {                         {
                            rightItem.m_durability -= rightItem.m_shared.m_useDurabilityDrain;                             rightItem.m_durability -= rightItem.m_shared.m_useDurabilityDrain;
                        }                         }
                    }                     }
                }                 }
                else                 else
                {                 {
                    Hud.instance.StaminaBarEmptyFlash();                     Hud.instance.StaminaBarEmptyFlash();
                }                 }
            }             }
            if ((ZInput.GetButtonDown("Attack") || ZInput.GetButtonDown("JoyPlace")) && !Hud.InRadial())             if ((ZInput.GetButtonDown("Attack") || ZInput.GetButtonDown("JoyPlace")) && !Hud.InRadial())
            {             {
                this.m_placePressedTime = Time.time;                 this.m_placePressedTime = Time.time;
            }             }
            if (Time.time - this.m_placePressedTime < 0.2f && Time.time - this.m_lastToolUseTime > this.m_placeDelay)             if (Time.time - this.m_placePressedTime < 0.2f && Time.time - this.m_lastToolUseTime > this.m_placeDelay)
            {             {
                this.m_placePressedTime = -9999f;                 this.m_placePressedTime = -9999f;
                if (ZInput.GetButton("JoyAltKeys"))                 if (ZInput.GetButton("JoyAltKeys"))
                {                 {
                    this.CopyPiece();                     this.CopyPiece();
                    this.m_blockRemove = true;                     this.m_blockRemove = true;
                }                 }
                else                 else
                {                 {
                    Piece selectedPiece = this.m_buildPieces.GetSelectedPiece();                     Piece selectedPiece = this.m_buildPieces.GetSelectedPiece();
                    if (selectedPiece != null)                     if (selectedPiece != null)
                    {                     {
                        if (this.HaveStamina(rightItem.m_shared.m_attack.m_attackStamina))                         if (this.HaveStamina(rightItem.m_shared.m_attack.m_attackStamina))
                        {                         {
                            if (selectedPiece.m_repairPiece)                             if (selectedPiece.m_repairPiece)
                            {                             {
                                this.Repair(rightItem, selectedPiece);                                 this.Repair(rightItem, selectedPiece);
                            }                             }
                            else if (this.m_placementGhost != null)                             else if (this.m_placementGhost != null)
                            {                             {
                                if (this.m_noPlacementCost || this.HaveRequirements(selectedPiece, Player.RequirementMode.CanBuild))                                 if (this.m_noPlacementCost || this.HaveRequirements(selectedPiece, Player.RequirementMode.CanBuild))
                                {                                 {
                                    if (this.PlacePiece(selectedPiece))                                     if (this.PlacePiece(selectedPiece))
                                    {                                     {
                                        this.m_lastToolUseTime = Time.time;                                         this.m_lastToolUseTime = Time.time;
                                        if (!ZoneSystem.instance.GetGlobalKey(GlobalKeys.NoBuildCost))                                         if (!ZoneSystem.instance.GetGlobalKey(GlobalKeys.NoBuildCost))
                                        {                                         {
                                            this.ConsumeResources(selectedPiece.m_resources, 0, -1);                                             this.ConsumeResources(selectedPiece.m_resources, 0, -1);
                                        }                                         }
                                        this.UseStamina(rightItem.m_shared.m_attack.m_attackStamina, true);                                         this.UseStamina(rightItem.m_shared.m_attack.m_attackStamina, true);
                                        if (rightItem.m_shared.m_useDurability)                                         if (rightItem.m_shared.m_useDurability)
                                        {                                         {
                                            rightItem.m_durability -= rightItem.m_shared.m_useDurabilityDrain;                                             rightItem.m_durability -= rightItem.m_shared.m_useDurabilityDrain;
                                        }                                         }
                                    }                                     }
                                }                                 }
                                else                                 else
                                {                                 {
                                    this.Message(MessageHud.MessageType.Center, "$msg_missingrequirement", 0, null);                                     this.Message(MessageHud.MessageType.Center, "$msg_missingrequirement", 0, null);
                                }                                 }
                            }                             }
                        }                         }
                        else                         else
                        {                         {
                            Hud.instance.StaminaBarEmptyFlash();                             Hud.instance.StaminaBarEmptyFlash();
                        }                         }
                    }                     }
                }                 }
            }             }
            if (this.m_placementGhost)             if (this.m_placementGhost)
            {             {
                IPieceMarker component = this.m_placementGhost.gameObject.GetComponent<IPieceMarker>();                 IPieceMarker component = this.m_placementGhost.gameObject.GetComponent<IPieceMarker>();
                if (component != null)                 if (component != null)
                {                 {
                    component.ShowBuildMarker();                     component.ShowBuildMarker();
                }                 }
            }             }
            Piece hoveringPiece = this.GetHoveringPiece();             Piece hoveringPiece = this.GetHoveringPiece();
            if (hoveringPiece)             if (hoveringPiece)
            {             {
                IPieceMarker component2 = hoveringPiece.gameObject.GetComponent<IPieceMarker>();                 IPieceMarker component2 = hoveringPiece.gameObject.GetComponent<IPieceMarker>();
                if (component2 != null)                 if (component2 != null)
                {                 {
                    component2.ShowHoverMarker();                     component2.ShowHoverMarker();
                }                 }
            }             }
            if (this.m_placementGhost)             if (this.m_placementGhost)
            {             {
                Piece component3 = this.m_placementGhost.GetComponent<Piece>();                 Piece component3 = this.m_placementGhost.GetComponent<Piece>();
.                if (component3 != null && component3.m_canRotate)                 if (component3 != null && component3.m_canRotate && this.m_placementGhost.activeInHierarchy)
                {                 {
                    if (ZInput.GetMouseScrollWheel() < 0f)                     if (ZInput.GetMouseScrollWheel() < 0f)
                    {                     {
                        this.m_placeRotation--;                         this.m_placeRotation--;
                    }                     }
                    if (ZInput.GetMouseScrollWheel() > 0f)                     if (ZInput.GetMouseScrollWheel() > 0f)
                    {                     {
                        this.m_placeRotation++;                         this.m_placeRotation++;
                    }                     }
                }                 }
            }             }
            float num = 0f;             float num = 0f;
            bool flag = false;             bool flag = false;
            if (ZInput.IsGamepadActive())             if (ZInput.IsGamepadActive())
            {             {
                switch (ZInput.InputLayout)                 switch (ZInput.InputLayout)
                {                 {
                case InputLayout.Default:                 case InputLayout.Default:
                    num = ZInput.GetJoyRightStickX();                     num = ZInput.GetJoyRightStickX();
                    flag = ZInput.GetButton("JoyRotate") && Mathf.Abs(num) > 0.5f;                     flag = ZInput.GetButton("JoyRotate") && Mathf.Abs(num) > 0.5f;
                    break;                     break;
                case InputLayout.Alternative1:                 case InputLayout.Alternative1:
                {                 {
                    bool button = ZInput.GetButton("JoyRotate");                     bool button = ZInput.GetButton("JoyRotate");
                    bool button2 = ZInput.GetButton("JoyRotateRight");                     bool button2 = ZInput.GetButton("JoyRotateRight");
                    flag = button || button2;                     flag = button || button2;
                    if (button)                     if (button)
                    {                     {
                        num = 0.5f;                         num = 0.5f;
                    }                     }
                    else if (button2)                     else if (button2)
                    {                     {
                        num = -0.5f;                         num = -0.5f;
                    }                     }
                    break;                     break;
                }                 }
                case InputLayout.Alternative2:                 case InputLayout.Alternative2:
                {                 {
                    object obj = ZInput.GetButtonLastPressedTimer("JoyRotate") < 0.33f && ZInput.GetButtonUp("JoyRotate");                     object obj = ZInput.GetButtonLastPressedTimer("JoyRotate") < 0.33f && ZInput.GetButtonUp("JoyRotate");
                    bool button3 = ZInput.GetButton("JoyRotateRight");                     bool button3 = ZInput.GetButton("JoyRotateRight");
                    object obj2 = obj;                     object obj2 = obj;
                    flag = (obj2 | button3) != null;                     flag = (obj2 | button3) != null;
                    if (obj2 != null)                     if (obj2 != null)
                    {                     {
                        num = 0.5f;                         num = 0.5f;
                    }                     }
                    else if (button3)                     else if (button3)
                    {                     {
                        num = -0.5f;                         num = -0.5f;
                    }                     }
                    break;                     break;
                }                 }
                }                 }
            }             }
            if (flag)             if (flag)
            {             {
                if (this.m_rotatePieceTimer == 0f)                 if (this.m_rotatePieceTimer == 0f)
                {                 {
                    if (num < 0f)                     if (num < 0f)
                    {                     {
                        this.m_placeRotation++;                         this.m_placeRotation++;
                    }                     }
                    else                     else
                    {                     {
                        this.m_placeRotation--;                         this.m_placeRotation--;
                    }                     }
                }                 }
                else if (this.m_rotatePieceTimer > 0.25f)                 else if (this.m_rotatePieceTimer > 0.25f)
                {                 {
                    if (num < 0f)                     if (num < 0f)
                    {                     {
                        this.m_placeRotation++;                         this.m_placeRotation++;
                    }                     }
                    else                     else
                    {                     {
                        this.m_placeRotation--;                         this.m_placeRotation--;
                    }                     }
                    this.m_rotatePieceTimer = 0.17f;                     this.m_rotatePieceTimer = 0.17f;
                }                 }
                this.m_rotatePieceTimer += dt;                 this.m_rotatePieceTimer += dt;
            }             }
            else             else
            {             {
                this.m_rotatePieceTimer = 0f;                 this.m_rotatePieceTimer = 0f;
            }             }
            using (Dictionary<Material, float>.Enumerator enumerator = this.m_ghostRippleDistance.GetEnumerator())             using (Dictionary<Material, float>.Enumerator enumerator = this.m_ghostRippleDistance.GetEnumerator())
            {             {
                while (enumerator.MoveNext())                 while (enumerator.MoveNext())
                {                 {
                    KeyValuePair<Material, float> keyValuePair = enumerator.Current;                     KeyValuePair<Material, float> keyValuePair = enumerator.Current;
                    keyValuePair.Key.SetFloat("_RippleDistance", ZInput.GetKey(KeyCode.LeftControl, true) ? keyValuePair.Value : 0f);                     keyValuePair.Key.SetFloat("_RippleDistance", ZInput.GetKey(KeyCode.LeftControl, true) ? keyValuePair.Value : 0f);
                }                 }
                return;                 return;
            }             }
        }         }
        if (this.m_placementGhost)         if (this.m_placementGhost)
        {         {
            this.m_placementGhost.SetActive(false);             this.m_placementGhost.SetActive(false);
        }         }
    }     }
   
    private void UpdateBuildGuiInputAlternative1()     private void UpdateBuildGuiInputAlternative1()
    {     {
        if (!Hud.IsPieceSelectionVisible() && ZInput.GetButtonDown("JoyBuildMenu") && !PlayerController.HasInputDelay && !Hud.InRadial())         if (!Hud.IsPieceSelectionVisible() && ZInput.GetButtonDown("JoyBuildMenu") && !PlayerController.HasInputDelay && !Hud.InRadial())
        {         {
            for (int i = 0; i < this.m_buildPieces.m_selectedPiece.Length; i++)             for (int i = 0; i < this.m_buildPieces.m_selectedPiece.Length; i++)
            {             {
                this.m_buildPieces.m_lastSelectedPiece[i] = this.m_buildPieces.m_selectedPiece[i];                 this.m_buildPieces.m_lastSelectedPiece[i] = this.m_buildPieces.m_selectedPiece[i];
            }             }
            Hud.instance.TogglePieceSelection();             Hud.instance.TogglePieceSelection();
            return;             return;
        }         }
        if (Hud.IsPieceSelectionVisible())         if (Hud.IsPieceSelectionVisible())
        {         {
            if (ZInput.GetKeyDown(KeyCode.Escape, true) || ZInput.GetButtonDown("JoyButtonB") || ZInput.GetButtonDown("BuildMenu"))             if (ZInput.GetKeyDown(KeyCode.Escape, true) || ZInput.GetButtonDown("JoyButtonB") || ZInput.GetButtonDown("BuildMenu"))
            {             {
                for (int j = 0; j < this.m_buildPieces.m_selectedPiece.Length; j++)                 for (int j = 0; j < this.m_buildPieces.m_selectedPiece.Length; j++)
                {                 {
                    this.m_buildPieces.m_selectedPiece[j] = this.m_buildPieces.m_lastSelectedPiece[j];                     this.m_buildPieces.m_selectedPiece[j] = this.m_buildPieces.m_lastSelectedPiece[j];
                }                 }
                Hud.HidePieceSelection();                 Hud.HidePieceSelection();
                this.SetupPlacementGhost();                 this.SetupPlacementGhost();
            }             }
            if (ZInput.GetButtonDown("JoyButtonA"))             if (ZInput.GetButtonDown("JoyButtonA"))
            {             {
                Hud.HidePieceSelection();                 Hud.HidePieceSelection();
                this.PlayButtonSound();                 this.PlayButtonSound();
            }             }
            if (ZInput.GetButtonDown("JoyTabLeft") || ZInput.GetButtonDown("TabLeft") || ZInput.GetMouseScrollWheel() > 0f)             if (ZInput.GetButtonDown("JoyTabLeft") || ZInput.GetButtonDown("TabLeft") || ZInput.GetMouseScrollWheel() > 0f)
            {             {
                this.m_buildPieces.PrevCategory();                 this.m_buildPieces.PrevCategory();
                this.UpdateAvailablePiecesList();                 this.UpdateAvailablePiecesList();
            }             }
            if (ZInput.GetButtonDown("JoyTabRight") || ZInput.GetButtonDown("TabRight") || ZInput.GetMouseScrollWheel() < 0f)             if (ZInput.GetButtonDown("JoyTabRight") || ZInput.GetButtonDown("TabRight") || ZInput.GetMouseScrollWheel() < 0f)
            {             {
                this.m_buildPieces.NextCategory();                 this.m_buildPieces.NextCategory();
                this.UpdateAvailablePiecesList();                 this.UpdateAvailablePiecesList();
            }             }
            if (ZInput.GetButtonDown("JoyLStickLeft") || ZInput.GetButtonDown("JoyDPadLeft"))             if (ZInput.GetButtonDown("JoyLStickLeft") || ZInput.GetButtonDown("JoyDPadLeft"))
            {             {
                this.m_buildPieces.LeftPiece();                 this.m_buildPieces.LeftPiece();
                this.SetupPlacementGhost();                 this.SetupPlacementGhost();
            }             }
            if (ZInput.GetButtonDown("JoyLStickRight") || ZInput.GetButtonDown("JoyDPadRight"))             if (ZInput.GetButtonDown("JoyLStickRight") || ZInput.GetButtonDown("JoyDPadRight"))
            {             {
                this.m_buildPieces.RightPiece();                 this.m_buildPieces.RightPiece();
                this.SetupPlacementGhost();                 this.SetupPlacementGhost();
            }             }
            if (ZInput.GetButtonDown("JoyLStickUp") || ZInput.GetButtonDown("JoyDPadUp"))             if (ZInput.GetButtonDown("JoyLStickUp") || ZInput.GetButtonDown("JoyDPadUp"))
            {             {
                this.m_buildPieces.UpPiece();                 this.m_buildPieces.UpPiece();
                this.SetupPlacementGhost();                 this.SetupPlacementGhost();
            }             }
            if (ZInput.GetButtonDown("JoyLStickDown") || ZInput.GetButtonDown("JoyDPadDown"))             if (ZInput.GetButtonDown("JoyLStickDown") || ZInput.GetButtonDown("JoyDPadDown"))
            {             {
                this.m_buildPieces.DownPiece();                 this.m_buildPieces.DownPiece();
                this.SetupPlacementGhost();                 this.SetupPlacementGhost();
            }             }
        }         }
    }     }
   
    private void UpdateBuildGuiInput()     private void UpdateBuildGuiInput()
    {     {
        if (ZInput.IsNonClassicFunctionality() && ZInput.IsGamepadActive())         if (ZInput.IsNonClassicFunctionality() && ZInput.IsGamepadActive())
        {         {
            this.UpdateBuildGuiInputAlternative1();             this.UpdateBuildGuiInputAlternative1();
            return;             return;
        }         }
        if (!Hud.IsPieceSelectionVisible())         if (!Hud.IsPieceSelectionVisible())
        {         {
            if (Hud.instance.IsQuickPieceSelectEnabled())             if (Hud.instance.IsQuickPieceSelectEnabled())
            {             {
                if (!Hud.IsPieceSelectionVisible() && ZInput.GetButtonDown("BuildMenu") && !PlayerController.HasInputDelay && !Hud.InRadial())                 if (!Hud.IsPieceSelectionVisible() && ZInput.GetButtonDown("BuildMenu") && !PlayerController.HasInputDelay && !Hud.InRadial())
                {                 {
                    Hud.instance.TogglePieceSelection();                     Hud.instance.TogglePieceSelection();
                }                 }
            }             }
            else if (ZInput.GetButtonDown("BuildMenu") && !PlayerController.HasInputDelay && !Hud.InRadial())             else if (ZInput.GetButtonDown("BuildMenu") && !PlayerController.HasInputDelay && !Hud.InRadial())
            {             {
                Hud.instance.TogglePieceSelection();                 Hud.instance.TogglePieceSelection();
            }             }
            if (ZInput.GetButtonDown("JoyUse") && !PlayerController.HasInputDelay && !Hud.InRadial())             if (ZInput.GetButtonDown("JoyUse") && !PlayerController.HasInputDelay && !Hud.InRadial())
            {             {
                Hud.instance.TogglePieceSelection();                 Hud.instance.TogglePieceSelection();
                return;                 return;
            }             }
        }         }
        else if (Hud.IsPieceSelectionVisible())         else if (Hud.IsPieceSelectionVisible())
        {         {
            if (ZInput.GetKeyDown(KeyCode.Escape, true) || ZInput.GetButtonDown("JoyButtonB") || ZInput.GetButtonDown("BuildMenu"))             if (ZInput.GetKeyDown(KeyCode.Escape, true) || ZInput.GetButtonDown("JoyButtonB") || ZInput.GetButtonDown("BuildMenu"))
            {             {
                Hud.HidePieceSelection();                 Hud.HidePieceSelection();
            }             }
            if (ZInput.GetButtonDown("JoyUse"))             if (ZInput.GetButtonDown("JoyUse"))
            {             {
                Hud.HidePieceSelection();                 Hud.HidePieceSelection();
                this.PlayButtonSound();                 this.PlayButtonSound();
            }             }
            if (ZInput.GetButtonDown("JoyTabLeft") || ZInput.GetButtonDown("TabLeft") || ZInput.GetMouseScrollWheel() > 0f)             if (ZInput.GetButtonDown("JoyTabLeft") || ZInput.GetButtonDown("TabLeft") || ZInput.GetMouseScrollWheel() > 0f)
            {             {
                this.m_buildPieces.PrevCategory();                 this.m_buildPieces.PrevCategory();
                this.UpdateAvailablePiecesList();                 this.UpdateAvailablePiecesList();
            }             }
            if (ZInput.GetButtonDown("JoyTabRight") || ZInput.GetButtonDown("TabRight") || ZInput.GetMouseScrollWheel() < 0f)             if (ZInput.GetButtonDown("JoyTabRight") || ZInput.GetButtonDown("TabRight") || ZInput.GetMouseScrollWheel() < 0f)
            {             {
                this.m_buildPieces.NextCategory();                 this.m_buildPieces.NextCategory();
                this.UpdateAvailablePiecesList();                 this.UpdateAvailablePiecesList();
            }             }
            if (ZInput.GetButtonDown("JoyLStickLeft") || ZInput.GetButtonDown("JoyDPadLeft"))             if (ZInput.GetButtonDown("JoyLStickLeft") || ZInput.GetButtonDown("JoyDPadLeft"))
            {             {
                this.m_buildPieces.LeftPiece();                 this.m_buildPieces.LeftPiece();
                this.SetupPlacementGhost();                 this.SetupPlacementGhost();
            }             }
            if (ZInput.GetButtonDown("JoyLStickRight") || ZInput.GetButtonDown("JoyDPadRight"))             if (ZInput.GetButtonDown("JoyLStickRight") || ZInput.GetButtonDown("JoyDPadRight"))
            {             {
                this.m_buildPieces.RightPiece();                 this.m_buildPieces.RightPiece();
                this.SetupPlacementGhost();                 this.SetupPlacementGhost();
            }             }
            if (ZInput.GetButtonDown("JoyLStickUp") || ZInput.GetButtonDown("JoyDPadUp"))             if (ZInput.GetButtonDown("JoyLStickUp") || ZInput.GetButtonDown("JoyDPadUp"))
            {             {
                this.m_buildPieces.UpPiece();                 this.m_buildPieces.UpPiece();
                this.SetupPlacementGhost();                 this.SetupPlacementGhost();
            }             }
            if (ZInput.GetButtonDown("JoyLStickDown") || ZInput.GetButtonDown("JoyDPadDown"))             if (ZInput.GetButtonDown("JoyLStickDown") || ZInput.GetButtonDown("JoyDPadDown"))
            {             {
                this.m_buildPieces.DownPiece();                 this.m_buildPieces.DownPiece();
                this.SetupPlacementGhost();                 this.SetupPlacementGhost();
            }             }
        }         }
    }     }
   
    private void PlayButtonSound()     private void PlayButtonSound()
    {     {
        if (Player.m_localPlayer)         if (Player.m_localPlayer)
        {         {
            EffectList buttonEffects = this.m_buttonEffects;             EffectList buttonEffects = this.m_buttonEffects;
            if (buttonEffects == null)             if (buttonEffects == null)
            {             {
                return;                 return;
            }             }
            buttonEffects.Create(Player.m_localPlayer.transform.position, Quaternion.identity, null, 1f, -1);             buttonEffects.Create(Player.m_localPlayer.transform.position, Quaternion.identity, null, 1f, -1);
        }         }
    }     }
   
    public bool SetSelectedPiece(Piece p)     public bool SetSelectedPiece(Piece p)
    {     {
        Vector2Int vector2Int;         Vector2Int vector2Int;
        int num;         int num;
        if (this.m_buildPieces.GetPieceIndex(p, out vector2Int, out num))         if (this.m_buildPieces.GetPieceIndex(p, out vector2Int, out num))
        {         {
            this.SetBuildCategory(num);             this.SetBuildCategory(num);
            this.SetSelectedPiece(vector2Int);             this.SetSelectedPiece(vector2Int);
            return true;             return true;
        }         }
        return false;         return false;
    }     }
   
    public void SetSelectedPiece(Vector2Int p)     public void SetSelectedPiece(Vector2Int p)
    {     {
        if (this.m_buildPieces && this.m_buildPieces.GetSelectedIndex() != p)         if (this.m_buildPieces && this.m_buildPieces.GetSelectedIndex() != p)
        {         {
            this.m_buildPieces.SetSelected(p);             this.m_buildPieces.SetSelected(p);
            this.SetupPlacementGhost();             this.SetupPlacementGhost();
        }         }
    }     }
   
    public Piece GetPiece(Vector2Int p)     public Piece GetPiece(Vector2Int p)
    {     {
        if (!(this.m_buildPieces != null))         if (!(this.m_buildPieces != null))
        {         {
            return null;             return null;
        }         }
        return this.m_buildPieces.GetPiece(p);         return this.m_buildPieces.GetPiece(p);
    }     }
   
    public bool IsPieceAvailable(Piece piece)     public bool IsPieceAvailable(Piece piece)
    {     {
        return this.m_buildPieces != null && this.m_buildPieces.IsPieceAvailable(piece);         return this.m_buildPieces != null && this.m_buildPieces.IsPieceAvailable(piece);
    }     }
   
    public Piece GetSelectedPiece()     public Piece GetSelectedPiece()
    {     {
        if (!(this.m_buildPieces != null))         if (!(this.m_buildPieces != null))
        {         {
            return null;             return null;
        }         }
        return this.m_buildPieces.GetSelectedPiece();         return this.m_buildPieces.GetSelectedPiece();
    }     }
   
    private void LateUpdate()     private void LateUpdate()
    {     {
        if (!this.m_nview.IsValid())         if (!this.m_nview.IsValid())
        {         {
            return;             return;
        }         }
        this.UpdateEmote();         this.UpdateEmote();
        if (this.m_nview.IsOwner())         if (this.m_nview.IsOwner())
        {         {
            ZNet.instance.SetReferencePosition(base.transform.position);             ZNet.instance.SetReferencePosition(base.transform.position);
            this.UpdatePlacementGhost(false);             this.UpdatePlacementGhost(false);
        }         }
    }     }
   
    public void UpdateEvents()     public void UpdateEvents()
    {     {
        if (!RandEventSystem.instance)         if (!RandEventSystem.instance)
        {         {
            return;             return;
        }         }
        this.m_readyEvents.Clear();         this.m_readyEvents.Clear();
        foreach (RandomEvent randomEvent in RandEventSystem.instance.m_events)         foreach (RandomEvent randomEvent in RandEventSystem.instance.m_events)
        {         {
            if (RandEventSystem.instance.PlayerIsReadyForEvent(this, randomEvent))             if (RandEventSystem.instance.PlayerIsReadyForEvent(this, randomEvent))
            {             {
                this.m_readyEvents.Add(randomEvent.m_name);                 this.m_readyEvents.Add(randomEvent.m_name);
            }             }
        }         }
        if (ZNet.instance)         if (ZNet.instance)
        {         {
.              RandEventSystem.SetRandomEventsNeedsRefresh();
            ZNet.instance.m_serverSyncedPlayerData["possibleEvents"] = string.Join(",", this.m_readyEvents);             ZNet.instance.m_serverSyncedPlayerData["possibleEvents"] = string.Join(",", this.m_readyEvents);
        }         }
    }     }
   
    private void SetupAwake()     private void SetupAwake()
    {     {
        if (this.m_nview.GetZDO() == null)         if (this.m_nview.GetZDO() == null)
        {         {
            this.m_animator.SetBool("wakeup", false);             this.m_animator.SetBool("wakeup", false);
            return;             return;
        }         }
        bool @bool = this.m_nview.GetZDO().GetBool(ZDOVars.s_wakeup, true);         bool @bool = this.m_nview.GetZDO().GetBool(ZDOVars.s_wakeup, true);
        this.m_animator.SetBool("wakeup", @bool);         this.m_animator.SetBool("wakeup", @bool);
        if (@bool)         if (@bool)
        {         {
            this.m_wakeupTimer = 0f;             this.m_wakeupTimer = 0f;
        }         }
    }     }
   
    private void UpdateAwake(float dt)     private void UpdateAwake(float dt)
    {     {
        if (this.m_wakeupTimer >= 0f)         if (this.m_wakeupTimer >= 0f)
        {         {
            this.m_wakeupTimer += dt;             this.m_wakeupTimer += dt;
            if (this.m_wakeupTimer > 1f)             if (this.m_wakeupTimer > 1f)
            {             {
                this.m_wakeupTimer = -1f;                 this.m_wakeupTimer = -1f;
                this.m_animator.SetBool("wakeup", false);                 this.m_animator.SetBool("wakeup", false);
                if (this.m_nview.IsOwner())                 if (this.m_nview.IsOwner())
                {                 {
                    this.m_nview.GetZDO().Set(ZDOVars.s_wakeup, false);                     this.m_nview.GetZDO().Set(ZDOVars.s_wakeup, false);
                }                 }
            }             }
        }         }
    }     }
   
    private void EdgeOfWorldKill(float dt)     private void EdgeOfWorldKill(float dt)
    {     {
        if (this.IsDead())         if (this.IsDead())
        {         {
            return;             return;
        }         }
        float num = Utils.DistanceXZ(Vector3.zero, base.transform.position);         float num = Utils.DistanceXZ(Vector3.zero, base.transform.position);
        float num2 = 10420f;         float num2 = 10420f;
.        if (num > num2 && (base.IsSwimming() || base.transform.position.y < ZoneSystem.instance.m_waterLevel))         if (num > num2 && (base.IsSwimming() || base.transform.position.y < 30f))
        {         {
            Vector3 vector = Vector3.Normalize(base.transform.position);             Vector3 vector = Vector3.Normalize(base.transform.position);
            float num3 = Utils.LerpStep(num2, 10500f, num) * 10f;             float num3 = Utils.LerpStep(num2, 10500f, num) * 10f;
            this.m_body.MovePosition(this.m_body.position + vector * num3 * dt);             this.m_body.MovePosition(this.m_body.position + vector * num3 * dt);
        }         }
.        if (num > num2 && base.transform.position.y < ZoneSystem.instance.m_waterLevel - 40f)         if (num > num2 && base.transform.position.y < -10f)
        {         {
            HitData hitData = new HitData();             HitData hitData = new HitData();
            hitData.m_damage.m_damage = 99999f;             hitData.m_damage.m_damage = 99999f;
            hitData.m_hitType = HitData.HitType.EdgeOfWorld;             hitData.m_hitType = HitData.HitType.EdgeOfWorld;
            base.Damage(hitData);             base.Damage(hitData);
        }         }
    }     }
   
    private void AutoPickup(float dt)     private void AutoPickup(float dt)
    {     {
        if (this.IsTeleporting())         if (this.IsTeleporting())
        {         {
            return;             return;
        }         }
.        if (!this.m_enableAutoPickup)         if (!Player.m_enableAutoPickup)
        {         {
            return;             return;
        }         }
        Vector3 vector = base.transform.position + Vector3.up;         Vector3 vector = base.transform.position + Vector3.up;
        foreach (Collider collider in Physics.OverlapSphere(vector, this.m_autoPickupRange, this.m_autoPickupMask))         foreach (Collider collider in Physics.OverlapSphere(vector, this.m_autoPickupRange, this.m_autoPickupMask))
        {         {
            if (collider.attachedRigidbody)             if (collider.attachedRigidbody)
            {             {
.                ItemDrop component = collider.attachedRigidbody.GetComponent<ItemDrop>();                 ItemDrop itemDrop = collider.attachedRigidbody.GetComponent<ItemDrop>();
                if (!(component == null) && component.m_autoPickup && !this.HaveUniqueKey(component.m_itemData.m_shared.m_name) && component.GetComponent<ZNetView>().IsValid())                 FloatingTerrainDummy floatingTerrainDummy = null; 
                  if (itemDrop == null && (floatingTerrainDummy = collider.attachedRigidbody.gameObject.GetComponent<FloatingTerrainDummy>()) && floatingTerrainDummy) 
                  { 
                      itemDrop = floatingTerrainDummy.m_parent.gameObject.GetComponent<ItemDrop>(); 
                  } 
                  if (!(itemDrop == null) && itemDrop.m_autoPickup && !this.HaveUniqueKey(itemDrop.m_itemData.m_shared.m_name) && itemDrop.GetComponent<ZNetView>().IsValid())
                {                 {
.                    if (!component.CanPickup(true))                     if (!itemDrop.CanPickup(true))
                    {                     {
.                        component.RequestOwn();                         itemDrop.RequestOwn();
                    }                     }
.                    else if (!component.InTar())                     else if (!itemDrop.InTar())
                    {                     {
.                        component.Load();                         itemDrop.Load();
                        if (this.m_inventory.CanAddItem(component.m_itemData, -1) && component.m_itemData.GetWeight() + this.m_inventory.GetTotalWeight() <= this.GetMaxCarryWeight())                         if (this.m_inventory.CanAddItem(itemDrop.m_itemData, -1) && itemDrop.m_itemData.GetWeight() + this.m_inventory.GetTotalWeight() <= this.GetMaxCarryWeight())
                        {                         {
.                            float num = Vector3.Distance(component.transform.position, vector);                             float num = Vector3.Distance(itemDrop.transform.position, vector);
                            if (num <= this.m_autoPickupRange)                             if (num <= this.m_autoPickupRange)
                            {                             {
                                if (num < 0.3f)                                 if (num < 0.3f)
                                {                                 {
.                                    base.Pickup(component.gameObject, true, true);                                     base.Pickup(itemDrop.gameObject, true, true);
                                }                                 }
                                else                                 else
                                {                                 {
.                                    Vector3 vector2 = Vector3.Normalize(vector - component.transform.position);                                     Vector3 vector2 = Vector3.Normalize(vector - itemDrop.transform.position);
                                    float num2 = 15f;                                     float num2 = 15f;
.                                    component.transform.position = component.transform.position + vector2 * num2 * dt;                                     Vector3 vector3 = vector2 * num2 * dt; 
                                      itemDrop.transform.position += vector3; 
                                      if (floatingTerrainDummy) 
                                      { 
                                          floatingTerrainDummy.transform.position += vector3;
                                      } 
                                }                                 }
                            }                             }
                        }                         }
                    }                     }
                }                 }
            }             }
        }         }
    }     }
   
    private void PlayerAttackInput(float dt)     private void PlayerAttackInput(float dt)
    {     {
        if (this.InPlaceMode())         if (this.InPlaceMode())
        {         {
            return;             return;
        }         }
        ItemDrop.ItemData currentWeapon = base.GetCurrentWeapon();         ItemDrop.ItemData currentWeapon = base.GetCurrentWeapon();
        this.UpdateWeaponLoading(currentWeapon, dt);         this.UpdateWeaponLoading(currentWeapon, dt);
        if (currentWeapon != null && currentWeapon.m_shared.m_attack.m_bowDraw)         if (currentWeapon != null && currentWeapon.m_shared.m_attack.m_bowDraw)
        {         {
            this.UpdateAttackBowDraw(currentWeapon, dt);             this.UpdateAttackBowDraw(currentWeapon, dt);
        }         }
        else         else
        {         {
            if (this.m_attack)             if (this.m_attack)
            {             {
                this.m_queuedAttackTimer = 0.5f;                 this.m_queuedAttackTimer = 0.5f;
                this.m_queuedSecondAttackTimer = 0f;                 this.m_queuedSecondAttackTimer = 0f;
            }             }
            if (this.m_secondaryAttack)             if (this.m_secondaryAttack)
            {             {
                this.m_queuedSecondAttackTimer = 0.5f;                 this.m_queuedSecondAttackTimer = 0.5f;
                this.m_queuedAttackTimer = 0f;                 this.m_queuedAttackTimer = 0f;
            }             }
            this.m_queuedAttackTimer -= Time.fixedDeltaTime;             this.m_queuedAttackTimer -= Time.fixedDeltaTime;
            this.m_queuedSecondAttackTimer -= Time.fixedDeltaTime;             this.m_queuedSecondAttackTimer -= Time.fixedDeltaTime;
            if ((this.m_queuedAttackTimer > 0f || this.m_attackHold) && this.StartAttack(null, false))             if ((this.m_queuedAttackTimer > 0f || this.m_attackHold) && this.StartAttack(null, false))
            {             {
                this.m_queuedAttackTimer = 0f;                 this.m_queuedAttackTimer = 0f;
            }             }
            if ((this.m_queuedSecondAttackTimer > 0f || this.m_secondaryAttackHold) && this.StartAttack(null, true))             if ((this.m_queuedSecondAttackTimer > 0f || this.m_secondaryAttackHold) && this.StartAttack(null, true))
            {             {
                this.m_queuedSecondAttackTimer = 0f;                 this.m_queuedSecondAttackTimer = 0f;
            }             }
        }         }
        if (this.m_currentAttack != null && this.m_currentAttack.m_loopingAttack && !(this.m_currentAttackIsSecondary ? this.m_secondaryAttackHold : this.m_attackHold))         if (this.m_currentAttack != null && this.m_currentAttack.m_loopingAttack && !(this.m_currentAttackIsSecondary ? this.m_secondaryAttackHold : this.m_attackHold))
        {         {
            this.m_currentAttack.Abort();             this.m_currentAttack.Abort();
        }         }
    }     }
   
    private void UpdateWeaponLoading(ItemDrop.ItemData weapon, float dt)     private void UpdateWeaponLoading(ItemDrop.ItemData weapon, float dt)
    {     {
        if (weapon == null || !weapon.m_shared.m_attack.m_requiresReload)         if (weapon == null || !weapon.m_shared.m_attack.m_requiresReload)
        {         {
            this.SetWeaponLoaded(null);             this.SetWeaponLoaded(null);
            return;             return;
        }         }
        if (this.m_weaponLoaded == weapon)         if (this.m_weaponLoaded == weapon)
        {         {
            return;             return;
        }         }
        if (weapon.m_shared.m_attack.m_requiresReload && !this.IsReloadActionQueued())         if (weapon.m_shared.m_attack.m_requiresReload && !this.IsReloadActionQueued())
        {         {
.              if (!base.TryUseEitr(weapon.m_shared.m_attack.m_reloadEitrDrain))
              {
                  return;
              }
            this.QueueReloadAction();             this.QueueReloadAction();
        }         }
    }     }
   
    private void CancelReloadAction()     private void CancelReloadAction()
    {     {
        foreach (Player.MinorActionData minorActionData in this.m_actionQueue)         foreach (Player.MinorActionData minorActionData in this.m_actionQueue)
        {         {
            if (minorActionData.m_type == Player.MinorActionData.ActionType.Reload)             if (minorActionData.m_type == Player.MinorActionData.ActionType.Reload)
            {             {
                this.m_actionQueue.Remove(minorActionData);                 this.m_actionQueue.Remove(minorActionData);
                break;                 break;
            }             }
        }         }
    }     }
   
    public override void ResetLoadedWeapon()     public override void ResetLoadedWeapon()
    {     {
        this.SetWeaponLoaded(null);         this.SetWeaponLoaded(null);
        foreach (Player.MinorActionData minorActionData in this.m_actionQueue)         foreach (Player.MinorActionData minorActionData in this.m_actionQueue)
        {         {
            if (minorActionData.m_type == Player.MinorActionData.ActionType.Reload)             if (minorActionData.m_type == Player.MinorActionData.ActionType.Reload)
            {             {
                this.m_actionQueue.Remove(minorActionData);                 this.m_actionQueue.Remove(minorActionData);
                break;                 break;
            }             }
        }         }
    }     }
   
    private void SetWeaponLoaded(ItemDrop.ItemData weapon)     private void SetWeaponLoaded(ItemDrop.ItemData weapon)
    {     {
        if (weapon == this.m_weaponLoaded)         if (weapon == this.m_weaponLoaded)
        {         {
            return;             return;
        }         }
        this.m_weaponLoaded = weapon;         this.m_weaponLoaded = weapon;
        this.m_nview.GetZDO().Set(ZDOVars.s_weaponLoaded, weapon != null);         this.m_nview.GetZDO().Set(ZDOVars.s_weaponLoaded, weapon != null);
    }     }
   
    public override bool IsWeaponLoaded()     public override bool IsWeaponLoaded()
    {     {
        if (!this.m_nview.IsValid())         if (!this.m_nview.IsValid())
        {         {
            return false;             return false;
        }         }
        if (!this.m_nview.IsOwner())         if (!this.m_nview.IsOwner())
        {         {
            return this.m_nview.GetZDO().GetBool(ZDOVars.s_weaponLoaded, false);             return this.m_nview.GetZDO().GetBool(ZDOVars.s_weaponLoaded, false);
        }         }
        return this.m_weaponLoaded != null;         return this.m_weaponLoaded != null;
    }     }
   
    private void UpdateAttackBowDraw(ItemDrop.ItemData weapon, float dt)     private void UpdateAttackBowDraw(ItemDrop.ItemData weapon, float dt)
    {     {
        if (this.m_blocking || this.InMinorAction() || this.IsAttached())         if (this.m_blocking || this.InMinorAction() || this.IsAttached())
        {         {
            this.m_attackDrawTime = -1f;             this.m_attackDrawTime = -1f;
            if (!string.IsNullOrEmpty(weapon.m_shared.m_attack.m_drawAnimationState))             if (!string.IsNullOrEmpty(weapon.m_shared.m_attack.m_drawAnimationState))
            {             {
                this.m_zanim.SetBool(weapon.m_shared.m_attack.m_drawAnimationState, false);                 this.m_zanim.SetBool(weapon.m_shared.m_attack.m_drawAnimationState, false);
            }             }
            return;             return;
        }         }
        float num = weapon.GetDrawStaminaDrain();         float num = weapon.GetDrawStaminaDrain();
.          float drawEitrDrain = weapon.GetDrawEitrDrain();
        if ((double)base.GetAttackDrawPercentage() >= 1.0)         if ((double)base.GetAttackDrawPercentage() >= 1.0)
        {         {
            num *= 0.5f;             num *= 0.5f;
        }         }
.          num += num * this.GetEquipmentAttackStaminaModifier();
          this.m_seman.ModifyAttackStaminaUsage(num, ref num, true);
        bool flag = num <= 0f || this.HaveStamina(0f);         bool flag = num <= 0f || this.HaveStamina(0f);
.          bool flag2 = drawEitrDrain <= 0f || this.HaveEitr(0f);
        if (this.m_attackDrawTime < 0f)         if (this.m_attackDrawTime < 0f)
        {         {
            if (!this.m_attackHold)             if (!this.m_attackHold)
            {             {
                this.m_attackDrawTime = 0f;                 this.m_attackDrawTime = 0f;
                return;                 return;
            }             }
        }         }
        else         else
        {         {
            if (this.m_attackHold && flag && this.m_attackDrawTime >= 0f)             if (this.m_attackHold && flag && this.m_attackDrawTime >= 0f)
            {             {
                if (this.m_attackDrawTime == 0f)                 if (this.m_attackDrawTime == 0f)
                {                 {
                    if (!weapon.m_shared.m_attack.StartDraw(this, weapon))                     if (!weapon.m_shared.m_attack.StartDraw(this, weapon))
                    {                     {
                        this.m_attackDrawTime = -1f;                         this.m_attackDrawTime = -1f;
                        return;                         return;
                    }                     }
                    weapon.m_shared.m_holdStartEffect.Create(base.transform.position, Quaternion.identity, base.transform, 1f, -1);                     weapon.m_shared.m_holdStartEffect.Create(base.transform.position, Quaternion.identity, base.transform, 1f, -1);
                }                 }
                this.m_attackDrawTime += Time.fixedDeltaTime;                 this.m_attackDrawTime += Time.fixedDeltaTime;
                if (!string.IsNullOrEmpty(weapon.m_shared.m_attack.m_drawAnimationState))                 if (!string.IsNullOrEmpty(weapon.m_shared.m_attack.m_drawAnimationState))
                {                 {
                    this.m_zanim.SetBool(weapon.m_shared.m_attack.m_drawAnimationState, true);                     this.m_zanim.SetBool(weapon.m_shared.m_attack.m_drawAnimationState, true);
.                      this.m_zanim.SetFloat("drawpercent", base.GetAttackDrawPercentage());
                }                 }
                this.UseStamina(num * dt, false);                 this.UseStamina(num * dt, false);
.                  this.UseEitr(drawEitrDrain * dt);
                return;                 return;
            }             }
            if (this.m_attackDrawTime > 0f)             if (this.m_attackDrawTime > 0f)
            {             {
.                if (flag)                 if (flag && flag2)
                {                 {
                    this.StartAttack(null, false);                     this.StartAttack(null, false);
                }                 }
                if (!string.IsNullOrEmpty(weapon.m_shared.m_attack.m_drawAnimationState))                 if (!string.IsNullOrEmpty(weapon.m_shared.m_attack.m_drawAnimationState))
                {                 {
                    this.m_zanim.SetBool(weapon.m_shared.m_attack.m_drawAnimationState, false);                     this.m_zanim.SetBool(weapon.m_shared.m_attack.m_drawAnimationState, false);
                }                 }
                this.m_attackDrawTime = 0f;                 this.m_attackDrawTime = 0f;
            }             }
        }         }
    }     }
   
    protected override bool HaveQueuedChain()     protected override bool HaveQueuedChain()
    {     {
        return (this.m_queuedAttackTimer > 0f || this.m_attackHold) && base.GetCurrentWeapon() != null && this.m_currentAttack != null && this.m_currentAttack.CanStartChainAttack();         return (this.m_queuedAttackTimer > 0f || this.m_attackHold) && base.GetCurrentWeapon() != null && this.m_currentAttack != null && this.m_currentAttack.CanStartChainAttack();
    }     }
   
    private void UpdateBaseValue(float dt)     private void UpdateBaseValue(float dt)
    {     {
        this.m_baseValueUpdateTimer += dt;         this.m_baseValueUpdateTimer += dt;
        if (this.m_baseValueUpdateTimer > 2f)         if (this.m_baseValueUpdateTimer > 2f)
        {         {
            this.m_baseValueUpdateTimer = 0f;             this.m_baseValueUpdateTimer = 0f;
            this.m_baseValue = EffectArea.GetBaseValue(base.transform.position, 20f);             this.m_baseValue = EffectArea.GetBaseValue(base.transform.position, 20f);
.              this.m_comfortLevel = SE_Rested.CalculateComfortLevel(this);
              if (this.m_baseValueOld == this.m_baseValue)
              {
                  return;
              }
              this.m_baseValueOld = this.m_baseValue;
            ZNet.instance.m_serverSyncedPlayerData["baseValue"] = this.m_baseValue.ToString();             ZNet.instance.m_serverSyncedPlayerData["baseValue"] = this.m_baseValue.ToString();
            this.m_nview.GetZDO().Set(ZDOVars.s_baseValue, this.m_baseValue, false);             this.m_nview.GetZDO().Set(ZDOVars.s_baseValue, this.m_baseValue, false);
.            this.m_comfortLevel = SE_Rested.CalculateComfortLevel(this);             RandEventSystem.SetRandomEventsNeedsRefresh();
        }         }
    }     }
   
    public int GetComfortLevel()     public int GetComfortLevel()
    {     {
        if (this.m_nview == null)         if (this.m_nview == null)
        {         {
            return 0;             return 0;
        }         }
        return this.m_comfortLevel;         return this.m_comfortLevel;
    }     }
   
    public int GetBaseValue()     public int GetBaseValue()
    {     {
        if (!this.m_nview.IsValid())         if (!this.m_nview.IsValid())
        {         {
            return 0;             return 0;
        }         }
        if (this.m_nview.IsOwner())         if (this.m_nview.IsOwner())
        {         {
            return this.m_baseValue;             return this.m_baseValue;
        }         }
        return this.m_nview.GetZDO().GetInt(ZDOVars.s_baseValue, 0);         return this.m_nview.GetZDO().GetInt(ZDOVars.s_baseValue, 0);
    }     }
   
    public bool IsSafeInHome()     public bool IsSafeInHome()
    {     {
        return this.m_safeInHome;         return this.m_safeInHome;
    }     }
   
    private void UpdateBiome(float dt)     private void UpdateBiome(float dt)
    {     {
        if (this.InIntro())         if (this.InIntro())
        {         {
            return;             return;
        }         }
        if (this.m_biomeTimer == 0f)         if (this.m_biomeTimer == 0f)
        {         {
            Location location = Location.GetLocation(base.transform.position, false);             Location location = Location.GetLocation(base.transform.position, false);
            if (location != null && !string.IsNullOrEmpty(location.m_discoverLabel))             if (location != null && !string.IsNullOrEmpty(location.m_discoverLabel))
            {             {
                this.AddKnownLocationName(location.m_discoverLabel);                 this.AddKnownLocationName(location.m_discoverLabel);
            }             }
        }         }
        this.m_biomeTimer += dt;         this.m_biomeTimer += dt;
        if (this.m_biomeTimer > 1f)         if (this.m_biomeTimer > 1f)
        {         {
            this.m_biomeTimer = 0f;             this.m_biomeTimer = 0f;
            Heightmap.Biome biome = Heightmap.FindBiome(base.transform.position);             Heightmap.Biome biome = Heightmap.FindBiome(base.transform.position);
            if (this.m_currentBiome != biome)             if (this.m_currentBiome != biome)
            {             {
                this.m_currentBiome = biome;                 this.m_currentBiome = biome;
                this.AddKnownBiome(biome);                 this.AddKnownBiome(biome);
            }             }
        }         }
    }     }
   
    public Heightmap.Biome GetCurrentBiome()     public Heightmap.Biome GetCurrentBiome()
    {     {
        return this.m_currentBiome;         return this.m_currentBiome;
    }     }
   
    public override void RaiseSkill(Skills.SkillType skill, float value = 1f)     public override void RaiseSkill(Skills.SkillType skill, float value = 1f)
    {     {
        if (skill == Skills.SkillType.None)         if (skill == Skills.SkillType.None)
        {         {
            return;             return;
        }         }
        float num = 1f;         float num = 1f;
        this.m_seman.ModifyRaiseSkill(skill, ref num);         this.m_seman.ModifyRaiseSkill(skill, ref num);
        value *= num;         value *= num;
        this.m_skills.RaiseSkill(skill, value);         this.m_skills.RaiseSkill(skill, value);
    }     }
   
    private void UpdateStats(float dt)     private void UpdateStats(float dt)
    {     {
        if (this.InIntro() || this.IsTeleporting())         if (this.InIntro() || this.IsTeleporting())
        {         {
            return;             return;
        }         }
        this.m_timeSinceDeath += dt;         this.m_timeSinceDeath += dt;
.        this.UpdateMovementModifier();         this.UpdateModifiers();
        this.UpdateHomeItemModifier();   
        this.UpdateFood(dt, false);         this.UpdateFood(dt, false);
        bool flag = this.IsEncumbered();         bool flag = this.IsEncumbered();
        float maxStamina = this.GetMaxStamina();         float maxStamina = this.GetMaxStamina();
        float num = 1f;         float num = 1f;
        if (this.IsBlocking())         if (this.IsBlocking())
        {         {
            num *= 0.8f;             num *= 0.8f;
        }         }
        if ((base.IsSwimming() && !base.IsOnGround()) || this.InAttack() || this.InDodge() || this.m_wallRunning || flag)         if ((base.IsSwimming() && !base.IsOnGround()) || this.InAttack() || this.InDodge() || this.m_wallRunning || flag)
        {         {
            num = 0f;             num = 0f;
        }         }
        float num2 = (this.m_staminaRegen + (1f - this.m_stamina / maxStamina) * this.m_staminaRegen * this.m_staminaRegenTimeMultiplier) * num;         float num2 = (this.m_staminaRegen + (1f - this.m_stamina / maxStamina) * this.m_staminaRegen * this.m_staminaRegenTimeMultiplier) * num;
        float num3 = 1f;         float num3 = 1f;
        this.m_seman.ModifyStaminaRegen(ref num3);         this.m_seman.ModifyStaminaRegen(ref num3);
        num2 *= num3;         num2 *= num3;
        this.m_staminaRegenTimer -= dt;         this.m_staminaRegenTimer -= dt;
        if (this.m_stamina < maxStamina && this.m_staminaRegenTimer <= 0f)         if (this.m_stamina < maxStamina && this.m_staminaRegenTimer <= 0f)
        {         {
            this.m_stamina = Mathf.Min(maxStamina, this.m_stamina + num2 * dt * Game.m_staminaRegenRate);             this.m_stamina = Mathf.Min(maxStamina, this.m_stamina + num2 * dt * Game.m_staminaRegenRate);
        }         }
        this.m_nview.GetZDO().Set(ZDOVars.s_stamina, this.m_stamina);         this.m_nview.GetZDO().Set(ZDOVars.s_stamina, this.m_stamina);
        float maxEitr = this.GetMaxEitr();         float maxEitr = this.GetMaxEitr();
        float num4 = 1f;         float num4 = 1f;
        if (this.IsBlocking())         if (this.IsBlocking())
        {         {
            num4 *= 0.8f;             num4 *= 0.8f;
        }         }
        if (this.InAttack() || this.InDodge())         if (this.InAttack() || this.InDodge())
        {         {
            num4 = 0f;             num4 = 0f;
        }         }
        float num5 = (this.m_eiterRegen + (1f - this.m_eitr / maxEitr) * this.m_eiterRegen) * num4;         float num5 = (this.m_eiterRegen + (1f - this.m_eitr / maxEitr) * this.m_eiterRegen) * num4;
        float num6 = 1f;         float num6 = 1f;
        this.m_seman.ModifyEitrRegen(ref num6);         this.m_seman.ModifyEitrRegen(ref num6);
        num6 += this.GetEquipmentEitrRegenModifier();         num6 += this.GetEquipmentEitrRegenModifier();
        num5 *= num6;         num5 *= num6;
        this.m_eitrRegenTimer -= dt;         this.m_eitrRegenTimer -= dt;
        if (this.m_eitr < maxEitr && this.m_eitrRegenTimer <= 0f)         if (this.m_eitr < maxEitr && this.m_eitrRegenTimer <= 0f)
        {         {
            this.m_eitr = Mathf.Min(maxEitr, this.m_eitr + num5 * dt);             this.m_eitr = Mathf.Min(maxEitr, this.m_eitr + num5 * dt);
        }         }
        this.m_nview.GetZDO().Set(ZDOVars.s_eitr, this.m_eitr);         this.m_nview.GetZDO().Set(ZDOVars.s_eitr, this.m_eitr);
        if (flag)         if (flag)
        {         {
            if (this.m_moveDir.magnitude > 0.1f)             if (this.m_moveDir.magnitude > 0.1f)
            {             {
                this.UseStamina(this.m_encumberedStaminaDrain * dt, false);                 this.UseStamina(this.m_encumberedStaminaDrain * dt, false);
            }             }
.            this.m_seman.AddStatusEffect(Player.s_statusEffectEncumbered, false, 0, 0f);             this.m_seman.AddStatusEffect(SEMan.s_statusEffectEncumbered, false, 0, 0f);
            this.ShowTutorial("encumbered", false);             this.ShowTutorial("encumbered", false);
        }         }
        else         else
        {         {
.            this.m_seman.RemoveStatusEffect(Player.s_statusEffectEncumbered, false);             this.m_seman.RemoveStatusEffect(SEMan.s_statusEffectEncumbered, false);
        }         }
        if (!this.HardDeath())         if (!this.HardDeath())
        {         {
.            this.m_seman.AddStatusEffect(Player.s_statusEffectSoftDeath, false, 0, 0f);             this.m_seman.AddStatusEffect(SEMan.s_statusEffectSoftDeath, false, 0, 0f);
        }         }
        else         else
        {         {
.            this.m_seman.RemoveStatusEffect(Player.s_statusEffectSoftDeath, false);             this.m_seman.RemoveStatusEffect(SEMan.s_statusEffectSoftDeath, false);
        }         }
        this.UpdateEnvStatusEffects(dt);         this.UpdateEnvStatusEffects(dt);
    }     }
   
    public float GetEquipmentEitrRegenModifier()     public float GetEquipmentEitrRegenModifier()
    {     {
        float num = 0f;         float num = 0f;
        if (this.m_chestItem != null)         if (this.m_chestItem != null)
        {         {
            num += this.m_chestItem.m_shared.m_eitrRegenModifier;             num += this.m_chestItem.m_shared.m_eitrRegenModifier;
        }         }
        if (this.m_legItem != null)         if (this.m_legItem != null)
        {         {
            num += this.m_legItem.m_shared.m_eitrRegenModifier;             num += this.m_legItem.m_shared.m_eitrRegenModifier;
        }         }
        if (this.m_helmetItem != null)         if (this.m_helmetItem != null)
        {         {
            num += this.m_helmetItem.m_shared.m_eitrRegenModifier;             num += this.m_helmetItem.m_shared.m_eitrRegenModifier;
        }         }
        if (this.m_shoulderItem != null)         if (this.m_shoulderItem != null)
        {         {
            num += this.m_shoulderItem.m_shared.m_eitrRegenModifier;             num += this.m_shoulderItem.m_shared.m_eitrRegenModifier;
        }         }
        if (this.m_leftItem != null)         if (this.m_leftItem != null)
        {         {
            num += this.m_leftItem.m_shared.m_eitrRegenModifier;             num += this.m_leftItem.m_shared.m_eitrRegenModifier;
        }         }
        if (this.m_rightItem != null)         if (this.m_rightItem != null)
        {         {
            num += this.m_rightItem.m_shared.m_eitrRegenModifier;             num += this.m_rightItem.m_shared.m_eitrRegenModifier;
        }         }
        if (this.m_utilityItem != null)         if (this.m_utilityItem != null)
        {         {
            num += this.m_utilityItem.m_shared.m_eitrRegenModifier;             num += this.m_utilityItem.m_shared.m_eitrRegenModifier;
        }         }
        return num;         return num;
    }     }
   
    private void UpdateEnvStatusEffects(float dt)     private void UpdateEnvStatusEffects(float dt)
    {     {
        this.m_nearFireTimer += dt;         this.m_nearFireTimer += dt;
        HitData.DamageModifiers damageModifiers = base.GetDamageModifiers(null);         HitData.DamageModifiers damageModifiers = base.GetDamageModifiers(null);
        bool flag = this.m_nearFireTimer < 0.25f;         bool flag = this.m_nearFireTimer < 0.25f;
.        bool flag2 = this.m_seman.HaveStatusEffect("Burning");         bool flag2 = this.m_seman.HaveStatusEffect(SEMan.s_statusEffectBurning);
        bool flag3 = this.InShelter();         bool flag3 = this.InShelter();
        HitData.DamageModifier modifier = damageModifiers.GetModifier(HitData.DamageType.Frost);         HitData.DamageModifier modifier = damageModifiers.GetModifier(HitData.DamageType.Frost);
.        bool flag4 = EnvMan.instance.IsFreezing();         bool flag4 = EnvMan.IsFreezing();
        bool flag5 = EnvMan.instance.IsCold();         bool flag5 = EnvMan.IsCold();
        bool flag6 = EnvMan.instance.IsWet();         bool flag6 = EnvMan.IsWet();
        bool flag7 = this.IsSensed();         bool flag7 = this.IsSensed();
.        bool flag8 = this.m_seman.HaveStatusEffect("Wet");         bool flag8 = this.m_seman.HaveStatusEffect(SEMan.s_statusEffectWet);
        bool flag9 = this.IsSitting();         bool flag9 = this.IsSitting();
        bool flag10 = EffectArea.IsPointInsideArea(base.transform.position, EffectArea.Type.WarmCozyArea, 1f);         bool flag10 = EffectArea.IsPointInsideArea(base.transform.position, EffectArea.Type.WarmCozyArea, 1f);
.        bool flag11 = flag4 && !flag && !flag3;         bool flag11 = ShieldGenerator.IsInsideShield(base.transform.position); 
        bool flag12 = (flag5 && !flag) || (flag4 && flag && !flag3) || (flag4 && !flag && flag3);         bool flag12 = flag4 && !flag && !flag3;
          bool flag13 = (flag5 && !flag) || (flag4 && flag && !flag3) || (flag4 && !flag && flag3);
        if (modifier == HitData.DamageModifier.Resistant || modifier == HitData.DamageModifier.VeryResistant || flag10)         if (modifier == HitData.DamageModifier.Resistant || modifier == HitData.DamageModifier.VeryResistant || flag10)
        {         {
.            flag11 = false;  
            flag12 = false;             flag12 = false;
.              flag13 = false;
        }         }
.        if (flag6 && !this.m_underRoof)         if (flag6 && !this.m_underRoof && !flag11)
        {         {
.            this.m_seman.AddStatusEffect(Player.s_statusEffectWet, true, 0, 0f);             this.m_seman.AddStatusEffect(SEMan.s_statusEffectWet, true, 0, 0f);
        }         }
        if (flag3)         if (flag3)
        {         {
.            this.m_seman.AddStatusEffect(Player.s_statusEffectShelter, false, 0, 0f);             this.m_seman.AddStatusEffect(SEMan.s_statusEffectShelter, false, 0, 0f);
        }         }
        else         else
        {         {
.            this.m_seman.RemoveStatusEffect(Player.s_statusEffectShelter, false);             this.m_seman.RemoveStatusEffect(SEMan.s_statusEffectShelter, false);
        }         }
        if (flag)         if (flag)
        {         {
.            this.m_seman.AddStatusEffect(Player.s_statusEffectCampFire, false, 0, 0f);             this.m_seman.AddStatusEffect(SEMan.s_statusEffectCampFire, false, 0, 0f);
        }         }
        else         else
        {         {
.            this.m_seman.RemoveStatusEffect(Player.s_statusEffectCampFire, false);             this.m_seman.RemoveStatusEffect(SEMan.s_statusEffectCampFire, false);
        }         }
.        bool flag13 = !flag7 && (flag9 || flag3) && !flag12 && !flag11 && (!flag8 || flag10) && !flag2 && flag;         bool flag14 = !flag7 && (flag9 || flag3) && !flag13 && !flag12 && (!flag8 || flag10) && !flag2 && flag;
        if (flag13)         if (flag14)
        {         {
.            this.m_seman.AddStatusEffect(Player.s_statusEffectResting, false, 0, 0f);             this.m_seman.AddStatusEffect(SEMan.s_statusEffectResting, false, 0, 0f);
        }         }
        else         else
        {         {
.            this.m_seman.RemoveStatusEffect(Player.s_statusEffectResting, false);             this.m_seman.RemoveStatusEffect(SEMan.s_statusEffectResting, false);
        }         }
.        this.m_safeInHome = flag13 && flag3 && (float)this.GetBaseValue() >= 1f;         this.m_safeInHome = flag14 && flag3 && (float)this.GetBaseValue() >= 1f;
        if (flag11)         if (flag12)
        {         {
.            if (!this.m_seman.RemoveStatusEffect(Player.s_statusEffectCold, true))             if (!this.m_seman.RemoveStatusEffect(SEMan.s_statusEffectCold, true))
            {             {
.                this.m_seman.AddStatusEffect(Player.s_statusEffectFreezing, false, 0, 0f);                 this.m_seman.AddStatusEffect(SEMan.s_statusEffectFreezing, false, 0, 0f);
                return;                 return;
            }             }
        }         }
.        else if (flag12)         else if (flag13)
        {         {
.            if (!this.m_seman.RemoveStatusEffect(Player.s_statusEffectFreezing, true) && this.m_seman.AddStatusEffect(Player.s_statusEffectCold, false, 0, 0f))             if (!this.m_seman.RemoveStatusEffect(SEMan.s_statusEffectFreezing, true) && this.m_seman.AddStatusEffect(SEMan.s_statusEffectCold, false, 0, 0f))
            {             {
                this.ShowTutorial("cold", false);                 this.ShowTutorial("cold", false);
                return;                 return;
            }             }
        }         }
        else         else
        {         {
.            this.m_seman.RemoveStatusEffect(Player.s_statusEffectCold, false);             this.m_seman.RemoveStatusEffect(SEMan.s_statusEffectCold, false);
            this.m_seman.RemoveStatusEffect(Player.s_statusEffectFreezing, false);             this.m_seman.RemoveStatusEffect(SEMan.s_statusEffectFreezing, false);
        }         }
    }     }
   
    private bool CanEat(ItemDrop.ItemData item, bool showMessages)     private bool CanEat(ItemDrop.ItemData item, bool showMessages)
    {     {
        foreach (Player.Food food in this.m_foods)         foreach (Player.Food food in this.m_foods)
        {         {
            if (food.m_item.m_shared.m_name == item.m_shared.m_name)             if (food.m_item.m_shared.m_name == item.m_shared.m_name)
            {             {
                if (food.CanEatAgain())                 if (food.CanEatAgain())
                {                 {
                    return true;                     return true;
                }                 }
                this.Message(MessageHud.MessageType.Center, Localization.instance.Localize("$msg_nomore", new string[] { item.m_shared.m_name }), 0, null);                 this.Message(MessageHud.MessageType.Center, Localization.instance.Localize("$msg_nomore", new string[] { item.m_shared.m_name }), 0, null);
                return false;                 return false;
            }             }
        }         }
        using (List<Player.Food>.Enumerator enumerator = this.m_foods.GetEnumerator())         using (List<Player.Food>.Enumerator enumerator = this.m_foods.GetEnumerator())
        {         {
            while (enumerator.MoveNext())             while (enumerator.MoveNext())
            {             {
                if (enumerator.Current.CanEatAgain())                 if (enumerator.Current.CanEatAgain())
                {                 {
                    return true;                     return true;
                }                 }
            }             }
        }         }
        if (this.m_foods.Count >= 3)         if (this.m_foods.Count >= 3)
        {         {
            this.Message(MessageHud.MessageType.Center, "$msg_isfull", 0, null);             this.Message(MessageHud.MessageType.Center, "$msg_isfull", 0, null);
            return false;             return false;
        }         }
        return true;         return true;
    }     }
   
    private Player.Food GetMostDepletedFood()     private Player.Food GetMostDepletedFood()
    {     {
        Player.Food food = null;         Player.Food food = null;
        foreach (Player.Food food2 in this.m_foods)         foreach (Player.Food food2 in this.m_foods)
        {         {
            if (food2.CanEatAgain() && (food == null || food2.m_time < food.m_time))             if (food2.CanEatAgain() && (food == null || food2.m_time < food.m_time))
            {             {
                food = food2;                 food = food2;
            }             }
        }         }
        return food;         return food;
    }     }
   
    public void ClearFood()     public void ClearFood()
    {     {
        this.m_foods.Clear();         this.m_foods.Clear();
    }     }
   
    public bool RemoveOneFood()     public bool RemoveOneFood()
    {     {
        if (this.m_foods.Count == 0)         if (this.m_foods.Count == 0)
        {         {
            return false;             return false;
        }         }
        this.m_foods.RemoveAt(UnityEngine.Random.Range(0, this.m_foods.Count));         this.m_foods.RemoveAt(UnityEngine.Random.Range(0, this.m_foods.Count));
        return true;         return true;
    }     }
   
    private bool EatFood(ItemDrop.ItemData item)     private bool EatFood(ItemDrop.ItemData item)
    {     {
        if (!this.CanEat(item, false))         if (!this.CanEat(item, false))
        {         {
            return false;             return false;
        }         }
        string text = "";         string text = "";
        if (item.m_shared.m_food > 0f)         if (item.m_shared.m_food > 0f)
        {         {
            text = text + " +" + item.m_shared.m_food.ToString() + " $item_food_health ";             text = text + " +" + item.m_shared.m_food.ToString() + " $item_food_health ";
        }         }
        if (item.m_shared.m_foodStamina > 0f)         if (item.m_shared.m_foodStamina > 0f)
        {         {
            text = text + " +" + item.m_shared.m_foodStamina.ToString() + " $item_food_stamina ";             text = text + " +" + item.m_shared.m_foodStamina.ToString() + " $item_food_stamina ";
        }         }
        if (item.m_shared.m_foodEitr > 0f)         if (item.m_shared.m_foodEitr > 0f)
        {         {
            text = text + " +" + item.m_shared.m_foodEitr.ToString() + " $item_food_eitr ";             text = text + " +" + item.m_shared.m_foodEitr.ToString() + " $item_food_eitr ";
        }         }
        this.Message(MessageHud.MessageType.Center, text, 0, null);         this.Message(MessageHud.MessageType.Center, text, 0, null);
        foreach (Player.Food food in this.m_foods)         foreach (Player.Food food in this.m_foods)
        {         {
            if (food.m_item.m_shared.m_name == item.m_shared.m_name)             if (food.m_item.m_shared.m_name == item.m_shared.m_name)
            {             {
                if (food.CanEatAgain())                 if (food.CanEatAgain())
                {                 {
                    food.m_time = item.m_shared.m_foodBurnTime;                     food.m_time = item.m_shared.m_foodBurnTime;
                    food.m_health = item.m_shared.m_food;                     food.m_health = item.m_shared.m_food;
                    food.m_stamina = item.m_shared.m_foodStamina;                     food.m_stamina = item.m_shared.m_foodStamina;
                    food.m_eitr = item.m_shared.m_foodEitr;                     food.m_eitr = item.m_shared.m_foodEitr;
                    this.UpdateFood(0f, true);                     this.UpdateFood(0f, true);
                    return true;                     return true;
                }                 }
                return false;                 return false;
            }             }
        }         }
        if (this.m_foods.Count < 3)         if (this.m_foods.Count < 3)
        {         {
            Player.Food food2 = new Player.Food();             Player.Food food2 = new Player.Food();
            food2.m_name = item.m_dropPrefab.name;             food2.m_name = item.m_dropPrefab.name;
            food2.m_item = item;             food2.m_item = item;
            food2.m_time = item.m_shared.m_foodBurnTime;             food2.m_time = item.m_shared.m_foodBurnTime;
            food2.m_health = item.m_shared.m_food;             food2.m_health = item.m_shared.m_food;
            food2.m_stamina = item.m_shared.m_foodStamina;             food2.m_stamina = item.m_shared.m_foodStamina;
            food2.m_eitr = item.m_shared.m_foodEitr;             food2.m_eitr = item.m_shared.m_foodEitr;
            this.m_foods.Add(food2);             this.m_foods.Add(food2);
            this.UpdateFood(0f, true);             this.UpdateFood(0f, true);
            return true;             return true;
        }         }
        Player.Food mostDepletedFood = this.GetMostDepletedFood();         Player.Food mostDepletedFood = this.GetMostDepletedFood();
        if (mostDepletedFood != null)         if (mostDepletedFood != null)
        {         {
            mostDepletedFood.m_name = item.m_dropPrefab.name;             mostDepletedFood.m_name = item.m_dropPrefab.name;
            mostDepletedFood.m_item = item;             mostDepletedFood.m_item = item;
            mostDepletedFood.m_time = item.m_shared.m_foodBurnTime;             mostDepletedFood.m_time = item.m_shared.m_foodBurnTime;
            mostDepletedFood.m_health = item.m_shared.m_food;             mostDepletedFood.m_health = item.m_shared.m_food;
            mostDepletedFood.m_stamina = item.m_shared.m_foodStamina;             mostDepletedFood.m_stamina = item.m_shared.m_foodStamina;
            this.UpdateFood(0f, true);             this.UpdateFood(0f, true);
            return true;             return true;
        }         }
        Game.instance.IncrementPlayerStat(PlayerStatType.FoodEaten, 1f);         Game.instance.IncrementPlayerStat(PlayerStatType.FoodEaten, 1f);
        return false;         return false;
    }     }
   
    private void UpdateFood(float dt, bool forceUpdate)     private void UpdateFood(float dt, bool forceUpdate)
    {     {
        this.m_foodUpdateTimer += dt;         this.m_foodUpdateTimer += dt;
        if (this.m_foodUpdateTimer >= 1f || forceUpdate)         if (this.m_foodUpdateTimer >= 1f || forceUpdate)
        {         {
            this.m_foodUpdateTimer -= 1f;             this.m_foodUpdateTimer -= 1f;
            foreach (Player.Food food in this.m_foods)             foreach (Player.Food food in this.m_foods)
            {             {
                food.m_time -= 1f;                 food.m_time -= 1f;
                float num = Mathf.Clamp01(food.m_time / food.m_item.m_shared.m_foodBurnTime);                 float num = Mathf.Clamp01(food.m_time / food.m_item.m_shared.m_foodBurnTime);
                num = Mathf.Pow(num, 0.3f);                 num = Mathf.Pow(num, 0.3f);
                food.m_health = food.m_item.m_shared.m_food * num;                 food.m_health = food.m_item.m_shared.m_food * num;
                food.m_stamina = food.m_item.m_shared.m_foodStamina * num;                 food.m_stamina = food.m_item.m_shared.m_foodStamina * num;
                food.m_eitr = food.m_item.m_shared.m_foodEitr * num;                 food.m_eitr = food.m_item.m_shared.m_foodEitr * num;
                if (food.m_time <= 0f)                 if (food.m_time <= 0f)
                {                 {
                    this.Message(MessageHud.MessageType.Center, "$msg_food_done", 0, null);                     this.Message(MessageHud.MessageType.Center, "$msg_food_done", 0, null);
                    this.m_foods.Remove(food);                     this.m_foods.Remove(food);
                    break;                     break;
                }                 }
            }             }
            float num2;             float num2;
            float num3;             float num3;
            float num4;             float num4;
            this.GetTotalFoodValue(out num2, out num3, out num4);             this.GetTotalFoodValue(out num2, out num3, out num4);
            this.SetMaxHealth(num2, true);             this.SetMaxHealth(num2, true);
            this.SetMaxStamina(num3, true);             this.SetMaxStamina(num3, true);
            this.SetMaxEitr(num4, true);             this.SetMaxEitr(num4, true);
            if (num4 > 0f)             if (num4 > 0f)
            {             {
                this.ShowTutorial("eitr", false);                 this.ShowTutorial("eitr", false);
            }             }
        }         }
        if (!forceUpdate)         if (!forceUpdate)
        {         {
            this.m_foodRegenTimer += dt;             this.m_foodRegenTimer += dt;
            if (this.m_foodRegenTimer >= 10f)             if (this.m_foodRegenTimer >= 10f)
            {             {
                this.m_foodRegenTimer = 0f;                 this.m_foodRegenTimer = 0f;
                float num5 = 0f;                 float num5 = 0f;
                foreach (Player.Food food2 in this.m_foods)                 foreach (Player.Food food2 in this.m_foods)
                {                 {
                    num5 += food2.m_item.m_shared.m_foodRegen;                     num5 += food2.m_item.m_shared.m_foodRegen;
                }                 }
                if (num5 > 0f)                 if (num5 > 0f)
                {                 {
                    float num6 = 1f;                     float num6 = 1f;
                    this.m_seman.ModifyHealthRegen(ref num6);                     this.m_seman.ModifyHealthRegen(ref num6);
                    num5 *= num6;                     num5 *= num6;
                    base.Heal(num5, true);                     base.Heal(num5, true);
                }                 }
            }             }
        }         }
    }     }
   
    private void GetTotalFoodValue(out float hp, out float stamina, out float eitr)     private void GetTotalFoodValue(out float hp, out float stamina, out float eitr)
    {     {
        hp = this.m_baseHP;         hp = this.m_baseHP;
        stamina = this.m_baseStamina;         stamina = this.m_baseStamina;
        eitr = 0f;         eitr = 0f;
        foreach (Player.Food food in this.m_foods)         foreach (Player.Food food in this.m_foods)
        {         {
            hp += food.m_health;             hp += food.m_health;
            stamina += food.m_stamina;             stamina += food.m_stamina;
            eitr += food.m_eitr;             eitr += food.m_eitr;
        }         }
    }     }
   
    public float GetBaseFoodHP()     public float GetBaseFoodHP()
    {     {
        return this.m_baseHP;         return this.m_baseHP;
    }     }
   
    public List<Player.Food> GetFoods()     public List<Player.Food> GetFoods()
    {     {
        return this.m_foods;         return this.m_foods;
    }     }
   
    public void OnSpawned()     public void OnSpawned()
    {     {
        this.m_spawnEffects.Create(base.transform.position, Quaternion.identity, null, 1f, -1);         this.m_spawnEffects.Create(base.transform.position, Quaternion.identity, null, 1f, -1);
        if (this.m_firstSpawn)         if (this.m_firstSpawn)
        {         {
            if (this.m_valkyrie != null)             if (this.m_valkyrie != null)
            {             {
                UnityEngine.Object.Instantiate<GameObject>(this.m_valkyrie, base.transform.position, Quaternion.identity);                 UnityEngine.Object.Instantiate<GameObject>(this.m_valkyrie, base.transform.position, Quaternion.identity);
            }             }
            this.m_firstSpawn = false;             this.m_firstSpawn = false;
        }         }
    }     }
   
    protected override bool CheckRun(Vector3 moveDir, float dt)     protected override bool CheckRun(Vector3 moveDir, float dt)
    {     {
        if (!base.CheckRun(moveDir, dt))         if (!base.CheckRun(moveDir, dt))
        {         {
            return false;             return false;
        }         }
        bool flag = this.HaveStamina(0f);         bool flag = this.HaveStamina(0f);
        float skillFactor = this.m_skills.GetSkillFactor(Skills.SkillType.Run);         float skillFactor = this.m_skills.GetSkillFactor(Skills.SkillType.Run);
        float num = Mathf.Lerp(1f, 0.5f, skillFactor);         float num = Mathf.Lerp(1f, 0.5f, skillFactor);
        float num2 = this.m_runStaminaDrain * num;         float num2 = this.m_runStaminaDrain * num;
.        this.m_seman.ModifyRunStaminaDrain(num2, ref num2);         num2 -= num2 * this.GetEquipmentMovementModifier(); 
          num2 += num2 * this.GetEquipmentRunStaminaModifier(); 
          this.m_seman.ModifyRunStaminaDrain(num2, ref num2, true);
        this.UseStamina(dt * num2 * Game.m_moveStaminaRate, false);         this.UseStamina(dt * num2 * Game.m_moveStaminaRate, false);
        if (this.HaveStamina(0f))         if (this.HaveStamina(0f))
        {         {
            this.m_runSkillImproveTimer += dt;             this.m_runSkillImproveTimer += dt;
            if (this.m_runSkillImproveTimer > 1f)             if (this.m_runSkillImproveTimer > 1f)
            {             {
                this.m_runSkillImproveTimer = 0f;                 this.m_runSkillImproveTimer = 0f;
                this.RaiseSkill(Skills.SkillType.Run, 1f);                 this.RaiseSkill(Skills.SkillType.Run, 1f);
            }             }
            this.ClearActionQueue();             this.ClearActionQueue();
            return true;             return true;
        }         }
        if (flag)         if (flag)
        {         {
            Hud.instance.StaminaBarEmptyFlash();             Hud.instance.StaminaBarEmptyFlash();
        }         }
        return false;         return false;
    }     }
   
.    private void UpdateMovementModifier()     private void UpdateModifiers()
    {     {
.        this.m_equipmentMovementModifier = 0f;          if (Player.s_equipmentModifierSourceFields == null)
        if (this.m_rightItem != null)  
        {         {
.            this.m_equipmentMovementModifier += this.m_rightItem.m_shared.m_movementModifier;             return;
        }   
        if (this.m_leftItem != null)   
        {   
            this.m_equipmentMovementModifier += this.m_leftItem.m_shared.m_movementModifier;   
        }   
        if (this.m_chestItem != null)   
        {   
            this.m_equipmentMovementModifier += this.m_chestItem.m_shared.m_movementModifier;   
        }   
        if (this.m_legItem != null)   
        {   
            this.m_equipmentMovementModifier += this.m_legItem.m_shared.m_movementModifier;   
        }   
        if (this.m_helmetItem != null)   
        {   
            this.m_equipmentMovementModifier += this.m_helmetItem.m_shared.m_movementModifier;   
        }   
        if (this.m_shoulderItem != null)   
        {   
            this.m_equipmentMovementModifier += this.m_shoulderItem.m_shared.m_movementModifier;   
        }         }
.        if (this.m_utilityItem != null)         for (int i = 0; i < this.m_equipmentModifierValues.Length; i++)
        {         {
.            this.m_equipmentMovementModifier += this.m_utilityItem.m_shared.m_movementModifier;             float num = 0f;
              if (this.m_rightItem != null) 
              { 
                  num += (float)Player.s_equipmentModifierSourceFields[i].GetValue(this.m_rightItem.m_shared); 
              } 
              if (this.m_leftItem != null) 
              { 
                  num += (float)Player.s_equipmentModifierSourceFields[i].GetValue(this.m_leftItem.m_shared); 
              } 
              if (this.m_chestItem != null) 
              { 
                  num += (float)Player.s_equipmentModifierSourceFields[i].GetValue(this.m_chestItem.m_shared); 
              } 
              if (this.m_legItem != null) 
              { 
                  num += (float)Player.s_equipmentModifierSourceFields[i].GetValue(this.m_legItem.m_shared); 
              } 
              if (this.m_helmetItem != null) 
              { 
                  num += (float)Player.s_equipmentModifierSourceFields[i].GetValue(this.m_helmetItem.m_shared); 
              } 
              if (this.m_shoulderItem != null) 
              { 
                  num += (float)Player.s_equipmentModifierSourceFields[i].GetValue(this.m_shoulderItem.m_shared); 
              } 
              if (this.m_utilityItem != null) 
              { 
                  num += (float)Player.s_equipmentModifierSourceFields[i].GetValue(this.m_utilityItem.m_shared); 
              } 
              this.m_equipmentModifierValues[i] = num; 
        }         }
    }     }
   
.    private void UpdateHomeItemModifier()     public void AppendEquipmentModifierTooltips(ItemDrop.ItemData item, StringBuilder sb)
    {     {
.        this.m_equipmentBaseItemModifier = 0f;          for (int i = 0; i < this.m_equipmentModifierValues.Length; i++) 
        if (this.m_rightItem != null)   
        {   
            this.m_equipmentBaseItemModifier += this.m_rightItem.m_shared.m_baseItemsStaminaModifier;   
        }   
        if (this.m_leftItem != null)   
        {   
            this.m_equipmentBaseItemModifier += this.m_leftItem.m_shared.m_baseItemsStaminaModifier;   
        }   
        if (this.m_chestItem != null)   
        {   
            this.m_equipmentBaseItemModifier += this.m_chestItem.m_shared.m_baseItemsStaminaModifier;   
        }   
        if (this.m_legItem != null)   
        {   
            this.m_equipmentBaseItemModifier += this.m_legItem.m_shared.m_baseItemsStaminaModifier;   
        }   
        if (this.m_helmetItem != null)   
        {   
            this.m_equipmentBaseItemModifier += this.m_helmetItem.m_shared.m_baseItemsStaminaModifier;   
        }   
        if (this.m_shoulderItem != null)   
        {   
            this.m_equipmentBaseItemModifier += this.m_shoulderItem.m_shared.m_baseItemsStaminaModifier;   
        }   
        if (this.m_utilityItem != null)   
        {         {
.            this.m_equipmentBaseItemModifier += this.m_utilityItem.m_shared.m_baseItemsStaminaModifier;             object value = Player.s_equipmentModifierSourceFields[i].GetValue(item.m_shared); 
              if (value is float) 
              { 
                  float num = (float)value; 
                  if (num != 0f) 
                  { 
                      sb.AppendFormat(string.Concat(new string[] 
                      { 
                          "\n", 
                          Player.s_equipmentModifierTooltips[i], 
                          ": <color=orange>", 
                          (num * 100f).ToString("+0;-0"), 
                          "%</color> ($item_total:<color=yellow>", 
                          (this.GetEquipmentModifierPlusSE(i) * 100f).ToString("+0;-0"), 
                          "%</color>)" 
                      }), Array.Empty<object>());
                  } 
              } 
        }         }
    }     }
   
    public void OnSkillLevelup(Skills.SkillType skill, float level)     public void OnSkillLevelup(Skills.SkillType skill, float level)
    {     {
        this.m_skillLevelupEffects.Create(this.m_head.position, this.m_head.rotation, this.m_head, 1f, -1);         this.m_skillLevelupEffects.Create(this.m_head.position, this.m_head.rotation, this.m_head, 1f, -1);
    }     }
   
    protected override void OnJump()     protected override void OnJump()
    {     {
        this.ClearActionQueue();         this.ClearActionQueue();
.        float num = this.m_jumpStaminaUsage - this.m_jumpStaminaUsage * this.m_equipmentMovementModifier;         float num = this.m_jumpStaminaUsage - this.m_jumpStaminaUsage * this.GetEquipmentMovementModifier() + this.m_jumpStaminaUsage * this.GetEquipmentJumpStaminaModifier();
        this.m_seman.ModifyJumpStaminaUsage(num, ref num);         this.m_seman.ModifyJumpStaminaUsage(num, ref num, true);
        this.UseStamina(num * Game.m_moveStaminaRate, false);         this.UseStamina(num * Game.m_moveStaminaRate, false);
        Game.instance.IncrementPlayerStat(PlayerStatType.Jumps, 1f);         Game.instance.IncrementPlayerStat(PlayerStatType.Jumps, 1f);
    }     }
   
    protected override void OnSwimming(Vector3 targetVel, float dt)     protected override void OnSwimming(Vector3 targetVel, float dt)
    {     {
        base.OnSwimming(targetVel, dt);         base.OnSwimming(targetVel, dt);
        if (targetVel.magnitude > 0.1f)         if (targetVel.magnitude > 0.1f)
        {         {
            float skillFactor = this.m_skills.GetSkillFactor(Skills.SkillType.Swim);             float skillFactor = this.m_skills.GetSkillFactor(Skills.SkillType.Swim);
            float num = Mathf.Lerp(this.m_swimStaminaDrainMinSkill, this.m_swimStaminaDrainMaxSkill, skillFactor);             float num = Mathf.Lerp(this.m_swimStaminaDrainMinSkill, this.m_swimStaminaDrainMaxSkill, skillFactor);
.              num += num * this.GetEquipmentSwimStaminaModifier();
              this.m_seman.ModifySwimStaminaUsage(num, ref num, true);
            this.UseStamina(dt * num * Game.m_moveStaminaRate, false);             this.UseStamina(dt * num * Game.m_moveStaminaRate, false);
            this.m_swimSkillImproveTimer += dt;             this.m_swimSkillImproveTimer += dt;
            if (this.m_swimSkillImproveTimer > 1f)             if (this.m_swimSkillImproveTimer > 1f)
            {             {
                this.m_swimSkillImproveTimer = 0f;                 this.m_swimSkillImproveTimer = 0f;
                this.RaiseSkill(Skills.SkillType.Swim, 1f);                 this.RaiseSkill(Skills.SkillType.Swim, 1f);
            }             }
        }         }
        if (!this.HaveStamina(0f))         if (!this.HaveStamina(0f))
        {         {
            this.m_drownDamageTimer += dt;             this.m_drownDamageTimer += dt;
            if (this.m_drownDamageTimer > 1f)             if (this.m_drownDamageTimer > 1f)
            {             {
                this.m_drownDamageTimer = 0f;                 this.m_drownDamageTimer = 0f;
                float num2 = Mathf.Ceil(base.GetMaxHealth() / 20f);                 float num2 = Mathf.Ceil(base.GetMaxHealth() / 20f);
                HitData hitData = new HitData();                 HitData hitData = new HitData();
                hitData.m_damage.m_damage = num2;                 hitData.m_damage.m_damage = num2;
                hitData.m_point = base.GetCenterPoint();                 hitData.m_point = base.GetCenterPoint();
                hitData.m_dir = Vector3.down;                 hitData.m_dir = Vector3.down;
                hitData.m_pushForce = 10f;                 hitData.m_pushForce = 10f;
                hitData.m_hitType = HitData.HitType.Drowning;                 hitData.m_hitType = HitData.HitType.Drowning;
                base.Damage(hitData);                 base.Damage(hitData);
                Vector3 position = base.transform.position;                 Vector3 position = base.transform.position;
                position.y = base.GetLiquidLevel();                 position.y = base.GetLiquidLevel();
                this.m_drownEffects.Create(position, base.transform.rotation, null, 1f, -1);                 this.m_drownEffects.Create(position, base.transform.rotation, null, 1f, -1);
            }             }
        }         }
    }     }
   
    protected override bool TakeInput()     protected override bool TakeInput()
    {     {
        bool flag = (!Chat.instance || !Chat.instance.HasFocus()) && !global::Console.IsVisible() && !TextInput.IsVisible() && (!StoreGui.IsVisible() && !InventoryGui.IsVisible() && !Menu.IsVisible() && (!TextViewer.instance || !TextViewer.instance.IsVisible()) && !Minimap.IsOpen() && !GameCamera.InFreeFly()) && !PlayerCustomizaton.IsBarberGuiVisible();         bool flag = (!Chat.instance || !Chat.instance.HasFocus()) && !global::Console.IsVisible() && !TextInput.IsVisible() && (!StoreGui.IsVisible() && !InventoryGui.IsVisible() && !Menu.IsVisible() && (!TextViewer.instance || !TextViewer.instance.IsVisible()) && !Minimap.IsOpen() && !GameCamera.InFreeFly()) && !PlayerCustomizaton.IsBarberGuiVisible();
        if (this.IsDead() || this.InCutscene() || this.IsTeleporting())         if (this.IsDead() || this.InCutscene() || this.IsTeleporting())
        {         {
            flag = false;             flag = false;
        }         }
        return flag;         return flag;
    }     }
   
    public void UseHotbarItem(int index)     public void UseHotbarItem(int index)
    {     {
        ItemDrop.ItemData itemAt = this.m_inventory.GetItemAt(index - 1, 0);         ItemDrop.ItemData itemAt = this.m_inventory.GetItemAt(index - 1, 0);
        if (itemAt != null)         if (itemAt != null)
        {         {
            base.UseItem(null, itemAt, false);             base.UseItem(null, itemAt, false);
        }         }
    }     }
   
    public bool RequiredCraftingStation(Recipe recipe, int qualityLevel, bool checkLevel)     public bool RequiredCraftingStation(Recipe recipe, int qualityLevel, bool checkLevel)
    {     {
        CraftingStation requiredStation = recipe.GetRequiredStation(qualityLevel);         CraftingStation requiredStation = recipe.GetRequiredStation(qualityLevel);
        if (requiredStation != null)         if (requiredStation != null)
        {         {
            if (this.m_currentStation == null)             if (this.m_currentStation == null)
            {             {
                return false;                 return false;
            }             }
            if (requiredStation.m_name != this.m_currentStation.m_name)             if (requiredStation.m_name != this.m_currentStation.m_name)
            {             {
                return false;                 return false;
            }             }
            if (checkLevel)             if (checkLevel)
            {             {
                int requiredStationLevel = recipe.GetRequiredStationLevel(qualityLevel);                 int requiredStationLevel = recipe.GetRequiredStationLevel(qualityLevel);
                if (this.m_currentStation.GetLevel(true) < requiredStationLevel)                 if (this.m_currentStation.GetLevel(true) < requiredStationLevel)
                {                 {
                    return false;                     return false;
                }                 }
            }             }
        }         }
        else if (this.m_currentStation != null && !this.m_currentStation.m_showBasicRecipies)         else if (this.m_currentStation != null && !this.m_currentStation.m_showBasicRecipies)
        {         {
            return false;             return false;
        }         }
        return true;         return true;
    }     }
   
    public bool HaveRequirements(Recipe recipe, bool discover, int qualityLevel)     public bool HaveRequirements(Recipe recipe, bool discover, int qualityLevel)
    {     {
        if (discover)         if (discover)
        {         {
            if (recipe.m_craftingStation && !this.KnowStationLevel(recipe.m_craftingStation.m_name, recipe.m_minStationLevel))             if (recipe.m_craftingStation && !this.KnowStationLevel(recipe.m_craftingStation.m_name, recipe.m_minStationLevel))
            {             {
                return false;                 return false;
            }             }
        }         }
        else if (!this.RequiredCraftingStation(recipe, qualityLevel, true))         else if (!this.RequiredCraftingStation(recipe, qualityLevel, true))
        {         {
            return false;             return false;
        }         }
        return (recipe.m_item.m_itemData.m_shared.m_dlc.Length <= 0 || DLCMan.instance.IsDLCInstalled(recipe.m_item.m_itemData.m_shared.m_dlc)) && this.HaveRequirementItems(recipe, discover, qualityLevel);         return (recipe.m_item.m_itemData.m_shared.m_dlc.Length <= 0 || DLCMan.instance.IsDLCInstalled(recipe.m_item.m_itemData.m_shared.m_dlc)) && this.HaveRequirementItems(recipe, discover, qualityLevel);
    }     }
   
    private bool HaveRequirementItems(Recipe piece, bool discover, int qualityLevel)     private bool HaveRequirementItems(Recipe piece, bool discover, int qualityLevel)
    {     {
        foreach (Piece.Requirement requirement in piece.m_resources)         foreach (Piece.Requirement requirement in piece.m_resources)
        {         {
            if (requirement.m_resItem)             if (requirement.m_resItem)
            {             {
                if (discover)                 if (discover)
                {                 {
                    if (requirement.m_amount > 0)                     if (requirement.m_amount > 0)
                    {                     {
                        if (piece.m_requireOnlyOneIngredient)                         if (piece.m_requireOnlyOneIngredient)
                        {                         {
                            if (this.m_knownMaterial.Contains(requirement.m_resItem.m_itemData.m_shared.m_name))                             if (this.m_knownMaterial.Contains(requirement.m_resItem.m_itemData.m_shared.m_name))
                            {                             {
                                return true;                                 return true;
                            }                             }
                        }                         }
                        else if (!this.m_knownMaterial.Contains(requirement.m_resItem.m_itemData.m_shared.m_name))                         else if (!this.m_knownMaterial.Contains(requirement.m_resItem.m_itemData.m_shared.m_name))
                        {                         {
                            return false;                             return false;
                        }                         }
                    }                     }
                }                 }
                else                 else
                {                 {
                    int amount = requirement.GetAmount(qualityLevel);                     int amount = requirement.GetAmount(qualityLevel);
                    int num = this.m_inventory.CountItems(requirement.m_resItem.m_itemData.m_shared.m_name, -1, true);                     int num = this.m_inventory.CountItems(requirement.m_resItem.m_itemData.m_shared.m_name, -1, true);
                    if (piece.m_requireOnlyOneIngredient)                     if (piece.m_requireOnlyOneIngredient)
                    {                     {
                        if (num >= amount)                         if (num >= amount)
                        {                         {
                            return true;                             return true;
                        }                         }
                    }                     }
                    else if (num < amount)                     else if (num < amount)
                    {                     {
                        return false;                         return false;
                    }                     }
                }                 }
            }             }
        }         }
        return !piece.m_requireOnlyOneIngredient;         return !piece.m_requireOnlyOneIngredient;
    }     }
   
    public ItemDrop.ItemData GetFirstRequiredItem(Inventory inventory, Recipe recipe, int qualityLevel, out int amount, out int extraAmount)     public ItemDrop.ItemData GetFirstRequiredItem(Inventory inventory, Recipe recipe, int qualityLevel, out int amount, out int extraAmount)
    {     {
        foreach (Piece.Requirement requirement in recipe.m_resources)         foreach (Piece.Requirement requirement in recipe.m_resources)
        {         {
            if (requirement.m_resItem)             if (requirement.m_resItem)
            {             {
                int amount2 = requirement.GetAmount(qualityLevel);                 int amount2 = requirement.GetAmount(qualityLevel);
                for (int j = 0; j <= requirement.m_resItem.m_itemData.m_shared.m_maxQuality; j++)                 for (int j = 0; j <= requirement.m_resItem.m_itemData.m_shared.m_maxQuality; j++)
                {                 {
                    if (this.m_inventory.CountItems(requirement.m_resItem.m_itemData.m_shared.m_name, j, true) >= amount2)                     if (this.m_inventory.CountItems(requirement.m_resItem.m_itemData.m_shared.m_name, j, true) >= amount2)
                    {                     {
                        amount = amount2;                         amount = amount2;
                        extraAmount = requirement.m_extraAmountOnlyOneIngredient;                         extraAmount = requirement.m_extraAmountOnlyOneIngredient;
                        return inventory.GetItem(requirement.m_resItem.m_itemData.m_shared.m_name, j, false);                         return inventory.GetItem(requirement.m_resItem.m_itemData.m_shared.m_name, j, false);
                    }                     }
                }                 }
            }             }
        }         }
        amount = 0;         amount = 0;
        extraAmount = 0;         extraAmount = 0;
        return null;         return null;
    }     }
   
    public bool HaveRequirements(Piece piece, Player.RequirementMode mode)     public bool HaveRequirements(Piece piece, Player.RequirementMode mode)
    {     {
        if (piece.m_craftingStation)         if (piece.m_craftingStation)
        {         {
            if (mode == Player.RequirementMode.IsKnown || mode == Player.RequirementMode.CanAlmostBuild)             if (mode == Player.RequirementMode.IsKnown || mode == Player.RequirementMode.CanAlmostBuild)
            {             {
                if (!this.m_knownStations.ContainsKey(piece.m_craftingStation.m_name))                 if (!this.m_knownStations.ContainsKey(piece.m_craftingStation.m_name))
                {                 {
                    return false;                     return false;
                }                 }
            }             }
            else if (!CraftingStation.HaveBuildStationInRange(piece.m_craftingStation.m_name, base.transform.position) && !ZoneSystem.instance.GetGlobalKey(GlobalKeys.NoWorkbench))             else if (!CraftingStation.HaveBuildStationInRange(piece.m_craftingStation.m_name, base.transform.position) && !ZoneSystem.instance.GetGlobalKey(GlobalKeys.NoWorkbench))
            {             {
                return false;                 return false;
            }             }
        }         }
        if (piece.m_dlc.Length > 0 && !DLCMan.instance.IsDLCInstalled(piece.m_dlc))         if (piece.m_dlc.Length > 0 && !DLCMan.instance.IsDLCInstalled(piece.m_dlc))
        {         {
            return false;             return false;
        }         }
        if (mode != Player.RequirementMode.IsKnown && ZoneSystem.instance.GetGlobalKey(GlobalKeys.NoBuildCost))         if (mode != Player.RequirementMode.IsKnown && ZoneSystem.instance.GetGlobalKey(GlobalKeys.NoBuildCost))
        {         {
            return true;             return true;
        }         }
        foreach (Piece.Requirement requirement in piece.m_resources)         foreach (Piece.Requirement requirement in piece.m_resources)
        {         {
            if (requirement.m_resItem && requirement.m_amount > 0)             if (requirement.m_resItem && requirement.m_amount > 0)
            {             {
                if (mode == Player.RequirementMode.IsKnown)                 if (mode == Player.RequirementMode.IsKnown)
                {                 {
                    if (!this.m_knownMaterial.Contains(requirement.m_resItem.m_itemData.m_shared.m_name))                     if (!this.m_knownMaterial.Contains(requirement.m_resItem.m_itemData.m_shared.m_name))
                    {                     {
                        return false;                         return false;
                    }                     }
                }                 }
                else if (mode == Player.RequirementMode.CanAlmostBuild)                 else if (mode == Player.RequirementMode.CanAlmostBuild)
                {                 {
                    if (!this.m_inventory.HaveItem(requirement.m_resItem.m_itemData.m_shared.m_name, true))                     if (!this.m_inventory.HaveItem(requirement.m_resItem.m_itemData.m_shared.m_name, true))
                    {                     {
                        return false;                         return false;
                    }                     }
                }                 }
                else if (mode == Player.RequirementMode.CanBuild && this.m_inventory.CountItems(requirement.m_resItem.m_itemData.m_shared.m_name, -1, true) < requirement.m_amount)                 else if (mode == Player.RequirementMode.CanBuild && this.m_inventory.CountItems(requirement.m_resItem.m_itemData.m_shared.m_name, -1, true) < requirement.m_amount)
                {                 {
                    return false;                     return false;
                }                 }
            }             }
        }         }
        return true;         return true;
    }     }
   
    public void ConsumeResources(Piece.Requirement[] requirements, int qualityLevel, int itemQuality = -1)     public void ConsumeResources(Piece.Requirement[] requirements, int qualityLevel, int itemQuality = -1)
    {     {
        foreach (Piece.Requirement requirement in requirements)         foreach (Piece.Requirement requirement in requirements)
        {         {
            if (requirement.m_resItem)             if (requirement.m_resItem)
            {             {
                int amount = requirement.GetAmount(qualityLevel);                 int amount = requirement.GetAmount(qualityLevel);
                if (amount > 0)                 if (amount > 0)
                {                 {
                    this.m_inventory.RemoveItem(requirement.m_resItem.m_itemData.m_shared.m_name, amount, itemQuality, true);                     this.m_inventory.RemoveItem(requirement.m_resItem.m_itemData.m_shared.m_name, amount, itemQuality, true);
                }                 }
            }             }
        }         }
    }     }
   
    private void UpdateHover()     private void UpdateHover()
    {     {
        if (this.InPlaceMode() || this.IsDead() || this.m_doodadController != null)         if (this.InPlaceMode() || this.IsDead() || this.m_doodadController != null)
        {         {
            this.m_hovering = null;             this.m_hovering = null;
            this.m_hoveringCreature = null;             this.m_hoveringCreature = null;
            return;             return;
        }         }
        this.FindHoverObject(out this.m_hovering, out this.m_hoveringCreature);         this.FindHoverObject(out this.m_hovering, out this.m_hoveringCreature);
    }     }
   
    public bool IsMaterialKnown(string sharedName)     public bool IsMaterialKnown(string sharedName)
    {     {
        return this.m_knownMaterial.Contains(sharedName);         return this.m_knownMaterial.Contains(sharedName);
    }     }
   
    private bool CheckCanRemovePiece(Piece piece)     private bool CheckCanRemovePiece(Piece piece)
    {     {
        if (!this.m_noPlacementCost && piece.m_craftingStation != null && !CraftingStation.HaveBuildStationInRange(piece.m_craftingStation.m_name, base.transform.position) && !ZoneSystem.instance.GetGlobalKey(GlobalKeys.NoWorkbench))         if (!this.m_noPlacementCost && piece.m_craftingStation != null && !CraftingStation.HaveBuildStationInRange(piece.m_craftingStation.m_name, base.transform.position) && !ZoneSystem.instance.GetGlobalKey(GlobalKeys.NoWorkbench))
        {         {
            this.Message(MessageHud.MessageType.Center, "$msg_missingstation", 0, null);             this.Message(MessageHud.MessageType.Center, "$msg_missingstation", 0, null);
            return false;             return false;
        }         }
        return true;         return true;
    }     }
   
    private bool CopyPiece()     private bool CopyPiece()
    {     {
        RaycastHit raycastHit;         RaycastHit raycastHit;
        if (Physics.Raycast(GameCamera.instance.transform.position, GameCamera.instance.transform.forward, out raycastHit, 50f, this.m_removeRayMask) && Vector3.Distance(raycastHit.point, this.m_eye.position) < this.m_maxPlaceDistance)         if (Physics.Raycast(GameCamera.instance.transform.position, GameCamera.instance.transform.forward, out raycastHit, 50f, this.m_removeRayMask) && Vector3.Distance(raycastHit.point, this.m_eye.position) < this.m_maxPlaceDistance)
        {         {
            Piece piece = raycastHit.collider.GetComponentInParent<Piece>();             Piece piece = raycastHit.collider.GetComponentInParent<Piece>();
            if (piece == null && raycastHit.collider.GetComponent<Heightmap>())             if (piece == null && raycastHit.collider.GetComponent<Heightmap>())
            {             {
                piece = TerrainModifier.FindClosestModifierPieceInRange(raycastHit.point, 2.5f);                 piece = TerrainModifier.FindClosestModifierPieceInRange(raycastHit.point, 2.5f);
            }             }
            if (piece)             if (piece)
            {             {
                if (this.SetSelectedPiece(piece))                 if (this.SetSelectedPiece(piece))
                {                 {
                    this.m_placeRotation = (int)Math.Round((double)(piece.transform.rotation.eulerAngles.y / this.m_placeRotationDegrees));                     this.m_placeRotation = (int)Math.Round((double)(piece.transform.rotation.eulerAngles.y / this.m_placeRotationDegrees));
                    return true;                     return true;
                }                 }
                this.Message(MessageHud.MessageType.Center, "$msg_missingrequirement", 0, null);                 this.Message(MessageHud.MessageType.Center, "$msg_missingrequirement", 0, null);
                return false;                 return false;
            }             }
        }         }
        return false;         return false;
    }     }
   
    private bool RemovePiece()     private bool RemovePiece()
    {     {
        RaycastHit raycastHit;         RaycastHit raycastHit;
        if (Physics.Raycast(GameCamera.instance.transform.position, GameCamera.instance.transform.forward, out raycastHit, 50f, this.m_removeRayMask) && Vector3.Distance(raycastHit.point, this.m_eye.position) < this.m_maxPlaceDistance)         if (Physics.Raycast(GameCamera.instance.transform.position, GameCamera.instance.transform.forward, out raycastHit, 50f, this.m_removeRayMask) && Vector3.Distance(raycastHit.point, this.m_eye.position) < this.m_maxPlaceDistance)
        {         {
            Piece piece = raycastHit.collider.GetComponentInParent<Piece>();             Piece piece = raycastHit.collider.GetComponentInParent<Piece>();
            if (piece == null && raycastHit.collider.GetComponent<Heightmap>())             if (piece == null && raycastHit.collider.GetComponent<Heightmap>())
            {             {
                piece = TerrainModifier.FindClosestModifierPieceInRange(raycastHit.point, 2.5f);                 piece = TerrainModifier.FindClosestModifierPieceInRange(raycastHit.point, 2.5f);
            }             }
            if (piece)             if (piece)
            {             {
                if (!piece.m_canBeRemoved)                 if (!piece.m_canBeRemoved)
                {                 {
                    return false;                     return false;
                }                 }
                if (Location.IsInsideNoBuildLocation(piece.transform.position))                 if (Location.IsInsideNoBuildLocation(piece.transform.position))
                {                 {
                    this.Message(MessageHud.MessageType.Center, "$msg_nobuildzone", 0, null);                     this.Message(MessageHud.MessageType.Center, "$msg_nobuildzone", 0, null);
                    return false;                     return false;
                }                 }
                if (!PrivateArea.CheckAccess(piece.transform.position, 0f, true, false))                 if (!PrivateArea.CheckAccess(piece.transform.position, 0f, true, false))
                {                 {
                    this.Message(MessageHud.MessageType.Center, "$msg_privatezone", 0, null);                     this.Message(MessageHud.MessageType.Center, "$msg_privatezone", 0, null);
                    return false;                     return false;
                }                 }
                if (!this.CheckCanRemovePiece(piece))                 if (!this.CheckCanRemovePiece(piece))
                {                 {
                    return false;                     return false;
                }                 }
                ZNetView component = piece.GetComponent<ZNetView>();                 ZNetView component = piece.GetComponent<ZNetView>();
                if (component == null)                 if (component == null)
                {                 {
                    return false;                     return false;
                }                 }
                if (!piece.CanBeRemoved())                 if (!piece.CanBeRemoved())
                {                 {
                    this.Message(MessageHud.MessageType.Center, "$msg_cantremovenow", 0, null);                     this.Message(MessageHud.MessageType.Center, "$msg_cantremovenow", 0, null);
                    return false;                     return false;
                }                 }
                WearNTear component2 = piece.GetComponent<WearNTear>();                 WearNTear component2 = piece.GetComponent<WearNTear>();
                if (component2)                 if (component2)
                {                 {
                    component2.Remove();                     component2.Remove();
                }                 }
                else                 else
                {                 {
                    ZLog.Log("Removing non WNT object with hammer " + piece.name);                     ZLog.Log("Removing non WNT object with hammer " + piece.name);
                    component.ClaimOwnership();                     component.ClaimOwnership();
.                    piece.DropResources();                     piece.DropResources(null);
                    piece.m_placeEffect.Create(piece.transform.position, piece.transform.rotation, piece.gameObject.transform, 1f, -1);                     piece.m_placeEffect.Create(piece.transform.position, piece.transform.rotation, piece.gameObject.transform, 1f, -1);
                    this.m_removeEffects.Create(piece.transform.position, Quaternion.identity, null, 1f, -1);                     this.m_removeEffects.Create(piece.transform.position, Quaternion.identity, null, 1f, -1);
                    ZNetScene.instance.Destroy(piece.gameObject);                     ZNetScene.instance.Destroy(piece.gameObject);
                }                 }
                ItemDrop.ItemData rightItem = base.GetRightItem();                 ItemDrop.ItemData rightItem = base.GetRightItem();
                if (rightItem != null)                 if (rightItem != null)
                {                 {
                    this.FaceLookDirection();                     this.FaceLookDirection();
                    this.m_zanim.SetTrigger(rightItem.m_shared.m_attack.m_attackAnimation);                     this.m_zanim.SetTrigger(rightItem.m_shared.m_attack.m_attackAnimation);
                }                 }
                return true;                 return true;
            }             }
        }         }
        return false;         return false;
    }     }
   
    public void FaceLookDirection()     public void FaceLookDirection()
    {     {
        base.transform.rotation = base.GetLookYaw();         base.transform.rotation = base.GetLookYaw();
        Physics.SyncTransforms();         Physics.SyncTransforms();
    }     }
   
    private bool PlacePiece(Piece piece)     private bool PlacePiece(Piece piece)
    {     {
        this.UpdatePlacementGhost(true);         this.UpdatePlacementGhost(true);
        Vector3 position = this.m_placementGhost.transform.position;         Vector3 position = this.m_placementGhost.transform.position;
        Quaternion rotation = this.m_placementGhost.transform.rotation;         Quaternion rotation = this.m_placementGhost.transform.rotation;
        GameObject gameObject = piece.gameObject;         GameObject gameObject = piece.gameObject;
        switch (this.m_placementStatus)         switch (this.m_placementStatus)
        {         {
        case Player.PlacementStatus.Invalid:         case Player.PlacementStatus.Invalid:
        case Player.PlacementStatus.NoRayHits:         case Player.PlacementStatus.NoRayHits:
            this.Message(MessageHud.MessageType.Center, "$msg_invalidplacement", 0, null);             this.Message(MessageHud.MessageType.Center, "$msg_invalidplacement", 0, null);
            return false;             return false;
        case Player.PlacementStatus.BlockedbyPlayer:         case Player.PlacementStatus.BlockedbyPlayer:
            this.Message(MessageHud.MessageType.Center, "$msg_blocked", 0, null);             this.Message(MessageHud.MessageType.Center, "$msg_blocked", 0, null);
            return false;             return false;
        case Player.PlacementStatus.NoBuildZone:         case Player.PlacementStatus.NoBuildZone:
            this.Message(MessageHud.MessageType.Center, "$msg_nobuildzone", 0, null);             this.Message(MessageHud.MessageType.Center, "$msg_nobuildzone", 0, null);
            return false;             return false;
        case Player.PlacementStatus.PrivateZone:         case Player.PlacementStatus.PrivateZone:
            this.Message(MessageHud.MessageType.Center, "$msg_privatezone", 0, null);             this.Message(MessageHud.MessageType.Center, "$msg_privatezone", 0, null);
            return false;             return false;
        case Player.PlacementStatus.MoreSpace:         case Player.PlacementStatus.MoreSpace:
            this.Message(MessageHud.MessageType.Center, "$msg_needspace", 0, null);             this.Message(MessageHud.MessageType.Center, "$msg_needspace", 0, null);
            return false;             return false;
        case Player.PlacementStatus.NoTeleportArea:         case Player.PlacementStatus.NoTeleportArea:
            this.Message(MessageHud.MessageType.Center, "$msg_noteleportarea", 0, null);             this.Message(MessageHud.MessageType.Center, "$msg_noteleportarea", 0, null);
            return false;             return false;
        case Player.PlacementStatus.ExtensionMissingStation:         case Player.PlacementStatus.ExtensionMissingStation:
            this.Message(MessageHud.MessageType.Center, "$msg_extensionmissingstation", 0, null);             this.Message(MessageHud.MessageType.Center, "$msg_extensionmissingstation", 0, null);
            return false;             return false;
        case Player.PlacementStatus.WrongBiome:         case Player.PlacementStatus.WrongBiome:
            this.Message(MessageHud.MessageType.Center, "$msg_wrongbiome", 0, null);             this.Message(MessageHud.MessageType.Center, "$msg_wrongbiome", 0, null);
            return false;             return false;
        case Player.PlacementStatus.NeedCultivated:         case Player.PlacementStatus.NeedCultivated:
            this.Message(MessageHud.MessageType.Center, "$msg_needcultivated", 0, null);             this.Message(MessageHud.MessageType.Center, "$msg_needcultivated", 0, null);
            return false;             return false;
        case Player.PlacementStatus.NeedDirt:         case Player.PlacementStatus.NeedDirt:
            this.Message(MessageHud.MessageType.Center, "$msg_needdirt", 0, null);             this.Message(MessageHud.MessageType.Center, "$msg_needdirt", 0, null);
            return false;             return false;
        case Player.PlacementStatus.NotInDungeon:         case Player.PlacementStatus.NotInDungeon:
            this.Message(MessageHud.MessageType.Center, "$msg_notindungeon", 0, null);             this.Message(MessageHud.MessageType.Center, "$msg_notindungeon", 0, null);
            return false;             return false;
        default:         default:
        {         {
            TerrainModifier.SetTriggerOnPlaced(true);             TerrainModifier.SetTriggerOnPlaced(true);
            GameObject gameObject2 = UnityEngine.Object.Instantiate<GameObject>(gameObject, position, rotation);             GameObject gameObject2 = UnityEngine.Object.Instantiate<GameObject>(gameObject, position, rotation);
            TerrainModifier.SetTriggerOnPlaced(false);             TerrainModifier.SetTriggerOnPlaced(false);
            CraftingStation componentInChildren = gameObject2.GetComponentInChildren<CraftingStation>();             CraftingStation componentInChildren = gameObject2.GetComponentInChildren<CraftingStation>();
            if (componentInChildren)             if (componentInChildren)
            {             {
                this.AddKnownStation(componentInChildren);                 this.AddKnownStation(componentInChildren);
            }             }
            Piece component = gameObject2.GetComponent<Piece>();             Piece component = gameObject2.GetComponent<Piece>();
            if (component)             if (component)
            {             {
                component.SetCreator(this.GetPlayerID());                 component.SetCreator(this.GetPlayerID());
            }             }
            PrivateArea component2 = gameObject2.GetComponent<PrivateArea>();             PrivateArea component2 = gameObject2.GetComponent<PrivateArea>();
            if (component2)             if (component2)
            {             {
                component2.Setup(Game.instance.GetPlayerProfile().GetName());                 component2.Setup(Game.instance.GetPlayerProfile().GetName());
            }             }
            WearNTear component3 = gameObject2.GetComponent<WearNTear>();             WearNTear component3 = gameObject2.GetComponent<WearNTear>();
            if (component3)             if (component3)
            {             {
                component3.OnPlaced();                 component3.OnPlaced();
            }             }
            ItemDrop.ItemData rightItem = base.GetRightItem();             ItemDrop.ItemData rightItem = base.GetRightItem();
            if (rightItem != null)             if (rightItem != null)
            {             {
                this.FaceLookDirection();                 this.FaceLookDirection();
                this.m_zanim.SetTrigger(rightItem.m_shared.m_attack.m_attackAnimation);                 this.m_zanim.SetTrigger(rightItem.m_shared.m_attack.m_attackAnimation);
            }             }
            if (piece.m_randomInitBuildRotation)             if (piece.m_randomInitBuildRotation)
            {             {
                this.m_placeRotation = UnityEngine.Random.Range(0, 16);                 this.m_placeRotation = UnityEngine.Random.Range(0, 16);
            }             }
            piece.m_placeEffect.Create(position, rotation, gameObject2.transform, 1f, -1);             piece.m_placeEffect.Create(position, rotation, gameObject2.transform, 1f, -1);
            base.AddNoise(50f);             base.AddNoise(50f);
            Game.instance.IncrementPlayerStat(PlayerStatType.Builds, 1f);             Game.instance.IncrementPlayerStat(PlayerStatType.Builds, 1f);
            ZLog.Log("Placed " + gameObject.name);             ZLog.Log("Placed " + gameObject.name);
            Gogan.LogEvent("Game", "PlacedPiece", gameObject.name, 0L);             Gogan.LogEvent("Game", "PlacedPiece", gameObject.name, 0L);
            return true;             return true;
        }         }
        }         }
    }     }
   
    public override bool IsPlayer()     public override bool IsPlayer()
    {     {
        return true;         return true;
    }     }
   
    public void GetBuildSelection(out Piece go, out Vector2Int id, out int total, out Piece.PieceCategory category, out bool useCategory)     public void GetBuildSelection(out Piece go, out Vector2Int id, out int total, out Piece.PieceCategory category, out bool useCategory)
    {     {
        category = this.m_buildPieces.m_selectedCategory;         category = this.m_buildPieces.m_selectedCategory;
        useCategory = this.m_buildPieces.m_useCategories;         useCategory = this.m_buildPieces.m_useCategories;
        if (this.m_buildPieces.GetAvailablePiecesInSelectedCategory() == 0)         if (this.m_buildPieces.GetAvailablePiecesInSelectedCategory() == 0)
        {         {
            go = null;             go = null;
            id = Vector2Int.zero;             id = Vector2Int.zero;
            total = 0;             total = 0;
            return;             return;
        }         }
        GameObject selectedPrefab = this.m_buildPieces.GetSelectedPrefab();         GameObject selectedPrefab = this.m_buildPieces.GetSelectedPrefab();
        go = (selectedPrefab ? selectedPrefab.GetComponent<Piece>() : null);         go = (selectedPrefab ? selectedPrefab.GetComponent<Piece>() : null);
        id = this.m_buildPieces.GetSelectedIndex();         id = this.m_buildPieces.GetSelectedIndex();
        total = this.m_buildPieces.GetAvailablePiecesInSelectedCategory();         total = this.m_buildPieces.GetAvailablePiecesInSelectedCategory();
    }     }
   
    public List<Piece> GetBuildPieces()     public List<Piece> GetBuildPieces()
    {     {
        if (!(this.m_buildPieces != null))         if (!(this.m_buildPieces != null))
        {         {
            return null;             return null;
        }         }
        return this.m_buildPieces.GetPiecesInSelectedCategory();         return this.m_buildPieces.GetPiecesInSelectedCategory();
    }     }
   
    public int GetAvailableBuildPiecesInCategory(Piece.PieceCategory cat)     public int GetAvailableBuildPiecesInCategory(Piece.PieceCategory cat)
    {     {
        if (!(this.m_buildPieces != null))         if (!(this.m_buildPieces != null))
        {         {
            return 0;             return 0;
        }         }
        return this.m_buildPieces.GetAvailablePiecesInCategory(cat);         return this.m_buildPieces.GetAvailablePiecesInCategory(cat);
    }     }
   
    private void RPC_OnDeath(long sender)     private void RPC_OnDeath(long sender)
    {     {
        this.m_visual.SetActive(false);         this.m_visual.SetActive(false);
    }     }
   
    private void CreateDeathEffects()     private void CreateDeathEffects()
    {     {
        GameObject[] array = this.m_deathEffects.Create(base.transform.position, base.transform.rotation, base.transform, 1f, -1);         GameObject[] array = this.m_deathEffects.Create(base.transform.position, base.transform.rotation, base.transform, 1f, -1);
        for (int i = 0; i < array.Length; i++)         for (int i = 0; i < array.Length; i++)
        {         {
            Ragdoll component = array[i].GetComponent<Ragdoll>();             Ragdoll component = array[i].GetComponent<Ragdoll>();
            if (component)             if (component)
            {             {
                Vector3 vector = this.m_body.velocity;                 Vector3 vector = this.m_body.velocity;
                if (this.m_pushForce.magnitude * 0.5f > vector.magnitude)                 if (this.m_pushForce.magnitude * 0.5f > vector.magnitude)
                {                 {
                    vector = this.m_pushForce * 0.5f;                     vector = this.m_pushForce * 0.5f;
                }                 }
                component.Setup(vector, 0f, 0f, 0f, null);                 component.Setup(vector, 0f, 0f, 0f, null);
                this.OnRagdollCreated(component);                 this.OnRagdollCreated(component);
                this.m_ragdoll = component;                 this.m_ragdoll = component;
            }             }
        }         }
    }     }
   
    public void UnequipDeathDropItems()     public void UnequipDeathDropItems()
    {     {
        if (this.m_rightItem != null)         if (this.m_rightItem != null)
        {         {
            base.UnequipItem(this.m_rightItem, false);             base.UnequipItem(this.m_rightItem, false);
        }         }
        if (this.m_leftItem != null)         if (this.m_leftItem != null)
        {         {
            base.UnequipItem(this.m_leftItem, false);             base.UnequipItem(this.m_leftItem, false);
        }         }
        if (this.m_ammoItem != null)         if (this.m_ammoItem != null)
        {         {
            base.UnequipItem(this.m_ammoItem, false);             base.UnequipItem(this.m_ammoItem, false);
        }         }
        if (this.m_utilityItem != null)         if (this.m_utilityItem != null)
        {         {
            base.UnequipItem(this.m_utilityItem, false);             base.UnequipItem(this.m_utilityItem, false);
        }         }
    }     }
   
    public void CreateTombStone()     public void CreateTombStone()
    {     {
        if (this.m_inventory.NrOfItems() == 0)         if (this.m_inventory.NrOfItems() == 0)
        {         {
            return;             return;
        }         }
        if (!ZoneSystem.instance.GetGlobalKey(GlobalKeys.DeathKeepEquip) && !ZoneSystem.instance.GetGlobalKey(GlobalKeys.DeathDeleteUnequipped))         if (!ZoneSystem.instance.GetGlobalKey(GlobalKeys.DeathKeepEquip) && !ZoneSystem.instance.GetGlobalKey(GlobalKeys.DeathDeleteUnequipped))
        {         {
            base.UnequipAllItems();             base.UnequipAllItems();
        }         }
        if (ZoneSystem.instance.GetGlobalKey(GlobalKeys.DeathDeleteItems) || ZoneSystem.instance.GetGlobalKey(GlobalKeys.DeathDeleteUnequipped))         if (ZoneSystem.instance.GetGlobalKey(GlobalKeys.DeathDeleteItems) || ZoneSystem.instance.GetGlobalKey(GlobalKeys.DeathDeleteUnequipped))
        {         {
            this.m_inventory.RemoveUnequipped();             this.m_inventory.RemoveUnequipped();
        }         }
        if (ZoneSystem.instance.GetGlobalKey(GlobalKeys.DeathDeleteUnequipped) && !ZoneSystem.instance.GetGlobalKey(GlobalKeys.DeathKeepEquip))         if (ZoneSystem.instance.GetGlobalKey(GlobalKeys.DeathDeleteUnequipped) && !ZoneSystem.instance.GetGlobalKey(GlobalKeys.DeathKeepEquip))
        {         {
            base.UnequipAllItems();             base.UnequipAllItems();
        }         }
        GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(this.m_tombstone, base.GetCenterPoint(), base.transform.rotation);         GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(this.m_tombstone, base.GetCenterPoint(), base.transform.rotation);
        gameObject.GetComponent<Container>().GetInventory().MoveInventoryToGrave(this.m_inventory);         gameObject.GetComponent<Container>().GetInventory().MoveInventoryToGrave(this.m_inventory);
        TombStone component = gameObject.GetComponent<TombStone>();         TombStone component = gameObject.GetComponent<TombStone>();
        PlayerProfile playerProfile = Game.instance.GetPlayerProfile();         PlayerProfile playerProfile = Game.instance.GetPlayerProfile();
        component.Setup(playerProfile.GetName(), playerProfile.GetPlayerID());         component.Setup(playerProfile.GetName(), playerProfile.GetPlayerID());
    }     }
   
    private bool HardDeath()     private bool HardDeath()
    {     {
        return this.m_timeSinceDeath > this.m_hardDeathCooldown;         return this.m_timeSinceDeath > this.m_hardDeathCooldown;
    }     }
   
    public void ClearHardDeath()     public void ClearHardDeath()
    {     {
        this.m_timeSinceDeath = this.m_hardDeathCooldown + 1f;         this.m_timeSinceDeath = this.m_hardDeathCooldown + 1f;
    }     }
   
    protected override void OnDeath()     protected override void OnDeath()
    {     {
        if (!this.m_nview.IsOwner())         if (!this.m_nview.IsOwner())
        {         {
            Debug.Log("OnDeath call but not the owner");             Debug.Log("OnDeath call but not the owner");
            return;             return;
        }         }
        bool flag = this.HardDeath();         bool flag = this.HardDeath();
        this.m_nview.GetZDO().Set(ZDOVars.s_dead, true);         this.m_nview.GetZDO().Set(ZDOVars.s_dead, true);
        this.m_nview.InvokeRPC(ZNetView.Everybody, "OnDeath", Array.Empty<object>());         this.m_nview.InvokeRPC(ZNetView.Everybody, "OnDeath", Array.Empty<object>());
        Game.instance.IncrementPlayerStat(PlayerStatType.Deaths, 1f);         Game.instance.IncrementPlayerStat(PlayerStatType.Deaths, 1f);
        switch (this.m_lastHit.m_hitType)         switch (this.m_lastHit.m_hitType)
        {         {
        case HitData.HitType.Undefined:         case HitData.HitType.Undefined:
            Game.instance.IncrementPlayerStat(PlayerStatType.DeathByUndefined, 1f);             Game.instance.IncrementPlayerStat(PlayerStatType.DeathByUndefined, 1f);
            break;             break;
        case HitData.HitType.EnemyHit:         case HitData.HitType.EnemyHit:
            Game.instance.IncrementPlayerStat(PlayerStatType.DeathByEnemyHit, 1f);             Game.instance.IncrementPlayerStat(PlayerStatType.DeathByEnemyHit, 1f);
            break;             break;
        case HitData.HitType.PlayerHit:         case HitData.HitType.PlayerHit:
            Game.instance.IncrementPlayerStat(PlayerStatType.DeathByPlayerHit, 1f);             Game.instance.IncrementPlayerStat(PlayerStatType.DeathByPlayerHit, 1f);
            break;             break;
        case HitData.HitType.Fall:         case HitData.HitType.Fall:
            Game.instance.IncrementPlayerStat(PlayerStatType.DeathByFall, 1f);             Game.instance.IncrementPlayerStat(PlayerStatType.DeathByFall, 1f);
            break;             break;
        case HitData.HitType.Drowning:         case HitData.HitType.Drowning:
            Game.instance.IncrementPlayerStat(PlayerStatType.DeathByDrowning, 1f);             Game.instance.IncrementPlayerStat(PlayerStatType.DeathByDrowning, 1f);
            break;             break;
        case HitData.HitType.Burning:         case HitData.HitType.Burning:
            Game.instance.IncrementPlayerStat(PlayerStatType.DeathByBurning, 1f);             Game.instance.IncrementPlayerStat(PlayerStatType.DeathByBurning, 1f);
            break;             break;
        case HitData.HitType.Freezing:         case HitData.HitType.Freezing:
            Game.instance.IncrementPlayerStat(PlayerStatType.DeathByFreezing, 1f);             Game.instance.IncrementPlayerStat(PlayerStatType.DeathByFreezing, 1f);
            break;             break;
        case HitData.HitType.Poisoned:         case HitData.HitType.Poisoned:
            Game.instance.IncrementPlayerStat(PlayerStatType.DeathByPoisoned, 1f);             Game.instance.IncrementPlayerStat(PlayerStatType.DeathByPoisoned, 1f);
            break;             break;
        case HitData.HitType.Water:         case HitData.HitType.Water:
            Game.instance.IncrementPlayerStat(PlayerStatType.DeathByWater, 1f);             Game.instance.IncrementPlayerStat(PlayerStatType.DeathByWater, 1f);
            break;             break;
        case HitData.HitType.Smoke:         case HitData.HitType.Smoke:
            Game.instance.IncrementPlayerStat(PlayerStatType.DeathBySmoke, 1f);             Game.instance.IncrementPlayerStat(PlayerStatType.DeathBySmoke, 1f);
            break;             break;
        case HitData.HitType.EdgeOfWorld:         case HitData.HitType.EdgeOfWorld:
            Game.instance.IncrementPlayerStat(PlayerStatType.DeathByEdgeOfWorld, 1f);             Game.instance.IncrementPlayerStat(PlayerStatType.DeathByEdgeOfWorld, 1f);
            break;             break;
        case HitData.HitType.Impact:         case HitData.HitType.Impact:
            Game.instance.IncrementPlayerStat(PlayerStatType.DeathByImpact, 1f);             Game.instance.IncrementPlayerStat(PlayerStatType.DeathByImpact, 1f);
            break;             break;
        case HitData.HitType.Cart:         case HitData.HitType.Cart:
            Game.instance.IncrementPlayerStat(PlayerStatType.DeathByCart, 1f);             Game.instance.IncrementPlayerStat(PlayerStatType.DeathByCart, 1f);
            break;             break;
        case HitData.HitType.Tree:         case HitData.HitType.Tree:
            Game.instance.IncrementPlayerStat(PlayerStatType.DeathByTree, 1f);             Game.instance.IncrementPlayerStat(PlayerStatType.DeathByTree, 1f);
            break;             break;
        case HitData.HitType.Self:         case HitData.HitType.Self:
            Game.instance.IncrementPlayerStat(PlayerStatType.DeathBySelf, 1f);             Game.instance.IncrementPlayerStat(PlayerStatType.DeathBySelf, 1f);
            break;             break;
        case HitData.HitType.Structural:         case HitData.HitType.Structural:
            Game.instance.IncrementPlayerStat(PlayerStatType.DeathByStructural, 1f);             Game.instance.IncrementPlayerStat(PlayerStatType.DeathByStructural, 1f);
            break;             break;
        case HitData.HitType.Turret:         case HitData.HitType.Turret:
            Game.instance.IncrementPlayerStat(PlayerStatType.DeathByTurret, 1f);             Game.instance.IncrementPlayerStat(PlayerStatType.DeathByTurret, 1f);
            break;             break;
        case HitData.HitType.Boat:         case HitData.HitType.Boat:
            Game.instance.IncrementPlayerStat(PlayerStatType.DeathByBoat, 1f);             Game.instance.IncrementPlayerStat(PlayerStatType.DeathByBoat, 1f);
            break;             break;
        case HitData.HitType.Stalagtite:         case HitData.HitType.Stalagtite:
            Game.instance.IncrementPlayerStat(PlayerStatType.DeathByStalagtite, 1f);             Game.instance.IncrementPlayerStat(PlayerStatType.DeathByStalagtite, 1f);
            break;             break;
        default:         default:
            ZLog.LogWarning("Not implemented death type " + this.m_lastHit.m_hitType.ToString());             ZLog.LogWarning("Not implemented death type " + this.m_lastHit.m_hitType.ToString());
            break;             break;
        }         }
        Game.instance.GetPlayerProfile().SetDeathPoint(base.transform.position);         Game.instance.GetPlayerProfile().SetDeathPoint(base.transform.position);
        this.CreateDeathEffects();         this.CreateDeathEffects();
        this.CreateTombStone();         this.CreateTombStone();
        this.m_foods.Clear();         this.m_foods.Clear();
        if (ZoneSystem.instance.GetGlobalKey(GlobalKeys.DeathSkillsReset))         if (ZoneSystem.instance.GetGlobalKey(GlobalKeys.DeathSkillsReset))
        {         {
            this.m_skills.Clear();             this.m_skills.Clear();
        }         }
        else if (flag)         else if (flag)
        {         {
            this.m_skills.OnDeath();             this.m_skills.OnDeath();
        }         }
        this.m_seman.RemoveAllStatusEffects(false);         this.m_seman.RemoveAllStatusEffects(false);
        Game.instance.RequestRespawn(10f, true);         Game.instance.RequestRespawn(10f, true);
        this.m_timeSinceDeath = 0f;         this.m_timeSinceDeath = 0f;
        if (!flag)         if (!flag)
        {         {
            this.Message(MessageHud.MessageType.TopLeft, "$msg_softdeath", 0, null);             this.Message(MessageHud.MessageType.TopLeft, "$msg_softdeath", 0, null);
        }         }
        this.Message(MessageHud.MessageType.Center, "$msg_youdied", 0, null);         this.Message(MessageHud.MessageType.Center, "$msg_youdied", 0, null);
        this.ShowTutorial("death", false);         this.ShowTutorial("death", false);
        Minimap.instance.AddPin(base.transform.position, Minimap.PinType.Death, string.Format("$hud_mapday {0}", EnvMan.instance.GetDay(ZNet.instance.GetTimeSeconds())), true, false, 0L, "");         Minimap.instance.AddPin(base.transform.position, Minimap.PinType.Death, string.Format("$hud_mapday {0}", EnvMan.instance.GetDay(ZNet.instance.GetTimeSeconds())), true, false, 0L, "");
        if (this.m_onDeath != null)         if (this.m_onDeath != null)
        {         {
            this.m_onDeath();             this.m_onDeath();
        }         }
        string text = "biome:" + this.GetCurrentBiome().ToString();         string text = "biome:" + this.GetCurrentBiome().ToString();
        Gogan.LogEvent("Game", "Death", text, 0L);         Gogan.LogEvent("Game", "Death", text, 0L);
    }     }
   
    public void OnRespawn()     public void OnRespawn()
    {     {
        this.m_nview.GetZDO().Set(ZDOVars.s_dead, false);         this.m_nview.GetZDO().Set(ZDOVars.s_dead, false);
        base.SetHealth(base.GetMaxHealth());         base.SetHealth(base.GetMaxHealth());
    }     }
   
    private void SetupPlacementGhost()     private void SetupPlacementGhost()
    {     {
        if (this.m_placementGhost)         if (this.m_placementGhost)
        {         {
            UnityEngine.Object.Destroy(this.m_placementGhost);             UnityEngine.Object.Destroy(this.m_placementGhost);
            this.m_placementGhost = null;             this.m_placementGhost = null;
        }         }
        if (this.m_buildPieces == null || this.IsDead())         if (this.m_buildPieces == null || this.IsDead())
        {         {
            return;             return;
        }         }
        GameObject selectedPrefab = this.m_buildPieces.GetSelectedPrefab();         GameObject selectedPrefab = this.m_buildPieces.GetSelectedPrefab();
        if (selectedPrefab == null)         if (selectedPrefab == null)
        {         {
            return;             return;
        }         }
        if (selectedPrefab.GetComponent<Piece>().m_repairPiece)         if (selectedPrefab.GetComponent<Piece>().m_repairPiece)
        {         {
            return;             return;
        }         }
        bool flag = false;         bool flag = false;
        TerrainModifier componentInChildren = selectedPrefab.GetComponentInChildren<TerrainModifier>();         TerrainModifier componentInChildren = selectedPrefab.GetComponentInChildren<TerrainModifier>();
        if (componentInChildren)         if (componentInChildren)
        {         {
            flag = componentInChildren.enabled;             flag = componentInChildren.enabled;
            componentInChildren.enabled = false;             componentInChildren.enabled = false;
        }         }
        TerrainOp.m_forceDisableTerrainOps = true;         TerrainOp.m_forceDisableTerrainOps = true;
        ZNetView.m_forceDisableInit = true;         ZNetView.m_forceDisableInit = true;
        GameObject placementGhost = this.m_placementGhost;         GameObject placementGhost = this.m_placementGhost;
        this.m_placementGhost = UnityEngine.Object.Instantiate<GameObject>(selectedPrefab);         this.m_placementGhost = UnityEngine.Object.Instantiate<GameObject>(selectedPrefab);
        Piece component = this.m_placementGhost.GetComponent<Piece>();         Piece component = this.m_placementGhost.GetComponent<Piece>();
        if (component != null && component.m_randomInitBuildRotation)         if (component != null && component.m_randomInitBuildRotation)
        {         {
            this.m_placeRotation = UnityEngine.Random.Range(0, 16);             this.m_placeRotation = UnityEngine.Random.Range(0, 16);
        }         }
        ZNetView.m_forceDisableInit = false;         ZNetView.m_forceDisableInit = false;
        TerrainOp.m_forceDisableTerrainOps = false;         TerrainOp.m_forceDisableTerrainOps = false;
        this.m_placementGhost.name = selectedPrefab.name;         this.m_placementGhost.name = selectedPrefab.name;
        if (this.m_placementGhostLast != this.m_placementGhost.name)         if (this.m_placementGhostLast != this.m_placementGhost.name)
        {         {
            this.m_manualSnapPoint = -1;             this.m_manualSnapPoint = -1;
        }         }
        this.m_placementGhostLast = this.m_placementGhost.name;         this.m_placementGhostLast = this.m_placementGhost.name;
        if (componentInChildren)         if (componentInChildren)
        {         {
            componentInChildren.enabled = flag;             componentInChildren.enabled = flag;
        }         }
        Joint[] componentsInChildren = this.m_placementGhost.GetComponentsInChildren<Joint>();         Joint[] componentsInChildren = this.m_placementGhost.GetComponentsInChildren<Joint>();
        for (int i = 0; i < componentsInChildren.Length; i++)         for (int i = 0; i < componentsInChildren.Length; i++)
        {         {
            UnityEngine.Object.Destroy(componentsInChildren[i]);             UnityEngine.Object.Destroy(componentsInChildren[i]);
        }         }
        Rigidbody[] componentsInChildren2 = this.m_placementGhost.GetComponentsInChildren<Rigidbody>();         Rigidbody[] componentsInChildren2 = this.m_placementGhost.GetComponentsInChildren<Rigidbody>();
        for (int i = 0; i < componentsInChildren2.Length; i++)         for (int i = 0; i < componentsInChildren2.Length; i++)
        {         {
            UnityEngine.Object.Destroy(componentsInChildren2[i]);             UnityEngine.Object.Destroy(componentsInChildren2[i]);
        }         }
        ParticleSystemForceField[] componentsInChildren3 = this.m_placementGhost.GetComponentsInChildren<ParticleSystemForceField>();         ParticleSystemForceField[] componentsInChildren3 = this.m_placementGhost.GetComponentsInChildren<ParticleSystemForceField>();
        for (int i = 0; i < componentsInChildren3.Length; i++)         for (int i = 0; i < componentsInChildren3.Length; i++)
        {         {
            UnityEngine.Object.Destroy(componentsInChildren3[i]);             UnityEngine.Object.Destroy(componentsInChildren3[i]);
        }         }
        Demister[] componentsInChildren4 = this.m_placementGhost.GetComponentsInChildren<Demister>();         Demister[] componentsInChildren4 = this.m_placementGhost.GetComponentsInChildren<Demister>();
        for (int i = 0; i < componentsInChildren4.Length; i++)         for (int i = 0; i < componentsInChildren4.Length; i++)
        {         {
            UnityEngine.Object.Destroy(componentsInChildren4[i]);             UnityEngine.Object.Destroy(componentsInChildren4[i]);
        }         }
        foreach (Collider collider in this.m_placementGhost.GetComponentsInChildren<Collider>())         foreach (Collider collider in this.m_placementGhost.GetComponentsInChildren<Collider>())
        {         {
            if (((1 << collider.gameObject.layer) & this.m_placeRayMask) == 0)             if (((1 << collider.gameObject.layer) & this.m_placeRayMask) == 0)
            {             {
                ZLog.Log("Disabling " + collider.gameObject.name + "  " + LayerMask.LayerToName(collider.gameObject.layer));                 ZLog.Log("Disabling " + collider.gameObject.name + "  " + LayerMask.LayerToName(collider.gameObject.layer));
                collider.enabled = false;                 collider.enabled = false;
            }             }
        }         }
        Transform[] componentsInChildren6 = this.m_placementGhost.GetComponentsInChildren<Transform>();         Transform[] componentsInChildren6 = this.m_placementGhost.GetComponentsInChildren<Transform>();
        int num = LayerMask.NameToLayer("ghost");         int num = LayerMask.NameToLayer("ghost");
        Transform[] array = componentsInChildren6;         Transform[] array = componentsInChildren6;
        for (int i = 0; i < array.Length; i++)         for (int i = 0; i < array.Length; i++)
        {         {
            array[i].gameObject.layer = num;             array[i].gameObject.layer = num;
        }         }
        TerrainModifier[] componentsInChildren7 = this.m_placementGhost.GetComponentsInChildren<TerrainModifier>();         TerrainModifier[] componentsInChildren7 = this.m_placementGhost.GetComponentsInChildren<TerrainModifier>();
        for (int i = 0; i < componentsInChildren7.Length; i++)         for (int i = 0; i < componentsInChildren7.Length; i++)
        {         {
            UnityEngine.Object.Destroy(componentsInChildren7[i]);             UnityEngine.Object.Destroy(componentsInChildren7[i]);
        }         }
        GuidePoint[] componentsInChildren8 = this.m_placementGhost.GetComponentsInChildren<GuidePoint>();         GuidePoint[] componentsInChildren8 = this.m_placementGhost.GetComponentsInChildren<GuidePoint>();
        for (int i = 0; i < componentsInChildren8.Length; i++)         for (int i = 0; i < componentsInChildren8.Length; i++)
        {         {
            UnityEngine.Object.Destroy(componentsInChildren8[i]);             UnityEngine.Object.Destroy(componentsInChildren8[i]);
        }         }
        Light[] componentsInChildren9 = this.m_placementGhost.GetComponentsInChildren<Light>();         Light[] componentsInChildren9 = this.m_placementGhost.GetComponentsInChildren<Light>();
        for (int i = 0; i < componentsInChildren9.Length; i++)         for (int i = 0; i < componentsInChildren9.Length; i++)
        {         {
            UnityEngine.Object.Destroy(componentsInChildren9[i]);             UnityEngine.Object.Destroy(componentsInChildren9[i]);
        }         }
        AudioSource[] componentsInChildren10 = this.m_placementGhost.GetComponentsInChildren<AudioSource>();         AudioSource[] componentsInChildren10 = this.m_placementGhost.GetComponentsInChildren<AudioSource>();
        for (int i = 0; i < componentsInChildren10.Length; i++)         for (int i = 0; i < componentsInChildren10.Length; i++)
        {         {
            componentsInChildren10[i].enabled = false;             componentsInChildren10[i].enabled = false;
        }         }
        ZSFX[] componentsInChildren11 = this.m_placementGhost.GetComponentsInChildren<ZSFX>();         ZSFX[] componentsInChildren11 = this.m_placementGhost.GetComponentsInChildren<ZSFX>();
        for (int i = 0; i < componentsInChildren11.Length; i++)         for (int i = 0; i < componentsInChildren11.Length; i++)
        {         {
            componentsInChildren11[i].enabled = false;             componentsInChildren11[i].enabled = false;
        }         }
        WispSpawner componentInChildren2 = this.m_placementGhost.GetComponentInChildren<WispSpawner>();         WispSpawner componentInChildren2 = this.m_placementGhost.GetComponentInChildren<WispSpawner>();
        if (componentInChildren2)         if (componentInChildren2)
        {         {
            UnityEngine.Object.Destroy(componentInChildren2);             UnityEngine.Object.Destroy(componentInChildren2);
        }         }
        Windmill componentInChildren3 = this.m_placementGhost.GetComponentInChildren<Windmill>();         Windmill componentInChildren3 = this.m_placementGhost.GetComponentInChildren<Windmill>();
        if (componentInChildren3)         if (componentInChildren3)
        {         {
            componentInChildren3.enabled = false;             componentInChildren3.enabled = false;
        }         }
        ParticleSystem[] componentsInChildren12 = this.m_placementGhost.GetComponentsInChildren<ParticleSystem>();         ParticleSystem[] componentsInChildren12 = this.m_placementGhost.GetComponentsInChildren<ParticleSystem>();
        for (int i = 0; i < componentsInChildren12.Length; i++)         for (int i = 0; i < componentsInChildren12.Length; i++)
        {         {
            componentsInChildren12[i].gameObject.SetActive(false);             componentsInChildren12[i].gameObject.SetActive(false);
        }         }
        Transform transform = this.m_placementGhost.transform.Find("_GhostOnly");         Transform transform = this.m_placementGhost.transform.Find("_GhostOnly");
        if (transform)         if (transform)
        {         {
            transform.gameObject.SetActive(true);             transform.gameObject.SetActive(true);
        }         }
        this.m_placementGhost.transform.position = base.transform.position;         this.m_placementGhost.transform.position = base.transform.position;
        this.m_placementGhost.transform.localScale = selectedPrefab.transform.localScale;         this.m_placementGhost.transform.localScale = selectedPrefab.transform.localScale;
        this.m_ghostRippleDistance.Clear();         this.m_ghostRippleDistance.Clear();
        this.CleanupGhostMaterials<MeshRenderer>(this.m_placementGhost);         this.CleanupGhostMaterials<MeshRenderer>(this.m_placementGhost);
        this.CleanupGhostMaterials<SkinnedMeshRenderer>(this.m_placementGhost);         this.CleanupGhostMaterials<SkinnedMeshRenderer>(this.m_placementGhost);
    }     }
   
.      public static bool IsPlacementGhost(GameObject obj)
      {
          return Player.m_localPlayer && obj == Player.m_localPlayer.m_placementGhost;
      }
   
    private void CleanupGhostMaterials<T>(GameObject ghost) where T : Renderer     private void CleanupGhostMaterials<T>(GameObject ghost) where T : Renderer
    {     {
        foreach (T t in this.m_placementGhost.GetComponentsInChildren<T>())         foreach (T t in this.m_placementGhost.GetComponentsInChildren<T>())
        {         {
            if (!(t.sharedMaterial == null))             if (!(t.sharedMaterial == null))
            {             {
                Material[] sharedMaterials = t.sharedMaterials;                 Material[] sharedMaterials = t.sharedMaterials;
                for (int j = 0; j < sharedMaterials.Length; j++)                 for (int j = 0; j < sharedMaterials.Length; j++)
                {                 {
                    Material material = new Material(sharedMaterials[j]);                     Material material = new Material(sharedMaterials[j]);
                    if (material.HasProperty("_RippleDistance"))                     if (material.HasProperty("_RippleDistance"))
                    {                     {
                        this.m_ghostRippleDistance[material] = material.GetFloat("_RippleDistance");                         this.m_ghostRippleDistance[material] = material.GetFloat("_RippleDistance");
                    }                     }
                    material.SetFloat("_ValueNoise", 0f);                     material.SetFloat("_ValueNoise", 0f);
                    material.SetFloat("_TriplanarLocalPos", 1f);                     material.SetFloat("_TriplanarLocalPos", 1f);
                    sharedMaterials[j] = material;                     sharedMaterials[j] = material;
                }                 }
                t.sharedMaterials = sharedMaterials;                 t.sharedMaterials = sharedMaterials;
                t.shadowCastingMode = ShadowCastingMode.Off;                 t.shadowCastingMode = ShadowCastingMode.Off;
            }             }
        }         }
    }     }
   
    private void SetPlacementGhostValid(bool valid)     private void SetPlacementGhostValid(bool valid)
    {     {
        this.m_placementGhost.GetComponent<Piece>().SetInvalidPlacementHeightlight(!valid);         this.m_placementGhost.GetComponent<Piece>().SetInvalidPlacementHeightlight(!valid);
    }     }
   
    protected override void SetPlaceMode(PieceTable buildPieces)     protected override void SetPlaceMode(PieceTable buildPieces)
    {     {
        base.SetPlaceMode(buildPieces);         base.SetPlaceMode(buildPieces);
        this.m_buildPieces = buildPieces;         this.m_buildPieces = buildPieces;
        this.UpdateAvailablePiecesList();         this.UpdateAvailablePiecesList();
    }     }
   
    public void SetBuildCategory(int index)     public void SetBuildCategory(int index)
    {     {
        if (this.m_buildPieces != null)         if (this.m_buildPieces != null)
        {         {
            this.m_buildPieces.SetCategory(index);             this.m_buildPieces.SetCategory(index);
            this.UpdateAvailablePiecesList();             this.UpdateAvailablePiecesList();
        }         }
    }     }
   
    public override bool InPlaceMode()     public override bool InPlaceMode()
    {     {
        return this.m_buildPieces != null;         return this.m_buildPieces != null;
    }     }
   
    public bool InRepairMode()     public bool InRepairMode()
    {     {
        if (this.InPlaceMode())         if (this.InPlaceMode())
        {         {
            Piece selectedPiece = this.m_buildPieces.GetSelectedPiece();             Piece selectedPiece = this.m_buildPieces.GetSelectedPiece();
            if (selectedPiece != null)             if (selectedPiece != null)
            {             {
                return selectedPiece.m_repairPiece;                 return selectedPiece.m_repairPiece;
            }             }
        }         }
        return false;         return false;
    }     }
   
    public Player.PlacementStatus GetPlacementStatus()     public Player.PlacementStatus GetPlacementStatus()
    {     {
        return this.m_placementStatus;         return this.m_placementStatus;
    }     }
   
    public bool CanRotatePiece()     public bool CanRotatePiece()
    {     {
        if (this.InPlaceMode())         if (this.InPlaceMode())
        {         {
            Piece selectedPiece = this.m_buildPieces.GetSelectedPiece();             Piece selectedPiece = this.m_buildPieces.GetSelectedPiece();
            if (selectedPiece != null)             if (selectedPiece != null)
            {             {
                return selectedPiece.m_canRotate;                 return selectedPiece.m_canRotate;
            }             }
        }         }
        return false;         return false;
    }     }
   
    private void Repair(ItemDrop.ItemData toolItem, Piece repairPiece)     private void Repair(ItemDrop.ItemData toolItem, Piece repairPiece)
    {     {
        if (!this.InPlaceMode())         if (!this.InPlaceMode())
        {         {
            return;             return;
        }         }
        Piece hoveringPiece = this.GetHoveringPiece();         Piece hoveringPiece = this.GetHoveringPiece();
        if (hoveringPiece)         if (hoveringPiece)
        {         {
            if (!this.CheckCanRemovePiece(hoveringPiece))             if (!this.CheckCanRemovePiece(hoveringPiece))
            {             {
                return;                 return;
            }             }
            if (!PrivateArea.CheckAccess(hoveringPiece.transform.position, 0f, true, false))             if (!PrivateArea.CheckAccess(hoveringPiece.transform.position, 0f, true, false))
            {             {
                return;                 return;
            }             }
            bool flag = false;             bool flag = false;
            WearNTear component = hoveringPiece.GetComponent<WearNTear>();             WearNTear component = hoveringPiece.GetComponent<WearNTear>();
            if (component && component.Repair())             if (component && component.Repair())
            {             {
                flag = true;                 flag = true;
            }             }
            if (flag)             if (flag)
            {             {
                this.FaceLookDirection();                 this.FaceLookDirection();
                this.m_zanim.SetTrigger(toolItem.m_shared.m_attack.m_attackAnimation);                 this.m_zanim.SetTrigger(toolItem.m_shared.m_attack.m_attackAnimation);
                hoveringPiece.m_placeEffect.Create(hoveringPiece.transform.position, hoveringPiece.transform.rotation, null, 1f, -1);                 hoveringPiece.m_placeEffect.Create(hoveringPiece.transform.position, hoveringPiece.transform.rotation, null, 1f, -1);
                this.Message(MessageHud.MessageType.TopLeft, Localization.instance.Localize("$msg_repaired", new string[] { hoveringPiece.m_name }), 0, null);                 this.Message(MessageHud.MessageType.TopLeft, Localization.instance.Localize("$msg_repaired", new string[] { hoveringPiece.m_name }), 0, null);
                this.UseStamina(toolItem.m_shared.m_attack.m_attackStamina, true);                 this.UseStamina(toolItem.m_shared.m_attack.m_attackStamina, true);
                this.UseEitr(toolItem.m_shared.m_attack.m_attackEitr);                 this.UseEitr(toolItem.m_shared.m_attack.m_attackEitr);
                if (toolItem.m_shared.m_useDurability)                 if (toolItem.m_shared.m_useDurability)
                {                 {
                    toolItem.m_durability -= toolItem.m_shared.m_useDurabilityDrain;                     toolItem.m_durability -= toolItem.m_shared.m_useDurabilityDrain;
                    return;                     return;
                }                 }
            }             }
            else             else
            {             {
                this.Message(MessageHud.MessageType.TopLeft, hoveringPiece.m_name + " $msg_doesnotneedrepair", 0, null);                 this.Message(MessageHud.MessageType.TopLeft, hoveringPiece.m_name + " $msg_doesnotneedrepair", 0, null);
            }             }
        }         }
    }     }
   
    private void UpdateWearNTearHover()     private void UpdateWearNTearHover()
    {     {
        if (!this.InPlaceMode())         if (!this.InPlaceMode())
        {         {
            this.m_hoveringPiece = null;             this.m_hoveringPiece = null;
            return;             return;
        }         }
        this.m_hoveringPiece = null;         this.m_hoveringPiece = null;
        RaycastHit raycastHit;         RaycastHit raycastHit;
        if (Physics.Raycast(GameCamera.instance.transform.position, GameCamera.instance.transform.forward, out raycastHit, 50f, this.m_removeRayMask) && Vector3.Distance(this.m_eye.position, raycastHit.point) < this.m_maxPlaceDistance)         if (Physics.Raycast(GameCamera.instance.transform.position, GameCamera.instance.transform.forward, out raycastHit, 50f, this.m_removeRayMask) && Vector3.Distance(this.m_eye.position, raycastHit.point) < this.m_maxPlaceDistance)
        {         {
            Piece componentInParent = raycastHit.collider.GetComponentInParent<Piece>();             Piece componentInParent = raycastHit.collider.GetComponentInParent<Piece>();
            this.m_hoveringPiece = componentInParent;             this.m_hoveringPiece = componentInParent;
            if (componentInParent)             if (componentInParent)
            {             {
                WearNTear component = componentInParent.GetComponent<WearNTear>();                 WearNTear component = componentInParent.GetComponent<WearNTear>();
                if (component)                 if (component)
                {                 {
                    component.Highlight();                     component.Highlight();
                }                 }
            }             }
        }         }
    }     }
   
    public Piece GetHoveringPiece()     public Piece GetHoveringPiece()
    {     {
        if (!this.InPlaceMode())         if (!this.InPlaceMode())
        {         {
            return null;             return null;
        }         }
        return this.m_hoveringPiece;         return this.m_hoveringPiece;
    }     }
   
    private void UpdatePlacementGhost(bool flashGuardStone)     private void UpdatePlacementGhost(bool flashGuardStone)
    {     {
        if (this.m_placementGhost == null)         if (this.m_placementGhost == null)
        {         {
            if (this.m_placementMarkerInstance)             if (this.m_placementMarkerInstance)
            {             {
                this.m_placementMarkerInstance.SetActive(false);                 this.m_placementMarkerInstance.SetActive(false);
            }             }
            return;             return;
        }         }
        bool flag = ((ZInput.IsNonClassicFunctionality() && ZInput.IsGamepadActive()) ? this.m_altPlace : (ZInput.GetButton("AltPlace") || (ZInput.GetButton("JoyAltPlace") && !ZInput.GetButton("JoyRotate"))));         bool flag = ((ZInput.IsNonClassicFunctionality() && ZInput.IsGamepadActive()) ? this.m_altPlace : (ZInput.GetButton("AltPlace") || (ZInput.GetButton("JoyAltPlace") && !ZInput.GetButton("JoyRotate"))));
        Piece component = this.m_placementGhost.GetComponent<Piece>();         Piece component = this.m_placementGhost.GetComponent<Piece>();
        bool flag2 = component.m_waterPiece || component.m_noInWater;         bool flag2 = component.m_waterPiece || component.m_noInWater;
        Vector3 vector;         Vector3 vector;
        Vector3 up;         Vector3 up;
        Piece piece;         Piece piece;
        Heightmap heightmap;         Heightmap heightmap;
        Collider collider;         Collider collider;
        if (this.PieceRayTest(out vector, out up, out piece, out heightmap, out collider, flag2))         if (this.PieceRayTest(out vector, out up, out piece, out heightmap, out collider, flag2))
        {         {
            this.m_placementStatus = Player.PlacementStatus.Valid;             this.m_placementStatus = Player.PlacementStatus.Valid;
            Quaternion quaternion = Quaternion.Euler(0f, this.m_placeRotationDegrees * (float)this.m_placeRotation, 0f);             Quaternion quaternion = Quaternion.Euler(0f, this.m_placeRotationDegrees * (float)this.m_placeRotation, 0f);
            if (this.m_placementMarkerInstance == null)             if (this.m_placementMarkerInstance == null)
            {             {
                this.m_placementMarkerInstance = UnityEngine.Object.Instantiate<GameObject>(this.m_placeMarker, vector, Quaternion.identity);                 this.m_placementMarkerInstance = UnityEngine.Object.Instantiate<GameObject>(this.m_placeMarker, vector, Quaternion.identity);
            }             }
            this.m_placementMarkerInstance.SetActive(true);             this.m_placementMarkerInstance.SetActive(true);
            this.m_placementMarkerInstance.transform.position = vector;             this.m_placementMarkerInstance.transform.position = vector;
            this.m_placementMarkerInstance.transform.rotation = Quaternion.LookRotation(up, quaternion * Vector3.forward);             this.m_placementMarkerInstance.transform.rotation = Quaternion.LookRotation(up, quaternion * Vector3.forward);
            if (component.m_groundOnly || component.m_groundPiece || component.m_cultivatedGroundOnly)             if (component.m_groundOnly || component.m_groundPiece || component.m_cultivatedGroundOnly)
            {             {
                this.m_placementMarkerInstance.SetActive(false);                 this.m_placementMarkerInstance.SetActive(false);
            }             }
            WearNTear wearNTear = ((piece != null) ? piece.GetComponent<WearNTear>() : null);             WearNTear wearNTear = ((piece != null) ? piece.GetComponent<WearNTear>() : null);
            StationExtension component2 = component.GetComponent<StationExtension>();             StationExtension component2 = component.GetComponent<StationExtension>();
            if (component2 != null)             if (component2 != null)
            {             {
                CraftingStation craftingStation = component2.FindClosestStationInRange(vector);                 CraftingStation craftingStation = component2.FindClosestStationInRange(vector);
                if (craftingStation)                 if (craftingStation)
                {                 {
                    component2.StartConnectionEffect(craftingStation, 1f);                     component2.StartConnectionEffect(craftingStation, 1f);
                }                 }
                else                 else
                {                 {
                    component2.StopConnectionEffect();                     component2.StopConnectionEffect();
                    this.m_placementStatus = Player.PlacementStatus.ExtensionMissingStation;                     this.m_placementStatus = Player.PlacementStatus.ExtensionMissingStation;
                }                 }
                if (component2.OtherExtensionInRange(component.m_spaceRequirement))                 if (component2.OtherExtensionInRange(component.m_spaceRequirement))
                {                 {
                    this.m_placementStatus = Player.PlacementStatus.MoreSpace;                     this.m_placementStatus = Player.PlacementStatus.MoreSpace;
                }                 }
            }             }
            if (component.m_blockRadius > 0f && component.m_blockingPieces.Count > 0)             if (component.m_blockRadius > 0f && component.m_blockingPieces.Count > 0)
            {             {
                Collider[] array = Physics.OverlapSphere(vector, component.m_blockRadius, LayerMask.GetMask(new string[] { "piece" }));                 Collider[] array = Physics.OverlapSphere(vector, component.m_blockRadius, LayerMask.GetMask(new string[] { "piece" }));
                for (int i = 0; i < array.Length; i++)                 for (int i = 0; i < array.Length; i++)
                {                 {
                    Piece componentInParent = array[i].gameObject.GetComponentInParent<Piece>();                     Piece componentInParent = array[i].gameObject.GetComponentInParent<Piece>();
                    if (componentInParent != null && componentInParent != component)                     if (componentInParent != null && componentInParent != component)
                    {                     {
                        using (List<Piece>.Enumerator enumerator = component.m_blockingPieces.GetEnumerator())                         using (List<Piece>.Enumerator enumerator = component.m_blockingPieces.GetEnumerator())
                        {                         {
                            while (enumerator.MoveNext())                             while (enumerator.MoveNext())
                            {                             {
                                if (enumerator.Current.m_name == componentInParent.m_name)                                 if (enumerator.Current.m_name == componentInParent.m_name)
                                {                                 {
                                    this.m_placementStatus = Player.PlacementStatus.MoreSpace;                                     this.m_placementStatus = Player.PlacementStatus.MoreSpace;
                                    break;                                     break;
                                }                                 }
                            }                             }
                        }                         }
                    }                     }
                }                 }
            }             }
            if (component.m_mustConnectTo != null)             if (component.m_mustConnectTo != null)
            {             {
                ZNetView znetView = null;                 ZNetView znetView = null;
                Collider[] array = Physics.OverlapSphere(component.transform.position, component.m_connectRadius);                 Collider[] array = Physics.OverlapSphere(component.transform.position, component.m_connectRadius);
                for (int i = 0; i < array.Length; i++)                 for (int i = 0; i < array.Length; i++)
                {                 {
                    ZNetView componentInParent2 = array[i].GetComponentInParent<ZNetView>();                     ZNetView componentInParent2 = array[i].GetComponentInParent<ZNetView>();
                    if (componentInParent2 != null && componentInParent2 != this.m_nview && componentInParent2.name.Contains(component.m_mustConnectTo.name))                     if (componentInParent2 != null && componentInParent2 != this.m_nview && componentInParent2.name.Contains(component.m_mustConnectTo.name))
                    {                     {
                        if (component.m_mustBeAboveConnected)                         if (component.m_mustBeAboveConnected)
                        {                         {
                            RaycastHit raycastHit;                             RaycastHit raycastHit;
                            Physics.Raycast(component.transform.position, Vector3.down, out raycastHit);                             Physics.Raycast(component.transform.position, Vector3.down, out raycastHit);
                            if (raycastHit.transform.GetComponentInParent<ZNetView>() != componentInParent2)                             if (raycastHit.transform.GetComponentInParent<ZNetView>() != componentInParent2)
                            {                             {
                                goto IL_31F;                                 goto IL_31F;
                            }                             }
                        }                         }
                        znetView = componentInParent2;                         znetView = componentInParent2;
                        break;                         break;
                    }                     }
                    IL_31F:;                     IL_31F:;
                }                 }
                if (!znetView)                 if (!znetView)
                {                 {
                    this.m_placementStatus = Player.PlacementStatus.Invalid;                     this.m_placementStatus = Player.PlacementStatus.Invalid;
                }                 }
            }             }
            if (wearNTear && !wearNTear.m_supports)             if (wearNTear && !wearNTear.m_supports)
            {             {
                this.m_placementStatus = Player.PlacementStatus.Invalid;                 this.m_placementStatus = Player.PlacementStatus.Invalid;
            }             }
            if (component.m_waterPiece && collider == null && !flag)             if (component.m_waterPiece && collider == null && !flag)
            {             {
                this.m_placementStatus = Player.PlacementStatus.Invalid;                 this.m_placementStatus = Player.PlacementStatus.Invalid;
            }             }
            if (component.m_noInWater && collider != null)             if (component.m_noInWater && collider != null)
            {             {
                this.m_placementStatus = Player.PlacementStatus.Invalid;                 this.m_placementStatus = Player.PlacementStatus.Invalid;
            }             }
            if (component.m_groundPiece && heightmap == null)             if (component.m_groundPiece && heightmap == null)
            {             {
                this.m_placementGhost.SetActive(false);                 this.m_placementGhost.SetActive(false);
                this.m_placementStatus = Player.PlacementStatus.Invalid;                 this.m_placementStatus = Player.PlacementStatus.Invalid;
                return;                 return;
            }             }
            if (component.m_groundOnly && heightmap == null)             if (component.m_groundOnly && heightmap == null)
            {             {
                this.m_placementStatus = Player.PlacementStatus.Invalid;                 this.m_placementStatus = Player.PlacementStatus.Invalid;
            }             }
            if (component.m_cultivatedGroundOnly && (heightmap == null || !heightmap.IsCultivated(vector)))             if (component.m_cultivatedGroundOnly && (heightmap == null || !heightmap.IsCultivated(vector)))
            {             {
                this.m_placementStatus = Player.PlacementStatus.NeedCultivated;                 this.m_placementStatus = Player.PlacementStatus.NeedCultivated;
            }             }
.            if (component.m_vegetationGroundOnly && (heightmap == null || heightmap.GetVegetationMask(vector) < 0.25f))              if (component.m_vegetationGroundOnly) 
            {             {
.                this.m_placementStatus = Player.PlacementStatus.NeedDirt;                 bool flag3 = heightmap == null; 
                  if (!flag3) 
                  { 
                      int biome = (int)heightmap.GetBiome(vector, 0.02f, false); 
                      float vegetationMask = heightmap.GetVegetationMask(vector); 
                      flag3 = ((biome == 32) ? (vegetationMask > 0.1f) : (vegetationMask < 0.25f)); 
                  } 
                  if (flag3) 
                  { 
                      this.m_placementStatus = Player.PlacementStatus.NeedDirt;
                  } 
            }             }
            if (component.m_notOnWood && piece && wearNTear && (wearNTear.m_materialType == WearNTear.MaterialType.Wood || wearNTear.m_materialType == WearNTear.MaterialType.HardWood))             if (component.m_notOnWood && piece && wearNTear && (wearNTear.m_materialType == WearNTear.MaterialType.Wood || wearNTear.m_materialType == WearNTear.MaterialType.HardWood))
            {             {
                this.m_placementStatus = Player.PlacementStatus.Invalid;                 this.m_placementStatus = Player.PlacementStatus.Invalid;
            }             }
            if (component.m_notOnTiltingSurface && up.y < 0.8f)             if (component.m_notOnTiltingSurface && up.y < 0.8f)
            {             {
                this.m_placementStatus = Player.PlacementStatus.Invalid;                 this.m_placementStatus = Player.PlacementStatus.Invalid;
            }             }
            if (component.m_inCeilingOnly && up.y > -0.5f)             if (component.m_inCeilingOnly && up.y > -0.5f)
            {             {
                this.m_placementStatus = Player.PlacementStatus.Invalid;                 this.m_placementStatus = Player.PlacementStatus.Invalid;
            }             }
            if (component.m_notOnFloor && up.y > 0.1f)             if (component.m_notOnFloor && up.y > 0.1f)
            {             {
                this.m_placementStatus = Player.PlacementStatus.Invalid;                 this.m_placementStatus = Player.PlacementStatus.Invalid;
            }             }
            if (component.m_onlyInTeleportArea && !EffectArea.IsPointInsideArea(vector, EffectArea.Type.Teleport, 0f))             if (component.m_onlyInTeleportArea && !EffectArea.IsPointInsideArea(vector, EffectArea.Type.Teleport, 0f))
            {             {
                this.m_placementStatus = Player.PlacementStatus.NoTeleportArea;                 this.m_placementStatus = Player.PlacementStatus.NoTeleportArea;
            }             }
            if (!component.m_allowedInDungeons && base.InInterior() && !EnvMan.instance.CheckInteriorBuildingOverride() && !ZoneSystem.instance.GetGlobalKey(GlobalKeys.DungeonBuild))             if (!component.m_allowedInDungeons && base.InInterior() && !EnvMan.instance.CheckInteriorBuildingOverride() && !ZoneSystem.instance.GetGlobalKey(GlobalKeys.DungeonBuild))
            {             {
                this.m_placementStatus = Player.PlacementStatus.NotInDungeon;                 this.m_placementStatus = Player.PlacementStatus.NotInDungeon;
            }             }
            if (heightmap)             if (heightmap)
            {             {
                up = Vector3.up;                 up = Vector3.up;
            }             }
            this.m_placementGhost.SetActive(true);             this.m_placementGhost.SetActive(true);
            int manualSnapPoint = this.m_manualSnapPoint;             int manualSnapPoint = this.m_manualSnapPoint;
            if (!ZInput.GetButton("JoyAltKeys") && !Hud.IsPieceSelectionVisible() && Minimap.instance.m_mode != Minimap.MapMode.Large && !global::Console.IsVisible() && !Chat.instance.HasFocus())             if (!ZInput.GetButton("JoyAltKeys") && !Hud.IsPieceSelectionVisible() && Minimap.instance.m_mode != Minimap.MapMode.Large && !global::Console.IsVisible() && !Chat.instance.HasFocus())
            {             {
                if (ZInput.GetButtonDown("TabLeft") || (ZInput.GetButtonUp("JoyPrevSnap") && ZInput.GetButtonLastPressedTimer("JoyPrevSnap") < 0.33f))                 if (ZInput.GetButtonDown("TabLeft") || (ZInput.GetButtonUp("JoyPrevSnap") && ZInput.GetButtonLastPressedTimer("JoyPrevSnap") < 0.33f))
                {                 {
                    this.m_manualSnapPoint--;                     this.m_manualSnapPoint--;
                }                 }
                if (ZInput.GetButtonDown("TabRight") || (ZInput.GetButtonUp("JoyNextSnap") && ZInput.GetButtonLastPressedTimer("JoyNextSnap") < 0.33f))                 if (ZInput.GetButtonDown("TabRight") || (ZInput.GetButtonUp("JoyNextSnap") && ZInput.GetButtonLastPressedTimer("JoyNextSnap") < 0.33f))
                {                 {
                    this.m_manualSnapPoint++;                     this.m_manualSnapPoint++;
                }                 }
            }             }
            this.m_tempSnapPoints1.Clear();             this.m_tempSnapPoints1.Clear();
            this.m_placementGhost.GetComponent<Piece>().GetSnapPoints(this.m_tempSnapPoints1);             this.m_placementGhost.GetComponent<Piece>().GetSnapPoints(this.m_tempSnapPoints1);
            if (this.m_manualSnapPoint < -1)             if (this.m_manualSnapPoint < -1)
            {             {
                this.m_manualSnapPoint = this.m_tempSnapPoints1.Count - 1;                 this.m_manualSnapPoint = this.m_tempSnapPoints1.Count - 1;
            }             }
            if (this.m_manualSnapPoint >= this.m_tempSnapPoints1.Count)             if (this.m_manualSnapPoint >= this.m_tempSnapPoints1.Count)
            {             {
                this.m_manualSnapPoint = -1;                 this.m_manualSnapPoint = -1;
            }             }
            if (((component.m_groundPiece || component.m_clipGround) && heightmap) || component.m_clipEverything)             if (((component.m_groundPiece || component.m_clipGround) && heightmap) || component.m_clipEverything)
            {             {
                GameObject selectedPrefab = this.m_buildPieces.GetSelectedPrefab();                 GameObject selectedPrefab = this.m_buildPieces.GetSelectedPrefab();
                TerrainModifier component3 = selectedPrefab.GetComponent<TerrainModifier>();                 TerrainModifier component3 = selectedPrefab.GetComponent<TerrainModifier>();
                TerrainOp component4 = selectedPrefab.GetComponent<TerrainOp>();                 TerrainOp component4 = selectedPrefab.GetComponent<TerrainOp>();
                if ((component3 || component4) && component.m_allowAltGroundPlacement && ((ZInput.IsNonClassicFunctionality() && ZInput.IsGamepadActive()) ? (component.m_groundPiece && !this.m_altPlace) : (component.m_groundPiece && !ZInput.GetButton("AltPlace") && !ZInput.GetButton("JoyAltPlace"))))                 if ((component3 || component4) && component.m_allowAltGroundPlacement && ((ZInput.IsNonClassicFunctionality() && ZInput.IsGamepadActive()) ? (component.m_groundPiece && !this.m_altPlace) : (component.m_groundPiece && !ZInput.GetButton("AltPlace") && !ZInput.GetButton("JoyAltPlace"))))
                {                 {
                    float groundHeight = ZoneSystem.instance.GetGroundHeight(base.transform.position);                     float groundHeight = ZoneSystem.instance.GetGroundHeight(base.transform.position);
                    vector.y = groundHeight;                     vector.y = groundHeight;
                }                 }
                this.m_placementGhost.transform.position = vector + ((this.m_manualSnapPoint < 0) ? Vector3.zero : (quaternion * -this.m_tempSnapPoints1[this.m_manualSnapPoint].localPosition));                 this.m_placementGhost.transform.position = vector + ((this.m_manualSnapPoint < 0) ? Vector3.zero : (quaternion * -this.m_tempSnapPoints1[this.m_manualSnapPoint].localPosition));
                this.m_placementGhost.transform.rotation = quaternion;                 this.m_placementGhost.transform.rotation = quaternion;
            }             }
            else             else
            {             {
                Collider[] componentsInChildren = this.m_placementGhost.GetComponentsInChildren<Collider>();                 Collider[] componentsInChildren = this.m_placementGhost.GetComponentsInChildren<Collider>();
                if (componentsInChildren.Length != 0)                 if (componentsInChildren.Length != 0)
                {                 {
                    this.m_placementGhost.transform.position = vector + up * 50f;                     this.m_placementGhost.transform.position = vector + up * 50f;
                    this.m_placementGhost.transform.rotation = quaternion;                     this.m_placementGhost.transform.rotation = quaternion;
                    Vector3 vector2 = Vector3.zero;                     Vector3 vector2 = Vector3.zero;
                    float num = 999999f;                     float num = 999999f;
                    foreach (Collider collider2 in componentsInChildren)                     foreach (Collider collider2 in componentsInChildren)
                    {                     {
                        if (!collider2.isTrigger && collider2.enabled)                         if (!collider2.isTrigger && collider2.enabled)
                        {                         {
                            MeshCollider meshCollider = collider2 as MeshCollider;                             MeshCollider meshCollider = collider2 as MeshCollider;
                            if (!(meshCollider != null) || meshCollider.convex)                             if (!(meshCollider != null) || meshCollider.convex)
                            {                             {
                                Vector3 vector3 = collider2.ClosestPoint(vector);                                 Vector3 vector3 = collider2.ClosestPoint(vector);
                                float num2 = Vector3.Distance(vector3, vector);                                 float num2 = Vector3.Distance(vector3, vector);
                                if (num2 < num)                                 if (num2 < num)
                                {                                 {
                                    vector2 = vector3;                                     vector2 = vector3;
                                    num = num2;                                     num = num2;
                                }                                 }
                            }                             }
                        }                         }
                    }                     }
                    Vector3 vector4 = this.m_placementGhost.transform.position - vector2;                     Vector3 vector4 = this.m_placementGhost.transform.position - vector2;
                    if (component.m_waterPiece)                     if (component.m_waterPiece)
                    {                     {
                        vector4.y = 3f;                         vector4.y = 3f;
                    }                     }
                    this.m_placementGhost.transform.position = vector + ((this.m_manualSnapPoint < 0) ? vector4 : (quaternion * -this.m_tempSnapPoints1[this.m_manualSnapPoint].localPosition));                     this.m_placementGhost.transform.position = vector + ((this.m_manualSnapPoint < 0) ? vector4 : (quaternion * -this.m_tempSnapPoints1[this.m_manualSnapPoint].localPosition));
                    this.m_placementGhost.transform.rotation = quaternion;                     this.m_placementGhost.transform.rotation = quaternion;
                }                 }
            }             }
            if (manualSnapPoint != this.m_manualSnapPoint)             if (manualSnapPoint != this.m_manualSnapPoint)
            {             {
                this.Message(MessageHud.MessageType.Center, "$msg_snapping " + ((this.m_manualSnapPoint == -1) ? "$msg_snapping_auto" : this.m_tempSnapPoints1[this.m_manualSnapPoint].name), 0, null);                 this.Message(MessageHud.MessageType.Center, "$msg_snapping " + ((this.m_manualSnapPoint == -1) ? "$msg_snapping_auto" : this.m_tempSnapPoints1[this.m_manualSnapPoint].name), 0, null);
            }             }
            if (!flag)             if (!flag)
            {             {
                this.m_tempPieces.Clear();                 this.m_tempPieces.Clear();
                Transform transform;                 Transform transform;
                Transform transform2;                 Transform transform2;
                if (this.FindClosestSnapPoints(this.m_placementGhost.transform, 0.5f, out transform, out transform2, this.m_tempPieces))                 if (this.FindClosestSnapPoints(this.m_placementGhost.transform, 0.5f, out transform, out transform2, this.m_tempPieces))
                {                 {
                    Vector3 position = transform2.parent.position;                     Vector3 position = transform2.parent.position;
                    Vector3 vector5 = transform2.position - (transform.position - this.m_placementGhost.transform.position);                     Vector3 vector5 = transform2.position - (transform.position - this.m_placementGhost.transform.position);
                    if (!this.IsOverlappingOtherPiece(vector5, this.m_placementGhost.transform.rotation, this.m_placementGhost.name, this.m_tempPieces, component.m_allowRotatedOverlap))                     if (!this.IsOverlappingOtherPiece(vector5, this.m_placementGhost.transform.rotation, this.m_placementGhost.name, this.m_tempPieces, component.m_allowRotatedOverlap))
                    {                     {
                        this.m_placementGhost.transform.position = vector5;                         this.m_placementGhost.transform.position = vector5;
                    }                     }
                }                 }
            }             }
            if (Location.IsInsideNoBuildLocation(this.m_placementGhost.transform.position))             if (Location.IsInsideNoBuildLocation(this.m_placementGhost.transform.position))
            {             {
                this.m_placementStatus = Player.PlacementStatus.NoBuildZone;                 this.m_placementStatus = Player.PlacementStatus.NoBuildZone;
            }             }
            PrivateArea component5 = component.GetComponent<PrivateArea>();             PrivateArea component5 = component.GetComponent<PrivateArea>();
            float num3 = (component5 ? component5.m_radius : 0f);             float num3 = (component5 ? component5.m_radius : 0f);
.            bool flag3 = component5 != null;             bool flag4 = component5 != null;
            if (!PrivateArea.CheckAccess(this.m_placementGhost.transform.position, num3, flashGuardStone, flag3))             if (!PrivateArea.CheckAccess(this.m_placementGhost.transform.position, num3, flashGuardStone, flag4))
            {             {
                this.m_placementStatus = Player.PlacementStatus.PrivateZone;                 this.m_placementStatus = Player.PlacementStatus.PrivateZone;
            }             }
            if (this.CheckPlacementGhostVSPlayers())             if (this.CheckPlacementGhostVSPlayers())
            {             {
                this.m_placementStatus = Player.PlacementStatus.BlockedbyPlayer;                 this.m_placementStatus = Player.PlacementStatus.BlockedbyPlayer;
            }             }
            if (component.m_onlyInBiome != Heightmap.Biome.None && (Heightmap.FindBiome(this.m_placementGhost.transform.position) & component.m_onlyInBiome) == Heightmap.Biome.None)             if (component.m_onlyInBiome != Heightmap.Biome.None && (Heightmap.FindBiome(this.m_placementGhost.transform.position) & component.m_onlyInBiome) == Heightmap.Biome.None)
            {             {
                this.m_placementStatus = Player.PlacementStatus.WrongBiome;                 this.m_placementStatus = Player.PlacementStatus.WrongBiome;
            }             }
            if (component.m_noClipping && this.TestGhostClipping(this.m_placementGhost, 0.2f))             if (component.m_noClipping && this.TestGhostClipping(this.m_placementGhost, 0.2f))
            {             {
                this.m_placementStatus = Player.PlacementStatus.Invalid;                 this.m_placementStatus = Player.PlacementStatus.Invalid;
            }             }
        }         }
        else         else
        {         {
            if (this.m_placementMarkerInstance)             if (this.m_placementMarkerInstance)
            {             {
                this.m_placementMarkerInstance.SetActive(false);                 this.m_placementMarkerInstance.SetActive(false);
            }             }
            this.m_placementGhost.SetActive(false);             this.m_placementGhost.SetActive(false);
            this.m_placementStatus = Player.PlacementStatus.NoRayHits;             this.m_placementStatus = Player.PlacementStatus.NoRayHits;
        }         }
        this.SetPlacementGhostValid(this.m_placementStatus == Player.PlacementStatus.Valid);         this.SetPlacementGhostValid(this.m_placementStatus == Player.PlacementStatus.Valid);
    }     }
   
    private bool IsOverlappingOtherPiece(Vector3 p, Quaternion rotation, string pieceName, List<Piece> pieces, bool allowRotatedOverlap)     private bool IsOverlappingOtherPiece(Vector3 p, Quaternion rotation, string pieceName, List<Piece> pieces, bool allowRotatedOverlap)
    {     {
        foreach (Piece piece in this.m_tempPieces)         foreach (Piece piece in this.m_tempPieces)
        {         {
            if (Vector3.Distance(p, piece.transform.position) < 0.05f && (!allowRotatedOverlap || Quaternion.Angle(piece.transform.rotation, rotation) <= 10f) && piece.gameObject.name.CustomStartsWith(pieceName))             if (Vector3.Distance(p, piece.transform.position) < 0.05f && (!allowRotatedOverlap || Quaternion.Angle(piece.transform.rotation, rotation) <= 10f) && piece.gameObject.name.CustomStartsWith(pieceName))
            {             {
                return true;                 return true;
            }             }
        }         }
        return false;         return false;
    }     }
   
    private bool FindClosestSnapPoints(Transform ghost, float maxSnapDistance, out Transform a, out Transform b, List<Piece> pieces)     private bool FindClosestSnapPoints(Transform ghost, float maxSnapDistance, out Transform a, out Transform b, List<Piece> pieces)
    {     {
        this.m_tempSnapPoints1.Clear();         this.m_tempSnapPoints1.Clear();
        ghost.GetComponent<Piece>().GetSnapPoints(this.m_tempSnapPoints1);         ghost.GetComponent<Piece>().GetSnapPoints(this.m_tempSnapPoints1);
        this.m_tempSnapPoints2.Clear();         this.m_tempSnapPoints2.Clear();
        this.m_tempPieces.Clear();         this.m_tempPieces.Clear();
        Piece.GetSnapPoints(ghost.transform.position, 10f, this.m_tempSnapPoints2, this.m_tempPieces);         Piece.GetSnapPoints(ghost.transform.position, 10f, this.m_tempSnapPoints2, this.m_tempPieces);
        float num = 9999999f;         float num = 9999999f;
        a = null;         a = null;
        b = null;         b = null;
        if (this.m_manualSnapPoint < 0)         if (this.m_manualSnapPoint < 0)
        {         {
            foreach (Transform transform in this.m_tempSnapPoints1)             foreach (Transform transform in this.m_tempSnapPoints1)
            {             {
                Transform transform2;                 Transform transform2;
                float num2;                 float num2;
                if (this.FindClosestSnappoint(transform.position, this.m_tempSnapPoints2, maxSnapDistance, out transform2, out num2) && num2 < num)                 if (this.FindClosestSnappoint(transform.position, this.m_tempSnapPoints2, maxSnapDistance, out transform2, out num2) && num2 < num)
                {                 {
                    num = num2;                     num = num2;
                    a = transform;                     a = transform;
                    b = transform2;                     b = transform2;
                }                 }
            }             }
            return a != null;             return a != null;
        }         }
        Transform transform3;         Transform transform3;
        float num3;         float num3;
        if (this.FindClosestSnappoint(this.m_tempSnapPoints1[this.m_manualSnapPoint].position, this.m_tempSnapPoints2, maxSnapDistance, out transform3, out num3))         if (this.FindClosestSnappoint(this.m_tempSnapPoints1[this.m_manualSnapPoint].position, this.m_tempSnapPoints2, maxSnapDistance, out transform3, out num3))
        {         {
            a = this.m_tempSnapPoints1[this.m_manualSnapPoint];             a = this.m_tempSnapPoints1[this.m_manualSnapPoint];
            b = transform3;             b = transform3;
            return true;             return true;
        }         }
        return false;         return false;
    }     }
   
    private bool FindClosestSnappoint(Vector3 p, List<Transform> snapPoints, float maxDistance, out Transform closest, out float distance)     private bool FindClosestSnappoint(Vector3 p, List<Transform> snapPoints, float maxDistance, out Transform closest, out float distance)
    {     {
        closest = null;         closest = null;
        distance = 999999f;         distance = 999999f;
        foreach (Transform transform in snapPoints)         foreach (Transform transform in snapPoints)
        {         {
            float num = Vector3.Distance(transform.position, p);             float num = Vector3.Distance(transform.position, p);
            if (num <= maxDistance && num < distance)             if (num <= maxDistance && num < distance)
            {             {
                closest = transform;                 closest = transform;
                distance = num;                 distance = num;
            }             }
        }         }
        return closest != null;         return closest != null;
    }     }
   
    private bool TestGhostClipping(GameObject ghost, float maxPenetration)     private bool TestGhostClipping(GameObject ghost, float maxPenetration)
    {     {
        Collider[] componentsInChildren = ghost.GetComponentsInChildren<Collider>();         Collider[] componentsInChildren = ghost.GetComponentsInChildren<Collider>();
        Collider[] array = Physics.OverlapSphere(ghost.transform.position, 10f, this.m_placeRayMask);         Collider[] array = Physics.OverlapSphere(ghost.transform.position, 10f, this.m_placeRayMask);
        foreach (Collider collider in componentsInChildren)         foreach (Collider collider in componentsInChildren)
        {         {
            foreach (Collider collider2 in array)             foreach (Collider collider2 in array)
            {             {
                Vector3 vector;                 Vector3 vector;
                float num;                 float num;
                if (Physics.ComputePenetration(collider, collider.transform.position, collider.transform.rotation, collider2, collider2.transform.position, collider2.transform.rotation, out vector, out num) && num > maxPenetration)                 if (Physics.ComputePenetration(collider, collider.transform.position, collider.transform.rotation, collider2, collider2.transform.position, collider2.transform.rotation, out vector, out num) && num > maxPenetration)
                {                 {
                    return true;                     return true;
                }                 }
            }             }
        }         }
        return false;         return false;
    }     }
   
    private bool CheckPlacementGhostVSPlayers()     private bool CheckPlacementGhostVSPlayers()
    {     {
        if (this.m_placementGhost == null)         if (this.m_placementGhost == null)
        {         {
            return false;             return false;
        }         }
        List<Character> list = new List<Character>();         List<Character> list = new List<Character>();
        Character.GetCharactersInRange(base.transform.position, 30f, list);         Character.GetCharactersInRange(base.transform.position, 30f, list);
        foreach (Collider collider in this.m_placementGhost.GetComponentsInChildren<Collider>())         foreach (Collider collider in this.m_placementGhost.GetComponentsInChildren<Collider>())
        {         {
            if (!collider.isTrigger && collider.enabled)             if (!collider.isTrigger && collider.enabled)
            {             {
                MeshCollider meshCollider = collider as MeshCollider;                 MeshCollider meshCollider = collider as MeshCollider;
                if (!(meshCollider != null) || meshCollider.convex)                 if (!(meshCollider != null) || meshCollider.convex)
                {                 {
                    foreach (Character character in list)                     foreach (Character character in list)
                    {                     {
                        CapsuleCollider collider2 = character.GetCollider();                         CapsuleCollider collider2 = character.GetCollider();
                        Vector3 vector;                         Vector3 vector;
                        float num;                         float num;
                        if (Physics.ComputePenetration(collider, collider.transform.position, collider.transform.rotation, collider2, collider2.transform.position, collider2.transform.rotation, out vector, out num))                         if (Physics.ComputePenetration(collider, collider.transform.position, collider.transform.rotation, collider2, collider2.transform.position, collider2.transform.rotation, out vector, out num))
                        {                         {
                            return true;                             return true;
                        }                         }
                    }                     }
                }                 }
            }             }
        }         }
        return false;         return false;
    }     }
   
    private bool PieceRayTest(out Vector3 point, out Vector3 normal, out Piece piece, out Heightmap heightmap, out Collider waterSurface, bool water)     private bool PieceRayTest(out Vector3 point, out Vector3 normal, out Piece piece, out Heightmap heightmap, out Collider waterSurface, bool water)
    {     {
        int num = this.m_placeRayMask;         int num = this.m_placeRayMask;
        if (water)         if (water)
        {         {
            num = this.m_placeWaterRayMask;             num = this.m_placeWaterRayMask;
        }         }
        RaycastHit raycastHit;         RaycastHit raycastHit;
.        if (Physics.Raycast(GameCamera.instance.transform.position, GameCamera.instance.transform.forward, out raycastHit, 50f, num) && raycastHit.collider && !raycastHit.collider.attachedRigidbody && Vector3.Distance(this.m_eye.position, raycastHit.point) < this.m_maxPlaceDistance)          if (Physics.Raycast(GameCamera.instance.transform.position, GameCamera.instance.transform.forward, out raycastHit, 50f, num)) 
        {         {
.            point = raycastHit.point;              float num2 = this.m_maxPlaceDistance;
            normal = raycastHit.normal;             if (this.m_placementGhost) 
            piece = raycastHit.collider.GetComponentInParent<Piece>();   
            heightmap = raycastHit.collider.GetComponent<Heightmap>();   
            if (raycastHit.collider.gameObject.layer == LayerMask.NameToLayer("Water"))   
            {             {
.                waterSurface = raycastHit.collider;                 Piece component = this.m_placementGhost.GetComponent<Piece>();
                  if (component != null) 
                  { 
                      num2 += (float)component.m_extraPlacementDistance; 
                  } 
            }             }
.            else              if (raycastHit.collider && !raycastHit.collider.attachedRigidbody && Vector3.Distance(this.m_eye.position, raycastHit.point) < num2) 
            {             {
.                waterSurface = null;                 point = raycastHit.point; 
                  normal = raycastHit.normal; 
                  piece = raycastHit.collider.GetComponentInParent<Piece>(); 
                  heightmap = raycastHit.collider.GetComponent<Heightmap>(); 
                  if (raycastHit.collider.gameObject.layer == LayerMask.NameToLayer("Water")) 
                  { 
                      waterSurface = raycastHit.collider; 
                  } 
                  else 
                  { 
                      waterSurface = null;
                  } 
                  return true; 
            }             }
.            return true;  
        }         }
        point = Vector3.zero;         point = Vector3.zero;
        normal = Vector3.zero;         normal = Vector3.zero;
        piece = null;         piece = null;
        heightmap = null;         heightmap = null;
        waterSurface = null;         waterSurface = null;
        return false;         return false;
    }     }
   
    private void FindHoverObject(out GameObject hover, out Character hoverCreature)     private void FindHoverObject(out GameObject hover, out Character hoverCreature)
    {     {
        hover = null;         hover = null;
        hoverCreature = null;         hoverCreature = null;
.        RaycastHit[] array = Physics.RaycastAll(GameCamera.instance.transform.position, GameCamera.instance.transform.forward, 50f, this.m_interactMask);         int num = Physics.RaycastNonAlloc(GameCamera.instance.transform.position, GameCamera.instance.transform.forward, this.m_raycastHoverHits, 50f, this.m_interactMask);
        Array.Sort<RaycastHit>(array, (RaycastHit x, RaycastHit y) => x.distance.CompareTo(y.distance));         Array.Sort<RaycastHit>(this.m_raycastHoverHits, 0, num, Player.RaycastHitComparer.Instance);
        RaycastHit[] array2 = array;   
        int i = 0;         int i = 0;
.        while (i < array2.Length)         while (i < num)
        {         {
.            RaycastHit raycastHit = array2[i];             RaycastHit raycastHit = this.m_raycastHoverHits[i];
            if (!raycastHit.collider.attachedRigidbody || !(raycastHit.collider.attachedRigidbody.gameObject == base.gameObject))             if (!raycastHit.collider.attachedRigidbody || !(raycastHit.collider.attachedRigidbody.gameObject == base.gameObject))
            {             {
                if (hoverCreature == null)                 if (hoverCreature == null)
                {                 {
                    Character character = (raycastHit.collider.attachedRigidbody ? raycastHit.collider.attachedRigidbody.GetComponent<Character>() : raycastHit.collider.GetComponent<Character>());                     Character character = (raycastHit.collider.attachedRigidbody ? raycastHit.collider.attachedRigidbody.GetComponent<Character>() : raycastHit.collider.GetComponent<Character>());
                    if (character != null && (!character.GetBaseAI() || !character.GetBaseAI().IsSleeping()) && !ParticleMist.IsMistBlocked(base.GetCenterPoint(), character.GetCenterPoint()))                     if (character != null && (!character.GetBaseAI() || !character.GetBaseAI().IsSleeping()) && !ParticleMist.IsMistBlocked(base.GetCenterPoint(), character.GetCenterPoint()))
                    {                     {
                        hoverCreature = character;                         hoverCreature = character;
                    }                     }
                }                 }
                if (Vector3.Distance(this.m_eye.position, raycastHit.point) >= this.m_maxInteractDistance)                 if (Vector3.Distance(this.m_eye.position, raycastHit.point) >= this.m_maxInteractDistance)
                {                 {
                    break;                     break;
                }                 }
                if (raycastHit.collider.GetComponent<Hoverable>() != null)                 if (raycastHit.collider.GetComponent<Hoverable>() != null)
                {                 {
                    hover = raycastHit.collider.gameObject;                     hover = raycastHit.collider.gameObject;
                    return;                     return;
                }                 }
                if (raycastHit.collider.attachedRigidbody)                 if (raycastHit.collider.attachedRigidbody)
                {                 {
                    hover = raycastHit.collider.attachedRigidbody.gameObject;                     hover = raycastHit.collider.attachedRigidbody.gameObject;
                    return;                     return;
                }                 }
                hover = raycastHit.collider.gameObject;                 hover = raycastHit.collider.gameObject;
                return;                 return;
            }             }
            else             else
            {             {
                i++;                 i++;
            }             }
        }         }
    }     }
   
    private void Interact(GameObject go, bool hold, bool alt)     private void Interact(GameObject go, bool hold, bool alt)
    {     {
        if (this.InAttack() || this.InDodge())         if (this.InAttack() || this.InDodge())
        {         {
            return;             return;
        }         }
        if (hold && Time.time - this.m_lastHoverInteractTime < 0.2f)         if (hold && Time.time - this.m_lastHoverInteractTime < 0.2f)
        {         {
            return;             return;
        }         }
        Interactable componentInParent = go.GetComponentInParent<Interactable>();         Interactable componentInParent = go.GetComponentInParent<Interactable>();
        if (componentInParent != null)         if (componentInParent != null)
        {         {
            this.m_lastHoverInteractTime = Time.time;             this.m_lastHoverInteractTime = Time.time;
            if (componentInParent.Interact(this, hold, alt))             if (componentInParent.Interact(this, hold, alt))
            {             {
                base.DoInteractAnimation(go.transform.position);                 base.DoInteractAnimation(go.transform.position);
            }             }
        }         }
    }     }
   
    private void UpdateStations(float dt)     private void UpdateStations(float dt)
    {     {
        this.m_stationDiscoverTimer += dt;         this.m_stationDiscoverTimer += dt;
        if (this.m_stationDiscoverTimer > 1f)         if (this.m_stationDiscoverTimer > 1f)
        {         {
            this.m_stationDiscoverTimer = 0f;             this.m_stationDiscoverTimer = 0f;
            CraftingStation.UpdateKnownStationsInRange(this);             CraftingStation.UpdateKnownStationsInRange(this);
        }         }
        if (!(this.m_currentStation != null))         if (!(this.m_currentStation != null))
        {         {
            if (this.m_inCraftingStation)             if (this.m_inCraftingStation)
            {             {
                this.m_zanim.SetInt("crafting", 0);                 this.m_zanim.SetInt("crafting", 0);
                this.m_inCraftingStation = false;                 this.m_inCraftingStation = false;
                if (InventoryGui.IsVisible())                 if (InventoryGui.IsVisible())
                {                 {
                    InventoryGui.instance.Hide();                     InventoryGui.instance.Hide();
                }                 }
            }             }
            return;             return;
        }         }
        if (!this.m_currentStation.InUseDistance(this))         if (!this.m_currentStation.InUseDistance(this))
        {         {
            InventoryGui.instance.Hide();             InventoryGui.instance.Hide();
            this.SetCraftingStation(null);             this.SetCraftingStation(null);
            return;             return;
        }         }
        if (!InventoryGui.IsVisible())         if (!InventoryGui.IsVisible())
        {         {
            this.SetCraftingStation(null);             this.SetCraftingStation(null);
            return;             return;
        }         }
        this.m_currentStation.PokeInUse();         this.m_currentStation.PokeInUse();
        if (!this.AlwaysRotateCamera())         if (!this.AlwaysRotateCamera())
        {         {
            Vector3 normalized = (this.m_currentStation.transform.position - base.transform.position).normalized;             Vector3 normalized = (this.m_currentStation.transform.position - base.transform.position).normalized;
            normalized.y = 0f;             normalized.y = 0f;
            normalized.Normalize();             normalized.Normalize();
            Quaternion quaternion = Quaternion.LookRotation(normalized);             Quaternion quaternion = Quaternion.LookRotation(normalized);
            base.transform.rotation = Quaternion.RotateTowards(base.transform.rotation, quaternion, this.m_turnSpeed * dt);             base.transform.rotation = Quaternion.RotateTowards(base.transform.rotation, quaternion, this.m_turnSpeed * dt);
        }         }
        this.m_zanim.SetInt("crafting", this.m_currentStation.m_useAnimation);         this.m_zanim.SetInt("crafting", this.m_currentStation.m_useAnimation);
        this.m_inCraftingStation = true;         this.m_inCraftingStation = true;
    }     }
   
    public void SetCraftingStation(CraftingStation station)     public void SetCraftingStation(CraftingStation station)
    {     {
        if (this.m_currentStation == station)         if (this.m_currentStation == station)
        {         {
            return;             return;
        }         }
        if (station)         if (station)
        {         {
            this.AddKnownStation(station);             this.AddKnownStation(station);
            station.PokeInUse();             station.PokeInUse();
            base.HideHandItems();             base.HideHandItems();
        }         }
        this.m_currentStation = station;         this.m_currentStation = station;
    }     }
   
    public CraftingStation GetCurrentCraftingStation()     public CraftingStation GetCurrentCraftingStation()
    {     {
        return this.m_currentStation;         return this.m_currentStation;
    }     }
   
    private void UpdateCover(float dt)     private void UpdateCover(float dt)
    {     {
        this.m_updateCoverTimer += dt;         this.m_updateCoverTimer += dt;
        if (this.m_updateCoverTimer > 1f)         if (this.m_updateCoverTimer > 1f)
        {         {
            this.m_updateCoverTimer = 0f;             this.m_updateCoverTimer = 0f;
            Cover.GetCoverForPoint(base.GetCenterPoint(), out this.m_coverPercentage, out this.m_underRoof, 0.5f);             Cover.GetCoverForPoint(base.GetCenterPoint(), out this.m_coverPercentage, out this.m_underRoof, 0.5f);
        }         }
    }     }
   
    public Character GetHoverCreature()     public Character GetHoverCreature()
    {     {
        return this.m_hoveringCreature;         return this.m_hoveringCreature;
    }     }
   
    public override GameObject GetHoverObject()     public override GameObject GetHoverObject()
    {     {
        return this.m_hovering;         return this.m_hovering;
    }     }
   
    public override void OnNearFire(Vector3 point)     public override void OnNearFire(Vector3 point)
    {     {
        this.m_nearFireTimer = 0f;         this.m_nearFireTimer = 0f;
    }     }
   
    public bool InShelter()     public bool InShelter()
    {     {
        return this.m_coverPercentage >= 0.8f && this.m_underRoof;         return this.m_coverPercentage >= 0.8f && this.m_underRoof;
    }     }
   
    public float GetStamina()     public float GetStamina()
    {     {
        return this.m_stamina;         return this.m_stamina;
    }     }
   
    public override float GetMaxStamina()     public override float GetMaxStamina()
    {     {
        return this.m_maxStamina;         return this.m_maxStamina;
    }     }
   
    public float GetEitr()     public float GetEitr()
    {     {
        return this.m_eitr;         return this.m_eitr;
    }     }
   
    public override float GetMaxEitr()     public override float GetMaxEitr()
    {     {
        return this.m_maxEitr;         return this.m_maxEitr;
    }     }
   
    public override float GetEitrPercentage()     public override float GetEitrPercentage()
    {     {
        return this.m_eitr / this.m_maxEitr;         return this.m_eitr / this.m_maxEitr;
    }     }
   
    public override float GetStaminaPercentage()     public override float GetStaminaPercentage()
    {     {
        return this.m_stamina / this.m_maxStamina;         return this.m_stamina / this.m_maxStamina;
    }     }
   
    public void SetGodMode(bool godMode)     public void SetGodMode(bool godMode)
    {     {
        this.m_godMode = godMode;         this.m_godMode = godMode;
    }     }
   
    public override bool InGodMode()     public override bool InGodMode()
    {     {
        return this.m_godMode;         return this.m_godMode;
    }     }
   
    public void SetGhostMode(bool ghostmode)     public void SetGhostMode(bool ghostmode)
    {     {
        this.m_ghostMode = ghostmode;         this.m_ghostMode = ghostmode;
    }     }
   
    public override bool InGhostMode()     public override bool InGhostMode()
    {     {
        return this.m_ghostMode;         return this.m_ghostMode;
    }     }
   
.      public bool AttackTowardsPlayerLookDir
      {
          get
          {
              return this.m_attackTowardsPlayerLookDir;
          }
          set
          {
              this.m_attackTowardsPlayerLookDir = value;
          }
      }
   
    public override bool IsDebugFlying()     public override bool IsDebugFlying()
    {     {
        if (this.m_nview == null || !this.m_nview.IsValid())         if (this.m_nview == null || !this.m_nview.IsValid())
        {         {
            return false;             return false;
        }         }
        if (this.m_nview.IsOwner())         if (this.m_nview.IsOwner())
        {         {
            return this.m_debugFly;             return this.m_debugFly;
        }         }
        return this.m_nview.GetZDO().GetBool(ZDOVars.s_debugFly, false);         return this.m_nview.GetZDO().GetBool(ZDOVars.s_debugFly, false);
    }     }
   
    public override void AddEitr(float v)     public override void AddEitr(float v)
    {     {
        this.m_eitr += v;         this.m_eitr += v;
        if (this.m_eitr > this.m_maxEitr)         if (this.m_eitr > this.m_maxEitr)
        {         {
            this.m_eitr = this.m_maxEitr;             this.m_eitr = this.m_maxEitr;
        }         }
    }     }
   
    public override void AddStamina(float v)     public override void AddStamina(float v)
    {     {
        this.m_stamina += v;         this.m_stamina += v;
        if (this.m_stamina > this.m_maxStamina)         if (this.m_stamina > this.m_maxStamina)
        {         {
            this.m_stamina = this.m_maxStamina;             this.m_stamina = this.m_maxStamina;
        }         }
    }     }
   
    public override void UseEitr(float v)     public override void UseEitr(float v)
    {     {
        if (v == 0f)         if (v == 0f)
        {         {
            return;             return;
        }         }
        if (!this.m_nview.IsValid())         if (!this.m_nview.IsValid())
        {         {
            return;             return;
        }         }
        if (this.m_nview.IsOwner())         if (this.m_nview.IsOwner())
        {         {
            this.RPC_UseEitr(0L, v);             this.RPC_UseEitr(0L, v);
            return;             return;
        }         }
        this.m_nview.InvokeRPC("UseEitr", new object[] { v });         this.m_nview.InvokeRPC("UseEitr", new object[] { v });
    }     }
   
    private void RPC_UseEitr(long sender, float v)     private void RPC_UseEitr(long sender, float v)
    {     {
        if (v == 0f)         if (v == 0f)
        {         {
            return;             return;
        }         }
        this.m_eitr -= v;         this.m_eitr -= v;
        if (this.m_eitr < 0f)         if (this.m_eitr < 0f)
        {         {
            this.m_eitr = 0f;             this.m_eitr = 0f;
        }         }
        this.m_eitrRegenTimer = this.m_eitrRegenDelay;         this.m_eitrRegenTimer = this.m_eitrRegenDelay;
    }     }
   
    public override bool HaveEitr(float amount = 0f)     public override bool HaveEitr(float amount = 0f)
    {     {
        if (this.m_nview.IsValid() && !this.m_nview.IsOwner())         if (this.m_nview.IsValid() && !this.m_nview.IsOwner())
        {         {
            return this.m_nview.GetZDO().GetFloat(ZDOVars.s_eitr, this.m_maxEitr) > amount;             return this.m_nview.GetZDO().GetFloat(ZDOVars.s_eitr, this.m_maxEitr) > amount;
        }         }
        return this.m_eitr > amount;         return this.m_eitr > amount;
    }     }
   
.    public override void UseStamina(float v, bool isBaseUsage = false)     public override void UseStamina(float v, bool isHomeUsage = false)
    {     {
        if (v == 0f)         if (v == 0f)
        {         {
            return;             return;
        }         }
        v *= Game.m_staminaRate;         v *= Game.m_staminaRate;
.        if (isBaseUsage)         if (isHomeUsage)
        {         {
.            v *= 1f + this.m_equipmentBaseItemModifier;             v *= 1f + this.GetEquipmentHomeItemModifier();
              this.m_seman.ModifyHomeItemStaminaUsage(v, ref v, true); 
        }         }
        if (!this.m_nview.IsValid())         if (!this.m_nview.IsValid())
        {         {
            return;             return;
        }         }
        if (this.m_nview.IsOwner())         if (this.m_nview.IsOwner())
        {         {
            this.RPC_UseStamina(0L, v);             this.RPC_UseStamina(0L, v);
            return;             return;
        }         }
        this.m_nview.InvokeRPC("UseStamina", new object[] { v });         this.m_nview.InvokeRPC("UseStamina", new object[] { v });
    }     }
   
    private void RPC_UseStamina(long sender, float v)     private void RPC_UseStamina(long sender, float v)
    {     {
        if (v == 0f)         if (v == 0f)
        {         {
            return;             return;
        }         }
        this.m_stamina -= v;         this.m_stamina -= v;
        if (this.m_stamina < 0f)         if (this.m_stamina < 0f)
        {         {
            this.m_stamina = 0f;             this.m_stamina = 0f;
        }         }
        this.m_staminaRegenTimer = this.m_staminaRegenDelay;         this.m_staminaRegenTimer = this.m_staminaRegenDelay;
    }     }
   
    public override bool HaveStamina(float amount = 0f)     public override bool HaveStamina(float amount = 0f)
    {     {
        if (this.m_nview.IsValid() && !this.m_nview.IsOwner())         if (this.m_nview.IsValid() && !this.m_nview.IsOwner())
        {         {
            return this.m_nview.GetZDO().GetFloat(ZDOVars.s_stamina, this.m_maxStamina) > amount;             return this.m_nview.GetZDO().GetFloat(ZDOVars.s_stamina, this.m_maxStamina) > amount;
        }         }
        return this.m_stamina > amount;         return this.m_stamina > amount;
    }     }
   
    public void Save(ZPackage pkg)     public void Save(ZPackage pkg)
    {     {
.        pkg.Write(26);         pkg.Write(27);
        pkg.Write(base.GetMaxHealth());         pkg.Write(base.GetMaxHealth());
        pkg.Write(base.GetHealth());         pkg.Write(base.GetHealth());
        pkg.Write(this.GetMaxStamina());         pkg.Write(this.GetMaxStamina());
        pkg.Write(this.m_firstSpawn);         pkg.Write(this.m_firstSpawn);
        pkg.Write(this.m_timeSinceDeath);         pkg.Write(this.m_timeSinceDeath);
        pkg.Write(this.m_guardianPower);         pkg.Write(this.m_guardianPower);
        pkg.Write(this.m_guardianPowerCooldown);         pkg.Write(this.m_guardianPowerCooldown);
        this.m_inventory.Save(pkg);         this.m_inventory.Save(pkg);
        pkg.Write(this.m_knownRecipes.Count);         pkg.Write(this.m_knownRecipes.Count);
        foreach (string text in this.m_knownRecipes)         foreach (string text in this.m_knownRecipes)
        {         {
            pkg.Write(text);             pkg.Write(text);
        }         }
        pkg.Write(this.m_knownStations.Count);         pkg.Write(this.m_knownStations.Count);
        foreach (KeyValuePair<string, int> keyValuePair in this.m_knownStations)         foreach (KeyValuePair<string, int> keyValuePair in this.m_knownStations)
        {         {
            pkg.Write(keyValuePair.Key);             pkg.Write(keyValuePair.Key);
            pkg.Write(keyValuePair.Value);             pkg.Write(keyValuePair.Value);
        }         }
        pkg.Write(this.m_knownMaterial.Count);         pkg.Write(this.m_knownMaterial.Count);
        foreach (string text2 in this.m_knownMaterial)         foreach (string text2 in this.m_knownMaterial)
        {         {
            pkg.Write(text2);             pkg.Write(text2);
        }         }
        pkg.Write(this.m_shownTutorials.Count);         pkg.Write(this.m_shownTutorials.Count);
        foreach (string text3 in this.m_shownTutorials)         foreach (string text3 in this.m_shownTutorials)
        {         {
            pkg.Write(text3);             pkg.Write(text3);
        }         }
        pkg.Write(this.m_uniques.Count);         pkg.Write(this.m_uniques.Count);
        foreach (string text4 in this.m_uniques)         foreach (string text4 in this.m_uniques)
        {         {
            pkg.Write(text4);             pkg.Write(text4);
        }         }
        pkg.Write(this.m_trophies.Count);         pkg.Write(this.m_trophies.Count);
        foreach (string text5 in this.m_trophies)         foreach (string text5 in this.m_trophies)
        {         {
            pkg.Write(text5);             pkg.Write(text5);
        }         }
        pkg.Write(this.m_knownBiome.Count);         pkg.Write(this.m_knownBiome.Count);
        foreach (Heightmap.Biome biome in this.m_knownBiome)         foreach (Heightmap.Biome biome in this.m_knownBiome)
        {         {
            pkg.Write((int)biome);             pkg.Write((int)biome);
        }         }
        pkg.Write(this.m_knownTexts.Count);         pkg.Write(this.m_knownTexts.Count);
        foreach (KeyValuePair<string, string> keyValuePair2 in this.m_knownTexts)         foreach (KeyValuePair<string, string> keyValuePair2 in this.m_knownTexts)
        {         {
            pkg.Write(keyValuePair2.Key.Replace("\u0016", ""));             pkg.Write(keyValuePair2.Key.Replace("\u0016", ""));
            pkg.Write(keyValuePair2.Value.Replace("\u0016", ""));             pkg.Write(keyValuePair2.Value.Replace("\u0016", ""));
        }         }
        pkg.Write(this.m_beardItem);         pkg.Write(this.m_beardItem);
        pkg.Write(this.m_hairItem);         pkg.Write(this.m_hairItem);
        pkg.Write(this.m_skinColor);         pkg.Write(this.m_skinColor);
        pkg.Write(this.m_hairColor);         pkg.Write(this.m_hairColor);
        pkg.Write(this.m_modelIndex);         pkg.Write(this.m_modelIndex);
        pkg.Write(this.m_foods.Count);         pkg.Write(this.m_foods.Count);
        foreach (Player.Food food in this.m_foods)         foreach (Player.Food food in this.m_foods)
        {         {
            pkg.Write(food.m_name);             pkg.Write(food.m_name);
            pkg.Write(food.m_time);             pkg.Write(food.m_time);
        }         }
        this.m_skills.Save(pkg);         this.m_skills.Save(pkg);
        pkg.Write(this.m_customData.Count);         pkg.Write(this.m_customData.Count);
        foreach (KeyValuePair<string, string> keyValuePair3 in this.m_customData)         foreach (KeyValuePair<string, string> keyValuePair3 in this.m_customData)
        {         {
            pkg.Write(keyValuePair3.Key);             pkg.Write(keyValuePair3.Key);
            pkg.Write(keyValuePair3.Value);             pkg.Write(keyValuePair3.Value);
        }         }
        pkg.Write(this.GetStamina());         pkg.Write(this.GetStamina());
        pkg.Write(this.GetMaxEitr());         pkg.Write(this.GetMaxEitr());
        pkg.Write(this.GetEitr());         pkg.Write(this.GetEitr());
    }     }
   
    public void Load(ZPackage pkg)     public void Load(ZPackage pkg)
    {     {
        this.m_isLoading = true;         this.m_isLoading = true;
        base.UnequipAllItems();         base.UnequipAllItems();
        int num = pkg.ReadInt();         int num = pkg.ReadInt();
        if (num >= 7)         if (num >= 7)
        {         {
            this.SetMaxHealth(pkg.ReadSingle(), false);             this.SetMaxHealth(pkg.ReadSingle(), false);
        }         }
        float num2 = pkg.ReadSingle();         float num2 = pkg.ReadSingle();
        float maxHealth = base.GetMaxHealth();         float maxHealth = base.GetMaxHealth();
        if (num2 <= 0f || num2 > maxHealth || float.IsNaN(num2))         if (num2 <= 0f || num2 > maxHealth || float.IsNaN(num2))
        {         {
            num2 = maxHealth;             num2 = maxHealth;
        }         }
        base.SetHealth(num2);         base.SetHealth(num2);
        if (num >= 10)         if (num >= 10)
        {         {
            float num3 = pkg.ReadSingle();             float num3 = pkg.ReadSingle();
            this.SetMaxStamina(num3, false);             this.SetMaxStamina(num3, false);
            this.m_stamina = num3;             this.m_stamina = num3;
        }         }
        if (num >= 8)         if (num >= 8)
        {         {
            this.m_firstSpawn = pkg.ReadBool();             this.m_firstSpawn = pkg.ReadBool();
        }         }
        if (num >= 20)         if (num >= 20)
        {         {
            this.m_timeSinceDeath = pkg.ReadSingle();             this.m_timeSinceDeath = pkg.ReadSingle();
        }         }
        if (num >= 23)         if (num >= 23)
        {         {
            string text = pkg.ReadString();             string text = pkg.ReadString();
            this.SetGuardianPower(text);             this.SetGuardianPower(text);
        }         }
        if (num >= 24)         if (num >= 24)
        {         {
            this.m_guardianPowerCooldown = pkg.ReadSingle();             this.m_guardianPowerCooldown = pkg.ReadSingle();
        }         }
        if (num == 2)         if (num == 2)
        {         {
            pkg.ReadZDOID();             pkg.ReadZDOID();
        }         }
        this.m_inventory.Load(pkg);         this.m_inventory.Load(pkg);
        int num4 = pkg.ReadInt();         int num4 = pkg.ReadInt();
        for (int i = 0; i < num4; i++)         for (int i = 0; i < num4; i++)
        {         {
            string text2 = pkg.ReadString();             string text2 = pkg.ReadString();
            this.m_knownRecipes.Add(text2);             this.m_knownRecipes.Add(text2);
        }         }
        if (num < 15)         if (num < 15)
        {         {
            int num5 = pkg.ReadInt();             int num5 = pkg.ReadInt();
            for (int j = 0; j < num5; j++)             for (int j = 0; j < num5; j++)
            {             {
                pkg.ReadString();                 pkg.ReadString();
            }             }
        }         }
        else         else
        {         {
            int num6 = pkg.ReadInt();             int num6 = pkg.ReadInt();
            for (int k = 0; k < num6; k++)             for (int k = 0; k < num6; k++)
            {             {
                string text3 = pkg.ReadString();                 string text3 = pkg.ReadString();
                int num7 = pkg.ReadInt();                 int num7 = pkg.ReadInt();
                this.m_knownStations.Add(text3, num7);                 this.m_knownStations.Add(text3, num7);
            }             }
        }         }
        int num8 = pkg.ReadInt();         int num8 = pkg.ReadInt();
        for (int l = 0; l < num8; l++)         for (int l = 0; l < num8; l++)
        {         {
            string text4 = pkg.ReadString();             string text4 = pkg.ReadString();
            this.m_knownMaterial.Add(text4);             this.m_knownMaterial.Add(text4);
        }         }
        if (num < 19 || num >= 21)         if (num < 19 || num >= 21)
        {         {
            int num9 = pkg.ReadInt();             int num9 = pkg.ReadInt();
            for (int m = 0; m < num9; m++)             for (int m = 0; m < num9; m++)
            {             {
                string text5 = pkg.ReadString();                 string text5 = pkg.ReadString();
                this.m_shownTutorials.Add(text5);                 this.m_shownTutorials.Add(text5);
            }             }
        }         }
        if (num >= 6)         if (num >= 6)
        {         {
            int num10 = pkg.ReadInt();             int num10 = pkg.ReadInt();
            for (int n = 0; n < num10; n++)             for (int n = 0; n < num10; n++)
            {             {
                string text6 = pkg.ReadString();                 string text6 = pkg.ReadString();
                this.m_uniques.Add(text6);                 this.m_uniques.Add(text6);
            }             }
        }         }
        if (num >= 9)         if (num >= 9)
        {         {
            int num11 = pkg.ReadInt();             int num11 = pkg.ReadInt();
            for (int num12 = 0; num12 < num11; num12++)             for (int num12 = 0; num12 < num11; num12++)
            {             {
                string text7 = pkg.ReadString();                 string text7 = pkg.ReadString();
                this.m_trophies.Add(text7);                 this.m_trophies.Add(text7);
            }             }
        }         }
        if (num >= 18)         if (num >= 18)
        {         {
            int num13 = pkg.ReadInt();             int num13 = pkg.ReadInt();
            for (int num14 = 0; num14 < num13; num14++)             for (int num14 = 0; num14 < num13; num14++)
            {             {
                Heightmap.Biome biome = (Heightmap.Biome)pkg.ReadInt();                 Heightmap.Biome biome = (Heightmap.Biome)pkg.ReadInt();
                this.m_knownBiome.Add(biome);                 this.m_knownBiome.Add(biome);
            }             }
        }         }
        if (num >= 22)         if (num >= 22)
        {         {
            int num15 = pkg.ReadInt();             int num15 = pkg.ReadInt();
            for (int num16 = 0; num16 < num15; num16++)             for (int num16 = 0; num16 < num15; num16++)
            {             {
                string text8 = pkg.ReadString();                 string text8 = pkg.ReadString();
                string text9 = pkg.ReadString();                 string text9 = pkg.ReadString();
                this.m_knownTexts[text8] = text9;                 this.m_knownTexts[text8] = text9;
            }             }
        }         }
        if (num >= 4)         if (num >= 4)
        {         {
            string text10 = pkg.ReadString();             string text10 = pkg.ReadString();
            string text11 = pkg.ReadString();             string text11 = pkg.ReadString();
            base.SetBeard(text10);             base.SetBeard(text10);
            base.SetHair(text11);             base.SetHair(text11);
        }         }
        if (num >= 5)         if (num >= 5)
        {         {
            Vector3 vector = pkg.ReadVector3();             Vector3 vector = pkg.ReadVector3();
            Vector3 vector2 = pkg.ReadVector3();             Vector3 vector2 = pkg.ReadVector3();
            this.SetSkinColor(vector);             this.SetSkinColor(vector);
            this.SetHairColor(vector2);             this.SetHairColor(vector2);
        }         }
        if (num >= 11)         if (num >= 11)
        {         {
            int num17 = pkg.ReadInt();             int num17 = pkg.ReadInt();
            this.SetPlayerModel(num17);             this.SetPlayerModel(num17);
        }         }
        if (num >= 12)         if (num >= 12)
        {         {
            this.m_foods.Clear();             this.m_foods.Clear();
            int num18 = pkg.ReadInt();             int num18 = pkg.ReadInt();
            for (int num19 = 0; num19 < num18; num19++)             for (int num19 = 0; num19 < num18; num19++)
            {             {
                if (num >= 14)                 if (num >= 14)
                {                 {
                    Player.Food food = new Player.Food();                     Player.Food food = new Player.Food();
                    food.m_name = pkg.ReadString();                     food.m_name = pkg.ReadString();
                    if (num >= 25)                     if (num >= 25)
                    {                     {
                        food.m_time = pkg.ReadSingle();                         food.m_time = pkg.ReadSingle();
                    }                     }
                    else                     else
                    {                     {
                        food.m_health = pkg.ReadSingle();                         food.m_health = pkg.ReadSingle();
                        if (num >= 16)                         if (num >= 16)
                        {                         {
                            food.m_stamina = pkg.ReadSingle();                             food.m_stamina = pkg.ReadSingle();
                        }                         }
                    }                     }
                    GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(food.m_name);                     GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(food.m_name);
                    if (itemPrefab == null)                     if (itemPrefab == null)
                    {                     {
                        ZLog.LogWarning("Failed to find food item " + food.m_name);                         ZLog.LogWarning("Failed to find food item " + food.m_name);
                    }                     }
                    else                     else
                    {                     {
                        food.m_item = itemPrefab.GetComponent<ItemDrop>().m_itemData;                         food.m_item = itemPrefab.GetComponent<ItemDrop>().m_itemData;
                        this.m_foods.Add(food);                         this.m_foods.Add(food);
                    }                     }
                }                 }
                else                 else
                {                 {
                    pkg.ReadString();                     pkg.ReadString();
                    pkg.ReadSingle();                     pkg.ReadSingle();
                    pkg.ReadSingle();                     pkg.ReadSingle();
                    pkg.ReadSingle();                     pkg.ReadSingle();
                    pkg.ReadSingle();                     pkg.ReadSingle();
                    pkg.ReadSingle();                     pkg.ReadSingle();
                    pkg.ReadSingle();                     pkg.ReadSingle();
                    if (num >= 13)                     if (num >= 13)
                    {                     {
                        pkg.ReadSingle();                         pkg.ReadSingle();
                    }                     }
                }                 }
            }             }
        }         }
        if (num >= 17)         if (num >= 17)
        {         {
            this.m_skills.Load(pkg);             this.m_skills.Load(pkg);
        }         }
        if (num >= 26)         if (num >= 26)
        {         {
            int num20 = pkg.ReadInt();             int num20 = pkg.ReadInt();
            for (int num21 = 0; num21 < num20; num21++)             for (int num21 = 0; num21 < num20; num21++)
            {             {
                string text12 = pkg.ReadString();                 string text12 = pkg.ReadString();
                string text13 = pkg.ReadString();                 string text13 = pkg.ReadString();
                this.m_customData[text12] = text13;                 this.m_customData[text12] = text13;
            }             }
            this.m_stamina = Mathf.Clamp(pkg.ReadSingle(), 0f, this.m_maxStamina);             this.m_stamina = Mathf.Clamp(pkg.ReadSingle(), 0f, this.m_maxStamina);
            this.SetMaxEitr(pkg.ReadSingle(), false);             this.SetMaxEitr(pkg.ReadSingle(), false);
            this.m_eitr = Mathf.Clamp(pkg.ReadSingle(), 0f, this.m_maxEitr);             this.m_eitr = Mathf.Clamp(pkg.ReadSingle(), 0f, this.m_maxEitr);
        }         }
.          if (num < 27)
          {
              if (this.m_knownMaterial.Contains("$item_flametal"))
              {
                  ZLog.DevLog("Pre ashlands character loaded, replacing flametal with ancient as known material.");
                  this.m_knownMaterial.Remove("$item_flametal");
                  this.m_knownMaterial.Add("$item_flametal_old");
              }
              if (this.m_knownMaterial.Contains("$item_flametalore"))
              {
                  ZLog.DevLog("Pre ashlands character loaded, replacing flametal ore with ancient as known material.");
                  this.m_knownMaterial.Remove("$item_flametalore");
                  this.m_knownMaterial.Add("$item_flametalore_old");
              }
          }
        this.m_isLoading = false;         this.m_isLoading = false;
        this.UpdateAvailablePiecesList();         this.UpdateAvailablePiecesList();
        this.EquipInventoryItems();         this.EquipInventoryItems();
        this.UpdateEvents();         this.UpdateEvents();
    }     }
   
    private void EquipInventoryItems()     private void EquipInventoryItems()
    {     {
        foreach (ItemDrop.ItemData itemData in this.m_inventory.GetEquippedItems())         foreach (ItemDrop.ItemData itemData in this.m_inventory.GetEquippedItems())
        {         {
            if (!base.EquipItem(itemData, false))             if (!base.EquipItem(itemData, false))
            {             {
                itemData.m_equipped = false;                 itemData.m_equipped = false;
            }             }
        }         }
    }     }
   
    public override bool CanMove()     public override bool CanMove()
    {     {
        return !this.m_teleporting && !this.InCutscene() && (!this.IsEncumbered() || this.HaveStamina(0f)) && base.CanMove();         return !this.m_teleporting && !this.InCutscene() && (!this.IsEncumbered() || this.HaveStamina(0f)) && base.CanMove();
    }     }
   
    public override bool IsEncumbered()     public override bool IsEncumbered()
    {     {
        return this.m_inventory.GetTotalWeight() > this.GetMaxCarryWeight();         return this.m_inventory.GetTotalWeight() > this.GetMaxCarryWeight();
    }     }
   
    public float GetMaxCarryWeight()     public float GetMaxCarryWeight()
    {     {
        float maxCarryWeight = this.m_maxCarryWeight;         float maxCarryWeight = this.m_maxCarryWeight;
        this.m_seman.ModifyMaxCarryWeight(maxCarryWeight, ref maxCarryWeight);         this.m_seman.ModifyMaxCarryWeight(maxCarryWeight, ref maxCarryWeight);
        return maxCarryWeight;         return maxCarryWeight;
    }     }
   
    public override bool HaveUniqueKey(string name)     public override bool HaveUniqueKey(string name)
    {     {
        return this.m_uniques.Contains(name);         return this.m_uniques.Contains(name);
    }     }
   
    public override void AddUniqueKey(string name)     public override void AddUniqueKey(string name)
    {     {
        if (!this.m_uniques.Contains(name))         if (!this.m_uniques.Contains(name))
        {         {
            this.m_uniques.Add(name);             this.m_uniques.Add(name);
        }         }
        ZoneSystem instance = ZoneSystem.instance;         ZoneSystem instance = ZoneSystem.instance;
        if (instance != null)         if (instance != null)
        {         {
            instance.UpdateWorldRates();             instance.UpdateWorldRates();
        }         }
        this.UpdateEvents();         this.UpdateEvents();
    }     }
   
    public override bool RemoveUniqueKey(string name)     public override bool RemoveUniqueKey(string name)
    {     {
        if (this.m_uniques.Contains(name))         if (this.m_uniques.Contains(name))
        {         {
            this.m_uniques.Remove(name);             this.m_uniques.Remove(name);
            ZoneSystem.instance.UpdateWorldRates();             ZoneSystem.instance.UpdateWorldRates();
            this.UpdateEvents();             this.UpdateEvents();
            return true;             return true;
        }         }
        return false;         return false;
    }     }
   
    public List<string> GetUniqueKeys()     public List<string> GetUniqueKeys()
    {     {
        this.m_tempUniqueKeys.Clear();         this.m_tempUniqueKeys.Clear();
        this.m_tempUniqueKeys.AddRange(this.m_uniques);         this.m_tempUniqueKeys.AddRange(this.m_uniques);
        return this.m_tempUniqueKeys;         return this.m_tempUniqueKeys;
    }     }
   
    public void ResetUniqueKeys()     public void ResetUniqueKeys()
    {     {
        this.m_uniques.Clear();         this.m_uniques.Clear();
    }     }
   
    public bool IsBiomeKnown(Heightmap.Biome biome)     public bool IsBiomeKnown(Heightmap.Biome biome)
    {     {
        return this.m_knownBiome.Contains(biome);         return this.m_knownBiome.Contains(biome);
    }     }
   
    private void AddKnownBiome(Heightmap.Biome biome)     private void AddKnownBiome(Heightmap.Biome biome)
    {     {
        if (!this.m_knownBiome.Contains(biome))         if (!this.m_knownBiome.Contains(biome))
        {         {
            this.m_knownBiome.Add(biome);             this.m_knownBiome.Add(biome);
            if (biome != Heightmap.Biome.Meadows && biome != Heightmap.Biome.None)             if (biome != Heightmap.Biome.Meadows && biome != Heightmap.Biome.None)
            {             {
                string text = "$biome_" + biome.ToString().ToLower();                 string text = "$biome_" + biome.ToString().ToLower();
                MessageHud.instance.ShowBiomeFoundMsg(text, true);                 MessageHud.instance.ShowBiomeFoundMsg(text, true);
            }             }
            if (biome == Heightmap.Biome.BlackForest && !ZoneSystem.instance.GetGlobalKey("defeated_eikthyr"))             if (biome == Heightmap.Biome.BlackForest && !ZoneSystem.instance.GetGlobalKey("defeated_eikthyr"))
            {             {
                this.ShowTutorial("blackforest", false);                 this.ShowTutorial("blackforest", false);
            }             }
            Gogan.LogEvent("Game", "BiomeFound", biome.ToString(), 0L);             Gogan.LogEvent("Game", "BiomeFound", biome.ToString(), 0L);
        }         }
        if (biome == Heightmap.Biome.BlackForest)         if (biome == Heightmap.Biome.BlackForest)
        {         {
            this.ShowTutorial("haldor", false);             this.ShowTutorial("haldor", false);
        }         }
.          if (biome == Heightmap.Biome.AshLands)
          {
              this.ShowTutorial("ashlands", false);
          }
    }     }
   
    public void AddKnownLocationName(string label)     public void AddKnownLocationName(string label)
    {     {
        if (!this.m_shownTutorials.Contains(label))         if (!this.m_shownTutorials.Contains(label))
        {         {
            this.m_shownTutorials.Add(label);             this.m_shownTutorials.Add(label);
            MessageHud.instance.ShowBiomeFoundMsg(label, true);             MessageHud.instance.ShowBiomeFoundMsg(label, true);
        }         }
    }     }
   
    public bool IsRecipeKnown(string name)     public bool IsRecipeKnown(string name)
    {     {
        return this.m_knownRecipes.Contains(name);         return this.m_knownRecipes.Contains(name);
    }     }
   
    private void AddKnownRecipe(Recipe recipe)     private void AddKnownRecipe(Recipe recipe)
    {     {
        if (!this.m_knownRecipes.Contains(recipe.m_item.m_itemData.m_shared.m_name))         if (!this.m_knownRecipes.Contains(recipe.m_item.m_itemData.m_shared.m_name))
        {         {
            this.m_knownRecipes.Add(recipe.m_item.m_itemData.m_shared.m_name);             this.m_knownRecipes.Add(recipe.m_item.m_itemData.m_shared.m_name);
            MessageHud.instance.QueueUnlockMsg(recipe.m_item.m_itemData.GetIcon(), "$msg_newrecipe", recipe.m_item.m_itemData.m_shared.m_name);             MessageHud.instance.QueueUnlockMsg(recipe.m_item.m_itemData.GetIcon(), "$msg_newrecipe", recipe.m_item.m_itemData.m_shared.m_name);
            Gogan.LogEvent("Game", "RecipeFound", recipe.m_item.m_itemData.m_shared.m_name, 0L);             Gogan.LogEvent("Game", "RecipeFound", recipe.m_item.m_itemData.m_shared.m_name, 0L);
        }         }
    }     }
   
    private void AddKnownPiece(Piece piece)     private void AddKnownPiece(Piece piece)
    {     {
        if (this.m_knownRecipes.Contains(piece.m_name))         if (this.m_knownRecipes.Contains(piece.m_name))
        {         {
            return;             return;
        }         }
        this.m_knownRecipes.Add(piece.m_name);         this.m_knownRecipes.Add(piece.m_name);
        MessageHud.instance.QueueUnlockMsg(piece.m_icon, "$msg_newpiece", piece.m_name);         MessageHud.instance.QueueUnlockMsg(piece.m_icon, "$msg_newpiece", piece.m_name);
        Gogan.LogEvent("Game", "PieceFound", piece.m_name, 0L);         Gogan.LogEvent("Game", "PieceFound", piece.m_name, 0L);
    }     }
   
    public void AddKnownStation(CraftingStation station)     public void AddKnownStation(CraftingStation station)
    {     {
        int level = station.GetLevel(true);         int level = station.GetLevel(true);
        int num;         int num;
        if (this.m_knownStations.TryGetValue(station.m_name, out num))         if (this.m_knownStations.TryGetValue(station.m_name, out num))
        {         {
            if (num < level)             if (num < level)
            {             {
                this.m_knownStations[station.m_name] = level;                 this.m_knownStations[station.m_name] = level;
                MessageHud.instance.QueueUnlockMsg(station.m_icon, "$msg_newstation_level", station.m_name + " $msg_level " + level.ToString());                 MessageHud.instance.QueueUnlockMsg(station.m_icon, "$msg_newstation_level", station.m_name + " $msg_level " + level.ToString());
                this.UpdateKnownRecipesList();                 this.UpdateKnownRecipesList();
            }             }
            return;             return;
        }         }
        this.m_knownStations.Add(station.m_name, level);         this.m_knownStations.Add(station.m_name, level);
        MessageHud.instance.QueueUnlockMsg(station.m_icon, "$msg_newstation", station.m_name);         MessageHud.instance.QueueUnlockMsg(station.m_icon, "$msg_newstation", station.m_name);
        Gogan.LogEvent("Game", "StationFound", station.m_name, 0L);         Gogan.LogEvent("Game", "StationFound", station.m_name, 0L);
        this.UpdateKnownRecipesList();         this.UpdateKnownRecipesList();
    }     }
   
    private bool KnowStationLevel(string name, int level)     private bool KnowStationLevel(string name, int level)
    {     {
        int num;         int num;
        return this.m_knownStations.TryGetValue(name, out num) && num >= level;         return this.m_knownStations.TryGetValue(name, out num) && num >= level;
    }     }
   
    public void AddKnownText(string label, string text)     public void AddKnownText(string label, string text)
    {     {
        if (label.Length == 0)         if (label.Length == 0)
        {         {
            ZLog.LogWarning("Text " + text + " Is missing label");             ZLog.LogWarning("Text " + text + " Is missing label");
            return;             return;
        }         }
        if (!this.m_knownTexts.ContainsKey(label.Replace("\u0016", "")))         if (!this.m_knownTexts.ContainsKey(label.Replace("\u0016", "")))
        {         {
            this.m_knownTexts.Add(label, text);             this.m_knownTexts.Add(label, text);
            this.Message(MessageHud.MessageType.TopLeft, Localization.instance.Localize("$msg_newtext", new string[] { label }), 0, this.m_textIcon);             this.Message(MessageHud.MessageType.TopLeft, Localization.instance.Localize("$msg_newtext", new string[] { label }), 0, this.m_textIcon);
        }         }
    }     }
   
    public List<KeyValuePair<string, string>> GetKnownTexts()     public List<KeyValuePair<string, string>> GetKnownTexts()
    {     {
        return this.m_knownTexts.ToList<KeyValuePair<string, string>>();         return this.m_knownTexts.ToList<KeyValuePair<string, string>>();
    }     }
   
    public void AddKnownItem(ItemDrop.ItemData item)     public void AddKnownItem(ItemDrop.ItemData item)
    {     {
        if (item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Trophy)         if (item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Trophy)
        {         {
            this.AddTrophy(item);             this.AddTrophy(item);
        }         }
        if (!this.m_knownMaterial.Contains(item.m_shared.m_name))         if (!this.m_knownMaterial.Contains(item.m_shared.m_name))
        {         {
            this.m_knownMaterial.Add(item.m_shared.m_name);             this.m_knownMaterial.Add(item.m_shared.m_name);
            if (item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Material)             if (item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Material)
            {             {
                MessageHud.instance.QueueUnlockMsg(item.GetIcon(), "$msg_newmaterial", item.m_shared.m_name);                 MessageHud.instance.QueueUnlockMsg(item.GetIcon(), "$msg_newmaterial", item.m_shared.m_name);
            }             }
            else if (item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Trophy)             else if (item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Trophy)
            {             {
                MessageHud.instance.QueueUnlockMsg(item.GetIcon(), "$msg_newtrophy", item.m_shared.m_name);                 MessageHud.instance.QueueUnlockMsg(item.GetIcon(), "$msg_newtrophy", item.m_shared.m_name);
            }             }
            else             else
            {             {
                MessageHud.instance.QueueUnlockMsg(item.GetIcon(), "$msg_newitem", item.m_shared.m_name);                 MessageHud.instance.QueueUnlockMsg(item.GetIcon(), "$msg_newitem", item.m_shared.m_name);
            }             }
            Gogan.LogEvent("Game", "ItemFound", item.m_shared.m_name, 0L);             Gogan.LogEvent("Game", "ItemFound", item.m_shared.m_name, 0L);
            this.UpdateKnownRecipesList();             this.UpdateKnownRecipesList();
            this.UpdateEvents();             this.UpdateEvents();
        }         }
    }     }
   
    private void AddTrophy(ItemDrop.ItemData item)     private void AddTrophy(ItemDrop.ItemData item)
    {     {
        if (item.m_shared.m_itemType != ItemDrop.ItemData.ItemType.Trophy)         if (item.m_shared.m_itemType != ItemDrop.ItemData.ItemType.Trophy)
        {         {
            return;             return;
        }         }
        if (!this.m_trophies.Contains(item.m_dropPrefab.name))         if (!this.m_trophies.Contains(item.m_dropPrefab.name))
        {         {
            this.m_trophies.Add(item.m_dropPrefab.name);             this.m_trophies.Add(item.m_dropPrefab.name);
        }         }
    }     }
   
    public List<string> GetTrophies()     public List<string> GetTrophies()
    {     {
        List<string> list = new List<string>();         List<string> list = new List<string>();
        list.AddRange(this.m_trophies);         list.AddRange(this.m_trophies);
        return list;         return list;
    }     }
   
    private void UpdateKnownRecipesList()     private void UpdateKnownRecipesList()
    {     {
        if (Game.instance == null)         if (Game.instance == null)
        {         {
            return;             return;
        }         }
        foreach (Recipe recipe in ObjectDB.instance.m_recipes)         foreach (Recipe recipe in ObjectDB.instance.m_recipes)
        {         {
            bool flag = this.m_currentSeason != null && this.m_currentSeason.Recipes.Contains(recipe);             bool flag = this.m_currentSeason != null && this.m_currentSeason.Recipes.Contains(recipe);
            if ((recipe.m_enabled || flag) && recipe.m_item && !this.m_knownRecipes.Contains(recipe.m_item.m_itemData.m_shared.m_name) && this.HaveRequirements(recipe, true, 0))             if ((recipe.m_enabled || flag) && recipe.m_item && !this.m_knownRecipes.Contains(recipe.m_item.m_itemData.m_shared.m_name) && this.HaveRequirements(recipe, true, 0))
            {             {
                this.AddKnownRecipe(recipe);                 this.AddKnownRecipe(recipe);
            }             }
        }         }
        this.m_tempOwnedPieceTables.Clear();         this.m_tempOwnedPieceTables.Clear();
        this.m_inventory.GetAllPieceTables(this.m_tempOwnedPieceTables);         this.m_inventory.GetAllPieceTables(this.m_tempOwnedPieceTables);
        bool flag2 = false;         bool flag2 = false;
        foreach (PieceTable pieceTable in this.m_tempOwnedPieceTables)         foreach (PieceTable pieceTable in this.m_tempOwnedPieceTables)
        {         {
            foreach (GameObject gameObject in pieceTable.m_pieces)             foreach (GameObject gameObject in pieceTable.m_pieces)
            {             {
                Piece component = gameObject.GetComponent<Piece>();                 Piece component = gameObject.GetComponent<Piece>();
                bool flag3 = this.m_currentSeason != null && this.m_currentSeason.Pieces.Contains(gameObject);                 bool flag3 = this.m_currentSeason != null && this.m_currentSeason.Pieces.Contains(gameObject);
                if ((component.m_enabled || flag3) && !this.m_knownRecipes.Contains(component.m_name) && this.HaveRequirements(component, Player.RequirementMode.IsKnown))                 if ((component.m_enabled || flag3) && !this.m_knownRecipes.Contains(component.m_name) && this.HaveRequirements(component, Player.RequirementMode.IsKnown))
                {                 {
                    this.AddKnownPiece(component);                     this.AddKnownPiece(component);
                    flag2 = true;                     flag2 = true;
                }                 }
            }             }
        }         }
        if (flag2)         if (flag2)
        {         {
            this.UpdateAvailablePiecesList();             this.UpdateAvailablePiecesList();
        }         }
    }     }
   
    private void UpdateAvailablePiecesList()     private void UpdateAvailablePiecesList()
    {     {
        if (this.m_buildPieces != null)         if (this.m_buildPieces != null)
        {         {
            this.m_buildPieces.UpdateAvailable(this.m_knownRecipes, this, false, this.m_noPlacementCost || ZoneSystem.instance.GetGlobalKey(GlobalKeys.AllPiecesUnlocked));             this.m_buildPieces.UpdateAvailable(this.m_knownRecipes, this, false, this.m_noPlacementCost || ZoneSystem.instance.GetGlobalKey(GlobalKeys.AllPiecesUnlocked));
        }         }
        this.SetupPlacementGhost();         this.SetupPlacementGhost();
    }     }
   
    private void UpdateCurrentSeason()     private void UpdateCurrentSeason()
    {     {
        this.m_currentSeason = null;         this.m_currentSeason = null;
        foreach (SeasonalItemGroup seasonalItemGroup in this.m_seasonalItemGroups)         foreach (SeasonalItemGroup seasonalItemGroup in this.m_seasonalItemGroups)
        {         {
            if (seasonalItemGroup.IsInSeason())             if (seasonalItemGroup.IsInSeason())
            {             {
                this.m_currentSeason = seasonalItemGroup;                 this.m_currentSeason = seasonalItemGroup;
                break;                 break;
            }             }
        }         }
    }     }
   
    public override void Message(MessageHud.MessageType type, string msg, int amount = 0, Sprite icon = null)     public override void Message(MessageHud.MessageType type, string msg, int amount = 0, Sprite icon = null)
    {     {
        if (this.m_nview == null || !this.m_nview.IsValid())         if (this.m_nview == null || !this.m_nview.IsValid())
        {         {
            return;             return;
        }         }
        if (this.m_nview.IsOwner())         if (this.m_nview.IsOwner())
        {         {
            if (MessageHud.instance)             if (MessageHud.instance)
            {             {
                MessageHud.instance.ShowMessage(type, msg, amount, icon);                 MessageHud.instance.ShowMessage(type, msg, amount, icon);
                return;                 return;
            }             }
        }         }
        else         else
        {         {
            this.m_nview.InvokeRPC("Message", new object[]             this.m_nview.InvokeRPC("Message", new object[]
            {             {
                (int)type,                 (int)type,
                msg,                 msg,
                amount                 amount
            });             });
        }         }
    }     }
   
    private void RPC_Message(long sender, int type, string msg, int amount)     private void RPC_Message(long sender, int type, string msg, int amount)
    {     {
        if (!this.m_nview.IsOwner())         if (!this.m_nview.IsOwner())
        {         {
            return;             return;
        }         }
        if (MessageHud.instance)         if (MessageHud.instance)
        {         {
            MessageHud.instance.ShowMessage((MessageHud.MessageType)type, msg, amount, null);             MessageHud.instance.ShowMessage((MessageHud.MessageType)type, msg, amount, null);
        }         }
    }     }
   
    public static Player GetPlayer(long playerID)     public static Player GetPlayer(long playerID)
    {     {
        foreach (Player player in Player.s_players)         foreach (Player player in Player.s_players)
        {         {
            if (player.GetPlayerID() == playerID)             if (player.GetPlayerID() == playerID)
            {             {
                return player;                 return player;
            }             }
        }         }
        return null;         return null;
    }     }
   
    public static Player GetClosestPlayer(Vector3 point, float maxRange)     public static Player GetClosestPlayer(Vector3 point, float maxRange)
    {     {
        Player player = null;         Player player = null;
        float num = 999999f;         float num = 999999f;
        foreach (Player player2 in Player.s_players)         foreach (Player player2 in Player.s_players)
        {         {
            float num2 = Vector3.Distance(player2.transform.position, point);             float num2 = Vector3.Distance(player2.transform.position, point);
            if (num2 < num && num2 < maxRange)             if (num2 < num && num2 < maxRange)
            {             {
                num = num2;                 num = num2;
                player = player2;                 player = player2;
            }             }
        }         }
        return player;         return player;
    }     }
   
    public static bool IsPlayerInRange(Vector3 point, float range, long playerID)     public static bool IsPlayerInRange(Vector3 point, float range, long playerID)
    {     {
        foreach (Player player in Player.s_players)         foreach (Player player in Player.s_players)
        {         {
            if (player.GetPlayerID() == playerID)             if (player.GetPlayerID() == playerID)
            {             {
                return Utils.DistanceXZ(player.transform.position, point) < range;                 return Utils.DistanceXZ(player.transform.position, point) < range;
            }             }
        }         }
        return false;         return false;
    }     }
   
    public static void MessageAllInRange(Vector3 point, float range, MessageHud.MessageType type, string msg, Sprite icon = null)     public static void MessageAllInRange(Vector3 point, float range, MessageHud.MessageType type, string msg, Sprite icon = null)
    {     {
        foreach (Player player in Player.s_players)         foreach (Player player in Player.s_players)
        {         {
            if (Vector3.Distance(player.transform.position, point) < range)             if (Vector3.Distance(player.transform.position, point) < range)
            {             {
                player.Message(type, msg, 0, icon);                 player.Message(type, msg, 0, icon);
            }             }
        }         }
    }     }
   
    public static int GetPlayersInRangeXZ(Vector3 point, float range)     public static int GetPlayersInRangeXZ(Vector3 point, float range)
    {     {
        int num = 0;         int num = 0;
        using (List<Player>.Enumerator enumerator = Player.s_players.GetEnumerator())         using (List<Player>.Enumerator enumerator = Player.s_players.GetEnumerator())
        {         {
            while (enumerator.MoveNext())             while (enumerator.MoveNext())
            {             {
                if (Utils.DistanceXZ(enumerator.Current.transform.position, point) < range)                 if (Utils.DistanceXZ(enumerator.Current.transform.position, point) < range)
                {                 {
                    num++;                     num++;
                }                 }
            }             }
        }         }
        return num;         return num;
    }     }
   
    private static void GetPlayersInRange(Vector3 point, float range, List<Player> players)     private static void GetPlayersInRange(Vector3 point, float range, List<Player> players)
    {     {
        foreach (Player player in Player.s_players)         foreach (Player player in Player.s_players)
        {         {
            if (Vector3.Distance(player.transform.position, point) < range)             if (Vector3.Distance(player.transform.position, point) < range)
            {             {
                players.Add(player);                 players.Add(player);
            }             }
        }         }
    }     }
   
    public static bool IsPlayerInRange(Vector3 point, float range)     public static bool IsPlayerInRange(Vector3 point, float range)
    {     {
        using (List<Player>.Enumerator enumerator = Player.s_players.GetEnumerator())         using (List<Player>.Enumerator enumerator = Player.s_players.GetEnumerator())
        {         {
            while (enumerator.MoveNext())             while (enumerator.MoveNext())
            {             {
                if (Vector3.Distance(enumerator.Current.transform.position, point) < range)                 if (Vector3.Distance(enumerator.Current.transform.position, point) < range)
                {                 {
                    return true;                     return true;
                }                 }
            }             }
        }         }
        return false;         return false;
    }     }
   
    public static bool IsPlayerInRange(Vector3 point, float range, float minNoise)     public static bool IsPlayerInRange(Vector3 point, float range, float minNoise)
    {     {
        foreach (Player player in Player.s_players)         foreach (Player player in Player.s_players)
        {         {
            if (Vector3.Distance(player.transform.position, point) < range)             if (Vector3.Distance(player.transform.position, point) < range)
            {             {
                float noiseRange = player.GetNoiseRange();                 float noiseRange = player.GetNoiseRange();
                if (range <= noiseRange && noiseRange >= minNoise)                 if (range <= noiseRange && noiseRange >= minNoise)
                {                 {
                    return true;                     return true;
                }                 }
            }             }
        }         }
        return false;         return false;
    }     }
   
    public static Player GetPlayerNoiseRange(Vector3 point, float maxNoiseRange = 100f)     public static Player GetPlayerNoiseRange(Vector3 point, float maxNoiseRange = 100f)
    {     {
        foreach (Player player in Player.s_players)         foreach (Player player in Player.s_players)
        {         {
            float num = Vector3.Distance(player.transform.position, point);             float num = Vector3.Distance(player.transform.position, point);
            float num2 = Mathf.Min(player.GetNoiseRange(), maxNoiseRange);             float num2 = Mathf.Min(player.GetNoiseRange(), maxNoiseRange);
            if (num < num2)             if (num < num2)
            {             {
                return player;                 return player;
            }             }
        }         }
        return null;         return null;
    }     }
   
    public static List<Player> GetAllPlayers()     public static List<Player> GetAllPlayers()
    {     {
        return Player.s_players;         return Player.s_players;
    }     }
   
    public static Player GetRandomPlayer()     public static Player GetRandomPlayer()
    {     {
        if (Player.s_players.Count == 0)         if (Player.s_players.Count == 0)
        {         {
            return null;             return null;
        }         }
        return Player.s_players[UnityEngine.Random.Range(0, Player.s_players.Count)];         return Player.s_players[UnityEngine.Random.Range(0, Player.s_players.Count)];
    }     }
   
    public void GetAvailableRecipes(ref List<Recipe> available)     public void GetAvailableRecipes(ref List<Recipe> available)
    {     {
        available.Clear();         available.Clear();
        foreach (Recipe recipe in ObjectDB.instance.m_recipes)         foreach (Recipe recipe in ObjectDB.instance.m_recipes)
        {         {
            bool flag = this.m_currentSeason != null && this.m_currentSeason.Recipes.Contains(recipe);             bool flag = this.m_currentSeason != null && this.m_currentSeason.Recipes.Contains(recipe);
.            if ((recipe.m_enabled || flag) && recipe.m_item && (recipe.m_item.m_itemData.m_shared.m_dlc.Length <= 0 || DLCMan.instance.IsDLCInstalled(recipe.m_item.m_itemData.m_shared.m_dlc)) && (this.m_knownRecipes.Contains(recipe.m_item.m_itemData.m_shared.m_name) || this.m_noPlacementCost || ZoneSystem.instance.GetGlobalKey(GlobalKeys.AllRecipesUnlocked)) && (this.RequiredCraftingStation(recipe, 1, false) || this.m_noPlacementCost))              if ((recipe.m_enabled || flag) && recipe.m_item) 
            {             {
.                available.Add(recipe);                 if (Player.s_FilterCraft.Count > 0) 
                  { 
                      bool flag2 = false; 
                      int num = 0; 
                      while (num < Player.s_FilterCraft.Count && (Player.s_FilterCraft[num].Length <= 0 || (!recipe.m_item.name.ToLower().Contains(Player.s_FilterCraft[num].ToLower()) && !recipe.m_item.m_itemData.m_shared.m_name.ToLower().Contains(Player.s_FilterCraft[num].ToLower()) && !Localization.instance.Localize(recipe.m_item.m_itemData.m_shared.m_name).ToLower().Contains(Player.s_FilterCraft[num].ToLower())))) 
                      { 
                          if (num + 1 == Player.s_FilterCraft.Count) 
                          { 
                              flag2 = true; 
                          } 
                          num++; 
                      } 
                      if (flag2) 
                      { 
                          continue; 
                      } 
                  } 
                  if ((recipe.m_item.m_itemData.m_shared.m_dlc.Length <= 0 || DLCMan.instance.IsDLCInstalled(recipe.m_item.m_itemData.m_shared.m_dlc)) && (this.m_knownRecipes.Contains(recipe.m_item.m_itemData.m_shared.m_name) || this.m_noPlacementCost || ZoneSystem.instance.GetGlobalKey(GlobalKeys.AllRecipesUnlocked)) && (this.RequiredCraftingStation(recipe, 1, false) || this.m_noPlacementCost)) 
                  { 
                      available.Add(recipe);
                  } 
            }             }
        }         }
    }     }
   
    private void OnInventoryChanged()     private void OnInventoryChanged()
    {     {
        if (this.m_isLoading)         if (this.m_isLoading)
        {         {
            return;             return;
        }         }
        foreach (ItemDrop.ItemData itemData in this.m_inventory.GetAllItems())         foreach (ItemDrop.ItemData itemData in this.m_inventory.GetAllItems())
        {         {
            this.AddKnownItem(itemData);             this.AddKnownItem(itemData);
            if (!itemData.m_pickedUp)             if (!itemData.m_pickedUp)
            {             {
                itemData.m_pickedUp = true;                 itemData.m_pickedUp = true;
                PlayerProfile playerProfile = Game.instance.GetPlayerProfile();                 PlayerProfile playerProfile = Game.instance.GetPlayerProfile();
                playerProfile.IncrementStat(PlayerStatType.ItemsPickedUp, 1f);                 playerProfile.IncrementStat(PlayerStatType.ItemsPickedUp, 1f);
                playerProfile.m_itemPickupStats.IncrementOrSet(itemData.m_shared.m_name, (float)itemData.m_stack);                 playerProfile.m_itemPickupStats.IncrementOrSet(itemData.m_shared.m_name, (float)itemData.m_stack);
            }             }
            if (itemData.m_shared.m_name == "$item_hammer")             if (itemData.m_shared.m_name == "$item_hammer")
            {             {
                this.ShowTutorial("hammer", false);                 this.ShowTutorial("hammer", false);
            }             }
            else if (itemData.m_shared.m_name == "$item_hoe")             else if (itemData.m_shared.m_name == "$item_hoe")
            {             {
                this.ShowTutorial("hoe", false);                 this.ShowTutorial("hoe", false);
            }             }
.              else if (itemData.m_shared.m_name == "$item_bellfragment")
              {
                  this.ShowTutorial("bellfragment", false);
              }
            else if (itemData.m_shared.m_name == "$item_pickaxe_antler")             else if (itemData.m_shared.m_name == "$item_pickaxe_antler")
            {             {
                this.ShowTutorial("pickaxe", false);                 this.ShowTutorial("pickaxe", false);
            }             }
            else if (itemData.m_shared.m_name.CustomStartsWith("$item_shield"))             else if (itemData.m_shared.m_name.CustomStartsWith("$item_shield"))
            {             {
                this.ShowTutorial("shield", false);                 this.ShowTutorial("shield", false);
            }             }
            if (itemData.m_shared.m_name == "$item_trophy_eikthyr")             if (itemData.m_shared.m_name == "$item_trophy_eikthyr")
            {             {
                this.ShowTutorial("boss_trophy", false);                 this.ShowTutorial("boss_trophy", false);
            }             }
            if (itemData.m_shared.m_name == "$item_wishbone")             if (itemData.m_shared.m_name == "$item_wishbone")
            {             {
                this.ShowTutorial("wishbone", false);                 this.ShowTutorial("wishbone", false);
            }             }
            else if (itemData.m_shared.m_name == "$item_copperore" || itemData.m_shared.m_name == "$item_tinore")             else if (itemData.m_shared.m_name == "$item_copperore" || itemData.m_shared.m_name == "$item_tinore")
            {             {
                this.ShowTutorial("ore", false);                 this.ShowTutorial("ore", false);
            }             }
            else if (itemData.m_shared.m_food > 0f || itemData.m_shared.m_foodStamina > 0f)             else if (itemData.m_shared.m_food > 0f || itemData.m_shared.m_foodStamina > 0f)
            {             {
                this.ShowTutorial("food", false);                 this.ShowTutorial("food", false);
            }             }
        }         }
        this.UpdateKnownRecipesList();         this.UpdateKnownRecipesList();
        this.UpdateAvailablePiecesList();         this.UpdateAvailablePiecesList();
    }     }
   
    public bool InDebugFlyMode()     public bool InDebugFlyMode()
    {     {
        return this.m_debugFly;         return this.m_debugFly;
    }     }
   
    public void ShowTutorial(string name, bool force = false)     public void ShowTutorial(string name, bool force = false)
    {     {
        if (this.HaveSeenTutorial(name))         if (this.HaveSeenTutorial(name))
        {         {
            return;             return;
        }         }
        Tutorial.instance.ShowText(name, force);         Tutorial.instance.ShowText(name, force);
    }     }
   
    public void SetSeenTutorial(string name)     public void SetSeenTutorial(string name)
    {     {
        if (name.Length == 0)         if (name.Length == 0)
        {         {
            return;             return;
        }         }
        if (this.m_shownTutorials.Contains(name))         if (this.m_shownTutorials.Contains(name))
        {         {
            return;             return;
        }         }
        this.m_shownTutorials.Add(name);         this.m_shownTutorials.Add(name);
    }     }
   
    public bool HaveSeenTutorial(string name)     public bool HaveSeenTutorial(string name)
    {     {
        return name.Length != 0 && this.m_shownTutorials.Contains(name);         return name.Length != 0 && this.m_shownTutorials.Contains(name);
    }     }
   
    public static bool IsSeenTutorialsCleared()     public static bool IsSeenTutorialsCleared()
    {     {
        return !Player.m_localPlayer || Player.m_localPlayer.m_shownTutorials.Count == 0;         return !Player.m_localPlayer || Player.m_localPlayer.m_shownTutorials.Count == 0;
    }     }
   
    public static void ResetSeenTutorials()     public static void ResetSeenTutorials()
    {     {
        if (Player.m_localPlayer)         if (Player.m_localPlayer)
        {         {
            Player.m_localPlayer.m_shownTutorials.Clear();             Player.m_localPlayer.m_shownTutorials.Clear();
        }         }
    }     }
   
    public void SetMouseLook(Vector2 mouseLook)     public void SetMouseLook(Vector2 mouseLook)
    {     {
        Quaternion quaternion = this.m_lookYaw * Quaternion.Euler(0f, mouseLook.x, 0f);         Quaternion quaternion = this.m_lookYaw * Quaternion.Euler(0f, mouseLook.x, 0f);
        if (PlayerCustomizaton.IsBarberGuiVisible())         if (PlayerCustomizaton.IsBarberGuiVisible())
        {         {
            if (Vector3.Dot(base.transform.rotation * Vector3.forward, this.m_lookYaw * Vector3.forward) > 0f)             if (Vector3.Dot(base.transform.rotation * Vector3.forward, this.m_lookYaw * Vector3.forward) > 0f)
            {             {
                this.SetMouseLookBackward(true);                 this.SetMouseLookBackward(true);
            }             }
            if (Vector3.Dot(base.transform.rotation * Vector3.forward, quaternion * Vector3.forward) < 0f)             if (Vector3.Dot(base.transform.rotation * Vector3.forward, quaternion * Vector3.forward) < 0f)
            {             {
                this.m_lookYaw = quaternion;                 this.m_lookYaw = quaternion;
            }             }
        }         }
        else         else
        {         {
            this.m_lookYaw = quaternion;             this.m_lookYaw = quaternion;
        }         }
        this.m_lookPitch = Mathf.Clamp(this.m_lookPitch - mouseLook.y, -89f, 89f);         this.m_lookPitch = Mathf.Clamp(this.m_lookPitch - mouseLook.y, -89f, 89f);
        this.UpdateEyeRotation();         this.UpdateEyeRotation();
        this.m_lookDir = this.m_eye.forward;         this.m_lookDir = this.m_eye.forward;
        if (this.m_lookTransitionTime > 0f && mouseLook != Vector2.zero)         if (this.m_lookTransitionTime > 0f && mouseLook != Vector2.zero)
        {         {
            this.m_lookTransitionTime = 0f;             this.m_lookTransitionTime = 0f;
        }         }
    }     }
   
    public void SetMouseLookForward(bool includePitch = true)     public void SetMouseLookForward(bool includePitch = true)
    {     {
        this.m_lookYaw = Quaternion.Euler(0f, base.transform.rotation.eulerAngles.y, 0f);         this.m_lookYaw = Quaternion.Euler(0f, base.transform.rotation.eulerAngles.y, 0f);
        if (includePitch)         if (includePitch)
        {         {
            this.m_lookPitch = 0f;             this.m_lookPitch = 0f;
        }         }
    }     }
   
    public void SetMouseLookBackward(bool includePitch = true)     public void SetMouseLookBackward(bool includePitch = true)
    {     {
        this.m_lookYaw = Quaternion.Euler(0f, base.transform.rotation.eulerAngles.y + 180f, 0f);         this.m_lookYaw = Quaternion.Euler(0f, base.transform.rotation.eulerAngles.y + 180f, 0f);
        if (includePitch)         if (includePitch)
        {         {
            this.m_lookPitch = 0f;             this.m_lookPitch = 0f;
        }         }
    }     }
   
    protected override void UpdateEyeRotation()     protected override void UpdateEyeRotation()
    {     {
        this.m_eye.rotation = this.m_lookYaw * Quaternion.Euler(this.m_lookPitch, 0f, 0f);         this.m_eye.rotation = this.m_lookYaw * Quaternion.Euler(this.m_lookPitch, 0f, 0f);
    }     }
   
    public Ragdoll GetRagdoll()     public Ragdoll GetRagdoll()
    {     {
        return this.m_ragdoll;         return this.m_ragdoll;
    }     }
   
    public void OnDodgeMortal()     public void OnDodgeMortal()
    {     {
        this.m_dodgeInvincible = false;         this.m_dodgeInvincible = false;
    }     }
   
    private void UpdateDodge(float dt)     private void UpdateDodge(float dt)
    {     {
        this.m_queuedDodgeTimer -= dt;         this.m_queuedDodgeTimer -= dt;
        if (this.m_queuedDodgeTimer > 0f && base.IsOnGround() && !this.IsDead() && !this.InAttack() && !this.IsEncumbered() && !this.InDodge() && !base.IsStaggering())         if (this.m_queuedDodgeTimer > 0f && base.IsOnGround() && !this.IsDead() && !this.InAttack() && !this.IsEncumbered() && !this.InDodge() && !base.IsStaggering())
        {         {
.            float num = this.m_dodgeStaminaUsage - this.m_dodgeStaminaUsage * this.m_equipmentMovementModifier;             float num = this.m_dodgeStaminaUsage - this.m_dodgeStaminaUsage * this.GetEquipmentMovementModifier() + this.m_dodgeStaminaUsage * this.GetEquipmentDodgeStaminaModifier();
              this.m_seman.ModifyDodgeStaminaUsage(num, ref num, true); 
            if (this.HaveStamina(num))             if (this.HaveStamina(num))
            {             {
                this.ClearActionQueue();                 this.ClearActionQueue();
                this.m_queuedDodgeTimer = 0f;                 this.m_queuedDodgeTimer = 0f;
                this.m_dodgeInvincible = true;                 this.m_dodgeInvincible = true;
                base.transform.rotation = Quaternion.LookRotation(this.m_queuedDodgeDir);                 base.transform.rotation = Quaternion.LookRotation(this.m_queuedDodgeDir);
                this.m_body.rotation = base.transform.rotation;                 this.m_body.rotation = base.transform.rotation;
                this.m_zanim.SetTrigger("dodge");                 this.m_zanim.SetTrigger("dodge");
                base.AddNoise(5f);                 base.AddNoise(5f);
                this.UseStamina(num, false);                 this.UseStamina(num, false);
                this.m_dodgeEffects.Create(base.transform.position, Quaternion.identity, base.transform, 1f, -1);                 this.m_dodgeEffects.Create(base.transform.position, Quaternion.identity, base.transform, 1f, -1);
            }             }
            else             else
            {             {
                Hud.instance.StaminaBarEmptyFlash();                 Hud.instance.StaminaBarEmptyFlash();
            }             }
        }         }
        bool flag = this.m_animator.GetBool(Player.s_animatorTagDodge) || base.GetNextOrCurrentAnimHash() == Player.s_animatorTagDodge;         bool flag = this.m_animator.GetBool(Player.s_animatorTagDodge) || base.GetNextOrCurrentAnimHash() == Player.s_animatorTagDodge;
        bool flag2 = flag && this.m_dodgeInvincible;         bool flag2 = flag && this.m_dodgeInvincible;
        this.m_nview.GetZDO().Set(ZDOVars.s_dodgeinv, flag2);         this.m_nview.GetZDO().Set(ZDOVars.s_dodgeinv, flag2);
        this.m_inDodge = flag;         this.m_inDodge = flag;
    }     }
   
    public override bool IsDodgeInvincible()     public override bool IsDodgeInvincible()
    {     {
        return this.m_nview.IsValid() && this.m_nview.GetZDO().GetBool(ZDOVars.s_dodgeinv, false);         return this.m_nview.IsValid() && this.m_nview.GetZDO().GetBool(ZDOVars.s_dodgeinv, false);
    }     }
   
    public override bool InDodge()     public override bool InDodge()
    {     {
        return this.m_nview.IsValid() && this.m_nview.IsOwner() && this.m_inDodge;         return this.m_nview.IsValid() && this.m_nview.IsOwner() && this.m_inDodge;
    }     }
   
    public override bool IsDead()     public override bool IsDead()
    {     {
        ZDO zdo = this.m_nview.GetZDO();         ZDO zdo = this.m_nview.GetZDO();
        return zdo != null && zdo.GetBool(ZDOVars.s_dead, false);         return zdo != null && zdo.GetBool(ZDOVars.s_dead, false);
    }     }
   
    private void Dodge(Vector3 dodgeDir)     private void Dodge(Vector3 dodgeDir)
    {     {
        this.m_queuedDodgeTimer = 0.5f;         this.m_queuedDodgeTimer = 0.5f;
        this.m_queuedDodgeDir = dodgeDir;         this.m_queuedDodgeDir = dodgeDir;
    }     }
   
    protected override bool AlwaysRotateCamera()     protected override bool AlwaysRotateCamera()
    {     {
        ItemDrop.ItemData currentWeapon = base.GetCurrentWeapon();         ItemDrop.ItemData currentWeapon = base.GetCurrentWeapon();
.        if ((currentWeapon != null && this.m_currentAttack != null && this.m_lastCombatTimer < 1f && this.m_currentAttack.m_attackType != Attack.AttackType.None) || this.IsDrawingBow() || this.m_blocking)         if ((currentWeapon != null && this.m_currentAttack != null && this.m_lastCombatTimer < 1f && this.m_currentAttack.m_attackType != Attack.AttackType.None && !this.m_attackTowardsPlayerLookDir) || this.IsDrawingBow() || this.m_blocking)
        {         {
            return true;             return true;
        }         }
        if (currentWeapon != null && currentWeapon.m_shared.m_alwaysRotate && this.m_moveDir.magnitude < 0.01f)         if (currentWeapon != null && currentWeapon.m_shared.m_alwaysRotate && this.m_moveDir.magnitude < 0.01f)
        {         {
            return true;             return true;
        }         }
        if (this.m_currentAttack != null && this.m_currentAttack.m_loopingAttack && this.InAttack())         if (this.m_currentAttack != null && this.m_currentAttack.m_loopingAttack && this.InAttack())
        {         {
            return true;             return true;
        }         }
        if (this.InPlaceMode())         if (this.InPlaceMode())
        {         {
            Vector3 vector = base.GetLookYaw() * Vector3.forward;             Vector3 vector = base.GetLookYaw() * Vector3.forward;
            Vector3 forward = base.transform.forward;             Vector3 forward = base.transform.forward;
            if (Vector3.Angle(vector, forward) > 95f)             if (Vector3.Angle(vector, forward) > 95f)
            {             {
                return true;                 return true;
            }             }
        }         }
        return false;         return false;
    }     }
   
    public override bool TeleportTo(Vector3 pos, Quaternion rot, bool distantTeleport)     public override bool TeleportTo(Vector3 pos, Quaternion rot, bool distantTeleport)
    {     {
        if (!this.m_nview.IsOwner())         if (!this.m_nview.IsOwner())
        {         {
            this.m_nview.InvokeRPC("RPC_TeleportTo", new object[] { pos, rot, distantTeleport });             this.m_nview.InvokeRPC("RPC_TeleportTo", new object[] { pos, rot, distantTeleport });
            return false;             return false;
        }         }
        if (this.IsTeleporting())         if (this.IsTeleporting())
        {         {
            return false;             return false;
        }         }
        if (this.m_teleportCooldown < 2f)         if (this.m_teleportCooldown < 2f)
        {         {
            return false;             return false;
        }         }
        this.m_teleporting = true;         this.m_teleporting = true;
        this.m_distantTeleport = distantTeleport;         this.m_distantTeleport = distantTeleport;
        this.m_teleportTimer = 0f;         this.m_teleportTimer = 0f;
        this.m_teleportCooldown = 0f;         this.m_teleportCooldown = 0f;
        base.InvalidateCachedLiquidDepth();         base.InvalidateCachedLiquidDepth();
        this.m_teleportFromPos = base.transform.position;         this.m_teleportFromPos = base.transform.position;
        this.m_teleportFromRot = base.transform.rotation;         this.m_teleportFromRot = base.transform.rotation;
        this.m_teleportTargetPos = pos;         this.m_teleportTargetPos = pos;
        this.m_teleportTargetRot = rot;         this.m_teleportTargetRot = rot;
        return true;         return true;
    }     }
   
    private void UpdateTeleport(float dt)     private void UpdateTeleport(float dt)
    {     {
        if (!this.m_teleporting)         if (!this.m_teleporting)
        {         {
            this.m_teleportCooldown += dt;             this.m_teleportCooldown += dt;
            return;             return;
        }         }
        this.m_teleportCooldown = 0f;         this.m_teleportCooldown = 0f;
        this.m_teleportTimer += dt;         this.m_teleportTimer += dt;
        if (this.m_teleportTimer > 2f)         if (this.m_teleportTimer > 2f)
        {         {
            Vector3 vector = this.m_teleportTargetRot * Vector3.forward;             Vector3 vector = this.m_teleportTargetRot * Vector3.forward;
            base.transform.position = this.m_teleportTargetPos;             base.transform.position = this.m_teleportTargetPos;
            base.transform.rotation = this.m_teleportTargetRot;             base.transform.rotation = this.m_teleportTargetRot;
            this.m_body.velocity = Vector3.zero;             this.m_body.velocity = Vector3.zero;
            this.m_maxAirAltitude = base.transform.position.y;             this.m_maxAirAltitude = base.transform.position.y;
            base.SetLookDir(vector, 0f);             base.SetLookDir(vector, 0f);
            if ((this.m_teleportTimer > 8f || !this.m_distantTeleport) && ZNetScene.instance.IsAreaReady(this.m_teleportTargetPos))             if ((this.m_teleportTimer > 8f || !this.m_distantTeleport) && ZNetScene.instance.IsAreaReady(this.m_teleportTargetPos))
            {             {
                float num = 0f;                 float num = 0f;
                if (ZoneSystem.instance.FindFloor(this.m_teleportTargetPos, out num))                 if (ZoneSystem.instance.FindFloor(this.m_teleportTargetPos, out num))
                {                 {
                    this.m_teleportTimer = 0f;                     this.m_teleportTimer = 0f;
                    this.m_teleporting = false;                     this.m_teleporting = false;
                    base.ResetCloth();                     base.ResetCloth();
                    return;                     return;
                }                 }
                if (this.m_teleportTimer > 15f || !this.m_distantTeleport)                 if (this.m_teleportTimer > 15f || !this.m_distantTeleport)
                {                 {
                    if (this.m_distantTeleport)                     if (this.m_distantTeleport)
                    {                     {
                        Vector3 position = base.transform.position;                         Vector3 position = base.transform.position;
                        position.y = ZoneSystem.instance.GetSolidHeight(this.m_teleportTargetPos) + 0.5f;                         position.y = ZoneSystem.instance.GetSolidHeight(this.m_teleportTargetPos) + 0.5f;
                        base.transform.position = position;                         base.transform.position = position;
                    }                     }
                    else                     else
                    {                     {
                        base.transform.rotation = this.m_teleportFromRot;                         base.transform.rotation = this.m_teleportFromRot;
                        base.transform.position = this.m_teleportFromPos;                         base.transform.position = this.m_teleportFromPos;
                        this.m_maxAirAltitude = base.transform.position.y;                         this.m_maxAirAltitude = base.transform.position.y;
                        this.Message(MessageHud.MessageType.Center, "$msg_portal_blocked", 0, null);                         this.Message(MessageHud.MessageType.Center, "$msg_portal_blocked", 0, null);
                    }                     }
                    this.m_teleportTimer = 0f;                     this.m_teleportTimer = 0f;
                    this.m_teleporting = false;                     this.m_teleporting = false;
                    base.ResetCloth();                     base.ResetCloth();
                }                 }
            }             }
        }         }
    }     }
   
    public override bool IsTeleporting()     public override bool IsTeleporting()
    {     {
        return this.m_teleporting;         return this.m_teleporting;
    }     }
   
    public bool ShowTeleportAnimation()     public bool ShowTeleportAnimation()
    {     {
        return this.m_teleporting && this.m_distantTeleport;         return this.m_teleporting && this.m_distantTeleport;
    }     }
   
    public void SetPlayerModel(int index)     public void SetPlayerModel(int index)
    {     {
        if (this.m_modelIndex == index)         if (this.m_modelIndex == index)
        {         {
            return;             return;
        }         }
        this.m_modelIndex = index;         this.m_modelIndex = index;
        this.m_visEquipment.SetModel(index);         this.m_visEquipment.SetModel(index);
    }     }
   
    public int GetPlayerModel()     public int GetPlayerModel()
    {     {
        return this.m_modelIndex;         return this.m_modelIndex;
    }     }
   
    public void SetSkinColor(Vector3 color)     public void SetSkinColor(Vector3 color)
    {     {
        if (color == this.m_skinColor)         if (color == this.m_skinColor)
        {         {
            return;             return;
        }         }
        this.m_skinColor = color;         this.m_skinColor = color;
        this.m_visEquipment.SetSkinColor(this.m_skinColor);         this.m_visEquipment.SetSkinColor(this.m_skinColor);
    }     }
   
    public void SetHairColor(Vector3 color)     public void SetHairColor(Vector3 color)
    {     {
        if (this.m_hairColor == color)         if (this.m_hairColor == color)
        {         {
            return;             return;
        }         }
        this.m_hairColor = color;         this.m_hairColor = color;
        this.m_visEquipment.SetHairColor(this.m_hairColor);         this.m_visEquipment.SetHairColor(this.m_hairColor);
    }     }
   
    public Vector3 GetHairColor()     public Vector3 GetHairColor()
    {     {
        return this.m_hairColor;         return this.m_hairColor;
    }     }
   
    protected override void SetupVisEquipment(VisEquipment visEq, bool isRagdoll)     protected override void SetupVisEquipment(VisEquipment visEq, bool isRagdoll)
    {     {
        base.SetupVisEquipment(visEq, isRagdoll);         base.SetupVisEquipment(visEq, isRagdoll);
        visEq.SetModel(this.m_modelIndex);         visEq.SetModel(this.m_modelIndex);
        visEq.SetSkinColor(this.m_skinColor);         visEq.SetSkinColor(this.m_skinColor);
        visEq.SetHairColor(this.m_hairColor);         visEq.SetHairColor(this.m_hairColor);
    }     }
   
    public override bool CanConsumeItem(ItemDrop.ItemData item, bool checkWorldLevel = false)     public override bool CanConsumeItem(ItemDrop.ItemData item, bool checkWorldLevel = false)
    {     {
        if (!base.CanConsumeItem(item, checkWorldLevel))         if (!base.CanConsumeItem(item, checkWorldLevel))
        {         {
            return false;             return false;
        }         }
        if (item.m_shared.m_food > 0f && !this.CanEat(item, true))         if (item.m_shared.m_food > 0f && !this.CanEat(item, true))
        {         {
            return false;             return false;
        }         }
        if (item.m_shared.m_consumeStatusEffect)         if (item.m_shared.m_consumeStatusEffect)
        {         {
            StatusEffect consumeStatusEffect = item.m_shared.m_consumeStatusEffect;             StatusEffect consumeStatusEffect = item.m_shared.m_consumeStatusEffect;
.            if (this.m_seman.HaveStatusEffect(item.m_shared.m_consumeStatusEffect.name) || this.m_seman.HaveStatusEffectCategory(consumeStatusEffect.m_category))             if (this.m_seman.HaveStatusEffect(item.m_shared.m_consumeStatusEffect.NameHash()) || this.m_seman.HaveStatusEffectCategory(consumeStatusEffect.m_category))
            {             {
                this.Message(MessageHud.MessageType.Center, "$msg_cantconsume", 0, null);                 this.Message(MessageHud.MessageType.Center, "$msg_cantconsume", 0, null);
                return false;                 return false;
            }             }
        }         }
        return true;         return true;
    }     }
   
    public override bool ConsumeItem(Inventory inventory, ItemDrop.ItemData item, bool checkWorldLevel = false)     public override bool ConsumeItem(Inventory inventory, ItemDrop.ItemData item, bool checkWorldLevel = false)
    {     {
        if (!this.CanConsumeItem(item, checkWorldLevel))         if (!this.CanConsumeItem(item, checkWorldLevel))
        {         {
            return false;             return false;
        }         }
        if (item.m_shared.m_consumeStatusEffect)         if (item.m_shared.m_consumeStatusEffect)
        {         {
            StatusEffect consumeStatusEffect = item.m_shared.m_consumeStatusEffect;             StatusEffect consumeStatusEffect = item.m_shared.m_consumeStatusEffect;
            this.m_seman.AddStatusEffect(item.m_shared.m_consumeStatusEffect, true, 0, 0f);             this.m_seman.AddStatusEffect(item.m_shared.m_consumeStatusEffect, true, 0, 0f);
        }         }
        if (item.m_shared.m_food > 0f)         if (item.m_shared.m_food > 0f)
        {         {
            this.EatFood(item);             this.EatFood(item);
        }         }
        inventory.RemoveOneItem(item);         inventory.RemoveOneItem(item);
        return true;         return true;
    }     }
   
    public void SetIntro(bool intro)     public void SetIntro(bool intro)
    {     {
        if (this.m_intro == intro)         if (this.m_intro == intro)
        {         {
            return;             return;
        }         }
        this.m_intro = intro;         this.m_intro = intro;
        this.m_zanim.SetBool("intro", intro);         this.m_zanim.SetBool("intro", intro);
    }     }
   
    public override bool InIntro()     public override bool InIntro()
    {     {
        return this.m_intro;         return this.m_intro;
    }     }
   
    public override bool InCutscene()     public override bool InCutscene()
    {     {
        return base.GetCurrentAnimHash() == Player.s_animatorTagCutscene || this.InIntro() || this.m_sleeping || base.InCutscene();         return base.GetCurrentAnimHash() == Player.s_animatorTagCutscene || this.InIntro() || this.m_sleeping || base.InCutscene();
    }     }
   
    public void SetMaxStamina(float stamina, bool flashBar)     public void SetMaxStamina(float stamina, bool flashBar)
    {     {
        if (flashBar && Hud.instance != null && stamina > this.m_maxStamina)         if (flashBar && Hud.instance != null && stamina > this.m_maxStamina)
        {         {
            Hud.instance.StaminaBarUppgradeFlash();             Hud.instance.StaminaBarUppgradeFlash();
        }         }
        this.m_maxStamina = stamina;         this.m_maxStamina = stamina;
        this.m_stamina = Mathf.Clamp(this.m_stamina, 0f, this.m_maxStamina);         this.m_stamina = Mathf.Clamp(this.m_stamina, 0f, this.m_maxStamina);
    }     }
   
    private void SetMaxEitr(float eitr, bool flashBar)     private void SetMaxEitr(float eitr, bool flashBar)
    {     {
        if (flashBar && Hud.instance != null && eitr > this.m_maxEitr)         if (flashBar && Hud.instance != null && eitr > this.m_maxEitr)
        {         {
            Hud.instance.EitrBarUppgradeFlash();             Hud.instance.EitrBarUppgradeFlash();
        }         }
        this.m_maxEitr = eitr;         this.m_maxEitr = eitr;
        this.m_eitr = Mathf.Clamp(this.m_eitr, 0f, this.m_maxEitr);         this.m_eitr = Mathf.Clamp(this.m_eitr, 0f, this.m_maxEitr);
    }     }
   
    public void SetMaxHealth(float health, bool flashBar)     public void SetMaxHealth(float health, bool flashBar)
    {     {
        if (flashBar && Hud.instance != null && health > base.GetMaxHealth())         if (flashBar && Hud.instance != null && health > base.GetMaxHealth())
        {         {
            Hud.instance.FlashHealthBar();             Hud.instance.FlashHealthBar();
        }         }
        base.SetMaxHealth(health);         base.SetMaxHealth(health);
    }     }
   
    public override bool IsPVPEnabled()     public override bool IsPVPEnabled()
    {     {
        if (!this.m_nview.IsValid())         if (!this.m_nview.IsValid())
        {         {
            return false;             return false;
        }         }
        if (this.m_nview.IsOwner())         if (this.m_nview.IsOwner())
        {         {
            return this.m_pvp;             return this.m_pvp;
        }         }
        return this.m_nview.GetZDO().GetBool(ZDOVars.s_pvp, false);         return this.m_nview.GetZDO().GetBool(ZDOVars.s_pvp, false);
    }     }
   
    public void SetPVP(bool enabled)     public void SetPVP(bool enabled)
    {     {
        if (this.m_pvp == enabled)         if (this.m_pvp == enabled)
        {         {
            return;             return;
        }         }
        this.m_pvp = enabled;         this.m_pvp = enabled;
        this.m_nview.GetZDO().Set(ZDOVars.s_pvp, this.m_pvp);         this.m_nview.GetZDO().Set(ZDOVars.s_pvp, this.m_pvp);
        if (this.m_pvp)         if (this.m_pvp)
        {         {
            this.Message(MessageHud.MessageType.Center, "$msg_pvpon", 0, null);             this.Message(MessageHud.MessageType.Center, "$msg_pvpon", 0, null);
            return;             return;
        }         }
        this.Message(MessageHud.MessageType.Center, "$msg_pvpoff", 0, null);         this.Message(MessageHud.MessageType.Center, "$msg_pvpoff", 0, null);
    }     }
   
    public bool CanSwitchPVP()     public bool CanSwitchPVP()
    {     {
        return this.m_lastCombatTimer > 10f;         return this.m_lastCombatTimer > 10f;
    }     }
   
    public bool NoCostCheat()     public bool NoCostCheat()
    {     {
        return this.m_noPlacementCost;         return this.m_noPlacementCost;
    }     }
   
    public bool StartEmote(string emote, bool oneshot = true)     public bool StartEmote(string emote, bool oneshot = true)
    {     {
        if (!this.CanMove() || this.InAttack() || this.IsDrawingBow() || this.IsAttached() || this.IsAttachedToShip())         if (!this.CanMove() || this.InAttack() || this.IsDrawingBow() || this.IsAttached() || this.IsAttachedToShip())
        {         {
            return false;             return false;
        }         }
        this.SetCrouch(false);         this.SetCrouch(false);
        int @int = this.m_nview.GetZDO().GetInt(ZDOVars.s_emoteID, 0);         int @int = this.m_nview.GetZDO().GetInt(ZDOVars.s_emoteID, 0);
        this.m_nview.GetZDO().Set(ZDOVars.s_emoteID, @int + 1, false);         this.m_nview.GetZDO().Set(ZDOVars.s_emoteID, @int + 1, false);
        this.m_nview.GetZDO().Set(ZDOVars.s_emote, emote);         this.m_nview.GetZDO().Set(ZDOVars.s_emote, emote);
        this.m_nview.GetZDO().Set(ZDOVars.s_emoteOneshot, oneshot);         this.m_nview.GetZDO().Set(ZDOVars.s_emoteOneshot, oneshot);
        return true;         return true;
    }     }
   
    protected override void StopEmote()     protected override void StopEmote()
    {     {
        if (this.m_nview.GetZDO().GetString(ZDOVars.s_emote, "") != "")         if (this.m_nview.GetZDO().GetString(ZDOVars.s_emote, "") != "")
        {         {
            int @int = this.m_nview.GetZDO().GetInt(ZDOVars.s_emoteID, 0);             int @int = this.m_nview.GetZDO().GetInt(ZDOVars.s_emoteID, 0);
            this.m_nview.GetZDO().Set(ZDOVars.s_emoteID, @int + 1, false);             this.m_nview.GetZDO().Set(ZDOVars.s_emoteID, @int + 1, false);
            this.m_nview.GetZDO().Set(ZDOVars.s_emote, "");             this.m_nview.GetZDO().Set(ZDOVars.s_emote, "");
        }         }
    }     }
   
    private void UpdateEmote()     private void UpdateEmote()
    {     {
        if (this.m_nview.IsOwner() && this.InEmote() && this.m_moveDir != Vector3.zero)         if (this.m_nview.IsOwner() && this.InEmote() && this.m_moveDir != Vector3.zero)
        {         {
            this.StopEmote();             this.StopEmote();
        }         }
        int @int = this.m_nview.GetZDO().GetInt(ZDOVars.s_emoteID, 0);         int @int = this.m_nview.GetZDO().GetInt(ZDOVars.s_emoteID, 0);
        if (@int != this.m_emoteID)         if (@int != this.m_emoteID)
        {         {
            this.m_emoteID = @int;             this.m_emoteID = @int;
            if (!string.IsNullOrEmpty(this.m_emoteState))             if (!string.IsNullOrEmpty(this.m_emoteState))
            {             {
                this.m_animator.SetBool("emote_" + this.m_emoteState, false);                 this.m_animator.SetBool("emote_" + this.m_emoteState, false);
            }             }
            this.m_emoteState = "";             this.m_emoteState = "";
            this.m_animator.SetTrigger("emote_stop");             this.m_animator.SetTrigger("emote_stop");
            string @string = this.m_nview.GetZDO().GetString(ZDOVars.s_emote, "");             string @string = this.m_nview.GetZDO().GetString(ZDOVars.s_emote, "");
            if (!string.IsNullOrEmpty(@string))             if (!string.IsNullOrEmpty(@string))
            {             {
                bool @bool = this.m_nview.GetZDO().GetBool(ZDOVars.s_emoteOneshot, false);                 bool @bool = this.m_nview.GetZDO().GetBool(ZDOVars.s_emoteOneshot, false);
                this.m_animator.ResetTrigger("emote_stop");                 this.m_animator.ResetTrigger("emote_stop");
                if (@bool)                 if (@bool)
                {                 {
                    this.m_animator.SetTrigger("emote_" + @string);                     this.m_animator.SetTrigger("emote_" + @string);
                    return;                     return;
                }                 }
                this.m_emoteState = @string;                 this.m_emoteState = @string;
                this.m_animator.SetBool("emote_" + @string, true);                 this.m_animator.SetBool("emote_" + @string, true);
            }             }
        }         }
    }     }
   
    public override bool InEmote()     public override bool InEmote()
    {     {
        return !string.IsNullOrEmpty(this.m_emoteState) || base.GetCurrentAnimHash() == Player.s_animatorTagEmote;         return !string.IsNullOrEmpty(this.m_emoteState) || base.GetCurrentAnimHash() == Player.s_animatorTagEmote;
    }     }
   
    public override bool IsCrouching()     public override bool IsCrouching()
    {     {
        return base.GetCurrentAnimHash() == Player.s_animatorTagCrouch;         return base.GetCurrentAnimHash() == Player.s_animatorTagCrouch;
    }     }
   
    private void UpdateCrouch(float dt)     private void UpdateCrouch(float dt)
    {     {
        if (this.m_crouchToggled)         if (this.m_crouchToggled)
        {         {
            if (!this.HaveStamina(0f) || base.IsSwimming() || this.InBed() || this.InPlaceMode() || this.m_run || this.IsBlocking() || base.IsFlying())             if (!this.HaveStamina(0f) || base.IsSwimming() || this.InBed() || this.InPlaceMode() || this.m_run || this.IsBlocking() || base.IsFlying())
            {             {
                this.SetCrouch(false);                 this.SetCrouch(false);
            }             }
            bool flag = this.InAttack() || this.IsDrawingBow();             bool flag = this.InAttack() || this.IsDrawingBow();
            this.m_zanim.SetBool(Player.s_crouching, this.m_crouchToggled && !flag);             this.m_zanim.SetBool(Player.s_crouching, this.m_crouchToggled && !flag);
            return;             return;
        }         }
        this.m_zanim.SetBool(Player.s_crouching, false);         this.m_zanim.SetBool(Player.s_crouching, false);
    }     }
   
    protected override void SetCrouch(bool crouch)     protected override void SetCrouch(bool crouch)
    {     {
        this.m_crouchToggled = crouch;         this.m_crouchToggled = crouch;
    }     }
   
    public void SetGuardianPower(string name)     public void SetGuardianPower(string name)
    {     {
        this.m_guardianPower = name;         this.m_guardianPower = name;
        this.m_guardianPowerHash = (string.IsNullOrEmpty(name) ? 0 : name.GetStableHashCode());         this.m_guardianPowerHash = (string.IsNullOrEmpty(name) ? 0 : name.GetStableHashCode());
        this.m_guardianSE = ObjectDB.instance.GetStatusEffect(this.m_guardianPowerHash);         this.m_guardianSE = ObjectDB.instance.GetStatusEffect(this.m_guardianPowerHash);
        if (ZoneSystem.instance)         if (ZoneSystem.instance)
        {         {
            this.AddUniqueKey(name);             this.AddUniqueKey(name);
            Game.instance.IncrementPlayerStat(PlayerStatType.SetGuardianPower, 1f);             Game.instance.IncrementPlayerStat(PlayerStatType.SetGuardianPower, 1f);
            uint num = <PrivateImplementationDetails>.ComputeStringHash(name);             uint num = <PrivateImplementationDetails>.ComputeStringHash(name);
            if (num <= 2474185561U)             if (num <= 2474185561U)
            {             {
                if (num <= 2006288425U)                 if (num <= 2006288425U)
                {                 {
                    if (num != 1427920915U)                     if (num != 1427920915U)
                    {                     {
                        if (num == 2006288425U)                         if (num == 2006288425U)
                        {                         {
                            if (name == "GP_Bonemass")                             if (name == "GP_Bonemass")
                            {                             {
                                Game.instance.IncrementPlayerStat(PlayerStatType.SetPowerBonemass, 1f);                                 Game.instance.IncrementPlayerStat(PlayerStatType.SetPowerBonemass, 1f);
                                return;                                 return;
                            }                             }
                        }                         }
                    }                     }
                    else if (name == "GP_Queen")                     else if (name == "GP_Queen")
                    {                     {
                        Game.instance.IncrementPlayerStat(PlayerStatType.SetPowerQueen, 1f);                         Game.instance.IncrementPlayerStat(PlayerStatType.SetPowerQueen, 1f);
                        return;                         return;
                    }                     }
                }                 }
                else if (num != 2142994390U)                 else if (num != 2142994390U)
                {                 {
                    if (num == 2474185561U)                     if (num == 2474185561U)
                    {                     {
                        if (name == "GP_Yagluth")                         if (name == "GP_Yagluth")
                        {                         {
                            Game.instance.IncrementPlayerStat(PlayerStatType.SetPowerYagluth, 1f);                             Game.instance.IncrementPlayerStat(PlayerStatType.SetPowerYagluth, 1f);
                            return;                             return;
                        }                         }
                    }                     }
                }                 }
                else if (name == "GP_Moder")                 else if (name == "GP_Moder")
                {                 {
                    Game.instance.IncrementPlayerStat(PlayerStatType.SetPowerModer, 1f);                     Game.instance.IncrementPlayerStat(PlayerStatType.SetPowerModer, 1f);
                    return;                     return;
                }                 }
            }             }
            else if (num <= 3121473449U)             else if (num <= 3121473449U)
            {             {
                if (num != 2548002664U)                 if (num != 2548002664U)
                {                 {
                    if (num == 3121473449U)                     if (num == 3121473449U)
                    {                     {
                        if (name == "GP_Ashlands")                         if (name == "GP_Ashlands")
                        {                         {
                            Game.instance.IncrementPlayerStat(PlayerStatType.SetPowerAshlands, 1f);                             Game.instance.IncrementPlayerStat(PlayerStatType.SetPowerAshlands, 1f);
                            return;                             return;
                        }                         }
                    }                     }
                }                 }
                else if (name == "GP_DeepNorth")                 else if (name == "GP_DeepNorth")
                {                 {
                    Game.instance.IncrementPlayerStat(PlayerStatType.SetPowerDeepNorth, 1f);                     Game.instance.IncrementPlayerStat(PlayerStatType.SetPowerDeepNorth, 1f);
                    return;                     return;
                }                 }
            }             }
            else if (num != 3360619182U)             else if (num != 3360619182U)
            {             {
                if (num == 3839426325U)                 if (num == 3839426325U)
                {                 {
                    if (name == "GP_Eikthyr")                     if (name == "GP_Eikthyr")
                    {                     {
                        Game.instance.IncrementPlayerStat(PlayerStatType.SetPowerEikthyr, 1f);                         Game.instance.IncrementPlayerStat(PlayerStatType.SetPowerEikthyr, 1f);
                        return;                         return;
                    }                     }
                }                 }
            }             }
            else if (name == "GP_TheElder")             else if (name == "GP_TheElder")
            {             {
                Game.instance.IncrementPlayerStat(PlayerStatType.SetPowerElder, 1f);                 Game.instance.IncrementPlayerStat(PlayerStatType.SetPowerElder, 1f);
                return;                 return;
            }             }
            ZLog.LogWarning("Missing stat for guardian power: " + name);             ZLog.LogWarning("Missing stat for guardian power: " + name);
        }         }
    }     }
   
    public string GetGuardianPowerName()     public string GetGuardianPowerName()
    {     {
        return this.m_guardianPower;         return this.m_guardianPower;
    }     }
   
    public void GetGuardianPowerHUD(out StatusEffect se, out float cooldown)     public void GetGuardianPowerHUD(out StatusEffect se, out float cooldown)
    {     {
        se = this.m_guardianSE;         se = this.m_guardianSE;
        cooldown = this.m_guardianPowerCooldown;         cooldown = this.m_guardianPowerCooldown;
    }     }
   
    public bool StartGuardianPower()     public bool StartGuardianPower()
    {     {
        if (this.m_guardianSE == null)         if (this.m_guardianSE == null)
        {         {
            return false;             return false;
        }         }
        if ((this.InAttack() && !this.HaveQueuedChain()) || this.InDodge() || !this.CanMove() || base.IsKnockedBack() || base.IsStaggering() || this.InMinorAction())         if ((this.InAttack() && !this.HaveQueuedChain()) || this.InDodge() || !this.CanMove() || base.IsKnockedBack() || base.IsStaggering() || this.InMinorAction())
        {         {
            return false;             return false;
        }         }
        if (this.m_guardianPowerCooldown > 0f)         if (this.m_guardianPowerCooldown > 0f)
        {         {
            this.Message(MessageHud.MessageType.Center, "$hud_powernotready", 0, null);             this.Message(MessageHud.MessageType.Center, "$hud_powernotready", 0, null);
            return false;             return false;
        }         }
        this.m_zanim.SetTrigger("gpower");         this.m_zanim.SetTrigger("gpower");
        Game.instance.IncrementPlayerStat(PlayerStatType.UseGuardianPower, 1f);         Game.instance.IncrementPlayerStat(PlayerStatType.UseGuardianPower, 1f);
        string prefabName = Utils.GetPrefabName(this.m_guardianSE.name);         string prefabName = Utils.GetPrefabName(this.m_guardianSE.name);
        uint num = <PrivateImplementationDetails>.ComputeStringHash(prefabName);         uint num = <PrivateImplementationDetails>.ComputeStringHash(prefabName);
        if (num <= 2474185561U)         if (num <= 2474185561U)
        {         {
            if (num <= 2006288425U)             if (num <= 2006288425U)
            {             {
                if (num != 1427920915U)                 if (num != 1427920915U)
                {                 {
                    if (num == 2006288425U)                     if (num == 2006288425U)
                    {                     {
                        if (prefabName == "GP_Bonemass")                         if (prefabName == "GP_Bonemass")
                        {                         {
                            Game.instance.IncrementPlayerStat(PlayerStatType.UsePowerBonemass, 1f);                             Game.instance.IncrementPlayerStat(PlayerStatType.UsePowerBonemass, 1f);
                            return true;                             return true;
                        }                         }
                    }                     }
                }                 }
                else if (prefabName == "GP_Queen")                 else if (prefabName == "GP_Queen")
                {                 {
                    Game.instance.IncrementPlayerStat(PlayerStatType.UsePowerQueen, 1f);                     Game.instance.IncrementPlayerStat(PlayerStatType.UsePowerQueen, 1f);
                    return true;                     return true;
                }                 }
            }             }
            else if (num != 2142994390U)             else if (num != 2142994390U)
            {             {
                if (num == 2474185561U)                 if (num == 2474185561U)
                {                 {
                    if (prefabName == "GP_Yagluth")                     if (prefabName == "GP_Yagluth")
                    {                     {
                        Game.instance.IncrementPlayerStat(PlayerStatType.UsePowerYagluth, 1f);                         Game.instance.IncrementPlayerStat(PlayerStatType.UsePowerYagluth, 1f);
                        return true;                         return true;
                    }                     }
                }                 }
            }             }
            else if (prefabName == "GP_Moder")             else if (prefabName == "GP_Moder")
            {             {
                Game.instance.IncrementPlayerStat(PlayerStatType.UsePowerModer, 1f);                 Game.instance.IncrementPlayerStat(PlayerStatType.UsePowerModer, 1f);
                return true;                 return true;
            }             }
        }         }
        else if (num <= 3121473449U)         else if (num <= 3121473449U)
        {         {
            if (num != 2548002664U)             if (num != 2548002664U)
            {             {
                if (num == 3121473449U)                 if (num == 3121473449U)
                {                 {
                    if (prefabName == "GP_Ashlands")                     if (prefabName == "GP_Ashlands")
                    {                     {
                        Game.instance.IncrementPlayerStat(PlayerStatType.UsePowerAshlands, 1f);                         Game.instance.IncrementPlayerStat(PlayerStatType.UsePowerAshlands, 1f);
                        return true;                         return true;
                    }                     }
                }                 }
            }             }
            else if (prefabName == "GP_DeepNorth")             else if (prefabName == "GP_DeepNorth")
            {             {
                Game.instance.IncrementPlayerStat(PlayerStatType.UsePowerDeepNorth, 1f);                 Game.instance.IncrementPlayerStat(PlayerStatType.UsePowerDeepNorth, 1f);
                return true;                 return true;
            }             }
        }         }
        else if (num != 3360619182U)         else if (num != 3360619182U)
        {         {
            if (num == 3839426325U)             if (num == 3839426325U)
            {             {
                if (prefabName == "GP_Eikthyr")                 if (prefabName == "GP_Eikthyr")
                {                 {
                    Game.instance.IncrementPlayerStat(PlayerStatType.UsePowerEikthyr, 1f);                     Game.instance.IncrementPlayerStat(PlayerStatType.UsePowerEikthyr, 1f);
                    return true;                     return true;
                }                 }
            }             }
        }         }
        else if (prefabName == "GP_TheElder")         else if (prefabName == "GP_TheElder")
        {         {
            Game.instance.IncrementPlayerStat(PlayerStatType.UsePowerElder, 1f);             Game.instance.IncrementPlayerStat(PlayerStatType.UsePowerElder, 1f);
            return true;             return true;
        }         }
        ZLog.LogWarning("Missing stat for guardian power: " + prefabName);         ZLog.LogWarning("Missing stat for guardian power: " + prefabName);
        return true;         return true;
    }     }
   
    public bool ActivateGuardianPower()     public bool ActivateGuardianPower()
    {     {
        if (this.m_guardianPowerCooldown > 0f)         if (this.m_guardianPowerCooldown > 0f)
        {         {
            return false;             return false;
        }         }
        if (this.m_guardianSE == null)         if (this.m_guardianSE == null)
        {         {
            return false;             return false;
        }         }
        List<Player> list = new List<Player>();         List<Player> list = new List<Player>();
        Player.GetPlayersInRange(base.transform.position, 10f, list);         Player.GetPlayersInRange(base.transform.position, 10f, list);
        foreach (Player player in list)         foreach (Player player in list)
        {         {
            player.GetSEMan().AddStatusEffect(this.m_guardianSE.NameHash(), true, 0, 0f);             player.GetSEMan().AddStatusEffect(this.m_guardianSE.NameHash(), true, 0, 0f);
        }         }
        this.m_guardianPowerCooldown = this.m_guardianSE.m_cooldown;         this.m_guardianPowerCooldown = this.m_guardianSE.m_cooldown;
        return false;         return false;
    }     }
   
    private void UpdateGuardianPower(float dt)     private void UpdateGuardianPower(float dt)
    {     {
        this.m_guardianPowerCooldown -= dt;         this.m_guardianPowerCooldown -= dt;
        if (this.m_guardianPowerCooldown < 0f)         if (this.m_guardianPowerCooldown < 0f)
        {         {
            this.m_guardianPowerCooldown = 0f;             this.m_guardianPowerCooldown = 0f;
        }         }
    }     }
   
    public override void AttachStart(Transform attachPoint, GameObject colliderRoot, bool hideWeapons, bool isBed, bool onShip, string attachAnimation, Vector3 detachOffset, Transform cameraPos = null)     public override void AttachStart(Transform attachPoint, GameObject colliderRoot, bool hideWeapons, bool isBed, bool onShip, string attachAnimation, Vector3 detachOffset, Transform cameraPos = null)
    {     {
        if (this.m_attached)         if (this.m_attached)
        {         {
            return;             return;
        }         }
        this.m_attached = true;         this.m_attached = true;
        this.m_attachedToShip = onShip;         this.m_attachedToShip = onShip;
        this.m_attachPoint = attachPoint;         this.m_attachPoint = attachPoint;
        this.m_detachOffset = detachOffset;         this.m_detachOffset = detachOffset;
        this.m_attachAnimation = attachAnimation;         this.m_attachAnimation = attachAnimation;
        this.m_attachPointCamera = cameraPos;         this.m_attachPointCamera = cameraPos;
        this.m_zanim.SetBool(attachAnimation, true);         this.m_zanim.SetBool(attachAnimation, true);
        this.m_nview.GetZDO().Set(ZDOVars.s_inBed, isBed);         this.m_nview.GetZDO().Set(ZDOVars.s_inBed, isBed);
        if (colliderRoot != null)         if (colliderRoot != null)
        {         {
            this.m_attachColliders = colliderRoot.GetComponentsInChildren<Collider>();             this.m_attachColliders = colliderRoot.GetComponentsInChildren<Collider>();
            ZLog.Log("Ignoring " + this.m_attachColliders.Length.ToString() + " colliders");             ZLog.Log("Ignoring " + this.m_attachColliders.Length.ToString() + " colliders");
            foreach (Collider collider in this.m_attachColliders)             foreach (Collider collider in this.m_attachColliders)
            {             {
                Physics.IgnoreCollision(this.m_collider, collider, true);                 Physics.IgnoreCollision(this.m_collider, collider, true);
            }             }
        }         }
        if (hideWeapons)         if (hideWeapons)
        {         {
            base.HideHandItems();             base.HideHandItems();
        }         }
        this.UpdateAttach();         this.UpdateAttach();
        base.ResetCloth();         base.ResetCloth();
    }     }
   
    private void UpdateAttach()     private void UpdateAttach()
    {     {
        if (this.m_attached)         if (this.m_attached)
        {         {
            if (this.m_attachPoint != null)             if (this.m_attachPoint != null)
            {             {
                base.transform.position = this.m_attachPoint.position;                 base.transform.position = this.m_attachPoint.position;
                base.transform.rotation = this.m_attachPoint.rotation;                 base.transform.rotation = this.m_attachPoint.rotation;
                Rigidbody componentInParent = this.m_attachPoint.GetComponentInParent<Rigidbody>();                 Rigidbody componentInParent = this.m_attachPoint.GetComponentInParent<Rigidbody>();
                this.m_body.useGravity = false;                 this.m_body.useGravity = false;
                this.m_body.velocity = (componentInParent ? componentInParent.GetPointVelocity(base.transform.position) : Vector3.zero);                 this.m_body.velocity = (componentInParent ? componentInParent.GetPointVelocity(base.transform.position) : Vector3.zero);
                this.m_body.angularVelocity = Vector3.zero;                 this.m_body.angularVelocity = Vector3.zero;
                this.m_maxAirAltitude = base.transform.position.y;                 this.m_maxAirAltitude = base.transform.position.y;
                return;                 return;
            }             }
            this.AttachStop();             this.AttachStop();
        }         }
    }     }
   
    public override bool IsAttached()     public override bool IsAttached()
    {     {
        return this.m_attached || base.IsAttached();         return this.m_attached || base.IsAttached();
    }     }
   
    public Transform GetAttachPoint()     public Transform GetAttachPoint()
    {     {
        return this.m_attachPoint;         return this.m_attachPoint;
    }     }
   
    public Transform GetAttachCameraPoint()     public Transform GetAttachCameraPoint()
    {     {
        return this.m_attachPointCamera;         return this.m_attachPointCamera;
    }     }
   
    public void ResetAttachCameraPoint()     public void ResetAttachCameraPoint()
    {     {
        this.m_attachPointCamera = null;         this.m_attachPointCamera = null;
    }     }
   
    public override bool IsAttachedToShip()     public override bool IsAttachedToShip()
    {     {
        return this.m_attached && this.m_attachedToShip;         return this.m_attached && this.m_attachedToShip;
    }     }
   
    public override bool IsRiding()     public override bool IsRiding()
    {     {
        return this.m_doodadController != null && this.m_doodadController.IsValid() && this.m_doodadController is Sadle;         return this.m_doodadController != null && this.m_doodadController.IsValid() && this.m_doodadController is Sadle;
    }     }
   
    public override bool InBed()     public override bool InBed()
    {     {
        return this.m_nview.IsValid() && this.m_nview.GetZDO().GetBool(ZDOVars.s_inBed, false);         return this.m_nview.IsValid() && this.m_nview.GetZDO().GetBool(ZDOVars.s_inBed, false);
    }     }
   
    public override void AttachStop()     public override void AttachStop()
    {     {
        if (this.m_sleeping)         if (this.m_sleeping)
        {         {
            return;             return;
        }         }
        if (this.m_attached)         if (this.m_attached)
        {         {
            if (this.m_attachPoint != null)             if (this.m_attachPoint != null)
            {             {
                base.transform.position = this.m_attachPoint.TransformPoint(this.m_detachOffset);                 base.transform.position = this.m_attachPoint.TransformPoint(this.m_detachOffset);
            }             }
            if (this.m_attachColliders != null)             if (this.m_attachColliders != null)
            {             {
                foreach (Collider collider in this.m_attachColliders)                 foreach (Collider collider in this.m_attachColliders)
                {                 {
                    if (collider)                     if (collider)
                    {                     {
                        Physics.IgnoreCollision(this.m_collider, collider, false);                         Physics.IgnoreCollision(this.m_collider, collider, false);
                    }                     }
                }                 }
                this.m_attachColliders = null;                 this.m_attachColliders = null;
            }             }
            this.m_body.useGravity = true;             this.m_body.useGravity = true;
            this.m_attached = false;             this.m_attached = false;
            this.m_attachPoint = null;             this.m_attachPoint = null;
            this.m_attachPointCamera = null;             this.m_attachPointCamera = null;
            this.m_zanim.SetBool(this.m_attachAnimation, false);             this.m_zanim.SetBool(this.m_attachAnimation, false);
            this.m_nview.GetZDO().Set(ZDOVars.s_inBed, false);             this.m_nview.GetZDO().Set(ZDOVars.s_inBed, false);
            base.ResetCloth();             base.ResetCloth();
        }         }
    }     }
   
    public void StartDoodadControl(IDoodadController shipControl)     public void StartDoodadControl(IDoodadController shipControl)
    {     {
        this.m_doodadController = shipControl;         this.m_doodadController = shipControl;
        ZLog.Log("Doodad controlls set " + shipControl.GetControlledComponent().gameObject.name);         ZLog.Log("Doodad controlls set " + shipControl.GetControlledComponent().gameObject.name);
    }     }
   
    public void StopDoodadControl()     public void StopDoodadControl()
    {     {
        if (this.m_doodadController != null)         if (this.m_doodadController != null)
        {         {
            if (this.m_doodadController.IsValid())             if (this.m_doodadController.IsValid())
            {             {
                this.m_doodadController.OnUseStop(this);                 this.m_doodadController.OnUseStop(this);
            }             }
            ZLog.Log("Stop doodad controlls");             ZLog.Log("Stop doodad controlls");
            this.m_doodadController = null;             this.m_doodadController = null;
        }         }
    }     }
   
    private void SetDoodadControlls(ref Vector3 moveDir, ref Vector3 lookDir, ref bool run, ref bool autoRun, bool block)     private void SetDoodadControlls(ref Vector3 moveDir, ref Vector3 lookDir, ref bool run, ref bool autoRun, bool block)
    {     {
        if (this.m_doodadController.IsValid())         if (this.m_doodadController.IsValid())
        {         {
            this.m_doodadController.ApplyControlls(moveDir, lookDir, run, autoRun, block);             this.m_doodadController.ApplyControlls(moveDir, lookDir, run, autoRun, block);
        }         }
        moveDir = Vector3.zero;         moveDir = Vector3.zero;
        autoRun = false;         autoRun = false;
        run = false;         run = false;
    }     }
   
    public Ship GetControlledShip()     public Ship GetControlledShip()
    {     {
        if (this.m_doodadController != null && this.m_doodadController.IsValid())         if (this.m_doodadController != null && this.m_doodadController.IsValid())
        {         {
            return this.m_doodadController.GetControlledComponent() as Ship;             return this.m_doodadController.GetControlledComponent() as Ship;
        }         }
        return null;         return null;
    }     }
   
    public IDoodadController GetDoodadController()     public IDoodadController GetDoodadController()
    {     {
        return this.m_doodadController;         return this.m_doodadController;
    }     }
   
    private void UpdateDoodadControls(float dt)     private void UpdateDoodadControls(float dt)
    {     {
        if (this.m_doodadController == null)         if (this.m_doodadController == null)
        {         {
            return;             return;
        }         }
        if (!this.m_doodadController.IsValid())         if (!this.m_doodadController.IsValid())
        {         {
            this.StopDoodadControl();             this.StopDoodadControl();
            return;             return;
        }         }
        Vector3 forward = this.m_doodadController.GetControlledComponent().transform.forward;         Vector3 forward = this.m_doodadController.GetControlledComponent().transform.forward;
        forward.y = 0f;         forward.y = 0f;
        forward.Normalize();         forward.Normalize();
        Quaternion quaternion = Quaternion.LookRotation(forward);         Quaternion quaternion = Quaternion.LookRotation(forward);
        base.transform.rotation = Quaternion.RotateTowards(base.transform.rotation, quaternion, 100f * dt);         base.transform.rotation = Quaternion.RotateTowards(base.transform.rotation, quaternion, 100f * dt);
        if (Vector3.Distance(this.m_doodadController.GetPosition(), base.transform.position) > this.m_maxInteractDistance)         if (Vector3.Distance(this.m_doodadController.GetPosition(), base.transform.position) > this.m_maxInteractDistance)
        {         {
            this.StopDoodadControl();             this.StopDoodadControl();
        }         }
    }     }
   
    public bool IsSleeping()     public bool IsSleeping()
    {     {
        return this.m_sleeping;         return this.m_sleeping;
    }     }
   
    public void SetSleeping(bool sleep)     public void SetSleeping(bool sleep)
    {     {
        if (this.m_sleeping == sleep)         if (this.m_sleeping == sleep)
        {         {
            return;             return;
        }         }
        this.m_sleeping = sleep;         this.m_sleeping = sleep;
        if (!sleep)         if (!sleep)
        {         {
            this.Message(MessageHud.MessageType.Center, "$msg_goodmorning", 0, null);             this.Message(MessageHud.MessageType.Center, "$msg_goodmorning", 0, null);
.            this.m_seman.AddStatusEffect(Player.s_statusEffectRested, true, 0, 0f);             this.m_seman.AddStatusEffect(SEMan.s_statusEffectRested, true, 0, 0f);
            this.m_wakeupTime = DateTime.Now;             this.m_wakeupTime = ZNet.instance.GetTimeSeconds();
            Game.instance.IncrementPlayerStat(PlayerStatType.Sleep, 1f);             Game.instance.IncrementPlayerStat(PlayerStatType.Sleep, 1f);
        }         }
    }     }
   
    public void SetControls(Vector3 movedir, bool attack, bool attackHold, bool secondaryAttack, bool secondaryAttackHold, bool block, bool blockHold, bool jump, bool crouch, bool run, bool autoRun, bool dodge = false)     public void SetControls(Vector3 movedir, bool attack, bool attackHold, bool secondaryAttack, bool secondaryAttackHold, bool block, bool blockHold, bool jump, bool crouch, bool run, bool autoRun, bool dodge = false)
    {     {
        if ((this.IsAttached() || this.InEmote()) && (movedir != Vector3.zero || attack || secondaryAttack || block || blockHold || jump || crouch) && this.GetDoodadController() == null)         if ((this.IsAttached() || this.InEmote()) && (movedir != Vector3.zero || attack || secondaryAttack || block || blockHold || jump || crouch) && this.GetDoodadController() == null)
        {         {
            attack = false;             attack = false;
            attackHold = false;             attackHold = false;
            secondaryAttack = false;             secondaryAttack = false;
            secondaryAttackHold = false;             secondaryAttackHold = false;
            this.StopEmote();             this.StopEmote();
            this.AttachStop();             this.AttachStop();
        }         }
        if (this.m_doodadController != null)         if (this.m_doodadController != null)
        {         {
            this.SetDoodadControlls(ref movedir, ref this.m_lookDir, ref run, ref autoRun, blockHold);             this.SetDoodadControlls(ref movedir, ref this.m_lookDir, ref run, ref autoRun, blockHold);
            if (jump || attack || secondaryAttack || dodge)             if (jump || attack || secondaryAttack || dodge)
            {             {
                attack = false;                 attack = false;
                attackHold = false;                 attackHold = false;
                secondaryAttack = false;                 secondaryAttack = false;
                secondaryAttackHold = false;                 secondaryAttackHold = false;
                this.StopDoodadControl();                 this.StopDoodadControl();
            }             }
        }         }
        if (run)         if (run)
        {         {
            this.m_walk = false;             this.m_walk = false;
        }         }
        if (!this.m_autoRun)         if (!this.m_autoRun)
        {         {
            Vector3 lookDir = this.m_lookDir;             Vector3 lookDir = this.m_lookDir;
            lookDir.y = 0f;             lookDir.y = 0f;
            lookDir.Normalize();             lookDir.Normalize();
            this.m_moveDir = movedir.z * lookDir + movedir.x * Vector3.Cross(Vector3.up, lookDir);             this.m_moveDir = movedir.z * lookDir + movedir.x * Vector3.Cross(Vector3.up, lookDir);
        }         }
        if (!this.m_autoRun && autoRun && !this.InPlaceMode())         if (!this.m_autoRun && autoRun && !this.InPlaceMode())
        {         {
            this.m_autoRun = true;             this.m_autoRun = true;
            this.SetCrouch(false);             this.SetCrouch(false);
            this.m_moveDir = this.m_lookDir;             this.m_moveDir = this.m_lookDir;
            this.m_moveDir.y = 0f;             this.m_moveDir.y = 0f;
            this.m_moveDir.Normalize();             this.m_moveDir.Normalize();
        }         }
        else if (this.m_autoRun)         else if (this.m_autoRun)
        {         {
            if (attack || jump || dodge || crouch || movedir != Vector3.zero || this.InPlaceMode() || attackHold || secondaryAttackHold)             if (attack || jump || dodge || crouch || movedir != Vector3.zero || this.InPlaceMode() || attackHold || secondaryAttackHold)
            {             {
                this.m_autoRun = false;                 this.m_autoRun = false;
            }             }
            else if (autoRun || blockHold)             else if (autoRun || blockHold)
            {             {
                this.m_moveDir = this.m_lookDir;                 this.m_moveDir = this.m_lookDir;
                this.m_moveDir.y = 0f;                 this.m_moveDir.y = 0f;
                this.m_moveDir.Normalize();                 this.m_moveDir.Normalize();
                blockHold = false;                 blockHold = false;
                block = false;                 block = false;
            }             }
        }         }
        this.m_attack = attack;         this.m_attack = attack;
        this.m_attackHold = attackHold;         this.m_attackHold = attackHold;
        this.m_secondaryAttack = secondaryAttack;         this.m_secondaryAttack = secondaryAttack;
        this.m_secondaryAttackHold = secondaryAttackHold;         this.m_secondaryAttackHold = secondaryAttackHold;
        this.m_blocking = blockHold;         this.m_blocking = blockHold;
        this.m_run = run;         this.m_run = run;
        if (crouch)         if (crouch)
        {         {
            this.SetCrouch(!this.m_crouchToggled);             this.SetCrouch(!this.m_crouchToggled);
        }         }
        if (ZInput.InputLayout == InputLayout.Default || !ZInput.IsGamepadActive())         if (ZInput.InputLayout == InputLayout.Default || !ZInput.IsGamepadActive())
        {         {
            if (jump)             if (jump)
            {             {
                if (this.m_blocking)                 if (this.m_blocking)
                {                 {
                    Vector3 vector = this.m_moveDir;                     Vector3 vector = this.m_moveDir;
                    if (vector.magnitude < 0.1f)                     if (vector.magnitude < 0.1f)
                    {                     {
                        vector = -this.m_lookDir;                         vector = -this.m_lookDir;
                        vector.y = 0f;                         vector.y = 0f;
                        vector.Normalize();                         vector.Normalize();
                    }                     }
                    this.Dodge(vector);                     this.Dodge(vector);
                    return;                     return;
                }                 }
                if (this.IsCrouching() || this.m_crouchToggled)                 if (this.IsCrouching() || this.m_crouchToggled)
                {                 {
                    Vector3 vector2 = this.m_moveDir;                     Vector3 vector2 = this.m_moveDir;
                    if (vector2.magnitude < 0.1f)                     if (vector2.magnitude < 0.1f)
                    {                     {
                        vector2 = this.m_lookDir;                         vector2 = this.m_lookDir;
                        vector2.y = 0f;                         vector2.y = 0f;
                        vector2.Normalize();                         vector2.Normalize();
                    }                     }
                    this.Dodge(vector2);                     this.Dodge(vector2);
                    return;                     return;
                }                 }
                base.Jump(false);                 base.Jump(false);
                return;                 return;
            }             }
        }         }
        else if (ZInput.IsNonClassicFunctionality())         else if (ZInput.IsNonClassicFunctionality())
        {         {
            if (dodge)             if (dodge)
            {             {
                if (this.m_blocking)                 if (this.m_blocking)
                {                 {
                    Vector3 vector3 = this.m_moveDir;                     Vector3 vector3 = this.m_moveDir;
                    if (vector3.magnitude < 0.1f)                     if (vector3.magnitude < 0.1f)
                    {                     {
                        vector3 = -this.m_lookDir;                         vector3 = -this.m_lookDir;
                        vector3.y = 0f;                         vector3.y = 0f;
                        vector3.Normalize();                         vector3.Normalize();
                    }                     }
                    this.Dodge(vector3);                     this.Dodge(vector3);
                }                 }
                else if (this.IsCrouching() || this.m_crouchToggled)                 else if (this.IsCrouching() || this.m_crouchToggled)
                {                 {
                    Vector3 vector4 = this.m_moveDir;                     Vector3 vector4 = this.m_moveDir;
                    if (vector4.magnitude < 0.1f)                     if (vector4.magnitude < 0.1f)
                    {                     {
                        vector4 = this.m_lookDir;                         vector4 = this.m_lookDir;
                        vector4.y = 0f;                         vector4.y = 0f;
                        vector4.Normalize();                         vector4.Normalize();
                    }                     }
                    this.Dodge(vector4);                     this.Dodge(vector4);
                }                 }
            }             }
            if (jump)             if (jump)
            {             {
                base.Jump(false);                 base.Jump(false);
            }             }
        }         }
    }     }
   
    private void UpdateTargeted(float dt)     private void UpdateTargeted(float dt)
    {     {
        this.m_timeSinceTargeted += dt;         this.m_timeSinceTargeted += dt;
        this.m_timeSinceSensed += dt;         this.m_timeSinceSensed += dt;
    }     }
   
    public override void OnTargeted(bool sensed, bool alerted)     public override void OnTargeted(bool sensed, bool alerted)
    {     {
        if (sensed)         if (sensed)
        {         {
            if (this.m_timeSinceSensed > 0.5f)             if (this.m_timeSinceSensed > 0.5f)
            {             {
                this.m_timeSinceSensed = 0f;                 this.m_timeSinceSensed = 0f;
                this.m_nview.InvokeRPC("OnTargeted", new object[] { sensed, alerted });                 this.m_nview.InvokeRPC("OnTargeted", new object[] { sensed, alerted });
                return;                 return;
            }             }
        }         }
        else if (this.m_timeSinceTargeted > 0.5f)         else if (this.m_timeSinceTargeted > 0.5f)
        {         {
            this.m_timeSinceTargeted = 0f;             this.m_timeSinceTargeted = 0f;
            this.m_nview.InvokeRPC("OnTargeted", new object[] { sensed, alerted });             this.m_nview.InvokeRPC("OnTargeted", new object[] { sensed, alerted });
        }         }
    }     }
   
    private void RPC_OnTargeted(long sender, bool sensed, bool alerted)     private void RPC_OnTargeted(long sender, bool sensed, bool alerted)
    {     {
        this.m_timeSinceTargeted = 0f;         this.m_timeSinceTargeted = 0f;
        if (sensed)         if (sensed)
        {         {
            this.m_timeSinceSensed = 0f;             this.m_timeSinceSensed = 0f;
        }         }
        if (alerted)         if (alerted)
        {         {
            MusicMan.instance.ResetCombatTimer();             MusicMan.instance.ResetCombatTimer();
        }         }
    }     }
   
    protected override void OnDamaged(HitData hit)     protected override void OnDamaged(HitData hit)
    {     {
        base.OnDamaged(hit);         base.OnDamaged(hit);
        if (hit.GetTotalDamage() > base.GetMaxHealth() / 10f)         if (hit.GetTotalDamage() > base.GetMaxHealth() / 10f)
        {         {
            Hud.instance.DamageFlash();             Hud.instance.DamageFlash();
        }         }
    }     }
   
    public bool IsTargeted()     public bool IsTargeted()
    {     {
        return this.m_timeSinceTargeted < 1f;         return this.m_timeSinceTargeted < 1f;
    }     }
   
    public bool IsSensed()     public bool IsSensed()
    {     {
        return this.m_timeSinceSensed < 1f;         return this.m_timeSinceSensed < 1f;
    }     }
   
    protected override void ApplyArmorDamageMods(ref HitData.DamageModifiers mods)     protected override void ApplyArmorDamageMods(ref HitData.DamageModifiers mods)
    {     {
        if (this.m_chestItem != null)         if (this.m_chestItem != null)
        {         {
            mods.Apply(this.m_chestItem.m_shared.m_damageModifiers);             mods.Apply(this.m_chestItem.m_shared.m_damageModifiers);
        }         }
        if (this.m_legItem != null)         if (this.m_legItem != null)
        {         {
            mods.Apply(this.m_legItem.m_shared.m_damageModifiers);             mods.Apply(this.m_legItem.m_shared.m_damageModifiers);
        }         }
        if (this.m_helmetItem != null)         if (this.m_helmetItem != null)
        {         {
            mods.Apply(this.m_helmetItem.m_shared.m_damageModifiers);             mods.Apply(this.m_helmetItem.m_shared.m_damageModifiers);
        }         }
        if (this.m_shoulderItem != null)         if (this.m_shoulderItem != null)
        {         {
            mods.Apply(this.m_shoulderItem.m_shared.m_damageModifiers);             mods.Apply(this.m_shoulderItem.m_shared.m_damageModifiers);
        }         }
    }     }
   
    public override float GetBodyArmor()     public override float GetBodyArmor()
    {     {
        float num = 0f;         float num = 0f;
        if (this.m_chestItem != null)         if (this.m_chestItem != null)
        {         {
            num += this.m_chestItem.GetArmor();             num += this.m_chestItem.GetArmor();
        }         }
        if (this.m_legItem != null)         if (this.m_legItem != null)
        {         {
            num += this.m_legItem.GetArmor();             num += this.m_legItem.GetArmor();
        }         }
        if (this.m_helmetItem != null)         if (this.m_helmetItem != null)
        {         {
            num += this.m_helmetItem.GetArmor();             num += this.m_helmetItem.GetArmor();
        }         }
        if (this.m_shoulderItem != null)         if (this.m_shoulderItem != null)
        {         {
            num += this.m_shoulderItem.GetArmor();             num += this.m_shoulderItem.GetArmor();
        }         }
        return num;         return num;
    }     }
   
    protected override void OnSneaking(float dt)     protected override void OnSneaking(float dt)
    {     {
        float num = Mathf.Pow(this.m_skills.GetSkillFactor(Skills.SkillType.Sneak), 0.5f);         float num = Mathf.Pow(this.m_skills.GetSkillFactor(Skills.SkillType.Sneak), 0.5f);
        float num2 = Mathf.Lerp(1f, 0.25f, num);         float num2 = Mathf.Lerp(1f, 0.25f, num);
.        this.UseStamina(dt * this.m_sneakStaminaDrain * num2, false);         float num3 = dt * this.m_sneakStaminaDrain * num2; 
          num3 += num3 * this.GetEquipmentSneakStaminaModifier(); 
          this.m_seman.ModifySneakStaminaUsage(num3, ref num3, true); 
          this.UseStamina(num3, false);
        if (!this.HaveStamina(0f))         if (!this.HaveStamina(0f))
        {         {
            Hud.instance.StaminaBarEmptyFlash();             Hud.instance.StaminaBarEmptyFlash();
        }         }
        this.m_sneakSkillImproveTimer += dt;         this.m_sneakSkillImproveTimer += dt;
        if (this.m_sneakSkillImproveTimer > 1f)         if (this.m_sneakSkillImproveTimer > 1f)
        {         {
            this.m_sneakSkillImproveTimer = 0f;             this.m_sneakSkillImproveTimer = 0f;
            if (BaseAI.InStealthRange(this))             if (BaseAI.InStealthRange(this))
            {             {
                this.RaiseSkill(Skills.SkillType.Sneak, 1f);                 this.RaiseSkill(Skills.SkillType.Sneak, 1f);
                return;                 return;
            }             }
            this.RaiseSkill(Skills.SkillType.Sneak, 0.1f);             this.RaiseSkill(Skills.SkillType.Sneak, 0.1f);
        }         }
    }     }
   
    private void UpdateStealth(float dt)     private void UpdateStealth(float dt)
    {     {
        this.m_stealthFactorUpdateTimer += dt;         this.m_stealthFactorUpdateTimer += dt;
        if (this.m_stealthFactorUpdateTimer > 0.5f)         if (this.m_stealthFactorUpdateTimer > 0.5f)
        {         {
            this.m_stealthFactorUpdateTimer = 0f;             this.m_stealthFactorUpdateTimer = 0f;
            this.m_stealthFactorTarget = 0f;             this.m_stealthFactorTarget = 0f;
            if (this.IsCrouching())             if (this.IsCrouching())
            {             {
                this.m_lastStealthPosition = base.transform.position;                 this.m_lastStealthPosition = base.transform.position;
                float skillFactor = this.m_skills.GetSkillFactor(Skills.SkillType.Sneak);                 float skillFactor = this.m_skills.GetSkillFactor(Skills.SkillType.Sneak);
                float lightFactor = StealthSystem.instance.GetLightFactor(base.GetCenterPoint());                 float lightFactor = StealthSystem.instance.GetLightFactor(base.GetCenterPoint());
                this.m_stealthFactorTarget = Mathf.Lerp(0.5f + lightFactor * 0.5f, 0.2f + lightFactor * 0.4f, skillFactor);                 this.m_stealthFactorTarget = Mathf.Lerp(0.5f + lightFactor * 0.5f, 0.2f + lightFactor * 0.4f, skillFactor);
                this.m_stealthFactorTarget = Mathf.Clamp01(this.m_stealthFactorTarget);                 this.m_stealthFactorTarget = Mathf.Clamp01(this.m_stealthFactorTarget);
                this.m_seman.ModifyStealth(this.m_stealthFactorTarget, ref this.m_stealthFactorTarget);                 this.m_seman.ModifyStealth(this.m_stealthFactorTarget, ref this.m_stealthFactorTarget);
                this.m_stealthFactorTarget = Mathf.Clamp01(this.m_stealthFactorTarget);                 this.m_stealthFactorTarget = Mathf.Clamp01(this.m_stealthFactorTarget);
            }             }
            else             else
            {             {
                this.m_stealthFactorTarget = 1f;                 this.m_stealthFactorTarget = 1f;
            }             }
        }         }
        this.m_stealthFactor = Mathf.MoveTowards(this.m_stealthFactor, this.m_stealthFactorTarget, dt / 4f);         this.m_stealthFactor = Mathf.MoveTowards(this.m_stealthFactor, this.m_stealthFactorTarget, dt / 4f);
        this.m_nview.GetZDO().Set(ZDOVars.s_stealth, this.m_stealthFactor);         this.m_nview.GetZDO().Set(ZDOVars.s_stealth, this.m_stealthFactor);
    }     }
   
    public override float GetStealthFactor()     public override float GetStealthFactor()
    {     {
        if (!this.m_nview.IsValid())         if (!this.m_nview.IsValid())
        {         {
            return 0f;             return 0f;
        }         }
        if (this.m_nview.IsOwner())         if (this.m_nview.IsOwner())
        {         {
            return this.m_stealthFactor;             return this.m_stealthFactor;
        }         }
        return this.m_nview.GetZDO().GetFloat(ZDOVars.s_stealth, 0f);         return this.m_nview.GetZDO().GetFloat(ZDOVars.s_stealth, 0f);
    }     }
   
    public override bool InAttack()     public override bool InAttack()
    {     {
        if (MonoUpdaters.UpdateCount == this.m_cachedFrame)         if (MonoUpdaters.UpdateCount == this.m_cachedFrame)
        {         {
            return this.m_cachedAttack;             return this.m_cachedAttack;
        }         }
        this.m_cachedFrame = MonoUpdaters.UpdateCount;         this.m_cachedFrame = MonoUpdaters.UpdateCount;
        if (base.GetNextOrCurrentAnimHash() == Humanoid.s_animatorTagAttack)         if (base.GetNextOrCurrentAnimHash() == Humanoid.s_animatorTagAttack)
        {         {
            this.m_cachedAttack = true;             this.m_cachedAttack = true;
            return true;             return true;
        }         }
        for (int i = 1; i < this.m_animator.layerCount; i++)         for (int i = 1; i < this.m_animator.layerCount; i++)
        {         {
            if ((this.m_animator.IsInTransition(i) ? this.m_animator.GetNextAnimatorStateInfo(i).tagHash : this.m_animator.GetCurrentAnimatorStateInfo(i).tagHash) == Humanoid.s_animatorTagAttack)             if ((this.m_animator.IsInTransition(i) ? this.m_animator.GetNextAnimatorStateInfo(i).tagHash : this.m_animator.GetCurrentAnimatorStateInfo(i).tagHash) == Humanoid.s_animatorTagAttack)
            {             {
                this.m_cachedAttack = true;                 this.m_cachedAttack = true;
                return true;                 return true;
            }             }
        }         }
        this.m_cachedAttack = false;         this.m_cachedAttack = false;
        return false;         return false;
    }     }
   
.      private float GetEquipmentModifier(int index)
      {
          if (this.m_equipmentModifierValues != null)
          {
              return this.m_equipmentModifierValues[index];
          }
          return 0f;
      }
   
    public override float GetEquipmentMovementModifier()     public override float GetEquipmentMovementModifier()
    {     {
.        return this.m_equipmentMovementModifier;         return this.GetEquipmentModifier(0);
      } 
   
      public override float GetEquipmentHomeItemModifier() 
      { 
          return this.GetEquipmentModifier(1); 
      } 
   
      public override float GetEquipmentHeatResistanceModifier() 
      { 
          return this.GetEquipmentModifier(2); 
      } 
   
      public override float GetEquipmentJumpStaminaModifier() 
      { 
          return this.GetEquipmentModifier(3); 
      } 
   
      public override float GetEquipmentAttackStaminaModifier() 
      { 
          return this.GetEquipmentModifier(4); 
      } 
   
      public override float GetEquipmentBlockStaminaModifier() 
      { 
          return this.GetEquipmentModifier(5); 
      } 
   
      public override float GetEquipmentDodgeStaminaModifier() 
      { 
          return this.GetEquipmentModifier(6); 
    }     }
   
.    public override float GetEquipmentBaseItemModifier()     public override float GetEquipmentSwimStaminaModifier()
    {     {
.        return this.m_equipmentBaseItemModifier;         return this.GetEquipmentModifier(7);
      } 
   
      public override float GetEquipmentSneakStaminaModifier() 
      { 
          return this.GetEquipmentModifier(8); 
      } 
   
      public override float GetEquipmentRunStaminaModifier() 
      { 
          return this.GetEquipmentModifier(9); 
      } 
   
      private float GetEquipmentModifierPlusSE(int index) 
      { 
          float num = this.m_equipmentModifierValues[index]; 
          switch (index) 
          { 
          case 3: 
              this.m_seman.ModifyJumpStaminaUsage(1f, ref num, false); 
              break; 
          case 4: 
              this.m_seman.ModifyAttackStaminaUsage(1f, ref num, false); 
              break; 
          case 5: 
              this.m_seman.ModifyBlockStaminaUsage(1f, ref num, false); 
              break; 
          case 6: 
              this.m_seman.ModifyDodgeStaminaUsage(1f, ref num, false); 
              break; 
          case 7: 
              this.m_seman.ModifySwimStaminaUsage(1f, ref num, false); 
              break; 
          case 8: 
              this.m_seman.ModifySneakStaminaUsage(1f, ref num, false); 
              break; 
          case 9: 
              this.m_seman.ModifyRunStaminaDrain(1f, ref num, false); 
              break; 
          } 
          return num; 
    }     }
   
    protected override float GetJogSpeedFactor()     protected override float GetJogSpeedFactor()
    {     {
.        return 1f + this.m_equipmentMovementModifier;         return 1f + this.GetEquipmentMovementModifier();
    }     }
   
    protected override float GetRunSpeedFactor()     protected override float GetRunSpeedFactor()
    {     {
        float skillFactor = this.m_skills.GetSkillFactor(Skills.SkillType.Run);         float skillFactor = this.m_skills.GetSkillFactor(Skills.SkillType.Run);
.        return (1f + skillFactor * 0.25f) * (1f + this.m_equipmentMovementModifier * 1.5f);         return (1f + skillFactor * 0.25f) * (1f + this.GetEquipmentMovementModifier() * 1.5f);
    }     }
   
    public override bool InMinorAction()     public override bool InMinorAction()
    {     {
        int tagHash = this.m_animator.GetCurrentAnimatorStateInfo(1).tagHash;         int tagHash = this.m_animator.GetCurrentAnimatorStateInfo(1).tagHash;
        if (tagHash == Player.s_animatorTagMinorAction || tagHash == Player.s_animatorTagMinorActionFast)         if (tagHash == Player.s_animatorTagMinorAction || tagHash == Player.s_animatorTagMinorActionFast)
        {         {
            return true;             return true;
        }         }
        if (this.m_animator.IsInTransition(1))         if (this.m_animator.IsInTransition(1))
        {         {
            int tagHash2 = this.m_animator.GetNextAnimatorStateInfo(1).tagHash;             int tagHash2 = this.m_animator.GetNextAnimatorStateInfo(1).tagHash;
            return tagHash2 == Player.s_animatorTagMinorAction || tagHash2 == Player.s_animatorTagMinorActionFast;             return tagHash2 == Player.s_animatorTagMinorAction || tagHash2 == Player.s_animatorTagMinorActionFast;
        }         }
        return false;         return false;
    }     }
   
    public override bool InMinorActionSlowdown()     public override bool InMinorActionSlowdown()
    {     {
        return this.m_animator.GetCurrentAnimatorStateInfo(1).tagHash == Player.s_animatorTagMinorAction || (this.m_animator.IsInTransition(1) && this.m_animator.GetNextAnimatorStateInfo(1).tagHash == Player.s_animatorTagMinorAction);         return this.m_animator.GetCurrentAnimatorStateInfo(1).tagHash == Player.s_animatorTagMinorAction || (this.m_animator.IsInTransition(1) && this.m_animator.GetNextAnimatorStateInfo(1).tagHash == Player.s_animatorTagMinorAction);
    }     }
   
    public override bool GetRelativePosition(out ZDOID parent, out string attachJoint, out Vector3 relativePos, out Quaternion relativeRot, out Vector3 relativeVel)     public override bool GetRelativePosition(out ZDOID parent, out string attachJoint, out Vector3 relativePos, out Quaternion relativeRot, out Vector3 relativeVel)
    {     {
        if (this.m_attached && this.m_attachPoint)         if (this.m_attached && this.m_attachPoint)
        {         {
            ZNetView componentInParent = this.m_attachPoint.GetComponentInParent<ZNetView>();             ZNetView componentInParent = this.m_attachPoint.GetComponentInParent<ZNetView>();
            if (componentInParent && componentInParent.IsValid())             if (componentInParent && componentInParent.IsValid())
            {             {
                parent = componentInParent.GetZDO().m_uid;                 parent = componentInParent.GetZDO().m_uid;
                if (componentInParent.GetComponent<Character>() != null)                 if (componentInParent.GetComponent<Character>() != null)
                {                 {
                    attachJoint = this.m_attachPoint.name;                     attachJoint = this.m_attachPoint.name;
                    relativePos = Vector3.zero;                     relativePos = Vector3.zero;
                    relativeRot = Quaternion.identity;                     relativeRot = Quaternion.identity;
                }                 }
                else                 else
                {                 {
                    attachJoint = "";                     attachJoint = "";
                    relativePos = componentInParent.transform.InverseTransformPoint(base.transform.position);                     relativePos = componentInParent.transform.InverseTransformPoint(base.transform.position);
                    relativeRot = Quaternion.Inverse(componentInParent.transform.rotation) * base.transform.rotation;                     relativeRot = Quaternion.Inverse(componentInParent.transform.rotation) * base.transform.rotation;
                }                 }
                relativeVel = Vector3.zero;                 relativeVel = Vector3.zero;
                return true;                 return true;
            }             }
        }         }
        return base.GetRelativePosition(out parent, out attachJoint, out relativePos, out relativeRot, out relativeVel);         return base.GetRelativePosition(out parent, out attachJoint, out relativePos, out relativeRot, out relativeVel);
    }     }
   
    public override Skills GetSkills()     public override Skills GetSkills()
    {     {
        return this.m_skills;         return this.m_skills;
    }     }
   
    public override float GetRandomSkillFactor(Skills.SkillType skill)     public override float GetRandomSkillFactor(Skills.SkillType skill)
    {     {
        return this.m_skills.GetRandomSkillFactor(skill);         return this.m_skills.GetRandomSkillFactor(skill);
    }     }
   
    public override float GetSkillFactor(Skills.SkillType skill)     public override float GetSkillFactor(Skills.SkillType skill)
    {     {
        return this.m_skills.GetSkillFactor(skill);         return this.m_skills.GetSkillFactor(skill);
    }     }
   
    protected override void DoDamageCameraShake(HitData hit)     protected override void DoDamageCameraShake(HitData hit)
    {     {
        float totalStaggerDamage = hit.m_damage.GetTotalStaggerDamage();         float totalStaggerDamage = hit.m_damage.GetTotalStaggerDamage();
        if (GameCamera.instance && totalStaggerDamage > 0f)         if (GameCamera.instance && totalStaggerDamage > 0f)
        {         {
            float num = Mathf.Clamp01(totalStaggerDamage / base.GetMaxHealth());             float num = Mathf.Clamp01(totalStaggerDamage / base.GetMaxHealth());
            GameCamera.instance.AddShake(base.transform.position, 50f, this.m_baseCameraShake * num, false);             GameCamera.instance.AddShake(base.transform.position, 50f, this.m_baseCameraShake * num, false);
        }         }
    }     }
   
    protected override void DamageArmorDurability(HitData hit)     protected override void DamageArmorDurability(HitData hit)
    {     {
        List<ItemDrop.ItemData> list = new List<ItemDrop.ItemData>();         List<ItemDrop.ItemData> list = new List<ItemDrop.ItemData>();
        if (this.m_chestItem != null)         if (this.m_chestItem != null)
        {         {
            list.Add(this.m_chestItem);             list.Add(this.m_chestItem);
        }         }
        if (this.m_legItem != null)         if (this.m_legItem != null)
        {         {
            list.Add(this.m_legItem);             list.Add(this.m_legItem);
        }         }
        if (this.m_helmetItem != null)         if (this.m_helmetItem != null)
        {         {
            list.Add(this.m_helmetItem);             list.Add(this.m_helmetItem);
        }         }
        if (this.m_shoulderItem != null)         if (this.m_shoulderItem != null)
        {         {
            list.Add(this.m_shoulderItem);             list.Add(this.m_shoulderItem);
        }         }
        if (list.Count == 0)         if (list.Count == 0)
        {         {
            return;             return;
        }         }
        float num = hit.GetTotalPhysicalDamage() + hit.GetTotalElementalDamage();         float num = hit.GetTotalPhysicalDamage() + hit.GetTotalElementalDamage();
        if (num <= 0f)         if (num <= 0f)
        {         {
            return;             return;
        }         }
        int num2 = UnityEngine.Random.Range(0, list.Count);         int num2 = UnityEngine.Random.Range(0, list.Count);
        ItemDrop.ItemData itemData = list[num2];         ItemDrop.ItemData itemData = list[num2];
        itemData.m_durability = Mathf.Max(0f, itemData.m_durability - num);         itemData.m_durability = Mathf.Max(0f, itemData.m_durability - num);
    }     }
   
    protected override bool ToggleEquipped(ItemDrop.ItemData item)     protected override bool ToggleEquipped(ItemDrop.ItemData item)
    {     {
        if (!item.IsEquipable())         if (!item.IsEquipable())
        {         {
            return false;             return false;
        }         }
        if (this.InAttack())         if (this.InAttack())
        {         {
            return true;             return true;
        }         }
        if (item.m_shared.m_equipDuration <= 0f)         if (item.m_shared.m_equipDuration <= 0f)
        {         {
            if (base.IsItemEquiped(item))             if (base.IsItemEquiped(item))
            {             {
                base.UnequipItem(item, true);                 base.UnequipItem(item, true);
            }             }
            else             else
            {             {
                base.EquipItem(item, true);                 base.EquipItem(item, true);
            }             }
        }         }
        else if (base.IsItemEquiped(item))         else if (base.IsItemEquiped(item))
        {         {
            this.QueueUnequipAction(item);             this.QueueUnequipAction(item);
        }         }
        else         else
        {         {
            this.QueueEquipAction(item);             this.QueueEquipAction(item);
        }         }
        return true;         return true;
    }     }
   
    public void GetActionProgress(out string name, out float progress)     public void GetActionProgress(out string name, out float progress)
    {     {
        if (this.m_actionQueue.Count > 0)         if (this.m_actionQueue.Count > 0)
        {         {
            Player.MinorActionData minorActionData = this.m_actionQueue[0];             Player.MinorActionData minorActionData = this.m_actionQueue[0];
            if (minorActionData.m_duration > 0.5f)             if (minorActionData.m_duration > 0.5f)
            {             {
                float num = Mathf.Clamp01(minorActionData.m_time / minorActionData.m_duration);                 float num = Mathf.Clamp01(minorActionData.m_time / minorActionData.m_duration);
                if (num > 0f)                 if (num > 0f)
                {                 {
                    name = minorActionData.m_progressText;                     name = minorActionData.m_progressText;
                    progress = num;                     progress = num;
                    return;                     return;
                }                 }
            }             }
        }         }
        name = null;         name = null;
        progress = 0f;         progress = 0f;
    }     }
   
    private void UpdateActionQueue(float dt)     private void UpdateActionQueue(float dt)
    {     {
        if (this.m_actionQueuePause > 0f)         if (this.m_actionQueuePause > 0f)
        {         {
            this.m_actionQueuePause -= dt;             this.m_actionQueuePause -= dt;
            if (this.m_actionAnimation != null)             if (this.m_actionAnimation != null)
            {             {
                this.m_zanim.SetBool(this.m_actionAnimation, false);                 this.m_zanim.SetBool(this.m_actionAnimation, false);
                this.m_actionAnimation = null;                 this.m_actionAnimation = null;
            }             }
            return;             return;
        }         }
        if (this.InAttack())         if (this.InAttack())
        {         {
            if (this.m_actionAnimation != null)             if (this.m_actionAnimation != null)
            {             {
                this.m_zanim.SetBool(this.m_actionAnimation, false);                 this.m_zanim.SetBool(this.m_actionAnimation, false);
                this.m_actionAnimation = null;                 this.m_actionAnimation = null;
            }             }
            return;             return;
        }         }
        if (this.m_actionQueue.Count == 0)         if (this.m_actionQueue.Count == 0)
        {         {
            if (this.m_actionAnimation != null)             if (this.m_actionAnimation != null)
            {             {
                this.m_zanim.SetBool(this.m_actionAnimation, false);                 this.m_zanim.SetBool(this.m_actionAnimation, false);
                this.m_actionAnimation = null;                 this.m_actionAnimation = null;
            }             }
            return;             return;
        }         }
        Player.MinorActionData minorActionData = this.m_actionQueue[0];         Player.MinorActionData minorActionData = this.m_actionQueue[0];
        if (this.m_actionAnimation != null && this.m_actionAnimation != minorActionData.m_animation)         if (this.m_actionAnimation != null && this.m_actionAnimation != minorActionData.m_animation)
        {         {
            this.m_zanim.SetBool(this.m_actionAnimation, false);             this.m_zanim.SetBool(this.m_actionAnimation, false);
            this.m_actionAnimation = null;             this.m_actionAnimation = null;
        }         }
        this.m_zanim.SetBool(minorActionData.m_animation, true);         this.m_zanim.SetBool(minorActionData.m_animation, true);
        this.m_actionAnimation = minorActionData.m_animation;         this.m_actionAnimation = minorActionData.m_animation;
        if (minorActionData.m_time == 0f && minorActionData.m_startEffect != null)         if (minorActionData.m_time == 0f && minorActionData.m_startEffect != null)
        {         {
            minorActionData.m_startEffect.Create(base.transform.position, Quaternion.identity, null, 1f, -1);             minorActionData.m_startEffect.Create(base.transform.position, Quaternion.identity, null, 1f, -1);
        }         }
        if (minorActionData.m_staminaDrain > 0f)         if (minorActionData.m_staminaDrain > 0f)
        {         {
            this.UseStamina(minorActionData.m_staminaDrain * dt, false);             this.UseStamina(minorActionData.m_staminaDrain * dt, false);
        }         }
.          if (minorActionData.m_eitrDrain > 0f)
          {
              this.UseEitr(minorActionData.m_eitrDrain * dt);
          }
        minorActionData.m_time += dt;         minorActionData.m_time += dt;
        if (minorActionData.m_time > minorActionData.m_duration)         if (minorActionData.m_time > minorActionData.m_duration)
        {         {
            this.m_actionQueue.RemoveAt(0);             this.m_actionQueue.RemoveAt(0);
            this.m_zanim.SetBool(this.m_actionAnimation, false);             this.m_zanim.SetBool(this.m_actionAnimation, false);
            this.m_actionAnimation = null;             this.m_actionAnimation = null;
            if (!string.IsNullOrEmpty(minorActionData.m_doneAnimation))             if (!string.IsNullOrEmpty(minorActionData.m_doneAnimation))
            {             {
                this.m_zanim.SetTrigger(minorActionData.m_doneAnimation);                 this.m_zanim.SetTrigger(minorActionData.m_doneAnimation);
            }             }
            switch (minorActionData.m_type)             switch (minorActionData.m_type)
            {             {
            case Player.MinorActionData.ActionType.Equip:             case Player.MinorActionData.ActionType.Equip:
                base.EquipItem(minorActionData.m_item, true);                 base.EquipItem(minorActionData.m_item, true);
                break;                 break;
            case Player.MinorActionData.ActionType.Unequip:             case Player.MinorActionData.ActionType.Unequip:
                base.UnequipItem(minorActionData.m_item, true);                 base.UnequipItem(minorActionData.m_item, true);
                break;                 break;
            case Player.MinorActionData.ActionType.Reload:             case Player.MinorActionData.ActionType.Reload:
                this.SetWeaponLoaded(minorActionData.m_item);                 this.SetWeaponLoaded(minorActionData.m_item);
                break;                 break;
            }             }
            this.m_actionQueuePause = 0.3f;             this.m_actionQueuePause = 0.3f;
        }         }
    }     }
   
    private void QueueEquipAction(ItemDrop.ItemData item)     private void QueueEquipAction(ItemDrop.ItemData item)
    {     {
        if (item == null)         if (item == null)
        {         {
            return;             return;
        }         }
        if (this.IsEquipActionQueued(item))         if (this.IsEquipActionQueued(item))
        {         {
            this.RemoveEquipAction(item);             this.RemoveEquipAction(item);
            return;             return;
        }         }
        this.CancelReloadAction();         this.CancelReloadAction();
        Player.MinorActionData minorActionData = new Player.MinorActionData();         Player.MinorActionData minorActionData = new Player.MinorActionData();
        minorActionData.m_item = item;         minorActionData.m_item = item;
        minorActionData.m_type = Player.MinorActionData.ActionType.Equip;         minorActionData.m_type = Player.MinorActionData.ActionType.Equip;
        minorActionData.m_duration = item.m_shared.m_equipDuration;         minorActionData.m_duration = item.m_shared.m_equipDuration;
        minorActionData.m_progressText = "$hud_equipping " + item.m_shared.m_name;         minorActionData.m_progressText = "$hud_equipping " + item.m_shared.m_name;
        minorActionData.m_animation = "equipping";         minorActionData.m_animation = "equipping";
        if (minorActionData.m_duration >= 1f)         if (minorActionData.m_duration >= 1f)
        {         {
            minorActionData.m_startEffect = this.m_equipStartEffects;             minorActionData.m_startEffect = this.m_equipStartEffects;
        }         }
        this.m_actionQueue.Add(minorActionData);         this.m_actionQueue.Add(minorActionData);
    }     }
   
    private void QueueUnequipAction(ItemDrop.ItemData item)     private void QueueUnequipAction(ItemDrop.ItemData item)
    {     {
        if (item == null)         if (item == null)
        {         {
            return;             return;
        }         }
        if (this.IsEquipActionQueued(item))         if (this.IsEquipActionQueued(item))
        {         {
            this.RemoveEquipAction(item);             this.RemoveEquipAction(item);
            return;             return;
        }         }
        this.CancelReloadAction();         this.CancelReloadAction();
        Player.MinorActionData minorActionData = new Player.MinorActionData();         Player.MinorActionData minorActionData = new Player.MinorActionData();
        minorActionData.m_item = item;         minorActionData.m_item = item;
        minorActionData.m_type = Player.MinorActionData.ActionType.Unequip;         minorActionData.m_type = Player.MinorActionData.ActionType.Unequip;
        minorActionData.m_duration = item.m_shared.m_equipDuration;         minorActionData.m_duration = item.m_shared.m_equipDuration;
        minorActionData.m_progressText = "$hud_unequipping " + item.m_shared.m_name;         minorActionData.m_progressText = "$hud_unequipping " + item.m_shared.m_name;
        minorActionData.m_animation = "equipping";         minorActionData.m_animation = "equipping";
        this.m_actionQueue.Add(minorActionData);         this.m_actionQueue.Add(minorActionData);
    }     }
   
    private void QueueReloadAction()     private void QueueReloadAction()
    {     {
        if (this.IsReloadActionQueued())         if (this.IsReloadActionQueued())
        {         {
            return;             return;
        }         }
        ItemDrop.ItemData currentWeapon = base.GetCurrentWeapon();         ItemDrop.ItemData currentWeapon = base.GetCurrentWeapon();
        if (currentWeapon == null || !currentWeapon.m_shared.m_attack.m_requiresReload)         if (currentWeapon == null || !currentWeapon.m_shared.m_attack.m_requiresReload)
        {         {
            return;             return;
        }         }
        Player.MinorActionData minorActionData = new Player.MinorActionData();         Player.MinorActionData minorActionData = new Player.MinorActionData();
        minorActionData.m_item = currentWeapon;         minorActionData.m_item = currentWeapon;
        minorActionData.m_type = Player.MinorActionData.ActionType.Reload;         minorActionData.m_type = Player.MinorActionData.ActionType.Reload;
        minorActionData.m_duration = currentWeapon.GetWeaponLoadingTime();         minorActionData.m_duration = currentWeapon.GetWeaponLoadingTime();
        minorActionData.m_progressText = "$hud_reloading " + currentWeapon.m_shared.m_name;         minorActionData.m_progressText = "$hud_reloading " + currentWeapon.m_shared.m_name;
        minorActionData.m_animation = currentWeapon.m_shared.m_attack.m_reloadAnimation;         minorActionData.m_animation = currentWeapon.m_shared.m_attack.m_reloadAnimation;
        minorActionData.m_doneAnimation = currentWeapon.m_shared.m_attack.m_reloadAnimation + "_done";         minorActionData.m_doneAnimation = currentWeapon.m_shared.m_attack.m_reloadAnimation + "_done";
        minorActionData.m_staminaDrain = currentWeapon.m_shared.m_attack.m_reloadStaminaDrain;         minorActionData.m_staminaDrain = currentWeapon.m_shared.m_attack.m_reloadStaminaDrain;
.          minorActionData.m_eitrDrain = currentWeapon.m_shared.m_attack.m_reloadEitrDrain;
        this.m_actionQueue.Add(minorActionData);         this.m_actionQueue.Add(minorActionData);
    }     }
   
    protected override void ClearActionQueue()     protected override void ClearActionQueue()
    {     {
        this.m_actionQueue.Clear();         this.m_actionQueue.Clear();
    }     }
   
    public override void RemoveEquipAction(ItemDrop.ItemData item)     public override void RemoveEquipAction(ItemDrop.ItemData item)
    {     {
        if (item == null)         if (item == null)
        {         {
            return;             return;
        }         }
        foreach (Player.MinorActionData minorActionData in this.m_actionQueue)         foreach (Player.MinorActionData minorActionData in this.m_actionQueue)
        {         {
            if (minorActionData.m_item == item)             if (minorActionData.m_item == item)
            {             {
                this.m_actionQueue.Remove(minorActionData);                 this.m_actionQueue.Remove(minorActionData);
                break;                 break;
            }             }
        }         }
    }     }
   
    public bool IsEquipActionQueued(ItemDrop.ItemData item)     public bool IsEquipActionQueued(ItemDrop.ItemData item)
    {     {
        if (item == null)         if (item == null)
        {         {
            return false;             return false;
        }         }
        foreach (Player.MinorActionData minorActionData in this.m_actionQueue)         foreach (Player.MinorActionData minorActionData in this.m_actionQueue)
        {         {
            if ((minorActionData.m_type == Player.MinorActionData.ActionType.Equip || minorActionData.m_type == Player.MinorActionData.ActionType.Unequip) && minorActionData.m_item == item)             if ((minorActionData.m_type == Player.MinorActionData.ActionType.Equip || minorActionData.m_type == Player.MinorActionData.ActionType.Unequip) && minorActionData.m_item == item)
            {             {
                return true;                 return true;
            }             }
        }         }
        return false;         return false;
    }     }
   
    private bool IsReloadActionQueued()     private bool IsReloadActionQueued()
    {     {
        using (List<Player.MinorActionData>.Enumerator enumerator = this.m_actionQueue.GetEnumerator())         using (List<Player.MinorActionData>.Enumerator enumerator = this.m_actionQueue.GetEnumerator())
        {         {
            while (enumerator.MoveNext())             while (enumerator.MoveNext())
            {             {
                if (enumerator.Current.m_type == Player.MinorActionData.ActionType.Reload)                 if (enumerator.Current.m_type == Player.MinorActionData.ActionType.Reload)
                {                 {
                    return true;                     return true;
                }                 }
            }             }
        }         }
        return false;         return false;
    }     }
   
    public void ResetCharacter()     public void ResetCharacter()
    {     {
        this.m_guardianPowerCooldown = 0f;         this.m_guardianPowerCooldown = 0f;
        Player.ResetSeenTutorials();         Player.ResetSeenTutorials();
        this.m_knownRecipes.Clear();         this.m_knownRecipes.Clear();
        this.m_knownStations.Clear();         this.m_knownStations.Clear();
        this.m_knownMaterial.Clear();         this.m_knownMaterial.Clear();
        this.m_uniques.Clear();         this.m_uniques.Clear();
        this.m_trophies.Clear();         this.m_trophies.Clear();
        this.m_skills.Clear();         this.m_skills.Clear();
        this.m_knownBiome.Clear();         this.m_knownBiome.Clear();
        this.m_knownTexts.Clear();         this.m_knownTexts.Clear();
    }     }
   
    public void ResetCharacterKnownItems()     public void ResetCharacterKnownItems()
    {     {
        this.m_knownRecipes.Clear();         this.m_knownRecipes.Clear();
        this.m_knownStations.Clear();         this.m_knownStations.Clear();
        this.m_knownMaterial.Clear();         this.m_knownMaterial.Clear();
        this.m_trophies.Clear();         this.m_trophies.Clear();
    }     }
   
    public bool ToggleDebugFly()     public bool ToggleDebugFly()
    {     {
        this.m_debugFly = !this.m_debugFly;         this.m_debugFly = !this.m_debugFly;
        this.m_nview.GetZDO().Set(ZDOVars.s_debugFly, this.m_debugFly);         this.m_nview.GetZDO().Set(ZDOVars.s_debugFly, this.m_debugFly);
        this.Message(MessageHud.MessageType.TopLeft, "Debug fly:" + this.m_debugFly.ToString(), 0, null);         this.Message(MessageHud.MessageType.TopLeft, "Debug fly:" + this.m_debugFly.ToString(), 0, null);
        return this.m_debugFly;         return this.m_debugFly;
    }     }
   
    public void SetNoPlacementCost(bool value)     public void SetNoPlacementCost(bool value)
    {     {
        if (value != this.m_noPlacementCost)         if (value != this.m_noPlacementCost)
        {         {
            this.ToggleNoPlacementCost();             this.ToggleNoPlacementCost();
        }         }
    }     }
   
    public bool ToggleNoPlacementCost()     public bool ToggleNoPlacementCost()
    {     {
        this.m_noPlacementCost = !this.m_noPlacementCost;         this.m_noPlacementCost = !this.m_noPlacementCost;
        this.Message(MessageHud.MessageType.TopLeft, "No placement cost:" + this.m_noPlacementCost.ToString(), 0, null);         this.Message(MessageHud.MessageType.TopLeft, "No placement cost:" + this.m_noPlacementCost.ToString(), 0, null);
        this.UpdateAvailablePiecesList();         this.UpdateAvailablePiecesList();
        return this.m_noPlacementCost;         return this.m_noPlacementCost;
    }     }
   
    public bool IsKnownMaterial(string name)     public bool IsKnownMaterial(string name)
    {     {
        return this.m_knownMaterial.Contains(name);         return this.m_knownMaterial.Contains(name);
    }     }
   
    public bool AlternativePlacementActive     public bool AlternativePlacementActive
    {     {
        get         get
        {         {
            return this.m_altPlace;             return this.m_altPlace;
        }         }
    }     }
   
    public SeasonalItemGroup CurrentSeason     public SeasonalItemGroup CurrentSeason
    {     {
        get         get
        {         {
            return this.m_currentSeason;             return this.m_currentSeason;
        }         }
    }     }
   
    private Vector3 m_lastDistCheck;     private Vector3 m_lastDistCheck;
   
    private float m_statCheck;     private float m_statCheck;
   
    [Header("Effects")]     [Header("Effects")]
    public EffectList m_buttonEffects = new EffectList();     public EffectList m_buttonEffects = new EffectList();
   
    private List<string> m_readyEvents = new List<string>();     private List<string> m_readyEvents = new List<string>();
   
.      private float[] m_equipmentModifierValues;
   
      private static FieldInfo[] s_equipmentModifierSourceFields;
   
      private static readonly string[] s_equipmentModifierSources = new string[] { "m_movementModifier", "m_homeItemsStaminaModifier", "m_heatResistanceModifier", "m_jumpStaminaModifier", "m_attackStaminaModifier", "m_blockStaminaModifier", "m_dodgeStaminaModifier", "m_swimStaminaModifier", "m_sneakStaminaModifier", "m_runStaminaModifier" };
   
      private static readonly string[] s_equipmentModifierTooltips = new string[] { "$item_movement_modifier", "$base_item_modifier", "$item_heat_modifier", "$se_jumpstamina", "$se_attackstamina", "$se_blockstamina", "$se_dodgestamina", "$se_swimstamina", "$se_sneakstamina", "$se_runstamina" };
   
    private float m_baseValueUpdateTimer;     private float m_baseValueUpdateTimer;
   
    private float m_rotatePieceTimer;     private float m_rotatePieceTimer;
   
    private bool m_altPlace;     private bool m_altPlace;
   
    public static Player m_localPlayer = null;     public static Player m_localPlayer = null;
   
    private static readonly List<Player> s_players = new List<Player>();     private static readonly List<Player> s_players = new List<Player>();
   
    public static List<string> m_addUniqueKeyQueue = new List<string>();     public static List<string> m_addUniqueKeyQueue = new List<string>();
   
.      public static List<string> s_FilterCraft = new List<string>();
   
    public static bool m_debugMode = false;     public static bool m_debugMode = false;
   
    [Header("Player")]     [Header("Player")]
    public float m_maxPlaceDistance = 5f;     public float m_maxPlaceDistance = 5f;
   
    public float m_maxInteractDistance = 5f;     public float m_maxInteractDistance = 5f;
   
    public float m_scrollSens = 4f;     public float m_scrollSens = 4f;
   
    public float m_staminaRegen = 5f;     public float m_staminaRegen = 5f;
   
    public float m_staminaRegenTimeMultiplier = 1f;     public float m_staminaRegenTimeMultiplier = 1f;
   
    public float m_staminaRegenDelay = 1f;     public float m_staminaRegenDelay = 1f;
   
    public float m_runStaminaDrain = 10f;     public float m_runStaminaDrain = 10f;
   
    public float m_sneakStaminaDrain = 5f;     public float m_sneakStaminaDrain = 5f;
   
    public float m_swimStaminaDrainMinSkill = 5f;     public float m_swimStaminaDrainMinSkill = 5f;
   
    public float m_swimStaminaDrainMaxSkill = 2f;     public float m_swimStaminaDrainMaxSkill = 2f;
   
    public float m_dodgeStaminaUsage = 10f;     public float m_dodgeStaminaUsage = 10f;
   
    public float m_weightStaminaFactor = 0.1f;     public float m_weightStaminaFactor = 0.1f;
   
    public float m_eiterRegen = 5f;     public float m_eiterRegen = 5f;
   
    public float m_eitrRegenDelay = 1f;     public float m_eitrRegenDelay = 1f;
   
    public float m_autoPickupRange = 2f;     public float m_autoPickupRange = 2f;
   
    public float m_maxCarryWeight = 300f;     public float m_maxCarryWeight = 300f;
   
    public float m_encumberedStaminaDrain = 10f;     public float m_encumberedStaminaDrain = 10f;
   
    public float m_hardDeathCooldown = 10f;     public float m_hardDeathCooldown = 10f;
   
    public float m_baseCameraShake = 4f;     public float m_baseCameraShake = 4f;
   
    public float m_placeDelay = 0.4f;     public float m_placeDelay = 0.4f;
   
    public float m_removeDelay = 0.25f;     public float m_removeDelay = 0.25f;
   
    public EffectList m_drownEffects = new EffectList();     public EffectList m_drownEffects = new EffectList();
   
    public EffectList m_spawnEffects = new EffectList();     public EffectList m_spawnEffects = new EffectList();
   
    public EffectList m_removeEffects = new EffectList();     public EffectList m_removeEffects = new EffectList();
   
    public EffectList m_dodgeEffects = new EffectList();     public EffectList m_dodgeEffects = new EffectList();
   
    public EffectList m_autopickupEffects = new EffectList();     public EffectList m_autopickupEffects = new EffectList();
   
    public EffectList m_skillLevelupEffects = new EffectList();     public EffectList m_skillLevelupEffects = new EffectList();
   
    public EffectList m_equipStartEffects = new EffectList();     public EffectList m_equipStartEffects = new EffectList();
   
    public GameObject m_placeMarker;     public GameObject m_placeMarker;
   
    public GameObject m_tombstone;     public GameObject m_tombstone;
   
    public GameObject m_valkyrie;     public GameObject m_valkyrie;
   
    public Sprite m_textIcon;     public Sprite m_textIcon;
   
.    public DateTime m_wakeupTime;  
   
    public float m_baseHP = 25f;     public float m_baseHP = 25f;
   
    public float m_baseStamina = 75f;     public float m_baseStamina = 75f;
   
.      public double m_wakeupTime;
   
    private Skills m_skills;     private Skills m_skills;
   
    private PieceTable m_buildPieces;     private PieceTable m_buildPieces;
   
    private bool m_noPlacementCost;     private bool m_noPlacementCost;
   
    private const bool m_hideUnavailable = false;     private const bool m_hideUnavailable = false;
   
.    private bool m_enableAutoPickup = true;     private static bool m_enableAutoPickup = true;
   
    private readonly HashSet<string> m_knownRecipes = new HashSet<string>();     private readonly HashSet<string> m_knownRecipes = new HashSet<string>();
   
    private readonly Dictionary<string, int> m_knownStations = new Dictionary<string, int>();     private readonly Dictionary<string, int> m_knownStations = new Dictionary<string, int>();
   
    private readonly HashSet<string> m_knownMaterial = new HashSet<string>();     private readonly HashSet<string> m_knownMaterial = new HashSet<string>();
   
    private readonly HashSet<string> m_shownTutorials = new HashSet<string>();     private readonly HashSet<string> m_shownTutorials = new HashSet<string>();
   
    private readonly HashSet<string> m_uniques = new HashSet<string>();     private readonly HashSet<string> m_uniques = new HashSet<string>();
   
    private readonly HashSet<string> m_trophies = new HashSet<string>();     private readonly HashSet<string> m_trophies = new HashSet<string>();
   
    private readonly HashSet<Heightmap.Biome> m_knownBiome = new HashSet<Heightmap.Biome>();     private readonly HashSet<Heightmap.Biome> m_knownBiome = new HashSet<Heightmap.Biome>();
   
    private readonly Dictionary<string, string> m_knownTexts = new Dictionary<string, string>();     private readonly Dictionary<string, string> m_knownTexts = new Dictionary<string, string>();
   
    private float m_stationDiscoverTimer;     private float m_stationDiscoverTimer;
   
    private bool m_debugFly;     private bool m_debugFly;
   
    private bool m_godMode;     private bool m_godMode;
   
    private bool m_ghostMode;     private bool m_ghostMode;
   
    private float m_lookPitch;     private float m_lookPitch;
   
    private const int m_maxFoods = 3;     private const int m_maxFoods = 3;
   
    private const float m_foodDrainPerSec = 0.1f;     private const float m_foodDrainPerSec = 0.1f;
   
    private float m_foodUpdateTimer;     private float m_foodUpdateTimer;
   
    private float m_foodRegenTimer;     private float m_foodRegenTimer;
   
    private readonly List<Player.Food> m_foods = new List<Player.Food>();     private readonly List<Player.Food> m_foods = new List<Player.Food>();
   
    private float m_stamina = 100f;     private float m_stamina = 100f;
   
    private float m_maxStamina = 100f;     private float m_maxStamina = 100f;
   
    private float m_staminaRegenTimer;     private float m_staminaRegenTimer;
   
    private float m_eitr;     private float m_eitr;
   
    private float m_maxEitr;     private float m_maxEitr;
   
    private float m_eitrRegenTimer;     private float m_eitrRegenTimer;
   
    private string m_guardianPower = "";     private string m_guardianPower = "";
   
    private int m_guardianPowerHash;     private int m_guardianPowerHash;
   
    public float m_guardianPowerCooldown;     public float m_guardianPowerCooldown;
   
    private StatusEffect m_guardianSE;     private StatusEffect m_guardianSE;
   
    private float m_placePressedTime = -1000f;     private float m_placePressedTime = -1000f;
   
    private float m_removePressedTime = -1000f;     private float m_removePressedTime = -1000f;
   
    private bool m_blockRemove;     private bool m_blockRemove;
   
    private float m_lastToolUseTime;     private float m_lastToolUseTime;
   
    private GameObject m_placementMarkerInstance;     private GameObject m_placementMarkerInstance;
   
    private GameObject m_placementGhost;     private GameObject m_placementGhost;
   
    private string m_placementGhostLast;     private string m_placementGhostLast;
   
    private Player.PlacementStatus m_placementStatus = Player.PlacementStatus.Invalid;     private Player.PlacementStatus m_placementStatus = Player.PlacementStatus.Invalid;
   
    private float m_placeRotationDegrees = 22.5f;     private float m_placeRotationDegrees = 22.5f;
   
    private int m_placeRotation;     private int m_placeRotation;
   
    private int m_placeRayMask;     private int m_placeRayMask;
   
    private int m_placeGroundRayMask;     private int m_placeGroundRayMask;
   
    private int m_placeWaterRayMask;     private int m_placeWaterRayMask;
   
    private int m_removeRayMask;     private int m_removeRayMask;
   
    private int m_interactMask;     private int m_interactMask;
   
    private int m_autoPickupMask;     private int m_autoPickupMask;
   
    private readonly List<Player.MinorActionData> m_actionQueue = new List<Player.MinorActionData>();     private readonly List<Player.MinorActionData> m_actionQueue = new List<Player.MinorActionData>();
   
    private float m_actionQueuePause;     private float m_actionQueuePause;
   
    private string m_actionAnimation;     private string m_actionAnimation;
   
    private GameObject m_hovering;     private GameObject m_hovering;
   
    private Character m_hoveringCreature;     private Character m_hoveringCreature;
   
    private float m_lastHoverInteractTime;     private float m_lastHoverInteractTime;
   
    private bool m_pvp;     private bool m_pvp;
   
    private float m_updateCoverTimer;     private float m_updateCoverTimer;
   
    private float m_coverPercentage;     private float m_coverPercentage;
   
    private bool m_underRoof = true;     private bool m_underRoof = true;
   
    private float m_nearFireTimer;     private float m_nearFireTimer;
   
    private bool m_isLoading;     private bool m_isLoading;
   
    private ItemDrop.ItemData m_weaponLoaded;     private ItemDrop.ItemData m_weaponLoaded;
   
    private float m_queuedAttackTimer;     private float m_queuedAttackTimer;
   
    private float m_queuedSecondAttackTimer;     private float m_queuedSecondAttackTimer;
   
    private float m_queuedDodgeTimer;     private float m_queuedDodgeTimer;
   
    private Vector3 m_queuedDodgeDir = Vector3.zero;     private Vector3 m_queuedDodgeDir = Vector3.zero;
   
    private bool m_inDodge;     private bool m_inDodge;
   
    private bool m_dodgeInvincible;     private bool m_dodgeInvincible;
   
    private CraftingStation m_currentStation;     private CraftingStation m_currentStation;
   
    private bool m_inCraftingStation;     private bool m_inCraftingStation;
   
    private Ragdoll m_ragdoll;     private Ragdoll m_ragdoll;
   
    private Piece m_hoveringPiece;     private Piece m_hoveringPiece;
   
    private Dictionary<Material, float> m_ghostRippleDistance = new Dictionary<Material, float>();     private Dictionary<Material, float> m_ghostRippleDistance = new Dictionary<Material, float>();
   
.      private bool m_attackTowardsPlayerLookDir;
   
    private string m_emoteState = "";     private string m_emoteState = "";
   
    private int m_emoteID;     private int m_emoteID;
   
    private bool m_intro;     private bool m_intro;
   
    private bool m_firstSpawn = true;     private bool m_firstSpawn = true;
   
    private bool m_crouchToggled;     private bool m_crouchToggled;
   
    public bool m_autoRun;     public bool m_autoRun;
   
    private bool m_safeInHome;     private bool m_safeInHome;
   
    private IDoodadController m_doodadController;     private IDoodadController m_doodadController;
   
    private bool m_attached;     private bool m_attached;
   
    private string m_attachAnimation = "";     private string m_attachAnimation = "";
   
    private bool m_sleeping;     private bool m_sleeping;
   
    private bool m_attachedToShip;     private bool m_attachedToShip;
   
    private Transform m_attachPoint;     private Transform m_attachPoint;
   
    private Vector3 m_detachOffset = Vector3.zero;     private Vector3 m_detachOffset = Vector3.zero;
   
    private Transform m_attachPointCamera;     private Transform m_attachPointCamera;
   
    private Collider[] m_attachColliders;     private Collider[] m_attachColliders;
   
    private int m_modelIndex;     private int m_modelIndex;
   
    private Vector3 m_skinColor = Vector3.one;     private Vector3 m_skinColor = Vector3.one;
   
    private Vector3 m_hairColor = Vector3.one;     private Vector3 m_hairColor = Vector3.one;
   
    private bool m_teleporting;     private bool m_teleporting;
   
    private bool m_distantTeleport;     private bool m_distantTeleport;
   
    private float m_teleportTimer;     private float m_teleportTimer;
   
    private float m_teleportCooldown;     private float m_teleportCooldown;
   
    private Vector3 m_teleportFromPos;     private Vector3 m_teleportFromPos;
   
    private Quaternion m_teleportFromRot;     private Quaternion m_teleportFromRot;
   
    private Vector3 m_teleportTargetPos;     private Vector3 m_teleportTargetPos;
   
    private Quaternion m_teleportTargetRot;     private Quaternion m_teleportTargetRot;
   
    private Heightmap.Biome m_currentBiome;     private Heightmap.Biome m_currentBiome;
   
    private float m_biomeTimer;     private float m_biomeTimer;
   
    private List<string> m_tempUniqueKeys = new List<string>();     private List<string> m_tempUniqueKeys = new List<string>();
   
    private int m_baseValue;     private int m_baseValue;
   
.      private int m_baseValueOld = -1;
   
    private int m_comfortLevel;     private int m_comfortLevel;
   
    private float m_drownDamageTimer;     private float m_drownDamageTimer;
   
    private float m_timeSinceTargeted;     private float m_timeSinceTargeted;
   
    private float m_timeSinceSensed;     private float m_timeSinceSensed;
   
    private float m_stealthFactorUpdateTimer;     private float m_stealthFactorUpdateTimer;
   
    private float m_stealthFactor;     private float m_stealthFactor;
   
    private float m_stealthFactorTarget;     private float m_stealthFactorTarget;
   
    private Vector3 m_lastStealthPosition = Vector3.zero;     private Vector3 m_lastStealthPosition = Vector3.zero;
   
.      private float m_lastVelocity;
   
    private float m_wakeupTimer = -1f;     private float m_wakeupTimer = -1f;
   
    private float m_timeSinceDeath = 999999f;     private float m_timeSinceDeath = 999999f;
   
    private float m_runSkillImproveTimer;     private float m_runSkillImproveTimer;
   
    private float m_swimSkillImproveTimer;     private float m_swimSkillImproveTimer;
   
    private float m_sneakSkillImproveTimer;     private float m_sneakSkillImproveTimer;
   
.    private float m_equipmentMovementModifier;  
   
    private float m_equipmentBaseItemModifier;  
   
    private int m_manualSnapPoint = -1;     private int m_manualSnapPoint = -1;
   
    private readonly List<PieceTable> m_tempOwnedPieceTables = new List<PieceTable>();     private readonly List<PieceTable> m_tempOwnedPieceTables = new List<PieceTable>();
   
    private readonly List<Transform> m_tempSnapPoints1 = new List<Transform>();     private readonly List<Transform> m_tempSnapPoints1 = new List<Transform>();
   
    private readonly List<Transform> m_tempSnapPoints2 = new List<Transform>();     private readonly List<Transform> m_tempSnapPoints2 = new List<Transform>();
   
    private readonly List<Piece> m_tempPieces = new List<Piece>();     private readonly List<Piece> m_tempPieces = new List<Piece>();
   
    [HideInInspector]     [HideInInspector]
    public Dictionary<string, string> m_customData = new Dictionary<string, string>();     public Dictionary<string, string> m_customData = new Dictionary<string, string>();
   
    private static int s_attackMask = 0;     private static int s_attackMask = 0;
   
    private static readonly int s_crouching = ZSyncAnimation.GetHash("crouching");     private static readonly int s_crouching = ZSyncAnimation.GetHash("crouching");
   
    private static readonly int s_animatorTagDodge = ZSyncAnimation.GetHash("dodge");     private static readonly int s_animatorTagDodge = ZSyncAnimation.GetHash("dodge");
   
    private static readonly int s_animatorTagCutscene = ZSyncAnimation.GetHash("cutscene");     private static readonly int s_animatorTagCutscene = ZSyncAnimation.GetHash("cutscene");
   
    private static readonly int s_animatorTagCrouch = ZSyncAnimation.GetHash("crouch");     private static readonly int s_animatorTagCrouch = ZSyncAnimation.GetHash("crouch");
   
    private static readonly int s_animatorTagMinorAction = ZSyncAnimation.GetHash("minoraction");     private static readonly int s_animatorTagMinorAction = ZSyncAnimation.GetHash("minoraction");
   
    private static readonly int s_animatorTagMinorActionFast = ZSyncAnimation.GetHash("minoraction_fast");     private static readonly int s_animatorTagMinorActionFast = ZSyncAnimation.GetHash("minoraction_fast");
   
    private static readonly int s_animatorTagEmote = ZSyncAnimation.GetHash("emote");     private static readonly int s_animatorTagEmote = ZSyncAnimation.GetHash("emote");
   
.    private static readonly int s_statusEffectRested = "Rested".GetStableHashCode();  
   
    private static readonly int s_statusEffectEncumbered = "Encumbered".GetStableHashCode();  
   
    private static readonly int s_statusEffectSoftDeath = "SoftDeath".GetStableHashCode();  
   
    private static readonly int s_statusEffectWet = "Wet".GetStableHashCode();  
   
    private static readonly int s_statusEffectShelter = "Shelter".GetStableHashCode();  
   
    private static readonly int s_statusEffectCampFire = "CampFire".GetStableHashCode();  
   
    private static readonly int s_statusEffectResting = "Resting".GetStableHashCode();  
   
    private static readonly int s_statusEffectCold = "Cold".GetStableHashCode();  
   
    private static readonly int s_statusEffectFreezing = "Freezing".GetStableHashCode();  
   
    public const string BaseValueKey = "baseValue";     public const string BaseValueKey = "baseValue";
   
    private int m_cachedFrame;     private int m_cachedFrame;
   
    private bool m_cachedAttack;     private bool m_cachedAttack;
   
    [Header("Seasonal Items")]     [Header("Seasonal Items")]
    [SerializeField]     [SerializeField]
    private List<SeasonalItemGroup> m_seasonalItemGroups = new List<SeasonalItemGroup>();     private List<SeasonalItemGroup> m_seasonalItemGroups = new List<SeasonalItemGroup>();
   
    private SeasonalItemGroup m_currentSeason;     private SeasonalItemGroup m_currentSeason;
   
.      private readonly RaycastHit[] m_raycastHoverHits = new RaycastHit[64];
   
    public enum RequirementMode     public enum RequirementMode
    {     {
        CanBuild,         CanBuild,
        IsKnown,         IsKnown,
        CanAlmostBuild         CanAlmostBuild
    }     }
   
    public class Food     public class Food
    {     {
        public bool CanEatAgain()         public bool CanEatAgain()
        {         {
            return this.m_time < this.m_item.m_shared.m_foodBurnTime / 2f;             return this.m_time < this.m_item.m_shared.m_foodBurnTime / 2f;
        }         }
   
        public string m_name = "";         public string m_name = "";
   
        public ItemDrop.ItemData m_item;         public ItemDrop.ItemData m_item;
   
        public float m_time;         public float m_time;
   
        public float m_health;         public float m_health;
   
        public float m_stamina;         public float m_stamina;
   
        public float m_eitr;         public float m_eitr;
    }     }
   
    public class MinorActionData     public class MinorActionData
    {     {
        public Player.MinorActionData.ActionType m_type;         public Player.MinorActionData.ActionType m_type;
   
        public ItemDrop.ItemData m_item;         public ItemDrop.ItemData m_item;
   
        public string m_progressText = "";         public string m_progressText = "";
   
        public float m_time;         public float m_time;
   
        public float m_duration;         public float m_duration;
   
        public string m_animation = "";         public string m_animation = "";
   
        public string m_doneAnimation = "";         public string m_doneAnimation = "";
   
        public float m_staminaDrain;         public float m_staminaDrain;
   
.          public float m_eitrDrain;
   
        public EffectList m_startEffect;         public EffectList m_startEffect;
   
        public enum ActionType         public enum ActionType
        {         {
            Equip,             Equip,
            Unequip,             Unequip,
            Reload             Reload
        }         }
    }     }
   
    public enum PlacementStatus     public enum PlacementStatus
    {     {
        Valid,         Valid,
        Invalid,         Invalid,
        BlockedbyPlayer,         BlockedbyPlayer,
        NoBuildZone,         NoBuildZone,
        PrivateZone,         PrivateZone,
        MoreSpace,         MoreSpace,
        NoTeleportArea,         NoTeleportArea,
        ExtensionMissingStation,         ExtensionMissingStation,
        WrongBiome,         WrongBiome,
        NeedCultivated,         NeedCultivated,
        NeedDirt,         NeedDirt,
        NotInDungeon,         NotInDungeon,
        NoRayHits         NoRayHits
.      }
   
      private class RaycastHitComparer : IComparer<RaycastHit>
      {
          public int Compare(RaycastHit x, RaycastHit y)
          {
              return x.distance.CompareTo(y.distance);
          }
   
          public static Player.RaycastHitComparer Instance = new Player.RaycastHitComparer();
    }     }
} }