Exemplo n.º 1
0
 public void SetItemInfo(InventoryGUIObject item)
 {
     ItemIcon.sprite     = item.InventoryIcon;
     ItemName.text       = item.ItemName;
     ItemName.color      = item.MainColor;
     Outline.effectColor = item.SecondaryColor;
 }
Exemplo n.º 2
0
    private void Start()
    {
        if (LinkedRecipe == null || ItemIcon == null || ItemName == null || CostImages == null || Outline == null || noCostText == null)
        {
            Debug.LogError("RecipeSelectButton: Start: not all references set");
            return;
        }

        InventoryGUIObject item = LinkedRecipe.GetComponent <InventoryGUIObject>();

        if (item == null)
        {
            Debug.LogError("RecipeSelectButton: Start: no <InventoryGUIObject> component found in recipe item");
            return;
        }

        GetComponent <GUIButton>().onClick.AddListener(() =>
        {
            Messaging.Crafting.SelectRecipe.Invoke(item);
        });

        ItemIcon.sprite     = item.InventoryIcon;
        ItemIcon.color      = Color.white;
        ItemName.text       = item.ItemName;
        ItemName.color      = item.MainColor;
        Outline.effectColor = item.SecondaryColor;

        noCostText.gameObject.SetActive(item.AssembleCost == CraftingCost.none);
        CostImages.SetCost(item.AssembleCost);
    }
Exemplo n.º 3
0
    public void SetUpgradeItem(InventoryGUIObject item)
    {
        if (item == null)
        {
            Debug.LogError("AugmentUpgradeDisplay: SetUpgradeItem: item == null");
            gameObject.SetActive(false);
            return;
        }

        UpgradeButton.gameObject.SetActive(true);
        CostGrid.gameObject.SetActive(true);

        CostGrid.SetCost(item.AssembleCost);
        ItemIcon.sprite = item.InventoryIcon;
        ItemIcon.color  = Color.white;

        ItemHover.Item = item;

        UpgradeButton.onClick.RemoveAllListeners();
        UpgradeButton.onClick.AddListener(() =>
        {
            if (Stash.CraftingMaterials < item.AssembleCost)
            {
                Messaging.GUI.ScreenMessage.Invoke("NOT ENOUGH MATERIALS!", Color.red);
                return;
            }

            Stash.CraftingMaterials            -= item.AssembleCost;
            PlayerInfo.CurrentLocal.AugmentItem = item;
            Messaging.Crafting.RefreshAssembler.Invoke();
            Messaging.Crafting.CraftingMaterialsUpdated.Invoke();
        });
    }
Exemplo n.º 4
0
    public static void Deserialize(List <Lump> lumps)
    {
        StashItems.Clear();

        CraftingMaterials = new CraftingCost(0, 0, 0, 0);

        if (lumps.Count > 0)
        {
            if (lumps[0].lumpName == "CRAFTMATS")
            {
                MemoryStream stream = new MemoryStream(lumps[0].data);
                BinaryReader br     = new BinaryReader(stream);

                CraftingMaterials.u = br.ReadInt32();
                CraftingMaterials.a = br.ReadInt32();
                CraftingMaterials.w = br.ReadInt32();
                CraftingMaterials.g = br.ReadInt32();

                br.Close();
                stream.Close();
            }
        }

        for (int i = 1; i < lumps.Count; i++)
        {
            Lump l = lumps[i];

            if (l.lumpName == "null")
            {
                StashItems.Add(null);
            }
            else
            {
                if (!ThingDesignator.Designations.ContainsKey(l.lumpName))
                {
                    Debug.LogError("Stash: Deserialize: designation \"" + l.lumpName + "\" not found in designator");
                    return;
                }

                GameObject         prefab = ThingDesignator.Designations[l.lumpName];
                InventoryGUIObject g      = prefab.GetComponent <InventoryGUIObject>();

                if (g == null)
                {
                    Debug.LogError("Stash: Deserialize: designation \"" + l.lumpName + "\" does not contain <InventoryGUIObject> component");
                    return;
                }

                //g.Deserialize(l.data);
                StashItems.Add(g);
            }
        }

        for (int i = 0; i < ExtraEmptySlots; i++)
        {
            StashItems.Add(null);
        }
    }
    private void Refresh()
    {
        InventoryGUIObject a = PlayerInfo.CurrentLocal.PlayerAccessories[transform.parent.GetSiblingIndex()];

        if (a == null)
        {
            button.SetSprite(null);
        }
        else
        {
            button.SetSprite(a.InventoryIcon);
        }
    }
