Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

if some one helped me with that i can reward him pls help the bot isn't maxing abilites #83

Open
JimCarry455 opened this issue Oct 3, 2021 · 31 comments

Comments

@JimCarry455
Copy link

bot isn't maxing up abilites

@UmbraNominis
Copy link
Contributor

Could you send your Coop.cs file. It should be in Binaries/Patterns.

@JimCarry455
Copy link
Author

Could you send your Coop.cs file. It should be in Binaries/Patterns.
here it's https://www112.zippyshare.com/v/cn9DS5OA/file.html

@JimCarry455
Copy link
Author

Could you send your Coop.cs file. It should be in Binaries/Patterns.

using System;
using System.Collections.Generic;
using System.Drawing;
using LeagueBot;
using LeagueBot.Patterns;
using LeagueBot.Game.Enums;
using LeagueBot.Game.Misc;
namespace LeagueBot
{
public class Coop : PatternScript
{

    private Point CastTargetPoint
    {
        get;
        set;
    }
    private int AllyIndex
    {
        get;
        set;
    }

    private Item[] Items = new Item[]
    {
        new Item("Doran Ring",400),
        new Item("Sorcere",1100),
        new Item("Lost Chapter",1300),
        new Item("Luden Tempest",2100), // <--- Cost when Lost Chapter & Blasting Wand were bought
        new Item("Needlessly Large Rod",1250),
        new Item("Needlessly Large Rod",1250),
        new Item("Rabadon Deathcap",1100),
    };

    public override bool ThrowException
    {
        get
        {
            return false;
        }
    }

    public override void Execute()
    {
        bot.log("Waiting for league of legends process...");

        bot.waitProcessOpen(Constants.GameProcessName);

        bot.waitUntilProcessBounds(Constants.GameProcessName, 1040, 800);

        bot.wait(200);

        bot.log("Waiting for game to load.");

        bot.bringProcessToFront(Constants.GameProcessName);
        bot.centerProcess(Constants.GameProcessName);

        game.waitUntilGameStart();

        bot.log("Game Started");

        bot.bringProcessToFront(Constants.GameProcessName);
        bot.centerProcess(Constants.GameProcessName);

        bot.wait(3000);
        game.player.upgradeSpellOnLevelUp();

        if (game.getSide() == SideEnum.Blue)
        {
            CastTargetPoint = new Point(1084, 398);
            bot.log("We are blue side !");
        }
        else
        {
            CastTargetPoint = new Point(644, 761);
            bot.log("We are red side !");
        }



        OnSpawnJoin();

        bot.log("Playing...");

        GameLoop();

        this.End();
    }
    private void BuyItems()
    {
        int golds = game.player.getGolds();

        game.shop.toogle();
        bot.wait(5000);
        foreach (Item item in Items)
        {
            if (item.Cost > golds)
            {
                break;
            }
            if (!item.Buyed)
            {
                game.shop.searchItem(item.Name);

                game.shop.buySearchedItem();

                item.Buyed = true;

                golds -= item.Cost;
            }
        }

        game.shop.toogle();

    }
    private void CheckBuyItems()
    {
        int golds = game.player.getGolds();

        foreach (Item item in Items)
        {
            if (item.Cost > golds)
            {
                break;
            }
            if (!item.Buyed)
            {
                game.player.recall();
                bot.wait(10000);
                if (game.player.getManaPercent() == 1)
                {
                    OnSpawnJoin();

                }
                

            }
        }


    }

    private void GameLoop()
    {
        int level = game.player.getLevel();

        bool dead = false;

        bool isRecalling = false;

        while (bot.isProcessOpen(Constants.GameProcessName))
        {
            bot.bringProcessToFront(Constants.GameProcessName);

            bot.centerProcess(Constants.GameProcessName);

            int newLevel = game.player.getLevel();
            

            if (newLevel != level)
            {
                level = newLevel;
                game.player.upgradeSpellOnLevelUp();

            }


            if (game.player.dead())
            {
                if (!dead)
                {
                    dead = true;
                    isRecalling = false;
                    OnDie();
                }

                bot.wait(4000);
                continue;
            }

            if (dead)
            {
                dead = false;
                OnRevive();
                continue;
            }

            if (isRecalling)
            {
                game.player.recall();
                bot.wait(8500);

                if (game.player.getManaPercent() == 1)
                {
                    OnSpawnJoin();
                    isRecalling = false;
                }
                continue;
            }



            if (game.player.getManaPercent() <= 0.10d)
            {
                isRecalling = true;
                continue;
            }

            if (game.player.getHealthPercent() <= 0.07d)
            {
                isRecalling = true;
                continue;
            }

            CastAndMove();


        }
    }
    private void OnDie()
    {
        BuyItems();
    }
    private void OnSpawnJoin()
    {
        BuyItems();
        AllyIndex = game.getAllyIdToFollow();
        game.camera.lockAlly(AllyIndex);
    }
    private void OnRevive()
    {
        AllyIndex = game.getAllyIdToFollow();
        game.camera.lockAlly(AllyIndex);
    }

