Skip to content
This repository has been archived by the owner on Dec 21, 2022. It is now read-only.

Commit

Permalink
loading message
Browse files Browse the repository at this point in the history
  • Loading branch information
joffreybesos committed Nov 6, 2021
1 parent 21d7a2e commit 7e2db59
Show file tree
Hide file tree
Showing 12 changed files with 2,827 additions and 23 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

All notable changes to this project will be documented in this file.

## [1.2.5] - 2021-11-06 - Updated offset for new client

- 'Loading' text now shown in place of map while map is downloading
- If map fails to download an overlayed error message will be shown
- Map will now hide when you alt-tab out of the game

## [1.2.4] - 2021-11-06 - Updated offset for new client

- Settings.ini updated with new offset for client v1.0.66878
Expand Down
35 changes: 22 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,22 @@ This repo will fetch the map from a backend map server and display it in the top

![Durance of Hate Level 2](duranceofhate2.png)

Lower Kurast
<img src="lowerkurast.png" alt="Lower Kurast" width=50% height=50% style="background-color:#000">
Canyon of the Magi
<img src="canyonofthemagi.png" alt="Canyon of the Magi" width=50% height=50% style="background-color:#000">
Arcane Sanctuary
<img src="arcane.png" alt="Arcane Sanctuar" width=50% height=50% style="background-color:#000">

## Usage

1. Download the latest `d2rmap-vx.x.x.exe` and `settings.ini` release files (link to the right).
2. Launch D2R.
3. Run `d2rmap.exe` while in menus or in game.
4. Map should appear at the top left and change as you move through the levels. (It might take a few seconds to first appear)

**Note that this method uses my free map server that I offer for no fee. This server is getting hammered lately so it would be appreciated if you supported this project with a Bitcoin donation** `18hSn32hChp1CmBYnRdQFyzkz5drpijRa2`
**Note that this default method uses my hosted map server that I offer out for free.
This server is getting hammered lately so it would be appreciated if you supported this project with a Bitcoin donation** `18hSn32hChp1CmBYnRdQFyzkz5drpijRa2`

**Map Legend**

Expand All @@ -36,13 +44,11 @@ This repo will fetch the map from a backend map server and display it in the top
## Run from source

If you don't trust a precompiled executable, you can alternatively download and install <https://www.autohotkey.com/>
Then you can directly run `src/d2r-map.ahk` directly from source.
At least then you can verify the code yourself and ensure there are no hidden macros.
Then you can run `src/d2r-map.ahk` directly from source.
This way you can verify the code yourself and ensure there are no hidden macros.

Do not accept executables for this from any other source!



## Discord

Join the discord server <https://discord.gg/qEgqyVW3uj>
Expand Down Expand Up @@ -77,7 +83,7 @@ Please refer to [SERVER.md](SERVER.md)

## How it works

This script will run the background and read player data directly from memory.
This script will run the background and read player data directly from memory once per second.
It will retrieve the mapseed/level/difficulty and send a request to a mapserver hosted separately.
This mapserver will return a map image.
This script will display that map image in the corner as shown in the above screenshot.
Expand All @@ -88,15 +94,18 @@ No one can say for sure. Blizzard do have Warden anti-cheat that will scan your

## Troubleshooting

A log file `log.txt` is generated in the same folder as the executable.

You can also set debug logging to `true` in `settings.ini` for verbose logging.

Go to the discord server if you need further help <https://discord.gg/qEgqyVW3uj>

Tested and working on Diablo 2 Resurrected `1.0.66878`
- A log file `log.txt` is generated in the same folder as the executable.
- You can also set debug logging to `true` in `settings.ini` for verbose logging.
- Go to the discord server if you need further help <https://discord.gg/qEgqyVW3uj>
- Tested and working on Diablo 2 Resurrected `1.0.66878`

## TODO

- Need to add more info for NPCs and others
- Replace coloured blocks with icons
- Option to change the map to a floating window
- Path finding between waypoints/exits?
- Show player location on the map?
- Indicate on the screen which way waypoints/exits are relative to your position?

If you have ideas for more features, feel free to share them on discord
Binary file added arcane.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 canyonofthemagi.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 lowerkurast.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 16 additions & 3 deletions src/d2r-map.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,19 @@ WriteLog(" startingOffset: " startingOffset)
WriteLog(" debug logging: " debug)

playerOffset:=startingOffset
windowShow := true

SetTimer, UpdateCycle, 1000 ; the 1000 here is priority, not sleep
SetTimer, CheckScreen, 50
return


