Merge branch 'fixes' into main/rendor-staging
[ryzomcore.git] / ryzom / common / src / game_share / item_infos.h
blob4cdfe67ef1110f0419f3a72f30c4b90e1de6c0bd
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This source file has been modified by the following contributors:
5 // Copyright (C) 2020 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
6 //
7 // This program is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU Affero General Public License as
9 // published by the Free Software Foundation, either version 3 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU Affero General Public License for more details.
17 // You should have received a copy of the GNU Affero General Public License
18 // along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef RY_ITEM_INFOS_H
23 #define RY_ITEM_INFOS_H
25 #include "nel/misc/types_nl.h"
26 #include "damage_types.h"
27 #include "protection_type.h"
28 #include "people.h"
29 #include "skills.h"
30 #include "characteristics.h"
31 #include "sphrase_com.h"
32 #include "type_skill_mod.h"
35 ///\structure defining the protection of an item
36 struct SProtection
38 inline SProtection():Factor(0.0f),Max(0){}
39 void serial( NLMISC::IStream & f )
41 f.serial( Factor );
42 f.serial( Max );
44 /// protection factor ( must be in [0..1] range 0 means no protection)
45 float Factor;
46 /// max absorbed damage
47 uint16 Max;
51 /**
52 * class used to store the item advanced infos and to send it to the client
53 * \author Nicolas Brigand
54 * \author Nevrax France
55 * \date 2003
57 class CItemInfos
59 public:
60 enum
62 // The number of bits of the lower bits part (the index part)
63 // 10 because the trading list can have 1024 entries
64 SlotIdIndexBitSize= 11,
65 SlotIdIndexBitMask= (1<<SlotIdIndexBitSize)-1,
68 enum
70 MaxMagicProtectionByJewel= 3,
71 MaxMagicResistanceByJewel= 3,
74 public:
75 /// ctor
76 CItemInfos();
78 ///\serial
79 void serial(NLMISC::IStream & s);
81 /// inventoryId(6 higher order bits )/slotId(10 lowers bits)
82 uint16 slotId;
83 /// version of the inventory slot
84 uint16 versionInfo;
85 ///\name item properties
86 //{@
87 uint32 Hp; // Current Durability of item
88 uint32 HpMax; // Max Durability of item (when is new)
89 uint32 CreatorName; // player character crafted item (if is a item crafted by PC)
90 uint32 CurrentDamage; // if is weapons or ammo, damage made by item whith current PC skill, if item is an range weapon, it is a modifier (+/- and base is ammo) (can be modified by action)
91 uint32 MaxDamage; // if is weapons or ammo, maximum damage can be made by item (due to his recommended skill (= old quality for weapon and ammos), this is reached when skill = recommended (can be modified by action)
92 float HitRate; // nb hits per minute item made (can be modified by action)
93 uint32 SapLoadCurrent; // sap load of item (for enchantment)
94 uint32 SapLoadMax; // sap load of item (for enchantment)
95 float Range; // range of weapon in milimeter, if item is an ammo, it is a modifier (+/-, base is range weapon)
96 sint32 ParryModifier; // parry modifier
97 sint32 DodgeModifier; // dodge modifier
98 sint32 AdversaryParryModifier; // target parry modifier
99 sint32 AdversaryDodgeModifier; // target dodge modifier
100 float ProtectionFactor; // protection in % gived by item
101 uint32 MaxSlashingProtection; // max damage absorbed by protection
102 uint32 MaxBluntProtection; // max damage absorbed by protection
103 uint32 MaxPiercingProtection; // max damage absorbed by protection
104 PROTECTION_TYPE::TProtectionType MagicProtection[MaxMagicProtectionByJewel]; //magic protection, only gived by jewel
105 uint32 MagicProtectionFactor[MaxMagicProtectionByJewel];
106 uint32 DesertMagicResistance; // Magic resistances
107 uint32 ForestMagicResistance;
108 uint32 LacustreMagicResistance;
109 uint32 JungleMagicResistance;
110 uint32 PrimaryRootMagicResistance;
111 sint32 HpBuff; // hp buff / debuff gived when item is equipped
112 sint32 SapBuff; // sap buff / debuff gived when item is equipped
113 sint32 StaBuff; // sta buff / debuff gived when item is equipped
114 sint32 FocusBuff; // focus buff / debuff gived when item is equipped
116 SKILLS::ESkills RequiredSkill; // required skill
117 uint16 RequiredSkillLevel; // required skill level
118 SKILLS::ESkills RequiredSkill2; // required skill
119 uint16 RequiredSkillLevel2; // required skill level
120 CHARACTERISTICS::TCharacteristics RequiredCharac; // required stat
121 uint16 RequiredCharacLevel; // min required stat level
123 // type specific skill bonus (applied against given race ennemies)
124 std::vector<CTypeSkillMod> TypeSkillMods;
126 // magic focus factor
127 enum TMagicFactorType
129 OffensiveElemental=0, // elemental spells (DD acid, fire...)
130 OffensiveAffliction, // offensive affliction spells
131 DefensiveHeal, // heal spells
132 DefensiveAffliction, // defensive affliction spells
134 NumMagicFactorType
136 float CastingSpeedFactor[NumMagicFactorType];
137 float MagicPowerFactor[NumMagicFactorType];
139 CSPhraseCom Enchantment;
140 float WearEquipmentMalus; // Malus for wearing this equipment (malus is used when execute an magic, forage action, craft action...), malus is only applicable for weapon and armor pieces
142 ucstring CustomText; // TODO: UTF-8 (serial)
143 ucstring R2ItemDescription; // TODO: UTF-8 (serial)
144 ucstring R2ItemComment; // TODO: UTF-8 (serial)
145 uint8 PetNumber; // 1 based pet index
146 //@}
150 #endif // RY_ITEM_INFOS_H
152 /* End of item_infos.h */