1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 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 CL_SHEET_MANAGER_H
20 #define CL_SHEET_MANAGER_H
27 #include "nel/misc/types_nl.h"
28 #include "nel/misc/smart_ptr.h"
29 #include "nel/misc/progress_callback.h"
31 #include "client_sheets/entity_sheet.h"
32 #include "client_sheets/character_sheet.h"
33 #include "client_sheets/player_sheet.h"
34 #include "client_sheets/fx_sheet.h"
35 #include "client_sheets/forage_source_sheet.h"
36 #include "client_sheets/building_sheet.h"
37 #include "client_sheets/item_sheet.h"
38 #include "client_sheets/pact_sheet.h"
39 #include "client_sheets/plant_sheet.h"
40 #include "client_sheets/mission_sheet.h"
41 #include "client_sheets/mission_icon_sheet.h"
42 #include "client_sheets/race_stats_sheet.h"
43 #include "client_sheets/light_cycle_sheet.h"
44 #include "client_sheets/weather_setup_sheet.h"
45 #include "client_sheets/continent_sheet.h"
46 #include "client_sheets/world_sheet.h"
47 #include "client_sheets/weather_function_params_sheet.h"
48 #include "client_sheets/sbrick_sheet.h"
49 #include "client_sheets/sphrase_sheet.h"
50 #include "client_sheets/skills_tree_sheet.h"
51 #include "client_sheets/unblock_titles_sheet.h"
52 #include "client_sheets/success_table_sheet.h"
53 #include "client_sheets/automaton_list_sheet.h"
54 #include "client_sheets/animation_fx_sheet.h"
55 #include "client_sheets/id_to_string_array.h"
56 #include "client_sheets/emot_list_sheet.h"
57 #include "client_sheets/flora_sheet.h"
58 #include "client_sheets/attack_list_sheet.h"
59 #include "client_sheets/sky_sheet.h"
60 #include "client_sheets/text_emot_list_sheet.h"
61 #include "client_sheets/outpost_sheet.h"
62 #include "client_sheets/outpost_building_sheet.h"
63 #include "client_sheets/outpost_squad_sheet.h"
67 #include "game_share/slot_types.h"
68 #include "game_share/skills.h"
89 * Class to manage all sheets.
90 * \author Guillaume PUZIN
91 * \author Nevrax France
94 class CSheetManagerEntry
98 /// The data which will be filled in readGeorges and serial
99 CEntitySheet
*EntitySheet
;
104 CSheetManagerEntry ();
105 virtual ~CSheetManagerEntry ();
107 /// Load the values using the george sheet
108 void readGeorges (const NLMISC::CSmartPtr
<NLGEORGES::UForm
> &form
, const NLMISC::CSheetId
&sheetId
);
110 /// Load/Save the values using the serial system
111 void serial (NLMISC::IStream
&s
);
113 void initSheet (CEntitySheet
*pES
, NLMISC::IStream
&s
, CEntitySheet::TType type
);
117 * Event to implement any action when the sheet is no longer existent.
118 * This method is called when a sheet have been read from the packed sheet
119 * and the associated sheet file no more exist in the directories.
123 static uint
getVersion();
124 static void setVersion(uint version
);
128 * Class to manage all sheets.
129 * \author Guillaume PUZIN
130 * \author Nevrax France
135 friend class CSheetManagerEntry
;
143 /// this is the structure that hold all the sheets needed
144 typedef std::map
<NLMISC::CSheetId
, CSheetManagerEntry
> TEntitySheetMap
;
146 typedef std::pair
<SLOTTYPE::EVisualSlot
, uint
> TVisualSlotItem
;
147 typedef std::vector
<TVisualSlotItem
> TVisualSlotItemArray
;
150 /// A ptr on a form loader
151 static NLGEORGES::UFormLoader
*FormLoader
;
163 /// \param needComputeVS : if 'true' this will compute the visual slot file too.
164 void load (NLMISC::IProgressCallback
&callBack
, bool updatePackedSheet
, bool needComputeVS
= false, bool dumpVSIndex
= false);
165 /// Load all sheet or a subset of them (if 'extensions' is not NULL, them the extensions list is taken from that vector)
166 void loadAllSheet(NLMISC::IProgressCallback
&callBack
, bool updatePackedSheet
, bool needComputeVS
, bool dumpVSIndex
, bool forceRecompute
= false, const std::vector
<std::string
> *extensions
= NULL
);
167 /// Load all sheet, without packed sheet, and with a wildcard (for reload feature)
168 void loadAllSheetNoPackedSheet(NLMISC::IProgressCallback
&callBack
, const std::vector
<std::string
> &extensions
, const std::string
&wildcardFilter
);
171 * Get a sheet from is number.
172 * \param CSheetId num : sheet number.
173 * \return CEntitySheet * : pointer on the sheet according to the param or 0 if any pb.
175 CEntitySheet
*get(NLMISC::CSheetId num
);
177 /// Get the number of available items for the given visual slot
178 uint
getNumItem(SLOTTYPE::EVisualSlot slot
);
180 /// Get the pointer on an item form from an index.
181 CItemSheet
*getItem(SLOTTYPE::EVisualSlot slot
, uint index
);
183 // Get a pair of visual slots / index from a CItemSheet pointer.
184 const TVisualSlotItemArray
*getVSItems(CItemSheet
*sheet
) const;
186 // From an item name and a slot, get its item, or -1 if not found
187 sint
getVSIndex(const std::string
&itemName
, SLOTTYPE::EVisualSlot slot
);
189 /// Return the number of color available for the eyes.
190 sint
nbEyesColor() {return _NbEyesColor
;}
191 /// Return the number of color available for the hair.
192 sint
nbHairColor() {return _NbHairColor
;}
195 /// Get all sheets (useful for other managers (skill, brick, ...))
197 const TEntitySheetMap
& getSheets() { return _EntitySheetContainer
; }
200 // tmp : dump the visual slots
201 void dumpVisualSlots();
203 /// dump all visual slots indexes in a file
204 void dumpVisualSlotsIndex();
206 /// Set output data path
207 void setOutputDataPath(const std::string
&dataPath
) { _OutputDataPath
= dataPath
; }
209 /// Return output data path
210 const std::string
& getOutputDataPath() const { return _OutputDataPath
; }
212 /// Return the rp item
213 const std::string
&getRpItem(uint32 id
) const
215 if (_RPItems
.size() > id
) {
218 static const std::string empty
;
223 void addRpItem(const std::string
&item
)
225 _RPItems
.push_back(item
);
230 typedef std::vector
<CItemSheet
*> TItemVector
;
231 typedef std::vector
<TItemVector
> TSlots
;
232 typedef std::vector
<std::string
> TRPitems
;
236 // directory where to create .packed_sheets
237 std::string _OutputDataPath
;
242 /// this structure is fill by the loadForm() function and will contain all the sheets needed
243 TEntitySheetMap _EntitySheetContainer
;
246 typedef std::map
<CItemSheet
*, TVisualSlotItemArray
> TItemSheet2SlotItemArray
;
248 // Associate sheet to visual slots
249 TItemSheet2SlotItemArray _SheetToVS
;
252 /** Processing the sheet.
253 * \param sheet : sheet to process.
255 void processSheet (CEntitySheet
*sheet
);
256 /// compute Visual Slots for this sheet.
267 extern CSheetManager SheetMngr
;
270 #endif // CL_SHEET_MANAGER_H
272 /* End of sheet_manager.h */