CheckScreen:
IfWinNotActive, ahk_exe D2R.exe
Gui, 1: Hide
IfWinActive, ahk_exe D2R.exe
if (windowShow)
Gui, 1: Show, NA
return

UpdateCycle:
Expand All @@ -51,18 +62,20 @@ UpdateCycle:
} else {
WriteLog("Fetching map from " sMapUrl)
lastMap := sMapUrl
windowShow := true
ShowMap(sMapUrl, width, leftMargin, topMargin, opacity)
}
} else {
windowShow := false
}
} else {
WriteLog("Found playerOffset" playerOffset ", but not map seed address")
Gui, 1: Hide
windowShow := false
playerOffset := startingOffset ; reset the offset to default
Sleep, 1000
}
} else {
playerOffset := startingOffset ; reset the offset to default
Gui, 1: Hide
windowShow := false
Sleep, 5000 ; sleep longer when no offset found, you're likely in menu
}
Sleep, 1000 ; set a pacing of 1 second
Expand Down
15 changes: 10 additions & 5 deletions src/include/showMap.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
SendMode Input
SetWorkingDir, %A_ScriptDir%
#Include %A_ScriptDir%\include\Gdip_All.ahk


#Include %A_ScriptDir%\include\showText.ahk

ShowMap(sMapUrl, configuredWidth, leftMargin, topMargin, opacity) {
; download image
Expand All @@ -13,18 +12,23 @@ ShowMap(sMapUrl, configuredWidth, leftMargin, topMargin, opacity) {
ExitApp
}

Gui, 1: Destroy
sFile=%a_scriptdir%\currentmap.png
URLDownloadToFile, %sMapUrl%,%sFile%

Gui, 1: -Caption +E0x20 +E0x80000 +LastFound +AlwaysOnTop +ToolWindow +OwnDialogs
Gui, 1: Show, NA
ShowText(configuredWidth, leftMargin, topMargin, "Loading map image...`nPlease wait", "22")
FileDelete, %sFile%
URLDownloadToFile, %sMapUrl%, %sFile%

Gui, 2: Hide
Gui, 1: -Caption +E0x20 +E0x80000 +LastFound +AlwaysOnTop +ToolWindow +OwnDialogs
hwnd1 := WinExist()
pBitmap := Gdip_CreateBitmapFromFile(sFile)

If !pBitmap
{
ShowText(configuredWidth, leftMargin, topMargin, "FAILED LOADING MAP!`nCheck log.txt`n`nExiting...", "ff")
WriteLog("Could not load " sMapUrl)
Sleep, 5000
ExitApp
}

Expand All @@ -49,4 +53,5 @@ ShowMap(sMapUrl, configuredWidth, leftMargin, topMargin, opacity) {
DeleteDC(hdc)
Gdip_DeleteGraphics(G)
Gdip_DisposeImage(pBitmap)
Gui, 1: Show, NA
}
29 changes: 29 additions & 0 deletions src/include/showText.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#Include %A_ScriptDir%\include\Gdip_All.ahk

ShowText(Width, leftMargin, topMargin, Text, opacity) {
pToken := Gdip_Startup()

Height = 500
Options = x0 y0 Center vCenter c%opacity%ffffff r4 s20
Font = Arial

DetectHiddenWindows, On
Gui, 2: -Caption +E0x20 +E0x80000 +LastFound +OwnDialogs +Owner +AlwaysOnTop
Gui, 2: Show, NA
hwnd1 := WinExist()
hbm := CreateDIBSection(Width, Height)
hdc := CreateCompatibleDC()
obm := SelectObject(hdc, hbm)
G := Gdip_GraphicsFromHDC(hdc)
Gdip_SetSmoothingMode(G, 4)
pBrush := Gdip_BrushCreateSolid(0xAA000000)
Gdip_DeleteBrush(pBrush)
Gdip_TextToGraphics(G, Text, Options, Font, Width, Height)
UpdateLayeredWindow(hwnd1, hdc, leftMargin, topMargin, Width, Height)
SelectObject(hdc, obm)
DeleteObject(hbm)
DeleteDC(hdc)
Gdip_DeleteGraphics(G)

Return
}
3 changes: 2 additions & 1 deletion src/settings.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
baseUrl=http://diab.wikiwarsgame.com:8080

[MapSettings]
; width is measured in pixels
width=1000
; height will be scaled in proportion to the width

Expand All @@ -10,7 +11,7 @@ leftMargin=50
topMargin=50

; opacity is 0-1 - lower is more transparent
opacity=0.6
opacity=0.5

[Memory]
playerOffset=0x20546E0
Expand Down
Loading

0 comments on commit 7e2db59

Please sign in to comment.