예제 #1
0
    private void Start()
    {
        PotionItem pItem = (PotionItem)gameObject.GetComponent <ThrowableGameObj>().GetItem();

        if (pItem.potionSort == 1)
        {
            Sprite         Poisonpotion = Resources.Load <Sprite>("Poisonpotion");
            Sprite         PoisonEffect = Resources.Load <Sprite>("Poisoneffect");
            SpriteRenderer spriteR      = gameObject.GetComponent <SpriteRenderer>();
            spriteR.sprite = Poisonpotion;
            ParticleSystem         partSys    = gameObject.GetComponent <ParticleSystem>();
            ParticleSystemRenderer partSysRen = gameObject.GetComponent <ParticleSystemRenderer>();
            partSys.Stop();
            poisonEffect(partSys, PoisonEffect, partSysRen);
            partSys.Play();
        }
        if (pItem.potionSort == 2)
        {
            Sprite         Firepotion = Resources.Load <Sprite>("Firepotion");
            Sprite         FireEffect = Resources.Load <Sprite>("Fireeffect");
            SpriteRenderer spriteR    = gameObject.GetComponent <SpriteRenderer>();
            spriteR.sprite = Firepotion;
            ParticleSystem         partSys    = gameObject.GetComponent <ParticleSystem>();
            ParticleSystemRenderer partSysRen = gameObject.GetComponent <ParticleSystemRenderer>();
            partSys.Stop();
            poisonEffect(partSys, FireEffect, partSysRen);
            partSys.Play();
        }
    }
예제 #2
0
        private void ReturnItemType()
        {
            randomPotionGenerated         = randomItemDropChance.Next(1, 4);
            randomPotionStrengthGenerated = randomItemDropChance.Next(1, 101);

            int minimum           = 0;
            int lowEquipChance    = minimum + WoodenEquipmentDropChance;
            int mediumEquipChance = lowEquipChance + StoneEquipmentDropChance;
            int highEquipChance   = mediumEquipChance + ironEquipmentDropChance;

            int potionStrength = 0;

            if (randomPotionStrengthGenerated > minimum && randomPotionStrengthGenerated < lowEquipChance)
            {
                potionStrength = 1;
            }
            else if (randomPotionStrengthGenerated >= lowEquipChance && randomPotionStrengthGenerated < mediumEquipChance)
            {
                potionStrength = 2;
            }
            else if (randomPotionStrengthGenerated >= mediumEquipChance && randomPotionStrengthGenerated < highEquipChance)
            {
                potionStrength = 3;
            }

            itemTempItem = new PotionItem(randomPotionGenerated, potionStrength);
        }
예제 #3
0
        public void UseItem(HeroClassTypes heroClass)
        {
            int tempPotionProperty = potion.ITEM_PROPERTIES;

            switch (potion.PotionTypes)
            {
            case PotionTypes.Health:
                SettingPlayerHealthWithPotion(heroClass, tempPotionProperty);
                break;

            case PotionTypes.Defence:
                SettingPlayerDefenceWithPotion(heroClass, tempPotionProperty);
                break;

            case PotionTypes.Attack:
                SettingPlayerStrengthWithPotion(heroClass, tempPotionProperty);
                break;

            default:
                break;
            }

            _usableItem = false;
            potion      = new PotionItem();
        }
예제 #4
0
    private void BuyPotionItem(int itemIndex, GameObject itemUseSet)
    {
        //포션
        PotionItem item = (PotionItem)StateManager.Instance.potionItems[itemIndex];

        if (StateManager.Instance.playGold >= item.Price)
        {
            if (potionNum[itemIndex] == 0)
            {
                itemUseNameText.text    = "이 름: " + item.Name;
                itemUseExplainText.text = "설 명: " + item.Explain;
                itemUseImage.GetComponent <Image>().sprite = (Sprite)Resources.Load(item.Image, typeof(Sprite));

                itemUseSet = Instantiate(itemUseSetObj) as GameObject;
                itemUseSet.transform.SetParent(itemUseGrid.transform);
                itemUseSet.transform.localScale = new Vector3(1, 1, 1);
                itemUseSet.name = "Potion" + itemIndex;

                potionItemBag[itemIndex] = itemUseSet;
            }
            StateManager.Instance.playGold -= item.Price;
            potionNum[itemIndex]++;
            potionPoolSet[itemIndex].transform.FindChild("Scrollcnt").GetComponent <Text>().text    = "보 유 갯 수:" + potionNum[itemIndex] + " 개";
            potionItemBag[itemIndex].transform.FindChild("ScrollUseCut").GetComponent <Text>().text = "보 유" + "\n" + potionNum[itemIndex] + " 개";
        }
        else
        {
            popClose.SetActive(true);
        }
    }
	public BaseItem createItemByData(Property.Item data)
	{
		int templateid = (int)data.templateid;
		int type = ConfigManager.getInstance().getTypeByTemplateID(templateid);
		BaseItem info = null;
		switch(type)
		{
		case (int)GlobalDef.ItemType.ITEM_NORMAL:
			info = new BaseItem(); 
			break;
		case (int)GlobalDef.ItemType.ITEM_EQUIPMENT:
			info = new EquipmentItem();
			break;
		case (int)GlobalDef.ItemType.ITEM_MEDICINE:
			info = new PotionItem();
			break;
		case (int)GlobalDef.ItemType.ITEM_DIAMOND:
			info = new DiamondItem();
			break;
        case (int)GlobalDef.ItemType.ITEM_MATERIAL:
            info = new MaterialItem();
            break;
		}
		if(null == info)
		{
			info = new BaseItem(); 
		}
		info.parseData (data);
		return info;
	}
예제 #6
0
 private void Start()
 {
     inventory = GameObject.FindGameObjectWithTag("Player").GetComponent <Inventory>();
     dbHolder  = Camera.main.gameObject;
     db        = dbHolder.GetComponent <DataBase>();
     item      = GetRandomItem();
     sprite    = LoadFromDb();
     GetComponent <SpriteRenderer>().sprite = sprite;
 }
예제 #7
0
        public void PotionItemAddToStackTest()
        {
            potion = new PotionItem(0, null, "", 100, 0, 1);

            potion.Use();
            Assert.IsTrue(potion.Count == 0);

            potion.Use();
            Assert.IsTrue(potion.Count == 0);
        }
 private void Start()
 {
     #region Refs.
     tilemap = FindObjectOfType <Tilemap>().gameObject;
     item    = this.GetComponent <PickUp>().pickup;
     if (item.GetType() == typeof(PotionItem))
     {
         pItem = (PotionItem)this.GetComponent <PickUp>().pickup;
     }
     #endregion
 }
