Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

cItem Class Reference

Item class. More...

#include <items.h>

Inheritance diagram for cItem:

cObject cContainerItem cWeapon List of all members.

Who is

void Refresh ()
 Refreshes the item.

SI32 getName (char *itemname)
const char * getRealItemName ()
 gets the real name of an item (removing #'s)

AmxEventamxevents [ALLITEMEVENTS]
SI32 hp
 Number of hit points an item has.

SI32 maxhp
 Max number of hit points an item can have.


Look

SI16 animid ()
SI08 isFieldSpellItem ()
LOGICAL IsCorpse ()
LOGICAL IsSpellScroll ()
 predefined spells

LOGICAL IsSpellScroll72 ()
 includes the scrolls with a variable name

LOGICAL IsTree ()
 this is used in AxeTarget()

LOGICAL IsTree2 ()
 this is used in SwordTarget() to give kindling.

LOGICAL IsInstrument ()
LOGICAL IsAxe ()
LOGICAL IsSword ()
LOGICAL IsSwordType ()
LOGICAL IsMace1H ()
LOGICAL IsMace2H ()
LOGICAL IsMaceType ()
LOGICAL IsFencing1H ()
LOGICAL IsFencing2H ()
LOGICAL IsFencingType ()
LOGICAL IsBow ()
LOGICAL IsCrossbow ()
LOGICAL IsHeavyCrossbow ()
LOGICAL IsBowType ()
LOGICAL IsArrow ()
LOGICAL IsBolt ()
LOGICAL IsStave ()
LOGICAL IsSpecialMace ()
LOGICAL IsChaosOrOrderShield ()
LOGICAL IsShield ()
LOGICAL IsLog ()
LOGICAL IsShaft ()
LOGICAL IsBoard ()
LOGICAL IsFeather ()
LOGICAL IsCutLeather ()
LOGICAL IsHide ()
LOGICAL IsBoltOfCloth ()
LOGICAL IsCutCloth ()
LOGICAL IsCloth ()
LOGICAL IsChest ()
LOGICAL IsForge ()
LOGICAL IsAnvil ()
LOGICAL IsCookingPlace ()
LOGICAL IsDagger ()
LOGICAL IsFish ()
LOGICAL IsFishWater ()
LOGICAL IsSign ()
LOGICAL IsBrassSign ()
LOGICAL IsWoodenSign ()
LOGICAL IsGuildSign ()
LOGICAL IsTradeSign ()
LOGICAL IsBankSign ()
LOGICAL IsTheatreSign ()
LOGICAL IsHouse ()
LOGICAL isSpawner ()
 Tells if an item is a dynamic spawner.

void animSetId (SI16 id)
 elcabesa animation

UI08 animid1
 elcabesa animation

UI08 animid2
 elcabesa animation

LOGICAL useAnimId
SI08 layer
 Layer if equipped on paperdoll.

SI08 oldlayer
 Old layer - used for bouncing bugfix - AntiChrist.

SI08 scriptlayer
 Luxor, for scripted setted Layer.

SI08 magic
 0=Default as stored in client, 1=Always movable, 2=Never movable, 3=Owner movable.

SI08 visible
 0=Normally Visible, 1=Owner & GM Visible, 2=GM Visible

SI16 dir

Container

SI32 getContSerial (LOGICAL old=0) const
BYTE getContSerialByte (UI32 nByte, LOGICAL old=false) const
const cObjectgetContainer () const
void setCont (P_OBJECT obj)
void setContSerial (SI32 serial, LOGICAL old=false, LOGICAL update=true)
 set the serial of the item's container

void setContSerialByte (UI32 nByte, BYTE value, LOGICAL old=false)
const LOGICAL isContainer () const
 check if item is a container

const LOGICAL isSecureContainer () const
void SetRandPosInCont (P_ITEM pCont)
bool ContainerPileItem (P_ITEM pItem)
 try to find an item in the container to stack with

LOGICAL AddItem (P_ITEM pItem, short xx=-1, short yy=-1)
 Add item to container.

SI32 DeleteAmountByID (int amount, unsigned int scriptID)
SI16 getContGump ()
void putInto (P_ITEM pi)
SI32 secureIt
Serial contserial
Serial oldcontserial

Amount

SI32 ReduceAmount (const SI16 amount)
SI32 IncreaseAmount (const SI16 amount)
 increase the amount of piled items

void setAmount (const UI16 amt)
 set the amount of piled items

SI32 DeleteAmount (int amount, short id, short color=-1)
 delete a determined amount of an item with determined color

const SI32 CountItems (short ID=-1, short col=-1, LOGICAL bAddAmounts=true) const
const SI32 CountItemsByID (unsigned int scriptID, LOGICAL bAddAmounts) const
const SI32 CountItemsByType (unsigned int type, LOGICAL bAddAmounts) const
UI16 amount
 Amount of items in pile.

UI16 amount2
 Used to track things like number of yards left in a roll of cloth.


Weight

R32 getWeight ()
 the weight of the single item

const R32 getWeightActual ()
UI32 weight

weapon and armour related

weapon, armour, wear related stuff

Author:
Xan & Luxor (mostly)


Skill getCombatSkill ()
 gets the combat skill of an item

UI32 att
 Item attack.

UI32 def
 Item defense.

Skill fightskill
 skill used by item

SI32 reqskill [2]
 required skill by item

DamageType damagetype
 for different damage types system

DamageType auxdamagetype
 Additional damage :].

