Otclient  14/8/2020
Item Class Reference

#include <item.h>

Inheritance diagram for Item:
Collaboration diagram for Item:

Public Member Functions

 Item ()
 
virtual ~Item ()
 
void draw (const Point &dest, float scaleFactor, bool animate, LightView *lightView=nullptr)
 
void setId (uint32 id)
 
void setOtbId (uint16 id)
 
void setCountOrSubType (int value)
 
void setCount (int count)
 
void setSubType (int subType)
 
void setColor (const Color &c)
 
int getCountOrSubType ()
 
int getSubType ()
 
int getCount ()
 
uint32 getId ()
 
uint16 getClientId ()
 
uint16 getServerId ()
 
std::string getName ()
 
bool isValid ()
 
void unserializeItem (const BinaryTreePtr &in)
 
void serializeItem (const OutputBinaryTreePtr &out)
 
void setDepotId (uint16 depotId)
 
uint16 getDepotId ()
 
void setDoorId (uint8 doorId)
 
uint8 getDoorId ()
 
uint16 getUniqueId ()
 
uint16 getActionId ()
 
void setActionId (uint16 actionId)
 
void setUniqueId (uint16 uniqueId)
 
std::string getText ()
 
std::string getDescription ()
 
void setDescription (std::string desc)
 
void setText (std::string txt)
 
Position getTeleportDestination ()
 
void setTeleportDestination (const Position &pos)
 
void setAsync (bool enable)
 
bool isHouseDoor ()
 
bool isDepot ()
 
bool isContainer ()
 
bool isDoor ()
 
bool isTeleport ()
 
bool isMoveable ()
 
bool isGround ()
 
ItemPtr clone ()
 
ItemPtr asItem ()
 
bool isItem ()
 
ItemVector getContainerItems ()
 
ItemPtr getContainerItem (int slot)
 
void addContainerItemIndexed (const ItemPtr &i, int slot)
 
void addContainerItem (const ItemPtr &i)
 
void removeContainerItem (int slot)
 
void clearContainerItems ()
 
void calculatePatterns (int &xPattern, int &yPattern, int &zPattern)
 
int calculateAnimationPhase (bool animate)
 
int getExactSize (int layer=0, int xPattern=0, int yPattern=0, int zPattern=0, int animationPhase=0)
 
const ThingTypePtrgetThingType ()
 
ThingTyperawGetThingType ()
 
- Public Member Functions inherited from Thing
 Thing ()
 
virtual ~Thing ()
 
void setPosition (const Position &position)
 
Position getPosition ()
 
int getStackPriority ()
 
const TilePtrgetTile ()
 
ContainerPtr getParentContainer ()
 
int getStackPos ()
 
virtual bool isEffect ()
 
virtual bool isMissile ()
 
virtual bool isCreature ()
 
virtual bool isNpc ()
 
virtual bool isMonster ()
 
virtual bool isPlayer ()
 
virtual bool isLocalPlayer ()
 
virtual bool isAnimatedText ()
 
virtual bool isStaticText ()
 
Size getSize ()
 
int getWidth ()
 
int getHeight ()
 
virtual Point getDisplacement ()
 
virtual int getDisplacementX ()
 
virtual int getDisplacementY ()
 
int getLayers ()
 
int getNumPatternX ()
 
int getNumPatternY ()
 
int getNumPatternZ ()
 
int getAnimationPhases ()
 
AnimatorPtr getAnimator ()
 
int getGroundSpeed ()
 
int getMaxTextLength ()
 
Light getLight ()
 
int getMinimapColor ()
 
int getLensHelp ()
 
int getClothSlot ()
 
int getElevation ()
 
bool isGround ()
 
bool isGroundBorder ()
 
bool isOnBottom ()
 
bool isOnTop ()
 
bool isContainer ()
 
bool isStackable ()
 
bool isForceUse ()
 
bool isMultiUse ()
 
bool isWritable ()
 
bool isChargeable ()
 
bool isWritableOnce ()
 
bool isFluidContainer ()
 
bool isSplash ()
 
bool isNotWalkable ()
 
bool isNotMoveable ()
 
bool blockProjectile ()
 
bool isNotPathable ()
 
bool isPickupable ()
 
bool isHangable ()
 
bool isHookSouth ()
 
bool isHookEast ()
 
bool isRotateable ()
 
bool hasLight ()
 
bool isDontHide ()
 
bool isTranslucent ()
 
bool hasDisplacement ()
 
bool hasElevation ()
 
bool isLyingCorpse ()
 
bool isAnimateAlways ()
 
bool hasMiniMapColor ()
 
bool hasLensHelp ()
 
bool isFullGround ()
 
bool isIgnoreLook ()
 
bool isCloth ()
 
bool isMarketable ()
 