예제 #9
0
 public void PotionItemBtn()
 {
     for (int i = 0; i < pItem.Count; i++)
     {
         if (gameObject.name == "Potion" + i)
         {
             PotionItem item = (PotionItem)pItem[i];
             StateManager.Instance.useItemNum  = i;
             StateManager.Instance.useItemBool = true;
             StateManager.Instance.useItemName = "Potion";
             Debug.Log("포션 아이템");
         }
     }
 }
예제 #10
0
    private void _setupPontion(int itemIndex)
    {
        PotionItem item = (PotionItem)StateManager.Instance.potionItems[itemIndex];

        itemPriceText.GetComponent <Text>().text   = item.Price.ToString() + "\n" + "골 드";
        itemNameText.GetComponent <Text>().text    = "이 름: " + item.Name;
        itemExplainText.GetComponent <Text>().text = "설 명: " + item.Explain;
        itemImage.GetComponent <Image>().sprite    = (Sprite)Resources.Load(item.Image, typeof(Sprite));

        potionPoolSet[itemIndex] = Instantiate(itemPool) as GameObject;
        potionPoolSet[itemIndex].transform.SetParent(itemGrid.transform);
        potionPoolSet[itemIndex].transform.localScale = new Vector3(1, 1, 1);

        potionPoolSet[itemIndex].name = "Potion" + (itemIndex + 1);
        potionPoolSet[itemIndex].GetComponent <Button>().onClick.AddListener(delegate { onClockPotion(itemIndex); });

        potionPoolSet[itemIndex].SetActive(false);
    }
예제 #11
0
        public void EquipItem(ItemManager item, bool enemyAlive)
        {
            item.ItemDrop(enemyAlive, heroClassSelected);

            string input;

            if (item.ITEMDROPPED == true)
            {
                if (item.ITEMTYPEDROPPED == ItemType.Weapon)
                {
                    input = MenuQueries.ItemDropped(item, heroClassSelected);

                    if (input.Equals("y", StringComparison.OrdinalIgnoreCase))
                    {
                        Weapon = item.WEAPONDROPPED;
                    }
                }
                else if (item.ITEMTYPEDROPPED == ItemType.Armour)
                {
                    input = MenuQueries.ItemDropped(item, heroClassSelected);

                    if (input.Equals("y", StringComparison.OrdinalIgnoreCase))
                    {
                        Armor = item.ARMOR_DROPPED;
                    }
                }
                else if (item.ITEMTYPEDROPPED == ItemType.Item)
                {
                    input = MenuQueries.ItemDropped(item, heroClassSelected);

                    if (input.Equals("y", StringComparison.OrdinalIgnoreCase))
                    {
                        Potion      = item.POTION_DROPPED;
                        _usableItem = true;
                    }
                }
            }
        }
예제 #12
0
        public Hero(HeroClassTypes heroClassTypes, string name)
        {
            heroClassSelected = heroClassTypes;
            _isAlive          = true;
            PlayerLevel       = 1;
            PlayerExperience  = 0;

            switch (heroClassTypes)
            {
            case HeroClassTypes.spearman:
                //hero = new HeroClass(name, Alignment.good, HeroClassTypes.spearman);
                heroSpear = new Spearman(name, Alignment.good);
                weapon    = new WoodenSpear();
                armour    = new Armor();
                potion    = new PotionItem();
                break;

            case HeroClassTypes.swordsman:
                //hero = new HeroClass(name, Alignment.good, HeroClassTypes.swordsman);
                heroSword = new Swordsman(name, Alignment.good);
                weapon    = new WoodenSword();
                armour    = new Armor();
                potion    = new PotionItem();
                break;

            case HeroClassTypes.ranger:
                //hero = new HeroClass(name, Alignment.good, HeroClassTypes.ranger);
                heroRanger = new Ranger(name, Alignment.good);
                weapon     = new WoodenBow();
                armour     = new Armor();
                potion     = new PotionItem();
                break;

            default:
                break;
            }
        }