Exemplo n.º 6
0
    private void Refresh()
    {
        InventoryGUIObject s = PlayerInfo.CurrentLocal.PlayerSkills[transform.parent.GetSiblingIndex()];

        if (s == null)
        {
            button.SetSprite(null);
        }
        else
        {
            button.SetSprite(s.InventoryIcon);
        }
    }
Exemplo n.º 7
0
    public static void AddItemToFirstEmpty(InventoryGUIObject item, out int slot)
    {
        for (int i = 0; i < StashItems.Count; i++)
        {
            if (StashItems[i] == null)
            {
                StashItems.RemoveAt(i);
                StashItems.Insert(i, item);
                slot = i;
                return;
            }
        }

        slot = StashItems.Count;
        StashItems.Add(item);
    }
Exemplo n.º 8
0
    private void Awake()
    {
        AudioSource audioSource = GetComponent <AudioSource>();

        useObject = GetComponent <CommonUsableObject>();

        useObject.OnUse.AddListener((character) =>
        {
            if (Used)
            {
                return;
            }
            Used = true;

            audioSource?.Play();

            if (LootTable.Length == 0)
            {
                return;
            }

            for (int i = 0; i < Loot; i++)
            {
                int r = Random.Range(0, LootTable.Length);
                InventoryGUIObject item = LootTable[r].GetComponent <InventoryGUIObject>();

                if (item == null)
                {
                    Debug.LogError("LootBoxes: OnUse: no <InventoryGUIObject> component found in loot index [" + r + "]");
                    return;
                }

                if (item is CraftingMatGUIObject)
                {
                    Stash.CraftingMaterials += (item as CraftingMatGUIObject).craftingMats;
                }
                else
                {
                    Stash.AddItemToFirstEmpty(item, out int _);
                }

                Messaging.GUI.LootMessage.Invoke(item, 0);
            }

            useObject.enabled = false;
        });
    }
Exemplo n.º 9
0
    private void Awake()
    {
        GetComponent <LevelChangeTeleport>().OnPlayerTouch.AddListener(() =>
        {
            if (!MissionCompleted)
            {
                return;
            }

            if (PlayerInfo.CurrentLocal.Level < MaxPlayerLevelIncrease)
            {
                PlayerInfo.CurrentLocal.Level++;
            }

            for (int i = 0; i < Loot; i++)
            {
                int r = Random.Range(0, LootTable.Length);
                InventoryGUIObject item = LootTable[r].GetComponent <InventoryGUIObject>();

                if (item == null)
                {
                    Debug.LogError("MissionRewardTeleport: OnPlayerTouch: no <InventoryGUIObject> component found in loot index [" + r + "]");
                    return;
                }

                if (item is CraftingMatGUIObject)
                {
                    Stash.CraftingMaterials += (item as CraftingMatGUIObject).craftingMats;
                }
                else
                {
                    Stash.AddItemToFirstEmpty(item, out int _);
                }

                Messaging.GUI.LootMessage.Invoke(item, Delay);
            }
        });

        Messaging.Mission.MissionStatus.AddListener((b) =>
        {
            MissionCompleted = b;
        });
    }