bool isUsable ()
 
bool isWrapable ()
 
bool isUnwrapable ()
 
bool isTopEffect ()
 
MarketData getMarketData ()
 
virtual void onPositionChange (const Position &, const Position &)
 
virtual void onAppear ()
 
virtual void onDisappear ()
 
- Public Member Functions inherited from LuaObject
 LuaObject ()
 
virtual ~LuaObject ()
 
template<typename T >
void connectLuaField (const std::string &field, const std::function< T > &f, bool pushFront=false)
 
template<typename... T>
int luaCallLuaField (const std::string &field, const T &... args)
 
template<typename R , typename... T>
callLuaField (const std::string &field, const T &... args)
 
template<typename... T>
void callLuaField (const std::string &field, const T &... args)
 
bool hasLuaField (const std::string &field)
 Returns true if the lua field exists. More...
 
template<typename T >
void setLuaField (const std::string &key, const T &value)
 Sets a field in this lua object. More...
 
template<typename T >
getLuaField (const std::string &key)
 Gets a field from this lua object. More...
 
void releaseLuaFieldsTable ()
 Release fields table reference. More...
 
void luaSetField (const std::string &key)
 Sets a field from this lua object, the value must be on the stack. More...
 
void luaGetField (const std::string &key)
 Gets a field from this lua object, the result is pushed onto the stack. More...
 
void luaGetMetatable ()
 Get object's metatable. More...
 
void luaGetFieldsTable ()
 Gets the table containing all stored fields of this lua object, the result is pushed onto the stack. More...
 
int getUseCount ()
 
std::string getClassName ()
 Returns the derived class name, its the same name used in Lua. More...
 
LuaObjectPtr asLuaObject ()
 
void operator= (const LuaObject &)
 
- Public Member Functions inherited from stdext::shared_object
 shared_object ()
 
virtual ~shared_object ()
 
void add_ref ()
 
void dec_ref ()
 
refcount_t ref_count ()
 
template<typename T >
stdext::shared_object_ptr< T > static_self_cast ()
 
template<typename T >
stdext::shared_object_ptr< T > dynamic_self_cast ()
 
template<typename T >
stdext::shared_object_ptr< T > const_self_cast ()
 

Static Public Member Functions

static ItemPtr create (int id)
 
static ItemPtr createFromOtb (int id)
 

Additional Inherited Members

- Protected Attributes inherited from Thing
Position m_position
 
uint16 m_datId
 

Detailed Description

Definition at line 76 of file item.h.

Constructor & Destructor Documentation

◆ Item()

Item::Item ( )

Definition at line 40 of file item.cpp.

◆ ~Item()

virtual Item::~Item ( )
inlinevirtual

Definition at line 80 of file item.h.

Member Function Documentation

◆ addContainerItem()

void Item::addContainerItem ( const ItemPtr i)
inline

Definition at line 142 of file item.h.

Here is the caller graph for this function:

◆ addContainerItemIndexed()

void Item::addContainerItemIndexed ( const ItemPtr i,
int  slot 
)
inline

Definition at line 141 of file item.h.

Here is the caller graph for this function:

◆ asItem()

ItemPtr Item::asItem ( )
inline

Definition at line 136 of file item.h.

◆ calculateAnimationPhase()

int Item::calculateAnimationPhase ( bool  animate)

Definition at line 381 of file item.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ calculatePatterns()

void Item::calculatePatterns ( int &  xPattern,
int &  yPattern,
int &  zPattern 
)

Definition at line 273 of file item.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clearContainerItems()

void Item::clearContainerItems ( )
inline

Definition at line 144 of file item.h.

Here is the caller graph for this function:

◆ clone()

ItemPtr Item::clone ( )

Definition at line 266 of file item.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create()

ItemPtr Item::create ( int  id)
static

Definition at line 51 of file item.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ createFromOtb()

ItemPtr Item::createFromOtb ( int  id)
static

Definition at line 58 of file item.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ draw()

void Item::draw ( const Point dest,
float  scaleFactor,
bool  animate,
LightView lightView = nullptr 
)
virtual

Sanity check This is just to ensure that we don't overwrite some color and screw up the whole rendering.

Reimplemented from Thing.

Definition at line 70 of file item.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getActionId()

uint16 Item::getActionId ( )
inline

Definition at line 113 of file item.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getClientId()

uint16 Item::getClientId ( )
inline

Definition at line 98 of file item.h.

◆ getContainerItem()

ItemPtr Item::getContainerItem ( int  slot)
inline

Definition at line 140 of file item.h.

Here is the caller graph for this function:

◆ getContainerItems()

ItemVector Item::getContainerItems ( )
inline

Definition at line 139 of file item.h.

Here is the caller graph for this function:

◆ getCount()

