예제 #1
0
        public void ShowSelectedItemInfo()
        {
            string text = ItemInfoBox.Text;

            if (pos < usedInventory.GetItemSlots().Count)
            {
                Item selected = usedInventory.GetItemSlots()[pos].GetItem();
                if (selected.GetID() != 0)
                {
                    if (selected is Equipable)
                    {
                        text += "Equipable";
                    }
                    else
                    {
                        text += "Consumable";
                    }
                    text += " item\nName: " + selected.GetName()
                            + "\nDescription: " + selected.GetDescription();
                    if (selected is Equipable)
                    {
                        Equipable it = (Equipable)selected;
                        int       n  = it.GetMainType();
                        text += "\nType: ";
                        if (n == 1)
                        {
                            text += "Weapon";
                            int m = it.GetSubType();
                            switch (m)
                            {
                            case 1:
                                text += "\nClass: Sword";
                                break;

                            case 2:
                                text += "\nClass: Axe";
                                break;

                            case 3:
                                text += "\nClass: Dagger";
                                break;

                            default:
                                text += "\nClass: Staff";
                                break;
                            }
                            text += "\nBase damage: " + it.GetPower();
                        }
                        else if (n == 2)
                        {
                            text += "Shield";
                        }
                        else
                        {
                            text += "Armor\nDeflects: " + it.GetPower() + "% Damage";
                        }
                    }
                    else
                    {
                        Consumable it = (Consumable)selected;
                        if (it.GetHealthChange() > 0)
                        {
                            text += "\nHeals " + it.GetHealthChange() + " health.";
                        }
                        if (it.GetManaChange() > 0)
                        {
                            text += "\nRestores " + it.GetManaChange() + " mana.";
                        }
                    }
                }
                text += "\nPrice: " + selected.GetPrice() + " Gold";
            }
            else
            {
                text = "Unavailable item selected!";
            }
            ItemInfoBox.Text = text;
        }