Linux multi-monitor fullscreen support
[ryzomcore.git] / ryzom / client / src / r2 / dmc / client_edition_module.h
blob662dddeb655c28f732c2bbb8646b991c40c1c084
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/>.
17 #ifndef R2_CLIENT_EDITON_MODULE_H
18 #define R2_CLIENT_EDITON_MODULE_H
20 #include "nel/misc/types_nl.h"
22 #include "nel/net/module.h"
23 #include "nel/misc/md5.h"
24 #include "game_share/r2_share_itf.h"
25 #include "game_share/dyn_chat.h"
26 #include "game_share/scenario.h"
28 #include <memory>
31 namespace R2
33 class CObject;
34 class CDynamicMapService;
35 class CDynamicMapClient;
36 class CPalette;
37 class CTranslationModule;
38 class CScenario;
39 class CObjectFactory;
41 class CPropertyAccessor;
42 class CUserComponent;
43 class CEmoteBehavior;
44 class CEditorConfig;
45 class CScenarioValidator;
46 class CUserComponentValidator;
47 class CServerAnswerForseener;
52 Small class used to Send information in multiPacket
55 class IMessageSender
57 public:
58 virtual void operator()(const NLNET::CMessage& msg) = 0;
59 virtual ~IMessageSender(){}
63 class CMessageSpliter
65 public:
66 static void sendSplitedMsg(uint32 charId, const NLNET::CMessage& msg, IMessageSender& sender);
73 /**
74 The main goal of this class is to communicates with the DSS, so the CEditor class will no need to know specific server communication.
75 This class hold the scenario that is synchronised with DSS. This class is also used to transform High Level edition data to data that can be understand by ais.
77 I) Data
78 Most of edition data are kept in a the Scenario Tree. This tree contains nodes that are made with a generic data structure. This data are easy to changes and are light to send
79 to network (generic compression and application specific compression)
81 Scenario Tree
83 - _Scenario (CScenario)
84 The main data tree is the CScenario class. It contains high level data (scenario / act / components) that are updated, changed by CEditor / lua code.
85 He contains animation data (that are very similar to primitive data) that is use to run animation (to feed ais).
86 The lua function r2:translator is use to creat animation data from High level data.
87 It contains the notion of palette that is use to insert new element.
88 It contains an InstanceMap to give quick access to tree node.
89 This tree is synchronized between client and server. In a simplified model, client would send a message to server that would change his data tree
90 then call back the client that would do the same update in order to keep boot data synchronized.
93 Data Node
95 - CObject
96 - CObjectString
97 - CObjectNumber
98 - CObjectTable
99 This generic data structure is used to manipulate data, it's look like (number, string , table).
100 You can add, element, remove element, move element, insert element in the table.
101 You can set value of an element.
104 Compression
106 - CSerializerClass
107 - CObjectSerializerServer
108 CObjectSerializerServer is used to compress data in order that the serial function to be the quickest possible.
109 The function CObjectSerializerServer::compress must call to use generic (zlib) compression. The uncompress function is call when read function is needed.
110 Other data specific compression is done via serial function. We can define SerializerClass for specific Node. Inded if we know needed property then it is not useful to send property name in data stream.
111 If we know optional property name we only send the index in optional property table. We only send the property name if we do not know by the property name.
112 Other optimisation are done. we use the shortest type that can hold the data (unsigned char, short, fixed point variable...)
113 To have C++ CSerializerClass synchronized with lua element is needed in order to keep data the shortest. It is not the case now so data could be optimized ( divided by 3 bandwith?).
115 - CScenario
118 II) Data modification
120 Data BandwidthThe edition tree is synchronized between the client and the server. Bandwidth, genericity and speed of reaction was kept in mind during the conception.
122 Simple Node Modification:
124 - requestSetNode
125 - requestSetNodeNoTest
126 - requestEraseNode
127 - requestInsertNode
128 - requestMoveNode
129 This function are called by CEditor. CEditor modify its local tree then send the modification to server via these functions.
130 If we change a Ghost Node. We forward the call directly to CEditor that apply the modification.
131 If we change a Node with the same value then the messge is not send (bandwith optimisation).
133 - CServerAnswerForseener::onNode(Set|Erased|Inserted)
134 We create an unique MessageId for each message we send via CServerAnswerForseener that cached data.
136 - ackMsg
137 - onScenarioUploaded
138 - onNodeSet
139 - onNodeInserted
140 - onNodeErased
141 - onNodeMoved
142 We send a message to the Server. If the node modification is accepted by the server. The server send an ACK to the client that has send the initial message.
143 ( so the client can apply the message with _ServerAnswerForseener backuped message). The server forward the message to other client connected to edition.
145 - setMute
146 Because multiEdition is disable, most of the time the server answer is not listen. We use the setMute function to not listen server result.
149 Heavy modifications:
150 - requestUploadScenario(CObject* scenario);
151 If we want to update the scenario (uploading of scenario from file, start an animation). Uploading the scenario would be to heavy if use classic communication (via FE).
152 Inded FE has limited band width.
154 - sendMsgToDss
155 The solution is to cut packets via sendMsgToDss This functions cut the message then send it to dss via SBS.
156 The SBS has no bandwidth limitation.
158 - multiPartMsgHead
159 - multiPartMsgBody
160 - multiPartMsgFoot
161 Dss calls the client back to let him know the percentage of data received (multiPartMsgHead, multiPartMsgBody, multiPartMsgFoot).
162 Then C++ calls lua back with "r2:onMessageSending(Start|Update|Finish)". Lua print a string that show the percentage of data upload (must be changed to show download bar).
164 III) Communication Client/Server
165 Modification is done between client and server by differents ways.
166 - CModule communication (hand writtedn message and generated messges)
167 - Modification of Database.
171 CModule communication
173 CClientEditionModule is a Nel module (it inherits from NLNET::CModuleBase) so can know if other module are up or down
174 - CClientEditionModule: the Client module (use to communicates with the DSS)
176 The client can know when DSS Module are up or down _ServerEditionProxy and _ServerAnimationProxy are used as proxy to the dss updated by this functions.
177 - onModuleDown, onModuleUp: enable to know if a module is up or down, update the state of _ServerEditionProxy and _ServerAnimationProxy
179 The client communicates with two dss modules: ServerEditionModule, ServerAnimationModule. He use _ServerEditionProxy and _ServerAnimationProxy has proxy to communicates with the dss..
180 - "ServerEditionModule": data tree modification, main dss functionalities
181 - "ServerAnimationModule": mainly DM functions
183 Hand written function are received by onProcessModuleMessage (this is old messages that have not been updated to the new module system like "ADV_CONN" message)
184 - onProcessModuleMessage : handle hand written message received by client
185 Main messages are
186 - "ADV_CONN": full update to a scenario. (connection to a new session or the client chose to change the editor mode edition, test...)
187 - "HELLO" : the DSS open its firewall so client is allowed to speak to him.
188 - other obsolete message like string table manipulation
190 Communication between CClientEditionModule and CServerEditionModule is mainly done via generated module messages.
191 We use the file "r2_share/r2_share_itf.xml" to add / remove communication.
192 This file is used to generated "game_share/r2_share_itf.h" and "r2_share/r2_share_itf.cpp".
193 CClientEditionModule inherits from CShareClientEditionItf and Server(Edition|Animation)Module inherit from CShareServer(Edition|Animation)Itf.
194 Itf files are definied in r2_share/r2_share_itf.h.
195 f we want to add a method that can be call by server via ModuleProxy we had it in CShareClientEditionItf, if we want to add a function called by client in DSS
196 we add it in CShareServerAnimationtf or CShareServeerEditionItf.
197 e.g.
198 <module_interface name="CShareServerEditionItf" module_class='"ServerEditionModule"'>
199 <method name="onNodeEraseAsked" msg="SNEA">
200 <doc line="The client request to erase a node on a hl scenario."/>
201 <param type="uint32" name="msgId"/>
202 <param type="std::string" name="instanceId" byref="true"/>
203 <param type="std::string" name="attrName" byref="true"/>
204 <param type="sint32" name="position"/>
205 </method>
206 </module_interface>
208 Client would send message to dss via
209 CShareServerEditionItfProxy proxy(_ServerEditionProxy);
210 proxy.onNodeEraseAsked(this, messageId, instanceId, attrName, position);
212 CServerEditionModule must implement the function to handle the client (and also to compile because this function is defined as pure virtual from the generated class he inherits)
213 virtual void onNodeEraseAsked(NLNET::IModuleProxy *senderModuleProxy, uint32 messageId,
214 const std::string& instanceId, const std::string& attrName, sint32 position)
216 IV) Connection to Edition
219 V) From Edition to test
221 We have seen previously how to create / update scenario.
222 First we ask the server the permission to startTheScenaro
223 - requestStartScenario: Ask the server the permission to start a scenario
224 The dss answer to all client connected to the scenario with the startingScenario function that has as parameter the charId of the client that has send the request.
225 - startingScenario: server indicates to all client connected that the scenario is about to start so client must go to test mode
226 If the client is not the one that has send the request then the editor quit the edition modes to go to test mode (in a waiting for secenario state)
227 If the client is the one that has send the request he begins the translation, then start the translation of the scenario then the upload
228 - CComLuaModule::loadLocal load the current scenario from the saved file
229 - CComLuaModule::translateFeatures execute the translation process that create RtData
230 - CShareServerEditionItfProxy::startScenario upload the RtData and ask the server to start the scenario
231 When the Dss receive the startScenario message he broadcast to other connecteds client
232 - startScenario: call by dss to signify the result of a CShareServerEditionItfProxy::startScenario return false in case of failure e.g. to much entities in the scene
234 When the user want to go from test back to edition he must first stop the current test (depop entites)
235 - requestStopTest: ask the dss to depop entities
236 Then you have to ask Reconnection to the edition session.
240 VI) Test / DM functions
242 During animation session or test mode. The DM has access to some "DM" function.
243 He can tp himself to a specific position (also accessible in edition mode)
244 - requestTpPosition: teleport the editor / Dm to a specific position
245 He can trigger "User Triggers" that belongs to the current scenario during edition mode.
246 - getUserTriggers: get the list of description of different user trigger of the current scenario (animation only function)
247 - requestTriggerUserTrigger: trigger a user trigger
248 He can change the current act
249 - getRuntimeActs() : return act description
250 - requestStartAct(): ask the DSS to start another act
251 - updateActPositionDescriptions(): update the description of acts
252 He can use DM function such teleport himself to another character
253 - requestTeleportOneCharacterToAnother: teleport the dm to another plyer character.
254 He can dynamically change the Weather or the Season.
255 - requestSetWeather: change the current weather at runtime or edit mode
256 - requestSetSeason: change the current season at runtime or edit mode, need loading screen
258 Most of dm function are done via the dssTarget function. Indeed dssTarget without option
259 Update the dm commands that are enable on the current target.
260 Tbe bitfield returned let us know if the selected target is a botobject, if it is grouped, if we can incarnate him and so.
261 - dssTarget: without parameter ask the server to update the list of command that are enable on the selected target
262 - onProcessModuleMessage with "NPC_APROP" message: return a bitfield that let know animation property of the selected entity
263 - CDynamicMapClient::onNpcAnimationTargeted: translate the bitfield given by the "NPC_APROP" message to known which are the allowed action
264 - r2:updateAnimBarActions: called by CDynamicMapClient::onNpcAnimationTargeted, update the anim bar that contains action that can be done on the selecte npc
266 The DM can push button on the anim bar to do some DM functions like kill an npc, kill a group, despawn, heal, control, speak as
267 - dssTarget with a parameter DESPAWN_NPC, ADD_HP, KILL_NPC, ADD_HP, GRP_KILL, GRP_HEAL, CONTROL, STOP_CONTROL, TALK_AS, STOP_TALK let the dm do dm functions.
269 CONTROL / STOP_CONTROL
270 The DM can incarnate a npc: in this case he is tp at the npc position, he takes the speed of the npc.
271 The controlled npc would follow the DM and have the same behavior (emote...)
272 A DM can control one npc at a time.
273 - updateIncarningList: called by dss to update the list of npcs incarned by the dm
274 - dssTarget CONTROL or STOP_CONTROL parameter control / stop the control of one npc by the dm
275 - getIncarnatingList(): get the list of npc we control as (updated by updateIncarningList)
276 The teleportation is done in the CComLuaModule::luaDssTarget with "CONTROL" parameter.
277 It is just a local change of position. Which mean that we change the position of the current player on the client side.
278 The position is validate by the GPMS because he is friendly in Ring Shard. The client is not ban.
279 if there is already a npc controled than a message is send with the systemMsg with "uiR2EDAlreadyIncarningANpc" msg
280 When we control a npc the EGS change the "SERVER:USER:NPC_CONTROL:WALK", "SERVER:USER:NPC_CONTROL:RUN", "SERVER:USER:NPC_CONTROL:SHEET" properties
281 from the database. So during the mainloop the CUserEntity::updateNpcContolSpeed can change the dm speed.
282 When a npc is controlled and we can "speak as" the npc. We speak as the npc.
283 - CServerAnimationModule handle the controlled list (see CServerAnimationModule::setIncarningPlayer)
284 - Ais handle the notification of the death of bot (useful for updating the list of controlled bot) (see CAisWrapper::askBotDespawnNotification)
285 - Ais handle the control of a npc by a player (see CAisControl)
287 TALK_AS / STOP_TALK
288 When a npc speak as on other entity. A new dynamic channel is created. This new dynamic chat has the name of the controlled npc.
289 Each Sentence that the npc would say is written in this dynamic channel.
290 - dssTarget TALK_AS or STOP_TALK parameter begin / stop the control of npc talk
291 - getTalkingAsList(): get the list of npc we talk as (updated by updateTalkingAsList)
292 - updateTalkingAsList: called by dss to update the list of npcs incarned by the dm
293 - CStringManagerModule handle to the management of channels (see CStringManagerModule::talkAs)
294 - CServerAnimationModule handle the management of list (CServerAnimationModule::setTalkingAsPlayer)
295 - Ais handle the notification of the death of bot (useful for updating the list of controlled bot) (see CAisWrapper::askBotDespawnNotification)
297 ADD_HP / KILL_NPC / ADD_HP / GRP_KILL / GRP_HEAL
298 It is possible for the Dm to add/remove hp to a group/npc.
299 - dssTarget with ADD_HP ok KILL_NPC or GRP_KILL or GRP_HEAL as parameter: heal/kill a npc/group
300 Note: CServerAnimationModule will call CAiWrapper::setGrpHPLevel, CAiWrapper::setHPLevel that will call Ais native function (nf_npc_grp.cpp)
301 Theses native functions set the life of a npc.
302 Its simple to add other AIS native function the same way.
304 There is some functions that can download the current string table (text that can be said by different npc)
305 So the dm can change some in order to change what the npc has to say.(b.e. to let the npc to have a more RP text).
306 Warning! Gui for string table manipulation has not be done. And the code has not be tested.
307 These functions may be obsolete
308 - requestStringTable: ask the server to give a table of id of the differents texts that can be said by npcs.
309 - requestStringValue: get the content of a text by a TextId given by requestStringTable
310 - requestSetStringValue: set at run time a text said by a npc by its id given by requestStringTable
311 - requestStopTalkA: stop the control of npc
312 - onProcessModuleMessage : The return for dss is done via message "stringTable", "stringValue", "id"
316 VII) From test to edition
318 First you have to ask the server to stop the test.
319 - requestStopTest : make the DSS stop the current test (depop entities) use the proxy Command CShareServerEditionItfProxy::stopTestRequested
320 Then you have to reconnect to edition session. That means that you will change the CEditor mode in order to be able to put new object.
321 - requestReconnection: re init the editor in order to reload edition data.
322 The previous function call requestMapConnection. With parameter that says that we do not want to be tp at the entry point of the scenario. And that it is not necessary to download
323 the scenario because the client stile have it in cache.
324 - requestMapConnection: ask the server to reset the editor, we can indicates if we want the caller to come back to the start Position. We can also indicates if we want
325 the server to upload the scenario content ( or if the client use the one he has in cache)
326 - onAdventureConnected: called by the DSS when the client has done a requestMapConnection. It resest the edition in the correct edition mode. (also call when the client connect to a specific session)
329 VIII) Save and load
331 All save, and load of scenarios need to be done with asynchronous Message. Loading of a file, or saving a file can not be done directly because we need the server validation.
332 Indeed a md5 of the file is done. A hash is done between this md5 and a private key hold by the server. This process generates a signature that is put back in the file.
333 In order to verify if we are allowed to load a file. The md5, and the signature is send to the DSS to test with its privates key if the signature and
334 the md5 are valide.
335 In order to save a file, it is needed to send the md5 the server will return the signature, headers information is also send. Indeed some verifications
336 are made with this header. A non :DEV: account can not save some its scenario with special options. (Acked client)
339 Headers infos are info contained in a lua file that can be read without (lua interpretation). This kind of information is realy fast to load.
340 Save / Loading a file are done by lua function "r2.load", "r2.save".
341 This functions calls CComLuaModule::load, CComLuaModule::save
342 The function addToLoadList put the loaded file in memory and ask the dss the permition to load the file.
343 When the server accept or refuse the loading of the file the callback CScenarioValidatorLoadSuccededCallback is called.
344 - addToLoadList: add a file to a loading
345 - CScenarioValidatorLoadSuccededCallback: callback called when loading of a file (from addToLoadList) has been accepted / refuse by server
346 The server send 2 message loadScenarioFileAccepted, saveScenarioFileAccepted these messages are use to trigg the callback CScenarioValidatorLoadSuccededCallback
347 loadScenarioFileAccepted: answer from server to indicates if the loading of a file has been accepted (in awnswer from addToLoadList)
348 saveScenarioFileAccepted: answer from server to indicates if the save of a file has been accepted (in awnswer from addToSaveList)
350 If an animation scenario is loaded (from ring access poing) loadAnimationSucceded is called.
351 If an edition scenario is loaded loadScenarioSucceded is called.
352 - CComLuaModule::luaLoadAnimation call addToLoadList with CLoadAnimationSucceded callback, which call loadAnimationSucceded
353 - CComLuaModule::luaLoad call addToLoadList with CLoadScenarioSucceded callback, which call loadAnimationSucceded
354 - CLoadScenarioSucceded and CLoadScenarioSucceded inherits from CScenarioValidatorLoadSuccededCallback
355 The save process need also to extract header to send them to server for more verification.
356 - CComLuaModule::luaSave call addToSaveList
359 IX) Change of State
360 ClientEditionModule is directly connect to the DSS. This module holds functions that can be call back though DSS will.
361 One of the aim of this module is to keep state synchronise between client and server.
362 Data synchronisation:
363 - onQuotaUpdated: synchronisation of the quota
364 - updateMissionItemsDescription: synchronisation of mission item descriptions
365 - updateActPositionDescriptions: synchronisation of Act list (use for tp)
366 - updateUserTriggerDescriptions: synchronisation of User trigger liste (used for DM to trigger user trigger)
367 - onCurrentActIndexUpdated: synchronisation of CurrentActIndex (updated when current act changes in edition or animation)
368 State synchronisation:
369 - onCharModeUpdated: change of state of the client (loading / save / test ...)
370 - onDisconnected: the sever chose to disconnect this client
371 - onKicked: the sever chose to kick this client
372 - onTestModeDisconnected: the server ask the client to quit the test mode
373 - onAnimationModePlayConnected: the server inform the client that he must update its GUI to animation mode.
375 X) Getters
376 ClientEditionModule communicates with CEditor, or CComLuaModule. He has some getters to let them know
377 state of variable synchronized with server state.
378 Sessions infos:
379 - getSessionId: get the id of the current session
380 - getAiInstance: get the id of the current AiInstance. One AiInstance is created by session.
381 - getSessionType: get the type of the current session (edition / animation)
382 - isSessionOwner: is the player the owner of the current session
383 - getEditSessionLink: is the current session linked to another session
384 - getScenarioHeader: get header info of current scenario (animation function). Enable to know divers info set into the header of a scenario.
385 Quotas infos:
386 - getMaxNpcs: get the maximal number of npc allowed by scenario.
387 - getMaxStaticObjects: get the maximal number of scenari object allowed by scenario.
388 Plot items:
389 - getSheetIdByPlotItemIndex: get the sheetId of a plot item (animation function)
390 Internal:
391 - getMustStartScenario: if true the scenario will start in the next update loop
392 - getScenarioUpToDate: if false the scenario is not up to date so the update function will be called
396 XI) Divers
397 - onTpPositionSimulated
398 - systemMsg
399 - hasCharacterSameCharacterIdMd5
401 XII) Property accessor
402 void addPaletteElement(const std::string& attrName, CObject* paletteElement);
404 bool isInPalette(const std::string& key) const;
406 CObject* getPropertyValue(const std::string& instanceId, const std::string& attrName) const;
408 CObject* getPropertyValue(CObject* component, const std::string& attrName) const;
410 CObject* getPropertyList(CObject* component) const;
412 CObject* getPaletteElement(const std::string& key)const;
414 CObject* newComponent(const std::string& type) const;
416 void registerGenerator(CObject* classObject);
418 CPropertyAccessor& getPropertyAccessor() const;
421 /////////////////////////////////////////////////////
426 class CClientEditionModule : public NLNET::CModuleBase, public CShareClientEditionItfSkel
428 public:
429 typedef std::vector< std::pair< std::string, std::string > > TScenarioHeader;
431 public:
432 CClientEditionModule();
434 virtual ~CClientEditionModule();
436 void init(NLNET::IModuleSocket* clientGW, CDynamicMapClient* client);
438 void init();
440 void release();
443 /////////////////////////////////////////////////////
444 //// CModuleBase message
445 /////////////////////////////////////////////////////
448 // Module API
449 // empty function needded by CModuleBase api
450 virtual void onServiceUp(const std::string &/* serviceName */, NLNET::TServiceId /* serviceId */) { }
451 virtual void onServiceDown(const std::string &/* serviceName */, NLNET::TServiceId /* serviceId */) {}
452 virtual void onModuleUpdate() {}
453 virtual void onApplicationExit() { }
454 virtual void onModuleSecurityChange(NLNET::IModuleProxy *moduleProxy);
455 virtual void onModuleSocketEvent(NLNET::IModuleSocket * /* moduleSocket */, TModuleSocketEvent /* eventType */) {}
456 virtual bool isImmediateDispatchingSupported() const { return false; }
459 virtual void onModuleUp(NLNET::IModuleProxy *moduleProxy);
460 virtual void onModuleDown(NLNET::IModuleProxy *moduleProxy);
465 //! Data modification - Sending commands
466 //! {
468 /*! Set a node from the current Scenario (in edition Mode)
469 If we update a Ghost Node. The call is forwarded directly to CEditor to apply the update.
470 If we update a Node with the same value then the messge is not send (bandwith optimisation).
471 \param instanceId The instanceId of the node we want to update e.g. "Client2_1235"
472 \param attrName The name of the subAttribut we want to update. Empty string means that we use the node and not a subnode.
473 \param value The value we want to set. The function do not take the ownership of the pointer. Most of time CObject static type is CObjectString or CObjectNumber.
475 void requestSetNode(const std::string& instanceId, const std::string& attrName, CObject* value);
476 /*! Same as requestSetNode \see requestSetNode() but directyl send the message through network (not Ghost test, no local send)
478 void requestSetNodeNoTest(const std::string& instanceId, const std::string& attrName, CObject* value);
481 /*! Erase a node from the current Scenario (in edition Mode)
482 If we update a Ghost Node. The call is forwarded directly to CEditor to apply the update.
483 \param instanceId The instanceId of the node we want to update e.g. "Client2_1235"
484 \param attrName The name of the subAttribut we want to update. Empty string means that we use the node and not a subnode.
485 \param position The position of the element we want to select. The value -1 means that we want to select the currrent node and not a sub element of a CObjectStringTable
487 void requestEraseNode(
488 const std::string& instanceId, const std::string& attrName, sint32 position);
490 /*! Insert a node into the current Scenario (in edition Mode)
491 If we update a Ghost Node. The call is forwarded directly to CEditor to apply the update.
492 \param instanceId The instanceId of the node we want to update e.g. "Client2_1235"
493 \param attrName The name of the subAttribut we want to update. Empty string means that we use the node and not a subnode.
494 \param position The position of the element we want to select. The value -1 means that we want to select the current node and not a sub element of a CObjectStringTable
495 \param key The name of the attribute we want to add
496 \param value The value of the node we want to add (the function does *NOT* take the ownership of the pointer
497 eg requestInsertNode("Client1_1", "", -1, "Menu", &CObjectTable()) //add a subnode
498 eg requestInsertNode("Client1_1", "Menu", -1, "element2", &CObjectNumber(4)) // inser elment in a subnode
499 eg requestInsertNode("Client1_1", "Menu", 1, "element1", &CObjectNumber(4)) // insert element in a subnode at a specific position
501 void requestInsertNode(
502 const std::string& instanceId, const std::string& attrName, sint32 position,
503 const std::string& key, CObject* value);
505 /*! Move a node form the current Scenario from a position to another (in edition Mode)
506 The initial position is defined by instanceId, attrName, position.
507 The final position is defined by desInstanceId, destAttrName, destPosition.
509 void requestMoveNode(
510 const std::string& instanceId, const std::string& attrName, sint32 position,
511 const std::string& desInstanceId, const std::string& destAttrName, sint32 destPosition);
513 /*! Update the RtScenario. The RtScenario is the primitive like scenario that is understable by AIS/EGS.
514 param scenario An Object that contains a RtScenario (a RtScenario contains, RtAct, RtState, and RtEventHandlers)
516 virtual void requestUpdateRtScenario( CObject* scenario);
517 /*! Update the edition scenario *server side*. The scenario is a simple data structure easy to manipulate by the editor
518 \param scenario An Object that contains a RtScenario (a RtScenario contains, RtAct, RtState, and RtEventHandlers)
520 bool requestUploadScenario(CObject* scenario);
521 /*! Update the edition scenario *localy*. The scenario is a simple data structure easy to manipulate by the editor
522 \param scenario An Object that contains a RtScenario (a RtScenario contains, RtAct, RtState, and RtEventHandlers)
524 void updateScenario(CObject* scenario);
525 //! }
530 //! Data modification - Receving commands
531 //! {
532 /*! When received by client this function the function will forseen the answer given by the server to other clients
533 like ...onNode(Inserted|Erased|*) or onScenarioUploaded
534 \param ok If false remove the action from the queue, if true execute the action hold in a buffer.
535 \param messageId The unique message id that enable to execute the buffered message.
537 virtual void ackMsg(NLNET::IModuleProxy *sender, uint32 messageId, bool ok);
538 /*! Server answer from a requestUploadScenario \see requestUploadScenario.
539 Broadcast to all co-editor that a scenario has been uploaded.
540 \param hlScenario The edition scenario (compressed)
542 virtual void onScenarioUploaded(NLNET::IModuleProxy *sender, const R2::CObjectSerializerClient &hlScenario) ;
543 /*! Server answer from a requestSetNode.
544 Broadcast to all co-editor when a node is set
545 Same options than requestSetNode
546 \see requestSetNode
548 virtual void onNodeSet(NLNET::IModuleProxy *sender, const std::string &instanceId, const std::string &attrName, const R2::CObjectSerializerClient &value);
549 /*! Server answer from a requestInsertNode.
550 Broadcast to all co-editor when a node is insert
551 Same options than requestInsertNode
552 \see requestInsertNode
554 virtual void onNodeInserted(NLNET::IModuleProxy *sender, const std::string &instanceId, const std::string &attrName, sint32 position, const std::string &key, const R2::CObjectSerializerClient &value);
555 /*! Server answer from a requestEraseNode
556 Broadcast to all co-editor when a node is erased
557 Same options than requestEraseNode
558 \see requestEraseNode
560 virtual void onNodeErased(NLNET::IModuleProxy *sender, const std::string &instanceId, const std::string &attrName, sint32 position);
561 /*! Server answer from a requestMoveNode
562 Broadcast to all co-editor when a node is moved
563 Same options than requestMoveNode
564 \see requestMoveNode
566 virtual void onNodeMoved(NLNET::IModuleProxy *sender, const std::string &instanceId1, const std::string &attrName1, sint32 position1, const std::string &instanceId2, const std::string &attrName2, sint32 position2);
567 //! }
570 //! Data modification - Data fragmentation
571 //! For some messages, data are cut in small message then send to DSS via SBS.
572 //! Fragmentation enable to implement a progression bar.
573 //! Communication via SBS disable bandwith limitation caused by FS
574 //! Using sendMsgToDss is useful only for big message like uploading Scenario or uploading runtime scenario
575 //! {
576 /*! Cut a messag in small chunk then send it to DSS via SBS.
577 \param msg The message that will be cut in small chunk an send via sbs.
579 void sendMsgToDss(const NLNET::CMessage& msg);
581 /*! Answer from Dss to sendMsgToDss
582 \param msgNam The name of the message as seen in r2_share_itf.xml
583 \param nbPacket The number of packet that will be send
584 \param size The size of the data that will be send.
586 virtual void multiPartMsgHead(NLNET::IModuleProxy *sender, const std::string& msgName, uint32 nbPacket, uint32 size);
588 /*! Answer from Dss to sendMsgToDss (this message always follow multiPartMsgHead)
589 This call back when each chunk of data is received.
590 \param packetId The id of the packet received. First value is 0 last value is nbPacke -1. nbPacket is given by multiPartMsgHead
591 \param nbPacket The number of packet that will be send
592 \param size The size of the data that will be send.
593 \see multiPartMsgHead
594 \see sendMsgToDss
596 virtual void multiPartMsgBody(NLNET::IModuleProxy *sender, uint32 packetId, uint32 packetSize);
598 /*! Answer from Dss to sendMsgToDss (this message always follow multiPartMsgHead and multiPartMsgBody)
599 This call back when each chunk of data is received.
600 \see multiPartMsgHead
601 \see multiPartMsgBody
602 \see sendMsgToDss
604 virtual void multiPartMsgFoot(NLNET::IModuleProxy *sender);
606 /*! setMute Mode. When mute is true then client do not apply scenario update messages. It is not necessary when ther is only on editor
607 \param mute If true the client do not apply onNode(Set|Inset|Moved)
609 void setMute(bool mute);
610 //! }
612 /////////////////////////////////////////////////////
613 //// Edition Mode to test mode
614 /////////////////////////////////////////////////////
615 /*! Edition Mode to test Mode*/
616 //!{
617 /*! Function call back by Dss when a scenario is about to start (after startScenario and request).
618 \see startingScenario
619 \param ok If true the scenario is about to start change the gui. If false go back in edition mode.
620 \param startAct The start act. In edition we start test from the current Act.
621 \param errorReason If the session owner was unable to start the session ( error in translation) a description message is send.
623 void startScenario(class NLNET::IModuleProxy * proxy, bool ok, uint32 startAct, const std::string & errorReason);
624 /*! This message appears short after requestStartScenario: the main animator will upload data and the other will draw a waiting screen
625 When this message hapends the editor change is Gui. If the player is the session owner he will upload data.
626 \param charId The id of the player that has "clicked" on a go start button
627 \see requestStartScenario
629 void startingScenario(class NLNET::IModuleProxy * proxy, uint32 charId);
630 //! The User ask the dss to start an animation/test scenario (the user click on the "Go Test" button)
631 bool requestStartScenario();
632 //!}
634 /////////////////////////////////////////////////////
635 //// Test Mode to edition mode
636 /////////////////////////////////////////////////////
638 //! Ask the stop of the Animation / Test. Send a message to AIS to unload data.
639 void requestStopTest();
641 /*! Ask the connection to an edition session.
642 \parm scenarioId The session number to which we want to connect.
643 \param mustTp If true then the player is teleport to the start of act when the scenario finish to download
644 \param mustUpdateHighLevel If false then the scenario is not download but is reload from buffer.
646 void requestMapConnection( uint32 scenarioId, bool mustTp = true, bool mustUpdateHighLevel = true );
648 /*! Same as requestMapConnection(currentScenarioId, true, false);
649 \see requestMapConnection()
651 void requestReconnection();
653 /*! Sever answer to requestMapConnection. Updates the gui.
654 \param userSlot The slot Id of the user. If one editor userSlotId equal 1.
655 \param scenarioId The id of the scenario we want to connect
656 \param connectedAs The state of the client when he connect (edition, animation
658 void onAdventureConnected(uint32 userSlotId, uint32 scenarioId, uint32 connectedAs, CObject* scenario );
659 //!}
662 /////////////////////////////////////////////////////
663 //// DM / Animation function
664 /////////////////////////////////////////////////////
665 // Function use in test/animation
666 //!{
668 /*! DM function to start another act (and stop the current).
669 This function is linked to gui with the button to change (The current Act).
670 If the next act is at the same location npc of current act will depop then npc from next act will pop.
671 If the two act are at different location then all member of the session are telported to the next act.
672 Accessible by the DM tool bar.
673 \param
675 void requestStartAct(uint32 actId);
677 /*! DM function that
679 const TActPositionDescriptions& getRuntimeActs() const { return _ActPositionDescriptions; }
682 DM function that enable the dm to teleport to another character (player).
683 (Right click in the participant list)
684 \param sessionId The id of the session
685 \param sourceCharId The id of the character that will be teleport
686 \param destCharId The id of the character where the player will be teleport
688 bool requestTeleportOneCharacterToAnother(uint32 sessionId, uint32 sourceCharId, uint32 destCharId);
691 DM function that enable the dm to trigger an user trigger
692 The list of trigger description is updated at start of scenario by updateUserTriggerDescriptions
693 The access to this function is don via the action bar of a DM.
694 \param actId The act where the trigger is defined (0 = permanent content)
695 \param triggerId The id of the trigger to launch
696 \see updateUserTriggerDescriptions
698 bool requestTriggerUserTrigger(uint32 actId, uint triggerId);
701 Function called by the DSS at scenario start during animation. It give the description of UserTrigger of the scenario.
702 This description is used to build the menu in the trigger selecter of DM anim bar.
703 \param userTriggerDescriptions The description of triggers that can be launched by clients
705 virtual void updateUserTriggerDescriptions(NLNET::IModuleProxy *sender, const TUserTriggerDescriptions &userTriggerDescriptions);
708 Returns the descriptions of differents User trigger that can be launch by DM
709 \see TUserTriggerDescriptions
710 \see TUserTriggerDescription
711 \return The description of user triggers
713 const TUserTriggerDescriptions& getUserTriggers() const { return _UserTriggerDescriptions; }
717 Changes the current weather during animation mode (light...)
718 \param weatherValue The weather value (see client code to known the meaning of this value)
720 void requestSetWeather(uint16 weatherValue);
723 Changes the current season (winter, snow). Not to use to often because changing the season means loading screen
724 \param seasonValue The season value See client code for meaning of this value (0 is automatique)
726 void requestSetSeason(uint8 seasonValue);
729 Teleports the character to the entry point of an act (or to the entry point of current act)
730 \param actId The index of the act. (zero means the current act index)
732 virtual bool requestTpToEntryPoint(uint32 actId = 0);
735 Teleports the character to a specific position
736 \param x, y, z the position to teleport to.
738 virtual void requestTpPosition(float x, float y, float z);
742 /*! Updates the DM admin bar. Send DM commands.
743 Called withou param this function update the DM action bar.
744 Called with as parameter DESPAWN_NPC, ADD_HP, KILL_NPC, ADD_HP, GRP_KILL, GRP_HEAL, CONTROL, STOP_CONTROL, TALK_AS, STOP_TALK it launch DM function
745 \see CClientEditionModule for more info
746 \parm args a list of optional argument may be empty or one of "DESPAWN_NPC" "ADD_HP" "KILL_NPC" "ADD_HP" "GRP_KILL" "GRP_HEAL" "CONTROL" "STOP_CONTROL" "TALK_AS" "STOP_TALK". Multi param could be useful for setting the aggro distance (NIY).
748 void dssTarget( std::vector<std::string>& args);
751 /*! Called by Dss when a npc is incarned. It synchronized the list of incarnated bot.
752 This list is shown on the own left of the scenn near the DM Action bar.
753 \param botId The updated list of id of npc controlled
755 void updateIncarningList(NLNET::IModuleProxy *sender, const std::vector<uint32> & botId);
757 /*! Called by Dss at start when a npc talk is controlled. It synchronized the list of controle bot.
758 This list is shown on the own left of the scenn near the DM Action bar.
759 \param botId The updated list of id of npc controlled
761 void updateTalkingAsList(NLNET::IModuleProxy *sender, const std::vector<uint32> & botId);
763 /*! Gets the list of Incarning Bot (this list is updated by updateIncarningList called by server)
764 \see updateIncarningList
766 std::vector<uint32> getIncarnatingList() const;
768 /*! Gets the list of Controlled Bot (this list is updated by updateTalkingAsList called by server)
769 \see updateTalkingAsList
771 std::vector<uint32> getTalkingAsList() const;
778 OBSOLETE, NIY, Not tested
779 This function enable to dynamically manage string table of a scenario.
780 It can let a DM dynamically change the dialog of npcs.
784 virtual void requestTalkAs(const std::string& npcname);
786 virtual void requestStopTalkAs();
788 virtual void requestStringTable();
790 virtual void requestSetStringValue(std::string& id,std::string& value );
792 virtual void requestStringValue(std::string& localId );
794 virtual void requestIdList();
801 /////////////////////////////////////////////////////
802 //// Save / Loading functions
803 /////////////////////////////////////////////////////
807 All save, and load of scenarios need to be done with asynchronous Message. Loading of a file, or saving a file can not be done directly because we need the server validation.
808 Because we need the server to allow a files or to sign scenarios.
809 see \see CClientEditionModule from more infos
811 Save / Loading functions
814 /*! add a scenario file to the Saving queue. The param of this function are the name of the file and Header info.
815 This function is called by a lua wrapper that load header infos from filename.
816 \see CComLuaModule::luaLoad
817 \param filename The name of the file to load.
818 \param values The header infos.
820 void addToSaveList(const std::string& filename, const std::vector< std::pair < std::string, std::string> >& values);
822 /*! Adds a scenario file to the loading queue.
823 The param of this function are the name of the file and a Functor that will be called when the loading is finished. (The loading is a asyncrhonous proccess)
824 \see CComLuaModule::luaLoad
825 \param filename The name of the file to load.
826 \param cb The functor that is called when the file is loaded.(can be null)
827 \see CScenarioValidatorLoadSuccededCallback
829 virtual bool addToLoadList( const std::string& filename, CScenarioValidatorLoadSuccededCallback* cb=0);
831 /*! DSS message that indicates if the loading of the scenario was allowed or not by the server
832 \param md5 The md5 of the file that we wanted to load.
833 \param ok If true the server has allowed the loading of the file otherwise the server has refused ( maybe the file was manually changed).
835 virtual void loadScenarioFileAccepted(NLNET::IModuleProxy *senderModuleProxy, const std::string& md5, bool ok);
838 /*! DSS message that indicates if the save of the scenario was allowed or not by the server
839 \param md5 The md5 of the file that we wanted to save.
840 \param signature The signature of the file. This value must be added to the file in order to be sure that the file was not manually generated/
841 \param ok If true the server has allowed the save of the file otherwise the server has refused ( maybe try to save the scenario with LD specific options).
843 virtual void saveScenarioFileAccepted(NLNET::IModuleProxy *senderModuleProxy, const std::string& md5, const std::string& signature, bool ok);
848 User Component load/save mehods
850 virtual void addToUserComponentSaveList(const std::string& filename, const std::vector< std::pair < std::string, std::string> >& values, std::string &body);
851 virtual void saveUserComponentFileAccepted(NLNET::IModuleProxy *senderModuleProxy, const std::string& md5, const std::string& signature, bool ok);
852 virtual void loadUserComponentFileAccepted(NLNET::IModuleProxy *senderModuleProxy, const std::string& md5, bool ok);
853 virtual bool addToUserComponentLoadList( const std::string& filename, CUserComponentValidatorLoadSuccededCallback* cb=0);
856 void loadScenarioSucceded(const std::string& filename, const std::string& body, const CScenarioValidator::TValues& values);
858 void loadAnimationSucceded(const std::string& filename, const std::string& body, const CScenarioValidator::TValues& values);
866 virtual bool onProcessModuleMessage(NLNET::IModuleProxy *senderModuleProxy, const NLNET::CMessage &message);
869 virtual void scheduleStartAct(NLNET::IModuleProxy *sender, uint32 errorId, uint32 actId, uint32 nbSeconds);
873 uint32 getCurrentActIndex() const { return _CurrentActIndex; }
879 void updateScenarioRingAccess(bool ok, const std::string& ringAccess, const std::string& errMsg);
881 std::string getCharacterRingAccess() const;
883 virtual void onRingAccessUpdated(NLNET::IModuleProxy *sender, const std::string &ringAccess) ;
886 void requestStopAct();
888 void requestCreatePrimitives();
890 void requestCreateScenario(CObject* scenario);
895 Property accessor.
896 This system enables to register class definition by registerGenerator.
897 Then the call to newComponent generates a CObjectTable using the template that have been save by registerGenerator.
898 The method getPropertyValue on a CObjectTable first look in the table of the object. Then in the palette. Then in its default value of the property then an thoses of his parents.
899 The function getPropertyList enables to know all properties of an object (useful for debug)
901 You can add an palette Element to the editor by addPaletteElement. A palette element is like a template that you clone and put in the scene.
902 Palette element are mainly defined in r2_palette.lua (binding is done via CComLuaModule
903 You can check if a paletteId (eg "palette.entities.botobjects.fo_s2_bigroot_a") has already been defined.
910 /////////////////////////////////////////////////////
911 //// Palette / Property accessor
912 /////////////////////////////////////////////////////
914 //! Palette / Property accessor
915 //! {
916 /*! Registers a palette Element. A palette element is like a template that can be clone. They are defined in "r2_palette.lua". And accessible via the Gui through the "Palette" Component.
917 \param attrName A unique paletteId like palette.entities.botobjects.fo_s2_bigroot_a"
918 \param paletteElement The template that will be register in the system
920 void addPaletteElement(const std::string& attrName, CObject* paletteElement);
923 Test if a palette id has been registered.
924 \param key A paletteId like "palette.entities.botobjects.fo_s2_bigroot_a"
926 bool isInPalette(const std::string& key) const;
929 Get by its name the value of a property of an object identified by its instance id.
930 \param instanceId The instanceId of the object.
931 \param attrName The name of the property.
933 CObject* getPropertyValue(const std::string& instanceId, const std::string& attrName) const;
936 Get by its name the value of a property of an object.
937 \param component The object.
938 \param attrName The name of the property.
940 CObject* getPropertyValue(CObject* component, const std::string& attrName) const;
944 Get the list of all property of an object. Mainly used for debug fonction (to dump an object)
945 \param component The object.
946 \return the list of property (an ObjectTable)
948 CObject* getPropertyList(CObject* component) const;
951 Get an element of the palette by its id. A palette element is a kind of template that is clone an put in the current act.
952 Id looks like "palette.entities.botobjects.fo_s2_bigroot_a" and are defined in r2_palette.lua
953 \param key The name of the palette element.
954 \return The palette element that is identified by its name
956 CObject* getPaletteElement(const std::string& key)const;
959 Create a new component by its class. Components are mainly defined in lua in the file r2_components.lua
960 eg "NpcCustom"
961 \param type The class of the component we want to create (like "NpcCustom", "Act"=
962 \return The component that is created.
964 CObject* newComponent(const std::string& type) const;
969 void registerGenerator(CObject* classObject);
971 CPropertyAccessor& getPropertyAccessor() const;
972 //! }
977 CScenario* getCurrentScenario() const;
979 std::string getEid() const { return _Eid; }
981 void setEid(const std::string& eid);
983 TSessionId getCurrentAdventureId() const { return _SessionId; }
985 void setCurrentAdventureId( TSessionId sessionId) { _SessionId = sessionId; }
988 CPalette *getPalette() const { return _Palette; }
990 // incoming message from servers
993 /////////////////////////////////////////////////////
994 //// Component Tooltips
995 /////////////////////////////////////////////////////
996 void resetDisplayInfo();
997 void setDisplayInfo(const std::string& formName, bool displayInfo);
998 bool mustDisplayInfo(const std::string& formName) const;
999 bool hasDisplayInfo(const std::string& formName) const;
1000 virtual void onDisplayInfoUpdated(NLNET::IModuleProxy *senderModuleProxy, uint32 displayInfo);
1002 /////////////////////////////////////////////////////
1003 //// UserComponent (Not Finished)
1004 /////////////////////////////////////////////////////
1006 std::string readUserComponentFile(const std::string& filename);
1008 void registerUserComponent(const std::string& filename);
1010 void updateUserComponentsInfo(const std::string & filename, const std::string& name, const std::string & description,
1011 uint32 timestamp, const std::string& md5hash);
1013 void saveUserComponentFile(const std::string& filename, bool mustCompress = true);
1016 bool loadUserComponent(const std::string& filename, bool mustReload = false);
1018 CUserComponent* getUserComponentByHashMd5( const NLMISC::CHashKeyMD5 & md5) const;
1020 CUserComponent* getUserComponentByFilename(const std::string& filename) const;
1022 virtual void onUserComponentRegistered(NLNET::IModuleProxy *senderModuleProxy, const NLMISC::CHashKeyMD5 & md5);
1024 virtual void onUserComponentUploading(NLNET::IModuleProxy *senderModuleProxy, const NLMISC::CHashKeyMD5 & md5);
1026 virtual void onUserComponentDownloaded(NLNET::IModuleProxy *senderModuleProxy, CUserComponent* component);
1028 std::string getUserComponentExtension() const { return ".lua"; }
1030 std::string getUserComponentCompiledExtension() const { return ".lua.gz"; }
1032 /////////////////////////////////////////////////////
1033 //// Change of state
1034 /////////////////////////////////////////////////////
1037 // End of Test or Animation mode
1038 // Reconnect if sessionType was Edition
1039 void onTestModeDisconnected(NLNET::IModuleProxy *moduleProxy, TSessionId sessionId, uint32 lastAct, TScenarioSessionType sessionType);
1041 // Update the user quota (static quota and dynamic quota)
1042 virtual void onQuotaUpdated(NLNET::IModuleProxy *senderModuleProxy, uint32 maxNpcs, uint32 maxStaticObjects);
1044 // The player mode has changed (he must chagnge its speed)
1045 virtual void onCharModeUpdated(NLNET::IModuleProxy *senderModuleProxy, R2::TCharMode mode);
1047 virtual void onDisconnected(NLNET::IModuleProxy *sender);
1049 virtual void onKicked(NLNET::IModuleProxy *sender, uint32 timeBeforeDisconnection, bool mustKick);
1051 virtual void onAnimationModePlayConnected(NLNET::IModuleProxy *senderModuleProxy);
1053 virtual void updateMissionItemsDescription(NLNET::IModuleProxy *sender, TSessionId sessionId, const std::vector<R2::TMissionItem> &missionItem);
1055 virtual void updateActPositionDescriptions(NLNET::IModuleProxy *sender, const TActPositionDescriptions &actPositionDescriptions);
1059 virtual void updateScenarioHeader(NLNET::IModuleProxy *sender, const TScenarioHeaderSerializer &scenarioHeader);
1061 virtual void onCurrentActIndexUpdated(NLNET::IModuleProxy *sender, uint32 currentActIndex);
1065 /////////////////////////////////////////////////////
1066 //// Divers
1067 /////////////////////////////////////////////////////
1069 virtual void systemMsg(NLNET::IModuleProxy *sender, const std::string& msgType, const std::string& who, const std::string& msg);
1070 // Simulate local a tp
1071 virtual void onTpPositionSimulated(NLNET::IModuleProxy *sender, TSessionId sessionId, uint64 characterId64, sint32 x, sint32 y, sint32 z, uint8 scenarioSeason);
1073 // Verify if the "crypted" charId (xox on bit rotated) is the same user that the current user.
1074 bool hasCharacterSameCharacterIdMd5(const std::string & charIdMd5) const;
1076 std::string getEmoteBehaviorFromEmoteId(const std::string& emote) const;
1078 void setMustStartScenario(bool state){ _MustStartScenario = state; }
1080 void setScenarioUpToDate(bool state) { _ScenarioUpToDate = state; }
1082 bool isServerEditionModuleUp() const {return _ServerEditionProxy != NULL; }
1083 /////////////////////////////////////////////////////
1084 //// Getter
1085 /////////////////////////////////////////////////////
1087 const TScenarioHeader& getScenarioHeader() const { return _ScenarioHeader; }
1090 bool isSessionOwner() const { return _IsSessionOwner; }
1091 // return the EditSession Linked (SessionType == st_anim) if no session are linked return 0;
1092 TSessionId getEditSessionLink() const { return _EditSessionLink;}
1094 TScenarioSessionType getSessionType() const { return _SessionType; }
1096 bool getMustStartScenario() const { return _MustStartScenario; }
1098 bool getScenarioUpToDate() const { return _ScenarioUpToDate; }
1100 uint32 getMaxStaticObjects() const { return _MaxStaticObjects;}
1102 uint32 getSheetIdByPlotItemIndex(uint32 index) const;
1105 TSessionId getSessionId() const { return _SessionId; }
1107 uint32 getAiInsanceId() const { return _AiInstanceId;}
1109 uint32 getMaxNpcs() const { return _MaxNpcs;}
1117 uint32 getCurrentMaxId();
1118 void refreshComponents();
1120 void reserveIdRange(uint32 range);
1123 bool askUpdateCharMode(R2::TCharMode mode);
1126 // set by lua just before a request translate Features
1127 void setStartingActIndex(uint32 startingActIndex);
1129 virtual bool requestSetStartingAct(uint32 actId );
1131 // Connect to a animation session in Play Mode
1132 virtual bool connectAnimationModePlay();
1134 // start an act (if an act is runing start stop the previous one)
1135 bool askMissionItemsDescription();
1137 void resetNameGiver();
1141 private:
1142 typedef std::map<std::string, CUserComponent*> TUserComponents;
1143 typedef std::map<std::string, CScenarioValidator*> TScenarioToSave;
1144 typedef std::map<std::string, CScenarioValidator*> TScenarioToLoad;
1145 typedef std::map<std::string, CUserComponentValidator*> TUserComponentToSave;
1146 typedef std::map<std::string, CUserComponentValidator*> TUserComponentToLoad;
1148 private:
1149 bool _Initialized;
1150 // NLMISC::TTime _LastRefreshComponents;
1151 std::string _ScriptDirectory;
1154 TUserComponents _UserComponents;
1156 CTranslationModule* _TranslationModule;
1157 CScenario* _Scenario;
1158 TScenarioSessionType _SessionType;
1159 CObjectFactory* _Factory;
1160 CPalette* _Palette;
1161 CServerAnswerForseener* _ServerAnswerForseener;
1163 CPropertyAccessor* _PropertyAccessor;
1165 NLNET::TModuleProxyPtr _ServerEditionProxy;
1166 CDynamicMapClient* _Client;
1167 std::string _Eid;
1168 TSessionId _SessionId;
1169 uint32 _MaxNpcs;
1170 uint32 _MaxStaticObjects;
1172 CUniquePtr<R2::CEmoteBehavior> _Emotes;
1175 CEditorConfig* _ClientEditorConfig;
1176 uint32 _StartingActIndex;
1177 TChanID _ChannelId;
1178 // NLNET::IModuleSocket* _ClientGw;
1179 // NLNET::TModuleId _ServerAnimationModuleId;
1180 NLNET::TModuleProxyPtr _ServerAnimationProxy;
1181 TActPositionDescriptions _ActPositionDescriptions;
1182 TUserTriggerDescriptions _UserTriggerDescriptions;
1183 uint32 _CurrentActIndex;
1185 std::vector<uint32> _IncarnatingList;
1186 std::vector<uint32> _TalkingAsList;
1188 std::string _RingAccess;
1189 bool _Mute;
1191 bool _MustStartScenario;
1192 bool _ScenarioUpToDate;
1194 uint32 _AiInstanceId;
1196 TUserComponentToSave _UserComponentToSave;
1197 TUserComponentToLoad _UserComponentToLoad;
1198 TScenarioToSave _ScenarioToSave;
1199 TScenarioToLoad _ScenarioToLoad;
1200 R2::TCharMode _CharMode;
1202 TScenarioHeader _LastReadHeader;
1203 TScenarioHeader _ScenarioHeader;
1204 bool _IsSessionOwner;
1205 TSessionId _EditSessionLink;
1209 class CLoadAnimationSucceded: public CScenarioValidatorLoadSuccededCallback
1211 public:
1212 CLoadAnimationSucceded(CClientEditionModule* module):_Module(module){}
1214 virtual void doOperation(const std::string& filename,const std::string& body,const CScenarioValidator::TValues& values);
1215 private:
1217 CClientEditionModule* _Module;
1220 class CLoadScenarioSucceded: public CScenarioValidatorLoadSuccededCallback
1222 public:
1223 CLoadScenarioSucceded(CClientEditionModule* module):_Module(module){}
1225 virtual void doOperation(const std::string& filename,const std::string& body,const CScenarioValidator::TValues& values);
1227 private:
1229 CClientEditionModule* _Module;
1234 class CLoadUserComponentSucceeded: public CUserComponentValidatorLoadSuccededCallback
1236 public:
1237 CLoadUserComponentSucceeded(CClientEditionModule* module):_Module(module){}
1239 virtual void doOperation(const std::string& filename,const std::string& body,const CUserComponentValidator::TValues& values);
1241 private:
1243 CClientEditionModule* _Module;
1246 class CEditorConfig
1248 public:
1249 CEditorConfig();
1250 void setDisplayInfo(const std::string& formName, bool displayInfo);
1251 void setDisplayInfo(uint32 displayInfo);
1252 bool mustDisplayInfo(const std::string& formName) const;
1253 bool hasDisplayInfo(const std::string& formName) const;
1254 uint32 getDisplayInfo() const;
1256 private:
1257 static std::map<std::string, uint32> _NameToId;
1264 } //namespace R2
1268 #endif //R2_CLIENT_EDITON_MODULE_H