int Item::getCount ( )

Definition at line 249 of file item.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCountOrSubType()

int Item::getCountOrSubType ( )
inline

Definition at line 94 of file item.h.

Here is the caller graph for this function:

◆ getDepotId()

uint16 Item::getDepotId ( )
inline

Definition at line 107 of file item.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDescription()

std::string Item::getDescription ( )
inline

Definition at line 118 of file item.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDoorId()

uint8 Item::getDoorId ( )
inline

Definition at line 110 of file item.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getExactSize()

int Item::getExactSize ( int  layer = 0,
int  xPattern = 0,
int  yPattern = 0,
int  zPattern = 0,
int  animationPhase = 0 
)
virtual

Reimplemented from Thing.

Definition at line 403 of file item.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getId()

uint32 Item::getId ( )
inlinevirtual

Reimplemented from Thing.

Definition at line 97 of file item.h.

Here is the caller graph for this function:

◆ getName()

std::string Item::getName ( )

Definition at line 65 of file item.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getServerId()

uint16 Item::getServerId ( )
inline

Definition at line 99 of file item.h.

Here is the caller graph for this function:

◆ getSubType()

int Item::getSubType ( )

Definition at line 240 of file item.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getTeleportDestination()

Position Item::getTeleportDestination ( )
inline

Definition at line 122 of file item.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getText()

std::string Item::getText ( )
inline

Definition at line 117 of file item.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getThingType()

const ThingTypePtr & Item::getThingType ( )
virtual

Reimplemented from Thing.

Definition at line 410 of file item.cpp.

Here is the call graph for this function:

◆ getUniqueId()

uint16 Item::getUniqueId ( )
inline

Definition at line 112 of file item.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isContainer()

bool Item::isContainer ( )
inline

Definition at line 129 of file item.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isDepot()

bool Item::isDepot ( )
inline

Definition at line 128 of file item.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isDoor()

bool Item::isDoor ( )
inline

Definition at line 130 of file item.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isGround()

bool Item::isGround ( )

Definition at line 261 of file item.cpp.

Here is the call graph for this function:

◆ isHouseDoor()

bool Item::isHouseDoor ( )
inline

Definition at line 127 of file item.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isItem()

bool Item::isItem ( )
inlinevirtual

Reimplemented from Thing.

Definition at line 137 of file item.h.

◆ isMoveable()

bool Item::isMoveable ( )

Definition at line 256 of file item.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isTeleport()

bool Item::isTeleport ( )
inline

Definition at line 131 of file item.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isValid()

bool Item::isValid ( )

Definition at line 114 of file item.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rawGetThingType()

ThingType * Item::rawGetThingType ( )
virtual

Reimplemented from Thing.

Definition at line 415 of file item.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeContainerItem()

void Item::removeContainerItem ( int  slot)
inline

Definition at line 143 of file item.h.

Here is the caller graph for this function:

◆ serializeItem()

void Item::serializeItem ( const OutputBinaryTreePtr out)

Definition at line 185 of file item.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setActionId()

void Item::setActionId ( uint16  actionId)
inline

Definition at line 114 of file item.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setAsync()

void Item::setAsync ( bool  enable)
inline

Definition at line 125 of file item.h.

◆ setColor()

void Item::setColor ( const Color c)
inline

Definition at line 92 of file item.h.

◆ setCount()

void Item::setCount ( int  count)
inline

Definition at line 90 of file item.h.

Here is the caller graph for this function:

◆ setCountOrSubType()

void Item::setCountOrSubType ( int  value)
inline

Definition at line 89 of file item.h.

Here is the caller graph for this function:

◆ setDepotId()

void Item::setDepotId ( uint16  depotId)
inline

Definition at line 106 of file item.h.

Here is the call graph for this function:

◆ setDescription()

void Item::setDescription ( std::string  desc)
inline

Definition at line 119 of file item.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setDoorId()

void Item::setDoorId ( uint8  doorId)
inline

Definition at line 109 of file item.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setId()

void Item::setId ( uint32  id)
virtual

Reimplemented from Thing.

Definition at line 93 of file item.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setOtbId()

void Item::setOtbId ( uint16  id)

Definition at line 101 of file item.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSubType()

void Item::setSubType ( int  subType)
inline

Definition at line 91 of file item.h.

Here is the caller graph for this function:

◆ setTeleportDestination()

void Item::setTeleportDestination ( const Position pos)
inline

Definition at line 123 of file item.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setText()

void Item::setText ( std::string  txt)
inline

Definition at line 120 of file item.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setUniqueId()

void Item::setUniqueId ( uint16  uniqueId)
inline

Definition at line 115 of file item.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ unserializeItem()

void Item::unserializeItem ( const BinaryTreePtr in)

Definition at line 119 of file item.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following files: