Skip to content

Commit

Permalink
v1.51.2 merge
Browse files Browse the repository at this point in the history
- language-detection fix for client.txt files with many error-messages or crashes
- fix for AHK-related compatibility issues when running within Linux environment
  • Loading branch information
Lailloken authored Dec 10, 2023
2 parents 56d804c + a477038 commit f6164af
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 21 deletions.
3 changes: 2 additions & 1 deletion Lailloken UI.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ Init_vars()
vars.client := {}
vars.leveltracker := {}
vars.lang := {}, vars.lang2 := {}
vars.log := {} ;store data related to the game's log here
vars.log := {"skip": ["[ENTITY]", "Failed to create ", "[WARN Client ", "Enumerated ", "[MAT]", "[GRAPH]", "[TRAILS]", "[SHADER]", "[ENGINE]", "[RENDER]", "[DOWNLOAD]", "Tile hash", "Doodad hash", "Connecting to", "Connect time", "login server", "[D3D12]", "[D3D11]", "[WINDOW]", "Precalc", "[STARTUP]", "[WARN", "[VULKAN]", "[DXC]", "[TEXTURE]", "[BUNDLE]", "[JOB]", "Enumerated", "[SOUND]", "Queue file to download", "[STORAGE]", "[RESOURCE]", "[PARTICLE]", "[Item Filter]"]} ;store data related to the game's log here
vars.mapinfo := {}
vars.hwnd := {"help_tooltips": {}}
vars.help := Json.Load(LLK_FileRead("data\english\help tooltips.json",, "65001"))
Expand Down Expand Up @@ -1307,6 +1307,7 @@ LLK_FontSizeGet(height, ByRef font_width) ;returns a font-size that's about the
LLK_IniRead(file, section := "", key := "", default := "")
{
IniRead, iniread, % file, % section, % key, % !default ? A_Space : default
iniread := (iniread = " ") ? "" : iniread
If (default != "") && (iniread = "") ;IniRead's 'default' is only read if the key cannot be found in the ini-file
Return default ;if the key in the ini-file is blank, the target-variable will also be blank (instead of storing 'default')
Else Return iniread
Expand Down
4 changes: 4 additions & 0 deletions data/changelog.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
[
[
["1.51.2", 15102],
"language-detection tweaks for client.txt files with many error-messages or crashes"
],
[
["1.51.1", 15101],
"regex fixes: ball lightning, storm rain"
Expand Down
2 changes: 1 addition & 1 deletion data/versions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"_release": [
15101,
15102,
"https://github.com/Lailloken/Lailloken-UI/archive/refs/heads/main.zip"
]
}
27 changes: 16 additions & 11 deletions modules/client log.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,20 @@
local
global vars, settings

If !IsObject(vars.log.file)
If !IsObject(vars.log.file) ;at script-startup
{
vars.log.file := FileOpen(vars.log.file_location, "r", "UTF-8")
log_content := vars.log.file.Read()
log_content := vars.log.file.Read(), log_content := SubStr(log_content, StrLen(log_content) * 0.75), log_content := SubStr(log_content, InStr(log_content, "`n") + 1)
}
Else log_content := LLK_FileRead(vars.log.file_location, 1, "65001"), log_content := SubStr(log_content, StrLen(log_content) * 0.5), log_content := SubStr(log_content, InStr(log_content, "`n") + 1) ;when specifying "active character" in the settings menu

Loop, Parse, log_content, `n ;extract relevant lines only
{
If (A_Index = 1)
log_content := ""
If LLK_PatternMatch(A_LoopField, "", ["Generating level ", " : ", ".login.", "*****"])
log_content .= A_LoopField "`n"
}
Else log_content := LLK_FileRead(vars.log.file_location, 1, "65001") ;FileRead, log_content, % vars.log.file_location

vars.log.parsing := "areaID, areaname, areaseed, arealevel, areatier, act, level, date_time"
Loop, Parse, % vars.log.parsing, `,, %A_Space%
Expand All @@ -23,11 +31,11 @@
While (SubStr(log_chunk, 0) != "`r") ;remove incomplete line at the end
log_chunk := SubStr(log_chunk, 1, -1)
log_chunk := SubStr(log_chunk, 1, -1)

If !settings.general.lang_client ;check if the current client-language is supported, i.e. if any available language-pack matches the client.txt
LangClient(log_chunk)

If vars.log.areaID && !check || (5000*A_Index >= log_length) ;break if character could not be found in the whole log
If vars.log.areaID && !check || (5000*A_Index >= log_length) ;break if character could not be found
Break
If vars.log.areaID && !InStr(log_chunk, " " settings.general.character " (") ;skip chunk if it doesn't contain level-up messages
Continue
Expand Down Expand Up @@ -139,13 +147,10 @@ LogParse(content, ByRef areaID, ByRef areaname, ByRef areaseed, ByRef arealevel,
local
global vars, settings, db

ignore := ["[SHADER]", "[ENGINE]", "[RENDER]", "[DOWNLOAD]", "Tile hash", "Doodad hash", "Connecting to", "Connect time", "login server", "[D3D12]", "[D3D11]", "[WINDOW]", "Precalc", "[STARTUP]", "[WARN", "[VULKAN]", "[DXC]", "[TEXTURE]", "[BUNDLE]", "[JOB]", "Enumerated", "[SOUND]", "Queue file to download", "[STORAGE]", "[RESOURCE]", "[PARTICLE]", "[Item Filter]"]

Loop, Parse, content, `n, % "`r" vars.lang.system_fullstop.1
{
For index, skip in ignore
If InStr(A_LoopField, skip, 1) ;skip lines with certain key words/phrases
Continue 2
If LLK_PatternMatch(A_LoopField, "", vars.log.skip)
Continue

If InStr(A_LoopField, "Generating level ", 1)
{
Expand Down Expand Up @@ -185,7 +190,7 @@ LogParse(content, ByRef areaID, ByRef areaname, ByRef areaseed, ByRef arealevel,
vars.maptracker.map.kills.2 := parse, LLK_ToolTip(LangTrans("maptracker_kills", 2),,,,, "Lime"), vars.maptracker.refresh_kills := 3
}

If settings.features.maptracker && settings.maptracker.mechanics && (vars.log.areaID = vars.maptracker.map.id)
If settings.features.maptracker && settings.maptracker.mechanics && vars.maptracker.map.id && (vars.log.areaID = vars.maptracker.map.id)
MaptrackerParseDialogue(A_LoopField)
}
}
3 changes: 2 additions & 1 deletion modules/hotkeys.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ Init_hotkeys()
settings.hotkeys.omniblock := LLK_IniRead("ini\hotkeys.ini", "Hotkeys", "block omnikey's native function", 0)
settings.hotkeys.omnikey := LLK_IniRead("ini\hotkeys.ini", "Hotkeys", "omni-hotkey", "MButton")
settings.hotkeys.omnikey2 := LLK_IniRead("ini\hotkeys.ini", "Hotkeys", "omni-hotkey2")

If !settings.hotkeys.omnikey2
settings.hotkeys.rebound_c := 0
settings.hotkeys.tab := LLK_IniRead("ini\hotkeys.ini", "Hotkeys", "tab replacement", "tab")
settings.hotkeys.tabblock := (settings.hotkeys.tab = "capslock") ? 1 : LLK_IniRead("ini\hotkeys.ini", "Hotkeys", "block tab-key's native function", 0)

Hotkey, If, settings.maptracker.kills && settings.features.maptracker && (vars.maptracker.refresh_kills = 1)
Hotkey, % settings.hotkeys.omnikey, MapTrackerKills, On

Expand Down
16 changes: 12 additions & 4 deletions modules/languages.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,18 @@ LangClient(log_chunk) ;finds out which language the client is running

Loop, Parse, log_chunk, `n, % "`r" vars.lang.system_fullstop.1
{
If InStr(A_LoopField, "Generating level ", 1) ;reset parsed language-setting every time "Generating level" is found in the log
settings.general.lang_client := lang_client := "unknown" ;without this reset, this function would merely find the last valid language (instead of the actual current language)
For key, val in lang_check
lang_client := LangMatch(A_LoopField, val) ? key : lang_client
If InStr(A_LoopField, "Generating level ", 1) ;(potentially) reset parsed language-setting every time "Generating level" is found in the log
lang_reset := 1

If InStr(A_LoopField, " : ")
{
If lang_reset ;without this reset, this function would merely find the last valid language (instead of the actual current language)
settings.general.lang_client := lang_client := "unknown"
For key, val in lang_check
If LangMatch(A_LoopField, val)
lang_client := key, lang_reset := 0
}

}
settings.general.lang_client := lang_client

Expand Down
2 changes: 1 addition & 1 deletion modules/leveling tracker.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -1633,7 +1633,7 @@ LeveltrackerTimerGUI()
Gui, %leveltracker_timer%: Add, Text, % "ys Border Center 0x200 x+-1 HWNDhwnd hp w"vars.leveltracker.custom_fontwidth*7, % "act "(timer.current_act = 11 ? 10 : timer.current_act)
vars.hwnd.leveltracker_timer.pause := hwnd

ControlGetPos, xControl,,,,, % ahk_id %hwnd%
ControlGetPos, xControl,,,,, ahk_id %hwnd%
If !Blank(xControl)
{
Gui, %leveltracker_timer%: Show, % "NA x10000 y10000"
Expand Down
8 changes: 6 additions & 2 deletions modules/settings menu.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,7 @@ Settings_general2(cHWND := "")
{
local
global vars, settings
static char_wait

check := LLK_HasVal(vars.hwnd.settings, cHWND), control := SubStr(check, InStr(check, "_") + 1), update := vars.update
If !check
Expand Down Expand Up @@ -864,7 +865,10 @@ Settings_general2(cHWND := "")
GuiControl, +cRed, % vars.hwnd.settings.character
GuiControl, movedraw, % vars.hwnd.settings.character
Case "save_character":
parse := LLK_ControlGet(vars.hwnd.settings.character), settings.general.character := InStr(parse, " (") ? SubStr(parse, 1, InStr(parse, " (") - 1) : parse
If char_wait
Return
char_wait := 1, parse := LLK_ControlGet(vars.hwnd.settings.character), settings.general.character := InStr(parse, " (") ? SubStr(parse, 1, InStr(parse, " (") - 1) : parse
GuiControl, +disabled, % vars.hwnd.settings.character
IniWrite, % settings.general.character, ini\config.ini, Settings, active character
Init_log()
If WinExist("ahk_id "vars.hwnd.geartracker.main)
Expand All @@ -873,7 +877,7 @@ Settings_general2(cHWND := "")
GeartrackerGUI("refresh")
If WinExist("ahk_id "vars.hwnd.leveltracker.main)
GuiControl, text, % vars.hwnd.leveltracker.experience, % LeveltrackerExperience()
Settings_menu("general")
Settings_menu("general"), char_wait := 0
Case "language":
IniWrite, % LLK_ControlGet(vars.hwnd.settings.language), ini\config.ini, settings, language
IniWrite, % vars.settings.active, ini\config.ini, Versions, reload settings
Expand Down

0 comments on commit f6164af

Please sign in to comment.