Planeshift
|
This class embodies item instances in the game. More...
#include <psitem.h>
Public Member Functions | |
float | AddDecay (float severityFactor) |
Adjust the item quality by an amount of decay. | |
void | AddLootModifier (uint32_t id, int pos=-1) |
Allows to add a modification to the item. | |
bool | AddModifier (psItemStats *modifier) |
Adds a modifier to this item instance if there is space available. | |
void | AddOpenableLock (uint32 v) |
double | CalcFunction (MathEnvironment *env, const char *functionName, const double *params) |
void | CancelEquipScript () |
bool | CanOpenLock (uint32 id, bool includeSkel) const |
bool | CheckRequirements (psCharacter *character, csString &resp) |
Check to see if the character meets the requirements for this item. | |
bool | CheckStackableWith (const psItem *otheritem, bool precise, bool checkStackCount=true, bool checkWorld=true) const |
Check if otheritem is stackable with this item. | |
void | ClearOpenableLocks () |
void | CombineStack (psItem *&stackme) |
Combines 'stackme' with this item. | |
bool | CompareOpenableLocks (const psItem *key) const |
virtual psItem * | Copy (unsigned short newstackcount) |
Duplicates an item instance. | |
virtual void | Copy (psItem *target) |
Copies values of its attributes to item 'target'. | |
void | CopyOpenableLock (psItem *origKey) |
virtual psItem * | CreateNew () |
Creates a new blank instance of it's class (i.e. | |
bool | DeleteFromDatabase () |
virtual void | DeleteObjectCallback (iDeleteNotificationObject *object) |
Handles deleted gem objects. | |
bool | Destroy () |
Called when an item is completely destroyed from the persistant world. | |
bool | FitsInSlot (INVENTORY_SLOT_NUMBER slot) |
bool | FitsInSlots (PSITEMSTATS_SLOTLIST slotmask) |
void | ForceSaveIfNew () |
Saves this item now if it hasn't been saved before, to force the generation of a UID. | |
PSITEMSTATS_AMMOTYPE | GetAmmoType () |
PSITEMSTATS_ARMORTYPE | GetArmorType () |
float | GetArmorVSWeaponResistance (psItemStats *armor) |
Gets the reduction of this weapon against the armor given. | |
int | GetAttackAnimID (psCharacter *pschar) |
TODO: Comment me with something more than "Gets the attack animation ID". | |
psItemStats * | GetBaseStats () const |
Returns the base stats for this item instance. | |
csString | GetBookText () |
Gets the book text, should only be used if this is a book. | |
bool | GetBuyPersonalise () |
bool | GetCanTransform () |
psItemCategory * | GetCategory () |
int | GetCharges () const |
uint32 | GetContainerID () const |
Returns the item that contains this item, or NULL if it's not contained by another item. | |
unsigned short | GetContainerMaxSize () |
int | GetContainerMaxSlots () |
Gets the slots available in this item (only containers) which means also the maximum amount of items which can be stored in this container. | |
float | GetCounterBlockValue () |
PID | GetCrafterID () const |
Returns the UID for the crafter of this item. Be sure to check GetIsCrafterIDValid()! | |
PSITEMSTATS_CREATIVETYPE | GetCreative () |
const csString & | GetCreativeBackgroundImg () |
return the background image used in this creative. | |
PID | GetCreator (PSITEMSTATS_CREATORSTATUS &creatorStatus) |
Gets the creator of this creative and the creator setting status. | |
psItemStats * | GetCurrentStats () const |
Gets a pointer to the current stats. | |
float | GetDamage (PSITEMSTATS_DAMAGETYPE dmgtype) |
float | GetDamageProtection (PSITEMSTATS_DAMAGETYPE dmgtype) |
float | GetDecay () |
Returns the decay value of the item. See the decay member for a description of what this is. | |
float | GetDecayResistance () |
const char * | GetDescription () const |
Fetch the psitem description if it's not null, otherwise the current_stats description. | |
PSITEM_FLAGS | GetFlags () |
gemItem * | GetGemObject () |
PID | GetGuardingCharacterID () const |
Item guardians: items dropped in the world or placed in a public container are not owned, but "guarded" by a character. | |
unsigned int | GetGuildID () const |
Returns the UID for the guild who has certified this item. Be sure to check GetIsGuildIDValid()! | |
float | GetHardness () |
int | GetIdentifyMinSkill () |
Returns minimum skill level to identify certain examined items. | |
int | GetIdentifySkill () |
Returns skill id of skill needed to identify examined items. | |
const char * | GetImageName () |
Get the Image Name for the item. | |
bool | GetIsAmmo () |
bool | GetIsArmor () |
bool | GetIsAutoTransformContainer () |
bool | GetIsBothHandsWeapon () |
bool | GetIsCD () const |
bool | GetIsConstructible () |
bool | GetIsContainer () |
bool | GetIsCrafterIDValid () |
Returns true if the crafter character ID is valid. | |
bool | GetIsEquipStackable () const |
bool | GetIsGuildIDValid () |
Returns true if the certifying guild ID is valid. | |
bool | GetIsIdentifiable () |
Get the identifiable status of the item. | |
bool | GetIsKey () const |
bool | GetIsLockable () |
bool | GetIsLocked () |
bool | GetIsMasterKey () const |
bool | GetIsMeleeWeapon () |
bool | GetIsNoPickup () |
Gets if the item has a no pickup flag set. | |
bool | GetIsNoPickupStrong () |
Checks if the item has a strong no pickup flag set. | |
bool | GetIsNoPickupWeak () |
Checks if the item has a weak no pickup flag set. | |
bool | GetIsNpcOwned () const |
bool | GetIsRangeWeapon () |
bool | GetIsReadable () |
Checks the readable flag in the item_stats and tell if this is the case. | |
bool | GetIsSecurityLocked () |
bool | GetIsSettingItem () const |
bool | GetIsShield () |
bool | GetIsSkeleton () |
bool | GetIsStackable () const |
bool | GetIsTrap () |
bool | GetIsUnique () const |
Returns true if this item is based off of unique statistics. | |
bool | GetIsUnpickable () |
bool | GetIsWriteable () |
Checks the writeable flag in the item_stats and tell if this is the case. | |
csString | GetItemCommand () |
returns the special command assigned to this item | |
float | GetItemDecayRate () |
Get the item decay factor. | |
float | GetItemQuality () const |
Gets the quality of the item. | |
float | GetItemSize () |
virtual const char * | GetItemType () |
Return a string identifying this object as an Item. | |
float | GetLatency () |
const csString & | GetLiteratureText (void) |
return creative contents of books. | |
void | GetLocationInWorld (InstanceID &instance, psSectorInfo **sectorinfo, float &loc_x, float &loc_y, float &loc_z, float &loc_yrot) const |
INVENTORY_SLOT_NUMBER | GetLocInParent (bool adjustSlot=false) |
Returns the location of this item in its parent item or in the player's equipment, bulk or bank as appropriate. | |
PSSKILL | GetLockpickSkill () |
unsigned int | GetLockStrength () |
int | GetMaxCharges () const |
float | GetMaxItemQuality () const |
Gets the maximum possible quality of the item by reading the item_stat. | |
const char * | GetMeshName () |
Get the Mesh Name for the item. | |
psItemStats * | GetModifier (int index) |
Returns the modifier at a specific index 0 through PSITEM_MAX_MODIFIERS-1. | |
const char * | GetModifiersDescription () |
If an overlay is set return it's script description, otherwise return the. | |
const csString & | GetMusicalSheet (void) |
return creative contents of musical sheets. | |
const char * | GetName () const |
csString | GetOpenableLockNames () |
psCharacter * | GetOwningCharacter () |
Returns a pointer to the character who is holding this item directly or indirectly (including containers and bank slots) or NULL if none. | |
PID | GetOwningCharacterID () const |
Get the ID of the owning character. | |
const char * | GetPartMeshName () |
Get the Part Mesh Name for the item. | |
const char * | GetPartName () |
Get the Part Name for the item. | |
float | GetPenetration () |
psMoney | GetPrice () |
double | GetProperty (MathEnvironment *env, const char *ptr) |
This is used by the math scripting engine to get various values. | |
virtual int | GetPurifyStatus () const |
const char * | GetQualityString () |
Returns a description of the quality level of item. | |
csString | GetQuantityName () |
float | GetRange () const |
float | GetRarity () |
return Rarity as 0-100% range | |
csString | GetRarityName () |
return Rarity description. example: "rare (0.7%)" | |
int | GetRequiredRepairTool () |
Returns item_stats id of repair tool required to fix this item, or 0. | |
bool | GetRequiredRepairToolConsumed () |
Returns the is_consumed flag of repair tool required to fix this item. | |
void | GetRotationInWorld (float &loc_xrot, float &loc_yrot, float &loc_zrot) |
Get the x,y and z axis rotations for the item. | |
psScheduledItem * | GetScheduledItem () |
psSectorInfo * | GetSector () const |
psMoney | GetSellPrice () |
Merchants want a percentage. | |
const csString & | GetSketch (void) |
return creative contents of sketches. | |
csString | GetSlotRemovedMesh (int slot, csString meshName="") |
Proxies the same function in psitemstats which gets the list of mesh to remove when this item is equipped in the specified slot. | |
const char * | GetSound () |
unsigned short | GetStackCount () const |
Returns the stack count. Be sure to call GetIsStackable() first! | |
const char * | GetStandardDescription () |
const char * | GetStandardName () |
float | GetTargetedBlockValue () |
const char * | GetTextureName () |
Get the Texture Name for the item. | |
float | GetTotalStackSize () |
Gets the total size of the items in the stack. | |
psWorkGameEvent * | GetTransformationEvent () |
uint32 | GetUID () |
Returns the UID of this item instance. | |
float | GetUntargetedBlockValue () |
bool | GetUsesAmmo () |
PSITEMSTATS_SLOTLIST | GetValidSlots () |
float | GetVisibleDistance () |
float | GetWeaponAttributeBonus (PSITEMSTATS_STAT stat) |
float | GetWeaponAttributeBonusMax (int index) |
PSITEMSTATS_STAT | GetWeaponAttributeBonusType (int index) |
PSSKILL | GetWeaponSkill (PSITEMSTATS_WEAPONSKILL_INDEX index) |
psWeaponType * | GetWeaponType () |
float | GetWeight () |
void | GetXZRotationInWorld (float &loc_xrot, float &loc_zrot) |
Get the x and z axis rotations for the item (y obtained in GetLocationInWorld) | |
bool | HasCharges () const |
bool | HasModifier (psItemStats *modifier) |
Returns true if this item has this modifier in its modifier list. | |
bool | IsActive () const |
bool | IsEquipped () const |
bool | IsInUse () |
bool | IsRechargeable () const |
bool | IsThisTheCreator (PID pid) |
Checks if the creator of the book is the one passed as argument. | |
bool | IsTransient () |
virtual bool | Load (iResultRow &row) |
Loads data from a database row into the current psItem. | |
void | MakeSkeleton (bool b) |
void | operator delete (void *) |
The delete operator is overriden to call PoolAllocator template functions. | |
void * | operator new (size_t) |
The new operator is overriden to call PoolAllocator template functions. | |
PSITEM_FLAGS | ParseItemFlags (csString flagstr) |
Parses an item flags list and returns the flags. | |
void | PrepareCreativeItemInstance () |
psItem () | |
Constructs a psItem. | |
void | RecalcCurrentStats () |
In some cases some modifiers or effects may be difficult to reverse (for example percent bonuses applied and removed in different orders). | |
void | RemoveOpenableLock (uint32 v) |
void | ResetItemStackable () |
void | RunEquipScript (gemActor *actor) |
void | Save (bool children) |
Queues this item to be saved to the database. | |
void | ScheduleRemoval () |
This function handles creating an event manager event at the right time to get transient objects removed from the world automatically. | |
void | ScheduleRespawn () |
bool | SendActionContents (Client *client, psActionLocation *action) |
bool | SendContainerContents (Client *client, int containerID=CONTAINER_INVENTORY_BULK) |
bool | SendItemDescription (Client *client) |
void | SetActive (bool state) |
void | SetBaseStats (psItemStats *statptr) |
Alters the base stats of this item instance. | |
bool | SetBookText (const csString &newText) |
Sets the book text, should only be used if this is a book. | |
void | SetCharges (int charges) |
void | SetContainerID (uint32 parentId) |
void | SetCrafterID (PID v) |
Sets the UID for the cracter of this item. Generally used immediately after completing the crafting work. | |
bool | SetCreation (PSITEMSTATS_CREATIVETYPE, const csString &, csString) |
Write creative stuff such as lit text (eg book) or map data. | |
void | SetCreator (PID, PSITEMSTATS_CREATORSTATUS) |
sets the creator (i.e. author, artist, etc) of creative things | |
void | SetCurrentStats (psItemStats *statptr) |
Sets the current item stats. | |
void | SetDecay (float v) |
Sets the decay value of the item. See the decay member for a description of what this is. | |
void | SetDecayResistance (float v) |
Set the decay resistance percentage for the item. | |
void | SetDescription (const char *newDescription) |
void | SetFlags (int f) |
void | SetGemObject (gemItem *object) |
void | SetGuardingCharacterID (PID guardian) |
void | SetGuildID (unsigned int v) |
Sets the UID for the guild certifying this item. | |
void | SetInUse (bool flag) |
void | SetIsCD (bool v) |
void | SetIsCrafterIDValid (bool v) |
Set wether the crafter ID is valid. SetCrafterID() sets this to true for you. | |
void | SetIsGuildIDValid (bool v) |
Set wether the guild ID is valid. SetGuildID() sets this to true for you. | |
void | SetIsIdentifiable (bool v) |
Set the Identifiable flag of the item. | |
void | SetIsItemStackable (bool v) |
void | SetIsKey (bool v) |
void | SetIsLockable (bool v) |
void | SetIsLocked (bool v) |
void | SetIsMasterKey (bool v) |
void | SetIsNpcOwned (bool v) |
void | SetIsPickupable (bool v) |
Sets the pickupable flag in order to not allow/allow the item to be picked up. | |
void | SetIsPickupableWeak (bool v) |
Sets the weak pickupable flag in order to not allow/allow the item to be picked up. | |
void | SetIsSecurityLocked (bool v) |
void | SetIsSettingItem (bool v) |
void | SetIsTransient (bool v) |
void | SetIsUnpickable (bool v) |
void | SetItemDecayRate (float v) |
Set the item decay factor. | |
void | SetItemQuality (float v) |
Sets the quality of the item. | |
void | SetLoaded () |
Flags that this item has been fully loaded, and is allowed to be saved on changes. | |
void | SetLocationInWorld (InstanceID instance, psSectorInfo *sectorinfo, float loc_x, float loc_y, float loc_z, float loc_yrot) |
void | SetLocInParent (INVENTORY_SLOT_NUMBER location) |
Please consider using UpdateInventoryStatus() instead. | |
void | SetLockpickSkill (PSSKILL v) |
void | SetLockStrength (unsigned int v) |
void | SetMaxItemQuality (float v) |
Sets the maximum allowed quality of the item by changing the item_stat. | |
bool | SetMusicalSheet (const csString &newMusicalSheet) |
Sets the musical sheet. | |
void | SetName (const char *newName) |
virtual void | SetOwningCharacter (psCharacter *owner) |
Alters the owning character of this item. Also see UpdateInventoryStatus. | |
void | SetRotationInWorld (float loc_xrot, float loc_yrot, float loc_zrot) |
Set the x, y and z axis rotations for the item. | |
void | SetScheduledItem (psScheduledItem *item) |
bool | SetSketch (const csString &newSketchData) |
Sets sketch data. | |
void | SetStackCount (unsigned short v) |
Sets the stack count. | |
void | SetTransformationEvent (psWorkGameEvent *t) |
void | SetUID (uint32 v) |
Sets the Unique ID of this item. | |
void | SetUniqueStats (psItemStats *statptr) |
Used to set the UNIQUE flag in addition to setting base stats pointer TODO: This is pretty much untested at this point. | |
void | SetXZRotationInWorld (float loc_xrot, float loc_zrot) |
Set the x and z axis rotations for the item (y set in SetLocationInWorld) | |
psItem * | SplitStack (unsigned short newstackcount) |
Splits an item instance representing a stack into two smaller stacks. | |
const char * | ToString () |
void | UpdateInventoryStatus (psCharacter *owner, uint32 parent_id, INVENTORY_SLOT_NUMBER slot) |
void | UpdateModifiers () |
Recalculates the modifications for this item. | |
void | UpdateView (Client *fromClient, EID eid, bool clear) |
inform clients on view updates | |
bool | UsesAmmoType (uint32_t id) const |
void | ViewItem (Client *client, int containerID, INVENTORY_SLOT_NUMBER slotID) |
Send an item to the client. | |
virtual | ~psItem () |
Destructs the psItem, and, if this is a container, all contained items. | |
Static Public Member Functions | |
static csString | GetQuantityName (const char *namePtr, int stack_count, PSITEMSTATS_CREATIVETYPE creativeType, bool giveDetail=false) |
Protected Attributes | |
PSITEM_FLAGS | flags |
Flags for this item instance. | |
bool | loaded |
This class embodies item instances in the game.
Every item that can be picked up, dropped, traded, equipped, bought or sold is a psitem.
This class has some specific design philosophy.
First, each item instance has a unique 32 bit identifier. The database ensures that there can be only one entry per item identifier. This means if an item is truly duped it will not persist between world resets since the next load from the database will find only one entry for that item. In order to make this mean anything, certain situations must be carefully coded to avoid bypassing this protection. In any case where 1 item becomes multiple items (such as splitting a stack) the logic should be well defined and located in just one place (preferably within the psItem class). If a bug does arise, it should require a fix to a single location. Any instance where an item is legitimately duped will need to do more work to actually copy the item. The code will be required to basically reconstruct the item from the ground up. The new item will be a truly new item. Do not take this lightly.
----The only time an item instance should be duplicated is for Game Master level functions.----
Items are built from statistic entries (item stats). Most items will have a base item stat entry and 0 or more item stat entries that act as modifiers. Modifiers are permanent additions to an item instance. For example, you may be able to buy a normal 'short sword' from a merchant. This would be the base stat of the item. If you use a trade skill to sharpen the short sword, that may add the 'sharpened' modifier to the sword. The resulting item instance will still (and always) have the base stat of 'short sword'. In addition it will have the modifier of 'sharpened'. It may gain or lose modifiers through other actions. Temporary effects such as spells, poisons, etc are NOT modifiers. They should be handled differently. At this time there is no code to handle effects on items, but it should not be difficult to add once the parameters of effects are defined. The other type of item instance is a unique item. Unique items are truely unique. The unique item has its own entry for its stats in the database. Only one item instance will ever refer to this entry. If the item instance is destroyed, so is the entry. In some situations the item stats may be altered - either through an extremely difficult quest, or GM intervention. These alterations to the stats will alter the entries of the unique item stats. In addition, normal modifiers may also be applied.
----Unique items should be very difficult to obtain as they are a larger drain on server resources----
An item instance has four persistant-state related operations: Load() - Translates data from a database item instance entry into a usable psItem Save() - Saves a psItem. This creates a new Unique Identifier (UID) for the item instance if needed (if the UID is 0). DeleteItem() - (Called from psCharacterLoader) Destroys the item instance entry from the database. The psItem entry in memory should also be destroyed promptly.
Weight Rules: TODO: Containers will have a maximum carrying weight. Weight of stacks is a the count of the stack multiplied by the weight of the base item stat.
Size Rules: Size is single number (float) that relates to the length of the longest dimension measured in centimeters. Stacks do not affect size. Containers have a maximum content size. 65535 = infinite size. Items with 65535 cannot be put into any containers. Containers with 65535 max content size can contain any item except items with 65535 size.
TODO: Add effect data - such as spell effects or poision or whatever. TODO: Merge various mutually exclusive stats into unions to save space.
psItem::psItem | ( | ) |
virtual psItem::~psItem | ( | ) | [virtual] |
Destructs the psItem, and, if this is a container, all contained items.
Does NOT remove any items from the database.
void psItem::AddLootModifier | ( | uint32_t | id, |
int | pos = -1 |
||
) |
Allows to add a modification to the item.
id | The id of the modification to apply to this item. |
pos | The position in the array where to put this modifications (note it overwrites what's there) |
bool psItem::AddModifier | ( | psItemStats * | modifier | ) |
Adds a modifier to this item instance if there is space available.
Current stats are automaticaly updated.
TODO: A DeleteModifier() function may be warranted in the future.
void psItem::AddOpenableLock | ( | uint32 | v | ) |
double psItem::CalcFunction | ( | MathEnvironment * | env, |
const char * | functionName, | ||
const double * | params | ||
) | [virtual] |
Implements iScriptableVar.
void psItem::CancelEquipScript | ( | ) |
bool psItem::CanOpenLock | ( | uint32 | id, |
bool | includeSkel | ||
) | const |
bool psItem::CheckRequirements | ( | psCharacter * | character, |
csString & | resp | ||
) |
Check to see if the character meets the requirements for this item.
bool psItem::CheckStackableWith | ( | const psItem * | otheritem, |
bool | precise, | ||
bool | checkStackCount = true , |
||
bool | checkWorld = true |
||
) | const |
Check if otheritem is stackable with this item.
otheritem | The item to check if this item is stackable with. |
precise | Is the quality, max quality and crafter the same. |
checkStackCount | Sheck the stack count. |
checkWorld | Checks if stackability is possible in the world (eg: instances comparing) |
void psItem::ClearOpenableLocks | ( | ) |
void psItem::CombineStack | ( | psItem *& | stackme | ) |
Combines 'stackme' with this item.
You must call CheckStackableWith first; this ASSERTS if the two are not stackable.
bool psItem::CompareOpenableLocks | ( | const psItem * | key | ) | const |
Duplicates an item instance.
The parameter is the stack count of the new item. The return value must be checked for NULL. The returned item will not have a valid location nor a valid UID. The location in the world or on an owning player must be set first, and then Save() called to generate a UID and save to the database.
virtual void psItem::Copy | ( | psItem * | target | ) | [virtual] |
Copies values of its attributes to item 'target'.
void psItem::CopyOpenableLock | ( | psItem * | origKey | ) |
virtual psItem* psItem::CreateNew | ( | ) | [inline, virtual] |
bool psItem::DeleteFromDatabase | ( | ) |
virtual void psItem::DeleteObjectCallback | ( | iDeleteNotificationObject * | object | ) | [virtual] |
Handles deleted gem objects.
Implements iDeleteObjectCallback.
bool psItem::Destroy | ( | ) |
Called when an item is completely destroyed from the persistant world.
Persistant refers to the item existing through a reset of the server. This definition can affect when an item should be "destroyed" (removed from the database). For example, if items dropped on the ground will be forever lost if the server goes down, then when an item is dropped on the group, DestroyItem() should be used instead of UpdateItem(). When the item is picked up again, CreateItem() should be called.
bool psItem::FitsInSlot | ( | INVENTORY_SLOT_NUMBER | slot | ) |
bool psItem::FitsInSlots | ( | PSITEMSTATS_SLOTLIST | slotmask | ) |
void psItem::ForceSaveIfNew | ( | ) |
Saves this item now if it hasn't been saved before, to force the generation of a UID.
PSITEMSTATS_AMMOTYPE psItem::GetAmmoType | ( | ) |
PSITEMSTATS_ARMORTYPE psItem::GetArmorType | ( | ) |
float psItem::GetArmorVSWeaponResistance | ( | psItemStats * | armor | ) |
Gets the reduction of this weapon against the armor given.
int psItem::GetAttackAnimID | ( | psCharacter * | pschar | ) |
TODO: Comment me with something more than "Gets the attack animation ID".
psItemStats* psItem::GetBaseStats | ( | ) | const [inline] |
csString psItem::GetBookText | ( | ) | [inline] |
bool psItem::GetBuyPersonalise | ( | ) |
bool psItem::GetCanTransform | ( | ) |
psItemCategory* psItem::GetCategory | ( | ) |
int psItem::GetCharges | ( | ) | const |
uint32 psItem::GetContainerID | ( | ) | const [inline] |
unsigned short psItem::GetContainerMaxSize | ( | ) |
int psItem::GetContainerMaxSlots | ( | ) |
Gets the slots available in this item (only containers) which means also the maximum amount of items which can be stored in this container.
float psItem::GetCounterBlockValue | ( | ) |
PID psItem::GetCrafterID | ( | ) | const [inline] |
Returns the UID for the crafter of this item. Be sure to check GetIsCrafterIDValid()!
PSITEMSTATS_CREATIVETYPE psItem::GetCreative | ( | ) |
const csString& psItem::GetCreativeBackgroundImg | ( | ) | [inline] |
PID psItem::GetCreator | ( | PSITEMSTATS_CREATORSTATUS & | creatorStatus | ) |
Gets the creator of this creative and the creator setting status.
creatorStatus | The status of the creator setting in this creative |
psItemStats* psItem::GetCurrentStats | ( | ) | const [inline] |
float psItem::GetDamage | ( | PSITEMSTATS_DAMAGETYPE | dmgtype | ) |
float psItem::GetDamageProtection | ( | PSITEMSTATS_DAMAGETYPE | dmgtype | ) |
float psItem::GetDecay | ( | ) |
Returns the decay value of the item. See the decay member for a description of what this is.
float psItem::GetDecayResistance | ( | ) |
const char* psItem::GetDescription | ( | ) | const |
Fetch the psitem description if it's not null, otherwise the current_stats description.
PSITEM_FLAGS psItem::GetFlags | ( | ) | [inline] |
PID psItem::GetGuardingCharacterID | ( | ) | const [inline] |
Returns the UID for the guild who has certified this item. Be sure to check GetIsGuildIDValid()!
float psItem::GetHardness | ( | ) |
int psItem::GetIdentifyMinSkill | ( | ) |
Returns minimum skill level to identify certain examined items.
int psItem::GetIdentifySkill | ( | ) |
Returns skill id of skill needed to identify examined items.
const char* psItem::GetImageName | ( | ) |
Get the Image Name for the item.
Used in inventory and other location where item has to be presented by a 2D image.
bool psItem::GetIsAmmo | ( | ) |
bool psItem::GetIsArmor | ( | ) |
bool psItem::GetIsAutoTransformContainer | ( | ) |
bool psItem::GetIsBothHandsWeapon | ( | ) |
bool psItem::GetIsConstructible | ( | ) |
bool psItem::GetIsContainer | ( | ) |
bool psItem::GetIsCrafterIDValid | ( | ) |
Returns true if the crafter character ID is valid.
bool psItem::GetIsEquipStackable | ( | ) | const |
bool psItem::GetIsGuildIDValid | ( | ) |
Returns true if the certifying guild ID is valid.
bool psItem::GetIsIdentifiable | ( | ) | [inline] |
bool psItem::GetIsMeleeWeapon | ( | ) |
bool psItem::GetIsNoPickup | ( | ) | [inline] |
bool psItem::GetIsNoPickupStrong | ( | ) | [inline] |
bool psItem::GetIsNoPickupWeak | ( | ) | [inline] |
bool psItem::GetIsRangeWeapon | ( | ) |
bool psItem::GetIsReadable | ( | ) |
Checks the readable flag in the item_stats and tell if this is the case.
bool psItem::GetIsShield | ( | ) |
bool psItem::GetIsSkeleton | ( | ) |
bool psItem::GetIsStackable | ( | ) | const |
bool psItem::GetIsTrap | ( | ) |
bool psItem::GetIsUnique | ( | ) | const |
Returns true if this item is based off of unique statistics.
Items with unique statistics will be especially rare. Some special operations are possible on unique items
bool psItem::GetIsWriteable | ( | ) |
Checks the writeable flag in the item_stats and tell if this is the case.
csString psItem::GetItemCommand | ( | ) | [inline] |
float psItem::GetItemDecayRate | ( | ) | [inline] |
float psItem::GetItemQuality | ( | ) | const |
Gets the quality of the item.
float psItem::GetItemSize | ( | ) |
virtual const char* psItem::GetItemType | ( | ) | [inline, virtual] |
float psItem::GetLatency | ( | ) |
const csString& psItem::GetLiteratureText | ( | void | ) | [inline] |
void psItem::GetLocationInWorld | ( | InstanceID & | instance, |
psSectorInfo ** | sectorinfo, | ||
float & | loc_x, | ||
float & | loc_y, | ||
float & | loc_z, | ||
float & | loc_yrot | ||
) | const |
INVENTORY_SLOT_NUMBER psItem::GetLocInParent | ( | bool | adjustSlot = false | ) |
Returns the location of this item in its parent item or in the player's equipment, bulk or bank as appropriate.
int psItem::GetMaxCharges | ( | ) | const |
float psItem::GetMaxItemQuality | ( | ) | const |
Gets the maximum possible quality of the item by reading the item_stat.
const char* psItem::GetMeshName | ( | ) |
Get the Mesh Name for the item.
Used for standalone or weilded mesh.
psItemStats* psItem::GetModifier | ( | int | index | ) |
Returns the modifier at a specific index 0 through PSITEM_MAX_MODIFIERS-1.
const char* psItem::GetModifiersDescription | ( | ) |
If an overlay is set return it's script description, otherwise return the.
const csString& psItem::GetMusicalSheet | ( | void | ) | [inline] |
const char* psItem::GetName | ( | ) | const |
csString psItem::GetOpenableLockNames | ( | ) |
psCharacter* psItem::GetOwningCharacter | ( | ) | [inline] |
Returns a pointer to the character who is holding this item directly or indirectly (including containers and bank slots) or NULL if none.
Returns NULL if on the ground or in a container on the ground.
This should always be valid since items should be destroyed when the character logs off
PID psItem::GetOwningCharacterID | ( | ) | const [inline] |
const char* psItem::GetPartMeshName | ( | ) |
Get the Part Mesh Name for the item.
This is the new mesh to be attached to the location given by the pattern Part Name.
const char* psItem::GetPartName | ( | ) |
Get the Part Name for the item.
This is the name of the part that the texture should be attached to if no change of mesh.
float psItem::GetPenetration | ( | ) |
psMoney psItem::GetPrice | ( | ) |
double psItem::GetProperty | ( | MathEnvironment * | env, |
const char * | ptr | ||
) | [virtual] |
This is used by the math scripting engine to get various values.
Implements iScriptableVar.
virtual int psItem::GetPurifyStatus | ( | ) | const [inline, virtual] |
const char* psItem::GetQualityString | ( | ) |
Returns a description of the quality level of item.
csString psItem::GetQuantityName | ( | ) |
static csString psItem::GetQuantityName | ( | const char * | namePtr, |
int | stack_count, | ||
PSITEMSTATS_CREATIVETYPE | creativeType, | ||
bool | giveDetail = false |
||
) | [static] |
float psItem::GetRarity | ( | ) |
return Rarity as 0-100% range
csString psItem::GetRarityName | ( | ) |
return Rarity description. example: "rare (0.7%)"
int psItem::GetRequiredRepairTool | ( | ) |
Returns item_stats id of repair tool required to fix this item, or 0.
bool psItem::GetRequiredRepairToolConsumed | ( | ) |
Returns the is_consumed flag of repair tool required to fix this item.
Get the x,y and z axis rotations for the item.
loc_xrot | the variable in which the x rotation will be stored |
loc_yrot | the variable in which the y rotation will be stored |
loc_zrot | the variable in which the z rotation will be stored |
psScheduledItem* psItem::GetScheduledItem | ( | ) | [inline] |
psSectorInfo* psItem::GetSector | ( | ) | const [inline] |
psMoney psItem::GetSellPrice | ( | ) |
Merchants want a percentage.
const csString& psItem::GetSketch | ( | void | ) | [inline] |
csString psItem::GetSlotRemovedMesh | ( | int | slot, |
csString | meshName = "" |
||
) | [inline] |
Proxies the same function in psitemstats which gets the list of mesh to remove when this item is equipped in the specified slot.
slot | The slot this item is being equipped into. |
meshName | The meshName we are sarching for the slot to remove for it. |
const char* psItem::GetSound | ( | ) |
unsigned short psItem::GetStackCount | ( | ) | const [inline] |
Returns the stack count. Be sure to call GetIsStackable() first!
const char* psItem::GetStandardDescription | ( | ) |
const char* psItem::GetStandardName | ( | ) |
float psItem::GetTargetedBlockValue | ( | ) |
const char* psItem::GetTextureName | ( | ) |
Get the Texture Name for the item.
Used when worn and attached to the mesh given by part name.
float psItem::GetTotalStackSize | ( | ) | [inline] |
psWorkGameEvent* psItem::GetTransformationEvent | ( | ) | [inline] |
uint32 psItem::GetUID | ( | ) | [inline] |
float psItem::GetUntargetedBlockValue | ( | ) |
bool psItem::GetUsesAmmo | ( | ) |
PSITEMSTATS_SLOTLIST psItem::GetValidSlots | ( | ) |
float psItem::GetVisibleDistance | ( | ) |
float psItem::GetWeaponAttributeBonus | ( | PSITEMSTATS_STAT | stat | ) |
PSITEMSTATS_STAT psItem::GetWeaponAttributeBonusType | ( | int | index | ) |
PSSKILL psItem::GetWeaponSkill | ( | PSITEMSTATS_WEAPONSKILL_INDEX | index | ) |
psWeaponType* psItem::GetWeaponType | ( | ) |
float psItem::GetWeight | ( | ) |
Get the x and z axis rotations for the item (y obtained in GetLocationInWorld)
loc_xrot | the variable in which the x rotation will be stored |
loc_zrot | the variable in which the z rotation will be stored |
bool psItem::HasCharges | ( | ) | const |
bool psItem::HasModifier | ( | psItemStats * | modifier | ) |
Returns true if this item has this modifier in its modifier list.
This can be used to make sure an item doesn't get the same modifier multiple times or if an item needs to have a specific modifier to be used for something.
TODO: In the future we may expand this to functions that check for "similar" modifiers to a given modifier.
bool psItem::IsActive | ( | ) | const |
bool psItem::IsEquipped | ( | ) | const |
bool psItem::IsRechargeable | ( | ) | const |
bool psItem::IsThisTheCreator | ( | PID | pid | ) |
Checks if the creator of the book is the one passed as argument.
pid | the PID of the character we are checking creator status. |
virtual bool psItem::Load | ( | iResultRow & | row | ) | [virtual] |
void psItem::MakeSkeleton | ( | bool | b | ) |
void psItem::operator delete | ( | void * | ) |
The delete operator is overriden to call PoolAllocator template functions.
Reimplemented in psGlyph.
void* psItem::operator new | ( | size_t | ) |
The new operator is overriden to call PoolAllocator template functions.
Reimplemented in psGlyph.
PSITEM_FLAGS psItem::ParseItemFlags | ( | csString | flagstr | ) |
Parses an item flags list and returns the flags.
void psItem::PrepareCreativeItemInstance | ( | ) |
void psItem::RecalcCurrentStats | ( | ) |
In some cases some modifiers or effects may be difficult to reverse (for example percent bonuses applied and removed in different orders).
In these cases it should be safe to call RecalcCurrentStats() which takes a bit longer, but builds the current stats back up from the base.
void psItem::RemoveOpenableLock | ( | uint32 | v | ) |
void psItem::ResetItemStackable | ( | ) |
void psItem::RunEquipScript | ( | gemActor * | actor | ) |
void psItem::Save | ( | bool | children | ) |
Queues this item to be saved to the database.
(DB action will be executed after 500ms) Call this after EVERY change of a persistant property, and the system will ensure that any sequence of changes will result in only one DB hit.
void psItem::ScheduleRemoval | ( | ) |
This function handles creating an event manager event at the right time to get transient objects removed from the world automatically.
void psItem::ScheduleRespawn | ( | ) |
bool psItem::SendActionContents | ( | Client * | client, |
psActionLocation * | action | ||
) |
bool psItem::SendItemDescription | ( | Client * | client | ) |
void psItem::SetActive | ( | bool | state | ) |
void psItem::SetBaseStats | ( | psItemStats * | statptr | ) |
Alters the base stats of this item instance.
If called on a unique item it revokes the unique item status of this item! If called on a unique item the unique item stats should be destroyed elsewhere.
bool psItem::SetBookText | ( | const csString & | newText | ) |
Sets the book text, should only be used if this is a book.
void psItem::SetCharges | ( | int | charges | ) |
void psItem::SetCrafterID | ( | PID | v | ) |
Sets the UID for the cracter of this item. Generally used immediately after completing the crafting work.
bool psItem::SetCreation | ( | PSITEMSTATS_CREATIVETYPE | , |
const csString & | , | ||
csString | |||
) |
Write creative stuff such as lit text (eg book) or map data.
void psItem::SetCreator | ( | PID | , |
PSITEMSTATS_CREATORSTATUS | |||
) |
sets the creator (i.e. author, artist, etc) of creative things
void psItem::SetCurrentStats | ( | psItemStats * | statptr | ) |
Sets the current item stats.
DO NOT USE! This is used mostly internally. The current stats either point to the same entry as the base stats or a stats entry that is the sum of the base stats plus modifiers and effects.
void psItem::SetDecay | ( | float | v | ) |
Sets the decay value of the item. See the decay member for a description of what this is.
void psItem::SetDecayResistance | ( | float | v | ) |
Set the decay resistance percentage for the item.
void psItem::SetDescription | ( | const char * | newDescription | ) |
void psItem::SetGemObject | ( | gemItem * | object | ) |
void psItem::SetGuardingCharacterID | ( | PID | guardian | ) | [inline] |
void psItem::SetIsCD | ( | bool | v | ) |
void psItem::SetIsCrafterIDValid | ( | bool | v | ) |
Set wether the crafter ID is valid. SetCrafterID() sets this to true for you.
void psItem::SetIsGuildIDValid | ( | bool | v | ) |
Set wether the guild ID is valid. SetGuildID() sets this to true for you.
void psItem::SetIsIdentifiable | ( | bool | v | ) |
Set the Identifiable flag of the item.
void psItem::SetIsItemStackable | ( | bool | v | ) |
void psItem::SetIsKey | ( | bool | v | ) |
void psItem::SetIsLockable | ( | bool | v | ) |
void psItem::SetIsLocked | ( | bool | v | ) |
void psItem::SetIsMasterKey | ( | bool | v | ) |
void psItem::SetIsNpcOwned | ( | bool | v | ) |
void psItem::SetIsPickupable | ( | bool | v | ) |
Sets the pickupable flag in order to not allow/allow the item to be picked up.
v | FALSE if the no pickup flag should be set. |
void psItem::SetIsPickupableWeak | ( | bool | v | ) |
Sets the weak pickupable flag in order to not allow/allow the item to be picked up.
v | FALSE if the weak no pickup flag should be set. |
void psItem::SetIsSecurityLocked | ( | bool | v | ) |
void psItem::SetIsSettingItem | ( | bool | v | ) |
void psItem::SetIsTransient | ( | bool | v | ) |
void psItem::SetIsUnpickable | ( | bool | v | ) |
void psItem::SetItemDecayRate | ( | float | v | ) |
Set the item decay factor.
void psItem::SetItemQuality | ( | float | v | ) |
Sets the quality of the item.
void psItem::SetLoaded | ( | ) | [inline] |
void psItem::SetLocationInWorld | ( | InstanceID | instance, |
psSectorInfo * | sectorinfo, | ||
float | loc_x, | ||
float | loc_y, | ||
float | loc_z, | ||
float | loc_yrot | ||
) |
void psItem::SetLocInParent | ( | INVENTORY_SLOT_NUMBER | location | ) |
Please consider using UpdateInventoryStatus() instead.
void psItem::SetLockpickSkill | ( | PSSKILL | v | ) |
void psItem::SetMaxItemQuality | ( | float | v | ) |
Sets the maximum allowed quality of the item by changing the item_stat.
bool psItem::SetMusicalSheet | ( | const csString & | newMusicalSheet | ) |
Sets the musical sheet.
void psItem::SetName | ( | const char * | newName | ) |
virtual void psItem::SetOwningCharacter | ( | psCharacter * | owner | ) | [virtual] |
Alters the owning character of this item. Also see UpdateInventoryStatus.
Reimplemented in psGlyph.
Set the x, y and z axis rotations for the item.
loc_xrot | the variable used to set the x rotation of the item |
loc_yrot | the variable used to set the x rotation of the item |
loc_zrot | the variable used to set the z rotation of the item |
void psItem::SetScheduledItem | ( | psScheduledItem * | item | ) | [inline] |
bool psItem::SetSketch | ( | const csString & | newSketchData | ) |
Sets sketch data.
void psItem::SetStackCount | ( | unsigned short | v | ) |
Sets the stack count.
Be sure to call GetIsStackable() first! Don't call this to try and combine or split stacks! That logic is done in CombineStack() and SplitStack().
void psItem::SetTransformationEvent | ( | psWorkGameEvent * | t | ) | [inline] |
void psItem::SetUID | ( | uint32 | v | ) |
Sets the Unique ID of this item.
DO NOT CALL THIS. This should ONLY be called internally or from psCharacterLoader.
void psItem::SetUniqueStats | ( | psItemStats * | statptr | ) |
Used to set the UNIQUE flag in addition to setting base stats pointer TODO: This is pretty much untested at this point.
Set the x and z axis rotations for the item (y set in SetLocationInWorld)
loc_xrot | the variable used to set the x rotation of the item |
loc_zrot | the variable used to set the z rotation of the item |
Splits an item instance representing a stack into two smaller stacks.
The parameter is the size of the new stack. The return value must be checked for NULL. The returned item will not have a valid location nor a valid UID. The location in the world or on an owning player must be set first, and then Save() called to generate a UID and save to the database.
const char* psItem::ToString | ( | ) | [inline, virtual] |
Implements iScriptableVar.
void psItem::UpdateInventoryStatus | ( | psCharacter * | owner, |
uint32 | parent_id, | ||
INVENTORY_SLOT_NUMBER | slot | ||
) |
void psItem::UpdateModifiers | ( | ) |
Recalculates the modifications for this item.
void psItem::UpdateView | ( | Client * | fromClient, |
EID | eid, | ||
bool | clear | ||
) |
inform clients on view updates
void psItem::ViewItem | ( | Client * | client, |
int | containerID, | ||
INVENTORY_SLOT_NUMBER | slotID | ||
) |
Send an item to the client.
client | The client the message is for. |
containerID | the ID of the owning container |
slotID | the slot this item is in TODO check if we can't get the data our self |
PSITEM_FLAGS psItem::flags [protected] |
Flags for this item instance.
Flags are described at the top of this file. Note that psItemStats also has flags that are stored separately. If you're looking for a flag that you think should be here, check psItemStats to be sure it's not a stat flag instead of an instance flag. Flags are indicated in the database as text, e.g. "NOPICKUP" in the flags column
bool psItem::loaded [protected] |