google-site-verification: googlebaca44933768a824.html JamLegend Bot is SLOW (with SOURCE) - Old Royal Hack Forum

Announcement

Collapse
No announcement yet.

JamLegend Bot is SLOW (with SOURCE)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    JamLegend Bot is SLOW (with SOURCE)

    this 3bots are for JamLegend but only working on Opera and on screensolution 1280x800


    TAB BOT


    Code:
    // JamBot is a bot especially for [URL="http://www.jamlegend.com/"]http://www.jamlegend.com[/URL] 
    // it uses simple color detection for actions 
     
    #include "stdafx.h" 
    #include <iostream> 
    #include <vector> 
    #include <utility> 
     
    #define VK_1 0x31 
    #define VK_2 0x32 
    #define VK_3 0x33 
    #define VK_4 0x34 
    #define VK_5 0x35 
     
    struct Vector2D 
    { 
        Vector2D() {} 
        Vector2D(float x, float y) 
        { 
            this->x = x; 
            this->y = y; 
        } 
        float x, y; 
    }; 
     
    struct Vector3D 
    { 
        Vector3D() {} 
        Vector3D(float x, float y, float z) 
        { 
            this->x = x; 
            this->y = y; 
            this->z = z; 
        } 
        float x, y, z; 
    }; 
     
    struct Button 
    { 
        Button(COLORREF c, COLORREF hc, Vector2D p, Vector2D hp, int k) 
        { 
            color = c; 
            holdColor = hc; 
            pos = p; 
            holdPos = hp; 
            locktime = 0; 
            down = false; 
            key = k; 
        } 
     
        COLORREF color; 
        COLORREF holdColor; 
     
        Vector2D pos; 
        Vector2D holdPos; 
        unsigned long locktime; 
        bool down; 
        int key; 
    }; 
     
    class Window 
    { 
    public: 
        Window() 
        { 
            hDC = CreateDC("DISPLAY", NULL, NULL, NULL); 
            hWnd = FindWindow("OperaWindowClass", NULL); 
            Init(); 
            Run(); 
        } 
     
        ~Window() 
        { 
            DeleteDC(hDC); 
        } 
    private: 
        COLORREF GetColor(Vector2D pos, int rows , int cols) 
        { 
            Vector3D rgb; 
            int counter = 0; 
     
            if (rows == 0 || cols == 0) 
            { 
                return GetPixel(hDC, (int)pos.x, (int)pos.y); 
            } 
     
            // row oder col == 1 -> -1, 0, 1, == 2 -> -2, -1, 0, 1, 2 
            for (int y = -cols; y <= cols; y++) 
            { 
                for (int x = -rows; x <= rows; x++) 
                { 
                    COLORREF color = GetPixel(hDC, (int)pos.x + x, (int)pos.y + y); 
     
                    rgb.x += GetRValue(color); 
                    rgb.y += GetGValue(color); 
                    rgb.z += GetBValue(color); 
     
                    counter++; 
                } 
            } 
     
            rgb.x /= counter; 
            rgb.y /= counter; 
            rgb.z /= counter; 
             
            return RGB(rgb.x, rgb.y, rgb.z); 
        } 
     
        void Init() 
        { 
            buttons.push_back(Button(RGB(255, 236, 136), RGB(255, 247, 51),  Vector2D(549, 480), Vector2D(552, 465), VK_1)); // gelb 
            buttons.push_back(Button(RGB(236, 148, 255), RGB(246, 96, 254),  Vector2D(589, 480), Vector2D(592, 465), VK_2)); // lila 
            buttons.push_back(Button(RGB(198, 255, 130), RGB(201, 255, 50),  Vector2D(629, 480), Vector2D(632, 465), VK_3)); // gr?n 
            buttons.push_back(Button(RGB(255, 146, 134), RGB(255, 97, 100),  Vector2D(669, 480), Vector2D(672, 465), VK_4)); // rot 
            buttons.push_back(Button(RGB(151, 211, 247), RGB(146, 246, 255), Vector2D(711, 480), Vector2D(712, 465), VK_5)); // blau 
        } 
     
        bool IsColorSimilar(COLORREF c1, COLORREF c2, int maxDistance) 
        { 
            byte r1 = GetRValue(c1); 
            byte r2 = GetRValue(c2); 
     
            byte g1 = GetGValue(c1); 
            byte g2 = GetGValue(c2); 
     
            byte b1 = GetBValue(c1); 
            byte b2 = GetBValue(c2); 
     
            // gr??er dem kleineren und kleiner dem gr??eren 
            if (r1 <= Clamp(r2 + maxDistance, 0, 255) &&  
                r1 >= Clamp(r2 - maxDistance, 0, 255) && 
     
                g1 <= Clamp(g2 + maxDistance, 0, 255) && 
                g1 >= Clamp(g2 - maxDistance, 0, 255) && 
     
                b1 <= Clamp(b2 + maxDistance, 0, 255) && 
                b1 >= Clamp(b2 - maxDistance, 0, 255)) 
            { 
                return true; 
            } 
            return false; 
        } 
     
        bool HasToHold(Button &b) 
        { 
            COLORREF lineColor = GetColor(b.holdPos, 0, 0); 
     
            if (IsColorSimilar(lineColor, b.holdColor, 60)) 
            { 
                return true; 
            } 
     
            return false; 
        } 
     
        void Run() 
        { 
            // better sleep 
            timeBeginPeriod(1); 
     
            while (true) 
            { 
                for(size_t i = 0; i < buttons.size(); i++) 
                { 
                    Button &b = buttons[i]; 
     
                    COLORREF targetColor = GetColor(b.pos, 2, 1); 
     
                    bool isSimilar = IsColorSimilar(targetColor, b.color, 30); 
     
                    if (isSimilar && !b.down/* && (b.locktime + 90) < timeGetTime() */) 
                    { 
                        keybd_event(b.key, 0, 0, 0); 
                        // press enter at the same time 
                        //keybd_event(0xD, 0, 0, 0); 
                        b.down = true; 
                        b.locktime = timeGetTime(); 
                    } 
                    else if(!isSimilar && b.down && /*(b.locktime + 50) < timeGetTime() && */!HasToHold(b)) 
                    { 
                        //keybd_event(0xD, 0, KEYEVENTF_KEYUP, 0); 
                        keybd_event(b.key, 0, KEYEVENTF_KEYUP, 0);                     
                        b.down = false; 
                    } 
                } 
     
                Sleep(10); 
            } 
        } 
     
        int Clamp(int val, int min, int max) 
        { 
            return max(min, min(val, max)); 
        } 
     
        HDC hDC; 
        HWND hWnd; 
        std::vector<Button> buttons; 
    }; 
     
     
    int _tmain(int argc, _TCHAR* argv[]) 
    { 
        Window wnd; 
        return 0; 
    }
    Stum Bot
    Code:
    [B]#include[/B] "[U]stdafx.h[/U]"[B] 
    #include[/B] <windows.h>[B] 
    #include[/B] <iostream> [B] 
    #include[/B] <vector> [B] 
    #include[/B] <utility>[B] 
    #pragma[/B] comment(lib, "[U]winmm.lib[/U]") 
     
    [B] 
    #define[/B] VK_1 0x31 [B] 
    #define[/B] VK_2 0x32 [B] 
    #define[/B] VK_3 0x33 [B] 
    #define[/B] VK_4 0x34 [B] 
    #define[/B] VK_5 0x35  
     
     
    [B]struct[/B] Vector2D  
    {  
        Vector2D() {}  
        Vector2D([B]float[/B] x, [B]float[/B] y)  
        {  
            [B]this[/B]->x = x;  
            [B]this[/B]->y = y;  
        }  
        [B]float[/B] x, y;  
    };  
     
    [B]struct[/B] Vector3D  
    {  
        Vector3D() {}  
        Vector3D([B]float[/B] x, [B]float[/B] y, [B]float[/B] z)  
        {  
            [B]this[/B]->x = x;  
            [B]this[/B]->y = y;  
            [B]this[/B]->z = z;  
        }  
        [B]float[/B] x, y, z;  
    };  
     
    [B]struct[/B] Button  
    {  
        Button(COLORREF c, COLORREF hc, Vector2D p, Vector2D hp, [B]int[/B] k)  
        {  
            color = c;  
            holdColor = hc;  
            pos = p;  
            holdPos = hp;  
            locktime = 0;  
            down = [B]false[/B];  
            key = k;  
        }  
     
        COLORREF color;  
        COLORREF holdColor;  
     
        Vector2D pos;  
        Vector2D holdPos;  
        [B]unsigned long[/B] locktime;  
        [B]bool[/B] down;  
        [B]int[/B] key;  
    };  
     
    [B]class[/B] Window  
    {  
    [B]public[/B]:  
        Window()  
        {  
            hDC = CreateDC(_T("[U]DISPLAY[/U]"), NULL, NULL, NULL);  
            hWnd = FindWindow(_T("[U]OperaWindowClass[/U]"), NULL);  
            Init();  
            Run();  
        }  
     
        ~Window()  
        {  
            DeleteDC(hDC);  
        }  
    [B]private[/B]:  
        COLORREF GetColor(Vector2D pos, [B]int[/B] rows , [B]int[/B] cols)  
        {  
            Vector3D rgb;  
            [B]int[/B] counter = 0;  
     
            [B]if[/B] (rows == 0 || cols == 0)  
            {  
                [B]return[/B] GetPixel(hDC, ([B]int[/B])pos.x, ([B]int[/B])pos.y);  
            }  
     
            [I]// row oder col == 1 -> -1, 0, 1, == 2 -> -2, -1, 0, 1, 2 [/I] 
            [B]for[/B] ([B]int[/B] y = -cols; y <= cols; y++)  
            {  
                [B]for[/B] ([B]int[/B] x = -rows; x <= rows; x++)  
                {  
                    COLORREF color = GetPixel(hDC, ([B]int[/B])pos.x + x, ([B]int[/B])pos.y + y);  
     
                    rgb.x += GetRValue(color);  
                    rgb.y += GetGValue(color);  
                    rgb.z += GetBValue(color);  
     
                    counter++;  
                }  
            }  
     
            rgb.x /= counter;  
            rgb.y /= counter;  
            rgb.z /= counter;  
             
            [B]return[/B] RGB(rgb.x, rgb.y, rgb.z);  
        }  
     
        [B]void[/B] Init()  
        {  
            buttons.push_back(Button(RGB(255, 236, 136), RGB(255, 247, 51),  Vector2D(549, 480), Vector2D(552, 465), VK_1)); [I]// gelb [/I] 
            buttons.push_back(Button(RGB(236, 148, 255), RGB(246, 96, 254),  Vector2D(589, 480), Vector2D(592, 465), VK_2)); [I]// lila [/I] 
            buttons.push_back(Button(RGB(198, 255, 130), RGB(201, 255, 50),  Vector2D(629, 480), Vector2D(632, 465), VK_3)); [I]// gr?n [/I] 
            buttons.push_back(Button(RGB(255, 146, 134), RGB(255, 97, 100),  Vector2D(669, 480), Vector2D(672, 465), VK_4)); [I]// rot [/I] 
            buttons.push_back(Button(RGB(151, 211, 247), RGB(146, 246, 255), Vector2D(711, 480), Vector2D(712, 465), VK_5)); [I]// blau [/I] 
        }  
     
        [B]bool[/B] IsColorSimilar(COLORREF c1, COLORREF c2, [B]int[/B] maxDistance)  
        {  
            byte r1 = GetRValue(c1);  
            byte r2 = GetRValue(c2);  
     
            byte g1 = GetGValue(c1);  
            byte g2 = GetGValue(c2);  
     
            byte b1 = GetBValue(c1);  
            byte b2 = GetBValue(c2);  
     
            [I]// gr??er dem kleineren und kleiner dem gr??eren [/I] 
            [B]if[/B] (r1 <= Clamp(r2 + maxDistance, 0, 255) &&  
                r1 >= Clamp(r2 - maxDistance, 0, 255) &&  
     
                g1 <= Clamp(g2 + maxDistance, 0, 255) &&  
                g1 >= Clamp(g2 - maxDistance, 0, 255) &&  
     
                b1 <= Clamp(b2 + maxDistance, 0, 255) &&  
                b1 >= Clamp(b2 - maxDistance, 0, 255))  
            {  
                [B]return true[/B];  
            }  
            [B]return false[/B];  
        }  
     
        [B]bool[/B] HasToHold(Button &b)  
        {  
            COLORREF lineColor = GetColor(b.holdPos, 0, 0);  
     
            [B]if[/B] (IsColorSimilar(lineColor, b.holdColor, 60))  
            {  
                [B]return true[/B];  
            }  
     
            [B]return false[/B];  
        }  
     
        [B]void[/B] Run()  
        {  
            [I]// better sleep [/I] 
            timeBeginPeriod(1);  
     
            [B]while[/B] ([B]true[/B])  
            {  
                [B]for[/B](size_t i = 0; i < buttons.size(); i++)  
                {  
                    Button &b = buttons[i];  
     
                    COLORREF targetColor = GetColor(b.pos, 2, 1);  
     
                    [B]bool[/B] isSimilar = IsColorSimilar(targetColor, b.color, 30);  
     
                    [B]if[/B] (isSimilar && !b.down[I]/* && (b.locktime + 90) < timeGetTime() */[/I])  
                    {  
                        keybd_event(b.key, 0, 0, 0) 
                         
                        ;keybd_event(0xD, 0, 0, 0);  
                        b.down = [B]true[/B];  
                        b.locktime = timeGetTime();  
                    }  
                    [B]else if[/B](!isSimilar && b.down && [I]/*(b.locktime + 50) < timeGetTime() && */[/I]!HasToHold(b))  
                    {  
                        keybd_event(0xD, 0, KEYEVENTF_KEYUP, 0);  
                        keybd_event(b.key, 0, KEYEVENTF_KEYUP, 0);                     
                        b.down = [B]false[/B];  
                    }  
                }  
     
              Sleep (10); 
            }  
        }  
     
        [B]int[/B] Clamp([B]int[/B] val, [B]int[/B] min, [B]int[/B] max)  
        {  
            [B]return[/B] max(min, min(val, max));  
        }  
     
        HDC hDC;  
        HWND hWnd;  
        std::vector<Button> buttons;  
    };  
     
     
    [B]int[/B] _tmain([B]int[/B] argc, _TCHAR* argv[])  
    {  
        Window wnd;  
        [B]return[/B] 0;  
    }
    Hammer Ons

    Code:
    [B]#include[/B] "[U]stdafx.h[/U]"[B] 
    #include[/B] <windows.h>[B] 
    #include[/B] <iostream> [B] 
    #include[/B] <vector> [B] 
    #include[/B] <utility>[B] 
    #pragma[/B] comment(lib, "[U]winmm.lib[/U]") 
     
    [B] 
    #define[/B] VK_1 0x31 [B] 
    #define[/B] VK_2 0x32 [B] 
    #define[/B] VK_3 0x33 [B] 
    #define[/B] VK_4 0x34 [B] 
    #define[/B] VK_5 0x35  
     
     
    [B]struct[/B] Vector2D  
    {  
        Vector2D() {}  
        Vector2D([B]float[/B] x, [B]float[/B] y)  
        {  
            [B]this[/B]->x = x;  
            [B]this[/B]->y = y;  
        }  
        [B]float[/B] x, y;  
    };  
     
    [B]struct[/B] Vector3D  
    {  
        Vector3D() {}  
        Vector3D([B]float[/B] x, [B]float[/B] y, [B]float[/B] z)  
        {  
            [B]this[/B]->x = x;  
            [B]this[/B]->y = y;  
            [B]this[/B]->z = z;  
        }  
        [B]float[/B] x, y, z;  
    };  
     
    [B]struct[/B] Button  
    {  
        Button(COLORREF c, COLORREF hc, Vector2D p, Vector2D hp, [B]int[/B] k)  
        {  
            color = c;  
            holdColor = hc;  
            pos = p;  
            holdPos = hp;  
            locktime = 0;  
            down = [B]false[/B];  
            key = k;  
        }  
     
        COLORREF color;  
        COLORREF holdColor;  
     
        Vector2D pos;  
        Vector2D holdPos;  
        [B]unsigned long[/B] locktime;  
        [B]bool[/B] down;  
        [B]int[/B] key;  
    };  
     
    [B]class[/B] Window  
    {  
    [B]public[/B]:  
        Window()  
        {  
            hDC = CreateDC(_T("[U]DISPLAY[/U]"), NULL, NULL, NULL);  
            hWnd = FindWindow(_T("[U]OperaWindowClass[/U]"), NULL);  
            Init();  
            Run();  
        }  
     
        ~Window()  
        {  
            DeleteDC(hDC);  
        }  
    [B]private[/B]:  
        COLORREF GetColor(Vector2D pos, [B]int[/B] rows , [B]int[/B] cols)  
        {  
            Vector3D rgb;  
            [B]int[/B] counter = 0;  
     
            [B]if[/B] (rows == 0 || cols == 0)  
            {  
                [B]return[/B] GetPixel(hDC, ([B]int[/B])pos.x, ([B]int[/B])pos.y);  
            }  
     
            [I]// row oder col == 1 -> -1, 0, 1, == 2 -> -2, -1, 0, 1, 2 [/I] 
            [B]for[/B] ([B]int[/B] y = -cols; y <= cols; y++)  
            {  
                [B]for[/B] ([B]int[/B] x = -rows; x <= rows; x++)  
                {  
                    COLORREF color = GetPixel(hDC, ([B]int[/B])pos.x + x, ([B]int[/B])pos.y + y);  
     
                    rgb.x += GetRValue(color);  
                    rgb.y += GetGValue(color);  
                    rgb.z += GetBValue(color);  
     
                    counter++;  
                }  
            }  
     
            rgb.x /= counter;  
            rgb.y /= counter;  
            rgb.z /= counter;  
             
            [B]return[/B] RGB(rgb.x, rgb.y, rgb.z);  
        }  
     
        [B]void[/B] Init()  
        {  
            buttons.push_back(Button(RGB(220, 220, 220), RGB(260, 260, 260),  Vector2D(549, 480), Vector2D(552, 465), VK_1)); [I]// gelb [/I] 
            buttons.push_back(Button(RGB(220, 220, 220), RGB(260, 260, 260),  Vector2D(589, 480), Vector2D(592, 465), VK_2)); [I]// lila [/I] 
            buttons.push_back(Button(RGB(220, 220, 220), RGB(260, 260, 260),  Vector2D(629, 480), Vector2D(632, 465), VK_3)); [I]// gr?n [/I] 
            buttons.push_back(Button(RGB(220, 220, 220), RGB(260, 260, 260),  Vector2D(669, 480), Vector2D(672, 465), VK_4)); [I]// rot [/I] 
            buttons.push_back(Button(RGB(220, 220, 220), RGB(260, 260, 260),  Vector2D(711, 480), Vector2D(712, 465), VK_5)); [I]// blau [/I] 
        }  
     
        [B]bool[/B] IsColorSimilar(COLORREF c1, COLORREF c2, [B]int[/B] maxDistance)  
        {  
            byte r1 = GetRValue(c1);  
            byte r2 = GetRValue(c2);  
     
            byte g1 = GetGValue(c1);  
            byte g2 = GetGValue(c2);  
     
            byte b1 = GetBValue(c1);  
            byte b2 = GetBValue(c2);  
     
            [I]// gr??er dem kleineren und kleiner dem gr??eren [/I] 
            [B]if[/B] (r1 <= Clamp(r2 + maxDistance, 0, 255) &&  
                r1 >= Clamp(r2 - maxDistance, 0, 255) &&  
     
                g1 <= Clamp(g2 + maxDistance, 0, 255) &&  
                g1 >= Clamp(g2 - maxDistance, 0, 255) &&  
     
                b1 <= Clamp(b2 + maxDistance, 0, 255) &&  
                b1 >= Clamp(b2 - maxDistance, 0, 255))  
            {  
                [B]return true[/B];  
            }  
            [B]return false[/B];  
        }  
     
        [B]bool[/B] HasToHold(Button &b)  
        {  
            COLORREF lineColor = GetColor(b.holdPos, 0, 0);  
     
            [B]if[/B] (IsColorSimilar(lineColor, b.holdColor, 60))  
            {  
                [B]return true[/B];  
            }  
     
            [B]return false[/B];  
        }  
     
        [B]void[/B] Run()  
        {  
            [I]// better sleep [/I] 
            timeBeginPeriod(1);  
     
            [B]while[/B] ([B]true[/B])  
            {  
                [B]for[/B](size_t i = 0; i < buttons.size(); i++)  
                {  
                    Button &b = buttons[i];  
     
                    COLORREF targetColor = GetColor(b.pos, 2, 1);  
     
                    [B]bool[/B] isSimilar = IsColorSimilar(targetColor, b.color, 30);  
     
                    [B]if[/B] (isSimilar && !b.down[I]/* && (b.locktime + 90) < timeGetTime() */[/I])  
                    {  
                        keybd_event(b.key, 0, 0, 0);  
                        [I]// press enter at the same time  
                        //keybd_event(0xD, 0, 0, 0); [/I] 
                        b.down = [B]true[/B];  
                        b.locktime = timeGetTime();  
                    }  
                    [B]else if[/B](!isSimilar && b.down && [I]/*(b.locktime + 50) < timeGetTime() && */[/I]!HasToHold(b))  
                    {  
                        [I]//keybd_event(0xD, 0, KEYEVENTF_KEYUP, 0); [/I] 
                        keybd_event(b.key, 0, KEYEVENTF_KEYUP, 0);                     
                        b.down = [B]false[/B];  
                    }  
                }  
              Sleep (9); 
     
            }  
        }  
     
        [B]int[/B] Clamp([B]int[/B] val, [B]int[/B] min, [B]int[/B] max)  
        {  
            [B]return[/B] max(min, min(val, max));  
        }  
     
        HDC hDC;  
        HWND hWnd;  
        std::vector<Button> buttons;  
    };  
     
     
    [B]int[/B] _tmain([B]int[/B] argc, _TCHAR* argv[])  
    {  
        Window wnd;  
        [B]return[/B] 0;  
    }
    so my question is can recode anyone this that the bot is getting the colors faster?
Working...
X