Merge pull request #936 from LightPower392/second_fork

Added horizontal healthbars
This commit is contained in:
LightCat 2020-04-19 19:46:31 +02:00 committed by GitHub
commit 3144f5ad73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 112 additions and 17 deletions

View File

@ -1,8 +1,8 @@
<Tab name="ESP" padding="4 4 4 4">
<Box padding="12 6 6 6" width="content" height="content" name="ESP">
<List width="150">
<AutoVariable width="fill" target="esp.enable" label="Enable ESP"/>
<AutoVariable width="fill" target="esp.legit" label="Legit Mode"/>
<AutoVariable width="fill" target="esp.enable" label="Enable ESP" tooltip="Enable Extrasensory Perception"/>
<AutoVariable width="fill" target="esp.legit" label="Legit Mode" tooltip="Dont Show ESP of Enemies Behind Walls"/>
<AutoVariable width="fill" target="esp.range" label="Max Range"/>
<AutoVariable width="fill" target="lightesp.enable" label="Enable Light ESP"/>
</List>
@ -69,7 +69,7 @@
<AutoVariable width="fill" target="esp.expand" label="Expand"/>
<LabeledObject width="fill" label="Text Position">
<Select target="esp.text-position">
<Option name="Top right" value="0"/>
<Option name="Top Right" value="0"/>
<Option name="Bottom Right" value="1"/>
<Option name="Center" value="2"/>
<Option name="Above" value="3"/>
@ -87,15 +87,15 @@
<Select target="esp.tracers-mode">
<Option name="Off" value="0"/>
<Option name="Center" value="1"/>
<Option name="bottom" value="2"/>
<Option name="Bottom" value="2"/>
</Select>
</LabeledObject>
<LabeledObject width="fill" label="Health Mode">
<Select target="esp.health-mode">
<LabeledObject width="fill" label="Health Mode" tooltip="Sets the Healthbar Mode">
<Select target="esp.health-bar">
<Option name="None" value="0"/>
<Option name="Text" value="1"/>
<Option name="Healthbar" value="2"/>
<Option name="Both" value="3"/>
<Option name="Top Horizontal" value="1"/>
<Option name="Bottom Horizontal" value="2"/>
<Option name="Vertical" value="3"/>
</Select>
</LabeledObject>
</List>
@ -103,6 +103,7 @@
<Box padding="12 6 6 6" width="content" height="content" name="Strings" x="340">
<List width="150">
<AutoVariable width="fill" target="esp.info.name" label="Name"/>
<AutoVariable width="fill" target="esp.info.health" label="Health"/>
<AutoVariable width="fill" target="esp.info.distance" label="Distance"/>
<AutoVariable width="fill" target="esp.info.class" label="Class"/>
<AutoVariable width="fill" target="esp.info.conditions" label="Conditions"/>
@ -115,7 +116,7 @@
<AutoVariable width="fill" target="esp.online.software" label="Online: Software"/>
</List>
</Box>
<Box padding="12 6 6 6" width="content" height="content" name="Emoji" x="340" y="140">
<Box padding="12 6 6 6" width="content" height="content" name="Emoji" x="340" y="155">
<List width="150">
<LabeledObject width="fill" label="Mode">
<Select target="esp.emoji.mode">

View File

@ -89,7 +89,7 @@ static void CreateMove()
else
shouldm2 = false;
}
if (!shouldm2 && CE_BYTE(LOCAL_E, netvar.m_bFeignDeathReady))
if (shouldm2 && CE_BYTE(LOCAL_E, netvar.m_bFeignDeathReady))
current_user_cmd->buttons |= IN_ATTACK2;
}
static InitRoutine EC([]() { EC::Register(EC::CreateMove, CreateMove, "AutoDeadringer", EC::average); });

View File

