1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010-2019 Winch Gate Property Limited
4 // This source file has been modified by the following contributors:
5 // Copyright (C) 2020 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
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/>.
23 #ifndef CL_ITEM_SHEET_H
24 #define CL_ITEM_SHEET_H
30 #include "client_sheets.h"
32 #include "nel/misc/types_nl.h"
34 #include "entity_sheet.h"
35 #include "item_fx_sheet.h"
37 #include "game_share/slot_types.h"
38 #include "game_share/item_family.h"
39 #include "game_share/item_type.h"
40 #include "game_share/skills.h"
41 #include "game_share/armor_types.h"
42 #include "game_share/weapon_types.h"
43 #include "game_share/damage_types.h"
44 #include "game_share/ecosystem.h"
45 #include "game_share/mp_category.h"
46 #include "game_share/item_origin.h"
47 #include "game_share/shield_types.h"
48 #include "game_share/crafting_tool_type.h"
49 #include "game_share/rm_family.h"
50 #include "game_share/range_weapon_type.h"
51 #include "game_share/characteristics.h"
52 #include "game_share/teleport_types.h"
53 #include "game_share/gender.h"
54 #include "game_share/characteristics.h"
74 // ***************************************************************************
76 * Class to manage an item sheet.
77 * \author Stephane Coutelas
78 * \author Nevrax France
81 class CItemSheet
: public CEntitySheet
87 GSGENDER::EGender Gender
;
89 void serial(NLMISC::IStream
&f
)
97 ARMORTYPE::EArmorType ArmorType
;
99 void serial(NLMISC::IStream
&f
)
101 f
.serialEnum(ArmorType
);
106 WEAPONTYPE::EWeaponType WeaponType
;
107 SKILLS::ESkills Skill
;
108 DMGTYPE::EDamageType DamageType
;
111 void serial(NLMISC::IStream
&f
)
113 f
.serialEnum(WeaponType
);
115 f
.serialEnum(DamageType
);
116 f
.serial(MeleeRange
);
121 WEAPONTYPE::EWeaponType WeaponType
;
122 RANGE_WEAPON_TYPE::TRangeWeaponType RangeWeaponType
;
123 SKILLS::ESkills Skill
;
125 void serial(NLMISC::IStream
&f
)
127 f
.serialEnum(WeaponType
);
129 f
.serialEnum(RangeWeaponType
);
134 SKILLS::ESkills Skill
;
135 DMGTYPE::EDamageType DamageType
;
138 void serial(NLMISC::IStream
&f
)
141 f
.serialEnum(DamageType
);
145 // Info on a itemPart which can be build by this MP
148 // The origin filter. It is actually a ITEM_ORIGIN::EItemOrigin
151 // The differents stats for this itemPart
152 uint8 Stats
[RM_FABER_STAT_TYPE::NumRMStatType
];
157 std::fill( Stats
, Stats
+ RM_FABER_STAT_TYPE::NumRMStatType
, 0 );
160 void serial(NLMISC::IStream
&f
)
162 f
.serial(OriginFilter
);
163 // must change sheet version
164 nlctassert(RM_FABER_STAT_TYPE::NumRMStatType
==34);
165 for(uint i
=0;i
<RM_FABER_STAT_TYPE::NumRMStatType
;i
++)
174 ECOSYSTEM::EECosystem Ecosystem
;
175 MP_CATEGORY::TMPCategory MpCategory
;
176 SKILLS::ESkills HarvestSkill
;
178 RM_FAMILY::TRMFamily Family
;
179 // If the MP is used as a special Craft Component requirement
180 bool UsedAsCraftRequirement
;
183 // The mean Stat Energy of this MP
185 // The ItemParts this MP can craft
189 void serial(NLMISC::IStream
&f
)
191 f
.serialEnum(Ecosystem
);
192 f
.serialEnum(MpCategory
);
193 f
.serialEnum(HarvestSkill
);
194 f
.serialEnum(Family
);
195 f
.serial(ItemPartBF
);
196 f
.serial(UsedAsCraftRequirement
);
198 f
.serial(StatEnergy
);
203 SHIELDTYPE::EShieldType ShieldType
;
205 void serial(NLMISC::IStream
&f
)
207 f
.serialEnum(ShieldType
);
212 SKILLS::ESkills Skill
; // Used by HARVEST, TAMING, TRAINING tools
213 TOOL_TYPE::TCraftingToolType CraftingToolType
; // Used by CRAFTING tool
214 sint32 CommandRange
; // Used by TAMING tool
215 sint32 MaxDonkey
; // Used by TAMING tool
217 void serial(NLMISC::IStream
&f
)
220 f
.serialEnum(CraftingToolType
);
221 f
.serial(CommandRange
);
231 void serial(NLMISC::IStream
&f
)
242 void serial(NLMISC::IStream
&f
)
250 TELEPORT_TYPES::TTeleportType Type
;
252 void serial(NLMISC::IStream
&f
)
261 std::string LuaCommand
;
262 std::string WebCommand
;
265 void serial(NLMISC::IStream
&f
)
268 f
.serial(LuaCommand
);
269 f
.serial(WebCommand
);
276 uint16 OverdoseTimer
;
277 uint16 ConsumptionTime
;
285 std::vector
<std::string
> Properties
;
287 void serial(NLMISC::IStream
&f
)
289 f
.serial(OverdoseTimer
);
290 f
.serial(ConsumptionTime
);
291 f
.serialCont(Properties
);
297 NLMISC::TSStringId IdShape
;
298 /// Female shape file name
299 NLMISC::TSStringId IdShapeFemale
;
300 /// shape file name for fyros
301 NLMISC::TSStringId IdShapeFyros
;
302 /// Female shape file name for fyros
303 NLMISC::TSStringId IdShapeFyrosFemale
;
304 /// shape file name for matis
305 NLMISC::TSStringId IdShapeMatis
;
306 /// Female shape file name for matis
307 NLMISC::TSStringId IdShapeMatisFemale
;
308 /// shape file name for tryker
309 NLMISC::TSStringId IdShapeTryker
;
310 /// Female shape file name for tryker
311 NLMISC::TSStringId IdShapeTrykerFemale
;
312 /// shape file name for zorai
313 NLMISC::TSStringId IdShapeZorai
;
314 /// Female shape file name for zorai
315 NLMISC::TSStringId IdShapeZoraiFemale
;
316 /// Equipment slot. This is a bitField matching each bit to SLOTTYPE::TSlotType
321 ITEMFAMILY::EItemFamily Family
;
323 ITEM_TYPE::TItemType ItemType
;
324 /// icon file name for race type
325 NLMISC::TSStringId IdIconBack
;
326 /// icon file name for main icon type
327 NLMISC::TSStringId IdIconMain
;
328 /// icon file name for overlay
329 NLMISC::TSStringId IdIconOver
;
330 /// icon file name for overlay2
331 NLMISC::TSStringId IdIconOver2
;
332 // Special Color to modulate with
333 NLMISC::CRGBA IconColor
;
334 NLMISC::CRGBA IconBackColor
;
335 NLMISC::CRGBA IconOverColor
;
336 NLMISC::CRGBA IconOver2Color
;
337 /// icon Special Text (raw materials)
338 NLMISC::TSStringId IdIconText
;
339 /// Part of the animation set ot use with this item.
340 NLMISC::TSStringId IdAnimSet
;
341 /// Item Color. Special Enum for armours
345 // Does the player can sell the item ?
347 // Item is not persistent to a disconnection ?
349 /// item max stack size
351 /// is item consumable
357 /// true if this item can be hidden when equipped
358 bool NeverHideWhenEquipped
;
363 // item special effects
364 NLMISC::TSStringId IdEffect1
;
365 NLMISC::TSStringId IdEffect2
;
366 NLMISC::TSStringId IdEffect3
;
367 NLMISC::TSStringId IdEffect4
;
370 std::vector
<CMpItemPart
> MpItemParts
;
373 CHARACTERISTICS::TCharacteristics RequiredCharac
;
374 uint16 RequiredCharacLevel
;
375 SKILLS::ESkills RequiredSkill
;
376 uint16 RequiredSkillLevel
;
378 /// if craftable, the craft plan
379 NLMISC::CSheetId CraftPlan
;
384 ITEM_ORIGIN::EItemOrigin ItemOrigin
;
385 // Different according to Family
390 CMeleeWeapon MeleeWeapon
;
391 CRangeWeapon RangeWeapon
;
396 CGuildOption GuildOption
;
402 CConsumable Consumable
;
411 std::string
getShape() const { return ClientSheetsStrings
.get(IdShape
); }
412 std::string
getShapeFemale() const { return ClientSheetsStrings
.get(IdShapeFemale
); }
413 std::string
getShapeFyros() const { return ClientSheetsStrings
.get(IdShapeFyros
); }
414 std::string
getShapeFyrosFemale() const { return ClientSheetsStrings
.get(IdShapeFyrosFemale
); }
415 std::string
getShapeMatis() const { return ClientSheetsStrings
.get(IdShapeMatis
); }
416 std::string
getShapeMatisFemale() const { return ClientSheetsStrings
.get(IdShapeMatisFemale
); }
417 std::string
getShapeTryker() const { return ClientSheetsStrings
.get(IdShapeTryker
); }
418 std::string
getShapeTrykerFemale() const { return ClientSheetsStrings
.get(IdShapeTrykerFemale
); }
419 std::string
getShapeZorai() const { return ClientSheetsStrings
.get(IdShapeZorai
); }
420 std::string
getShapeZoraiFemale() const { return ClientSheetsStrings
.get(IdShapeZoraiFemale
); }
421 std::string
getIconBack() const { return ClientSheetsStrings
.get(IdIconBack
); }
422 std::string
getIconMain() const { return ClientSheetsStrings
.get(IdIconMain
); }
423 std::string
getIconOver() const { return ClientSheetsStrings
.get(IdIconOver
); }
424 std::string
getIconOver2() const { return ClientSheetsStrings
.get(IdIconOver2
); }
425 std::string
getIconText() const { return ClientSheetsStrings
.get(IdIconText
); }
426 std::string
getAnimSet() const { return ClientSheetsStrings
.get(IdAnimSet
); }
428 std::string
getEffect1() const { return ClientSheetsStrings
.get(IdEffect1
); }
429 std::string
getEffect2() const { return ClientSheetsStrings
.get(IdEffect2
); }
430 std::string
getEffect3() const { return ClientSheetsStrings
.get(IdEffect3
); }
431 std::string
getEffect4() const { return ClientSheetsStrings
.get(IdEffect4
); }
433 /// Build the sheet from an external script.
434 virtual void build(const NLGEORGES::UFormElm
&item
);
436 /// Serialize character sheet into binary data file.
437 virtual void serial(NLMISC::IStream
&f
);
439 /// true if the item can put in the slot e
440 bool hasSlot(SLOTTYPE::TSlotType e
) const {return (SlotBF
&(SINT64_CONSTANT(1)<<e
))!=0;}
442 /// true if the item is faberisable according to family
443 bool isFaberisable() const;
445 // Get the skill required by the item depending on its type (or unknown_skill_type if no specific skill is required)
446 SKILLS::ESkills
getRequiredSkill() const;
448 // MP only. true if durability ok
449 bool canBuildItemPart(RM_FABER_TYPE::TRMFType e
) const;
451 // MP only. true if durability ok, and if origin ok
452 bool canBuildItemPart(RM_FABER_TYPE::TRMFType e
, ITEM_ORIGIN::EItemOrigin origin
) const;
454 // MP only. get a ref on the item part. assert if cannot build for any race
455 const CMpItemPart
&getItemPart(RM_FABER_TYPE::TRMFType e
) const;
457 // true if this is an MP that can build some item part
458 bool canBuildSomeItemPart() const;
460 // true if this is an MP that is required for some special item crafting
461 bool isUsedAsCraftRequirement() const;
463 // Weapon/Armor/Buckler only: check if some requirement on this item.
464 // if true, caracType/caracValue is filled according to itemType and itemLevel
465 // the current carac must be >= caracValue
466 bool hasCharacRequirement(uint itemLevel
, CHARACTERISTICS::TCharacteristics
&caracType
, float &caracValue
) const;
468 // return if canDrop (player exchange or BotChat Gift)
469 bool canExchangeOrGive(bool botChatGift
) const;
471 // MP only. return translated text of all item part this MP can build. empty, if can't build anything
472 void getItemPartListAsText(std::string
&ipList
) const;
475 const NLMISC::CSheetId
&getCraftPlan() const { return CraftPlan
; }
479 #endif // CL_ITEM_SHEET_H
481 /* End of item_sheet.h */