Ejemplo n.º 1
0
 private void SelectToSell()
 {
     selectedItem = Items.Instance.ItemByID(storage_ID[int.Parse(EventSystem.current.currentSelectedGameObject.name)]);
     StartCoroutine(ViewItemInfo(selectedItem.ID_string));
     precio = int.Parse(selectedItem.ID_string.Substring(3, 1)) * 40;
     window_vender.Find("Vender").Find("Adn").Find("Text").GetComponent <Text>().text = "+ " + precio.ToString();
 }
Ejemplo n.º 2
0
    public string GetRandomItemID(Chest chestRarity)
    {
        Equipable_Item newItem = GetRandomItemByEvolution(GameManager.Instance.GetMyEvolution());
        int            random  = Random.Range(0, 101);
        int            rarity  = GetRarityValue(chestRarity);

        int fuerza = 1;
        int vida   = 1;
        int skill  = 1;
        int luck   = 1;

        for (var x = 0; x < 5; x++)
        {
            switch (Random.Range(1, 5))
            {
            case 1: fuerza++; break;

            case 2: vida++; break;

            case 3: skill++; break;

            case 4: luck++; break;

            default: luck++; break;
            }
        }

        string skills = GenerateNewSkills();

        newItem.ID_string = newItem.ID.ToString() + rarity.ToString() + vida.ToString() + fuerza.ToString() +
                            skill.ToString() + luck.ToString() + skills;

        return(newItem.ID_string);
    }
Ejemplo n.º 3
0
    public string GetRandomItemID()
    {
        Equipable_Item newItem = new Equipable_Item();

        switch (Random.Range(1, 5)) //Equip Position
        {
        case 1: newItem = headgear_list[Random.Range(0, headgear_list.Count - 1)]; break;

        case 2: newItem = bodies_list[Random.Range(0, bodies_list.Count - 1)]; break;

        case 3: newItem = arms_list[Random.Range(0, arms_list.Count - 1)]; break;

        case 4: newItem = legs_list[Random.Range(0, legs_list.Count - 1)]; break;
        }
        int random = Random.Range(0, 101);
        int rarity = 1;

        if (random >= 95)
        {
            rarity = 4;
        }
        else if (random >= 85)
        {
            rarity = 3;
        }
        else if (random >= 60)
        {
            rarity = 2;
        }
        int fuerza = 1;
        int vida   = 1;
        int skill  = 1;
        int luck   = 1;

        for (var x = 0; x < 5; x++)
        {
            switch (Random.Range(1, 5))
            {
            case 1: fuerza++; break;

            case 2: vida++; break;

            case 3: skill++; break;

            case 4: luck++; break;

            default: luck++; break;
            }
        }

        string skills = GenerateNewSkills();

        newItem.ID_string = newItem.ID.ToString() + rarity.ToString() + vida.ToString() + fuerza.ToString() +
                            skill.ToString() + luck.ToString() + skills;

        return(newItem.ID_string);
    }
Ejemplo n.º 4
0
    public void BTN_CAMBIAR_SKILLS()
    {
        SetActiveBotons(false);
        Database.Instance.ReferenceDataDB().Child("gold").GetValueAsync().ContinueWith(task =>
        {
            int myMoney = int.Parse(task.Result.Value.ToString());
            if (myMoney >= 80)
            {
                Equipable_Item eItem   = new Equipable_Item();
                Equipable_Item newItem = new Equipable_Item();
                switch (currentEquipView)
                {
                case Equip_Position.Head:
                    eItem   = Items.Instance.ItemByID(GameManager.Instance.player.criatura.equipment.head.ID_string);
                    newItem = Items.Instance.ItemByID(ItemReSkills(eItem.ID_string));
                    Items.Instance.inventory_headgear.Remove(eItem);
                    Items.Instance.inventory_headgear.Add(newItem);
                    GameManager.Instance.player.criatura.equipment.head = newItem;
                    break;

                case Equip_Position.Body:
                    eItem   = Items.Instance.ItemByID(GameManager.Instance.player.criatura.equipment.body.ID_string);
                    newItem = Items.Instance.ItemByID(ItemReSkills(eItem.ID_string));
                    Items.Instance.inventory_bodies.Remove(eItem);
                    Items.Instance.inventory_bodies.Add(newItem);
                    GameManager.Instance.player.criatura.equipment.body = newItem;
                    break;

                case Equip_Position.Arms:
                    eItem   = Items.Instance.ItemByID(GameManager.Instance.player.criatura.equipment.arms.ID_string);
                    newItem = Items.Instance.ItemByID(ItemReSkills(eItem.ID_string));
                    Items.Instance.inventory_arms.Remove(eItem);
                    Items.Instance.inventory_arms.Add(newItem);
                    GameManager.Instance.player.criatura.equipment.arms = newItem;
                    break;

                case Equip_Position.Legs:
                    eItem   = Items.Instance.ItemByID(GameManager.Instance.player.criatura.equipment.legs.ID_string);
                    newItem = Items.Instance.ItemByID(ItemReSkills(eItem.ID_string));
                    Items.Instance.inventory_legs.Remove(eItem);
                    Items.Instance.inventory_legs.Add(newItem);
                    GameManager.Instance.player.criatura.equipment.legs = newItem;
                    break;
                }
                StartCoroutine(ViewItemInfo(newItem.ID_string));
                precio = -80;
                GuardarInventarioDB();
            }
            SetActiveBotons(true);
        });
    }
