tibia-client/src/otclient/core/thing.h

46 lines
1.2 KiB
C
Raw Normal View History

2011-08-15 16:11:24 +02:00
#ifndef THING_H
#define THING_H
#include "declarations.h"
2011-08-15 23:02:52 +02:00
#include "thingattributes.h"
#include <framework/luascript/luaobject.h>
2011-08-15 16:11:24 +02:00
struct Light
{
uint8 intensity;
uint8 color;
};
2011-08-15 23:02:52 +02:00
class Thing : public LuaObject
2011-08-15 16:11:24 +02:00
{
public:
2011-08-16 02:30:31 +02:00
Thing(ThingType type);
2011-08-15 23:02:52 +02:00
virtual ~Thing() { }
2011-08-15 16:11:24 +02:00
2011-08-15 23:02:52 +02:00
virtual void draw(int x, int y) = 0;
2011-08-15 16:11:24 +02:00
void setId(uint32 id) { m_id = id; }
void setPosition(const Position& position) { m_position = position; }
2011-08-15 23:02:52 +02:00
uint32 getId() const { return m_id; }
ThingType getType() const { return m_type; }
Position getPosition() const { return m_position; }
2011-08-15 21:15:49 +02:00
virtual const ThingAttributes& getAttributes() = 0;
2011-08-15 16:11:24 +02:00
2011-08-15 23:02:52 +02:00
ThingPtr asThing() { return std::static_pointer_cast<Thing>(shared_from_this()); }
virtual ItemPtr asItem() { return nullptr; }
virtual CreaturePtr asCreature() { return nullptr; }
virtual EffectPtr asEffect() { return nullptr; }
virtual PlayerPtr asPlayer() { return nullptr; }
virtual LocalPlayerPtr asLocalPlayer() { return nullptr; }
2011-08-15 16:11:24 +02:00
protected:
void internalDraw(int x, int y, int blendframes, int xdiv, int ydiv, int zdiv, int anim);
uint32 m_id;
2011-08-15 23:02:52 +02:00
ThingType m_type;
2011-08-15 16:11:24 +02:00
Position m_position;
};
2011-08-15 21:15:49 +02:00
#endif