Skip to content

Commit

Permalink
add: 1.20e显血,用户名输入状态待定
Browse files Browse the repository at this point in the history
  • Loading branch information
LoveBeforT committed Sep 5, 2022
1 parent ae989b2 commit ddb2559
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 0 deletions.
2 changes: 2 additions & 0 deletions WarcraftHelper/WarcraftHelper.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@
<ClCompile Include="hook.cpp" />
<ClCompile Include="pathfix.cpp" />
<ClCompile Include="showfps.cpp" />
<ClCompile Include="showhpbar.cpp" />
<ClCompile Include="sizebypass.cpp" />
<ClCompile Include="unlockfps.cpp" />
<ClCompile Include="windowfixer.cpp" />
Expand All @@ -180,6 +181,7 @@
<ClInclude Include="hook.h" />
<ClInclude Include="pathfix.h" />
<ClInclude Include="showfps.h" />
<ClInclude Include="showhpbar.h" />
<ClInclude Include="sizebypass.h" />
<ClInclude Include="unlockfps.h" />
<ClInclude Include="version.h" />
Expand Down
6 changes: 6 additions & 0 deletions WarcraftHelper/WarcraftHelper.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@
<ClCompile Include="pathfix.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="showhpbar.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="helper.h">
Expand Down Expand Up @@ -77,5 +80,8 @@
<ClInclude Include="pathfix.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="showhpbar.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
</Project>
3 changes: 3 additions & 0 deletions WarcraftHelper/helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Helper::Helper() {
this->m_AutoRep = &AutoRep();
this->m_ShowFPS = &ShowFPS();
this->m_PathFix = &PathFix();
this->m_ShowHPBar = &ShowHPBar();
}

Helper::~Helper() {
Expand All @@ -51,6 +52,7 @@ void Helper::Start() {
this->m_AutoRep->Start(this->m_GamedllBase, this->m_War3Version);
this->m_ShowFPS->Start(this->m_GamedllBase, this->m_War3Version);
this->m_PathFix->Start(this->m_GamedllBase, this->m_War3Version);
this->m_ShowHPBar->Start(this->m_GamedllBase, this->m_War3Version);
}

void Helper::Stop() {
Expand All @@ -65,6 +67,7 @@ void Helper::Stop() {
this->m_AutoRep->Stop();
this->m_ShowFPS->Stop();
this->m_PathFix->Stop();
this->m_ShowHPBar->Stop();
}

bool Helper::IsWar3() {
Expand Down
3 changes: 3 additions & 0 deletions WarcraftHelper/helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include "autorep.h"
#include "showfps.h"
#include "pathfix.h"
#include "showhpbar.h"


class Helper {
public:
Expand All @@ -27,6 +29,7 @@ class Helper {
AutoRep *m_AutoRep;
ShowFPS* m_ShowFPS;
PathFix* m_PathFix;
ShowHPBar* m_ShowHPBar;

bool IsWar3();
};
Expand Down
63 changes: 63 additions & 0 deletions WarcraftHelper/showhpbar.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#include "showhpbar.h"

bool ShowHPBar_Patched = false;
bool ShowHPBar_Closed = false;
DWORD is_chat_addr = 0x45CB8C;

DWORD __stdcall ShowBar(LPVOID lpThreadParameter) {
HWND h_war3 = FindWindow(0, "Warcraft III");
while (1)
{
if (ShowHPBar_Closed) {
ExitThread(0);
}
if (*(DWORD*)is_chat_addr) {
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);*/
}
return 0;
}

ShowHPBar::ShowHPBar() {}
ShowHPBar::~ShowHPBar() {}

void ShowHPBar::Start(DWORD m_GamedllBase, Version m_War3Version) {
if (ShowHPBar_Patched) {
return;
}
ShowHPBar_Patched = true;
if (!m_GamedllBase) {
MessageBoxA(0, "GameDll³õʼ»¯Ê§°Ü", "ShowHPBar", 0);
return;
}
switch (m_War3Version) {
case Version::v120e:
break;
default:
return;
}


DWORD is_showfps = ReadDwordFromReg("SOFTWARE\\Blizzard Entertainment\\Warcraft III\\Gameplay", "healthbars");
WriteDwordToReg("SOFTWARE\\Blizzard Entertainment\\Warcraft III\\Gameplay", "healthbars", is_showfps);
if (!is_showfps) {
return;
}
this->thread = CreateThread(NULL, NULL, ShowBar, NULL, NULL, NULL);
}

void ShowHPBar::Stop() {
ShowHPBar_Closed = true;
Sleep(51);
keybd_event(219, 0, 2, 0);
keybd_event(221, 0, 2, 0);
}
15 changes: 15 additions & 0 deletions WarcraftHelper/showhpbar.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#pragma once
#pragma once

#include "hook.h"

class ShowHPBar {
public:
ShowHPBar();
~ShowHPBar();
void Start(DWORD m_GamedllBase, Version m_War3Version);
void Stop();
private:
HANDLE thread;
};

0 comments on commit ddb2559

Please sign in to comment.