143 lines
6.9 KiB
C++
143 lines
6.9 KiB
C++
/*
|
|
* Copyright (c) 2010-2012 OTClient <https://github.com/edubart/otclient>
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
* in the Software without restriction, including without limitation the rights
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
* furnished to do so, subject to the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice shall be included in
|
|
* all copies or substantial portions of the Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
* THE SOFTWARE.
|
|
*/
|
|
|
|
#ifndef THING_H
|
|
#define THING_H
|
|
|
|
#include "declarations.h"
|
|
#include "thingtype.h"
|
|
#include "thingtypemanager.h"
|
|
#include <framework/luaengine/luaobject.h>
|
|
|
|
// @bindclass
|
|
#pragma pack(push,1) // disable memory alignment
|
|
class Thing : public LuaObject
|
|
{
|
|
public:
|
|
Thing();
|
|
virtual ~Thing() { }
|
|
|
|
virtual void startAnimation() { }
|
|
virtual void draw(const Point& dest, float scaleFactor, bool animate) { }
|
|
|
|
virtual void setId(uint32 id) { }
|
|
void setPosition(const Position& position) { m_position = position; }
|
|
|
|
virtual uint32 getId() { return 0; }
|
|
Position getPosition() { return m_position; }
|
|
int getStackPriority();
|
|
const TilePtr& getTile();
|
|
ContainerPtr getParentContainer();
|
|
int getStackpos();
|
|
|
|
ThingPtr asThing() { return std::static_pointer_cast<Thing>(shared_from_this()); }
|
|
virtual ItemPtr asItem() { return nullptr; }
|
|
virtual EffectPtr asEffect() { return nullptr; }
|
|
virtual MissilePtr asMissile() { return nullptr; }
|
|
virtual CreaturePtr asCreature() { return nullptr; }
|
|
virtual NpcPtr asNpc() { return nullptr; }
|
|
virtual MonsterPtr asMonster() { return nullptr; }
|
|
virtual PlayerPtr asPlayer() { return nullptr; }
|
|
virtual LocalPlayerPtr asLocalPlayer() { return nullptr; }
|
|
virtual AnimatedTextPtr asAnimatedText() { return nullptr; }
|
|
virtual StaticTextPtr asStaticText() { return nullptr; }
|
|
|
|
virtual bool isItem() { return false; }
|
|
virtual bool isEffect() { return false; }
|
|
virtual bool isMissile() { return false; }
|
|
virtual bool isCreature() { return false; }
|
|
virtual bool isNpc() { return false; }
|
|
virtual bool isMonster() { return false; }
|
|
virtual bool isPlayer() { return false; }
|
|
virtual bool isLocalPlayer() { return false; }
|
|
virtual bool isAnimatedText() { return false; }
|
|
virtual bool isStaticText() { return false; }
|
|
|
|
// type shortcuts
|
|
virtual const ThingTypePtr& getThingType();
|
|
virtual ThingType *rawGetThingType();
|
|
Size getSize() { return rawGetThingType()->getSize(); }
|
|
int getWidth() { return rawGetThingType()->getWidth(); }
|
|
int getHeight() { return rawGetThingType()->getHeight(); }
|
|
Point getDisplacement() { return rawGetThingType()->getDisplacement(); }
|
|
int getDisplacementX() { return rawGetThingType()->getDisplacementX(); }
|
|
int getDisplacementY() { return rawGetThingType()->getDisplacementY(); }
|
|
int getExactSize() { return rawGetThingType()->getExactSize(); }
|
|
int getLayers() { return rawGetThingType()->getLayers(); }
|
|
int getNumPatternX() { return rawGetThingType()->getNumPatternX(); }
|
|
int getNumPatternY() { return rawGetThingType()->getNumPatternY(); }
|
|
int getNumPatternZ() { return rawGetThingType()->getNumPatternZ(); }
|
|
int getAnimationPhases() { return rawGetThingType()->getAnimationPhases(); }
|
|
int getGroundSpeed() { return rawGetThingType()->getGroundSpeed(); }
|
|
int getMaxTextLength() { return rawGetThingType()->getMaxTextLength(); }
|
|
Light getLight() { return rawGetThingType()->getLight(); }
|
|
int getMinimapColor() { return rawGetThingType()->getMinimapColor(); }
|
|
int getLensHelp() { return rawGetThingType()->getLensHelp(); }
|
|
int getClothSlot() { return rawGetThingType()->getClothSlot(); }
|
|
int getElevation() { return rawGetThingType()->getElevation(); }
|
|
bool isGround() { return rawGetThingType()->isGround(); }
|
|
bool isGroundBorder() { return rawGetThingType()->isGroundBorder(); }
|
|
bool isOnBottom() { return rawGetThingType()->isOnBottom(); }
|
|
bool isOnTop() { return rawGetThingType()->isOnTop(); }
|
|
bool isContainer() { return rawGetThingType()->isContainer(); }
|
|
bool isStackable() { return rawGetThingType()->isStackable(); }
|
|
bool isForceUse() { return rawGetThingType()->isForceUse(); }
|
|
bool isMultiUse() { return rawGetThingType()->isMultiUse(); }
|
|
bool isWritable() { return rawGetThingType()->isWritable(); }
|
|
bool isChargeable() { return rawGetThingType()->isChargeable(); }
|
|
bool isWritableOnce() { return rawGetThingType()->isWritableOnce(); }
|
|
bool isFluidContainer() { return rawGetThingType()->isFluidContainer(); }
|
|
bool isSplash() { return rawGetThingType()->isSplash(); }
|
|
bool isNotWalkable() { return rawGetThingType()->isNotWalkable(); }
|
|
bool isNotMoveable() { return rawGetThingType()->isNotMoveable(); }
|
|
bool blockProjectile() { return rawGetThingType()->blockProjectile(); }
|
|
bool isNotPathable() { return rawGetThingType()->isNotPathable(); }
|
|
bool isPickupable() { return rawGetThingType()->isPickupable(); }
|
|
bool isHangable() { return rawGetThingType()->isHangable(); }
|
|
bool isHookSouth() { return rawGetThingType()->isHookSouth(); }
|
|
bool isHookEast() { return rawGetThingType()->isHookEast(); }
|
|
bool isRotateable() { return rawGetThingType()->isRotateable(); }
|
|
bool hasLight() { return rawGetThingType()->hasLight(); }
|
|
bool isDontHide() { return rawGetThingType()->isDontHide(); }
|
|
bool isTranslucent() { return rawGetThingType()->isTranslucent(); }
|
|
bool hasDisplacement() { return rawGetThingType()->hasDisplacement(); }
|
|
bool hasElevation() { return rawGetThingType()->hasElevation(); }
|
|
bool isLyingCorpse() { return rawGetThingType()->isLyingCorpse(); }
|
|
bool isAnimateAlways() { return rawGetThingType()->isAnimateAlways(); }
|
|
bool hasMiniMapColor() { return rawGetThingType()->hasMiniMapColor(); }
|
|
bool hasLensHelp() { return rawGetThingType()->hasLensHelp(); }
|
|
bool isFullGround() { return rawGetThingType()->isFullGround(); }
|
|
bool isIgnoreLook() { return rawGetThingType()->isIgnoreLook(); }
|
|
bool isCloth() { return rawGetThingType()->isCloth(); }
|
|
bool isMarketable() { return rawGetThingType()->isMarketable(); }
|
|
MarketData getMarketData() { return rawGetThingType()->getMarketData(); }
|
|
|
|
|
|
protected:
|
|
Position m_position;
|
|
uint16 m_datId;
|
|
};
|
|
#pragma pack(pop)
|
|
|
|
#endif
|
|
|