Exemplo n.º 10
0
    private void Awake()
    {
        GetComponent <MonsterCharacter>().OnDeath.AddListener(() =>
        {
            CreateLevelChange(FadeoutTime, TargetLevel, EntryPoint, transform.position);

            //loot
            if (PlayerInfo.CurrentLocal.Level < MaxPlayerLevelIncrease)
            {
                PlayerInfo.CurrentLocal.Level++;
            }

            for (int i = 0; i < Loot; i++)
            {
                int r = Random.Range(0, LootTable.Length);
                InventoryGUIObject item = LootTable[r].GetComponent <InventoryGUIObject>();

                if (item == null)
                {
                    Debug.LogError("MissionRewardTeleport: OnPlayerTouch: no <InventoryGUIObject> component found in loot index [" + r + "]");
                    return;
                }

                if (item is CraftingMatGUIObject)
                {
                    Stash.CraftingMaterials += (item as CraftingMatGUIObject).craftingMats;
                }
                else
                {
                    Stash.AddItemToFirstEmpty(item, out int _);
                }

                Messaging.GUI.LootMessage.Invoke(item, FadeoutTime + Delay);
            }
        });
    }
    private void Awake()
    {
        button = GetComponent <GUIButton>();

        int index = transform.parent.GetSiblingIndex();

        button.onClick.AddListener(() =>
        {
            InventoryGUIObject a = PlayerInfo.CurrentLocal.CursorItem;

            if (a != null)
            {
                if (!(a is Accessory))
                {
                    return;
                }

                Messaging.Player.DeActivateAccessory.Invoke(index);
                PlayerInfo.CurrentLocal.CursorItem = PlayerInfo.CurrentLocal.PlayerAccessories[index];
                PlayerInfo.CurrentLocal.PlayerAccessories[index] = (Accessory)a;
                button.SetSprite(a.InventoryIcon);
                Messaging.Player.ActivateAccessory.Invoke(index);
                Messaging.Player.LoadoutRefresh.Invoke();
                Messaging.GUI.HoverBox.Invoke(a.GetShortStats);
            }
            else
            {
                if (HotkeyAssigment.InventoryKey)
                {
                    switch (Stash.RightStashMode)
                    {
                    default:
                    case Stash.StashMode.Disabled:
                        return;

                    case Stash.StashMode.Assembler:
                        if (PlayerInfo.CurrentLocal.AssemblerItem != null)
                        {
                            return;
                        }

                        PlayerInfo.CurrentLocal.AssemblerItem = PlayerInfo.CurrentLocal.PlayerAccessories[index];
                        Messaging.Crafting.RefreshAssembler.Invoke();
                        break;

                    case Stash.StashMode.Stash:
                        Stash.AddItemToFirstEmpty(PlayerInfo.CurrentLocal.PlayerAccessories[index], out int slot);
                        Messaging.Player.RefreshStash.Invoke(slot);
                        break;

                    case Stash.StashMode.Disassembler:
                        if (PlayerInfo.CurrentLocal.DisassemblerItem != null)
                        {
                            return;
                        }

                        PlayerInfo.CurrentLocal.DisassemblerItem = PlayerInfo.CurrentLocal.PlayerAccessories[index];
                        Messaging.Crafting.RefreshAssembler.Invoke();
                        break;

                    case Stash.StashMode.Augment:
                        if (PlayerInfo.CurrentLocal.AugmentItem != null)
                        {
                            return;
                        }

                        PlayerInfo.CurrentLocal.AugmentItem = PlayerInfo.CurrentLocal.PlayerAccessories[index];
                        Messaging.Crafting.RefreshAssembler.Invoke();
                        break;
                    }
                }
                else
                {
                    PlayerInfo.CurrentLocal.CursorItem = PlayerInfo.CurrentLocal.PlayerAccessories[index];
                }

                Messaging.Player.DeActivateAccessory.Invoke(index);
                PlayerInfo.CurrentLocal.PlayerAccessories[index] = null;
                button.SetSprite(null);
                Messaging.Player.LoadoutRefresh.Invoke();
                Messaging.GUI.HoverBox.Invoke("");
            }
        });

        button.OnCursorEnter.AddListener(() =>
        {
            if (PlayerInfo.CurrentLocal.PlayerAccessories[transform.parent.GetSiblingIndex()] == null)
            {
                Messaging.GUI.HoverBox.Invoke("");
            }
            else
            {
                Messaging.GUI.HoverBox.Invoke(PlayerInfo.CurrentLocal.PlayerAccessories[transform.parent.GetSiblingIndex()].GetShortStats);
            }
        });

        button.OnCursorExit.AddListener(() => { Messaging.GUI.HoverBox.Invoke(""); });

        Messaging.Player.LoadoutRefresh.AddListener(() => { Refresh(); });
    }
