1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010-2020 Winch Gate Property Limited
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.
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 // ***************************************************************************
51 * New Sabrina Brick Sheet def.
52 * \author Lionel Berenguier
53 * \author Nevrax France
56 class CSBrickSheet
: public CEntitySheet
59 // MaxProperties in Sheet
60 enum {MaxProperties
= 20};
62 // A property of a brick
65 // The whole param in georges.
67 // translated at runTime with CSBrickManager to PropId/Value (not serialised)
79 void serial(NLMISC::IStream
&f
)
85 // The Faber plan For Craft mandatories.
91 ToolType
= TOOL_TYPE::Unknown
;
94 // ItemPartMP: a request for MPs that can build required item part
97 // If a filter is Unknown, then all Mps matchs
98 RM_FABER_TYPE::TRMFType FaberTypeFilter
;
103 FaberTypeFilter
= RM_FABER_TYPE::Unknown
;
107 void serial (NLMISC::IStream
&s
)
109 s
.serialEnum(FaberTypeFilter
);
115 // FormulaMP: a specific MP (or can be any item) that the faber requires in addition to CItemPartMPs
118 NLMISC::CSheetId ItemRequired
;
120 void serial (NLMISC::IStream
&s
)
122 s
.serial(ItemRequired
);
133 NLMISC::CSheetId ItemBuilt
;
134 std::vector
<CItemPartMP
> ItemPartMps
;
135 std::vector
<CFormulaMP
> FormulaMps
;
136 TOOL_TYPE::TCraftingToolType ToolType
;
140 void serial (NLMISC::IStream
&s
)
143 s
.serialCont(ItemPartMps
);
144 s
.serialCont(FormulaMps
);
145 s
.serialEnum(ToolType
);
146 s
.serial(NbItemBuilt
);
150 // a serializable Skill (special for serial)
154 SKILLS::ESkills Skill
;
156 void serial(NLMISC::IStream
&f
)
161 CSkillSerial() : Skill(SKILLS::unknown
) {}
162 CSkillSerial(SKILLS::ESkills e
) : Skill(e
) {}
163 CSkillSerial
&operator=(SKILLS::ESkills e
)
168 operator SKILLS::ESkills() const {return Skill
;}
175 SKILLS::ESkills Skill
;
180 Skill
= SKILLS::unknown
;
184 void serial(NLMISC::IStream
&f
)
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
;
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
;
207 float SabrinaRelativeCost
;
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
226 /// Min/Max Range (in meters)
230 // Brick flags required (0 by default)
231 uint64 BrickRequiredFlags
;
233 // The SkillPoint Cost
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
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
260 // min fame value to learn this brick
263 // Magic Only: The Domain of this spell (ie The resistance type)
264 RESISTANCE_TYPE::TResistanceType MagicResistType
;
267 // true if the brick is a Root, according to BrickFamily
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;
304 UsedSkills
.push_back(SKILLS::unknown
);
306 BrickFamily
= BRICK_FAMILIES::Unknown
;
313 IconColor
= NLMISC::CRGBA::White
;
314 IconBackColor
= NLMISC::CRGBA::White
;
315 IconOverColor
= NLMISC::CRGBA::White
;
316 IconOver2Color
= NLMISC::CRGBA::White
;
318 SabrinaRelativeCost
= 0.0f
;
320 IdForbiddenExclude
= 0;
325 BrickRequiredFlags
= 0;
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
)
353 s
.serialCont(UsedSkills
);
354 s
.serialEnum(BrickFamily
);
355 s
.serial (IndexInFamily
);
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
);
384 s
.serial(BrickRequiredFlags
);
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 */