SI32 auxdamage
 Additional damage :].

SI32 lodamage
 Minimum Damage weapon inflicts.

SI32 hidamage
 Maximum damage weapon inflicts.

SI32 wpsk
 The skill needed to use the item -> Seems not to work for the moment, usless.

SI32 spd
 The speed of the weapon.

SI32 itmhand
 ITEMHAND system - AntiChrist.

SI32 resists [MAX_RESISTANCE_INDEX]
 for resists system

SI32 st
 The strength needed to equip the item.

SI32 st2
 The strength the item gives.

SI32 dx
 The dexterity needed to equip the item.

SI32 dx2
 The dexterity the item gives.

SI32 in
 The intelligence needed to equip the item.

SI32 in2
 The intelligence the item gives.

PoisonType poisoned
 type of poison that poisoned item

UI32 ammo
 Ammo used (firing weapon).

UI32 ammoFx
 Flying ammo animation (firing weapon).


Magic Related

SI32 countSpellsInSpellBook ()
 counts the spells in a spellbook

LOGICAL containsSpell (magic::SpellId spellnumber)
 returns if or not a spellbook contains a spell

UI32 gatetime
SI32 gatenumber
SI08 offspell

Public Methods

cItem & operator= (cItem &b)
 Redefinition of = operator for cItem class.

 cItem (SERIAL serial)
 the weight of the item ( * number of piled item if there are )

 ~cItem ()
void explode (NXWSOCKET s)
const SI32 getSound () const
void setSound (UI16 newSound)
UI32 getType ()
void setType (UI32 newType)
LOGICAL doDecay ()
 execute decay on the item

const LOGICAL canDecay () const
void setDecay (const LOGICAL on=true)
const void setDecayTime (const TIMERVAL delay=uiCurrentTime+((&server_data)->decaytimer *MY_CLOCKS_PER_SEC))
const TIMERVAL getDecayTime () const
const LOGICAL isNewbie () const
void setNewbie (const LOGICAL on=true)
const LOGICAL isDispellable () const
void setDispellable (const LOGICAL on=true)
bool PileItem (P_ITEM pItem)
 Pile two items.

P_ITEM getOutMostCont (short rec=50)
 Get the out most container.

P_CHAR getPackOwner ()
 Get the owner of this pack ( automatic recurse for out most pack ).

UI32 distFrom (P_CHAR pc)
 Get item's distance from the given char.

UI32 distFrom (P_ITEM pi)
 Get item's distance from the given item.

virtual void Delete ()
 deletes the item

Position
const LOGICAL isInWorld () const
void MoveTo (Location newloc)
void MoveTo (SI32 x, SI32 y, SI32 z)
Spawn
void SetMultiSerial (SI32 mulser)

Static Public Methods

void archive ()
void safeoldsave ()

Public Attributes

