eyal282 icon

Hazama Gemless Paleo

eyal282 | PRO | 07/07/22 09:13:01 PM UTC | 0 ⭐ | 529 👁️ | Never ⏰ | []
Autohotkey |

4.76 KB

|

None

|

0 👍

/

0 👎

#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
 
CardSortType_Rarity := 1
CardSortType_Level := 2
CardSortType_ATK := 3
CardSortType_DEF := 4
 
CardSortOrder_Ascending := 1
CardSortOrder_Descending := 2
 
MsgBox, 4, Hazama's Gemless deck, Press the Yes button if your game is in windowed mode. If you need to cancel the process, press ESC.
 
LastWinW := 0
LastWinH := 0
 
IfMsgBox Yes
{
    WinWaitActive, masterduel
 
    WinGetPos,X,Y,LastWinW,LastWinH,A
 
    ResizeWin(512, 512)
    
    RemoveMainDeckMonsters()
 
    ; RemoveMainDeckMonsters ensures the mouse is not pointing at the button of display unowned cards.
    DisplayUnownedCards()
 
    RemoveExtraDeckMonsters()
 
    ClearAllFilters()
    
    SetCardSortMethod(CardSortType_Rarity, CardSortOrder_Ascending)
    AddCardByText("Sea Stealth Attack", 3)
    AddCardByText("Torrential Tribute", 2)
    AddCardByText("Gaia Knight, The Force of Earth", 3)
    AddCardByText("+ Blue-Eyes White Dragon", 2)
    AddCardByText("Berserker of the Tenyi", 1)
 
    SetCardSortMethod(CardSortType_Rarity, CardSortOrder_Descending)
    ; Here we start main deck monsters.
 
    AddCardByText("Megalosmasher X", 3)
    AddCardByText("Planet Pathfinder", 3)
    AddCardByText("Pacifis, the Phantasm City", 3)
    AddCardByText("Dimensional Fissure", 3)
    AddCardByText("Mystical Space Typhoon", 2)
    AddCardByText("Forbidden Chalice", 2)
    AddCardByText("Floodgate Trap Hole", 2)
    AddCardByText("Paleozoic Canadia", 2)
    AddCardByText("Paleozoic Dinomischus", 2)
    AddCardByText("Paleozoic Pikaia", 2)
    AddCardByText("Spiral Battle Min", 3)
    AddCardByText("Spiral Power Min", 2)
    AddCardByText("Dogmatika Punishment", 3)
    AddCardByText("Fists of the Unrivaled Tenyi", 3)
 
    ; Now we switch to extra deck monsters.
 
    AddCardByText("Herald of Pure Light", 1)
    AddCardByText("Cat Shark", 1)
    AddCardByText("Number 45: Crumble Logos the Prophet of Demolition", 1)
    AddCardByText("The Phantom Knights of Cursed Javelin", 1)
    AddCardByText("Gem-Knight Pearl", 1)
    AddCardByText("Number 82: Heartlandraco", 1)
    AddCardByText("Gagaga Samurai", 1)
    AddCardByText("Number 70: Malevolent Sin", 1)
    AddCardByText("Defender of the Labyrinth", 1)
 
    ResizeWin(LastWinW, LastWinH)
 
}
Else
{
    Return
}
 
ResizeWin(Width = 0,Height = 0)
{
    WinGetPos,X,Y,W,H,A
    
    if(%Width% = 0)
    {
        Width := W
    }
 
    if(%Height% = 0)
    {
        Height := H
    }
 
    WinMove,A,,%X%,%Y%,%Width%,%Height%
}
 
DisplayUnownedCards()
{
    PixelGetColor, OutputVar, 464, 181
 
    OutputVar += 0
 
    if(OutputVar < 2000)
    {
        Click, 464 181
 
        Sleep, 3000
    }
}
RemoveMainDeckMonsters()
{
    ; 70 instead of 65 to account for situations where the player already has an open menu.
    Loop, 70
    {
        Click, 148 197 Right
        Sleep, 100
    }
}
 
RemoveExtraDeckMonsters()
{
    Loop, 20
    {
        Click, 150 341 Right
        Sleep, 100
    }
}
 
ClearAllFilters()
{
    Click, 467 198
    Sleep, 2000
}
 
SetCardSortMethod(cardtype, cardorder)
{
    CardSortType_Rarity := 1
    CardSortType_Level := 2
    CardSortType_ATK := 3
    CardSortType_DEF := 4
 
    CardSortOrder_Ascending := 1
    CardSortOrder_Descending := 2
    
    Sleep, 1000
 
    Click, 419 195
 
    Sleep, 3000
 
 
    targetScreenPosX := 255
 
    if(cardorder = CardSortOrder_Descending)
    {
        targetScreenPosX += 63
    }
 
    targetScreenPosY := 0
 
    switch %cardtype%
    {
        case %CardSortType_Rarity%: targetScreenPosY = 150
        case %CardSortType_Level%: targetScreenPosY = 177
        case %CardSortType_ATK%: targetScreenPosY = 207
        case %CardSortType_DEF%: targetScreenPosY = 232
    }
 
    Click, %targetScreenPosX%, %targetScreenPosY%
 
    Sleep, 3000
}
AddCardByText(text, copies)
{
    text := StrReplace(text, "/", "{NumpadDiv}")
    text := StrReplace(text, "+", "{NumpadAdd}")
    text := StrReplace(text, "-", "{NumpadSub}")
    
    Click, 383 180
    Sleep, 200
    Send, %text%
    Sleep, 200
    Send, {Enter}
    Sleep, 1000
 
    Loop, %copies%
    {
        Click, 360 225 Right
        Sleep, 100
    }
 
    Click, 443 181
    Sleep, 1000
}
 
/::
 
    WinWaitActive, masterduel
 
    WinGetPos,X,Y,LastWinW,LastWinH,A
 
    ResizeWin(512, 512)
 
    MouseGetPos, xpos, ypos 
 
    clipboard = Click, %xpos% %ypos%
 
return
 
Esc::
    if(%LastWinW% != 0 && %LastWinH% != 0)
    {
        ResizeWin(LastWinW, LastWinH)
    }
 
ExitApp ; Exit script with Escape key
return

Comments