diff --git a/src/otclient/core/item.cpp b/src/otclient/core/item.cpp index d44f53bc..abc0fc77 100644 --- a/src/otclient/core/item.cpp +++ b/src/otclient/core/item.cpp @@ -36,12 +36,7 @@ void Item::draw(int x, int y) { const ThingType& type = g_thingsType.getItemType(m_id); - if(type.animationPhases > 1) { - if(g_platform.getTicks() - m_lastTicks > 500) { - m_animation++; - m_lastTicks = g_platform.getTicks(); - } - } + m_animation = (g_platform.getTicks() % (500 * type.animationPhases)) / 500; /*if(type.group == Otc::ThingSplashGroup || type.group == Otc::ThingFluidGroup) { //xPattern = m_count % type.xPattern; diff --git a/src/otclient/core/thing.cpp b/src/otclient/core/thing.cpp index 5405ae06..6138cb9d 100644 --- a/src/otclient/core/thing.cpp +++ b/src/otclient/core/thing.cpp @@ -32,6 +32,14 @@ Thing::Thing() : m_id(0) m_animation = 0; } +void Thing::setId(uint32 id) +{ + int oldId = m_id; + m_id = id; + + onIdChange(oldId); +} + void Thing::setPosition(const Position& position) { Position oldPosition = m_position; diff --git a/src/otclient/core/thing.h b/src/otclient/core/thing.h index 8da0f1ce..a0396942 100644 --- a/src/otclient/core/thing.h +++ b/src/otclient/core/thing.h @@ -41,7 +41,7 @@ public: virtual void draw(int x, int y) = 0; - void setId(uint32 id) { m_id = id; } + void setId(uint32 id); void setPosition(const Position& position); uint32 getId() const { return m_id; } @@ -49,6 +49,7 @@ public: int getStackPriority(); virtual const ThingType& getType() = 0; + virtual void onIdChange(int) {} virtual void onPositionChange(const Position&) {} ThingPtr asThing() { return std::static_pointer_cast(shared_from_this()); }