Skip to content

Commit

Permalink
v1.3.5 Commits
Browse files Browse the repository at this point in the history
  • Loading branch information
BuilderDolphin committed Apr 28, 2024
1 parent c7759f2 commit 9262207
Show file tree
Hide file tree
Showing 13 changed files with 332 additions and 74 deletions.
49 changes: 34 additions & 15 deletions Main.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if (RegExMatch(A_ScriptDir,"\.zip")){

Gdip_Startup()

global version := "v1.3.4"
global version := "v1.3.5"

global robloxId := 0

Expand Down Expand Up @@ -618,7 +618,7 @@ runPath(pathName,voidPoints,noCenter = 0){
pathsRunning.Push(targetDir)

DetectHiddenWindows, On
Run, % targetDir
Run, % """" . A_AhkPath . """ """ . targetDir . """"

stopped := 0

Expand Down Expand Up @@ -652,7 +652,9 @@ runPath(pathName,voidPoints,noCenter = 0){
PixelGetColor, pColor, % point[1], % point[2], RGB
blackCorners += compareColors(pColor,0x000000) < 8
}
if (blackCorners == 3){
PixelGetColor, pColor, % rX+width*0.5, % rY+height*0.5, RGB
centerBlack := compareColors(pColor,0x000000) < 8
if (blackCorners = 3 && centerBlack){
if (!voidCooldown){
voidCooldown := 5
expectedVoids -= 1
Expand Down Expand Up @@ -974,16 +976,17 @@ GetRobloxHWND()
return 0
}

getRobloxPos(ByRef x := "", ByRef y := "", ByRef width := "", ByRef height := ""){
rHwnd := GetRobloxHWND()
WinGetPos, x, y, width, height, ahk_id %rHwnd%
getRobloxPos(ByRef x := "", ByRef y := "", ByRef width := "", ByRef height := "", hwnd := ""){
if !hwnd
hwnd := GetRobloxHWND()
VarSetCapacity( buf, 16, 0 )
DllCall( "GetClientRect" , "UPtr", hwnd, "ptr", &buf)
DllCall( "ClientToScreen" , "UPtr", hwnd, "ptr", &buf)

if (!isFullscreen()){
height -= 39
width -= 16
x += 8
y += 31
}
x := NumGet(&buf,0,"Int")
y := NumGet(&buf,4,"Int")
width := NumGet(&buf,8,"Int")
height := NumGet(&buf,12,"Int")
}


Expand Down Expand Up @@ -1082,7 +1085,7 @@ getMenuButtonPosition(num, ByRef posX := "", ByRef posY := ""){ ; num is 1-7, 1
menuBarVSpacing := 10.5*(height/1080)
menuBarButtonSize := 58*(width/1920)
menuEdgeCenter := [rX + menuBarOffset, rY + (height/2)]
startPos := [menuEdgeCenter[1]+(menuBarButtonSize/2),menuEdgeCenter[2]+(menuBarButtonSize/4)-(menuBarButtonSize+menuBarVSpacing-1)*3.5] ; 3 to 4 because easter
startPos := [menuEdgeCenter[1]+(menuBarButtonSize/2),menuEdgeCenter[2]+(menuBarButtonSize/4)-(menuBarButtonSize+menuBarVSpacing-1)*3] ; final factor = 0.5x (x is number of menu buttons visible to all, so exclude private server button)

posX := startPos[1]
posY := startPos[2] + (menuBarButtonSize+menuBarVSpacing)*(num-1)
Expand Down Expand Up @@ -1175,6 +1178,9 @@ clickCraftingSlot(num,isPotionSlot := 0){
fittingSlots := Floor(scrollerHeight/slotHeight) + (Mod(scrollerHeight, slotHeight) > height*0.045)
if (fittingSlots < num){
rCount := num-fittingSlots
if (num = 13 && !isPotionSlot){
rCount += 5
}
Loop %rCount% {
Click, WheelDown
Sleep, 200
Expand Down Expand Up @@ -1339,12 +1345,20 @@ screenshotInventories(){ ; from all closed

waitForInvVisible()

itemButton := getPositionFromAspectRatioUV(0.564405, -0.451327, storageAspectRatio)
MouseMove, % itemButton[1], % itemButton[2]
Sleep, 200
MouseClick
Sleep, 200

ssMap := Gdip_BitmapFromScreen(topLeft[1] "|" topLeft[2] "|" totalSize[1] "|" totalSize[2])
Gdip_SaveBitmapToFile(ssMap,ssPath)
Gdip_DisposeBitmap(ssMap)
try webhookPost({files:[ssPath],embedImage:"attachment://ss.jpg",embedTitle: "Item Inventory Screenshot"})

MouseClick
Sleep, 200
clickMenuButton(3)
Sleep, 200
}

checkBottomLeft(){
Expand Down Expand Up @@ -1954,6 +1968,8 @@ handleImportSettings(){
MsgBox, 0,Import Settings Error, % "Cannot import settings from the current macro!"
}
}

importingSettings := 0
}

handleWebhookEnableToggle(){
Expand Down Expand Up @@ -2137,7 +2153,7 @@ startMacro(){
Gui, mainUI:+LastFoundExist
WinSetTitle, % "dolphSol Macro " version " (Running)"

Run, % mainDir . "lib\status.ahk"
Run, % """" . A_AhkPath . """ """ mainDir . "lib\status.ahk"""

if (options.StatusBarEnabled){
Gui statusBar:Show, % "w220 h25 x" (A_ScreenWidth-300) " y50", dolphSol Status
Expand Down Expand Up @@ -2247,6 +2263,9 @@ Supporters (Donations)
- @Ami.n
- @s.a.t.s
- @UnamedWasp - Member
- @JujuFRFX
- @Xon67
- @NightLT98 - Member

Thank you to everyone who currently supports and uses the macro! You guys are amazing!
)
Expand Down
Binary file added images/glitchTest.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/nullTest.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/play.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/starfallTest.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/starfallTest2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 24 additions & 9 deletions lib/colorRead.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,30 @@ isFullscreen() {
return (w = A_ScreenWidth && h = A_ScreenHeight)
}

getRobloxPos(ByRef x := "", ByRef y := "", ByRef width := "", ByRef height := ""){
WinGetPos, x, y, width, height, Roblox

if (!isFullscreen()){
height -= 39
width -= 16
x += 8
y += 31
}
GetRobloxHWND()
{
if (hwnd := WinExist("Roblox ahk_exe RobloxPlayerBeta.exe"))
return hwnd
else if (WinExist("Roblox ahk_exe ApplicationFrameHost.exe"))
{
ControlGet, hwnd, Hwnd, , ApplicationFrameInputSinkWindow1
return hwnd
}
else
return 0
}

getRobloxPos(ByRef x := "", ByRef y := "", ByRef width := "", ByRef height := "", hwnd := ""){
if !hwnd
hwnd := GetRobloxHWND()
VarSetCapacity( buf, 16, 0 )
DllCall( "GetClientRect" , "UPtr", hwnd, "ptr", &buf)
DllCall( "ClientToScreen" , "UPtr", hwnd, "ptr", &buf)

x := NumGet(&buf,0,"Int")
y := NumGet(&buf,4,"Int")
width := NumGet(&buf,8,"Int")
height := NumGet(&buf,12,"Int")
}

global currentText := ""
Expand Down
27 changes: 17 additions & 10 deletions lib/ocr.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,9 @@ ocr(file, lang := "FirstFromAvailableLanguages")
}
if (OcrEngine = 0)
{
msgbox Can not use language "%lang%" for OCR, please install language pack.
ExitApp
; msgbox Can not use language "%lang%" for OCR, please install language pack.
; ExitApp
return
}
CurrentLanguage := lang
}
Expand All @@ -100,8 +101,9 @@ ocr(file, lang := "FirstFromAvailableLanguages")
DllCall(NumGet(NumGet(BitmapFrame+0)+13*A_PtrSize), "ptr", BitmapFrame, "uint*", height) ; get_PixelHeight
if (width > MaxDimension) or (height > MaxDimension)
{
msgbox Image is to big - %width%x%height%.`nIt should be maximum - %MaxDimension% pixels
ExitApp
; msgbox Image is to big - %width%x%height%.`nIt should be maximum - %MaxDimension% pixels
; ExitApp
return
}
BitmapFrameWithSoftwareBitmap := ComObjQuery(BitmapDecoder, IBitmapFrameWithSoftwareBitmap := "{FE287C9A-420C-4963-87AD-691436E08383}")
DllCall(NumGet(NumGet(BitmapFrameWithSoftwareBitmap+0)+6*A_PtrSize), "ptr", BitmapFrameWithSoftwareBitmap, "ptr*", SoftwareBitmap) ; GetSoftwareBitmapAsync
Expand Down Expand Up @@ -142,13 +144,14 @@ CreateClass(string, interface, ByRef Class)
result := DllCall("Combase.dll\RoGetActivationFactory", "ptr", hString, "ptr", &GUID, "ptr*", Class)
if (result != 0)
{
return
if (result = 0x80004002)
msgbox No such interface supported
else if (result = 0x80040154)
msgbox Class not registered
else
msgbox error: %result%
ExitApp
; ExitApp
}
DeleteHString(hString)
}
Expand All @@ -174,8 +177,9 @@ WaitForAsync(ByRef Object)
if (status != 1)
{
DllCall(NumGet(NumGet(AsyncInfo+0)+8*A_PtrSize), "ptr", AsyncInfo, "uint*", ErrorCode) ; IAsyncInfo.ErrorCode
msgbox AsyncInfo status error: %ErrorCode%
ExitApp
;msgbox AsyncInfo status error: %ErrorCode%
;ExitApp
return
}
ObjRelease(AsyncInfo)
break
Expand All @@ -187,11 +191,14 @@ WaitForAsync(ByRef Object)
Object := ObjectResult
}

ocrFromBitmap(ByRef pbm){ ; removes pbm too
ocrFromBitmap(pbm){
hBM := Gdip_CreateHBITMAPFromBitmap(pbm)
;Gdip_SaveBitmapToFile(pBMNew, i A_Index ".png")
Gdip_DisposeImage(pbm)
pIRandomAccessStream := HBitmapToRandomAccessStream(hBM)
DllCall("DeleteObject", "Ptr", hBM)
return ocr(pIRandomAccessStream,"en")
result := ""
try {
result := ocr(pIRandomAccessStream,"en-us")
}
return result
}
23 changes: 12 additions & 11 deletions lib/pathReference.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,17 @@ GetRobloxHWND()
return 0
}

getRobloxPos(ByRef x := "", ByRef y := "", ByRef width := "", ByRef height := ""){
rHwnd := GetRobloxHWND()
WinGetPos, x, y, width, height, ahk_id %rHwnd%

if (!isFullscreen()){
height -= 39
width -= 16
x += 8
y += 31
}
getRobloxPos(ByRef x := "", ByRef y := "", ByRef width := "", ByRef height := "", hwnd := ""){
if !hwnd
hwnd := GetRobloxHWND()
VarSetCapacity( buf, 16, 0 )
DllCall( "GetClientRect" , "UPtr", hwnd, "ptr", &buf)
DllCall( "ClientToScreen" , "UPtr", hwnd, "ptr", &buf)

x := NumGet(&buf,0,"Int")
y := NumGet(&buf,4,"Int")
width := NumGet(&buf,8,"Int")
height := NumGet(&buf,12,"Int")
}

getColorComponents(color){
Expand Down Expand Up @@ -142,7 +143,7 @@ getMenuButtonPosition(num, ByRef posX := "", ByRef posY := ""){ ; num is 1-7, 1
menuBarVSpacing := 10.5*(height/1080)
menuBarButtonSize := 58*(width/1920)
menuEdgeCenter := [rX + menuBarOffset, rY + (height/2)]
startPos := [menuEdgeCenter[1]+(menuBarButtonSize/2),menuEdgeCenter[2]+(menuBarButtonSize/4)-(menuBarButtonSize+menuBarVSpacing-1)*3.5] ; 3 to 4 because easter
startPos := [menuEdgeCenter[1]+(menuBarButtonSize/2),menuEdgeCenter[2]+(menuBarButtonSize/4)-(menuBarButtonSize+menuBarVSpacing-1)*3] ; final factor = 0.5x (x is number of menu buttons visible to all, so exclude private server button)

posX := startPos[1]
posY := startPos[2] + (menuBarButtonSize+menuBarVSpacing)*(num-1)
Expand Down
59 changes: 59 additions & 0 deletions lib/releaseClone.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#SingleInstance, Force
SendMode Input
SetWorkingDir, %A_ScriptDir%

#Include, Gdip_All.ahk

global macroDir
RegExMatch(A_ScriptDir, "(.*)(?=\\)", macroDir)

global targetDir

MsgBox, 4, Warning, Creating/cloning for a release will either create a new directory or modify this macro's files. Proceed?

IfMsgBox, No
Exit

MsgBox, 3,Make New Directory?,Would you like to make a new directory for release? If not, this directory will be prepared for release.

global inputNewDir
IfMsgBox, Cancel
Exit
IfMsgBox, No
targetDir := macroDir
IfMsgBox, Yes
InputBox, targetDir, New Directory Path, Please enter the new directory path to create the release on.,,,,,,,, % macroDir . "-release"

RegExMatch(targetDir, ".*(?=\\.+\\?)", targetParent)
if (!FileExist(targetParent)){
MsgBox, ,Error,The parent directory you have entered for the new directory does not exist.`n`nTarget Directory: %targetDir%`nParent Directory: %targetParent%
Exit
}

if (FileExist(targetDir)){
MsgBox, 4, Warning, Proceeding will replace any existing files in this directory with their reset versions. Would you like to continue?
IfMsgBox, No
Exit
}

FileCopyDir, %macroDir%, %targetDir%, 1
exists := FileExist(targetDir)
if (ErrorLevel){
MsgBox,, Error, % "An error occurred, please try again."
Exit
}

token := Gdip_Startup()

empty := Gdip_CreateBitmap(1,1)
Gdip_SaveBitmapToFile(empty,targetDir . "\lib\ss.jpg")
Gdip_DisposeBitmap(empty)

Gdip_Shutdown(token)

configHeader := "; dolphSol Settings`n; Do not put spaces between equals`n; Additions may break this file and the macro overall, please be cautious`n; If you mess up this file, clear it entirely and restart the macro`n`n[Options]`r`n"

FileDelete, % targetDir . "\settings\config.ini"
FileAppend, % configHeader, % targetDir . "\settings\config.ini"

MsgBox, ,Release Process Complete,% "The directory " . targetDir . " is ready for release!"
14 changes: 11 additions & 3 deletions lib/staticData.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
; This data may update more than the macro itself, and is updated upon startup

[Options]
latestVersion=v1.3.4
latestVersion=v1.3.5
versionLink=https://github.com/BuilderDolphin/dolphSol-Macro/releases/latest
updateNotes=- Improved roll detection, small bug fixes
updateNotes=- Rare biome detection, lots of bug fixes

; star colors
; 1/10k+
Expand Down Expand Up @@ -147,6 +147,14 @@ nameMutation1m5015039=Aquatic : Flame
imageMutation1m5015039=https://static.wikia.nocookie.net/sol-rng/images/e/ea/Aquatic_Flame.gif
rarityMutation1m5015039=4000000

nameMutation1m7822335=Lunar : Full Moon (Breakthrough)
imageMutation1m7822335=https://static.wikia.nocookie.net/sol-rng/images/b/b4/LunarFullMoonAura.gif
rarityMutation1m7822335=5000000

nameMutation1m5390591=Twilight (Breakthrough)
imageMutation1m5390591=https://static.wikia.nocookie.net/sol-rng/images/4/4d/RobloxPlayerBeta_1Wn7Ej3k18.gif
rarityMutation1m5390591=6000000

name7808256=Hades
image7808256=https://static.wikia.nocookie.net/sol-rng/images/9/9d/HadesAura.gif
rarity7808256=6666666
Expand All @@ -165,7 +173,7 @@ name7665997=Glitch
image7665997=https://static.wikia.nocookie.net/sol-rng/images/4/44/GlitchAuraingame.gif
rarity7665997=12210110

name16722992=CHROMATIC OR Kromat1k (1/2)
name16722992=CHROMATIC
image16722992=https://static.wikia.nocookie.net/sol-rng/images/c/c4/RobloxPlayerBeta_9sJxflFBDP.gif
rarity16722992=20000000

Expand Down
Loading

0 comments on commit 9262207

Please sign in to comment.