Ejemplo n.º 5
0
    public string GetRandomItemID(Equip_Position posi, int rareLvl)
    {
        Equipable_Item newItem = new Equipable_Item();

        switch (posi) //Equip Position
        {
        case Equip_Position.Head: newItem = headgear_list[Random.Range(0, (headgear_list.Count - 1) / 3)]; break;

        case Equip_Position.Body: newItem = bodies_list[Random.Range(0, (bodies_list.Count - 1) / 3)]; break;

        case Equip_Position.Arms: newItem = arms_list[Random.Range(0, (arms_list.Count - 1) / 3)]; break;

        case Equip_Position.Legs: newItem = legs_list[Random.Range(0, (legs_list.Count - 1) / 3)]; break;
        }
        int rarity = Mathf.Clamp(rareLvl, 1, 5);
        int fuerza = 1;
        int vida   = 1;
        int skill  = 1;
        int luck   = 1;

        for (var x = 0; x < 5; x++)
        {
            switch (Random.Range(1, 5))
            {
            case 1: fuerza++; break;

            case 2: vida++; break;

            case 3: skill++; break;

            case 4: luck++; break;
            }
        }

        string skills = GenerateNewSkills();

        newItem.ID_string = newItem.ID.ToString() + rarity.ToString() + vida.ToString() + fuerza.ToString() +
                            skill.ToString() + luck.ToString() + skills;

        return(newItem.ID_string);
    }
Ejemplo n.º 6
0
    public Equipable_Item ItemByID(string bigID)
    {
        Equipable_Item item    = new Equipable_Item();
        int            listID  = int.Parse(bigID.Substring(0, 1));
        int            basicID = int.Parse(bigID.Substring(0, 3));
        int            rarity  = int.Parse(bigID.Substring(3, 1));

        try                                                                         //BUSCAR OBJETO EN LA LISTA CORRESPONDIENTE
        {
            switch (listID)
            {
            case 1: item = headgear_list.Find(e => e.ID == basicID); break;

            case 2: item = bodies_list.Find(e => e.ID == basicID); break;

            case 3: item = arms_list.Find(e => e.ID == basicID); break;

            case 4: item = legs_list.Find(e => e.ID == basicID); break;

            case 5: item = backs_list.Find(e => e.ID == basicID); break;

            case 6: item = weapons_list.Find(e => e.ID == basicID); break;
            }
        } catch { print("¡¡Item no encontrado!!"); }
        switch (rarity)
        {
        case 1: item.quality = Quality.Common; break;

        case 2: item.quality = Quality.Rare; break;

        case 3: item.quality = Quality.Epic; break;

        case 4: item.quality = Quality.Legendary; break;
        }
        item.ID        = basicID;
        item.ID_string = bigID;
        return(item);
    }
Ejemplo n.º 7
0
 private void DeselectLastItem()
 {
     selectedItem = new Equipable_Item();
     window_vender.Find("Vender").Find("Adn").Find("Text").GetComponent <Text>().text = "Selecciona para vender";
     StartCoroutine(ViewItemInfo());
 }
Ejemplo n.º 8
0
    public Equipable_Item GetRandomItemByEvolution(Evolution evo)
    {
        Equipable_Item newItem = new Equipable_Item();

        if (evo == Evolution.Creature)
        {
            switch (Random.Range(1, 5)) //Equip Position
            {
            case 1: newItem = headgear_list[Random.Range(0, (headgear_list.Count - 1) / 3)]; break;

            case 2: newItem = bodies_list[Random.Range(0, (bodies_list.Count - 1) / 3)]; break;

            case 3: newItem = arms_list[Random.Range(0, (arms_list.Count - 1)) / 3]; break;

            case 4: newItem = legs_list[Random.Range(0, (legs_list.Count - 1)) / 3]; break;
            }
        }
        else if (evo == Evolution.Tribal)
        {
            switch (Random.Range(1, 5)) //Equip Position
            {
            case 1: newItem = headgear_list[Random.Range((headgear_list.Count - 1) / 3, ((headgear_list.Count - 1) / 3) * 2)]; break;

            case 2: newItem = bodies_list[Random.Range((bodies_list.Count - 1) / 3, ((bodies_list.Count - 1) / 3) * 2)]; break;

            case 3: newItem = arms_list[Random.Range((arms_list.Count - 1) / 3, ((arms_list.Count - 1)) / 3) * 2]; break;

            case 4: newItem = legs_list[Random.Range((legs_list.Count - 1) / 3, ((legs_list.Count - 1) / 3) * 2)]; break;
            }
        }
        else
        {
            switch (Random.Range(1, 5)) //Equip Position
            {
            case 1: newItem = headgear_list[Random.Range(((headgear_list.Count - 1) / 3) * 2, headgear_list.Count - 1)]; break;

            case 2: newItem = bodies_list[Random.Range(((bodies_list.Count - 1) / 3) * 2, bodies_list.Count - 1)]; break;

            case 3: newItem = arms_list[Random.Range(((arms_list.Count - 1) / 3) * 2, arms_list.Count - 1)]; break;

            case 4: newItem = legs_list[Random.Range(((legs_list.Count - 1) / 3) * 2, legs_list.Count - 1)]; break;
            }
        }

        int random = Random.Range(0, 101);
        int rarity = 1;

        if (random >= 95)
        {
            rarity = 4;
        }
        else if (random >= 85)
        {
            rarity = 3;
        }
        else if (random >= 60)
        {
            rarity = 2;
        }
        int fuerza = 1;
        int vida   = 1;
        int skill  = 1;
        int luck   = 1;

        for (var x = 0; x < 5; x++)
        {
            switch (Random.Range(1, 5))
            {
            case 1: fuerza++; break;

            case 2: vida++; break;

            case 3: skill++; break;

            case 4: luck++; break;

            default: luck++; break;
            }
        }

        string skills = GenerateNewSkills();

        newItem.ID_string = newItem.ID.ToString() + rarity.ToString() + vida.ToString() + fuerza.ToString() +
                            skill.ToString() + luck.ToString() + skills;

        return(newItem);
    }