mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 11:34:54 +02:00
fix viplist sort, shared exp blink
This commit is contained in:
@@ -49,6 +49,12 @@ Creature::Creature() : Thing()
|
||||
m_walking = false;
|
||||
m_inverseWalking = true;
|
||||
|
||||
m_skull = Otc::SkullNone;
|
||||
m_shield = Otc::ShieldNone;
|
||||
m_emblem = Otc::EmblemNone;
|
||||
m_shieldBlink = false;
|
||||
m_showShieldTexture = true;
|
||||
|
||||
m_informationFont = g_fonts.getFont("verdana-11px-rounded");
|
||||
}
|
||||
|
||||
@@ -173,7 +179,7 @@ void Creature::drawInformation(int x, int y, bool useGray, const Rect& visibleRe
|
||||
g_painter.setColor(Fw::white);
|
||||
g_painter.drawTexturedRect(Rect(x + 12, y + 5, m_skullTexture->getSize()), m_skullTexture);
|
||||
}
|
||||
if(m_shield != Otc::ShieldNone && m_shieldTexture) {
|
||||
if(m_shield != Otc::ShieldNone && m_shieldTexture && m_showShieldTexture) {
|
||||
g_painter.setColor(Fw::white);
|
||||
g_painter.drawTexturedRect(Rect(x, y + 5, m_shieldTexture->getSize()), m_shieldTexture);
|
||||
}
|
||||
@@ -395,9 +401,19 @@ void Creature::setSkullTexture(const std::string& filename)
|
||||
m_skullTexture = g_textures.getTexture(filename);
|
||||
}
|
||||
|
||||
void Creature::setShieldTexture(const std::string& filename)
|
||||
void Creature::setShieldTexture(const std::string& filename, bool blink)
|
||||
{
|
||||
m_shieldTexture = g_textures.getTexture(filename);
|
||||
m_showShieldTexture = true;
|
||||
|
||||
if(blink && !m_shieldBlink) {
|
||||
auto self = asCreature();
|
||||
g_dispatcher.scheduleEvent([self]() {
|
||||
self->updateShield();
|
||||
}, SHIELD_BLINK_TICKS);
|
||||
}
|
||||
|
||||
m_shieldBlink = blink;
|
||||
}
|
||||
|
||||
void Creature::setEmblemTexture(const std::string& filename)
|
||||
@@ -436,6 +452,20 @@ void Creature::updateAnimation()
|
||||
}
|
||||
}
|
||||
|
||||
void Creature::updateShield()
|
||||
{
|
||||
m_showShieldTexture = !m_showShieldTexture;
|
||||
|
||||
if(m_shield != Otc::ShieldNone && m_shieldBlink) {
|
||||
auto self = asCreature();
|
||||
g_dispatcher.scheduleEvent([self]() {
|
||||
self->updateShield();
|
||||
}, SHIELD_BLINK_TICKS);
|
||||
}
|
||||
else if(!m_shieldBlink)
|
||||
m_showShieldTexture = true;
|
||||
}
|
||||
|
||||
ThingType *Creature::getType()
|
||||
{
|
||||
return g_thingsType.getThingType(m_outfit.getId(), m_outfit.getCategory());
|
||||
|
@@ -31,6 +31,7 @@ class Creature : public Thing
|
||||
{
|
||||
public:
|
||||
enum {
|
||||
SHIELD_BLINK_TICKS = 500,
|
||||
INVISIBLE_TICKS = 500,
|
||||
VOLATILE_SQUARE_DURATION = 1000
|
||||
};
|
||||
@@ -51,7 +52,7 @@ public:
|
||||
void setShield(uint8 shield);
|
||||
void setEmblem(uint8 emblem);
|
||||
void setSkullTexture(const std::string& filename);
|
||||
void setShieldTexture(const std::string& filename);
|
||||
void setShieldTexture(const std::string& filename, bool blink);
|
||||
void setEmblemTexture(const std::string& filename);
|
||||
void setPassable(bool passable) { m_passable = passable; }
|
||||
|
||||
@@ -73,6 +74,7 @@ public:
|
||||
bool getPassable() { return m_passable; }
|
||||
|
||||
void updateAnimation();
|
||||
void updateShield();
|
||||
|
||||
ThingType *getType();
|
||||
|
||||
@@ -98,6 +100,7 @@ protected:
|
||||
uint16 m_speed;
|
||||
uint8 m_skull, m_shield, m_emblem;
|
||||
TexturePtr m_skullTexture, m_shieldTexture, m_emblemTexture;
|
||||
bool m_showShieldTexture, m_shieldBlink;
|
||||
bool m_passable;
|
||||
Color m_volatileSquareColor, m_staticSquareColor;
|
||||
bool m_showVolatileSquare, m_showStaticSquare;
|
||||
|
Reference in New Issue
Block a user