UI08 more1
UI08 more2
UI08 more3
UI08 more4
SI08 moreb1
SI08 moreb2
SI08 moreb3
SI08 moreb4
UI32 morex
UI32 morey
UI32 morez
SI08 doordir
LOGICAL dooropen
SI32 itemSoundEffect
LOGICAL dye
 Reserved: Can item be dyed by dye kit.

SI08 priv
 Bit 0, decay off/on. Bit 1, newbie item off/on. Bit 2 Dispellable.

LOGICAL pileable
Corpse related
LOGICAL corpse
 Is item a corpse.

string murderer
 char's name who kille the char (forensic ev.)

SI32 murdertime
 when the people has been killed

Creation related
Author:
Magius (CHE)


SI32 smelt
 for item smelting

SI32 rank
 for rank system, this value is the LEVEL of the item from 1 to 10.

std::string creator
 Store the name of the player made this item.

SI32 good
 Store type of GOODs to trade system! (Plz not set as UNSIGNED).

SI32 rndvaluerate
 Store the value calculated base on RANDOMVALUE in region.scp.

SI32 madewith
 Store the skills used to make this item.

std::string vendorDescription
Buy & Sell
SI32 value
 Price shopkeeper sells item at.

SI32 restock
 Number up to which shopkeeper should restock this item.

Trigger
SI32 trigger
 Trigger number that item activates.

SI32 trigtype
 Type of trigger.

SI32 tuses
 Number of uses for trigger.

Special Use
UI32 type
 For things that do special things on doubleclicking.

UI32 type2
SI32 carve
 for new carve system

LOGICAL incognito
 for items under incognito effect

SI32 wipe
 Should this item be wiped with the /wipe command.

UI32 time_unused
 used for house decay and possibly for more in future, gets saved

UI32 timeused_last
 helper attribute for time_unused, doesnt get saved


Private Attributes

TIMERVAL decaytime

Detailed Description

Item class.


Constructor & Destructor Documentation

cItem::cItem SERIAL    ser
 

the weight of the item ( * number of piled item if there are )

Author:
Endymion
Returns:
the weigth actual
Todo:
make return value float

cItem::~cItem  
 


Member Function Documentation

LOGICAL cItem::AddItem P_ITEM    pItem,
short    xx = -1,
short    yy = -1
 

Add item to container.

Author:
Endymion
Parameters:
pItem  the item to add
xx  the x location or INVALID if use rand pos
yy  the y location or INVALID if use rand pos

SI16 cItem::animid   [inline]
 

void cItem::animSetId SI16    id
 

elcabesa animation

Author:
Elcabesa

void cItem::archive   [static]
 

const LOGICAL cItem::canDecay   const [inline]
 

bool cItem::ContainerPileItem P_ITEM    pItem
 

try to find an item in the container to stack with

LOGICAL cItem::containsSpell magic::SpellId    spellnum
 

returns if or not a spellbook contains a spell

Author:
Xanathar
Parameters:
spellnum  spell identifier
Returns:
true if the spell is in the spellbook else false

const SI32 cItem::CountItems short    ID = -1,
short    col = -1,
LOGICAL    bAddAmounts = true
const [inline]
 

const SI32 cItem::CountItemsByID unsigned int    scriptID,
LOGICAL    bAddAmounts
const [inline]
 

const SI32 cItem::CountItemsByType unsigned int    type,
LOGICAL    bAddAmounts
const [inline]
 

int cItem::countSpellsInSpellBook  
 

counts the spells in a spellbook

Author:
AXanathar
Returns:
the number of spells in the spellbook

void cItem::Delete   [virtual]
 

deletes the item

Author:
Luxor
Todo:
backport

Reimplemented from cObject.

int cItem::DeleteAmount int    amount,
short    id,
short    color = -1
 

delete a determined amount of an item with determined color

Author:
Juliunus Recurses through the container given by serial and deletes items of the given id and color (if given) until the given amount is reached

int cItem::DeleteAmountByID int    amount,
unsigned int    scriptID
 

Author:
Anthalir

UI32 cItem::distFrom P_ITEM    pi
 

Get item's distance from the given item.

Author:
Endymion
Returns:
distance ( if invalid is returned VERY_VERY_FAR )
Parameters:
pi  the item
Note:
it check also if is subcontainer, or weared. so np call freely

