D:\ValheimDev\Dumps\Old\assembly_valheim\CookingStation.cs D:\ValheimDev\Dumps\Latest\assembly_valheim\CookingStation.cs
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using UnityEngine; using UnityEngine;
using UnityEngine.Rendering; using UnityEngine.Rendering;
   
public class CookingStation : MonoBehaviour, Interactable, Hoverable public class CookingStation : MonoBehaviour, Interactable, Hoverable
{ {
    private void Awake()     private void Awake()
    {     {
        this.m_nview = base.gameObject.GetComponent<ZNetView>();         this.m_nview = base.gameObject.GetComponent<ZNetView>();
        if (this.m_nview.GetZDO() == null)         if (this.m_nview.GetZDO() == null)
        {         {
            return;             return;
        }         }
        this.m_ps = new ParticleSystem[this.m_slots.Length];         this.m_ps = new ParticleSystem[this.m_slots.Length];
        this.m_as = new AudioSource[this.m_slots.Length];         this.m_as = new AudioSource[this.m_slots.Length];
        for (int i = 0; i < this.m_slots.Length; i++)         for (int i = 0; i < this.m_slots.Length; i++)
        {         {
            this.m_ps[i] = this.m_slots[i].GetComponent<ParticleSystem>();             this.m_ps[i] = this.m_slots[i].GetComponent<ParticleSystem>();
            this.m_as[i] = this.m_slots[i].GetComponent<AudioSource>();             this.m_as[i] = this.m_slots[i].GetComponent<AudioSource>();
        }         }
.        this.m_nview.Register<Vector3>("RemoveDoneItem", new Action<long, Vector3>(this.RPC_RemoveDoneItem));         this.m_nview.Register<Vector3>("RPC_RemoveDoneItem", new Action<long, Vector3>(this.RPC_RemoveDoneItem));
        this.m_nview.Register<string>("AddItem", new Action<long, string>(this.RPC_AddItem));         this.m_nview.Register<string>("RPC_AddItem", new Action<long, string>(this.RPC_AddItem));
        this.m_nview.Register("AddFuel", new Action<long>(this.RPC_AddFuel));         this.m_nview.Register("RPC_AddFuel", new Action<long>(this.RPC_AddFuel));
        this.m_nview.Register<int, string>("SetSlotVisual", new Action<long, int, string>(this.RPC_SetSlotVisual));         this.m_nview.Register<int, string>("RPC_SetSlotVisual", new Action<long, int, string>(this.RPC_SetSlotVisual));
        if (this.m_addFoodSwitch)         if (this.m_addFoodSwitch)
        {         {
            this.m_addFoodSwitch.m_onUse = new Switch.Callback(this.OnAddFoodSwitch);             this.m_addFoodSwitch.m_onUse = new Switch.Callback(this.OnAddFoodSwitch);
            this.m_addFoodSwitch.m_hoverText = this.HoverText();             this.m_addFoodSwitch.m_hoverText = this.HoverText();
        }         }
        if (this.m_addFuelSwitch)         if (this.m_addFuelSwitch)
        {         {
            this.m_addFuelSwitch.m_onUse = new Switch.Callback(this.OnAddFuelSwitch);             this.m_addFuelSwitch.m_onUse = new Switch.Callback(this.OnAddFuelSwitch);
            this.m_addFuelSwitch.m_onHover = new Switch.TooltipCallback(this.OnHoverFuelSwitch);             this.m_addFuelSwitch.m_onHover = new Switch.TooltipCallback(this.OnHoverFuelSwitch);
        }         }
        WearNTear component = base.GetComponent<WearNTear>();         WearNTear component = base.GetComponent<WearNTear>();
        if (component)         if (component)
        {         {
            WearNTear wearNTear = component;             WearNTear wearNTear = component;
            wearNTear.m_onDestroyed = (Action)Delegate.Combine(wearNTear.m_onDestroyed, new Action(this.OnDestroyed));             wearNTear.m_onDestroyed = (Action)Delegate.Combine(wearNTear.m_onDestroyed, new Action(this.OnDestroyed));
        }         }
        base.InvokeRepeating("UpdateCooking", 0f, 1f);         base.InvokeRepeating("UpdateCooking", 0f, 1f);
    }     }
   
    private void DropAllItems()     private void DropAllItems()
    {     {
        if (this.m_fuelItem != null)         if (this.m_fuelItem != null)
        {         {
            float fuel = this.GetFuel();             float fuel = this.GetFuel();
            for (int i = 0; i < (int)fuel; i++)             for (int i = 0; i < (int)fuel; i++)
            {             {
                this.<DropAllItems>g__drop|1_0(this.m_fuelItem);                 this.<DropAllItems>g__drop|1_0(this.m_fuelItem);
            }             }
            this.SetFuel(0f);             this.SetFuel(0f);
        }         }
        for (int j = 0; j < this.m_slots.Length; j++)         for (int j = 0; j < this.m_slots.Length; j++)
        {         {
            string text;             string text;
            float num;             float num;
            CookingStation.Status status;             CookingStation.Status status;
            this.GetSlot(j, out text, out num, out status);             this.GetSlot(j, out text, out num, out status);
            if (text != "")             if (text != "")
            {             {
                if (status == CookingStation.Status.Done)                 if (status == CookingStation.Status.Done)
                {                 {
                    this.<DropAllItems>g__drop|1_0(this.GetItemConversion(text).m_to);                     this.<DropAllItems>g__drop|1_0(this.GetItemConversion(text).m_to);
                }                 }
                else if (status == CookingStation.Status.Burnt)                 else if (status == CookingStation.Status.Burnt)
                {                 {
                    this.<DropAllItems>g__drop|1_0(this.m_overCookedItem);                     this.<DropAllItems>g__drop|1_0(this.m_overCookedItem);
                }                 }
                else if (status == CookingStation.Status.NotDone)                 else if (status == CookingStation.Status.NotDone)
                {                 {
                    GameObject prefab = ZNetScene.instance.GetPrefab(text);                     GameObject prefab = ZNetScene.instance.GetPrefab(text);
                    if (prefab != null)                     if (prefab != null)
                    {                     {
                        ItemDrop component = prefab.GetComponent<ItemDrop>();                         ItemDrop component = prefab.GetComponent<ItemDrop>();
                        if (component)                         if (component)
                        {                         {
                            this.<DropAllItems>g__drop|1_0(component);                             this.<DropAllItems>g__drop|1_0(component);
                        }                         }
                    }                     }
                }                 }
                this.SetSlot(j, "", 0f, CookingStation.Status.NotDone);                 this.SetSlot(j, "", 0f, CookingStation.Status.NotDone);
            }             }
        }         }
    }     }
   
    private void OnDestroyed()     private void OnDestroyed()
    {     {
        if (this.m_nview.IsOwner())         if (this.m_nview.IsOwner())
        {         {
            this.DropAllItems();             this.DropAllItems();
        }         }
    }     }
   
    private void UpdateCooking()     private void UpdateCooking()
    {     {
        if (!this.m_nview.IsValid())         if (!this.m_nview.IsValid())
        {         {
            return;             return;
        }         }
        bool flag = (this.m_requireFire && this.IsFireLit()) || (this.m_useFuel && this.GetFuel() > 0f);         bool flag = (this.m_requireFire && this.IsFireLit()) || (this.m_useFuel && this.GetFuel() > 0f);
        if (this.m_nview.IsOwner())         if (this.m_nview.IsOwner())
        {         {
            float deltaTime = this.GetDeltaTime();             float deltaTime = this.GetDeltaTime();
            if (flag)             if (flag)
            {             {
                this.UpdateFuel(deltaTime);                 this.UpdateFuel(deltaTime);
                for (int i = 0; i < this.m_slots.Length; i++)                 for (int i = 0; i < this.m_slots.Length; i++)
                {                 {
                    string text;                     string text;
                    float num;                     float num;
                    CookingStation.Status status;                     CookingStation.Status status;
                    this.GetSlot(i, out text, out num, out status);                     this.GetSlot(i, out text, out num, out status);
                    if (text != "" && status != CookingStation.Status.Burnt)                     if (text != "" && status != CookingStation.Status.Burnt)
                    {                     {
                        CookingStation.ItemConversion itemConversion = this.GetItemConversion(text);                         CookingStation.ItemConversion itemConversion = this.GetItemConversion(text);
                        if (itemConversion == null)                         if (itemConversion == null)
                        {                         {
                            this.SetSlot(i, "", 0f, CookingStation.Status.NotDone);                             this.SetSlot(i, "", 0f, CookingStation.Status.NotDone);
                        }                         }
                        else                         else
                        {                         {
                            num += deltaTime;                             num += deltaTime;
                            if (num > itemConversion.m_cookTime * 2f)                             if (num > itemConversion.m_cookTime * 2f)
                            {                             {
                                this.m_overcookedEffect.Create(this.m_slots[i].position, Quaternion.identity, null, 1f, -1);                                 this.m_overcookedEffect.Create(this.m_slots[i].position, Quaternion.identity, null, 1f, -1);
                                this.SetSlot(i, this.m_overCookedItem.name, num, CookingStation.Status.Burnt);                                 this.SetSlot(i, this.m_overCookedItem.name, num, CookingStation.Status.Burnt);
                            }                             }
                            else if (num > itemConversion.m_cookTime && text == itemConversion.m_from.name)                             else if (num > itemConversion.m_cookTime && text == itemConversion.m_from.name)
                            {                             {
                                this.m_doneEffect.Create(this.m_slots[i].position, Quaternion.identity, null, 1f, -1);                                 this.m_doneEffect.Create(this.m_slots[i].position, Quaternion.identity, null, 1f, -1);
                                this.SetSlot(i, itemConversion.m_to.name, num, CookingStation.Status.Done);                                 this.SetSlot(i, itemConversion.m_to.name, num, CookingStation.Status.Done);
                            }                             }
                            else                             else
                            {                             {
                                this.SetSlot(i, text, num, status);                                 this.SetSlot(i, text, num, status);
                            }                             }
                        }                         }
                    }                     }
                }                 }
            }             }
        }         }
        this.UpdateVisual(flag);         this.UpdateVisual(flag);
    }     }
   
    private float GetDeltaTime()     private float GetDeltaTime()
    {     {
        DateTime time = ZNet.instance.GetTime();         DateTime time = ZNet.instance.GetTime();
        DateTime dateTime = new DateTime(this.m_nview.GetZDO().GetLong(ZDOVars.s_startTime, time.Ticks));         DateTime dateTime = new DateTime(this.m_nview.GetZDO().GetLong(ZDOVars.s_startTime, time.Ticks));
        float totalSeconds = (float)(time - dateTime).TotalSeconds;         float totalSeconds = (float)(time - dateTime).TotalSeconds;
        this.m_nview.GetZDO().Set(ZDOVars.s_startTime, time.Ticks);         this.m_nview.GetZDO().Set(ZDOVars.s_startTime, time.Ticks);
        return totalSeconds;         return totalSeconds;
    }     }
   
    private void UpdateFuel(float dt)     private void UpdateFuel(float dt)
    {     {
        if (!this.m_useFuel)         if (!this.m_useFuel)
        {         {
            return;             return;
        }         }
        float num = dt / (float)this.m_secPerFuel;         float num = dt / (float)this.m_secPerFuel;
        float num2 = this.GetFuel();         float num2 = this.GetFuel();
        num2 -= num;         num2 -= num;
        if (num2 < 0f)         if (num2 < 0f)
        {         {
            num2 = 0f;             num2 = 0f;
        }         }
        this.SetFuel(num2);         this.SetFuel(num2);
    }     }
   
    private void UpdateVisual(bool fireLit)     private void UpdateVisual(bool fireLit)
    {     {
        for (int i = 0; i < this.m_slots.Length; i++)         for (int i = 0; i < this.m_slots.Length; i++)
        {         {
            string text;             string text;
            float num;             float num;
            CookingStation.Status status;             CookingStation.Status status;
            this.GetSlot(i, out text, out num, out status);             this.GetSlot(i, out text, out num, out status);
            this.SetSlotVisual(i, text, fireLit, status);             this.SetSlotVisual(i, text, fireLit, status);
        }         }
        if (this.m_useFuel)         if (this.m_useFuel)
        {         {
            bool flag = this.GetFuel() > 0f;             bool flag = this.GetFuel() > 0f;
            if (this.m_haveFireObject)             if (this.m_haveFireObject)
            {             {
                this.m_haveFireObject.SetActive(fireLit);                 this.m_haveFireObject.SetActive(fireLit);
            }             }
            if (this.m_haveFuelObject)             if (this.m_haveFuelObject)
            {             {
                this.m_haveFuelObject.SetActive(flag);                 this.m_haveFuelObject.SetActive(flag);
            }             }
        }         }
    }     }
   
    private void RPC_SetSlotVisual(long sender, int slot, string item)     private void RPC_SetSlotVisual(long sender, int slot, string item)
    {     {
        this.SetSlotVisual(slot, item, false, CookingStation.Status.NotDone);         this.SetSlotVisual(slot, item, false, CookingStation.Status.NotDone);
    }     }
   
    private void SetSlotVisual(int i, string item, bool fireLit, CookingStation.Status status)     private void SetSlotVisual(int i, string item, bool fireLit, CookingStation.Status status)
    {     {
        if (item == "")         if (item == "")
        {         {
            this.m_ps[i].emission.enabled = false;             this.m_ps[i].emission.enabled = false;
            if (this.m_burntPS.Length != 0)             if (this.m_burntPS.Length != 0)
            {             {
                this.m_burntPS[i].emission.enabled = false;                 this.m_burntPS[i].emission.enabled = false;
            }             }
            if (this.m_donePS.Length != 0)             if (this.m_donePS.Length != 0)
            {             {
                this.m_donePS[i].emission.enabled = false;                 this.m_donePS[i].emission.enabled = false;
            }             }
            this.m_as[i].mute = true;             this.m_as[i].mute = true;
            if (this.m_slots[i].childCount > 0)             if (this.m_slots[i].childCount > 0)
            {             {
                UnityEngine.Object.Destroy(this.m_slots[i].GetChild(0).gameObject);                 UnityEngine.Object.Destroy(this.m_slots[i].GetChild(0).gameObject);
                return;                 return;
            }             }
        }         }
        else         else
        {         {
            this.m_ps[i].emission.enabled = fireLit && status != CookingStation.Status.Burnt;             this.m_ps[i].emission.enabled = fireLit && status != CookingStation.Status.Burnt;
            if (this.m_burntPS.Length != 0)             if (this.m_burntPS.Length != 0)
            {             {
                this.m_burntPS[i].emission.enabled = fireLit && status == CookingStation.Status.Burnt;                 this.m_burntPS[i].emission.enabled = fireLit && status == CookingStation.Status.Burnt;
            }             }
            if (this.m_donePS.Length != 0)             if (this.m_donePS.Length != 0)
            {             {
                this.m_donePS[i].emission.enabled = fireLit && status == CookingStation.Status.Done;                 this.m_donePS[i].emission.enabled = fireLit && status == CookingStation.Status.Done;
            }             }
            this.m_as[i].mute = !fireLit;             this.m_as[i].mute = !fireLit;
            if (this.m_slots[i].childCount == 0 || this.m_slots[i].GetChild(0).name != item)             if (this.m_slots[i].childCount == 0 || this.m_slots[i].GetChild(0).name != item)
            {             {
                if (this.m_slots[i].childCount > 0)                 if (this.m_slots[i].childCount > 0)
                {                 {
                    UnityEngine.Object.Destroy(this.m_slots[i].GetChild(0).gameObject);                     UnityEngine.Object.Destroy(this.m_slots[i].GetChild(0).gameObject);
                }                 }
                Component component = ObjectDB.instance.GetItemPrefab(item).transform.Find("attach");                 Component component = ObjectDB.instance.GetItemPrefab(item).transform.Find("attach");
                Transform transform = this.m_slots[i];                 Transform transform = this.m_slots[i];
                GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(component.gameObject, transform.position, transform.rotation, transform);                 GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(component.gameObject, transform.position, transform.rotation, transform);
                gameObject.name = item;                 gameObject.name = item;
                Renderer[] componentsInChildren = gameObject.GetComponentsInChildren<Renderer>();                 Renderer[] componentsInChildren = gameObject.GetComponentsInChildren<Renderer>();
                for (int j = 0; j < componentsInChildren.Length; j++)                 for (int j = 0; j < componentsInChildren.Length; j++)
                {                 {
                    componentsInChildren[j].shadowCastingMode = ShadowCastingMode.Off;                     componentsInChildren[j].shadowCastingMode = ShadowCastingMode.Off;
                }                 }
            }             }
        }         }
    }     }
   
    private void RPC_RemoveDoneItem(long sender, Vector3 userPoint)     private void RPC_RemoveDoneItem(long sender, Vector3 userPoint)
    {     {
        for (int i = 0; i < this.m_slots.Length; i++)         for (int i = 0; i < this.m_slots.Length; i++)
        {         {
            string text;             string text;
            float num;             float num;
            CookingStation.Status status;             CookingStation.Status status;
            this.GetSlot(i, out text, out num, out status);             this.GetSlot(i, out text, out num, out status);
            if (text != "" && this.IsItemDone(text))             if (text != "" && this.IsItemDone(text))
            {             {
                this.SpawnItem(text, i, userPoint);                 this.SpawnItem(text, i, userPoint);
                this.SetSlot(i, "", 0f, CookingStation.Status.NotDone);                 this.SetSlot(i, "", 0f, CookingStation.Status.NotDone);
.                this.m_nview.InvokeRPC(ZNetView.Everybody, "SetSlotVisual", new object[] { i, "" });                 this.m_nview.InvokeRPC(ZNetView.Everybody, "RPC_SetSlotVisual", new object[] { i, "" });
                return;                 return;
            }             }
        }         }
    }     }
   
    private bool HaveDoneItem()     private bool HaveDoneItem()
    {     {
        for (int i = 0; i < this.m_slots.Length; i++)         for (int i = 0; i < this.m_slots.Length; i++)
        {         {
            string text;             string text;
            float num;             float num;
            CookingStation.Status status;             CookingStation.Status status;
            this.GetSlot(i, out text, out num, out status);             this.GetSlot(i, out text, out num, out status);
            if (text != "" && this.IsItemDone(text))             if (text != "" && this.IsItemDone(text))
            {             {
                return true;                 return true;
            }             }
        }         }
        return false;         return false;
    }     }
   
    private bool IsItemDone(string itemName)     private bool IsItemDone(string itemName)
    {     {
        if (itemName == this.m_overCookedItem.name)         if (itemName == this.m_overCookedItem.name)
        {         {
            return true;             return true;
        }         }
        CookingStation.ItemConversion itemConversion = this.GetItemConversion(itemName);         CookingStation.ItemConversion itemConversion = this.GetItemConversion(itemName);
        return itemConversion != null && itemName == itemConversion.m_to.name;         return itemConversion != null && itemName == itemConversion.m_to.name;
    }     }
   
    private void SpawnItem(string name, int slot, Vector3 userPoint)     private void SpawnItem(string name, int slot, Vector3 userPoint)
    {     {
        GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(name);         GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(name);
        Vector3 vector;         Vector3 vector;
        Vector3 vector2;         Vector3 vector2;
        if (this.m_spawnPoint != null)         if (this.m_spawnPoint != null)
        {         {
            vector = this.m_spawnPoint.position;             vector = this.m_spawnPoint.position;
            vector2 = this.m_spawnPoint.forward;             vector2 = this.m_spawnPoint.forward;
        }         }
        else         else
        {         {
            Vector3 position = this.m_slots[slot].position;             Vector3 position = this.m_slots[slot].position;
            Vector3 vector3 = userPoint - position;             Vector3 vector3 = userPoint - position;
            vector3.y = 0f;             vector3.y = 0f;
            vector3.Normalize();             vector3.Normalize();
            vector = position + vector3 * 0.5f;             vector = position + vector3 * 0.5f;
            vector2 = vector3;             vector2 = vector3;
        }         }
        Quaternion quaternion = Quaternion.Euler(0f, (float)UnityEngine.Random.Range(0, 360), 0f);         Quaternion quaternion = Quaternion.Euler(0f, (float)UnityEngine.Random.Range(0, 360), 0f);
        GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(itemPrefab, vector, quaternion);         GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(itemPrefab, vector, quaternion);
        ItemDrop.OnCreateNew(gameObject);         ItemDrop.OnCreateNew(gameObject);
        gameObject.GetComponent<Rigidbody>().velocity = vector2 * this.m_spawnForce;         gameObject.GetComponent<Rigidbody>().velocity = vector2 * this.m_spawnForce;
        this.m_pickEffector.Create(vector, Quaternion.identity, null, 1f, -1);         this.m_pickEffector.Create(vector, Quaternion.identity, null, 1f, -1);
    }     }
   
    public string GetHoverText()     public string GetHoverText()
    {     {
        if (this.m_addFoodSwitch != null)         if (this.m_addFoodSwitch != null)
        {         {
            return "";             return "";
        }         }
        return Localization.instance.Localize(this.HoverText());         return Localization.instance.Localize(this.HoverText());
    }     }
   
    private string HoverText()     private string HoverText()
    {     {
        return this.m_name + "\n[<color=yellow><b>$KEY_Use</b></color>] " + this.m_addItemTooltip + (ZInput.GamepadActive ? "" : ("\n[<color=yellow><b>1-8</b></color>] " + this.m_addItemTooltip));         return this.m_name + "\n[<color=yellow><b>$KEY_Use</b></color>] " + this.m_addItemTooltip + (ZInput.GamepadActive ? "" : ("\n[<color=yellow><b>1-8</b></color>] " + this.m_addItemTooltip));
    }     }
   
    public string GetHoverName()     public string GetHoverName()
    {     {
        return this.m_name;         return this.m_name;
    }     }
   
    private bool OnAddFuelSwitch(Switch sw, Humanoid user, ItemDrop.ItemData item)     private bool OnAddFuelSwitch(Switch sw, Humanoid user, ItemDrop.ItemData item)
    {     {
        if (item != null && item.m_shared.m_name != this.m_fuelItem.m_itemData.m_shared.m_name)         if (item != null && item.m_shared.m_name != this.m_fuelItem.m_itemData.m_shared.m_name)
        {         {
            user.Message(MessageHud.MessageType.Center, "$msg_wrongitem", 0, null);             user.Message(MessageHud.MessageType.Center, "$msg_wrongitem", 0, null);
            return false;             return false;
        }         }
        if (this.GetFuel() > (float)(this.m_maxFuel - 1))         if (this.GetFuel() > (float)(this.m_maxFuel - 1))
        {         {
            user.Message(MessageHud.MessageType.Center, "$msg_itsfull", 0, null);             user.Message(MessageHud.MessageType.Center, "$msg_itsfull", 0, null);
            return false;             return false;
        }         }
        if (!user.GetInventory().HaveItem(this.m_fuelItem.m_itemData.m_shared.m_name, true))         if (!user.GetInventory().HaveItem(this.m_fuelItem.m_itemData.m_shared.m_name, true))
        {         {
            user.Message(MessageHud.MessageType.Center, "$msg_donthaveany " + this.m_fuelItem.m_itemData.m_shared.m_name, 0, null);             user.Message(MessageHud.MessageType.Center, "$msg_donthaveany " + this.m_fuelItem.m_itemData.m_shared.m_name, 0, null);
            return false;             return false;
        }         }
        user.Message(MessageHud.MessageType.Center, "$msg_added " + this.m_fuelItem.m_itemData.m_shared.m_name, 0, null);         user.Message(MessageHud.MessageType.Center, "$msg_added " + this.m_fuelItem.m_itemData.m_shared.m_name, 0, null);
        user.GetInventory().RemoveItem(this.m_fuelItem.m_itemData.m_shared.m_name, 1, -1, true);         user.GetInventory().RemoveItem(this.m_fuelItem.m_itemData.m_shared.m_name, 1, -1, true);
.        this.m_nview.InvokeRPC("AddFuel", Array.Empty<object>());         this.m_nview.InvokeRPC("RPC_AddFuel", Array.Empty<object>());
        return true;         return true;
    }     }
   
    private void RPC_AddFuel(long sender)     private void RPC_AddFuel(long sender)
    {     {
        if (!this.m_nview.IsOwner())         if (!this.m_nview.IsOwner())
        {         {
            return;             return;
        }         }
        ZLog.Log("Add fuel");         ZLog.Log("Add fuel");
        float fuel = this.GetFuel();         float fuel = this.GetFuel();
        this.SetFuel(fuel + 1f);         this.SetFuel(fuel + 1f);
        this.m_fuelAddedEffects.Create(base.transform.position, base.transform.rotation, base.transform, 1f, -1);         this.m_fuelAddedEffects.Create(base.transform.position, base.transform.rotation, base.transform, 1f, -1);
    }     }
   
    private string OnHoverFuelSwitch()     private string OnHoverFuelSwitch()
    {     {
        float fuel = this.GetFuel();         float fuel = this.GetFuel();
        Localization instance = Localization.instance;         Localization instance = Localization.instance;
        string[] array = new string[9];         string[] array = new string[9];
        array[0] = this.m_name;         array[0] = this.m_name;
        array[1] = " (";         array[1] = " (";
        array[2] = this.m_fuelItem.m_itemData.m_shared.m_name;         array[2] = this.m_fuelItem.m_itemData.m_shared.m_name;
        array[3] = " ";         array[3] = " ";
        array[4] = Mathf.Ceil(fuel).ToString();         array[4] = Mathf.Ceil(fuel).ToString();
        array[5] = "/";         array[5] = "/";
        int num = 6;         int num = 6;
        int maxFuel = this.m_maxFuel;         int maxFuel = this.m_maxFuel;
        array[num] = maxFuel.ToString();         array[num] = maxFuel.ToString();
        array[7] = ")\n[<color=yellow><b>$KEY_Use</b></color>] $piece_smelter_add ";         array[7] = ")\n[<color=yellow><b>$KEY_Use</b></color>] $piece_smelter_add ";
        array[8] = this.m_fuelItem.m_itemData.m_shared.m_name;         array[8] = this.m_fuelItem.m_itemData.m_shared.m_name;
        return instance.Localize(string.Concat(array));         return instance.Localize(string.Concat(array));
    }     }
   
    private bool OnAddFoodSwitch(Switch caller, Humanoid user, ItemDrop.ItemData item)     private bool OnAddFoodSwitch(Switch caller, Humanoid user, ItemDrop.ItemData item)
    {     {
        ZLog.Log("add food switch");         ZLog.Log("add food switch");
        if (item != null)         if (item != null)
        {         {
            return this.OnUseItem(user, item);             return this.OnUseItem(user, item);
        }         }
        return this.OnInteract(user);         return this.OnInteract(user);
    }     }
   
    public bool Interact(Humanoid user, bool hold, bool alt)     public bool Interact(Humanoid user, bool hold, bool alt)
    {     {
        return !hold && !(this.m_addFoodSwitch != null) && this.OnInteract(user);         return !hold && !(this.m_addFoodSwitch != null) && this.OnInteract(user);
    }     }
   
    private bool OnInteract(Humanoid user)     private bool OnInteract(Humanoid user)
    {     {
        if (this.HaveDoneItem())         if (this.HaveDoneItem())
        {         {
.            this.m_nview.InvokeRPC("RemoveDoneItem", new object[] { user.transform.position });             this.m_nview.InvokeRPC("RPC_RemoveDoneItem", new object[] { user.transform.position });
            return true;             return true;
        }         }
        ItemDrop.ItemData itemData = this.FindCookableItem(user.GetInventory());         ItemDrop.ItemData itemData = this.FindCookableItem(user.GetInventory());
        if (itemData == null)         if (itemData == null)
        {         {
            CookingStation.ItemMessage itemMessage = this.FindIncompatibleItem(user.GetInventory());             CookingStation.ItemMessage itemMessage = this.FindIncompatibleItem(user.GetInventory());
            if (itemMessage != null)             if (itemMessage != null)
            {             {
                user.Message(MessageHud.MessageType.Center, itemMessage.m_message + " " + itemMessage.m_item.m_itemData.m_shared.m_name, 0, null);                 user.Message(MessageHud.MessageType.Center, itemMessage.m_message + " " + itemMessage.m_item.m_itemData.m_shared.m_name, 0, null);
            }             }
            else             else
            {             {
                user.Message(MessageHud.MessageType.Center, "$msg_nocookitems", 0, null);                 user.Message(MessageHud.MessageType.Center, "$msg_nocookitems", 0, null);
            }             }
            return false;             return false;
        }         }
        return this.OnUseItem(user, itemData);         return this.OnUseItem(user, itemData);
    }     }
   
    public bool UseItem(Humanoid user, ItemDrop.ItemData item)     public bool UseItem(Humanoid user, ItemDrop.ItemData item)
    {     {
        return !(this.m_addFoodSwitch != null) && this.OnUseItem(user, item);         return !(this.m_addFoodSwitch != null) && this.OnUseItem(user, item);
    }     }
   
    private bool OnUseItem(Humanoid user, ItemDrop.ItemData item)     private bool OnUseItem(Humanoid user, ItemDrop.ItemData item)
    {     {
        if (this.m_requireFire && !this.IsFireLit())         if (this.m_requireFire && !this.IsFireLit())
        {         {
            user.Message(MessageHud.MessageType.Center, "$msg_needfire", 0, null);             user.Message(MessageHud.MessageType.Center, "$msg_needfire", 0, null);
            return false;             return false;
        }         }
        if (this.GetFreeSlot() == -1)         if (this.GetFreeSlot() == -1)
        {         {
            user.Message(MessageHud.MessageType.Center, "$msg_nocookroom", 0, null);             user.Message(MessageHud.MessageType.Center, "$msg_nocookroom", 0, null);
            return false;             return false;
        }         }
        return this.CookItem(user, item);         return this.CookItem(user, item);
    }     }
   
    private bool IsFireLit()     private bool IsFireLit()
    {     {
        if (this.m_fireCheckPoints != null && this.m_fireCheckPoints.Length != 0)         if (this.m_fireCheckPoints != null && this.m_fireCheckPoints.Length != 0)
        {         {
            Transform[] fireCheckPoints = this.m_fireCheckPoints;             Transform[] fireCheckPoints = this.m_fireCheckPoints;
            for (int i = 0; i < fireCheckPoints.Length; i++)             for (int i = 0; i < fireCheckPoints.Length; i++)
            {             {
                if (!EffectArea.IsPointInsideArea(fireCheckPoints[i].position, EffectArea.Type.Burning, this.m_fireCheckRadius))                 if (!EffectArea.IsPointInsideArea(fireCheckPoints[i].position, EffectArea.Type.Burning, this.m_fireCheckRadius))
                {                 {
                    return false;                     return false;
                }                 }
            }             }
            return true;             return true;
        }         }
        return EffectArea.IsPointInsideArea(base.transform.position, EffectArea.Type.Burning, this.m_fireCheckRadius);         return EffectArea.IsPointInsideArea(base.transform.position, EffectArea.Type.Burning, this.m_fireCheckRadius);
    }     }
   
    private ItemDrop.ItemData FindCookableItem(Inventory inventory)     private ItemDrop.ItemData FindCookableItem(Inventory inventory)
    {     {
        foreach (CookingStation.ItemConversion itemConversion in this.m_conversion)         foreach (CookingStation.ItemConversion itemConversion in this.m_conversion)
        {         {
            ItemDrop.ItemData item = inventory.GetItem(itemConversion.m_from.m_itemData.m_shared.m_name, -1, false);             ItemDrop.ItemData item = inventory.GetItem(itemConversion.m_from.m_itemData.m_shared.m_name, -1, false);
            if (item != null)             if (item != null)
            {             {
                return item;                 return item;
            }             }
        }         }
        return null;         return null;
    }     }
   
    private CookingStation.ItemMessage FindIncompatibleItem(Inventory inventory)     private CookingStation.ItemMessage FindIncompatibleItem(Inventory inventory)
    {     {
        foreach (CookingStation.ItemMessage itemMessage in this.m_incompatibleItems)         foreach (CookingStation.ItemMessage itemMessage in this.m_incompatibleItems)
        {         {
            if (inventory.GetItem(itemMessage.m_item.m_itemData.m_shared.m_name, -1, false) != null)             if (inventory.GetItem(itemMessage.m_item.m_itemData.m_shared.m_name, -1, false) != null)
            {             {
                return itemMessage;                 return itemMessage;
            }             }
        }         }
        return null;         return null;
    }     }
   
    private bool CookItem(Humanoid user, ItemDrop.ItemData item)     private bool CookItem(Humanoid user, ItemDrop.ItemData item)
    {     {
        string name = item.m_dropPrefab.name;         string name = item.m_dropPrefab.name;
        if (!this.m_nview.HasOwner())         if (!this.m_nview.HasOwner())
        {         {
            this.m_nview.ClaimOwnership();             this.m_nview.ClaimOwnership();
        }         }
        foreach (CookingStation.ItemMessage itemMessage in this.m_incompatibleItems)         foreach (CookingStation.ItemMessage itemMessage in this.m_incompatibleItems)
        {         {
            if (itemMessage.m_item.m_itemData.m_shared.m_name == item.m_shared.m_name)             if (itemMessage.m_item.m_itemData.m_shared.m_name == item.m_shared.m_name)
            {             {
                user.Message(MessageHud.MessageType.Center, itemMessage.m_message + " " + itemMessage.m_item.m_itemData.m_shared.m_name, 0, null);                 user.Message(MessageHud.MessageType.Center, itemMessage.m_message + " " + itemMessage.m_item.m_itemData.m_shared.m_name, 0, null);
                return true;                 return true;
            }             }
        }         }
        if (!this.IsItemAllowed(item))         if (!this.IsItemAllowed(item))
        {         {
            return false;             return false;
        }         }
        if (this.GetFreeSlot() == -1)         if (this.GetFreeSlot() == -1)
        {         {
            return false;             return false;
        }         }
        user.GetInventory().RemoveOneItem(item);         user.GetInventory().RemoveOneItem(item);
.        this.m_nview.InvokeRPC("AddItem", new object[] { name });         this.m_nview.InvokeRPC("RPC_AddItem", new object[] { name });
        return true;         return true;
    }     }
   
    private void RPC_AddItem(long sender, string itemName)     private void RPC_AddItem(long sender, string itemName)
    {     {
        if (!this.IsItemAllowed(itemName))         if (!this.IsItemAllowed(itemName))
        {         {
            return;             return;
        }         }
        int freeSlot = this.GetFreeSlot();         int freeSlot = this.GetFreeSlot();
        if (freeSlot == -1)         if (freeSlot == -1)
        {         {
            return;             return;
        }         }
        this.SetSlot(freeSlot, itemName, 0f, CookingStation.Status.NotDone);         this.SetSlot(freeSlot, itemName, 0f, CookingStation.Status.NotDone);
.        this.m_nview.InvokeRPC(ZNetView.Everybody, "SetSlotVisual", new object[] { freeSlot, itemName });         this.m_nview.InvokeRPC(ZNetView.Everybody, "RPC_SetSlotVisual", new object[] { freeSlot, itemName });
        this.m_addEffect.Create(this.m_slots[freeSlot].position, Quaternion.identity, null, 1f, -1);         this.m_addEffect.Create(this.m_slots[freeSlot].position, Quaternion.identity, null, 1f, -1);
    }     }
   
    private void SetSlot(int slot, string itemName, float cookedTime, CookingStation.Status status)     private void SetSlot(int slot, string itemName, float cookedTime, CookingStation.Status status)
    {     {
        if (!this.m_nview.IsValid())         if (!this.m_nview.IsValid())
        {         {
            return;             return;
        }         }
        this.m_nview.GetZDO().Set("slot" + slot.ToString(), itemName);         this.m_nview.GetZDO().Set("slot" + slot.ToString(), itemName);
        this.m_nview.GetZDO().Set("slot" + slot.ToString(), cookedTime);         this.m_nview.GetZDO().Set("slot" + slot.ToString(), cookedTime);
        this.m_nview.GetZDO().Set("slotstatus" + slot.ToString(), (int)status);         this.m_nview.GetZDO().Set("slotstatus" + slot.ToString(), (int)status);
    }     }
   
    private void GetSlot(int slot, out string itemName, out float cookedTime, out CookingStation.Status status)     private void GetSlot(int slot, out string itemName, out float cookedTime, out CookingStation.Status status)
    {     {
        if (!this.m_nview.IsValid())         if (!this.m_nview.IsValid())
        {         {
            itemName = "";             itemName = "";
            status = CookingStation.Status.NotDone;             status = CookingStation.Status.NotDone;
            cookedTime = 0f;             cookedTime = 0f;
            return;             return;
        }         }
        itemName = this.m_nview.GetZDO().GetString("slot" + slot.ToString(), "");         itemName = this.m_nview.GetZDO().GetString("slot" + slot.ToString(), "");
        cookedTime = this.m_nview.GetZDO().GetFloat("slot" + slot.ToString(), 0f);         cookedTime = this.m_nview.GetZDO().GetFloat("slot" + slot.ToString(), 0f);
        status = (CookingStation.Status)this.m_nview.GetZDO().GetInt("slotstatus" + slot.ToString(), 0);         status = (CookingStation.Status)this.m_nview.GetZDO().GetInt("slotstatus" + slot.ToString(), 0);
    }     }
   
    private bool IsEmpty()     private bool IsEmpty()
    {     {
        for (int i = 0; i < this.m_slots.Length; i++)         for (int i = 0; i < this.m_slots.Length; i++)
        {         {
            if (this.m_nview.GetZDO().GetString("slot" + i.ToString(), "") != "")             if (this.m_nview.GetZDO().GetString("slot" + i.ToString(), "") != "")
            {             {
                return false;                 return false;
            }             }
        }         }
        return true;         return true;
    }     }
   
    private int GetFreeSlot()     private int GetFreeSlot()
    {     {
        for (int i = 0; i < this.m_slots.Length; i++)         for (int i = 0; i < this.m_slots.Length; i++)
        {         {
            if (this.m_nview.GetZDO().GetString("slot" + i.ToString(), "") == "")             if (this.m_nview.GetZDO().GetString("slot" + i.ToString(), "") == "")
            {             {
                return i;                 return i;
            }             }
        }         }
        return -1;         return -1;
    }     }
   
    private bool IsItemAllowed(ItemDrop.ItemData item)     private bool IsItemAllowed(ItemDrop.ItemData item)
    {     {
        return this.IsItemAllowed(item.m_dropPrefab.name);         return this.IsItemAllowed(item.m_dropPrefab.name);
    }     }
   
    private bool IsItemAllowed(string itemName)     private bool IsItemAllowed(string itemName)
    {     {
        using (List<CookingStation.ItemConversion>.Enumerator enumerator = this.m_conversion.GetEnumerator())         using (List<CookingStation.ItemConversion>.Enumerator enumerator = this.m_conversion.GetEnumerator())
        {         {
            while (enumerator.MoveNext())             while (enumerator.MoveNext())
            {             {
                if (enumerator.Current.m_from.gameObject.name == itemName)                 if (enumerator.Current.m_from.gameObject.name == itemName)
                {                 {
                    return true;                     return true;
                }                 }
            }             }
        }         }
        return false;         return false;
    }     }
   
    private CookingStation.ItemConversion GetItemConversion(string itemName)     private CookingStation.ItemConversion GetItemConversion(string itemName)
    {     {
        foreach (CookingStation.ItemConversion itemConversion in this.m_conversion)         foreach (CookingStation.ItemConversion itemConversion in this.m_conversion)
        {         {
            if (itemConversion.m_from.gameObject.name == itemName || itemConversion.m_to.gameObject.name == itemName)             if (itemConversion.m_from.gameObject.name == itemName || itemConversion.m_to.gameObject.name == itemName)
            {             {
                return itemConversion;                 return itemConversion;
            }             }
        }         }
        return null;         return null;
    }     }
   
    private void SetFuel(float fuel)     private void SetFuel(float fuel)
    {     {
        this.m_nview.GetZDO().Set(ZDOVars.s_fuel, fuel);         this.m_nview.GetZDO().Set(ZDOVars.s_fuel, fuel);
    }     }
   
    private float GetFuel()     private float GetFuel()
    {     {
        return this.m_nview.GetZDO().GetFloat(ZDOVars.s_fuel, 0f);         return this.m_nview.GetZDO().GetFloat(ZDOVars.s_fuel, 0f);
    }     }
   
    private void OnDrawGizmosSelected()     private void OnDrawGizmosSelected()
    {     {
        if (this.m_requireFire)         if (this.m_requireFire)
        {         {
            if (this.m_fireCheckPoints != null && this.m_fireCheckPoints.Length != 0)             if (this.m_fireCheckPoints != null && this.m_fireCheckPoints.Length != 0)
            {             {
                foreach (Transform transform in this.m_fireCheckPoints)                 foreach (Transform transform in this.m_fireCheckPoints)
                {                 {
                    Gizmos.color = Color.red;                     Gizmos.color = Color.red;
                    Gizmos.DrawWireSphere(transform.position, this.m_fireCheckRadius);                     Gizmos.DrawWireSphere(transform.position, this.m_fireCheckRadius);
                }                 }
                return;                 return;
            }             }
            Gizmos.color = Color.red;             Gizmos.color = Color.red;
            Gizmos.DrawWireSphere(base.transform.position, this.m_fireCheckRadius);             Gizmos.DrawWireSphere(base.transform.position, this.m_fireCheckRadius);
        }         }
    }     }
   
    [CompilerGenerated]     [CompilerGenerated]
    private void <DropAllItems>g__drop|1_0(ItemDrop item)     private void <DropAllItems>g__drop|1_0(ItemDrop item)
    {     {
        Vector3 vector = base.transform.position + Vector3.up + UnityEngine.Random.insideUnitSphere * 0.3f;         Vector3 vector = base.transform.position + Vector3.up + UnityEngine.Random.insideUnitSphere * 0.3f;
        Quaternion quaternion = Quaternion.Euler(0f, (float)UnityEngine.Random.Range(0, 360), 0f);         Quaternion quaternion = Quaternion.Euler(0f, (float)UnityEngine.Random.Range(0, 360), 0f);
        ItemDrop.OnCreateNew(UnityEngine.Object.Instantiate<GameObject>(item.gameObject, vector, quaternion));         ItemDrop.OnCreateNew(UnityEngine.Object.Instantiate<GameObject>(item.gameObject, vector, quaternion));
    }     }
   
    public Switch m_addFoodSwitch;     public Switch m_addFoodSwitch;
   
    public Switch m_addFuelSwitch;     public Switch m_addFuelSwitch;
   
    public EffectList m_addEffect = new EffectList();     public EffectList m_addEffect = new EffectList();
   
    public EffectList m_doneEffect = new EffectList();     public EffectList m_doneEffect = new EffectList();
   
    public EffectList m_overcookedEffect = new EffectList();     public EffectList m_overcookedEffect = new EffectList();
   
    public EffectList m_pickEffector = new EffectList();     public EffectList m_pickEffector = new EffectList();
   
    public string m_addItemTooltip = "$piece_cstand_cook";     public string m_addItemTooltip = "$piece_cstand_cook";
   
    public Transform m_spawnPoint;     public Transform m_spawnPoint;
   
    public float m_spawnForce = 5f;     public float m_spawnForce = 5f;
   
    public ItemDrop m_overCookedItem;     public ItemDrop m_overCookedItem;
   
    public List<CookingStation.ItemConversion> m_conversion = new List<CookingStation.ItemConversion>();     public List<CookingStation.ItemConversion> m_conversion = new List<CookingStation.ItemConversion>();
   
    public List<CookingStation.ItemMessage> m_incompatibleItems = new List<CookingStation.ItemMessage>();     public List<CookingStation.ItemMessage> m_incompatibleItems = new List<CookingStation.ItemMessage>();
   
    public Transform[] m_slots;     public Transform[] m_slots;
   
    public ParticleSystem[] m_donePS;     public ParticleSystem[] m_donePS;
   
    public ParticleSystem[] m_burntPS;     public ParticleSystem[] m_burntPS;
   
    public string m_name = "";     public string m_name = "";
   
    public bool m_requireFire = true;     public bool m_requireFire = true;
   
    public Transform[] m_fireCheckPoints;     public Transform[] m_fireCheckPoints;
   
    public float m_fireCheckRadius = 0.25f;     public float m_fireCheckRadius = 0.25f;
   
    public bool m_useFuel;     public bool m_useFuel;
   
    public ItemDrop m_fuelItem;     public ItemDrop m_fuelItem;
   
    public int m_maxFuel = 10;     public int m_maxFuel = 10;
   
    public int m_secPerFuel = 5000;     public int m_secPerFuel = 5000;
   
    public EffectList m_fuelAddedEffects = new EffectList();     public EffectList m_fuelAddedEffects = new EffectList();
   
    public GameObject m_haveFuelObject;     public GameObject m_haveFuelObject;
   
    public GameObject m_haveFireObject;     public GameObject m_haveFireObject;
   
    private ZNetView m_nview;     private ZNetView m_nview;
   
    private ParticleSystem[] m_ps;     private ParticleSystem[] m_ps;
   
    private AudioSource[] m_as;     private AudioSource[] m_as;
   
    [Serializable]     [Serializable]
    public class ItemConversion     public class ItemConversion
    {     {
        public ItemDrop m_from;         public ItemDrop m_from;
   
        public ItemDrop m_to;         public ItemDrop m_to;
   
        public float m_cookTime = 10f;         public float m_cookTime = 10f;
    }     }
   
    [Serializable]     [Serializable]
    public class ItemMessage     public class ItemMessage
    {     {
        public ItemDrop m_item;         public ItemDrop m_item;
   
        public string m_message;         public string m_message;
    }     }
   
    private enum Status     private enum Status
    {     {
        NotDone,         NotDone,
        Done,         Done,
        Burnt         Burnt
    }     }
} }