RE

Custom Health Bar

Por Refe, 24 de fev. de 2019 em Clients

13
11.2k
RefeR
24 de fevereiro de 2019 às 14:05

8oaCApp.png

XOU0xgx.png

PREVIEW:

image.png

 

CÓDIGO:

Spoiler

Em creature.cpp procure linha:

        g_painter->drawFilledRect(backgroundRect);

Ela vai se encontrar logo depois de:

if(drawFlags & Otc::DrawBars && (!isNpc() || !g_game.getFeature(Otc::GameHideNpcNames))) {

Substitua por:

	TexturePtr m_health_empty_texture = g_textures.getTexture("/images/game/hp");
        g_painter->drawTexturedRect(backgroundRect, m_health_empty_texture);

Logo abaixo tem as seguintes linhas:

 if(drawFlags & Otc::DrawManaBar && isLocalPlayer()) {
            LocalPlayerPtr player = g_game.getLocalPlayer();
            if(player) {
                backgroundRect.moveTop(backgroundRect.bottom());

                g_painter->setColor(Color::black);
                g_painter->drawFilledRect(backgroundRect);

Faça o mesmo na linha igual.

Logo após é só criar uma imagem 27x4 e poe em:

data/images/game/hp.png

Se o seu client não tiver o DrawManaBar, você só faz a primeira parte.

 

CRÉDITOS:

@Refe

Editado Fevereiro 24 por Refe

Ayron5A
24 de fevereiro de 2019 às 14:23
17 minutos atrás, Refe disse:

8oaCApp.png

XOU0xgx.png

 PREVIEW: 

image.png

 

CÓDIGO:

  Ocultar conteúdo

Em creature.cpp procure linha:


        g_painter->drawFilledRect(backgroundRect);

Ela vai se encontrar logo depois de:


if(drawFlags & Otc::DrawBars && (!isNpc() || !g_game.getFeature(Otc::GameHideNpcNames))) {

Substitua por:


	TexturePtr m_health_empty_texture = g_textures.getTexture("/images/game/hp");
        g_painter->drawTexturedRect(backgroundRect, m_health_empty_texture);

Logo abaixo tem as seguintes linhas:


 if(drawFlags & Otc::DrawManaBar && isLocalPlayer()) {
            LocalPlayerPtr player = g_game.getLocalPlayer();
            if(player) {
                backgroundRect.moveTop(backgroundRect.bottom());

                g_painter->setColor(Color::black);
                g_painter->drawFilledRect(backgroundRect);

Faça o mesmo na linha igual.

Logo após é só criar uma imagem 24x4 e poe em:


data/images/game/hp.png

Se o seu client não tiver o DrawManaBar, você só faz a primeira parte.

 

CRÉDITOS:

@Refe

Pode ser maior que 24x4 ? 

RefeR
24 de fevereiro de 2019 às 14:29
5 minutos atrás, Sepulturaa disse:

Pode ser maior que 24x4 ? 

Aí tem que mudar o rect

Ayron5A
24 de fevereiro de 2019 às 14:56
31 minutos atrás, Refe disse:

Aí tem que mudar o rect

blz, pode dizer qual deles? 

 

Mano consegui ^^ 

Spoiler

468572403_EU2.png.524483e4e5dbf05708c1a5907ca06d38.png 851396755_EU3.png.609829fd235530b4773de561d5581187.png 1620219352_EU4.png.93efaa16db81d55258f4d8920abd7318.png

 

 

Editado Fevereiro 24 por Sepulturaa

RefeR
24 de fevereiro de 2019 às 15:04
7 minutos atrás, Sepulturaa disse:

blz, pode dizer qual deles? 

 

Mano consegui ^^ 

  Ocultar conteúdo

468572403_EU2.png.524483e4e5dbf05708c1a5907ca06d38.png 851396755_EU3.png.609829fd235530b4773de561d5581187.png 1620219352_EU4.png.93efaa16db81d55258f4d8920abd7318.png

 

 

Backgroundrect

Ayron5A
24 de fevereiro de 2019 às 15:43
2 minutos atrás, Thalles Vitor disse:

Gente eu tô numa lerdeza, não sei c ta certo

 

Alguem me ajuda

if(drawFlags & Otc::DrawBars && (!isNpc() || !g_game.getFeature(Otc::GameHideNpcNames))) {
        g_painter->setColor(Color::black);
        TexturePtr m_health_empty_texture = g_textures.getTexture("/images/game/hp");
        g_painter->drawTexturedRect(backgroundRect, m_health_empty_texture);

        g_painter->setColor(fillColor);
        g_painter->drawFilledRect(healthRect);
    }

 

Mano, vai estar assim lá na source.

Spoiler
// draw
if(g_game.getFeature(Otc::GameBlueNpcNameColor) && isNpc() && m_healthPercent == 100 && !useGray)
fillColor = Color(0x66, 0xcc, 0xff);
 
if(drawFlags & Otc::DrawBars && (!isNpc() || !g_game.getFeature(Otc::GameHideNpcNames))) {
g_painter->setColor(Color::black);
g_painter->drawFilledRect(backgroundRect);
 
g_painter->setColor(fillColor);
g_painter->drawFilledRect(healthRect);
}

 Aí vc vai procurar por isso 

 

Spoiler
g_painter->drawFilledRect(backgroundRect);

 E substituir ele pra isso 

Spoiler
TexturePtr m_health_empty_texture = g_textures.getTexture("/images/game/hp");
g_painter->drawTexturedRect(backgroundRect, m_health_empty_texture);

Ficando assim...

Spoiler
// draw
if(g_game.getFeature(Otc::GameBlueNpcNameColor) && isNpc() && m_healthPercent == 100 && !useGray)
fillColor = Color(0x66, 0xcc, 0xff);
 
if(drawFlags & Otc::DrawBars && (!isNpc() || !g_game.getFeature(Otc::GameHideNpcNames))) {
g_painter->setColor(Color::black);
TexturePtr m_health_empty_texture = g_textures.getTexture("/images/game/hp");
g_painter->drawTexturedRect(backgroundRect, m_health_empty_texture);
 
g_painter->setColor(fillColor);
g_painter->drawFilledRect(healthRect);
}

Tenta aí ^^ 

Ayron5A
24 de fevereiro de 2019 às 15:53
1 minuto atrás, Thalles Vitor disse:

Como faz pra mudar o tamanho.

Tem que mudar no Backgroundrect

Vou tentar aqui aí te mostro. 

RefeR
24 de fevereiro de 2019 às 15:54
3 minutos atrás, Thalles Vitor disse:

Como faz pra mudar o tamanho.

Só mudar no rect.

21 minutos atrás, Thalles Vitor disse:

Gente eu tô numa lerdeza, não sei c ta certo

 

Alguem me ajuda

if(drawFlags & Otc::DrawBars && (!isNpc() || !g_game.getFeature(Otc::GameHideNpcNames))) {
        g_painter->setColor(Color::black);
        TexturePtr m_health_empty_texture = g_textures.getTexture("/images/game/hp");
        g_painter->drawTexturedRect(backgroundRect, m_health_empty_texture);

        g_painter->setColor(fillColor);
        g_painter->drawFilledRect(healthRect);
    }

 

Você realmente é programador ?

lSaintyL
24 de fevereiro de 2019 às 18:28
2 horas atrás, Thalles Vitor disse:

Sim, porém eu não manjo de C++ nn

Mas a lógica de praticamente toda linguagem é a mesma o.O

Tudo bem não saber desenvolver em C++, mas alterar algumas linhas não tem segredo algum

Ayron5A
26 de fevereiro de 2019 às 22:18
Em 24/02/2019 em 14:05, Refe disse:

8oaCApp.png

XOU0xgx.png

 PREVIEW: 

image.png

 

CÓDIGO:

  Mostrar conteúdo oculto

Em creature.cpp procure linha:


        g_painter->drawFilledRect(backgroundRect);

Ela vai se encontrar logo depois de:


if(drawFlags & Otc::DrawBars && (!isNpc() || !g_game.getFeature(Otc::GameHideNpcNames))) {

Substitua por:


	TexturePtr m_health_empty_texture = g_textures.getTexture("/images/game/hp");
        g_painter->drawTexturedRect(backgroundRect, m_health_empty_texture);

Logo abaixo tem as seguintes linhas:


 if(drawFlags & Otc::DrawManaBar && isLocalPlayer()) {
            LocalPlayerPtr player = g_game.getLocalPlayer();
            if(player) {
                backgroundRect.moveTop(backgroundRect.bottom());

                g_painter->setColor(Color::black);
                g_painter->drawFilledRect(backgroundRect);

Faça o mesmo na linha igual.

Logo após é só criar uma imagem 27x4 e poe em:


data/images/game/hp.png

Se o seu client não tiver o DrawManaBar, você só faz a primeira parte.

 

CRÉDITOS:

@Refe

Tentei deixar um pouco diferente .-.  hehe

 

a.jpg.e7b9afaa999a6f344437b8aa30f41235.jpgaa.jpg.a18d484830a05f3fdcaa02e31aabe787.jpgaaa.jpg.30022ac253cc7bd7c5218a60b733650c.jpg

NdboHakaiN
03 de março de 2019 às 23:53

pena que é só no Otclient

1 ano depois...
SlytherinS
09 de fevereiro de 2021 às 13:36

Aqui não esta indo ? 

 

       // draw
    if(g_game.getFeature(Otc::GameBlueNpcNameColor) && isNpc() && m_healthPercent == 100 && !useGray)
        fillColor = Color(0x66, 0xcc, 0xff);

    if(drawFlags & Otc::DrawBars && (!isNpc() || !g_game.getFeature(Otc::GameHideNpcNames))) {
        g_painter->setColor(Color::black);
        g_painter->drawFilledRect(backgroundRect);

        g_painter->setColor(fillColor);
        g_painter->drawFilledRect(healthRect);
    }

    if(drawFlags & Otc::DrawExperienceBars) {
        if(isLocalPlayer()) {
            Rect expBackgroundRect = Rect(backgroundRect.x(), backgroundRect.y() + 5, 27, 4);
            expBackgroundRect.bind(parentRect);

            Rect expRect = expBackgroundRect.expanded(-1);
            expRect.setWidth((g_game.getLocalPlayer()->getLevelPercent() / 100.0) * 25);

            g_painter->setColor(Color::black);
            g_painter->drawFilledRect(expBackgroundRect);

            g_painter->setColor(Color(0x66, 0xcc, 0xff));
            g_painter->drawFilledRect(expRect);
        }
        else if(isLocalPlayerSummon()) {
            Rect expBackgroundRect = Rect(backgroundRect.x(), backgroundRect.y() + 5, 27, 4);
            expBackgroundRect.bind(parentRect);

            Rect expRect = expBackgroundRect.expanded(-1);
            expRect.setWidth((g_game.getLocalPlayer()->getMagicLevelPercent() / 100.0) * 25);

            g_painter->setColor(Color::black);
            g_painter->drawFilledRect(expBackgroundRect);

            g_painter->setColor(Color(0x66, 0xcc, 0xff));
            g_painter->drawFilledRect(expRect);
        }
    }

1 ano depois...
ZombiTRZ
05 de maio de 2022 às 12:41

Server 10.98 will be ? Someone can be check this files ?

creature.rar