UI32 cItem::distFrom P_CHAR    pc
 

Get item's distance from the given char.

Author:
Endymion
Returns:
distance ( if invalid is returned VERY_VERY_FAR )
Parameters:
pc  the char
Note:
it check also if is subcontainer, or weared. so np call freely

LOGICAL cItem::doDecay  
 

execute decay on the item

Author:
Luxor
Returns:
true if decayed (so deleted), false else

void cItem::explode NXWSOCKET    s
 

Skill cItem::getCombatSkill  
 

gets the combat skill of an item

Author:
Luxor
Returns:
the combat skill used by the object

const cObject * cItem::getContainer  
 

SI16 cItem::getContGump  
 

SI32 cItem::getContSerial LOGICAL    old = 0 const
 

BYTE cItem::getContSerialByte UI32    nByte,
LOGICAL    old = false
const
 

const TIMERVAL cItem::getDecayTime   const [inline]
 

int cItem::getName char *    itemname
 

Todo:
backport

P_ITEM cItem::getOutMostCont short    rec = 50
 

Get the out most container.

Author:
Endymion
Returns:
outer container
Parameters:
rec  not need to use, only internal for have a max number or recursion
Note:
max recursion = 50

P_CHAR cItem::getPackOwner  
 

Get the owner of this pack ( automatic recurse for out most pack ).

Author:
Endymion
Returns:
pointer to pack owner
Note:
automatic recurse for get out most container

const char * cItem::getRealItemName  
 