    private void CastAndMove() // Replace this by Champion pattern script.
    {
        /*
        Random rnd = new Random();
        int Numero = rnd.Next(0, 6);
        game.moveCenterScreen();

        if (Numero = 0)
            {
            game.player.tryCastSpellOnTarget(3); // veigar cage
            game.moveCenterScreen();
            bot.wait(2000);
            int Numero = rnd.Next(0, 6);
        }
        else if (Numero = 1)
        {
            game.player.tryCastSpellOnTarget(2); // Z
            game.moveCenterScreen();
            bot.wait(2000);
            int Numero = rnd.Next(0, 6);
        }

        else if (Numero = 2)
        {
            game.player.tryCastSpellOnTarget(1); // Q
            game.moveCenterScreen();
            bot.wait(2000);
            int Numero = rnd.Next(0, 6);
        }

        else if (Numero = 3)
        {
            game.player.tryCastSpellOnTarget(4); // ult 
            game.moveCenterScreen();
            bot.wait(2000);
            int Numero = rnd.Next(0, 6);
        }
        else if (Numero = 4)
        {
            game.player.tryCastSpellOnTarget(D); // Flash 
            game.moveCenterScreen();
            bot.wait(2000);
            int Numero = rnd.Next(0, 6);
        }
        else if (Numero = 5)
        {
            game.player.tryCastSpellOnTarget(F); // Ghost
            game.moveCenterScreen();
            bot.wait(2000);
            int Numero = rnd.Next(0, 6);
        }
        else if (Numero = 6)
        {
            CheckBuyItems();
            game.moveCenterScreen();
            bot.wait(2000);
            int Numero = rnd.Next(0, 6);

        }
      */
        int Ripeti = 0;
        while (Ripeti < 3)
        {

            Ripeti = Ripeti + 1;

            game.moveCenterScreen();

            game.player.tryCastSpellOnTarget(3); // veigar cage

            game.moveCenterScreen();

            game.player.tryCastSpellOnTarget(2); // Z

            game.moveCenterScreen();

            game.player.tryCastSpellOnTarget(1); // Q

            game.moveCenterScreen();

            game.player.tryCastSpellOnTarget(4); // ult 

            game.moveCenterScreen();

            game.player.tryCastSpellOnTarget(5); // Flash

            game.moveCenterScreen();

            game.player.tryCastSpellOnTarget(6); // Ghost
        }
        Ripeti = 0;
        CheckBuyItems();
        
    }



    public override void End()
    {
        bot.executePattern("EndCoop");
        base.End();
    }
}

}

@UmbraNominis
Copy link
Contributor

Hi, sorry for the long wait.

You should try to change the numbers that are inserted into this function and test the bot.

bot.waitUntilProcessBounds(Constants.GameProcessName, 1040, 800);

If the value is too low "Waiting for game to load." won't appear in the console and you should change the values again and restart the bot.
If the value is too high the bot will miss all of its mouse clicks.

Try to change the value to "1050, 810" or "1030, 790" and continue to increase or lower it.

@JimCarry455
Copy link
Author

Sadly it didn't work when i change this value to any other value the console stuck on waiting for league of legends process..... and the bot never starts doing anything thnx for trying to help me though :(

@JimCarry455
Copy link
Author

if u can help me can i add a line in coop.cs to automatically press ctrl+ q/e/w after every level up ?

@UmbraNominis
Copy link
Contributor

We don't need to add a line like that because it is already in there.
I noticed that your Coop.cs is different from the one in this repo.

Yours:

        bot.wait(3000);

        game.player.upgradeSpellOnLevelUp();
        if (game.getSide() == SideEnum.Blue)
        {
            CastTargetPoint = new Point(1084, 398);
            bot.log("We are blue side !");
        }
        else
        {
            CastTargetPoint = new Point(644, 761);
            bot.log("We are red side !");
        }

Repo:

            bot.wait(3000);

            if (game.getSide() == SideEnum.Blue)
            {
                CastTargetPoint = new Point(1084, 398);
                bot.log("We are blue side !");
            }
            else
            {
                CastTargetPoint = new Point(644, 761);
                bot.log("We are red side !");
            }
            game.player.upgradeSpellOnLevelUp();

Try to redownload the repo and see if it works.

@JimCarry455
Copy link
Author

yea i did that i was trying to fix it i redownloaded it and the same problem still exist :(

@UmbraNominis
Copy link
Contributor

What is your PC's resolution?

@JimCarry455
Copy link
Author

1680x1050 i got the problem when i looked in the source code but i don't know how to edit it in the main program it's in Sources\LeagueBot\LeagueBot\Game\Entities\Activeplayer.cd
public void upgradeSpell(int indice) // <---- replace this by keybinding + league settings
{
Point coords = new Point();

        switch (indice)
        {
            case 1:
                coords = new Point(826, 833);
                break;
            case 2:
                coords = new Point(875, 833);
                break;
            case 3:
                coords = new Point(917, 833);
                break;
            case 4:
                coords = new Point(967, 833);
                break;
            default:
                Logger.Write("Unknown spell indice :" + indice, MessageState.WARNING);
                return;
        }

this is the problem this coordinates is wrong and i know the right coordinates do u have an idea how can i edit it ??

@JimCarry455
Copy link
Author

or do u know how can i replace it by keybinding as the programmer said ??

@UmbraNominis
Copy link
Contributor

Could you send me the right right coordinates?

@JimCarry455
Copy link
Author

switch (indice)
{
case 1:
coords = new Point(694, 782);
break;
case 2:
coords = new Point(742, 782);
break;
case 3:
coords = new Point(790, 782);
break;
case 4:
coords = new Point(836, 782);
break;
default:
Logger.Write("Unknown spell indice :" + indice, MessageState.WARNING);
return;
}

@JimCarry455
Copy link
Author

can u please change it with the keybind if u can i have been waiting along time trying the whole day but i couldn't do anything sadly cuz i am very bad at coding -_- the key bind is ctrl +q / ctrl + w /ctrl +e/ctrl +r i will be much appreciated if u did that or fix the problem for me :( @TheUmbralPyre

@UmbraNominis
Copy link
Contributor

Sorry for making you wait, will try to send you a modified version later today.

@JimCarry455
Copy link
Author

JimCarry455 commented Oct 7, 2021

Thank you so much

@Gedzu
Copy link

Gedzu commented Oct 7, 2021

Could you help me with abilities cause boy don't cast them ;/

@UmbraNominis
Copy link
Contributor

Sorry, I wasn't able to send you the edited version yesterday.
Here it is.

@UmbraNominis
Copy link
Contributor

Could you help me with abilities cause boy don't cast them ;/

You should open a new issue.

@JimCarry455
Copy link
Author

Sadly it didn't work thnx for trying to help me though 😢

@JimCarry455
Copy link
Author

Can you yell me how did u transfer the source file to exe ? So i can try edit it by my self till it work ?

@JimCarry455
Copy link
Author

I tried visual studio 2019 but i had many errors wheb i. Trying to build i will be very thankful if u told me tho

@JimCarry455
Copy link
Author

and if u can't can u please edit it again the y coordinates is the problem it needs to be higher can u edit it one last time please
switch (indice)
{
case 1:
coords = new Point(694, 795);
break;
case 2:
coords = new Point(742, 795);
break;
case 3:
coords = new Point(790, 795);
break;
case 4:
coords = new Point(836, 795);
break;
default:
Logger.Write("Unknown spell indice :" + indice, MessageState.WARNING);
return;
}

@UmbraNominis
Copy link
Contributor

If you Build the LeagueBot Project in Visual Studio the .exe file will be automatically updated.

@JimCarry455
Copy link
Author

Untitled
Sry for wasting ur time but every time i try to build it i receive those errors and all the references has this yellow triangle can u please tell me your visual studio and netframework version and thank you for answering me again

@UmbraNominis
Copy link
Contributor

Try to Rebuild the Solution. The file, which contains LeagueBot and the ColorPicker Projects.

@JimCarry455
Copy link
Author

Sry i tried this but i had the same problem can u please edit the cordinatesfor the last time and it will work the y coordinates were weong it needs to be 795

@JimCarry455
Copy link
Author

case 1:
coords = new Point(694, 795);
break;
case 2:
coords = new Point(742, 795);
break;
case 3:
coords = new Point(790, 795);
break;
case 4:
coords = new Point(836, 795);
break;
default:
Logger.Write("Unknown spell indice :" + indice, MessageState.WARNING);
return;

@UmbraNominis
Copy link
Contributor

Here.

@JimCarry455
Copy link
Author

Finally it worked thak you so much ♥️

@anaquierealgo
Copy link

aquí _

Could you help me with this? please
https://github.com/Skinz3/League-of-Legends-Bot/issues/105

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants