diff --git a/modules/corelib/ui/uitabbar.lua b/modules/corelib/ui/uitabbar.lua index 1dbe1367..4e191396 100644 --- a/modules/corelib/ui/uitabbar.lua +++ b/modules/corelib/ui/uitabbar.lua @@ -163,6 +163,7 @@ function UITabBar:removeTab(tab) removeEvent(tab.blinkEvent) end tab:destroy() + updateMargins(self) end function UITabBar:getTab(text) diff --git a/modules/gamelib/ui/uicreaturebutton.lua b/modules/gamelib/ui/uicreaturebutton.lua index 4d31da47..1977ef93 100644 --- a/modules/gamelib/ui/uicreaturebutton.lua +++ b/modules/gamelib/ui/uicreaturebutton.lua @@ -11,9 +11,9 @@ local LifeBarColors = {} -- Must be sorted by percentAbove table.insert(LifeBarColors, {percentAbove = 92, color = '#00BC00' } ) table.insert(LifeBarColors, {percentAbove = 60, color = '#50A150' } ) table.insert(LifeBarColors, {percentAbove = 30, color = '#A1A100' } ) -table.insert(LifeBarColors, {percentAbove = 8, color = '#3C2727' } ) -table.insert(LifeBarColors, {percentAbove = 3, color = '#3C0000' } ) -table.insert(LifeBarColors, {percentAbove = -1, color = '#4F0000' } ) +table.insert(LifeBarColors, {percentAbove = 8, color = '#BF0A0A' } ) +table.insert(LifeBarColors, {percentAbove = 3, color = '#910F0F' } ) +table.insert(LifeBarColors, {percentAbove = -1, color = '#850C0C' } ) function UICreatureButton.create() local button = UICreatureButton.internalCreate() diff --git a/src/client/creature.cpp b/src/client/creature.cpp index 5579a7ed..c708a2ac 100644 --- a/src/client/creature.cpp +++ b/src/client/creature.cpp @@ -440,6 +440,11 @@ void Creature::onDisappear() }); } +void Creature::onDeath() +{ + callLuaField("onDeath"); +} + void Creature::updateWalkAnimation(int totalPixelsWalked) { // update outfit animation @@ -599,6 +604,9 @@ void Creature::setHealthPercent(uint8 healthPercent) m_healthPercent = healthPercent; callLuaField("onHealthPercentChange", healthPercent); + + if(healthPercent < 1) + onDeath(); } void Creature::setDirection(Otc::Direction direction) diff --git a/src/client/creature.h b/src/client/creature.h index 752ed770..7084e6cf 100644 --- a/src/client/creature.h +++ b/src/client/creature.h @@ -123,6 +123,7 @@ public: virtual void onPositionChange(const Position& newPos, const Position& oldPos); virtual void onAppear(); virtual void onDisappear(); + virtual void onDeath(); protected: virtual void updateWalkAnimation(int totalPixelsWalked);