@ -28,7 +28,7 @@ static settings::Int emoji_esp_size{ "esp.emoji.size", "32" };
static settings::Boolean emoji_esp_scaling{ "esp.emoji.scaling", "true" };
static settings::Int emoji_min_size{ "esp.emoji.min-size", "20" };
static settings::Int show_health{ "esp.health-mode", "3" };
static settings::Int healthbar{ "esp.health-bar", "3" };
static settings::Boolean draw_bones{ "esp.bones", "false" };
static settings::Int sightlines{ "esp.sightlines", "0" };
static settings::Int esp_text_position{ "esp.text-position", "0" };
@ -43,6 +43,7 @@ static settings::Boolean tank{ "esp.show.tank", "true" };
static settings::Boolean show_weapon{ "esp.info.weapon", "false" };
static settings::Boolean show_distance{ "esp.info.distance", "true" };
static settings::Boolean show_health{ "esp.info.health", "true" };
static settings::Boolean show_name{ "esp.info.name", "true" };
static settings::Boolean show_class{ "esp.info.class", "true" };
static settings::Boolean show_conditions{ "esp.info.conditions", "true" };
@ -295,7 +296,8 @@ static void cm()
static draw::Texture atlas{ paths::getDataPath("/textures/atlas.png") };
static draw::Texture idspec{ paths::getDataPath("/textures/idspec.png") };
Timer retry{};
void Init()
{
@ -624,8 +626,100 @@ void _FASTCALL ProcessEntityPT(CachedEntity *ent)
}
}
// Healthbar
if ((int) show_health >= 2)
// Top horizontal health bar
if (*healthbar == 1)
{
// We only want health bars on players and buildings
if (type == ENTITY_PLAYER || type == ENTITY_BUILDING)
{
// Get collidable from the cache
if (GetCollide(ent))
{
// Pull the cached collide info
int max_x = ent_data.collide_max.x;
int max_y = ent_data.collide_max.y;
int min_x = ent_data.collide_min.x;
int min_y = ent_data.collide_min.y;
// Get health values
int health = 0;
int healthmax = 0;
switch (type)
{
case ENTITY_PLAYER:
health = g_pPlayerResource->GetHealth(ent);
healthmax = g_pPlayerResource->GetMaxHealth(ent);
break;
case ENTITY_BUILDING:
health = CE_INT(ent, netvar.iBuildingHealth);
healthmax = CE_INT(ent, netvar.iBuildingMaxHealth);
break;
}
// Get Colors
rgba_t hp = colors::Transparent(colors::Health(health, healthmax), fg.a);
rgba_t border = ((classid == RCC_PLAYER) && IsPlayerInvisible(ent)) ? colors::FromRGBA8(160, 160, 160, fg.a * 255.0f) : colors::Transparent(colors::black, fg.a);
// Get bar width
int hbw = (max_x - min_x - 1) * std::min((float) health / (float) healthmax, 1.0f);
// Draw
draw::RectangleOutlined(min_x, min_y - 6, max_x - min_x + 1, 7, border, 0.5f);
draw::Rectangle(min_x + hbw, min_y - 5, -hbw, 5, hp);
}
}
}
// Bottom horizontal health bar
else if (*healthbar == 2)
{
// We only want health bars on players and buildings
if (type == ENTITY_PLAYER || type == ENTITY_BUILDING)
{
// Get collidable from the cache
if (GetCollide(ent))
{
// Pull the cached collide info
int max_x = ent_data.collide_max.x;
int max_y = ent_data.collide_max.y;
int min_x = ent_data.collide_min.x;
int min_y = ent_data.collide_min.y;
// Get health values
int health = 0;
int healthmax = 0;
switch (type)
{
case ENTITY_PLAYER:
health = g_pPlayerResource->GetHealth(ent);
healthmax = g_pPlayerResource->GetMaxHealth(ent);
break;
case ENTITY_BUILDING:
health = CE_INT(ent, netvar.iBuildingHealth);
healthmax = CE_INT(ent, netvar.iBuildingMaxHealth);
break;
}
// Get Colors
rgba_t hp = colors::Transparent(colors::Health(health, healthmax), fg.a);
rgba_t border = ((classid == RCC_PLAYER) && IsPlayerInvisible(ent)) ? colors::FromRGBA8(160, 160, 160, fg.a * 255.0f) : colors::Transparent(colors::black, fg.a);
// Get bar width
int hbw = (max_x - min_x - 1) * std::min((float) health / (float) healthmax, 1.0f);
// Draw
draw::RectangleOutlined(min_x, max_y, max_x - min_x + 1, 7, border, 0.5f);
draw::Rectangle(min_x + hbw, max_y + 1, -hbw, 5, hp);
}
}
}
// Vertical health bar
else if (*healthbar == 3)
{
// We only want health bars on players and buildings
@ -1073,7 +1167,7 @@ void _FASTCALL ProcessEntity(CachedEntity *ent)
}
}
// If text health is true, then add a string with the health
if ((int) show_health == 1 || (int) show_health == 3)
if (show_health)
{
AddEntityString(ent, format(ent->m_iHealth(), '/', ent->m_iMaxHealth(), " HP"), colors::Health(ent->m_iHealth(), ent->m_iMaxHealth()));
}
@ -1150,7 +1244,7 @@ void _FASTCALL ProcessEntity(CachedEntity *ent)
}
#endif
// Health esp
if ((int) show_health == 1 || (int) show_health == 3)
if (show_health)
{
AddEntityString(ent, format(g_pPlayerResource->GetHealth(ent), '/', g_pPlayerResource->GetMaxHealth(ent), " HP"), colors::Health(g_pPlayerResource->GetHealth(ent), g_pPlayerResource->GetMaxHealth(ent)));
}