RocketBot icon indicating copy to clipboard operation
RocketBot copied to clipboard

How catch using just ultraball?

Open KRgh opened this issue 10 years ago • 9 comments

KRgh avatar Jul 23 '16 13:07 KRgh

Not too sure, I believe it is automatically caught using a pokeball that suits best for the pokemon and the cp of the pokemon..

You could try to delete all your pokeballs but I'm not sure that would work?

Versified avatar Jul 23 '16 14:07 Versified

Then you should put on recycle 0 for pokeballs (the limits) maybe it will only use hyperballs. try it

iN3x0R avatar Jul 23 '16 14:07 iN3x0R

now always because recycle after a minute so if i meet a pokestop and get pokeballs it will use a pokeball! mmm so how can i recycle everytime that i go in a pokestop?

KRgh avatar Jul 23 '16 14:07 KRgh

Well in the code find the code in which a pokestop is used and link it to remove your pokeballs :+1:

Versified avatar Jul 23 '16 14:07 Versified

did it! it work!

KRgh avatar Jul 23 '16 14:07 KRgh

Congrats :+1: good luck trainer!

Versified avatar Jul 23 '16 14:07 Versified

You can modify the method GetBestBall inside Client.cs to use only a specific type of balls. Caution: apply some safety measure so it doesn't crash if you don't have any balls of the specific type left

jefvanhoyweghen avatar Jul 23 '16 15:07 jefvanhoyweghen

Yes i did it now it is perfect!

KRgh avatar Jul 23 '16 15:07 KRgh

Ok, I wrote a bit of code not knowing you already confirmed it worked. Thought I shared it anyway:

` private async Task<MiscEnums.Item> GetBestBall(int? pokemonCP) { var inventory = await GetInventory();

    var ballCollection = inventory.InventoryDelta.InventoryItems.Select(i => i.InventoryItemData?.Item)
        .Where(p => p != null)
        .GroupBy(i => (MiscEnums.Item)i.Item_)
        .Select(kvp => new { ItemId = kvp.Key, Amount = kvp.Sum(x => x.Count) })
        .Where(y => y.ItemId == MiscEnums.Item.ITEM_POKE_BALL
                    || y.ItemId == MiscEnums.Item.ITEM_GREAT_BALL
                    || y.ItemId == MiscEnums.Item.ITEM_ULTRA_BALL
                    || y.ItemId == MiscEnums.Item.ITEM_MASTER_BALL);

    var pokeBallsCount = ballCollection.Where(p => p.ItemId == MiscEnums.Item.ITEM_POKE_BALL).
        DefaultIfEmpty(new { ItemId = MiscEnums.Item.ITEM_POKE_BALL, Amount = 0 }).FirstOrDefault().Amount;
    var greatBallsCount = ballCollection.Where(p => p.ItemId == MiscEnums.Item.ITEM_GREAT_BALL).
        DefaultIfEmpty(new { ItemId = MiscEnums.Item.ITEM_GREAT_BALL, Amount = 0 }).FirstOrDefault().Amount;
    var ultraBallsCount = ballCollection.Where(p => p.ItemId == MiscEnums.Item.ITEM_ULTRA_BALL).
        DefaultIfEmpty(new { ItemId = MiscEnums.Item.ITEM_ULTRA_BALL, Amount = 0 }).FirstOrDefault().Amount;
    var masterBallsCount = ballCollection.Where(p => p.ItemId == MiscEnums.Item.ITEM_MASTER_BALL).
        DefaultIfEmpty(new { ItemId = MiscEnums.Item.ITEM_MASTER_BALL, Amount = 0 }).FirstOrDefault().Amount;

    // START
    //Remove part inbetween and uncomment underneath if you want to revert to initial code
    if (masterBallsCount > 0)
    {
        ColoredConsoleWrite(ConsoleColor.Green, $"Master Ball is being used");
        return MiscEnums.Item.ITEM_MASTER_BALL;
    }

    if (ultraBallsCount > 0)
    {
        ColoredConsoleWrite(ConsoleColor.Green, $"Ultra Ball is being used");
        return MiscEnums.Item.ITEM_ULTRA_BALL;
    }

    if (greatBallsCount > 0)
    {
        ColoredConsoleWrite(ConsoleColor.Green, $"Great Ball is being used");
        return MiscEnums.Item.ITEM_GREAT_BALL;
    }
    //Remove part inbetween and uncomment underneath if you want to revert to initial code
    //END



    // Use better balls for high CP pokemon
    //if (masterBallsCount > 0 && pokemonCP >= 1000)
    //{
    //    ColoredConsoleWrite(ConsoleColor.Green, $"Master Ball is being used");
    //    return MiscEnums.Item.ITEM_MASTER_BALL;
    //}

    //if (ultraBallsCount > 0 && pokemonCP >= 600)
    //{
    //    ColoredConsoleWrite(ConsoleColor.Green, $"Ultra Ball is being used");
    //    return MiscEnums.Item.ITEM_ULTRA_BALL;
    //}

    //if (greatBallsCount > 0 && pokemonCP >= 350)
    //{
    //    ColoredConsoleWrite(ConsoleColor.Green, $"Great Ball is being used");
    //    return MiscEnums.Item.ITEM_GREAT_BALL;
    //}

    // If low CP pokemon, but no more pokeballs; only use better balls if pokemon are of semi-worthy quality
    //if (pokeBallsCount > 0)
    //{
    //    ColoredConsoleWrite(ConsoleColor.Green, $"Poke Ball is being used");
    //    return MiscEnums.Item.ITEM_POKE_BALL;
    //}
    //else if ((greatBallsCount < 40 && pokemonCP >= 200) || greatBallsCount >= 40)
    //{
    //    ColoredConsoleWrite(ConsoleColor.Green, $"Great Ball is being used");
    //    return MiscEnums.Item.ITEM_GREAT_BALL;
    //}
    //else if (ultraBallsCount > 0 && pokemonCP >= 500)
    //{
    //    ColoredConsoleWrite(ConsoleColor.Green, $"Ultra Ball is being used");
    //    return MiscEnums.Item.ITEM_ULTRA_BALL;
    //}
    //else if (masterBallsCount > 0 && pokemonCP >= 700)
    //{
    //    ColoredConsoleWrite(ConsoleColor.Green, $"Master Ball is being used");
    //    return MiscEnums.Item.ITEM_MASTER_BALL;
    //}

    return MiscEnums.Item.ITEM_POKE_BALL;
}`

jefvanhoyweghen avatar Jul 23 '16 15:07 jefvanhoyweghen