예제 #13
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Id.Length != 0)
            {
                hash ^= Id.GetHashCode();
            }
            if (vaultItemTypeCase_ == VaultItemTypeOneofCase.CurrencyItem)
            {
                hash ^= CurrencyItem.GetHashCode();
            }
            if (vaultItemTypeCase_ == VaultItemTypeOneofCase.StaminaItem)
            {
                hash ^= StaminaItem.GetHashCode();
            }
            if (vaultItemTypeCase_ == VaultItemTypeOneofCase.DetectorItem)
            {
                hash ^= DetectorItem.GetHashCode();
            }
            if (vaultItemTypeCase_ == VaultItemTypeOneofCase.ContainerItem)
            {
                hash ^= ContainerItem.GetHashCode();
            }
            if (vaultItemTypeCase_ == VaultItemTypeOneofCase.RunestoneItem)
            {
                hash ^= RunestoneItem.GetHashCode();
            }
            if (vaultItemTypeCase_ == VaultItemTypeOneofCase.PotionItem)
            {
                hash ^= PotionItem.GetHashCode();
            }
            if (vaultItemTypeCase_ == VaultItemTypeOneofCase.PotionIngredient)
            {
                hash ^= PotionIngredient.GetHashCode();
            }
            if (vaultItemTypeCase_ == VaultItemTypeOneofCase.EnergyItem)
            {
                hash ^= EnergyItem.GetHashCode();
            }
            if (vaultItemTypeCase_ == VaultItemTypeOneofCase.CauldronTimeItem)
            {
                hash ^= CauldronTimeItem.GetHashCode();
            }
            if (Cap != 0L)
            {
                hash ^= Cap.GetHashCode();
            }
            if (RelativeValue != 0)
            {
                hash ^= RelativeValue.GetHashCode();
            }
            if (VaultCategoryGmtId.Length != 0)
            {
                hash ^= VaultCategoryGmtId.GetHashCode();
            }
            hash ^= (int)vaultItemTypeCase_;
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
예제 #14
0
    void LoadAssetfromJson()
    {
        StateManager.Instance.potionItems      = new ArrayList();
        StateManager.Instance.skillScrollItems = new ArrayList();
        StateManager.Instance.magicScrollItems = new ArrayList();
        StateManager.Instance.buffScrollItems  = new ArrayList();

        Hashtable itemTable = (Hashtable)HMJson.objectFromJsonString(textAsset.text);

        foreach (String itemName in itemTable.Keys)
        {
            itemInfosP = (ArrayList)itemTable["potion"];        //포션 ArrayList
            itemInfosS = (ArrayList)itemTable["skillScroll"];   //기술 ArrayList
            itemInfosM = (ArrayList)itemTable["magicScroll"];   //마법 ArrayList
            itemInfosB = (ArrayList)itemTable["buffScroll"];    //보조 ArrayList
            //Debug.Log("[Item " + itemName + "]" + "\n");

            foreach (Hashtable itemInfo in itemInfosP)
            {
                String name    = (String)itemInfo["name"];
                String price   = (String)itemInfo["price"];
                String upPoint = (String)itemInfo["up"];
                String image   = (String)itemInfo["potionImage"];
                String explain = (String)itemInfo["Explain"];

                PotionItem potionItem = new PotionItem();
                potionItem.Name    = name;
                potionItem.Price   = Int32.Parse(price);
                potionItem.UpPoint = Int32.Parse(upPoint);
                potionItem.Image   = image;
                potionItem.Explain = explain;

                StateManager.Instance.potionItems.Add(potionItem);
            }

            foreach (Hashtable itemInfo in itemInfosS)
            {
                String name           = (String)itemInfo["name"];
                String price          = (String)itemInfo["price"];
                String atkPoint       = (String)itemInfo["atk"];
                String specialAbility = (String)itemInfo["specialAbility"];
                String image          = (String)itemInfo["skillScrollImage"];
                String explain        = (String)itemInfo["Explain"];

                SkillItem skillItem = new SkillItem();
                skillItem.Name           = name;
                skillItem.Price          = Int32.Parse(price);
                skillItem.AttackUpPoint  = float.Parse(atkPoint);
                skillItem.SpecialAbility = float.Parse(specialAbility);
                skillItem.Image          = image;
                skillItem.Explain        = explain;
                StateManager.Instance.skillScrollItems.Add(skillItem);
            }

            foreach (Hashtable itemInfo in itemInfosM)
            {
                String name     = (String)itemInfo["name"];
                String price    = (String)itemInfo["price"];
                String atkPoint = (String)itemInfo["atk"];
                String spdDown  = (String)itemInfo["spdDown"];
                String atkDown  = (String)itemInfo["atkDown"];
                String image    = (String)itemInfo["magicScrollImage"];
                String explain  = (String)itemInfo["Explain"];

                MagicItem magicItem = new MagicItem();
                magicItem.Name         = name;
                magicItem.Price        = Int32.Parse(price);
                magicItem.AttactPoint  = float.Parse(atkPoint);
                magicItem.AtkDownPoint = float.Parse(atkDown);
                magicItem.SpdDownPoint = float.Parse(spdDown);
                magicItem.Image        = image;
                magicItem.Explain      = explain;
                StateManager.Instance.magicScrollItems.Add(magicItem);
            }

            foreach (Hashtable itemInfo in itemInfosB)
            {
                String name        = (String)itemInfo["name"];
                String price       = (String)itemInfo["price"];
                String HpUp_Mul    = (String)itemInfo["hpUp_Mul"];
                String AtkUp       = (String)itemInfo["atkUp"];
                String DefUp       = (String)itemInfo["defUp"];
                String SpdUp       = (String)itemInfo["spdUp"];
                String DefDown     = (String)itemInfo["defDown"];
                String Restoration = (String)itemInfo["restoration"];
                String image       = (String)itemInfo["buffScrollImage"];
                String explain     = (String)itemInfo["Explain"];

                BuffItem buffItem = new BuffItem();
                buffItem.Name        = name;
                buffItem.Price       = Int32.Parse(price);
                buffItem.HpUp_Mul    = float.Parse(HpUp_Mul);
                buffItem.AtkUp       = float.Parse(AtkUp);
                buffItem.DefUp       = float.Parse(DefUp);
                buffItem.SpdUp       = float.Parse(SpdUp);
                buffItem.DefDown     = float.Parse(DefDown);
                buffItem.Restoration = Int32.Parse(Restoration);
                buffItem.Image       = image;
                buffItem.Explain     = explain;


                StateManager.Instance.buffScrollItems.Add(buffItem);
            }
        }
    }
예제 #15
0
        public void MergeFrom(VaultItem other)
        {
            if (other == null)
            {
                return;
            }
            if (other.Id.Length != 0)
            {
                Id = other.Id;
            }
            if (other.Cap != 0L)
            {
                Cap = other.Cap;
            }
            if (other.RelativeValue != 0)
            {
                RelativeValue = other.RelativeValue;
            }
            if (other.VaultCategoryGmtId.Length != 0)
            {
                VaultCategoryGmtId = other.VaultCategoryGmtId;
            }
            switch (other.VaultItemTypeCase)
            {
            case VaultItemTypeOneofCase.CurrencyItem:
                if (CurrencyItem == null)
                {
                    CurrencyItem = new global::WUProtos.Data.CurrencyVaultItem();
                }
                CurrencyItem.MergeFrom(other.CurrencyItem);
                break;

            case VaultItemTypeOneofCase.StaminaItem:
                if (StaminaItem == null)
                {
                    StaminaItem = new global::WUProtos.Data.StaminaVaultItem();
                }
                StaminaItem.MergeFrom(other.StaminaItem);
                break;

            case VaultItemTypeOneofCase.DetectorItem:
                if (DetectorItem == null)
                {
                    DetectorItem = new global::WUProtos.Data.DarkDetectorVaultItem();
                }
                DetectorItem.MergeFrom(other.DetectorItem);
                break;

            case VaultItemTypeOneofCase.ContainerItem:
                if (ContainerItem == null)
                {
                    ContainerItem = new global::WUProtos.Data.ContainerVaultItem();
                }
                ContainerItem.MergeFrom(other.ContainerItem);
                break;

            case VaultItemTypeOneofCase.RunestoneItem:
                if (RunestoneItem == null)
                {
                    RunestoneItem = new global::WUProtos.Data.RunestoneVaultItem();
                }
                RunestoneItem.MergeFrom(other.RunestoneItem);
                break;

            case VaultItemTypeOneofCase.PotionItem:
                if (PotionItem == null)
                {
                    PotionItem = new global::WUProtos.Data.Potion.PotionVaultItem();
                }
                PotionItem.MergeFrom(other.PotionItem);
                break;

            case VaultItemTypeOneofCase.PotionIngredient:
                if (PotionIngredient == null)
                {
                    PotionIngredient = new global::WUProtos.Data.Potion.PotionIngredientVaultItem();
                }
                PotionIngredient.MergeFrom(other.PotionIngredient);
                break;

            case VaultItemTypeOneofCase.EnergyItem:
                if (EnergyItem == null)
                {
                    EnergyItem = new global::WUProtos.Data.EnergyVaultItem();
                }
                EnergyItem.MergeFrom(other.EnergyItem);
                break;

            case VaultItemTypeOneofCase.CauldronTimeItem:
                if (CauldronTimeItem == null)
                {
                    CauldronTimeItem = new global::WUProtos.Data.CauldronTimeItem();
                }
                CauldronTimeItem.MergeFrom(other.CauldronTimeItem);
                break;
            }

            _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
        }
