Skip to content

Commit

Permalink
Bugfix : Changed the opening behavior of the instances, RMM now fetch…
Browse files Browse the repository at this point in the history
…es the active window. + minor modifications + update build number
  • Loading branch information
mysther committed Nov 26, 2020
1 parent 33e92b4 commit 43901bd
Show file tree
Hide file tree
Showing 6 changed files with 116 additions and 59 deletions.
56 changes: 41 additions & 15 deletions Scenarios/ConnectPlayersOnServer.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,24 @@ Main:
API.GuiUpdateProgressBar(0)

section := A_ScreenWidth . "x" . A_ScreenHeight

; -------------
; Select server
; -------------
Loop, % API.GetNbWindows()
{
window := API.GetWindow(A_Index)
DofusInstanceWindow := API.GetWindow(A_Index)

;Skip if already connected
If (window.isConnected = True)
If (DofusInstanceWindow.isConnected = True)
Continue

window.Activate()
window.WaitActive()
DofusInstanceWindow.Activate()
DofusInstanceWindow.WaitActive()

;Get server slot position
inputX := Scenario.GetValueFromIni(section, "x" window.account.ServerSlot)
inputY := Scenario.GetValueFromIni(section, "y" window.account.ServerSlot)
inputX := Scenario.GetValueFromIni(section, "x" DofusInstanceWindow.account.ServerSlot)
inputY := Scenario.GetValueFromIni(section, "y" DofusInstanceWindow.account.ServerSlot)
If (!inputX || !inputY)
{
API.LogWrite("Couldn't load server slot position from INI, stopping current scenario.", 2)
Expand All @@ -33,24 +37,26 @@ Main:

SleepHandler(-100)

API.GuiUpdateProgressBar(A_Index, API.GetNbWindows()*2)
API.GuiUpdateProgressBar(A_Index, API.GetNbWindows()*3)
}

;-----------------------------------------------------------------
; -------------
; Select player
; -------------
Loop, % API.GetNbWindows()
{
window := API.GetWindow(A_Index)
DofusInstanceWindow := API.GetWindow(A_Index)

;Skip if already connected
If (window.isConnected = True)
If (DofusInstanceWindow.isConnected = True)
Continue

window.Activate()
window.WaitActive()
DofusInstanceWindow.Activate()
DofusInstanceWindow.WaitActive()

;Get player slot position
inputX := Scenario.GetValueFromIni(section, "x" window.account.PlayerSlot)
inputY := Scenario.GetValueFromIni(section, "y" window.account.PlayerSlot)
inputX := Scenario.GetValueFromIni(section, "x" DofusInstanceWindow.account.PlayerSlot)
inputY := Scenario.GetValueFromIni(section, "y" DofusInstanceWindow.account.PlayerSlot)
If (inputX = -1 || inputY = -1)
{
API.LogWrite("Couldn't load player slot position from INI, stopping current scenario.", 2)
Expand All @@ -64,7 +70,27 @@ Main:

SleepHandler(-100)

API.GuiUpdateProgressBar(A_Index+ API.GetNbWindows(), API.GetNbWindows()*2)
API.GuiUpdateProgressBar(A_Index+ API.GetNbWindows(), API.GetNbWindows()*3)
}


; -------------
; Update window
; -------------
Loop, % API.GetNbWindows()
{
DofusInstanceWindow := API.GetWindow(A_Index)

;Skip if already connected
If (DofusInstanceWindow.isConnected = True)
Continue

DofusInstanceWindow.SetTitle()
DofusInstanceWindow.isConnected := True

SleepHandler(-100)

API.GuiUpdateProgressBar(A_Index + (API.GetNbWindows()*2), API.GetNbWindows()*3)
}

API.GuiUpdateProgressBar(100)
Expand Down
16 changes: 8 additions & 8 deletions Scenarios/LoginAccounts.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ Main:
Loop, % API.GetNbWindows() {
API.LogWrite("Trying to connect account #" A_Index ".")

window := API.GetWindow(A_Index)
If (window.isConnected = True)
DofusInstanceWindow := API.GetWindow(A_Index)
If (DofusInstanceWindow.isConnected = True)
{
API.LogWrite("Skipping window #" A_Index ", already connected.")
Continue
Expand All @@ -30,24 +30,24 @@ Main:
If (Settings.WaitForAnkamaShield = True)
MsgBox, % Translate("UnlockShield", API.GetUsername(A_Index))

window.Activate()
window.WaitActive()
window.Maximize()
DofusInstanceWindow.Activate()
DofusInstanceWindow.WaitActive()
DofusInstanceWindow.Maximize()

;Username
Sleep, 50 * Settings.SpeedConnection
Sleep, 100 * Settings.SpeedConnection
MouseMove, inputX, inputY, 5 * Settings.SpeedConnection
Click
Sleep, 50 * Settings.SpeedConnection
Send, ^a
Sleep, 50 * Settings.SpeedConnection
SendRaw, % window.account.username
SendRaw, % DofusInstanceWindow.account.username
Sleep, 50 * Settings.SpeedConnection

;Password
Send, {Tab}
Sleep, 50 * Settings.SpeedConnection
SendRaw, % window.account.password
SendRaw, % DofusInstanceWindow.account.password
Sleep, 50 * Settings.SpeedConnection
Send, {Tab}
Sleep, 50 * Settings.SpeedConnection
Expand Down
15 changes: 9 additions & 6 deletions Scenarios/OpenDofusInstances.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,23 @@ Main:

Run, % Settings.DofusPath

WinWait, % Settings.DofusWindowName, , 10
WinWaitActive, % Settings.DofusWindowName, , 10
if ErrorLevel
{
MsgBox, 16, % Translate("Error"), % Translate("WinWaitTimeOutMsg")
API.LogWrite("Game window couldn't be detected (Timeout).")
return
}

WinGet, window, ID, % Settings.DofusWindowName
this_window := API.NewWindow(window, ArrayAccounts[A_Index])
this_window.WaitOpen()
this_window.SetTitle()
WinGet, window
DofusInstanceWindow := API.NewWindow(window, ArrayAccounts[A_Index])
DofusInstanceWindow.WaitOpen()
DofusInstanceWindow.Minimize()

; Disable renaming WindowsTitle (Dofus Retro instance change his name multiple time during connection)
; DofusInstanceWindow.SetTitle()

API.AddWindowToListView(this_window.id)
API.AddWindowToListView(DofusInstanceWindow.id)
API.GuiUpdateProgressBar(A_Index, API.GetNbActiveAccounts())

i++
Expand Down
82 changes: 53 additions & 29 deletions Scenarios/Out/MergedScenarios.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -121,20 +121,24 @@ ConnectPlayersOnServer:
API.GuiUpdateProgressBar(0)

section := A_ScreenWidth . "x" . A_ScreenHeight

; -------------
; Select server
; -------------
Loop, % API.GetNbWindows()
{
window := API.GetWindow(A_Index)
DofusInstanceWindow := API.GetWindow(A_Index)

;Skip if already connected
If (window.isConnected = True)
If (DofusInstanceWindow.isConnected = True)
Continue

window.Activate()
window.WaitActive()
DofusInstanceWindow.Activate()
DofusInstanceWindow.WaitActive()

;Get server slot position
inputX := Scenario.GetValueFromIni(section, "x" window.account.ServerSlot)
inputY := Scenario.GetValueFromIni(section, "y" window.account.ServerSlot)
inputX := Scenario.GetValueFromIni(section, "x" DofusInstanceWindow.account.ServerSlot)
inputY := Scenario.GetValueFromIni(section, "y" DofusInstanceWindow.account.ServerSlot)
If (!inputX || !inputY)
{
API.LogWrite("Couldn't load server slot position from INI, stopping current scenario.", 2)
Expand All @@ -148,24 +152,26 @@ ConnectPlayersOnServer:

SleepHandler(-100)

API.GuiUpdateProgressBar(A_Index, API.GetNbWindows()*2)
API.GuiUpdateProgressBar(A_Index, API.GetNbWindows()*3)
}

;-----------------------------------------------------------------
; -------------
; Select player
; -------------
Loop, % API.GetNbWindows()
{
window := API.GetWindow(A_Index)
DofusInstanceWindow := API.GetWindow(A_Index)

;Skip if already connected
If (window.isConnected = True)
If (DofusInstanceWindow.isConnected = True)
Continue

window.Activate()
window.WaitActive()
DofusInstanceWindow.Activate()
DofusInstanceWindow.WaitActive()

;Get player slot position
inputX := Scenario.GetValueFromIni(section, "x" window.account.PlayerSlot)
inputY := Scenario.GetValueFromIni(section, "y" window.account.PlayerSlot)
inputX := Scenario.GetValueFromIni(section, "x" DofusInstanceWindow.account.PlayerSlot)
inputY := Scenario.GetValueFromIni(section, "y" DofusInstanceWindow.account.PlayerSlot)
If (inputX = -1 || inputY = -1)
{
API.LogWrite("Couldn't load player slot position from INI, stopping current scenario.", 2)
Expand All @@ -179,7 +185,22 @@ ConnectPlayersOnServer:

SleepHandler(-100)

API.GuiUpdateProgressBar(A_Index+ API.GetNbWindows(), API.GetNbWindows()*2)
API.GuiUpdateProgressBar(A_Index+ API.GetNbWindows(), API.GetNbWindows()*3)
}


; -------------
; Update window
; -------------
Loop, % API.GetNbWindows()
{
DofusInstanceWindow := API.GetWindow(A_Index)
DofusInstanceWindow.SetTitle()
DofusInstanceWindow.isConnected := True

SleepHandler(-100)

API.GuiUpdateProgressBar(A_Index + (API.GetNbWindows()*2), API.GetNbWindows()*3)
}

API.GuiUpdateProgressBar(100)
Expand Down Expand Up @@ -251,8 +272,8 @@ LoginAccounts:
Loop, % API.GetNbWindows() {
API.LogWrite("Trying to connect account #" A_Index ".")

window := API.GetWindow(A_Index)
If (window.isConnected = True)
DofusInstanceWindow := API.GetWindow(A_Index)
If (DofusInstanceWindow.isConnected = True)
{
API.LogWrite("Skipping window #" A_Index ", already connected.")
Continue
Expand All @@ -261,24 +282,24 @@ LoginAccounts:
If (Settings.WaitForAnkamaShield = True)
MsgBox, % Translate("UnlockShield", API.GetUsername(A_Index))

window.Activate()
window.WaitActive()
window.Maximize()
DofusInstanceWindow.Activate()
DofusInstanceWindow.WaitActive()
DofusInstanceWindow.Maximize()

;Username
Sleep, 50 * Settings.SpeedConnection
Sleep, 100 * Settings.SpeedConnection
MouseMove, inputX, inputY, 5 * Settings.SpeedConnection
Click
Sleep, 50 * Settings.SpeedConnection
Send, ^a
Sleep, 50 * Settings.SpeedConnection
SendRaw, % window.account.username
SendRaw, % DofusInstanceWindow.account.username
Sleep, 50 * Settings.SpeedConnection

;Password
Send, {Tab}
Sleep, 50 * Settings.SpeedConnection
SendRaw, % window.account.password
SendRaw, % DofusInstanceWindow.account.password
Sleep, 50 * Settings.SpeedConnection
Send, {Tab}
Sleep, 50 * Settings.SpeedConnection
Expand Down Expand Up @@ -356,20 +377,23 @@ OpenDofusInstances:

Run, % Settings.DofusPath

WinWait, % Settings.DofusWindowName, , 10
WinWaitActive, % Settings.DofusWindowName, , 10
if ErrorLevel
{
MsgBox, 16, % Translate("Error"), % Translate("WinWaitTimeOutMsg")
API.LogWrite("Game window couldn't be detected (Timeout).")
return
}

WinGet, window, ID, % Settings.DofusWindowName
this_window := API.NewWindow(window, ArrayAccounts[A_Index])
this_window.WaitOpen()
this_window.SetTitle()
WinGet, window
DofusInstanceWindow := API.NewWindow(window, ArrayAccounts[A_Index])
DofusInstanceWindow.WaitOpen()
DofusInstanceWindow.Minimize()

; Disable renaming WindowsTitle (Dofus Retro instance change his name multiple time during connection)
; DofusInstanceWindow.SetTitle()

API.AddWindowToListView(this_window.id)
API.AddWindowToListView(DofusInstanceWindow.id)
API.GuiUpdateProgressBar(A_Index, API.GetNbActiveAccounts())

i++
Expand Down
2 changes: 1 addition & 1 deletion Tools/Release Maker/build.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[Build]
Id=33
Id=34
4 changes: 4 additions & 0 deletions src/class/API/window.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ Class Window {
WinMaximize, % "ahk_id " this.hwnd
}

Minimize(){
WinMinimize, % "ahk_id " this.hwnd
}

SetTitle(){
If (this.hwnd = "")
Logger.Write("Window HWND is not a valid ID : '" this.hwnd "'", 2)
Expand Down

0 comments on commit 43901bd

Please sign in to comment.