• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[solved]How to change otclient manabar color from blue to purple?

Felipe93

Ghost Member
Joined
Mar 21, 2015
Messages
1,990
Solutions
9
Reaction score
334
Location
Chile
Hello otlanders i have this question

i want to know how to change manabar color from blue to purple
i was checking some website to know about colors
but this numbers (supposed to be blue)
C++:
fillColor = Color(0x66, 0xcc, 0xff);
doesnt match with the ones that i saw on website someone could tell me how i should do this please?


C++:
   // 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::DrawManaBar && isLocalPlayer()) {
            LocalPlayerPtr player = g_game.getLocalPlayer();
            if(player) {
                backgroundRect.moveTop(backgroundRect.bottom());

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

                Rect manaRect = backgroundRect.expanded(-1);
                double maxMana = player->getMaxMana();
                if(maxMana == 0) {
                    manaRect.setWidth(25);
                } else {
                    manaRect.setWidth(player->getMana() / (maxMana * 1.0) * 25);
                }

                g_painter->setColor(Color::blue);
                g_painter->drawFilledRect(manaRect);
            }
        }
    }

thanks by advance
 
write this, any change?
C++:
  fillColor = Color(0xff, 0x00, 0x00)
if up some change we'll be search correct Color ()


On line 28, rewrite blue -> "purple"
 
Hello Felipe93,

let me break this for you quickly so you can understand better how it works:

This will draw the black retangle where your mana bar will be drawn upon:
C++:
g_painter->setColor(Color::black);
g_painter->drawFilledRect(backgroundRect);

This will draw the manabar inside of the black retangle:
C++:
g_painter->setColor(Color::blue);
g_painter->drawFilledRect(manaRect);

Where are these colors coming from? OTClient uses a color "library", you can find it in its sources under the names color.h and color.cpp.

Inside color.h you have some defined colors:
C++:
static const Color alpha;
static const Color white;
static const Color black;
static const Color red;
static const Color darkRed;
static const Color green;
static const Color darkGreen;
static const Color blue;
static const Color darkBlue;
static const Color pink;
static const Color darkPink;
static const Color yellow;
static const Color darkYellow;
static const Color teal;
static const Color darkTeal;
static const Color gray;
static const Color darkGray;
static const Color lightGray;
static const Color orange;

You can use any of those to set a color to the retangle which is then drawn inside of the black one.

inside color.cpp you can see that the colors are defined in this scheme: "AABBGGRR order"
C++:
const Color Color::alpha      = 0x00000000U;
const Color Color::white      = 0xffffffff;
const Color Color::black      = 0xff000000;
const Color Color::red        = 0xff0000ff;
const Color Color::darkRed    = 0xff000080;
const Color Color::green      = 0xff00ff00;
const Color Color::darkGreen  = 0xff008000;
const Color Color::blue       = 0xffff0000;
const Color Color::darkBlue   = 0xff800000;
const Color Color::pink       = 0xffff00ff;
const Color Color::darkPink   = 0xff800080;
const Color Color::yellow     = 0xff00ffff;
const Color Color::darkYellow = 0xff008080;
const Color Color::teal       = 0xffffff00;
const Color Color::darkTeal   = 0xff808000;
const Color Color::gray       = 0xffa0a0a0;
const Color Color::darkGray   = 0xff808080;
const Color Color::lightGray  = 0xffc0c0c0;
const Color Color::orange     = 0xff008cff;

If you want to create a new color, for example Purple, declare it in the color.h file and use any color picker to get the hex color of Purple then place it inside color.cpp just like the codes above (note: the order for it is AABBGGRR - Alpha, Blue, Green and Red). - A good purple color would be: 0xff5703c4.

Once you're good with that just go back to the code that draws the blue rectangle over the black one and replace it for
C++:
g_painter->setColor(Color::purple);
g_painter->drawFilledRect(manaRect);


I hope to have helped you and others.

Best Wishes and Kindest Regards,
Okke
 
Last edited:
Thank you a lot, i gonna recompile

it wasnt the color that i expected XD but it worked now i have to make some research

thanks a lot @Okke

38zSjf3.png
 
Last edited by a moderator:
Hello Felipe93,

glad I could help out! Please mark my post as solution so we can make other peoples life easier when searching for this kind of material.

Best Wishes,
Okke
 
Hello Felipe93,

glad I could help out! Please mark my post as solution so we can make other peoples life easier when searching for this kind of material.

Best Wishes,
Okke
I don't know why the optión best answer doesn't appear here i think that opción is only aviable atte support section and o usted otclient section :(
 
Back
Top