예제 #16
0
        public List <BaseItem> GetAllItemsInNpcBag(byte bag, int npcId)
        {
            DbParameter bagIdParameter = _db.CreateParameter(DbNames.GETALLNPCITEMSBYBAGID_BAGID_PARAMETER, bag);

            bagIdParameter.DbType = DbType.Byte;

            DbParameter characterIdParameter = _db.CreateParameter(DbNames.GETALLNPCITEMSBYBAGID_NPCID_PARAMETER, npcId);

            characterIdParameter.DbType = DbType.Int32;

            List <BaseItem> items = new List <BaseItem>();

            _db.Open();

            DbDataReader reader = _db.ExcecuteReader(DbNames.GETALLNPCITEMSBYBAGID_STOREDPROC, CommandType.StoredProcedure, bagIdParameter, characterIdParameter);

            int ordinalITEM_REFERENCEID    = reader.GetOrdinal(DbNames.ITEM_REFID);
            int ordinalITEM_BTYPE          = reader.GetOrdinal(DbNames.ITEM_BTYPE);
            int ordinalITEM_BKIND          = reader.GetOrdinal(DbNames.ITEM_BKIND);
            int ordinalITEM_VISUALID       = reader.GetOrdinal(DbNames.ITEM_VISUALID);
            int ordinalITEM_CLASS          = reader.GetOrdinal(DbNames.ITEM_CLASS);
            int ordinalITEM_AMOUNT         = reader.GetOrdinal(DbNames.ITEM_AMOUNT);
            int ordinalITEM_PRICE          = reader.GetOrdinal(DbNames.ITEM_PRICE);
            int ordinalITEM_LEVEL          = reader.GetOrdinal(DbNames.ITEM_LEVEL);
            int ordinalITEM_DEX            = reader.GetOrdinal(DbNames.ITEM_DEX);
            int ordinalITEM_STR            = reader.GetOrdinal(DbNames.ITEM_STR);
            int ordinalITEM_STA            = reader.GetOrdinal(DbNames.ITEM_STA);
            int ordinalITEM_ENE            = reader.GetOrdinal(DbNames.ITEM_ENE);
            int ordinalITEM_DURABILITY     = reader.GetOrdinal(DbNames.ITEM_DURABILITY);
            int ordinalITEM_DAMAGE         = reader.GetOrdinal(DbNames.ITEM_DAMAGE);
            int ordinalITEM_DEFENCE        = reader.GetOrdinal(DbNames.ITEM_DEFENCE);
            int ordinalITEM_ATTACKRATING   = reader.GetOrdinal(DbNames.ITEM_ATTACKRATING);
            int ordinalITEM_ATTACKSPEED    = reader.GetOrdinal(DbNames.ITEM_ATTACKSPEED);
            int ordinalITEM_ATTACKRANGE    = reader.GetOrdinal(DbNames.ITEM_ATTACKRANGE);
            int ordinalITEM_INCMAXLIFE     = reader.GetOrdinal(DbNames.ITEM_INCMAXLIFE);
            int ordinalITEM_INCMAXMANA     = reader.GetOrdinal(DbNames.ITEM_INCMAXMANA);
            int ordinalITEM_LIFEREGEN      = reader.GetOrdinal(DbNames.ITEM_LIFEREGEN);
            int ordinalITEM_MANAREGEN      = reader.GetOrdinal(DbNames.ITEM_MANAREGEN);
            int ordinalITEM_CRITICAL       = reader.GetOrdinal(DbNames.ITEM_CRITICAL);
            int ordinalITEM_TOMAPID        = reader.GetOrdinal(DbNames.ITEM_TOMAPID);
            int ordinalITEM_IMBUERATE      = reader.GetOrdinal(DbNames.ITEM_IMBUERATE);
            int ordinalITEM_IMBUEINCREASE  = reader.GetOrdinal(DbNames.ITEM_IMBUEINCREASE);
            int ordinalITEM_BOOKSKILLID    = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLID);
            int ordinalITEM_BOOKSKILLLEVEL = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLLEVEL);
            int ordinalITEM_BOOKSKILLDATA  = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLDATA);
            int ordinalITEM_MAXPOLISHTRIES = reader.GetOrdinal(DbNames.ITEM_MAXPOLISHTRIES);
            int ordinalITEM_MAXIMBUETRIES  = reader.GetOrdinal(DbNames.ITEM_MAXIMBUES);
            int ordinalITEM_BAG            = reader.GetOrdinal(DbNames.ITEM_BAG);
            int ordinalITEM_SLOT           = reader.GetOrdinal(DbNames.ITEM_SLOT);
            int ordinalITEM_SIZEX          = reader.GetOrdinal(DbNames.ITEM_SIZEX);
            int ordinalITEM_SIZEY          = reader.GetOrdinal(DbNames.ITEM_SIZEY);

            while (reader.Read())
            {
                BaseItem b = null;

                int BType = reader.GetByte(ordinalITEM_BTYPE);
                int BKind = reader.GetByte(ordinalITEM_BKIND);



                if (BType == (byte)bType.Weapon || BType == (byte)bType.Clothes || BType == (byte)bType.Hat || BType == (byte)bType.Necklace ||
                    BType == (byte)bType.Ring || BType == (byte)bType.Shoes || BType == (byte)bType.Cape)
                {
                    if (BKind == (byte)bKindWeapons.Sword && BType == (byte)bType.Weapon)
                    {
                        b = new Sword();
                    }
                    if (BKind == (byte)bKindWeapons.Blade && BType == (byte)bType.Weapon)
                    {
                        b = new Blade();
                    }
                    if (BKind == (byte)bKindWeapons.Fan && BType == (byte)bType.Weapon)
                    {
                        b = new Fan();
                    }
                    if (BKind == (byte)bKindWeapons.Brush && BType == (byte)bType.Weapon)
                    {
                        b = new Brush();
                    }
                    if (BKind == (byte)bKindWeapons.Claw && BType == (byte)bType.Weapon)
                    {
                        b = new Claw();
                    }
                    if (BKind == (byte)bKindWeapons.Axe && BType == (byte)bType.Weapon)
                    {
                        b = new Axe();
                    }
                    if (BKind == (byte)bKindWeapons.Talon && BType == (byte)bType.Weapon)
                    {
                        b = new Talon();
                    }
                    if (BKind == (byte)bKindWeapons.Tonfa && BType == (byte)bType.Weapon)
                    {
                        b = new Tonfa();
                    }
                    if (BKind == (byte)bKindWeapons.Hammer && BType == (byte)bType.Weapon)
                    {
                        b = new Hammer();
                    }
                    if (BKind == (byte)bKindArmors.SwordMan && BType == (byte)bType.Clothes)
                    {
                        b = new Clothes();
                    }
                    if (BKind == (byte)bKindArmors.Mage && BType == (byte)bType.Clothes)
                    {
                        b = new Dress();
                    }
                    if (BKind == (byte)bKindArmors.Warrior && BType == (byte)bType.Clothes)
                    {
                        b = new Armor();
                    }
                    if (BKind == (byte)bKindArmors.GhostFighter && BType == (byte)bType.Clothes)
                    {
                        b = new LeatherClothes();
                    }
                    if (BKind == (byte)bKindHats.SwordMan && BType == (byte)bType.Hat)
                    {
                        b = new Hood();
                    }
                    if (BKind == (byte)bKindHats.Mage && BType == (byte)bType.Hat)
                    {
                        b = new Tiara();
                    }
                    if (BKind == (byte)bKindHats.Warrior && BType == (byte)bType.Hat)
                    {
                        b = new Helmet();
                    }
                    if (BKind == (byte)bKindHats.GhostFighter && BType == (byte)bType.Hat)
                    {
                        b = new Hat();
                    }
                    if (BKind == (byte)bKindHats.SwordMan && BType == (byte)bType.Shoes)
                    {
                        b = new SmBoots();
                    }
                    if (BKind == (byte)bKindHats.Mage && BType == (byte)bType.Shoes)
                    {
                        b = new MageBoots();
                    }
                    if (BKind == (byte)bKindHats.Warrior && BType == (byte)bType.Shoes)
                    {
                        b = new WarriorShoes();
                    }
                    if (BKind == (byte)bKindHats.GhostFighter && BType == (byte)bType.Shoes)
                    {
                        b = new GhostFighterShoes();
                    }
                    if (BKind == 0 && BType == (byte)bType.Ring)
                    {
                        b = new Ring();
                    }
                    if (BKind == 0 && BType == (byte)bType.Necklace)
                    {
                        b = new Necklace();
                    }
                    if (BType == (byte)bType.Cape)
                    {
                        b = new Cape();
                        Cape c = b as Cape;
                        c.MaxPolishImbueTries = reader.GetInt16(ordinalITEM_MAXPOLISHTRIES);
                    }



                    Equipment e = b as Equipment;
                    e.RequiredLevel     = reader.GetInt16(ordinalITEM_LEVEL);
                    e.RequiredDexterity = reader.GetInt16(ordinalITEM_DEX);
                    e.RequiredStrength  = reader.GetInt16(ordinalITEM_STR);
                    e.RequiredStamina   = reader.GetInt16(ordinalITEM_STA);
                    e.RequiredEnergy    = reader.GetInt16(ordinalITEM_ENE);
                    e.Durability        = reader.GetInt32(ordinalITEM_DURABILITY);
                    e.MaxDurability     = e.Durability;
                    e.Damage            = reader.GetInt16(ordinalITEM_DAMAGE);
                    e.Defence           = reader.GetInt16(ordinalITEM_DEFENCE);
                    e.AttackRating      = reader.GetInt16(ordinalITEM_ATTACKRATING);
                    e.AttackSpeed       = reader.GetInt16(ordinalITEM_ATTACKSPEED);
                    e.AttackRange       = reader.GetInt16(ordinalITEM_ATTACKRANGE);
                    e.IncMaxLife        = reader.GetInt16(ordinalITEM_INCMAXLIFE);
                    e.IncMaxMana        = reader.GetInt16(ordinalITEM_INCMAXMANA);
                    e.IncLifeRegen      = reader.GetInt16(ordinalITEM_LIFEREGEN);
                    e.IncManaRegen      = reader.GetInt16(ordinalITEM_MANAREGEN);
                    e.Critical          = reader.GetInt16(ordinalITEM_CRITICAL);
                    e.MaxImbueTries     = reader.GetByte(ordinalITEM_MAXIMBUETRIES);
                }

                if (BType == (byte)bType.ImbueItem)
                {
                    if (BKind == (byte)bKindStones.Black)
                    {
                        b = new Black();
                    }
                    if (BKind == (byte)bKindStones.White)
                    {
                        b = new White();
                    }
                    if (BKind == (byte)bKindStones.Red)
                    {
                        b = new Red();
                    }
                    if (BKind == (byte)bKindStones.Dragon)
                    {
                        b = new Dragon();
                    }

                    ImbueItem im = b as ImbueItem;
                    im.ImbueChance   = reader.GetInt16(ordinalITEM_IMBUERATE);
                    im.IncreaseValue = reader.GetInt16(ordinalITEM_IMBUEINCREASE);
                }

                if (BType == (byte)bType.Potion)
                {
                    if (BKind == (byte)bKindPotions.Normal)
                    {
                        b = new Potion();
                    }
                    if (BKind == (byte)bKindPotions.Elixir)
                    {
                        b = new Elixir();
                    }

                    PotionItem pot = b as PotionItem;
                    pot.HealHp   = reader.GetInt16(ordinalITEM_INCMAXLIFE);
                    pot.HealMana = reader.GetInt16(ordinalITEM_INCMAXMANA);
                }
                if (BType == (byte)bType.Book)
                {
                    if (BKind == (byte)bKindBooks.SoftBook)
                    {
                        b = new SoftBook();
                    }
                    if (BKind == (byte)bKindBooks.HardBook)
                    {
                        b = new HardBook();
                    }

                    BookItem book = b as BookItem;
                    book.RequiredClass = reader.GetByte(ordinalITEM_CLASS);
                    book.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL);
                    book.SkillID       = reader.GetInt32(ordinalITEM_BOOKSKILLID);
                    book.SkillLevel    = reader.GetByte(ordinalITEM_BOOKSKILLLEVEL);
                    book.SkillData     = reader.GetInt32(ordinalITEM_BOOKSKILLDATA);
                }
                if (BType == (byte)bType.Bead)
                {
                    if (BKind == (byte)bKindBeads.Normal)
                    {
                        b = new Bead();
                    }
                    BeadItem bead = b as BeadItem;
                    bead.ToMapID = reader.GetInt32(ordinalITEM_TOMAPID);
                }

                b.ReferenceID   = reader.GetInt16(ordinalITEM_REFERENCEID);
                b.VisualID      = reader.GetInt16(ordinalITEM_VISUALID);
                b.Bag           = reader.GetByte(ordinalITEM_BAG);
                b.Slot          = reader.GetByte(ordinalITEM_SLOT);
                b.bType         = reader.GetByte(ordinalITEM_BTYPE);
                b.bKind         = reader.GetByte(ordinalITEM_BKIND);
                b.RequiredClass = reader.GetByte(ordinalITEM_CLASS);
                b.Amount        = reader.GetInt16(ordinalITEM_AMOUNT);
                b.SizeX         = reader.GetByte(ordinalITEM_SIZEX);
                b.SizeY         = reader.GetByte(ordinalITEM_SIZEY);
                b.Price         = reader.GetInt32(ordinalITEM_PRICE);

                items.Add(b);
            }

            reader.Close();
            _db.Close();

            return(items);
        }