gets the real name of an item (removing #'s)

Author:
Xanathar
Returns:
the real name of an item

const SI32 cItem::getSound   const [inline]
 

UI32 cItem::getType   [inline]
 

R32 cItem::getWeight  
 

the weight of the single item

Returns:
the weigth
Note:
May have to seek it from mul files

const R32 cItem::getWeightActual   [inline]
 

SI32 cItem::IncreaseAmount const SI16    amt
 

increase the amount of piled items

Parameters:
amt  amount to add to item amount

bool cItem::IsAnvil  
 

bool cItem::IsArrow  
 

bool cItem::IsAxe  
 

bool cItem::IsBankSign  
 

bool cItem::IsBoard  
 

bool cItem::IsBolt  
 

bool cItem::IsBoltOfCloth  
 

bool cItem::IsBow  
 

bool cItem::IsBowType  
 

bool cItem::IsBrassSign  
 

bool cItem::IsChaosOrOrderShield  
 

bool cItem::IsChest  
 

bool cItem::IsCloth  
 

const LOGICAL cItem::isContainer   const [inline]
 

check if item is a container

bool cItem::IsCookingPlace  
 

bool cItem::IsCorpse  
 

bool cItem::IsCrossbow  
 

bool cItem::IsCutCloth  
 

bool cItem::IsCutLeather  
 

bool cItem::IsDagger  
 

const LOGICAL cItem::isDispellable   const [inline]
 

bool cItem::IsFeather  
 

bool cItem::IsFencing1H  
 

bool cItem::IsFencing2H  
 

bool cItem::IsFencingType  
 

SI08 cItem::isFieldSpellItem  
 

bool cItem::IsFish  
 

bool cItem::IsFishWater  
 

bool cItem::IsForge  
 

bool cItem::IsGuildSign  
 

bool cItem::IsHeavyCrossbow  
 

bool cItem::IsHide  
 

bool cItem::IsHouse  
 

bool cItem::IsInstrument  
 

const LOGICAL cItem::isInWorld   const [inline]
 

bool cItem::IsLog  
 

bool cItem::IsMace1H  
 

bool cItem::IsMace2H  
 

bool cItem::IsMaceType  
 

const LOGICAL cItem::isNewbie   const [inline]
 

const LOGICAL cItem::isSecureContainer   const [inline]
 

bool cItem::IsShaft  
 

bool cItem::IsShield  
 

bool cItem::IsSign  
 

LOGICAL cItem::isSpawner  
 

Tells if an item is a dynamic spawner.

Author:
Luxor

bool cItem::IsSpecialMace  
 

bool cItem::IsSpellScroll  
 

predefined spells

bool cItem::IsSpellScroll72  
 

includes the scrolls with a variable name

bool cItem::IsStave  
 

bool cItem::IsSword  
 

bool cItem::IsSwordType  
 

bool cItem::IsTheatreSign  
 

bool cItem::IsTradeSign  
 

bool cItem::IsTree  
 

this is used in AxeTarget()

bool cItem::IsTree2  
 

this is used in SwordTarget() to give kindling.

bool cItem::IsWoodenSign  
 

void cItem::MoveTo SI32    x,
SI32    y,
SI32    z
[inline]
 

void cItem::MoveTo Location    newloc
 

Author:
Anthalir

cItem & cItem::operator= cItem &    b
 

Redefinition of = operator for cItem class.

Author:
Luxor
Since:
0.82rc3

bool cItem::PileItem P_ITEM    pItem
 

Pile two items.

Author:
Returns:
true if piled, false else
Note:
refresh is done if piled

void cItem::putInto P_ITEM    pi
 

SI32 cItem::ReduceAmount const SI16    amount
 

void cItem::Refresh  
 

Refreshes the item.

Author:
Luxor and AntiChrist

void cItem::safeoldsave   [static]
 

void cItem::setAmount const UI16    amt [inline]
 

set the amount of piled items

void cItem::setCont P_OBJECT    obj [inline]
 

void cItem::setContSerial SI32    serial,
LOGICAL    old = false,
LOGICAL    update = true
 

set the serial of the item's container

Author:
Anthalir
Since:
0.82a
Parameters:
serial  new serial
old  set the saved cont serial or the actual one ?
update  update the container map ?

void cItem::setContSerialByte UI32    nByte,
BYTE    value,
LOGICAL    old = false
 

void cItem::setDecay const LOGICAL    on = true
 

const void cItem::setDecayTime const TIMERVAL    delay = uiCurrentTime+( (&server_data) ->decaytimer*MY_CLOCKS_PER_SEC) [inline]
 

void cItem::setDispellable const LOGICAL    on = true
 

void cItem::SetMultiSerial SI32    mulser
 

void cItem::setNewbie const LOGICAL    on = true
 

void cItem::SetRandPosInCont P_ITEM    pCont
 

void cItem::setSound UI16    newSound [inline]
 

void cItem::setType UI32    newType [inline]
 


Member Data Documentation

UI32 cItem::ammo
 

Ammo used (firing weapon).

UI32 cItem::ammoFx
 

Flying ammo animation (firing weapon).

UI16 cItem::amount
 

Amount of items in pile.

UI16 cItem::amount2
 

Used to track things like number of yards left in a roll of cloth.

AmxEvent* cItem::amxevents[ALLITEMEVENTS]
 

UI08 cItem::animid1
 

elcabesa animation

UI08 cItem::animid2
 

elcabesa animation

UI32 cItem::att
 

Item attack.

SI32 cItem::auxdamage
 

Additional damage :].

DamageType cItem::auxdamagetype
 

Additional damage :].

SI32 cItem::carve
 

for new carve system

Serial cItem::contserial [private]
 

LOGICAL cItem::corpse
 

Is item a corpse.

std::string cItem::creator
 

Store the name of the player made this item.

DamageType cItem::damagetype
 

for different damage types system

TIMERVAL cItem::decaytime [private]
 

UI32 cItem::def
 

Item defense.

SI16 cItem::dir
 

SI08 cItem::doordir
 

LOGICAL cItem::dooropen
 

SI32 cItem::dx
 

The dexterity needed to equip the item.

SI32 cItem::dx2
 

The dexterity the item gives.

LOGICAL cItem::dye
 

Reserved: Can item be dyed by dye kit.

Skill cItem::fightskill
 

skill used by item

SI32 cItem::gatenumber
 

UI32 cItem::gatetime
 

SI32 cItem::good
 

Store type of GOODs to trade system! (Plz not set as UNSIGNED).

SI32 cItem::hidamage
 

Maximum damage weapon inflicts.

SI32 cItem::hp
 

Number of hit points an item has.

SI32 cItem::in
 

The intelligence needed to equip the item.

SI32 cItem::in2
 

The intelligence the item gives.

LOGICAL cItem::incognito
 

for items under incognito effect

SI32 cItem::itemSoundEffect
 

