Fix classique titles display
[ryzomcore.git] / ryzom / client / src / client_sheets / sbrick_sheet.h
blob78a5eb52d7be63ffba8a8ae29c7cea2d41b98c87
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010-2020 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef RY_SBRICK_SHEET_H
20 #define RY_SBRICK_SHEET_H
22 #include "client_sheets.h"
24 #include "nel/misc/types_nl.h"
25 #include "nel/misc/rgba.h"
26 #include "game_share/brick_types.h"
27 #include "game_share/skills.h"
28 #include "game_share/brick_families.h"
29 #include "game_share/rm_family.h"
30 #include "game_share/crafting_tool_type.h"
31 #include "entity_sheet.h"
32 #include "game_share/action_nature.h"
33 #include "game_share/people.h"
34 #include "game_share/fame.h"
35 #include "game_share/resistance_type.h"
37 // ***************************************************************************
38 #define SBRICK_MAX_MANDATORY 12
39 #define SBRICK_MAX_OPTIONAL 32
40 #define SBRICK_MAX_PARAMETER 4
41 #define SBRICK_MAX_CREDIT 12
44 // ***************************************************************************
45 // The max number of different MP required for a faber sentence. This applies for ItemPart MPs, and Formula MPs
46 #define MAX_FABER_REQ_MP 5
49 // ***************************************************************************
50 /**
51 * New Sabrina Brick Sheet def.
52 * \author Lionel Berenguier
53 * \author Nevrax France
54 * \date 2003
56 class CSBrickSheet : public CEntitySheet
58 public:
59 // MaxProperties in Sheet
60 enum {MaxProperties= 20};
62 // A property of a brick
63 struct CProperty
65 // The whole param in georges.
66 std::string Text;
67 // translated at runTime with CSBrickManager to PropId/Value (not serialised)
68 uint PropId;
69 float Value;
70 float Value2;
72 CProperty()
74 PropId=0;
75 Value= 0.f;
76 Value2=0.f;
79 void serial(NLMISC::IStream &f)
81 f.serial(Text);
85 // The Faber plan For Craft mandatories.
86 struct CFaberPlan
88 CFaberPlan()
90 NbItemBuilt= 0;
91 ToolType = TOOL_TYPE::Unknown;
94 // ItemPartMP: a request for MPs that can build required item part
95 struct CItemPartMP
97 // If a filter is Unknown, then all Mps matchs
98 RM_FABER_TYPE::TRMFType FaberTypeFilter;
99 uint32 Quantity;
101 CItemPartMP()
103 FaberTypeFilter = RM_FABER_TYPE::Unknown;
104 Quantity = 0;
107 void serial (NLMISC::IStream &s)
109 s.serialEnum(FaberTypeFilter);
110 s.serial(Quantity);
115 // FormulaMP: a specific MP (or can be any item) that the faber requires in addition to CItemPartMPs
116 struct CFormulaMP
118 NLMISC::CSheetId ItemRequired;
119 uint32 Quantity;
120 void serial (NLMISC::IStream &s)
122 s.serial(ItemRequired);
123 s.serial(Quantity);
126 CFormulaMP()
128 Quantity = 0;
132 // Faber
133 NLMISC::CSheetId ItemBuilt;
134 std::vector<CItemPartMP> ItemPartMps;
135 std::vector<CFormulaMP> FormulaMps;
136 TOOL_TYPE::TCraftingToolType ToolType;
137 uint32 NbItemBuilt;
140 void serial (NLMISC::IStream &s)
142 s.serial(ItemBuilt);
143 s.serialCont(ItemPartMps);
144 s.serialCont(FormulaMps);
145 s.serialEnum(ToolType);
146 s.serial(NbItemBuilt);
150 // a serializable Skill (special for serial)
151 class CSkillSerial
153 public:
154 SKILLS::ESkills Skill;
156 void serial(NLMISC::IStream &f)
158 f.serialEnum(Skill);
161 CSkillSerial() : Skill(SKILLS::unknown) {}
162 CSkillSerial(SKILLS::ESkills e) : Skill(e) {}
163 CSkillSerial &operator=(SKILLS::ESkills e)
165 Skill= e;
166 return *this;
168 operator SKILLS::ESkills() const {return Skill;}
171 // For progression
172 class CSkillValue
174 public:
175 SKILLS::ESkills Skill;
176 uint32 Value;
178 CSkillValue()
180 Skill = SKILLS::unknown;
181 Value = 0;
184 void serial(NLMISC::IStream &f)
186 f.serialEnum(Skill);
187 f.serial(Value);
191 public:
192 // For Combat only, this array may be >1. One of the skills match for combat
193 // guaranteed to be at least of size 1, with Unknown skill
194 std::vector<CSkillSerial> UsedSkills;
195 BRICK_FAMILIES::TBrickFamily BrickFamily;
196 uint8 IndexInFamily;
197 uint8 Level;
198 NLMISC::TSStringId IdIcon;
199 NLMISC::TSStringId IdIconBack;
200 NLMISC::TSStringId IdIconOver;
201 NLMISC::TSStringId IdIconOver2;
202 NLMISC::CRGBA IconColor;
203 NLMISC::CRGBA IconBackColor;
204 NLMISC::CRGBA IconOverColor;
205 NLMISC::CRGBA IconOver2Color;
206 sint32 SabrinaCost;
207 float SabrinaRelativeCost;
208 // Brick Properties
209 std::vector<CProperty> Properties;
211 std::vector<uint16> MandatoryFamilies;
212 std::vector<uint16> OptionalFamilies;
213 std::vector<uint16> ParameterFamilies;
214 std::vector<uint16> CreditFamilies;
216 // Forbidden Brick KeyWords.
217 NLMISC::TSStringId IdForbiddenDef;
218 NLMISC::TSStringId IdForbiddenExclude;
220 // The Faber Repair/Refine/Create plan
221 CFaberPlan FaberPlan;
223 /// Min/Max Casting Time (1/10sec), and range
224 uint8 MinCastTime;
225 uint8 MaxCastTime;
226 /// Min/Max Range (in meters)
227 uint8 MinRange;
228 uint8 MaxRange;
230 // Brick flags required (0 by default)
231 uint64 BrickRequiredFlags;
233 // The SkillPoint Cost
234 uint32 SPCost;
236 // The Action Nature
237 ACTNATURE::TActionNature ActionNature;
239 // For Progression, the required skills (at least one)
240 std::vector<CSkillValue> RequiredOneOfSkills;
242 // For Progression, the required skills (all of them)
243 std::vector<CSkillValue> RequiredSkills;
245 // For Progression, the required Bricks
246 std::vector<NLMISC::CSheetId> RequiredBricks;
248 // true if a phrase containing this brick can be cyclic
249 bool AvoidCyclic;
251 // if true this brick can't be used when no item in hands
252 bool UsableWithEmptyHands;
254 // Brick civilisation restriction
255 EGSPD::CPeople::TPeople CivRestriction;
257 // faction to check if min fame value != 0
258 uint32 FactionIndex;
260 // min fame value to learn this brick
261 sint32 MinFameValue;
263 // Magic Only: The Domain of this spell (ie The resistance type)
264 RESISTANCE_TYPE::TResistanceType MagicResistType;
266 public:
267 // true if the brick is a Root, according to BrickFamily
268 bool isRoot() const;
269 // true if the brick is a Credit, according to BrickFamily
270 bool isCredit() const;
271 // true if the brick is a Mandatory, according to BrickFamily
272 bool isMandatory() const;
273 // true if the brick is a Optional, according to BrickFamily
274 bool isOptional() const;
275 // true if the brick is a Parameter, according to BrickFamily
276 bool isParameter() const;
278 // return the brick type, according to BrickFamily
279 BRICK_TYPE::EBrickType getBrickType() const {return BRICK_FAMILIES::brickType(BrickFamily);}
280 // true if the brick is Combat Brick, according to BrickFamily
281 bool isCombat() const;
282 // true if the brick is Magic Brick, according to BrickFamily
283 bool isMagic() const;
284 // true if the brick is Faber Brick, according to BrickFamily
285 bool isFaber() const;
286 // true if the brick is Harvest Brick, according to BrickFamily
287 bool isHarvest() const;
288 // true if the brick is Forage Prospection Brick, according to BrickFamily
289 bool isForageProspection() const;
290 // true if the brick is Forage Extraction Brick, according to BrickFamily
291 bool isForageExtraction() const;
292 // true if the brick is SpecialPower Brick, according to BrickFamily
293 bool isSpecialPower() const;
294 // true if the brick is Enchantment Brick, according to BrickFamily
295 bool isProcEnchantment() const;
297 // true if must display the level index
298 bool mustDisplayLevel() const;
300 public:
302 CSBrickSheet ()
304 UsedSkills.push_back(SKILLS::unknown);
305 Type = SBRICK;
306 BrickFamily = BRICK_FAMILIES::Unknown;
307 IndexInFamily = 0;
308 Level = 0;
309 IdIcon = 0;
310 IdIconBack = 0;
311 IdIconOver = 0;
312 IdIconOver2 =0;
313 IconColor= NLMISC::CRGBA::White;
314 IconBackColor= NLMISC::CRGBA::White;
315 IconOverColor= NLMISC::CRGBA::White;
316 IconOver2Color= NLMISC::CRGBA::White;
317 SabrinaCost= 0;
318 SabrinaRelativeCost = 0.0f;
319 IdForbiddenDef = 0;
320 IdForbiddenExclude = 0;
321 MinCastTime= 10;
322 MaxCastTime= 100;
323 MinRange= 1;
324 MaxRange= 10;
325 BrickRequiredFlags= 0;
326 SPCost= 0;
327 AvoidCyclic= false;
328 UsableWithEmptyHands = true;
329 FactionIndex = CStaticFames::INVALID_FACTION_INDEX;
330 MinFameValue = NO_FAME;
331 ActionNature= ACTNATURE::UNKNOWN;
332 CivRestriction= EGSPD::CPeople::Common;
333 MagicResistType= RESISTANCE_TYPE::None;
337 std::string getIcon() const { return ClientSheetsStrings.get(IdIcon); }
338 std::string getIconBack() const { return ClientSheetsStrings.get(IdIconBack); }
339 std::string getIconOver() const { return ClientSheetsStrings.get(IdIconOver); }
340 std::string getIconOver2() const { return ClientSheetsStrings.get(IdIconOver2); }
341 std::string getForbiddenDef() const { return ClientSheetsStrings.get(IdForbiddenDef); }
342 std::string getForbiddenExclude() const { return ClientSheetsStrings.get(IdForbiddenExclude); }
344 // Works For all brick but combat. combat may have more than one Skill
345 SKILLS::ESkills getSkill() const {return UsedSkills[0];}
347 // Georges Std build implementation
348 virtual void build (const NLGEORGES::UFormElm &root);
350 virtual void serial (NLMISC::IStream &s)
352 std::string sTmp;
353 s.serialCont(UsedSkills);
354 s.serialEnum(BrickFamily);
355 s.serial (IndexInFamily);
356 s.serial (Level);
357 s.serial (sTmp);
358 ClientSheetsStrings.serial(s, IdIcon);
359 ClientSheetsStrings.serial(s, IdIconBack);
360 ClientSheetsStrings.serial(s, IdIconOver);
361 ClientSheetsStrings.serial(s, IdIconOver2);
363 s.serial (IconColor);
364 s.serial (IconBackColor);
365 s.serial (IconOverColor);
366 s.serial (IconOver2Color);
367 s.serial (SabrinaCost);
368 s.serial (SabrinaRelativeCost);
369 s.serialCont (MandatoryFamilies);
370 s.serialCont (OptionalFamilies);
371 s.serialCont (ParameterFamilies);
372 s.serialCont (CreditFamilies);
374 ClientSheetsStrings.serial(s, IdForbiddenDef);
375 ClientSheetsStrings.serial(s, IdForbiddenExclude);
377 s.serial (FaberPlan);
378 s.serialCont(Properties);
379 s.serial(MinCastTime);
380 s.serial(MaxCastTime);
381 s.serial(MinRange);
382 s.serial(MaxRange);
384 s.serial(BrickRequiredFlags);
386 s.serial(SPCost);
388 s.serialEnum(ActionNature);
390 s.serialCont(RequiredOneOfSkills);
392 s.serialCont(RequiredSkills);
394 s.serialCont(RequiredBricks);
396 s.serial(AvoidCyclic);
398 s.serial(UsableWithEmptyHands);
400 s.serialEnum(CivRestriction);
402 s.serial(FactionIndex);
404 s.serial(MinFameValue);
406 s.serialEnum(MagicResistType);
412 #endif // NL_SBRICK_SHEET_H
414 /* End of sbrick_sheet.h */