Use configured resolution for login/outgame/ingame
[ryzomcore.git] / ryzom / client / src / client_sheets / sbrick_sheet.h
blobe44d4d5f52c14d32f2c161e6b6f9bb2deeba46f6
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 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 skill
240 std::vector<CSkillValue> RequiredSkills;
242 // For Progression, the required Bricks
243 std::vector<NLMISC::CSheetId> RequiredBricks;
245 // true if a phrase containing this brick can be cyclic
246 bool AvoidCyclic;
248 // if true this brick can't be used when no item in hands
249 bool UsableWithEmptyHands;
251 // Brick civilisation restriction
252 EGSPD::CPeople::TPeople CivRestriction;
254 // faction to check if min fame value != 0
255 uint32 FactionIndex;
257 // min fame value to learn this brick
258 sint32 MinFameValue;
260 // Magic Only: The Domain of this spell (ie The resistance type)
261 RESISTANCE_TYPE::TResistanceType MagicResistType;
263 public:
264 // true if the brick is a Root, according to BrickFamily
265 bool isRoot() const;
266 // true if the brick is a Credit, according to BrickFamily
267 bool isCredit() const;
268 // true if the brick is a Mandatory, according to BrickFamily
269 bool isMandatory() const;
270 // true if the brick is a Optional, according to BrickFamily
271 bool isOptional() const;
272 // true if the brick is a Parameter, according to BrickFamily
273 bool isParameter() const;
275 // return the brick type, according to BrickFamily
276 BRICK_TYPE::EBrickType getBrickType() const {return BRICK_FAMILIES::brickType(BrickFamily);}
277 // true if the brick is Combat Brick, according to BrickFamily
278 bool isCombat() const;
279 // true if the brick is Magic Brick, according to BrickFamily
280 bool isMagic() const;
281 // true if the brick is Faber Brick, according to BrickFamily
282 bool isFaber() const;
283 // true if the brick is Harvest Brick, according to BrickFamily
284 bool isHarvest() const;
285 // true if the brick is Forage Prospection Brick, according to BrickFamily
286 bool isForageProspection() const;
287 // true if the brick is Forage Extraction Brick, according to BrickFamily
288 bool isForageExtraction() const;
289 // true if the brick is SpecialPower Brick, according to BrickFamily
290 bool isSpecialPower() const;
291 // true if the brick is Enchantment Brick, according to BrickFamily
292 bool isProcEnchantment() const;
294 // true if must display the level index
295 bool mustDisplayLevel() const;
297 public:
299 CSBrickSheet ()
301 UsedSkills.push_back(SKILLS::unknown);
302 Type = SBRICK;
303 BrickFamily = BRICK_FAMILIES::Unknown;
304 IndexInFamily = 0;
305 Level = 0;
306 IdIcon = 0;
307 IdIconBack = 0;
308 IdIconOver = 0;
309 IdIconOver2 =0;
310 IconColor= NLMISC::CRGBA::White;
311 IconBackColor= NLMISC::CRGBA::White;
312 IconOverColor= NLMISC::CRGBA::White;
313 IconOver2Color= NLMISC::CRGBA::White;
314 SabrinaCost= 0;
315 SabrinaRelativeCost = 0.0f;
316 IdForbiddenDef = 0;
317 IdForbiddenExclude = 0;
318 MinCastTime= 10;
319 MaxCastTime= 100;
320 MinRange= 1;
321 MaxRange= 10;
322 BrickRequiredFlags= 0;
323 SPCost= 0;
324 AvoidCyclic= false;
325 UsableWithEmptyHands = true;
326 FactionIndex = CStaticFames::INVALID_FACTION_INDEX;
327 MinFameValue = NO_FAME;
328 ActionNature= ACTNATURE::UNKNOWN;
329 CivRestriction= EGSPD::CPeople::Common;
330 MagicResistType= RESISTANCE_TYPE::None;
334 std::string getIcon() const { return ClientSheetsStrings.get(IdIcon); }
335 std::string getIconBack() const { return ClientSheetsStrings.get(IdIconBack); }
336 std::string getIconOver() const { return ClientSheetsStrings.get(IdIconOver); }
337 std::string getIconOver2() const { return ClientSheetsStrings.get(IdIconOver2); }
338 std::string getForbiddenDef() const { return ClientSheetsStrings.get(IdForbiddenDef); }
339 std::string getForbiddenExclude() const { return ClientSheetsStrings.get(IdForbiddenExclude); }
341 // Works For all brick but combat. combat may have more than one Skill
342 SKILLS::ESkills getSkill() const {return UsedSkills[0];}
344 // Georges Std build implementation
345 virtual void build (const NLGEORGES::UFormElm &root);
347 virtual void serial (NLMISC::IStream &s)
349 std::string sTmp;
350 s.serialCont(UsedSkills);
351 s.serialEnum(BrickFamily);
352 s.serial (IndexInFamily);
353 s.serial (Level);
354 s.serial (sTmp);
355 ClientSheetsStrings.serial(s, IdIcon);
356 ClientSheetsStrings.serial(s, IdIconBack);
357 ClientSheetsStrings.serial(s, IdIconOver);
358 ClientSheetsStrings.serial(s, IdIconOver2);
360 s.serial (IconColor);
361 s.serial (IconBackColor);
362 s.serial (IconOverColor);
363 s.serial (IconOver2Color);
364 s.serial (SabrinaCost);
365 s.serial (SabrinaRelativeCost);
366 s.serialCont (MandatoryFamilies);
367 s.serialCont (OptionalFamilies);
368 s.serialCont (ParameterFamilies);
369 s.serialCont (CreditFamilies);
371 ClientSheetsStrings.serial(s, IdForbiddenDef);
372 ClientSheetsStrings.serial(s, IdForbiddenExclude);
374 s.serial (FaberPlan);
375 s.serialCont(Properties);
376 s.serial(MinCastTime);
377 s.serial(MaxCastTime);
378 s.serial(MinRange);
379 s.serial(MaxRange);
381 s.serial(BrickRequiredFlags);
383 s.serial(SPCost);
385 s.serialEnum(ActionNature);
387 s.serialCont(RequiredSkills);
389 s.serialCont(RequiredBricks);
391 s.serial(AvoidCyclic);
393 s.serial(UsableWithEmptyHands);
395 s.serialEnum(CivRestriction);
397 s.serial(FactionIndex);
399 s.serial(MinFameValue);
401 s.serialEnum(MagicResistType);
407 #endif // NL_SBRICK_SHEET_H
409 /* End of sbrick_sheet.h */