Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enchants #12

Merged
merged 5 commits into from
Nov 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions BH/Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,22 @@ enum TextColor {
#define STAT_PASSIVEMAGICDMGMASTERY 357
#define STAT_PASSIVEMAGICRESREDUC 358

///////////////////////////////////////////////////
// Unit Enchantments
///////////////////////////////////////////////////
#define ENCH_EXTRA_STRONG 5
#define ENCH_EXTRA_FAST 6
#define ENCH_CURSED 7
#define ENCH_MAGIC_RESISTANT 8
#define ENCH_FIRE_ENCHANTED 9
#define ENCH_LIGHTNING_ENCHANTED 17
#define ENCH_COLD_ENCHANTED 18
#define ENCH_MANA_BURN 25
#define ENCH_TELEPORTATION 26
#define ENCH_SPECTRAL_HIT 27
#define ENCH_STONE_SKIN 28
#define ENCH_MULTIPLE_SHOTS 29

///////////////////////////////////////////////////
// Skill Tab Definitions
// (for GetUnitStat with STAT_SKILLTAB)
Expand Down
25 changes: 24 additions & 1 deletion BH/Modules/Maphack/Maphack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ void Maphack::ReadConfig() {
BH::config->ReadToggle("Remove Shake", "None", false, Toggles["Remove Shake"]);
BH::config->ReadToggle("Display Level Names", "None", true, Toggles["Display Level Names"]);
BH::config->ReadToggle("Monster Resistances", "None", true, Toggles["Monster Resistances"]);
BH::config->ReadToggle("Monster Enchantments", "None", true, Toggles["Monster Enchantments"]);

BH::config->ReadInt("Minimap Max Ghost", automapDraw.maxGhost);
}
Expand Down Expand Up @@ -193,6 +194,9 @@ void Maphack::OnLoad() {

new Checkhook(settingsTab, 4, (Y += 15), &Toggles["Monster Resistances"].state, "Monster Resistances");
new Keyhook(settingsTab, 130, (Y + 2), &Toggles["Monster Resistances"].toggle, "");

new Checkhook(settingsTab, 4, (Y += 15), &Toggles["Monster Enchantments"].state, "Monster Enchantments");
new Keyhook(settingsTab, 130, (Y + 2), &Toggles["Monster Enchantments"].toggle, "");

new Checkhook(settingsTab, 4, (Y += 15), &Toggles["Display Level Names"].state, "Level Names");
new Keyhook(settingsTab, 130, (Y + 2), &Toggles["Display Level Names"].toggle, "");
Expand Down Expand Up @@ -370,14 +374,33 @@ void Maphack::OnAutomapDraw() {
immunityText += szResistances[n];
}
}

//Determine Enchantments
string enchantText;
if (unit->pMonsterData->fBoss && Toggles["Monster Enchantments"].state) {
string szEnchantments[] = {"�c3m", "�c1e", "�c9e", "�c3e"};

for (int n = 0; n < 9; n++) {
if (unit->pMonsterData->anEnchants[n] == ENCH_MANA_BURN)
enchantText += szEnchantments[0];
if (unit->pMonsterData->anEnchants[n] == ENCH_FIRE_ENCHANTED)
enchantText += szEnchantments[1];
if (unit->pMonsterData->anEnchants[n] == ENCH_LIGHTNING_ENCHANTED)
enchantText += szEnchantments[2];
if (unit->pMonsterData->anEnchants[n] == ENCH_COLD_ENCHANTED)
enchantText += szEnchantments[3];
}
}

xPos = unit->pPath->xPos;
yPos = unit->pPath->yPos;
automapBuffer.push([immunityText, color, xPos, yPos, lineColor, MyPos]()->void{
automapBuffer.push([immunityText, enchantText, color, xPos, yPos, lineColor, MyPos]()->void{
POINT automapLoc;
Drawing::Hook::ScreenToAutomap(&automapLoc, xPos, yPos);
if (immunityText.length() > 0)
Drawing::Texthook::Draw(automapLoc.x, automapLoc.y - 8, Drawing::Center, 6, White, immunityText);
if (enchantText.length() > 0)
Drawing::Texthook::Draw(automapLoc.x, automapLoc.y - 14, Drawing::Center, 6, White, enchantText);
Drawing::Crosshook::Draw(automapLoc.x, automapLoc.y, color);
if (lineColor != -1) {
Drawing::Linehook::Draw(MyPos.x, MyPos.y, automapLoc.x, automapLoc.y, lineColor);
Expand Down