Skip to content

Commit

Permalink
Merge pull request planqi#10 from arolds/BuffSystem
Browse files Browse the repository at this point in the history
Buff system
  • Loading branch information
BeLikeLeBron authored Oct 27, 2021
2 parents 6c0a9ed + 71f2889 commit 9648d05
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 18 deletions.
1 change: 1 addition & 0 deletions BH/D2Ptrs.h
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,7 @@ VARPTR(D2LAUNCH, BnData, BnetData *, 0x25ABC, 0x25B30)

FUNCPTR(D2WIN, DrawSprites, void __fastcall, (void), 0x18750, 0xEAA0)
FUNCPTR(D2WIN, LoadCellFile, CellFile* __fastcall, (const char* szFile, int Type), -10111, -10023)
FUNCPTR(D2WIN, UnloadCellFile, void __fastcall, (CellFile* pCellFile), -10126, -10189)
FUNCPTR(D2WIN, DrawCellFile, void __fastcall, (CellFile * pCellFile, int xPos, int yPos, int div, int trans, int Color), -10138, -10172)


Expand Down
44 changes: 27 additions & 17 deletions BH/Modules/ScreenInfo/ScreenInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,14 @@ map<std::string, Toggle> ScreenInfo::Toggles;
void ScreenInfo::OnLoad() {
LoadConfig();

//buffs
buffs = { STATE_QUICKNESS,STATE_FADE,STATE_CLOAKED,STATE_VENOMCLAWS,STATE_SHOUT,STATE_BATTLEORDERS,STATE_BATTLECOMMAND,STATE_OAKSAGE,STATE_CYCLONEARMOR,STATE_HURRICANE,STATE_BONEARMOR,STATE_HOLYSHIELD,STATE_FROZENARMOR,STATE_SHIVERARMOR,STATE_CHILLINGARMOR,STATE_ENCHANT,STATE_ENERGYSHIELD,STATE_THUNDERSTORM,
//auras
STATE_MIGHT, STATE_PRAYER, STATE_RESISTFIRE, STATE_HOLYFIRE, STATE_THORNS, STATE_DEFIANCE, STATE_RESISTCOLD, STATE_BLESSEDAIM, STATE_STAMINA, STATE_RESISTLIGHT, STATE_CONCENTRATION, STATE_HOLYWIND, STATE_CLEANSING, STATE_HOLYSHOCK, STATE_SANCTUARY, STATE_MEDITATION, STATE_FANATICISM, STATE_REDEMPTION, STATE_CONVICTION, STATE_RESISTALL,
//debuffs
STATE_AMPLIFYDAMAGE, STATE_WEAKEN, STATE_DECREPIFY, STATE_LOWERRESIST };
//popupPatch->Install();

bhText = new Texthook(OutOfGame, 795, 6, BH_VERSION " (planqi Resurgence/Slash branch)");
bhText->SetAlignment(Right);
bhText->SetColor(Gold);
Expand All @@ -48,19 +54,6 @@ void ScreenInfo::OnLoad() {
automap["LASTXPPERSEC"] = szLastXpPerSec;
automap["LASTGAMETIME"] = szLastGameTime;
automap["SESSIONGAMECOUNT"] = to_string(nTotalGames);

mpqH = D2WIN_LoadMpq(5000, "BH.dll", "buffs.mpq", "buffs", 0, 0);
if (mpqH) {
cf = D2WIN_LoadCellFile("data\\global\\ui\\spells\\buffs24", 0);
//buffs
buffs = { STATE_QUICKNESS,STATE_FADE,STATE_CLOAKED,STATE_VENOMCLAWS,STATE_SHOUT,STATE_BATTLEORDERS,STATE_BATTLECOMMAND,STATE_OAKSAGE,STATE_CYCLONEARMOR,STATE_HURRICANE,STATE_BONEARMOR,STATE_HOLYSHIELD,STATE_FROZENARMOR,STATE_SHIVERARMOR,STATE_CHILLINGARMOR,STATE_ENCHANT,STATE_ENERGYSHIELD,STATE_THUNDERSTORM,
//auras
STATE_MIGHT, STATE_PRAYER, STATE_RESISTFIRE, STATE_HOLYFIRE, STATE_THORNS, STATE_DEFIANCE, STATE_RESISTCOLD, STATE_BLESSEDAIM, STATE_STAMINA, STATE_RESISTLIGHT, STATE_CONCENTRATION, STATE_HOLYWIND, STATE_CLEANSING, STATE_HOLYSHOCK, STATE_SANCTUARY, STATE_MEDITATION, STATE_FANATICISM, STATE_REDEMPTION, STATE_CONVICTION, STATE_RESISTALL,
//debuffs
STATE_AMPLIFYDAMAGE, STATE_WEAKEN, STATE_DECREPIFY, STATE_LOWERRESIST };
manageConv = false;
manageBuffs = true;
}
}

void ScreenInfo::LoadConfig() {
Expand Down Expand Up @@ -116,7 +109,11 @@ void ScreenInfo::OnGameJoin() {
if (!SetWindowText(D2GFX_GetHwnd(), title.c_str())) {
printf("Failed setting window text, error: %d\n\n", GetLastError());
}
}
}
manageConv = false;
manageBuffs = true;
//}
activeBuffs = {};

if (bFailedToWrite) {
bFailedToWrite = false;
Expand Down Expand Up @@ -192,8 +189,7 @@ void ScreenInfo::OnGameJoin() {
}
runs[runname]++;
*/
runcounter[runname]++;
activeBuffs = {};
runcounter[runname]++;

if (!Toggles["Run Details On Join"].state) {
return;
Expand Down Expand Up @@ -316,6 +312,13 @@ void ScreenInfo::OnDraw() {
if (!pData || !quests) {
return;
}
if (mpqH == NULL) {
mpqH = D2WIN_LoadMpq(5000, "BH.dll", "buffs.mpq", "buffs", 0, 0);
}
if (!cellLoaded) {
cf = D2WIN_LoadCellFile("data\\global\\ui\\spells\\buffs24", 0);
cellLoaded = true;
}

ULONGLONG ticks = BHGetTickCount();
ULONGLONG ms = ticks - packetTicks;
Expand Down Expand Up @@ -512,6 +515,13 @@ void ScreenInfo::OnDraw() {

}

void ScreenInfo::OnOOGDraw() {
if (cellLoaded) {
D2WIN_UnloadCellFile(cf);
cellLoaded = false;
}
}

void ScreenInfo::FormattedXPPerSec(char* buffer, double xpPerSec) {
char* unit = "";
if (xpPerSec > 1E9) {
Expand Down
4 changes: 3 additions & 1 deletion BH/Modules/ScreenInfo/ScreenInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class ScreenInfo : public Module {
BOOL manageBuffs;
BOOL manageConv;
int resTracker;
BOOL cellLoaded;
std::vector<Buff> activeBuffs;
std::vector<BYTE> buffs;
public:
Expand All @@ -92,7 +93,7 @@ class ScreenInfo : public Module {
ScreenInfo() :
Module("Screen Info"), warningTicks(BHGetTickCount()), packetRequests(0),
MephistoBlocked(false), DiabloBlocked(false), BaalBlocked(false), ReceivedQuestPacket(false),
startExperience(0), startLevel(0) {};
startExperience(0), startLevel(0), mpqH(NULL), cf(NULL), cellLoaded(false) {};

void OnLoad();
void LoadConfig();
Expand All @@ -103,6 +104,7 @@ class ScreenInfo : public Module {

void OnRightClick(bool up, int x, int y, bool* block);
void OnDraw();
void OnOOGDraw();
void OnAutomapDraw();
void OnGamePacketRecv(BYTE* packet, bool *block);

Expand Down
Binary file modified Release/BH.dll
Binary file not shown.

0 comments on commit 9648d05

Please sign in to comment.