예제 #17
0
	public static bool drinkPotion (PotionItem potionItem) {
		switch (potionItem.getPotionType()) {
			case PotionType.HEALTH:
				if (getHealth() < getMaxHealth()) {
					healHero(100);
					Util.disposeItem(potionItem);
					return true;
				}
				else return false;
			case PotionType.AGILITY:
				if (!isPotionAlreadyDrinked(potionItem.getPotionType())) {
					potionAgility = 10;
					drinkedPotions[potionItem.getPotionType()] = true;
					Util.disposeItem(potionItem);
					return true;
				} else return false;
			
			case PotionType.STRENGTH:
				if (!isPotionAlreadyDrinked(potionItem.getPotionType())) {
					potionStrength = 10;
					drinkedPotions[potionItem.getPotionType()] = true;
					Util.disposeItem(potionItem);
					return true;
				} else return false;
			case PotionType.ARMOR:
				if (!isPotionAlreadyDrinked(potionItem.getPotionType())) {
					potionArmor = 20;
					drinkedPotions[potionItem.getPotionType()] = true;
					Util.disposeItem(potionItem);
					return true;
				} else return false;
			default: Debug.Log("Unknown Potion"); return false;
		}
	}
예제 #18
0
    private void GetScrollItem(int itemIndex, GameObject itemUseSet)
    {
        int itemNum = Random.Range(0, 4);

        switch (itemIndex)
        {
        case 1:
            //스킬
            var sItem = (SkillItem)StateManager.Instance.skillScrollItems[itemNum];
            if (StateManager.Instance.SkscrollNum[itemNum] == 0)
            {
                itemUseNameText.text    = "이 름: " + sItem.Name;
                itemUseExplainText.text = "설 명: " + sItem.Explain;
                itemUseImage.GetComponent <Image>().sprite = (Sprite)Resources.Load(sItem.Image, typeof(Sprite));

                itemUseSet = Instantiate(itemUseSetObj) as GameObject;
                itemUseSet.transform.SetParent(skillUseGrid.transform);
                itemUseSet.transform.localScale = new Vector3(1, 1, 1);
                itemUseSet.name = "Skill" + itemNum;
                StateManager.Instance.SkScrollBag[itemNum] = itemUseSet;
            }
            StateManager.Instance.SkscrollNum[itemNum]++;
            StateManager.Instance.SkScrollBag[itemNum].transform.FindChild("ScrollUseCut").GetComponent <Text>().text = "보 유" + "\n" + StateManager.Instance.SkscrollNum[itemNum] + " 개";

            if (cBoxOpen.activeSelf.Equals(false))
            {
                StartCoroutine(findObj(6, 0, sItem.Name + "\n 스 크 롤 을  발 견 "));
            }
            else if (cBoxOpen.activeSelf.Equals(true))
            {
                getItemText.text = "획득 아이템 \n: " + sItem.Name;
                getItem.GetComponent <Image>().sprite = (Sprite)Resources.Load(sItem.Image, typeof(Sprite));
            }

            break;

        case 2:
            if (cBoxOpen.activeSelf.Equals(false))
            {
                StartCoroutine(findObj(6, 0, "스 크 롤 이 \n오 래 되 서  부 서 짐"));
            }
            else if (cBoxOpen.activeSelf.Equals(true))
            {
                getItemText.text = "획득 아이템 \n: 없 음";
            }
            //스크롤이 오래되서 부서짐
            break;

        case 3:
            MagicItem mItem = (MagicItem)StateManager.Instance.magicScrollItems[itemNum];
            if (StateManager.Instance.MgscrollNum[itemNum] == 0)
            {
                itemUseNameText.text    = "이 름: " + mItem.Name;
                itemUseExplainText.text = "설 명: " + mItem.Explain;
                itemUseImage.GetComponent <Image>().sprite = (Sprite)Resources.Load(mItem.Image, typeof(Sprite));

                itemUseSet = Instantiate(itemUseSetObj) as GameObject;
                itemUseSet.transform.SetParent(skillUseGrid.transform);
                itemUseSet.transform.localScale = new Vector3(1, 1, 1);
                itemUseSet.name = "Magic" + itemNum;
                StateManager.Instance.MgScrollBag[itemNum] = itemUseSet;
            }
            StateManager.Instance.MgscrollNum[itemNum]++;
            StateManager.Instance.MgScrollBag[itemNum].transform.FindChild("ScrollUseCut").GetComponent <Text>().text = "보 유" + "\n" + StateManager.Instance.MgscrollNum[itemNum] + " 개";
            if (cBoxOpen.activeSelf.Equals(false))
            {
                StartCoroutine(findObj(6, 0, mItem.Name + "\n 스 크 롤 을  발 견 "));
            }
            else if (cBoxOpen.activeSelf.Equals(true))
            {
                getItemText.text = "획득 아이템 \n: " + mItem.Name;
                getItem.GetComponent <Image>().sprite = (Sprite)Resources.Load(mItem.Image, typeof(Sprite));
            }

            break;

        case 4:
            //스크롤이 오래되서 부서짐
            if (cBoxOpen.activeSelf.Equals(false))
            {
                StartCoroutine(findObj(6, 0, "스 크 롤 이 \n오 래 되 서  부 서 짐"));
            }
            else if (cBoxOpen.activeSelf.Equals(true))
            {
                getItemText.text = "획득 아이템 \n: 없 음";
            }
            break;

        case 5:
            BuffItem bItem = (BuffItem)StateManager.Instance.buffScrollItems[itemNum];

            if (StateManager.Instance.BufscrollNum[itemNum] == 0)
            {
                itemUseNameText.text    = "이 름: " + bItem.Name;
                itemUseExplainText.text = "설 명: " + bItem.Explain;
                itemUseImage.GetComponent <Image>().sprite = (Sprite)Resources.Load(bItem.Image, typeof(Sprite));

                itemUseSet = Instantiate(itemUseSetObj) as GameObject;
                itemUseSet.transform.SetParent(skillUseGrid.transform);
                itemUseSet.transform.localScale = new Vector3(1, 1, 1);
                itemUseSet.name = "Buff" + itemNum;
                StateManager.Instance.BufScrollBag[itemNum] = itemUseSet;
            }
            StateManager.Instance.BufscrollNum[itemNum]++;
            StateManager.Instance.BufScrollBag[itemNum].transform.FindChild("ScrollUseCut").GetComponent <Text>().text = "보 유" + "\n" + StateManager.Instance.BufscrollNum[itemNum] + " 개";
            if (cBoxOpen.activeSelf.Equals(false))
            {
                StartCoroutine(findObj(6, 0, bItem.Name + "\n 스 크 롤 을  발 견 "));
            }
            else if (cBoxOpen.activeSelf.Equals(true))
            {
                getItemText.text = "획득 아이템 \n: " + bItem.Name;
                getItem.GetComponent <Image>().sprite = (Sprite)Resources.Load(bItem.Image, typeof(Sprite));
            }
            break;

        case 6:
            //깨진 포션병을 발견
            if (cBoxOpen.activeSelf.Equals(false))
            {
                StartCoroutine(findObj(7, 0, "깨 진  포 션 병 을  발 견"));
            }
            else if (cBoxOpen.activeSelf.Equals(true))
            {
                getItemText.text = "획득 아이템 \n: 없 음";
            }
            break;

        case 7:
            if (itemNum == 1)
            {
                itemNum = 0;
            }
            //포션
            PotionItem item = (PotionItem)StateManager.Instance.potionItems[itemNum];

            if (StateManager.Instance.potionNum[itemNum] == 0)
            {
                itemUseNameText.text    = "이 름: " + item.Name;
                itemUseExplainText.text = "설 명: " + item.Explain;
                itemUseImage.GetComponent <Image>().sprite = (Sprite)Resources.Load(item.Image, typeof(Sprite));

                itemUseSet = Instantiate(itemUseSetObj) as GameObject;
                itemUseSet.transform.SetParent(itemUseGrid.transform);
                itemUseSet.transform.localScale = new Vector3(1, 1, 1);
                itemUseSet.name = "Potion" + itemNum;

                StateManager.Instance.potionItemBag[itemNum] = itemUseSet;
            }

            StateManager.Instance.potionNum[itemNum]++;
            StateManager.Instance.potionItemBag[itemNum].transform.FindChild("ScrollUseCut").GetComponent <Text>().text = "보 유" + "\n" + StateManager.Instance.potionNum[itemNum] + " 개";

            if (cBoxOpen.activeSelf.Equals(false))
            {
                StartCoroutine(findObj(7, 0, item.Name + "\n 포 션 을  발 견 "));
            }
            else if (cBoxOpen.activeSelf.Equals(true))
            {
                getItemText.text = "획득 아이템 \n: " + item.Name;
                getItem.GetComponent <Image>().sprite = (Sprite)Resources.Load(item.Image, typeof(Sprite));
            }
            break;
        }
    }
