Skip to content

Commit

Permalink
v1.50.8 merge
Browse files Browse the repository at this point in the history
- mapping tracker: sanctum support
- preliminary support for community-sourced translations
  • Loading branch information
Lailloken authored Sep 2, 2023
2 parents 37fdf76 + d9ff1e7 commit 992d094
Show file tree
Hide file tree
Showing 10 changed files with 269 additions and 55 deletions.
15 changes: 10 additions & 5 deletions Lailloken UI.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ Return
#Include modules\hotkeys.ahk
#Include *i modules\hotkeys custom.ahk
#Include modules\item-checker.ahk
#Include modules\languages.ahk
#Include modules\leveling tracker.ahk
#Include modules\map-info.ahk
#Include modules\map tracker.ahk
Expand Down Expand Up @@ -229,6 +230,7 @@ HelpToolTip(HWND_key)
WinGetPos, xWin, yWin, wWin,, % "ahk_id "vars.hwnd[(HWND_checks[check] = 0) ? check : HWND_checks[check]].main
If (check = "lab" && InStr(control, "square"))
vars.help.lab[control] := [vars.lab.compass.rooms[StrReplace(control, "square")].name]

tooltip_width := (check = "settings") ? vars.settings.w - vars.settings.wSelection : (wWin - 2) * (check = "cheatsheets" && vars.cheatsheet_menu.type = "advanced" || check = "seed-explorer" ? 0.5 : 1)
If !tooltip_width
Return
Expand Down Expand Up @@ -522,6 +524,7 @@ Init_vars()
vars.cheatsheets := {}
vars.client := {}
vars.leveltracker := {}
vars.lang := {}
vars.log := {} ;store data related to the game's log here
vars.mapinfo := {}
vars.hwnd := {"help_tooltips": {}}
Expand Down Expand Up @@ -723,7 +726,7 @@ RightClick()
{
local
global vars, settings

If GetKeyState("LButton", "P")
Return
vars.system.click := 2
Expand Down Expand Up @@ -888,6 +891,7 @@ Startup()
sleep 4000

Init_client()
Init_lang()

vars.hwnd.poe_client := WinExist("ahk_group poe_window") ;save the client's handle
vars.general.runcheck := A_TickCount ;save when the client was last running (for purposes of killing the script after X minutes)
Expand Down Expand Up @@ -1238,7 +1242,7 @@ LLK_Error(ErrorMessage, restart := 0)

LLK_FileCheck()
{
If !FileExist("data\Resolutions.ini") || !FileExist("data\Class_CustomFont.ahk") || !FileExist("data\Fontin-SmallCaps.ttf") || !FileExist("data\JSON.ahk") || !FileExist("data\External Functions.ahk") || !FileExist("data\Map mods.ini") || !FileExist("data\Betrayal.json") || !FileExist("data\Atlas.ini") || !FileExist("data\timeless jewels\") || !FileExist("data\leveling tracker\")
If !FileExist("data\Resolutions.ini") || !FileExist("data\Class_CustomFont.ahk") || !FileExist("data\Fontin-SmallCaps.ttf") || !FileExist("data\JSON.ahk") || !FileExist("data\External Functions.ahk") || !FileExist("data\Map mods.ini") || !FileExist("data\Betrayal.json") || !FileExist("data\Atlas.ini") || !FileExist("data\timeless jewels\") || !FileExist("data\leveling tracker\") || !FileExist("data\lang_english.txt")
Return 0
Else Return 1
}
Expand All @@ -1261,12 +1265,13 @@ LLK_FilePermissionError(issue, folder)
MsgBox, % text
}

LLK_FileRead(file)
LLK_FileRead(file, keep_case := 0, encoding := "")
{
local

FileRead, read, % file
StringLower, read, read
FileRead, read, % (!Blank(encoding) ? "*P"encoding " " : "") file
If !keep_case
StringLower, read, read
Return read
}

Expand Down
6 changes: 3 additions & 3 deletions data/Betrayal.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,15 @@
"haku": {
"rewards": {
"fortification": [
"strongboxes",
"unique strongbox",
"mixed items"
],
"intervention": [
"ambush scarabs",
"ambush scarab"
],
"research": [
"qual rare items",
"quality rares",
"quality items"
],
"transportation": [
Expand Down Expand Up @@ -250,7 +250,7 @@
"blight scarab"
],
"research": [
"take one: catalyst,\nsplinter, essence, fossil",
"take one: oil, catalyst,\nsplinter, essence, fossil",
"fractured item"
],
"transportation": [
Expand Down
5 changes: 5 additions & 0 deletions data/changelog.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
[
[
["1.50.8", 15008],
"mapping tracker: sanctum support",
"general: preliminary support for community translations"
],
[
["1.50.7", 15007],
"item-info: jewel-weight fix",
Expand Down
8 changes: 6 additions & 2 deletions data/help tooltips.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
],
"active character status": [
"red: no name specified",
"yellow: char not found / waiting for level 2",
"yellow: char not found / waiting for level-up",
"green: char found, tracking active"
],
"force resolution": [
Expand Down Expand Up @@ -85,7 +85,7 @@
],
"cheatsheets modifier-key": [
"cheat sheets are activated by pressing the modifier and omni-key simultaneously",
"if a sheet is configured as <hold>, only the omni-key has to be held down",
"if a sheet is configured as <hold>, only the omni-key has to be held down",
"pick a combination that is not used in game"
],
"cheatsheets color": [
Expand Down Expand Up @@ -228,6 +228,9 @@
"single-click solution to mark larger mod groups as un/desired",
"the name specifies which mods are affected, the color whether they'll be set to un/desired"
],
"lang unavailable": [
"this feature is currently not available on non-english clients"
],
"leveltracker enable": [
"provides an automated leveling guide overlay and several campaign qol-tools"
],
Expand Down Expand Up @@ -321,6 +324,7 @@
],
"maptracker loot-tracker": [
"items you ctrl-click into the stash will be logged",
"ctrl-rightclick will remove previously added items one by one",
"requires the <stash> image-check to be set up correctly in the <screen-checks> menu"
],
"maptracker kill-tracker": [
Expand Down
115 changes: 115 additions & 0 deletions data/lang_english.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
;#####################################################
; general information/instructions
;#####################################################

; the script ignores lines that start with a semicolon
; this lang_english text-file can be used as a template to create new language-files
; feel free to publish your translation files in the Lailloken UI discussions section or your own GitHub repository
; I kindly ask you not to publish them as part of a Lailloken UI fork (imho, a translation for which I have laid the groundwork does not warrant a separate fork)

; make a __COPY__ of this file, then rename the __COPY__ to lang_XYZ (XYZ will be displayed in the drop-down menu in the <general> section of the settings menu, and it will also be used as a suffix for other required files, e.g. Betrayal-info data)
; the next time you restart the script, there should be a drop-down list with languages in the <general> section of the settings menu
; I know enough German to supply some edge-case examples/requirements for syntax-structures that differ from English, but not enough to add complete support for German game-clients
; use these examples to adjust the language-file to your own language

; each line of the main data is divided into two parts:
; key = "value"

; __DO NOT__ edit the key of a line, i.e. whatever is left of the equal sign
; always use TABs wherever this sample file uses them: if preferred, you can also remove them, but __DO NOT__ replace them with simple spaces

; the value contains in-game text AS IT IS DISPLAYED IN THE CHAT-BOX, and that's also what the script is looking for in the client.txt log-file
; the value has to be enclosed in quotation marks, and it is also case-sensitive
; to leave a value blank, set it to "0"

; depending on the syntax of a language, info-extraction from the client.txt file has to be adjusted
; generally, the script looks for certain patterns to determine what kind of information is present within a line in the log-file
; for English, "You have entered Highgate." will be displayed whenever you enter Highgate
; the script recognizes "You have entered", then 'knows' that the rest of the sentence is the location-name (so white-space and everything else will be removed)
; for German (and maybe others as well), "Ihr habt 'Hohenpforte' betreten." will be displayed
; so the script has to look for "Ihr habt" and "betreten" instead, then remove them to extract the location-name

; to let the script 'know' of this structural difference, additional key/value pairs have to be provided
; simply add one or more additional line(s) with the same key: it's important to list them in the correct order, i.e. following the sentence structure
; enter = "Ihr habt"
; enter = "betreten"



;#####################################################
; credits: translators
;#####################################################

; these names will be shown when hovering over the translator label next to the drop-down list in the settings menu
translator = "lailloken"
; translator = "0"
; translator = "0"
; translator = "0"
; translator = "0"



;#####################################################
; general: character tracking
;#####################################################

; certain languages may use sign-characters to highlight location-names (e.g. German uses apostrophes: Highgate -> 'Hohenpforte')
; location = "'"

; English doesn't, so the value stays blank ("0")
location = "0"
enter = "You have entered"
level = "is now level"
slain = "has been slain"
suicide = "has committed suicide"
killed = "You have killed"
killed = "monsters"



;#####################################################
; mapping tracker: league-content tracking (dialogue)
;#####################################################

; colons are included in the value (just in case they need to be swapped out in certain languages), so pay attention
; don't leave out colons because they are important for accuracy (especially Rog)
cassia = "Sister Cassia:"
strange voice = "Strange Voice:"
oshabi = "Oshabi:"
alva = "Alva, Master Explorer:"
einhar = "Einhar, Beastmaster:"
niko = "Niko, Master of the Depths:"
jun = "Jun, Veiled Master:"
aisling = "Aisling Laffrey, The Silent Butcher:"
cameria = "Cameria the Coldblooded:"
elreon = "Elreon, Light's Judge:"
gravicius = "Gravicius Reborn:"
guff = "Guff "Tiny" Grenn:"
haku = "Haku, Warmaster:"
hillock = "Hillock, the Blacksmith:"
it = "It That Fled:"
janus = "Janus Perandus:"
jorgin = "Thane Jorgin the Banished:"
korell = "Korell Goya, Son of Stone:"
leo = "Leo, Wolf of the Pits:"
riker = "Riker Maloney, Midnight Tinkerer:"
rin = "Rin Yuushu:"
tora = "Tora, the Culler:"
vagan = "Vagan, Victory's Herald:"
vorici = "Vorici, Silent Brother:"

; expedition note: there is a difference in displayed names depending on whether the NPCs greet you when they first see you in a map (Gwennen, the Gambler) or whether the encounter has finished (Gwennen)
; always use the name displayed when they greet you
; for some reason, Rog is always displayed as simply "Rog", regardless of when he speaks (at least in English)
dannig = "Dannig, Warrior Skald:"
gwennen = "Gwennen, the Gambler:"
rog = "Rog:"
tujen = "Tujen, the Haggler:"



;#####################################################
; mapping tracker: item names
;#####################################################

portal = "Portal Scroll"
2 changes: 1 addition & 1 deletion data/versions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"_release": [
15007,
15008,
"https://github.com/Lailloken/Lailloken-UI/archive/refs/heads/beta.zip"
]
}
26 changes: 13 additions & 13 deletions modules/client log.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

If !IsObject(vars.log.file)
{
vars.log.file := FileOpen(vars.log.file_location, "r")
vars.log.file := FileOpen(vars.log.file_location, "r", "UTF-8")
log_content := vars.log.file.Read()
}
Else FileRead, log_content, % vars.log.file_location
Expand Down Expand Up @@ -137,15 +137,15 @@ 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]"]
StringLower, content, content
Loop, Parse, content, `n, `r
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.
{
For index, skip in ignore
If InStr(A_LoopField, skip, 1) ;skip lines with certain key-words
If InStr(A_LoopField, skip, 1) ;skip lines with certain key words/phrases
Continue 2

If InStr(A_LoopField, "generating level")
If InStr(A_LoopField, "Generating level ", 1)
{
parse := SubStr(A_Loopfield, InStr(A_Loopfield, "area """) + 6), areaID := SubStr(parse, 1, InStr(parse, """") -1) ;store PoE-internal location name in var
areaseed := SubStr(A_Loopfield, InStr(A_Loopfield, "with seed ") + 10), areaname := ""
Expand All @@ -159,22 +159,22 @@ LogParse(content, ByRef areaID, ByRef areaname, ByRef areaseed, ByRef arealevel,
Else If InStr(A_LoopField, " connected to ") && InStr(A_LoopField, ".login.") || InStr(A_LoopField, "*****")
areaID := "login"

If InStr(A_LoopField, "you have entered ")
parse := SubStr(A_LoopField, InStr(A_LoopField, "you have entered") + 17), areaname := SubStr(parse, 1, -1)
If LangLineParse(A_LoopField, vars.lang.enter)
parse := SubStr(A_LoopField, InStr(A_LoopField, vars.lang.enter.1)), areaname := LLK_StringCase(LangLineTrim(parse, vars.lang.enter, 1))

If !Blank(settings.general.character) && InStr(A_LoopField, " " settings.general.character " ") && InStr(A_LoopField, " is now level ")
If !Blank(settings.general.character) && InStr(A_LoopField, " " settings.general.character " ") && LangLineParse(A_LoopField, vars.lang.level)
{
level := SubStr(A_Loopfield, InStr(A_Loopfield, "is now level ")), level := StrReplace(level, "is now level ")
level := SubStr(A_Loopfield, InStr(A_Loopfield, vars.lang.level.1)), level := LangLineTrim(level, vars.lang.level)
If settings.leveltracker.geartracker && vars.hwnd.geartracker.main
GeartrackerGUI("refresh")
}

If settings.features.maptracker && (vars.log.areaID = vars.maptracker.map.id) && (InStr(A_LoopField, " has been slain.") || InStr(A_LoopField, " has committed suicide."))
If settings.features.maptracker && (vars.log.areaID = vars.maptracker.map.id) && (LangLineParse(A_LoopField, vars.lang.slain) || LangLineParse(A_LoopField, vars.lang.suicide))
vars.maptracker.map.deaths += 1

If settings.features.maptracker && settings.maptracker.kills && vars.maptracker.refresh_kills && InStr(A_LoopField, "you have killed ")
If settings.features.maptracker && settings.maptracker.kills && vars.maptracker.refresh_kills && LangLineParse(A_LoopField, vars.lang.killed)
{
parse := SubStr(A_LoopField, InStr(A_LoopField, "you have killed ") + 16), parse := SubStr(parse, 1, InStr(parse, " monsters") - 1)
parse := SubStr(A_LoopField, InStr(A_LoopField, vars.lang.killed.1)), parse := LangLineTrim(parse, vars.lang.killed)
Loop, Parse, parse
{
If (A_Index = 1)
Expand Down
57 changes: 57 additions & 0 deletions modules/languages.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
Init_Lang()
{
local
global vars, settings, Json

lang := LLK_IniRead("ini\config.ini", "settings", "language", "english"), lang := !FileExist("data\lang_"lang ".txt") ? "english" : lang, settings.general.lang := lang
Loop, Parse, % StrReplace(LLK_FileRead("data\lang_"settings.general.lang ".txt", 1, "65001"), "`t"), `n, `r
{
If Blank(A_LoopField) || (SubStr(A_LoopField, 1, 1) = ";")
Continue
If !InStr(A_LoopField, "=")
{
MsgBox, % "Error in file ""data\lang_"settings.general.lang """, line"A_Index ":`nkey/value pair is missing an equal sign, or comment is missing a semicolon"
Continue
}
key := SubStr(A_LoopField, 1, InStr(A_LoopField, "=") - 1), val := SubStr(A_LoopField, InStr(A_LoopField, "=") + 1), val := SubStr(val, 2), val := SubStr(val, 1, -1)
If !val
Continue
If !IsObject(vars.lang[key])
vars.lang[key] := []
vars.lang[key].Push(val)
}
vars.help.settings["lang translators"] := vars.lang.translator.Clone()
}

LangLineParse(line, array)
{
local
global vars, settings

If !array.Count()
Return

check := 1
For index, segment in array
{
check *= InStr(line, segment, 1) ? 1 : 0
If !check
Break
}
Return check
}

LangLineTrim(line, array, location := 0)
{
local
global vars, settings

location := location ? vars.lang.location.1 : ""
For index, segment in array
line := StrReplace(line, segment,,, 1)
While InStr(" "location, SubStr(line, 1, 1))
line := SubStr(line, 2)
While InStr(" "location, SubStr(line, 0))
line := SubStr(line, 1, -1)
Return line
}
Loading

0 comments on commit 992d094

Please sign in to comment.