Exemplo n.º 12
0
    public static void Deserialize(List <Lump> lumps)
    {
        int i = 0;

        CurrentLocal.RPGName         = Encoding.ASCII.GetString(lumps[i++].data);
        CurrentLocal.RPGProfession   = Encoding.ASCII.GetString(lumps[i++].data);
        CurrentLocal.Portrait        = BitConverter.ToInt32(lumps[i++].data, 0);
        CurrentLocal.Badge           = BitConverter.ToInt32(lumps[i++].data, 0);
        CurrentLocal.Level           = BitConverter.ToInt32(lumps[i++].data, 0);
        Difficulty.CurrentDifficulty = BitConverter.ToInt32(lumps[i++].data, 0);
        CurrentLocal.CurrentMap      = Encoding.ASCII.GetString(lumps[i++].data);

        Difficulty.SharedStash    = BitConverter.ToBoolean(lumps[i++].data, 0);
        Difficulty.PermanentDeath = BitConverter.ToBoolean(lumps[i++].data, 0);
        Difficulty.PlayerDamage   = BitConverter.ToInt32(lumps[i++].data, 0);
        Difficulty.EnemyDamage    = BitConverter.ToInt32(lumps[i++].data, 0);

        //faction colors
        {
            MemoryStream stream = new MemoryStream(lumps[i].data);
            BinaryReader br     = new BinaryReader(stream);

            List <Color> colors = new List <Color>();
            for (int p = 0; p < lumps[i].data.Length / 16; p++)
            {
                colors.Add(new Color(br.ReadSingle(), br.ReadSingle(), br.ReadSingle(), br.ReadSingle()));
            }

            CurrentLocal.FactionColors = colors.ToArray();

            br.Close();
            stream.Close();

            i++;
        }

        for (int w = 0; w < CurrentLocal.PlayerWeapons.Length; w++, i++)
        {
            if (lumps[i].lumpName == "null")
            {
                CurrentLocal.PlayerWeapons[w] = null;
                continue;
            }

            if (!ThingDesignator.Designations.ContainsKey(lumps[i].lumpName))
            {
                Debug.LogError("PlayerInfo: Deserialize: weaponslot[" + w + "] designation \"" + lumps[i].lumpName + "\" not found in designator");
                continue;
            }

            GameObject prefab = ThingDesignator.Designations[lumps[i].lumpName];
            Weapon     weapon = prefab.GetComponent <Weapon>();

            if (weapon == null)
            {
                Debug.LogError("PlayerInfo: Deserialize: weaponslot[" + w + "] designation \"" + lumps[i].lumpName + "\" does not contain <Weapon> component");
                continue;
            }

            //(weapon as InventoryGUIObject).Deserialize(lumps[i].data);
            CurrentLocal.PlayerWeapons[w] = weapon;
        }

        for (int s = 0; s < CurrentLocal.PlayerSkills.Length; s++, i++)
        {
            if (lumps[i].lumpName == "null")
            {
                CurrentLocal.PlayerSkills[s] = null;
                continue;
            }

            if (!ThingDesignator.Designations.ContainsKey(lumps[i].lumpName))
            {
                Debug.LogError("PlayerInfo: Deserialize: skillslot[" + s + "] designation \"" + lumps[i].lumpName + "\" not found in designator");
                continue;
            }

            GameObject prefab = ThingDesignator.Designations[lumps[i].lumpName];
            Skill      skill  = prefab.GetComponent <Skill>();

            if (skill == null)
            {
                Debug.LogError("PlayerInfo: Deserialize: skillslot[" + s + "] designation \"" + lumps[i].lumpName + "\" does not contain <Skill> component");
                continue;
            }

            //(skill as InventoryGUIObject).Deserialize(lumps[i].data);
            CurrentLocal.PlayerSkills[s] = skill;
        }

        for (int a = 0; a < CurrentLocal.PlayerAccessories.Length; a++, i++)
        {
            if (lumps[i].lumpName == "null")
            {
                CurrentLocal.PlayerAccessories[a] = null;
                continue;
            }

            if (!ThingDesignator.Designations.ContainsKey(lumps[i].lumpName))
            {
                Debug.LogError("PlayerInfo: Deserialize: accessoryslot[" + a + "] designation \"" + lumps[i].lumpName + "\" not found in designator");
                continue;
            }

            GameObject prefab    = ThingDesignator.Designations[lumps[i].lumpName];
            Accessory  accessory = prefab.GetComponent <Accessory>();

            if (accessory == null)
            {
                Debug.LogError("PlayerInfo: Deserialize: accessoryslot[" + a + "] designation \"" + lumps[i].lumpName + "\" does not contain <Accessory> component");
                continue;
            }

            //(accessory as InventoryGUIObject).Deserialize(lumps[i].data);
            CurrentLocal.PlayerAccessories[a] = accessory;
        }

        if (lumps[i].lumpName == "null")
        {
            CurrentLocal.CursorItem = null;
        }
        else
        {
            if (!ThingDesignator.Designations.ContainsKey(lumps[i].lumpName))
            {
                Debug.LogError("PlayerInfo: Deserialize: cursoritem designation \"" + lumps[i].lumpName + "\" not found in designator");
                return;
            }

            GameObject         prefab = ThingDesignator.Designations[lumps[i].lumpName];
            InventoryGUIObject g      = prefab.GetComponent <InventoryGUIObject>();

            if (g == null)
            {
                Debug.LogError("PlayerInfo: Deserialize: cursoritem designation \"" + lumps[i].lumpName + "\" does not contain <InventoryGUIObject> component");
                return;
            }

            //g.Deserialize(lumps[i].data);
            CurrentLocal.CursorItem = g;
        }

        CurrentLocal.LastPlayerWeaponSwap = BitConverter.ToInt32(lumps[++i].data, 0);

        //talents
        {
            CurrentLocal.Talents.Clear();

            MemoryStream stream = new MemoryStream(lumps[++i].data);
            BinaryReader br     = new BinaryReader(stream);

            CurrentLocal.TalentPoints = br.ReadInt32();

            for (int t = 0; t < (lumps[i].data.Length - 1) / 12; t++)
            {
                string referenceName = Wad.ByteString(br.ReadBytes(12));

                if (!ThingDesignator.Designations.ContainsKey(referenceName))
                {
                    Debug.LogError("PlayerInfo: Deserialize: talent designation \"" + referenceName + "\" not found in designator");
                    return;
                }

                GameObject prefab = ThingDesignator.Designations[referenceName];
                Talent     talent = prefab.GetComponent <Talent>();

                if (talent == null)
                {
                    Debug.LogError("PlayerInfo: Deserialize: talent designation \"" + referenceName + "\" does not contain <Talent> component");
                    return;
                }

                CurrentLocal.Talents.Add(talent);
            }

            br.Close();
            stream.Close();

            i++;
        }
    }
