Skip to content

Commit

Permalink
update: 更新1.20e自动显血支持
Browse files Browse the repository at this point in the history
  • Loading branch information
LoveBeforT committed Sep 5, 2022
1 parent ddb2559 commit a22077e
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 15 deletions.
1 change: 1 addition & 0 deletions WarcraftHelper/helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ void Helper::Stop() {
this->m_ShowFPS->Stop();
this->m_PathFix->Stop();
this->m_ShowHPBar->Stop();
Sleep(60);
}

bool Helper::IsWar3() {
Expand Down
35 changes: 22 additions & 13 deletions WarcraftHelper/showhpbar.cpp
Original file line number Diff line number Diff line change
@@ -1,28 +1,36 @@
#include "showhpbar.h"
#include <iostream>

bool ShowHPBar_Patched = false;
bool ShowHPBar_Closed = false;
DWORD is_chat_addr = 0x45CB8C;
DWORD *is_chat_addr = (DWORD*)0x45CB8C;
DWORD game_status = 0;

int(__fastcall* orgSetGameStatus)(DWORD *ecx, DWORD edx, DWORD status) = 0;
int __fastcall SetGameStatus(DWORD *ecx, DWORD edx, DWORD status) {
DWORD ret = orgSetGameStatus(ecx, edx, status);
game_status = ecx[156];
return ret;
}

DWORD __stdcall ShowBar(LPVOID lpThreadParameter) {
HWND h_war3 = FindWindow(0, "Warcraft III");
while (1)
{
if (ShowHPBar_Closed) {
ExitThread(0);
}
if (*(DWORD*)is_chat_addr) {
if (IsBadReadPtr(is_chat_addr, 4)) {
break;
}
if (*is_chat_addr) {
continue;
}
if (game_status != 4) {
continue;
}
keybd_event(219, 0, 0, 0);
keybd_event(221, 0, 0, 0);
Sleep(500);

/* PostMessage(h_war3, WM_KEYDOWN, 219, 0);
PostMessage(h_war3, WM_KEYDOWN, 221, 0);
PostMessage(h_war3, WM_KEYUP, 219, 0);
PostMessage(h_war3, WM_KEYUP, 221, 0);*/
Sleep(50);
}
return 0;
}
Expand All @@ -39,8 +47,10 @@ void ShowHPBar::Start(DWORD m_GamedllBase, Version m_War3Version) {
MessageBoxA(0, "GameDll³õʼ»¯Ê§°Ü", "ShowHPBar", 0);
return;
}
DWORD SetGameStatus_addr = 0;
switch (m_War3Version) {
case Version::v120e:
SetGameStatus_addr = 0x6F283B60;
break;
default:
return;
Expand All @@ -53,11 +63,10 @@ void ShowHPBar::Start(DWORD m_GamedllBase, Version m_War3Version) {
return;
}
this->thread = CreateThread(NULL, NULL, ShowBar, NULL, NULL, NULL);
InlineHook((void*)SetGameStatus_addr, SetGameStatus, (void*&)orgSetGameStatus);
}

void ShowHPBar::Stop() {
ShowHPBar_Closed = true;
Sleep(51);
keybd_event(219, 0, 2, 0);
keybd_event(221, 0, 2, 0);
DetachHook((void*)orgSetGameStatus, SetGameStatus);
}
1 change: 0 additions & 1 deletion WarcraftHelper/windowfixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,4 @@ void WindowFixer::Start() {

void WindowFixer::Stop() {
t_closed = true;
Sleep(51);
}
10 changes: 9 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#### 介绍

魔兽辅助插件,解除地图大小限制,宽屏支持,解锁FPS,自动保存录像,自动显示fps,最大刷新率修复,目录中文名修复
魔兽辅助插件,解除地图大小限制,宽屏支持,解锁FPS,自动保存录像,自动显示fps,最大刷新率修复,目录中文名修复,自动显血

支持版本:1.20e、1.24e和1.27a

Expand All @@ -15,6 +15,7 @@
| 自动显示fps | × |||
| 最大刷新率修复 ||||
| 地图目录中文名修复 ||||
| 自动显血 || 游戏自带 | 游戏自带 |

使用方法:把WarcraftHelper.mix文件直接放到魔兽目录下,第一次运行使用窗口化模式启动魔兽争霸3,以便插件覆盖注册表中魔兽fps最大值数据。

Expand All @@ -36,6 +37,13 @@ HKEY_CURRENT_USER\\SOFTWARE\\Blizzard Entertainment\\Warcraft III\\Video
将表项`showfps`设置为1即可,**不支持**1.20e版本魔兽,你仍然可以在游戏内使用`/fps`来关闭fps显示。

- 对于高刷新率屏幕,魔兽全屏模式下鼠标会有延迟感,第一次打开游戏时会刷新注册表,第二次进入游戏后就正常不会有延迟感了。
- 对于1.20e的版本,如果要开启自动显血,需要**进入注册表**

```
HKEY_CURRENT_USER\\SOFTWARE\\Blizzard Entertainment\\Warcraft III\\Gameplay
```

将表项`healthbars`设置为1即可,**支持**1.20e版本魔兽。



Expand Down

0 comments on commit a22077e

Please sign in to comment.