Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@ Scripts/*.ini
*.bak
!.gitkeep
Accounts/Saved/**/*.xml
Accounts/SpecificCards/
Accounts/GodPacks/
Accounts/Saved/tmp/**
Accounts/Trades/*.csv
Accounts/Trades/*.json
Lab
Scripts/temp/**
Lab/

# macOS metadata files
._*
Expand All @@ -29,4 +33,4 @@ Lab
# Claude Code configuration
.claude/

.REFACTORING_SUMMARY.md
.REFACTORING_SUMMARY.md
1 change: 1 addition & 0 deletions Data/dictionary_cn.dat
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ Txt_openExtraPack:額外多開一包
Txt_claimSpecialMissions:領取特殊任務
SortByText:注入排序:

Txt_ParadoxDrive:Paradox Drive
Txt_PulsingAura:Pulsing Aura
Txt_MegaShine:Mega Shine
Txt_PaldeanWonders:Paldean Wonders
Expand Down
1 change: 1 addition & 0 deletions Data/dictionary_de.dat
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ Txt_openExtraPack:Extra-Pack öffnen
Txt_claimSpecialMissions:Spezialmissionen
SortByText:Sortieren nach:

Txt_ParadoxDrive:Paradox Drive
Txt_PulsingAura:Pulsing Aura
Txt_MegaShine:Mega Shine
Txt_PaldeanWonders:Paldean Wonders
Expand Down
1 change: 1 addition & 0 deletions Data/dictionary_en.dat
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ Txt_openExtraPack:Open Extra Pack
Txt_claimSpecialMissions:Claim Special Missions
SortByText:Sort By:

Txt_ParadoxDrive:Paradox Drive
Txt_PulsingAura:Pulsing Aura
Txt_MegaShine:Mega Shine
Txt_PaldeanWonders:Paldean Wonders
Expand Down
1 change: 1 addition & 0 deletions Data/dictionary_jp.dat
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ Txt_openExtraPack:追加パックを開く
Txt_claimSpecialMissions:イベント
SortByText:注入序列:

Txt_ParadoxDrive:Paradox Drive
Txt_PulsingAura:Pulsing Aura
Txt_MegaShine:Mega Shine
Txt_PaldeanWonders:Paldean Wonders
Expand Down
21 changes: 11 additions & 10 deletions Data/packdata.dat
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Pack list in Home screen
Home:Left|Mewtwo,Middle|PulsingAura,Right|MegaShine
# Pack list in Home screen
Home:Left|MegaShine,Middle|ParadoxDrive,Right|PulsingAura

# Pack data(Structure)
# PackID, Series Type, Number of packs in the set, Location of extension window, y Pos, Scroll Type
Expand All @@ -22,14 +22,15 @@ Pack:Springs|A|1|Col-Second|298|0
Pack:Deluxe|A|1|Col-First|298|0

# B Series
Pack:MegaGyarados|B|3|Col-Second-Left|405|1
Pack:MegaBlaziken|B|3|Col-Second-Middle|405|1
Pack:MegaAltaria|B|3|Col-Second-Right|405|1
Pack:CrimsonBlaze|B|1|Col-First|434|2
Pack:Parade|B|1|Col-Second|434|0
Pack:PaldeanWonders|B|1|Col-First|434|0
Pack:MegaShine|B|1|Col-Second|298|0
Pack:PulsingAura|B|1|Col-First|298|0
Pack:MegaGyarados|B|3|Col-First-Left|405|1
Pack:MegaBlaziken|B|3|Col-First-Middle|405|1
Pack:MegaAltaria|B|3|Col-First-Right|405|1
Pack:CrimsonBlaze|B|1|Col-Second|434|2
Pack:Parade|B|1|Col-First|434|2
Pack:PaldeanWonders|B|1|Col-Second|434|0
Pack:MegaShine|B|1|Col-First|434|0
Pack:PulsingAura|B|1|Col-Second|298|0
Pack:ParadoxDrive|B|1|Col-First|298|0

# DO NOT Delete End
---END---
98 changes: 75 additions & 23 deletions PTCGPB.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ OnMessage(0x4A, "ReceiveData")

if not A_IsAdmin
{
Run *RunAs "%A_ScriptFullPath%"
try {
Run *RunAs "%A_ScriptFullPath%"
} catch {
MsgBox, 48, PTCGPB, Administrator permission is required to run PTCGPB.`n`nPlease launch it again and approve the permission prompt.
}
ExitApp
}

Expand All @@ -81,11 +85,19 @@ botConfig.loadSettingsToConfig("ALL")

SetTimer, ShowSwipeSpeedToolTip, 50

displayScaleSetting := botConfig.get("DisplayScale")
if (displayScaleSetting = "")
displayScaleSetting := "Auto"
configuredDisplayScale := GetConfiguredDisplayScale()
if (displayScaleSetting = "Auto")
displayScaleLabel := "Auto (resolved to " . configuredDisplayScale . "%)"
else
displayScaleLabel := displayScaleSetting . "%"
hasInvalidScale := false

monitorScaleList := GetAllMonitorScales()
For idx, scaleValue in monitorScaleList {
if(scaleValue != 100){
if(scaleValue != configuredDisplayScale){
hasInvalidScale := true
break
}
Expand All @@ -94,10 +106,11 @@ For idx, scaleValue in monitorScaleList {
if (hasInvalidScale) {
msgTitle := "Display Scale Warning"
msgText := "WARNING: Display scale issue detected!`n`n"
. "To ensure the program works correctly, ALL monitors must be set to 100% scale in Windows settings.`n`n"
. "Please change your display scale to 100% and restart the program.`n`n"
. "[!] If you are ABSOLUTELY SURE all your monitors are already at 100% (script detection error), you can choose to ignore this warning.`n`n"
. "Do you want to ignore this warning and continue anyway?"
. "PTCGPB needs one matching display scale for coordinates and image search.`n"
. "Set the bot Display Scale and every Windows monitor to the same value (100% or 125%).`n`n"
. "Bot Display Scale: " displayScaleLabel "`n`n"
. "Restart the program after changing scale settings.`n`n"
. "Continue anyway?"

MsgBox, 308, %msgTitle%, %msgText%

Expand Down Expand Up @@ -312,7 +325,12 @@ NextStep:
Gui, Font, s12 cWhite Bold
Gui, Add, Text, x621 y20 w155 h50 Left BackgroundTrans cWhite, % dict["title_main"]
Gui, Font, s10 cWhite Bold
Gui, Add, Text, x621 y20 w155 h150 Left BackgroundTrans cWhite, % "`n" localVersion "`n(for Scale 100%)`n`nModder: Crinity " modVersion
displayScaleCaption := botConfig.get("DisplayScale")
if (displayScaleCaption = "" || displayScaleCaption = "Auto")
displayScaleCaption := "Auto/" . GetConfiguredDisplayScale() . "%"
else
displayScaleCaption := displayScaleCaption . "%"
Gui, Add, Text, x621 y20 w155 h150 Left BackgroundTrans cWhite, % "`n" localVersion "`n(Scale " displayScaleCaption ")`n`nModder: Crinity " modVersion

Gui, Add, Picture, gBuyMeCoffee x625 y130 w150, %A_ScriptDir%\GUI\Images\support_me_on_kofi.png

Expand Down Expand Up @@ -1123,6 +1141,17 @@ ShowToolsAndSystemSettings:
SelectedMonitorIndex := RegExReplace(botConfig.get("SelectedMonitorIndex"), ":.*$")
Gui, ToolsAndSystemSelect:Add, DropDownList, x%col2X% y%yPos2% w100 vui_SelectedMonitorIndex_Popup Choose%SelectedMonitorIndex% Background2A2A2A cWhite, %MonitorOptions%
yPos2 += 25

displayScaleList := "Auto|100|125"
displayScaleChoose := 1
if (botConfig.get("DisplayScale") = "100")
displayScaleChoose := 2
else if (botConfig.get("DisplayScale") = "125")
displayScaleChoose := 3
displayScaleTextY := yPos2 + 2
Gui, ToolsAndSystemSelect:Add, Text, x%col2X% y%displayScaleTextY% %sectionColor%, Display Scale
Gui, ToolsAndSystemSelect:Add, DropDownList, x325 y%yPos2% w60 vui_DisplayScale_Popup Choose%displayScaleChoose% Background2A2A2A cWhite, %displayScaleList%
yPos2 += 25

rowGapY := yPos2 + 2
Gui, ToolsAndSystemSelect:Add, Text, x%col2X% y%rowGapY% %sectionColor%, % dict["Txt_RowGap"]
Expand Down Expand Up @@ -1222,6 +1251,7 @@ saveToolsAndSystemSettings:
botConfig.set("wonderpickForEventMissions", ui_wonderpickForEventMissions_Popup, "ToolsAndSystem")

botConfig.set("SelectedMonitorIndex", ui_SelectedMonitorIndex_Popup, "ToolsAndSystem")
botConfig.set("DisplayScale", ui_DisplayScale_Popup, "ToolsAndSystem")
botConfig.set("RowGap", ui_RowGap_Popup, "ToolsAndSystem")
botConfig.set("folderPath", ui_folderPath_Popup, "ToolsAndSystem")
botConfig.set("ocrLanguage", ui_ocrLanguage_Popup, "ToolsAndSystem")
Expand Down Expand Up @@ -1441,14 +1471,18 @@ BalanceXMLs:
if !FileExist(saveDir)
FileCreateDir, %saveDir%

tmpDir := A_ScriptDir "\Accounts\Saved\tmp"
if !FileExist(tmpDir)
FileCreateDir, %tmpDir%
tmpRoot := A_ScriptDir "\Accounts\Saved\tmp"
if !FileExist(tmpRoot)
FileCreateDir, %tmpRoot%

FormatTime, balanceRunId,, yyyyMMddHHmmss
tmpDir := tmpRoot . "\balance_" . balanceRunId . "_" . A_TickCount
FileCreateDir, %tmpDir%

Tooltip, Moving Files and Folders to tmp
Loop, Files, %saveDir%*, D
{
if (A_LoopFilePath == tmpDir)
if (A_LoopFilePath == tmpRoot)
continue
dest := tmpDir . "\" . A_LoopFileName

Expand Down Expand Up @@ -1528,6 +1562,9 @@ BalanceXMLs:
if (instance > botConfig.get("Instances"))
instance := 1
}

ToolTip, Restoring preserved files
RestorePreservedSavedReadmes(tmpDir, saveDir)

instanceOneDir := saveDir . "1"
counter := 0
Expand All @@ -1546,6 +1583,24 @@ BalanceXMLs:
}
return

RestorePreservedSavedReadmes(tmpDir, saveDir) {
Loop, Files, %tmpDir%\*, FR
{
if (A_LoopFileName != "readme.md")
continue

relativePath := SubStr(A_LoopFileFullPath, StrLen(tmpDir) + 2)
if (!RegExMatch(relativePath, "i)^(\d+)\\readme\.md$", readmeMatch))
continue

restorePath := saveDir . readmeMatch1 . "\readme.md"
SplitPath, restorePath,, restoreDir
if !FileExist(restoreDir)
FileCreateDir, %restoreDir%
FileMove, %A_LoopFileFullPath%, %restorePath%, 1
}
}

; =================== Logic - Launch All Mumu Button Action ===================
LaunchAllMumu:
Gui, Submit, NoHide
Expand Down Expand Up @@ -1575,9 +1630,10 @@ ArrangeWindows:

SaveAllSettings()

scaleParam := 283
windowMetrics := GetMumuWindowMetrics()
scaleParam := windowMetrics.scaleParam
windowsPositioned := 0
titleHeight := 40
titleHeight := windowMetrics.titleHeight

if(botConfig.get("SelectedMonitorIndex") = "")
botConfig.set("SelectedMonitorIndex", "1:", "ToolsAndSystem")
Expand All @@ -1595,7 +1651,7 @@ ArrangeWindows:

instanceIndex := A_Index
borderWidth := 4 - 1
rowHeight := titleHeight + 492
rowHeight := windowMetrics.rowHeight
currentRow := Floor((instanceIndex - 1) / botConfig.get("Columns"))
y := MonitorTop + (currentRow * rowHeight) + (currentRow * botConfig.get("rowGap"))
x := MonitorLeft + (Mod((instanceIndex - 1), botConfig.get("Columns")) * (scaleParam - borderWidth * 2))
Expand Down Expand Up @@ -1626,7 +1682,7 @@ ArrangeWindows:
instanceIndex := (botConfig.get("Mains") - 1) + A_Index + 1

borderWidth := 4 - 1
rowHeight := titleHeight + 492
rowHeight := windowMetrics.rowHeight
currentRow := Floor((instanceIndex - 1) / botConfig.get("Columns"))
y := MonitorTop + (currentRow * rowHeight) + (currentRow * botConfig.get("rowGap"))
x := MonitorLeft + (Mod((instanceIndex - 1), botConfig.get("Columns")) * (scaleParam - borderWidth * 2))
Expand Down Expand Up @@ -1725,10 +1781,6 @@ SaveAllSettings() {
botConfig.set("stopPreferenceMain", botConfig.get("stopPreferenceMain"), "Extra")

botConfig.saveConfigToSettings("ALL")

if (botConfig.get("debugMode")) {
FileAppend, % A_Now . " - Settings saved. DeleteMethod: " . botConfig.get("deleteMethod") . "`n", %A_ScriptDir%\debug_settings.log
}
}

; =================== Logic - Reset account lists ===================
Expand Down Expand Up @@ -1945,7 +1997,7 @@ StartBot() {
discMessage .= selectMsg

if(botConfig.get("groupRerollEnabled") || (!botConfig.get("groupRerollEnabled") && botConfig.get("heartBeatOwnerWebHookURL") = ""))
LogToDiscord(discMessage,, false,,, botConfig.get("heartBeatWebhookURL"))
LogToDiscord(discMessage,, false,,, botConfig.get("heartBeatWebhookURL"),, false)

if(botConfig.get("heartBeatOwnerWebHookURL")){
FormatTime, currentTime, , yyyy-MM-dd HH:mm:ss
Expand Down Expand Up @@ -1978,7 +2030,7 @@ StartBot() {

discMessage .= "\n--------------------------------------------------"

LogToDiscord(discMessage,, false,,, botConfig.get("heartBeatOwnerWebHookURL"))
LogToDiscord(discMessage,, false,,, botConfig.get("heartBeatOwnerWebHookURL"),, false)
}

if (botConfig.get("debugMode")) {
Expand Down Expand Up @@ -2024,7 +2076,7 @@ SendAllInstancesOfflineStatus() {
discMessage .= selectMsg
discMessage .= "\n\n All instances marked as OFFLINE"

LogToDiscord(discMessage,, false,,, botConfig.get("heartBeatWebhookURL"))
LogToDiscord(discMessage,, false,,, botConfig.get("heartBeatWebhookURL"),, false)
}

ReceiveData(wParam, lParam) {
Expand Down Expand Up @@ -2207,4 +2259,4 @@ return
~+F12::
ListVars
Pause ; 변수 목록을 확인하기 위해 스크립트를 잠시 멈춥니다.
return
return
Loading