SI32 cItem::itmhand
 

ITEMHAND system - AntiChrist.

SI08 cItem::layer
 

Layer if equipped on paperdoll.

SI32 cItem::lodamage
 

Minimum Damage weapon inflicts.

SI32 cItem::madewith
 

Store the skills used to make this item.

Note by Magius: Value range to -ALLSKILLS-1 to ALLSKILLS+1
To calculate skill used to made this item:
if is a positive value, substract 1 it.
Ex) madewith=34 , 34-1=33 , 33=STEALING
if is a negative value, add 1 from it and invert value.
Ex) madewith=-34 , -34+1=-33 , Abs(-33)=33=STEALING.
0 = NULL

So... a positive value is used when the item is made by a player with 95.0+ at that skill. Infact in this way when you click on the item appear its name and the name of the creator. A Negative value if the player is not enought skilled!

SI08 cItem::magic
 

0=Default as stored in client, 1=Always movable, 2=Never movable, 3=Owner movable.

SI32 cItem::maxhp
 

Max number of hit points an item can have.

UI08 cItem::more1
 

UI08 cItem::more2
 

UI08 cItem::more3
 

UI08 cItem::more4
 

SI08 cItem::moreb1
 

SI08 cItem::moreb2
 

SI08 cItem::moreb3
 

SI08 cItem::moreb4
 

UI32 cItem::morex
 

UI32 cItem::morey
 

UI32 cItem::morez
 

string cItem::murderer
 

char's name who kille the char (forensic ev.)

SI32 cItem::murdertime
 

when the people has been killed

SI08 cItem::offspell
 

Serial cItem::oldcontserial [private]
 

SI08 cItem::oldlayer
 

Old layer - used for bouncing bugfix - AntiChrist.

LOGICAL cItem::pileable
 

PoisonType cItem::poisoned
 

type of poison that poisoned item

SI08 cItem::priv
 

Bit 0, decay off/on. Bit 1, newbie item off/on. Bit 2 Dispellable.

SI32 cItem::rank
 

for rank system, this value is the LEVEL of the item from 1 to 10.

Simply multiply the rank*10 and calculate the MALUS this item has from the original.
for example: RANK 5 ---> 5*10=50% of malus
this item has same values decreased by 50%..
RANK 1 ---> 1*10=10% this item has 90% of malus!
RANK 10 --> 10*10=100% this item has no malus! RANK 10 is automatically setted if you select RANKSYSTEM 0.
Vars: LODAMAGE,HIDAMAGE,ATT,DEF,HP,MAXHP

SI32 cItem::reqskill[2]
 

required skill by item

SI32 cItem::resists[MAX_RESISTANCE_INDEX]
 

for resists system

SI32 cItem::restock
 

Number up to which shopkeeper should restock this item.

SI32 cItem::rndvaluerate
 

Store the value calculated base on RANDOMVALUE in region.scp.

SI08 cItem::scriptlayer
 

Luxor, for scripted setted Layer.

SI32 cItem::secureIt
 

SI32 cItem::smelt
 

for item smelting

SI32 cItem::spd
 

The speed of the weapon.

SI32 cItem::st
 

The strength needed to equip the item.

SI32 cItem::st2
 

The strength the item gives.

UI32 cItem::time_unused
 

used for house decay and possibly for more in future, gets saved

UI32 cItem::timeused_last
 

helper attribute for time_unused, doesnt get saved

SI32 cItem::trigger
 

Trigger number that item activates.

SI32 cItem::trigtype
 

Type of trigger.

SI32 cItem::tuses
 

Number of uses for trigger.

UI32 cItem::type
 

For things that do special things on doubleclicking.

UI32 cItem::type2
 

LOGICAL cItem::useAnimId
 

SI32 cItem::value
 

Price shopkeeper sells item at.

std::string cItem::vendorDescription
 

SI08 cItem::visible
 

0=Normally Visible, 1=Owner & GM Visible, 2=GM Visible

UI32 cItem::weight
 

SI32 cItem::wipe
 

Should this item be wiped with the /wipe command.

SI32 cItem::wpsk
 

The skill needed to use the item -> Seems not to work for the moment, usless.


The documentation for this class was generated from the following files: SourceForge.net Logo