Exemplo n.º 13
0
    private void Awake()
    {
        button = GetComponent <GUIButton>();

        Messaging.Crafting.SelectRecipe.AddListener((r) => { selectedRecipe = r; });

        Messaging.Crafting.AssembleSelectedRecipe.AddListener(() =>
        {
            if (selectedRecipe == null)
            {
                return;
            }

            if (PlayerInfo.CurrentLocal.AssemblerItem != null)
            {
                return;
            }

            if (Stash.CraftingMaterials < selectedRecipe.AssembleCost)
            {
                Messaging.GUI.ScreenMessage.Invoke("NOT ENOUGH MATERIALS!", Color.red);
                return;
            }

            Stash.CraftingMaterials -= selectedRecipe.AssembleCost;

            PlayerInfo.CurrentLocal.AssemblerItem = selectedRecipe;
            Messaging.Crafting.SelectRecipe.Invoke(null);
            Messaging.Crafting.CraftingMaterialsUpdated.Invoke();
            Refresh();
        });

        button.onClick.AddListener(() =>
        {
            InventoryGUIObject item = PlayerInfo.CurrentLocal.CursorItem;

            if (item != null)
            {
                PlayerInfo.CurrentLocal.CursorItem    = PlayerInfo.CurrentLocal.AssemblerItem;
                PlayerInfo.CurrentLocal.AssemblerItem = item;
                Refresh();
                Messaging.GUI.HoverBox.Invoke(item.GetShortStats);
            }
            else
            {
                if (HotkeyAssigment.InventoryKey)
                {
                    switch (Stash.LeftStashMode)
                    {
                    default:
                    case Stash.StashMode.Disabled:
                        return;

                    case Stash.StashMode.Loadout:
                        if (PlayerInfo.CurrentLocal.AssemblerItem is Weapon)
                        {
                            for (int i = 0; i < PlayerInfo.CurrentLocal.PlayerWeapons.Length; i++)
                            {
                                if (PlayerInfo.CurrentLocal.PlayerWeapons[i] == null)
                                {
                                    PlayerInfo.CurrentLocal.PlayerWeapons[i] = (Weapon)PlayerInfo.CurrentLocal.AssemblerItem;
                                    PlayerInfo.CurrentLocal.AssemblerItem    = null;
                                    Refresh();
                                    Messaging.Player.EquipPlayerItems.Invoke();
                                    Messaging.Player.LoadoutRefresh.Invoke();
                                    Messaging.GUI.HoverBox.Invoke("");
                                    return;
                                }
                            }
                        }
                        else if (PlayerInfo.CurrentLocal.AssemblerItem is Skill)
                        {
                            for (int i = 0; i < PlayerInfo.CurrentLocal.PlayerSkills.Length; i++)
                            {
                                if (PlayerInfo.CurrentLocal.PlayerSkills[i] == null)
                                {
                                    PlayerInfo.CurrentLocal.PlayerSkills[i] = (Skill)PlayerInfo.CurrentLocal.AssemblerItem;
                                    PlayerInfo.CurrentLocal.AssemblerItem   = null;
                                    Refresh();
                                    Messaging.Player.EquipPlayerItems.Invoke();
                                    Messaging.Player.LoadoutRefresh.Invoke();
                                    Messaging.GUI.HoverBox.Invoke("");
                                    return;
                                }
                            }
                        }
                        else if (PlayerInfo.CurrentLocal.AssemblerItem is Accessory)
                        {
                            for (int i = 0; i < PlayerInfo.CurrentLocal.PlayerAccessories.Length; i++)
                            {
                                if (PlayerInfo.CurrentLocal.PlayerAccessories[i] == null)
                                {
                                    PlayerInfo.CurrentLocal.PlayerAccessories[i] = (Accessory)PlayerInfo.CurrentLocal.AssemblerItem;
                                    PlayerInfo.CurrentLocal.AssemblerItem        = null;
                                    Refresh();
                                    Messaging.Player.ActivateAccessory.Invoke(i);
                                    Messaging.Player.LoadoutRefresh.Invoke();
                                    Messaging.GUI.HoverBox.Invoke("");
                                    return;
                                }
                            }
                        }
                        return;

                    case Stash.StashMode.Stash:
                        Stash.AddItemToFirstEmpty(PlayerInfo.CurrentLocal.AssemblerItem, out int slot);
                        Messaging.Player.RefreshStash.Invoke(slot);
                        break;
                    }
                }
                else
                {
                    PlayerInfo.CurrentLocal.CursorItem = PlayerInfo.CurrentLocal.AssemblerItem;
                }

                PlayerInfo.CurrentLocal.AssemblerItem = null;
                Refresh();
                Messaging.GUI.HoverBox.Invoke("");
            }
        });

        button.OnCursorEnter.AddListener(() =>
        {
            if (PlayerInfo.CurrentLocal.AssemblerItem == null)
            {
                Messaging.GUI.HoverBox.Invoke("");
            }
            else
            {
                Messaging.GUI.HoverBox.Invoke(PlayerInfo.CurrentLocal.AssemblerItem.GetShortStats);
            }
        });

        button.OnCursorExit.AddListener(() => { Messaging.GUI.HoverBox.Invoke(""); });

        Messaging.Crafting.RefreshAssembler.AddListener(() => { Refresh(); });
    }
