Skip to content

Commit

Permalink
Fixed a bug where some settings were not working without a reload.
Browse files Browse the repository at this point in the history
  • Loading branch information
DetroitApps committed Nov 4, 2019
1 parent ca23cd8 commit 93a77ed
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 15 deletions.
11 changes: 6 additions & 5 deletions Scenarios/ConnectPlayersOnServer.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ Main:
;Skip unactive accounts
If !ArrayAccounts[A_Index].IsActive
Continue

;Get value for server slot
inputX := Scenario.GetValueFromIni(section, "x" ArrayAccounts[A_Index].ServerSlot)
inputY := Scenario.GetValueFromIni(section, "y" ArrayAccounts[A_Index].ServerSlot)
If (!inputX || !inputY)
{
API.LogWrite("Couldn't load account input position from INI, stopping current scenario.", 2)
API.LogWrite("Couldn't load server slot position from INI, stopping current scenario.", 2)
MsgBox, 16, Error, Couldn't load server slot position from INI, stopping current scenario.
return
}

Expand All @@ -38,7 +38,8 @@ Main:
inputY := Scenario.GetValueFromIni(section, "y" ArrayAccounts[A_Index].PlayerSlot)
If (inputX = -1 || inputY = -1)
{
API.LogWrite("Couldn't load account input position from INI, stopping current scenario.", 2)
API.LogWrite("Couldn't load player slot position from INI, stopping current scenario.", 2)
MsgBox, 16, Error, Couldn't load player slot position from INI, stopping current scenario.
return
}
MouseMove, inputX, inputY, 5 * Settings.Speed
Expand All @@ -49,9 +50,9 @@ Main:
Click, 2
API.GuiUpdateProgressBar(i, API.GetNbWindows())
i++
Sleep 500
Sleep 1500
}

API.LogWrite("Successfully connected " i " characters.")
API.LogWrite("Successfully connected " i - 1 " characters.")
API.GuiUpdateProgressBar(100)
return
1 change: 1 addition & 0 deletions Scenarios/LoginAccounts.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Main:
If (!inputX || !inputY)
{
API.LogWrite("Couldn't load account input position from INI, stopping current scenario.", 2)
MsgBox, 16, Error, Couldn't load account input position from INI, stopping current scenario.
return
}
i := 1
Expand Down
12 changes: 7 additions & 5 deletions Scenarios/Out/MergedScenarios.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ ConnectPlayersOnServer:
;Skip unactive accounts
If !ArrayAccounts[A_Index].IsActive
Continue

;Get value for server slot
inputX := Scenario.GetValueFromIni(section, "x" ArrayAccounts[A_Index].ServerSlot)
inputY := Scenario.GetValueFromIni(section, "y" ArrayAccounts[A_Index].ServerSlot)
If (!inputX || !inputY)
{
API.LogWrite("Couldn't load account input position from INI, stopping current scenario.", 2)
API.LogWrite("Couldn't load server slot position from INI, stopping current scenario.", 2)
MsgBox, 16, Error, Couldn't load server slot position from INI, stopping current scenario.
return
}

Expand All @@ -71,7 +71,8 @@ ConnectPlayersOnServer:
inputY := Scenario.GetValueFromIni(section, "y" ArrayAccounts[A_Index].PlayerSlot)
If (inputX = -1 || inputY = -1)
{
API.LogWrite("Couldn't load account input position from INI, stopping current scenario.", 2)
API.LogWrite("Couldn't load player slot position from INI, stopping current scenario.", 2)
MsgBox, 16, Error, Couldn't load player slot position from INI, stopping current scenario.
return
}
MouseMove, inputX, inputY, 5 * Settings.Speed
Expand All @@ -82,10 +83,10 @@ ConnectPlayersOnServer:
Click, 2
API.GuiUpdateProgressBar(i, API.GetNbWindows())
i++
Sleep 500
Sleep 1500
}

API.LogWrite("Successfully connected " i " characters.")
API.LogWrite("Successfully connected " i - 1 " characters.")
API.GuiUpdateProgressBar(100)
return

Expand Down Expand Up @@ -141,6 +142,7 @@ LoginAccounts:
If (!inputX || !inputY)
{
API.LogWrite("Couldn't load account input position from INI, stopping current scenario.", 2)
MsgBox, 16, Error, Couldn't load account input position from INI, stopping current scenario.
return
}
i := 1
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=15
Id=16
2 changes: 2 additions & 0 deletions src/class/API/scenario.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ Class Scenario {

GetValueFromIni(ByRef section, ByRef key)
{
API.LogWrite("Trying to get value for key '" key "' in section '" section "' from INI file '" this.Title ".ini'.")
IniRead, readValue, % "resources/" . this.Title ".ini", %section%, %key%, %A_Space%
API.LogWrite("Result: " readValue)
return readValue
}
}
5 changes: 3 additions & 2 deletions src/class/accounts.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@
*/

Class Account {
__New(_Username, _Password, _Nickname, _CharacterClass, _IsActive, _PlayerSlot := 1, _ServerSlot := 1){
__New(_Username, _Password, _Nickname, _CharacterClass, _IsActive, _ServerSlot := 1, _PlayerSlot := 1)
{
static idIndex := 1

this.Username := _Username
this.Password := _Password
this.Nickname := _Nickname
this.CharacterClass := _CharacterClass
this.IsActive := _IsActive
this.PlayerSlot := _PlayerSlot
this.ServerSlot := _ServerSlot
this.PlayerSlot := _PlayerSlot
this.Id := idIndex++
}
}
3 changes: 1 addition & 2 deletions src/labels/labels.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,14 @@ SaveProfile:
password := InputPassword%A_Index%
If (CheckEncryption = 1)
password := XOR_String_Plus(password, MasterPassword)
Logger.Write(username)
file.WriteLine("Password" . A_Index . "=" . password)
file.WriteLine("Nickname" . A_Index . "=" . InputNickname%A_Index%)
file.WriteLine("Class" . A_Index . "=" . SelectClass%A_Index%)
file.WriteLine("PlayerSlot" . A_Index . "=" . SelectPlayerSlot%A_Index%)
file.WriteLine("ServerSlot" . A_Index . "=" . SelectServerSlot%A_Index%)
IsActive := CheckActive%A_Index% = 1 ? 1 : 0
file.WriteLine("IsActive" . A_Index . "=" . IsActive)
ArrayAccounts[A_Index] := New Account(InputUsername%A_Index%, InputPassword%A_Index%, InputNickname%A_Index%, SelectClass%A_Index%, IsActive)
ArrayAccounts[A_Index] := New Account(InputUsername%A_Index%, InputPassword%A_Index%, InputNickname%A_Index%, SelectClass%A_Index%, IsActive, SelectServerSlot%A_Index%, SelectPlayerSlot%A_Index%)
}
file.WriteLine("`n[Security]")
Encrypt := CheckEncryption = 1 ? 1 : 0
Expand Down

0 comments on commit 93a77ed

Please sign in to comment.