예제 #19
0
    public void lord()
    {
        itemUseNameText    = itemUseName.GetComponent <Text>();
        itemUseExplainText = itemUseExplain.GetComponent <Text>();

        for (int i = 0; i < StateManager.Instance.potionNum.Length; i++)
        {
            StateManager.Instance.potionNum[i] = PlayerPrefs.GetInt("potion" + (i + 1).ToString(), 0);
            PotionItem item = (PotionItem)StateManager.Instance.potionItems[i];
            if (StateManager.Instance.potionNum[i] > 0)
            {
                itemUseNameText.text    = "이 름: " + item.Name;
                itemUseExplainText.text = "설 명: " + item.Explain;
                itemUseImage.GetComponent <Image>().sprite = (Sprite)Resources.Load(item.Image, typeof(Sprite));

                GameObject itemUseSet = Instantiate(itemUseSetObj) as GameObject;
                itemUseSet.transform.SetParent(itemUseGrid.transform);
                itemUseSet.transform.localScale = new Vector3(1, 1, 1);
                itemUseSet.name = "Potion" + i;

                StateManager.Instance.potionItemBag[i] = itemUseSet;
                StateManager.Instance.potionItemBag[i].transform.FindChild("ScrollUseCut").GetComponent <Text>().text = "보 유" + "\n" + StateManager.Instance.potionNum[i] + " 개";
            }
        }

        for (int i = 0; i < StateManager.Instance.SkscrollNum.Length; i++)
        {
            StateManager.Instance.SkscrollNum[i] = PlayerPrefs.GetInt("skill" + (i + 1).ToString(), 0);
            SkillItem item = (SkillItem)StateManager.Instance.skillScrollItems[i];
            if (StateManager.Instance.SkscrollNum[i] > 0)
            {
                itemUseNameText.text    = "이 름: " + item.Name;
                itemUseExplainText.text = "설 명: " + item.Explain;
                itemUseImage.GetComponent <Image>().sprite = (Sprite)Resources.Load(item.Image, typeof(Sprite));

                GameObject itemUseSet = Instantiate(itemUseSetObj) as GameObject;
                itemUseSet.transform.SetParent(skillUseGrid.transform);
                itemUseSet.transform.localScale = new Vector3(1, 1, 1);
                itemUseSet.name = "Skill" + i;

                StateManager.Instance.SkScrollBag[i] = itemUseSet;
                StateManager.Instance.SkScrollBag[i].transform.FindChild("ScrollUseCut").GetComponent <Text>().text = "보 유" + "\n" + StateManager.Instance.SkscrollNum[i] + " 개";
            }
        }

        for (int i = 0; i < StateManager.Instance.MgscrollNum.Length; i++)
        {
            StateManager.Instance.MgscrollNum[i] = PlayerPrefs.GetInt("magic" + (i + 1).ToString(), 0);
            MagicItem item = (MagicItem)StateManager.Instance.magicScrollItems[i];
            if (StateManager.Instance.MgscrollNum[i] > 0)
            {
                itemUseNameText.text    = "이 름: " + item.Name;
                itemUseExplainText.text = "설 명: " + item.Explain;
                itemUseImage.GetComponent <Image>().sprite = (Sprite)Resources.Load(item.Image, typeof(Sprite));

                GameObject itemUseSet = Instantiate(itemUseSetObj) as GameObject;
                itemUseSet.transform.SetParent(magicUseGrid.transform);
                itemUseSet.transform.localScale = new Vector3(1, 1, 1);
                itemUseSet.name = "Magic" + i;

                StateManager.Instance.MgScrollBag[i] = itemUseSet;
                StateManager.Instance.MgScrollBag[i].transform.FindChild("ScrollUseCut").GetComponent <Text>().text = "보 유" + "\n" + StateManager.Instance.MgscrollNum[i] + " 개";
            }
        }

        for (int i = 0; i < StateManager.Instance.BufscrollNum.Length; i++)
        {
            StateManager.Instance.BufscrollNum[i] = PlayerPrefs.GetInt("buff" + (i + 1).ToString(), 0);
            BuffItem item = (BuffItem)StateManager.Instance.buffScrollItems[i];
            if (StateManager.Instance.BufscrollNum[i] > 0)
            {
                itemUseNameText.text    = "이 름: " + item.Name;
                itemUseExplainText.text = "설 명: " + item.Explain;
                itemUseImage.GetComponent <Image>().sprite = (Sprite)Resources.Load(item.Image, typeof(Sprite));

                GameObject itemUseSet = Instantiate(itemUseSetObj) as GameObject;
                itemUseSet.transform.SetParent(magicUseGrid.transform);
                itemUseSet.transform.localScale = new Vector3(1, 1, 1);
                itemUseSet.name = "Buff" + i;

                StateManager.Instance.BufScrollBag[i] = itemUseSet;
                StateManager.Instance.BufScrollBag[i].transform.FindChild("ScrollUseCut").GetComponent <Text>().text = "보 유" + "\n" + StateManager.Instance.BufscrollNum[i] + " 개";
            }
        }

        StateManager.Instance.playUseAtk = PlayerPrefs.GetInt("playUseAtk");
        StateManager.Instance.playUseDef = PlayerPrefs.GetInt("playUseDef");
        //StateManager.Instance.playUseSpd = PlayerPrefs.GetFloat("playUseSpd");

        StateManager.Instance.wUse = PlayerPrefs.GetInt("wUse");
        StateManager.Instance.aUse = PlayerPrefs.GetInt("aUse");
        //StateManager.Instance.bUse = PlayerPrefs.GetInt("bUse");

        StateManager.Instance.weaponDurability[StateManager.Instance.wUse] = PlayerPrefs.GetInt("weaponDurability");

        if (StateManager.Instance.playUseAtk != 0)
        {
            if (StateManager.Instance.playUseAtk.Equals(5))
            {
                Weapon(0);
            }
            if (StateManager.Instance.playUseAtk.Equals(8))
            {
                Weapon(1);
            }
            if (StateManager.Instance.playUseAtk.Equals(10))
            {
                Weapon(2);
            }
            if (StateManager.Instance.playUseAtk.Equals(20))
            {
                Weapon(3);
            }
            if (StateManager.Instance.playUseAtk.Equals(30))
            {
                Weapon(4);
            }
            if (StateManager.Instance.playUseAtk.Equals(500))
            {
                Weapon(5);
            }
        }
        if (StateManager.Instance.playDef != 0)
        {
            if (StateManager.Instance.playUseDef.Equals(5))
            {
                Armor(0);
            }
            if (StateManager.Instance.playUseDef.Equals(10))
            {
                Armor(1);
            }
            if (StateManager.Instance.playUseDef.Equals(20))
            {
                Armor(2);
            }
            if (StateManager.Instance.playUseDef.Equals(15))
            {
                Armor(3);
            }
            if (StateManager.Instance.playUseDef.Equals(25))
            {
                Armor(4);
            }
            if (StateManager.Instance.playUseDef.Equals(50))
            {
                Armor(5);
            }
            if (StateManager.Instance.playUseDef.Equals(150))
            {
                Armor(6);
            }
        }

        //if (StateManager.Instance.playSpd != 0)
        //{
        //    if (StateManager.Instance.playUseSpd.Equals(0.5))
        //    {
        //        Boots(0);
        //    }
        //    if (StateManager.Instance.playUseSpd.Equals(1.5))
        //    {
        //        Boots(1);
        //    }
        //    if (StateManager.Instance.playUseSpd.Equals(2))
        //    {
        //        Boots(2);
        //    }
        //    if (StateManager.Instance.playUseSpd.Equals(3))
        //    {
        //        Boots(3);
        //    }
        //    if (StateManager.Instance.playUseSpd.Equals(4.5))
        //    {
        //        Boots(4);
        //    }
        //    if (StateManager.Instance.playSpd.Equals(6))
        //    {
        //        Boots(5);
        //    }

        //}
    }