Exemplo n.º 14
0
    private void Awake()
    {
        button = GetComponent <GUIButton>();
        index  = transform.parent.GetSiblingIndex();

        Refresh();

        button.onClick.AddListener(() =>
        {
            InventoryGUIObject item = PlayerInfo.CurrentLocal.CursorItem;

            if (item != null)
            {
                switch (Allow)
                {
                default:
                    return;

                case Allowance.All:
                    break;

                case Allowance.Weapons:
                    if (!(item is Weapon))
                    {
                        return;
                    }
                    break;

                case Allowance.Skills:
                    if (!(item is Skill))
                    {
                        return;
                    }
                    break;
                }

                PlayerInfo.CurrentLocal.CursorItem = Stash.StashItems[index];
                Stash.StashItems[index]            = item;
                Refresh();
            }
            else
            {
                if (Stash.StashItems[index] == null)
                {
                    return;
                }

                if (HotkeyAssigment.InventoryKey)
                {
                    switch (Stash.LeftStashMode)
                    {
                    default:
                    case Stash.StashMode.Disabled:
                        return;

                    case Stash.StashMode.Loadout:
                        if (Stash.StashItems[index] is Weapon)
                        {
                            for (int i = 0; i < PlayerInfo.CurrentLocal.PlayerWeapons.Length; i++)
                            {
                                if (PlayerInfo.CurrentLocal.PlayerWeapons[i] == null)
                                {
                                    PlayerInfo.CurrentLocal.PlayerWeapons[i] = (Weapon)Stash.StashItems[index];
                                    Stash.StashItems[index] = null;
                                    Refresh();
                                    Messaging.Player.EquipPlayerItems.Invoke();
                                    Messaging.Player.LoadoutRefresh.Invoke();
                                    return;
                                }
                            }
                        }
                        else if (Stash.StashItems[index] is Skill)
                        {
                            for (int i = 0; i < PlayerInfo.CurrentLocal.PlayerSkills.Length; i++)
                            {
                                if (PlayerInfo.CurrentLocal.PlayerSkills[i] == null)
                                {
                                    PlayerInfo.CurrentLocal.PlayerSkills[i] = (Skill)Stash.StashItems[index];
                                    Stash.StashItems[index] = null;
                                    Refresh();
                                    Messaging.Player.EquipPlayerItems.Invoke();
                                    Messaging.Player.LoadoutRefresh.Invoke();
                                    return;
                                }
                            }
                        }
                        else if (Stash.StashItems[index] is Accessory)
                        {
                            for (int i = 0; i < PlayerInfo.CurrentLocal.PlayerAccessories.Length; i++)
                            {
                                if (PlayerInfo.CurrentLocal.PlayerAccessories[i] == null)
                                {
                                    PlayerInfo.CurrentLocal.PlayerAccessories[i] = (Accessory)Stash.StashItems[index];
                                    Stash.StashItems[index] = null;
                                    Refresh();
                                    Messaging.Player.ActivateAccessory.Invoke(i);
                                    Messaging.Player.LoadoutRefresh.Invoke();
                                    return;
                                }
                            }
                        }
                        return;

                    case Stash.StashMode.Stash:
                        switch (Stash.RightStashMode)
                        {
                        default:
                        case Stash.StashMode.Disabled:
                        case Stash.StashMode.Stash:
                            return;

                        case Stash.StashMode.Assembler:
                            if (PlayerInfo.CurrentLocal.AssemblerItem != null)
                            {
                                return;
                            }

                            PlayerInfo.CurrentLocal.AssemblerItem = Stash.StashItems[index];
                            Messaging.Crafting.RefreshAssembler.Invoke();
                            break;

                        case Stash.StashMode.Disassembler:
                            if (PlayerInfo.CurrentLocal.DisassemblerItem != null)
                            {
                                return;
                            }

                            PlayerInfo.CurrentLocal.DisassemblerItem = Stash.StashItems[index];
                            Messaging.Crafting.RefreshAssembler.Invoke();
                            break;

                        case Stash.StashMode.Augment:
                            if (PlayerInfo.CurrentLocal.AugmentItem != null)
                            {
                                return;
                            }

                            PlayerInfo.CurrentLocal.AugmentItem = Stash.StashItems[index];
                            Messaging.Crafting.RefreshAssembler.Invoke();
                            break;
                        }
                        break;
                    }
                }
                else
                {
                    PlayerInfo.CurrentLocal.CursorItem = Stash.StashItems[index];
                }

                Stash.StashItems[index] = null;
                Refresh();
            }
        });

        button.OnCursorEnter.AddListener(() => {
            if (Stash.StashItems[index] == null)
            {
                Messaging.GUI.HoverBox.Invoke("");
            }
            else
            {
                Messaging.GUI.HoverBox.Invoke(Stash.StashItems[index].GetShortStats);
            }
        });

        button.OnCursorExit.AddListener(() =>
        {
            Messaging.GUI.HoverBox.Invoke("");
        });

        Messaging.Player.RefreshStash.AddListener((i) =>
        {
            if (i == index)
            {
                Refresh();
            }
        });
    }