25 #include <csutil/array.h> 26 #include <csgeom/vector3.h> 27 #include <csutil/weakreferenced.h> 70 #define REMOVAL_INTERVAL_RANGE 300 71 #define REMOVAL_INTERVAL_MINIMUM 2419200 74 #define ID_DONT_SAVE_ITEM 0xffffffff 77 #define PSITEM_FLAG_CRAFTER_ID_IS_VALID 0x00000001 78 #define PSITEM_FLAG_GUILD_ID_IS_VALID 0x00000002 80 #define PSITEM_FLAG_UNIQUE_ITEM 0x00000004 91 #define PSITEM_FLAG_USES_BASIC_ITEM 0x00000008 92 #define PSITEM_FLAG_PURIFIED 0x00000010 94 #define PSITEM_FLAG_PURIFYING 0x00000020 97 #define PSITEM_FLAG_LOCKED 0x00000040 100 #define PSITEM_FLAG_LOCKABLE 0x00000080 103 #define PSITEM_FLAG_NOPICKUP 0x00000100 106 #define PSITEM_FLAG_KEY 0x00000200 109 #define PSITEM_FLAG_TRANSIENT 0x00000400 112 #define PSITEM_FLAG_UNPICKABLE 0x00000800 115 #define PSITEM_FLAG_SECURITYLOCK 0x00001000 118 #define PSITEM_FLAG_NPCOWNED 0x00002000 121 #define PSITEM_FLAG_MASTERKEY 0x00004000 124 #define PSITEM_FLAG_USE_CD 0x00008000 127 #define PSITEM_FLAG_ACTIVE 0x00010000 130 #define PSITEM_FLAG_UNSTACKABLE 0x00020000 133 #define PSITEM_FLAG_STACKABLE 0x00040000 136 #define PSITEM_FLAG_SETTINGITEM 0x00080000 139 #define PSITEM_FLAG_NOPICKUPWEAK 0x00100000 142 #define PSITEM_FLAG_IDENTIFIABLE 0x00200000 144 #define KEY_SKELETON ((unsigned int)-2) 146 #define MAX_STACK_COUNT 65 // This is the most items a player can have in a stack 151 #define PSITEM_MAX_MODIFIERS 10 264 void SetGemObject(
gemItem*
object);
268 return transformationEvent;
272 transformationEvent = t;
279 void UpdateView(
Client* fromClient, EID eid,
bool clear);
281 bool SendItemDescription(
Client* client);
304 void SendCraftTransInfo(
Client* client);
306 void GetComboInfoString(
psCharacter* character, uint32 designID, csString &comboString);
308 void GetTransInfoString(
psCharacter* character, uint32 designID, csString &transString);
310 bool SendBookText(
Client* client,
int containerID,
int slotID);
312 void SendSketchDefinition(
Client* client);
314 void SendMusicalSheet(
Client* client);
335 float decay_resistance;
339 float crafted_quality;
343 float item_quality_original;
346 unsigned short stack_count;
374 unsigned int guild_id;
401 PID owningCharacterID;
402 PID guardingCharacterID;
423 unsigned int lockStrength;
427 csArray<unsigned int> openableLocks;
436 void Commit(
bool children =
false);
444 void UpdateItemQuality(uint32
id,
float qual);
447 friend class psDelaySave;
457 csString item_description;
469 csArray<uint32_t> modifierIds;
476 virtual bool Load(iResultRow &row);
482 void Save(
bool children);
485 void ForceSaveIfNew();
498 bool CheckRequirements(
psCharacter* character, csString &resp);
512 void SetUID(uint32 v);
515 bool GetIsCrafterIDValid();
517 void SetIsCrafterIDValid(
bool v);
520 bool GetIsGuildIDValid();
522 void SetIsGuildIDValid(
bool v);
530 void SetCrafterID(PID v);
538 void SetGuildID(
unsigned int v);
541 float GetMaxItemQuality()
const;
543 void SetMaxItemQuality(
float v);
546 float GetItemQuality()
const;
548 void SetItemQuality(
float v);
550 const char* GetQualityString();
556 int GetRequiredRepairTool();
558 bool GetRequiredRepairToolConsumed();
561 int GetIdentifySkill();
563 int GetIdentifyMinSkill();
566 void SetDecayResistance(
float v);
568 void SetItemDecayRate(
float v);
575 float AddDecay(
float severityFactor);
590 bool GetIsUnique()
const;
625 virtual psItem* Copy(
unsigned short newstackcount);
629 virtual void Copy(
psItem* target);
637 psItem* SplitStack(
unsigned short newstackcount);
642 void CombineStack(
psItem* &stackme);
653 void SetDecay(
float v);
664 void SetStackCount(
unsigned short v);
674 return owning_character;
681 return owningCharacterID;
685 virtual void SetOwningCharacter(
psCharacter* owner);
691 return guardingCharacterID;
695 guardingCharacterID = guardian;
701 return parent_item_InstanceID;
705 parent_item_InstanceID = parentId;
748 return current_stats;
754 void RecalcCurrentStats();
779 bool GetIsMeleeWeapon();
780 bool GetIsBothHandsWeapon();
781 bool GetIsRangeWeapon();
785 bool GetIsContainer();
786 bool GetIsAutoTransformContainer();
788 bool GetIsConstructible();
789 bool GetCanTransform();
791 bool GetIsStackable()
const;
792 bool GetIsEquipStackable()
const;
809 bool IsThisTheCreator(PID pid);
810 bool GetBuyPersonalise();
816 const char* GetDescription()
const;
817 void SetName(
const char* newName);
818 void SetDescription(
const char* newDescription);
819 const char* GetStandardName();
820 const char* GetStandardDescription();
830 void AddLootModifier(uint32_t
id,
int pos = -1);
833 void UpdateModifiers();
850 float GetPenetration();
851 float GetUntargetedBlockValue();
852 float GetTargetedBlockValue();
853 float GetCounterBlockValue();
859 float GetWeaponAttributeBonusMax(
int index);
866 return GetItemSize()*stack_count;
869 unsigned short GetContainerMaxSize();
877 int GetContainerMaxSlots();
890 return GetBaseStats()->GetSlotRemovedMesh(slot, meshName);
892 float GetDecayResistance();
898 float GetVisibleDistance();
900 void GetLocationInWorld(
InstanceID &instance,
psSectorInfo** sectorinfo,
float &loc_x,
float &loc_y,
float &loc_z,
float &loc_yrot)
const;
901 void SetLocationInWorld(
InstanceID instance,
psSectorInfo* sectorinfo,
float loc_x,
float loc_y,
float loc_z,
float loc_yrot);
907 void GetXZRotationInWorld(
float &loc_xrot,
float &loc_zrot);
913 void SetXZRotationInWorld(
float loc_xrot,
float loc_zrot);
920 void GetRotationInWorld(
float &loc_xrot,
float &loc_yrot,
float &loc_zrot);
927 void SetRotationInWorld(
float loc_xrot,
float loc_yrot,
float loc_zrot);
931 return location.loc_sectorinfo;
938 const char* GetMeshName();
944 const char* GetTextureName();
951 const char* GetPartName();
958 const char* GetPartMeshName();
965 const char* GetImageName();
967 csString GetQuantityName();
968 static csString GetQuantityName(
const char* namePtr,
int stack_count,
PSITEMSTATS_CREATIVETYPE creativeType,
bool giveDetail =
false);
980 bool IsEquipped()
const;
985 bool IsActive()
const;
986 void SetActive(
bool state);
988 void RunEquipScript(
gemActor* actor);
989 void CancelEquipScript();
995 const char* GetModifiersDescription();
1005 bool CheckStackableWith(
const psItem* otheritem,
bool precise,
bool checkStackCount =
true,
bool checkWorld =
true)
const;
1007 const char* GetSound();
1011 double CalcFunction(
MathEnvironment* env,
const char* functionName,
const double* params);
1014 return item_name.GetDataSafe();
1021 void SetIsLocked(
bool v);
1027 void SetIsLockable(
bool v);
1033 void SetIsSecurityLocked(
bool v);
1039 void SetIsUnpickable(
bool v);
1046 return (GetIsNoPickupStrong() || GetIsNoPickupWeak());
1069 void SetIsCD(
bool v);
1075 void SetIsNpcOwned(
bool v);
1081 void SetIsKey(
bool v);
1087 void SetIsMasterKey(
bool v);
1093 void SetIsTransient(
bool v);
1098 void SetIsPickupable(
bool v);
1103 void SetIsPickupableWeak(
bool v);
1105 void SetIsItemStackable(
bool v);
1106 void ResetItemStackable();
1112 void SetIsSettingItem(
bool v);
1116 return lockpickSkill;
1118 void SetLockpickSkill(
PSSKILL v);
1122 return lockStrength;
1124 void SetLockStrength(
unsigned int v);
1126 bool CompareOpenableLocks(
const psItem* key)
const;
1127 bool CanOpenLock(uint32
id,
bool includeSkel)
const;
1128 void AddOpenableLock(uint32 v);
1129 void RemoveOpenableLock(uint32 v);
1130 void ClearOpenableLocks();
1131 void CopyOpenableLock(
psItem* origKey);
1132 void MakeSkeleton(
bool b);
1133 bool GetIsSkeleton();
1134 csString GetOpenableLockNames();
1144 void ScheduleRespawn();
1147 float GetArmorVSWeaponResistance(
psItemStats* armor);
1152 return GetLiteratureText();
1155 bool SetBookText(
const csString &newText);
1157 bool SetSketch(
const csString &newSketchData);
1159 bool SetMusicalSheet(
const csString &newMusicalSheet);
1161 bool HasCharges()
const;
1162 bool IsRechargeable()
const;
1163 void SetCharges(
int charges);
1164 int GetCharges()
const;
1165 int GetMaxCharges()
const;
1170 return GetBaseStats()->GetItemCommand();
1188 void ScheduleRemoval();
1190 bool DeleteFromDatabase();
1201 void*
operator new(size_t);
1203 void operator delete(
void*);
1208 bool GetIsWriteable();
1212 bool GetIsReadable();
1232 return creativeStats.creativeType ==
PSITEMSTATS_CREATIVETYPE_NONE ? GetBaseStats()->GetCreativeBackgroundImg() : creativeStats.backgroundImg;
1235 void PrepareCreativeItemInstance();
1241 csString GetRarityName();
1249 void SetIsIdentifiable(
bool v);
1264 float CalculateItemRarity();
1271 csString last_save_queued_from;
1281 float range,
int lock_str = 0,
int lock_skill = -1, csString flags =
"");
1325 void UpdatePosition(csVector3 &positon,
const char* sector);
1326 void ChangeIntervals(
int newint,
int newrand);
1327 void ChangeRange(
float newRange);
1328 void ChangeAmount(
int newAmount);
#define PSITEM_FLAG_LOCKED
Flags for locked status (as in a locked container). If locked it can be opened only with lockpick or ...
uint32 GetUID()
Returns the UID of this item instance.
#define PSITEM_FLAG_SECURITYLOCK
Flag to indicate that lock is a security lock that stays locked.
csArray< ItemRequirement > reqs
Array of all the stat prerequisites needed to equip this item.
#define PSITEM_FLAG_SETTINGITEM
Flag defines if item is done by setting (unused by the server, it's more for ordering in the db) ...
PSITEMSTATS_WEAPONSKILL_INDEX
bool UsesAmmoType(uint32_t id) const
unsigned int PSITEMSTATS_SLOTLIST
bool GetIsSettingItem() const
void SetContainerID(uint32 parentId)
psMoney price
Price calculated from the loot modifiers rules which overlays the basic one.
A specific MathEnvironment to be used in a MathScript.
PSITEM_FLAGS flags
Flags for this item instance.
void SetLoaded()
Flags that this item has been fully loaded, and is allowed to be saved on changes.
unsigned int GetLockStrength()
PID GetCrafterID() const
Returns the UID for the crafter of this item. Be sure to check GetIsCrafterIDValid()! ...
int GetLockSkill()
Gets the lock skill which will be associated to this item.
unsigned short GetStackCount() const
Returns the stack count. Be sure to call GetIsStackable() first!
#define PSITEM_FLAG_UNPICKABLE
Flag to indicate that lock is unpickable.
bool UsesAmmoType(uint32_t id) const
const char * GetName(int id)
INVENTORY_SLOT_NUMBER
Holds a list of the possible socket identifiers that items can be attached to.
unsigned int PSITEM_FLAGS
void SetScheduledItem(psScheduledItem *item)
PSSKILL GetLockpickSkill()
bool GetIsNoPickupWeak()
Checks if the item has a weak no pickup flag set.
const csString & GetLiteratureText(void)
return creative contents of books.
#define PSITEM_FLAG_NOPICKUPWEAK
Flag for an un-pickupable item (remains fixed) - weak variant.
csString GetBookText()
Gets the book text, should only be used if this is a book.
csString GetItemCommand()
returns the special command assigned to this item
unsigned int GetGuildID() const
Returns the UID for the guild who has certified this item. Be sure to check GetIsGuildIDValid()! ...
float GetItemDecayRate()
Get the item decay factor.
uint32 GetContainerID() const
Returns the item that contains this item, or NULL if it's not contained by another item...
General Message for sending information about an containter to a client.
bool active
Notifies if this overlay is active and should be applied.
ApplicativeScript * equip_script
Equip script for this item overriding the main one from loot modifiers rules.
psCharacter * GetOwningCharacter()
Returns a pointer to the character who is holding this item directly or indirectly (including contain...
psWorkGameEvent * GetTransformationEvent()
csString mesh
Overriden mesh of this item from the basic one.
float latency
Latency of the weapon changed by the loot modifiers rules.
psItemStats * GetBaseStats() const
Returns the base stats for this item instance.
Any semi-autonomous object, either a player or an NPC.
#define PSITEM_FLAG_MASTERKEY
Flag defines any item as a key to a locked object that can be used to make a copy of the key...
const csString & GetMusicalSheet(void)
return creative contents of musical sheets.
psSectorInfo * loc_sectorinfo
int GetLockStrength()
Gets the lock strength which will be associated to this item.
psItemStats * GetCurrentStats() const
Gets a pointer to the current stats.
csString name
The name which should be replaced for this randomized item.
csString GetFlags()
Gets the flags which will be associated to this item.
float weight
Weigth of the item changed by the loot modifier rules.
const csString & GetCreativeBackgroundImg()
return the background image used in this creative.
#define PSITEM_FLAG_TRANSIENT
Transient items are removed from the world approx 3hrs after creation, if not picked up by someone...
#define PSITEM_FLAG_LOCKABLE
Flag to allow locking/unlocking of the item. It will add the "lock/unlock" icon in the context menu o...
#define PSITEM_FLAG_KEY
Flag defines any item as a key to a locked object.
float GetTotalStackSize()
Gets the total size of the items in the stack.
const csString & GetSketch(void)
return creative contents of sketches.
psSectorInfo * GetSector()
bool GetIsMasterKey() const
virtual int GetPurifyStatus() const
This class collects data of a netclient.
csString icon
Overriden icon of this item from the basic one.
~RandomizedOverlay()
Destructor.
csString GetSlotRemovedMesh(int slot, csString meshName="")
Proxies the same function in psitemstats which gets the list of mesh to remove when this item is equi...
#define PSITEM_FLAG_NPCOWNED
Flag to indicate that players shouldn't be able to put items into this container. ...
PID GetGuardingCharacterID() const
Item guardians: items dropped in the world or placed in a public container are not owned...
RandomizedOverlay()
Constructor.
ApplicativeScript is the applied script container.
This class holds info about Creative items such as books, etc.
bool GetIsIdentifiable()
Get the identifiable status of the item.
void SetGuardingCharacterID(PID guardian)
This huge class stores all the properties of any object a player can have in the game.
PSITEMSTATS_CREATORSTATUS
virtual psItem * CreateNew()
Creates a new blank instance of it's class (i.e.
virtual const char * GetItemType()
Return a string identifying this object as an Item.
This class stores all the properties of an action location Entrance, return location, name, response type, trigger.
#define PSITEM_FLAG_IDENTIFIABLE
Flag for identifiable item (not yet identified)
csVector3 & GetPosition()
#define PSITEM_FLAG_NOPICKUP
Flag for an un-pickupable item (remains fixed)
bool GetIsNpcOwned() const
Stores the randomized stats from the loot randomizer, it could be used to apply any global special ef...
float damageStats[PSITEMSTATS_DAMAGETYPE_COUNT]
Damage/protection stats changed by the loot modifiers rules.
Contains information about sectors from the server perspective.
bool GetIsNoPickup()
Gets if the item has a no pickup flag set.
PID GetOwningCharacterID() const
Get the ID of the owning character.
bool GetIsNoPickupStrong()
Checks if the item has a strong no pickup flag set.
psScheduledItem * GetScheduledItem()
#define PSITEM_MAX_MODIFIERS
The maximum number of modifiers that can be applied to a single instance of an item on top of the bas...
This class generically allows objects to be notified when a gemObject is removed. ...
#define PSITEM_FLAG_USE_CD
Flag defines if CD should be used on this item.
psSectorInfo * GetSector() const
bool GetIsSecurityLocked()
void SetTransformationEvent(psWorkGameEvent *t)
This class embodies item instances in the game.