예제 #20
0
	private void setActionMsg (ItemHolder holder) {
		if (shopDescriptor && holder == null) {//Подразумевает, что мы находимся в магазине, и смотрим на полки (у них нет холдера)
			if (item.getCost() <= Vars.gold) {
                adjustFooter("Купить", false);
            } else {
                adjustFooter("Не хватает монет", true);
            }
		} else if (shopDescriptor) {
            adjustFooter("Продать", false);
		} else if (workbenchDescriptor) {
			hideActionMsg();
		} else {
			switch (holder.getHolderType()) {
				case ItemHolderType.INVENTORY:
				case ItemHolderType.POTION_BAG:
					if (holder.getItem().getItemType() == ItemType.POTION) {
						tempPotion = (PotionItem)holder.getItem();
                        if ((tempPotion.getPotionType() == PotionType.HEALTH && Hero.getHealth() == Hero.getMaxHealth())) {
                            adjustFooter("Здоровье макс.", true);
                        } else if (Hero.isPotionAlreadyDrinked(tempPotion.getPotionType())) {
                            adjustFooter("Нельзя выпить", true);
                        } else {
							adjustFooter("Выпить", false);
						}
					} else if (holder.getItem().getItemType() == ItemType.MATERIAL) {
						hideActionMsg();
					} else if (holder.getItem().getItemType() == ItemType.WEAPON) {
                    	adjustFooter("Взять", false);
					} else {
                        adjustFooter("Надеть", false);
					}
					break;
				case ItemHolderType.EQUIPMENT: adjustFooter("Снять", false); break;
			}
		}
	}