Resolve "Toggle Free Look with Hotkey"
[ryzomcore.git] / ryzom / server / src / sabrina / sabrina_message_callbacks.cpp
blob9484ec54990cf5e377797d725d04fa232f7c1bc6
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 #include "stdpch.h"
21 // game share
22 //#include "game_share/msg_combat_move_service.h"
23 //sabrina
24 #include "sabrina_message_callbacks.h"
25 //#include "phrase_utilities_functions.h"
28 extern CMirror Mirror;
29 extern CMirroredDataSet *FeTempDataset;
32 //--------------------------------------------------------------
33 // CEGSExecuteMsg::callback()
34 //--------------------------------------------------------------
35 void CEGSExecuteMsgImp::callback (const std::string &serviceName, NLNET::TServiceId serviceId)
37 nlwarning("*** Received untreated message 'CEGSExecuteMsgImp' from service %s(%d)",serviceName.c_str(),serviceId);
38 // if ( ! Mirror.mirrorIsReady() )
39 // {
40 // nlwarning("CEGSExecuteMsgImp::callback(): Message received from %s(%d) service but mirror not yet ready", serviceName.c_str(), sid );
41 // return;
42 // }
44 // //PhraseManager->executePhrase( TheDataset.getEntityId(PlayerId), TheDataset.getEntityId(TargetId), Bricks/*, MPsSheet, MPsQty, MPsQuality*/, (BRICK_TYPE::EBrickType)Type, Index );
45 // PhraseManager->executePhrase( ActorRowId, TargetRowId, BrickIds, Cyclic );
46 } // CEGSExecuteMsg::callback //
48 //--------------------------------------------------------------
49 // CBSAIEventReportMsg::callback()
50 //--------------------------------------------------------------
51 void CBSAIDeathReport::callback(const std::string &serviceName, NLNET::TServiceId serviceId)
53 nlwarning("*** Received untreated message 'CBSAIDeathReport' from service %s(%d)",serviceName.c_str(),serviceId);
54 // Nothing to do.
57 //--------------------------------------------------------------
58 // CBSAIEventReportMsg::callback()
59 //--------------------------------------------------------------
60 void CBSAIEventReportMsg::callback(const std::string &serviceName, NLNET::TServiceId serviceId)
62 nlwarning("*** Received untreated message 'CBSAIEventReportMsg' from service %s(%d)",serviceName.c_str(),serviceId);
63 // empty , unused
64 } // CBSAIEventReportMsg::callback //
67 namespace SABRINA
70 //--------------------------------------------------------------
71 // cbCancelPhrase()
72 //--------------------------------------------------------------
73 void cbCancelPhrase( NLNET::CMessage& msgin, const std::string &serviceName, uint16 serviceId )
75 nlwarning("*** Received untreated message 'cbCancelPhrase' from service %s(%d)",serviceName.c_str(),serviceId);
76 // if ( ! Mirror.mirrorIsReady() )
77 // {
78 // nlwarning("<cbCancelPhrase> Received from %s service but mirror not yet ready", serviceName.c_str() );
79 // return;
80 // }
82 // if (NLMISC::nlstricmp(serviceName.c_str(),"AIS")==0)
83 // {
84 // TDataSetRow playerId;
85 // msgin.serial( playerId );
86 //
87 // BRICK_TYPE::EBrickType type = BRICK_TYPE::UNKNOWN;
88 // msgin.serialEnum( type );
89 //
90 // uint8 index;
91 // msgin.serial( index );
92 //
93 // //PhraseManager->cancelSentence( TheDataset.getEntityId(playerId), type, index );
94 // }
95 // else
96 // {
97 // NLMISC::CEntityId playerId;
98 // msgin.serial( playerId );
99 //
100 // BRICK_TYPE::EBrickType type = BRICK_TYPE::UNKNOWN;
101 // msgin.serialEnum( type );
103 // uint8 index;
104 // msgin.serial( index );
106 // //PhraseManager->cancelSentence( playerId, type, index );
107 // }
108 } // cbCancelPhrase //
112 //--------------------------------------------------------------
113 // cbCancelCurrentPhrase()
114 //--------------------------------------------------------------
115 void cbCancelCurrentPhrase( NLNET::CMessage& msgin, const std::string &serviceName, uint16 serviceId )
117 nlwarning("*** Received untreated message 'cbCancelCurrentPhrase' from service %s(%d)",serviceName.c_str(),serviceId);
118 // if ( ! Mirror.mirrorIsReady() )
119 // {
120 // nlwarning("<cbCancelCurrentPhrase> Received from %s service but mirror not yet ready", serviceName.c_str() );
121 // return;
122 // }
124 // if (NLMISC::nlstricmp(serviceName.c_str(),"AIS")==0)
125 // {
126 // TDataSetRow playerId;
127 // msgin.serial( playerId );
129 //// PhraseManager->cancelCurrentSentence( TheDataset.getEntityId(playerId) );
130 // }
131 // else
132 // {
133 // NLMISC::CEntityId playerId;
134 // msgin.serial( playerId );
136 //// PhraseManager->cancelCurrentSentence( playerId );
137 // }
138 } // cbCancelCurrentPhrase //
142 //--------------------------------------------------------------
143 // cbCancelAllPhrases()
144 //--------------------------------------------------------------
145 void cbCancelAllPhrases( NLNET::CMessage& msgin, const std::string &serviceName, uint16 serviceId )
147 nlwarning("*** Received untreated message 'cbCancelAllPhrases' from service %s(%d)",serviceName.c_str(),serviceId);
148 // if ( ! Mirror.mirrorIsReady() )
149 // {
150 // nlwarning("<cbCancelAllPhrases> Received from %s service but mirror not yet ready", serviceName.c_str() );
151 // return;
152 // }
154 // if (NLMISC::nlstricmp(serviceName.c_str(),"AIS")==0)
155 // {
156 // TDataSetRow playerId;
157 // msgin.serial( playerId );
159 //// PhraseManager->cancelAllSentences( TheDataset.getEntityId(playerId) );
160 // }
161 // else
162 // {
163 // NLMISC::CEntityId playerId;
164 // msgin.serial( playerId );
166 //// PhraseManager->cancelAllSentences( playerId );
167 // }
168 } // cbCancelAllPhrases //
171 //--------------------------------------------------------------
172 // cbRegisterService()
173 //--------------------------------------------------------------
174 void cbRegisterService( NLNET::CMessage& msgin, const std::string &serviceName, uint16 serviceId )
176 nlwarning("*** Received untreated message 'cbRegisterService' from service %s(%d)",serviceName.c_str(),serviceId);
177 // PhraseManager->registerService( serviceName );
178 } // cbRegisterService //
181 //--------------------------------------------------------------
182 // cbUnregisterService()
183 //--------------------------------------------------------------
184 void cbUnregisterService( NLNET::CMessage& msgin, const std::string &serviceName, uint16 serviceId )
186 nlwarning("*** Received untreated message 'cbUnregisterService' from service %s(%d)",serviceName.c_str(),serviceId);
187 // PhraseManager->unregisterService( serviceName );
188 } // cbUnregisterService //
191 //--------------------------------------------------------------
192 // cbRegisterServiceAI()
193 //--------------------------------------------------------------
194 void cbRegisterServiceAI( NLNET::CMessage& msgin, const std::string &serviceName, uint16 serviceId )
196 nlwarning("*** Received untreated message 'cbRegisterServiceAI' from service %s(%d)",serviceName.c_str(),serviceId);
197 // PhraseManager->registerServiceForAI( serviceName );
198 } // cbRegisterServiceAI //
201 //--------------------------------------------------------------
202 // cbUnregisterServiceAI()
203 //--------------------------------------------------------------
204 void cbUnregisterServiceAI( NLNET::CMessage& msgin, const std::string &serviceName, uint16 serviceId )
206 nlwarning("*** Received untreated message 'cbUnregisterServiceAI' from service %s(%d)",serviceName.c_str(),serviceId);
207 // PhraseManager->unregisterServiceForAI( serviceName );
208 } // cbUnregisterServiceAI //
211 //--------------------------------------------------------------
212 // cbDisengageNotification()
213 //--------------------------------------------------------------
214 void cbDisengageNotification( NLNET::CMessage& msgin, const std::string &serviceName, uint16 serviceId )
216 nlwarning("*** Received untreated message 'cbDisengageNotification' from service %s(%d)",serviceName.c_str(),serviceId);
217 // if ( ! Mirror.mirrorIsReady() )
218 // {
219 // nlwarning("<cbDisengageNotification> Received from %s service but mirror not yet ready", serviceName.c_str() );
220 // return;
221 // }
223 // if (NLMISC::nlstricmp(serviceName.c_str(),"AIS")==0)
224 // {
225 // TDataSetRow entityRowId;
226 // msgin.serial( entityRowId );
228 //// INFOLOG("<cbDisengageNotification> received disengage notification for entity %s", TheDataset.getEntityId(entityRowId).toString().c_str());
230 // PhraseManager->disengage( entityRowId, true );
231 // }
232 // else
233 // {
234 // CEntityId entityId;
235 // msgin.serial( entityId );
237 // INFOLOG("<cbDisengageNotification> received disengage notification for entity %s", entityId.toString().c_str());
239 // PhraseManager->disengage( TheDataset.getDataSetRow(entityId), true );
240 // }
241 } // cbDisengageNotification //
244 //--------------------------------------------------------------
245 // cbDisengage()
246 //--------------------------------------------------------------
247 void cbDisengage( NLNET::CMessage& msgin, const std::string &serviceName, uint16 serviceId )
249 nlwarning("*** Received untreated message 'cbDisengage' from service %s(%d)",serviceName.c_str(),serviceId);
251 // if ( ! Mirror.mirrorIsReady() )
252 // {
253 // nlwarning("<cbDisengage> Received from %s service but mirror not yet ready", serviceName.c_str() );
254 // return;
255 // }
257 // if (NLMISC::nlstricmp(serviceName.c_str(),"AIS")==0)
258 // {
259 // TDataSetRow entityRowId;
260 // msgin.serial( entityRowId );
262 // DEBUGLOG("<cbDisengage> AIS Disengage entity %s", TheDataset.getEntityId(entityRowId).toString().c_str() );
264 // PhraseManager->disengage( entityRowId, true /*chatMsg*/, true /*disengageCreature*/);
265 // }
266 // else
267 // {
268 // CEntityId entityId;
269 // msgin.serial( entityId );
271 // DEBUGLOG("<cbDisengage> Service %s Disengage entity %s", serviceName.c_str(), entityId.toString().c_str() );
273 // PhraseManager->disengage( TheDataset.getDataSetRow(entityId), true );
274 // }
276 } // cbDisengage //
281 //class CEntitiesSortFunctor
283 //public:
284 // inline CEntitiesSortFunctor()
285 // {}
287 // inline bool operator() (const pair<CEntityId, sint32> &arg1, const pair<CEntityId, sint32> &arg2)
288 // {
289 // return ( arg1.second < arg2.second);
290 // }
291 //};
294 //--------------------------------------------------------------
295 // cbVisionAnswer()
296 //--------------------------------------------------------------
297 void cbVisionAnswer( NLNET::CMessage& msgin, const std::string &serviceName, uint16 serviceId )
299 nlwarning("*** Received untreated message 'cbVisionAnswer' from service %s(%d)",serviceName.c_str(),serviceId);
300 // if ( ! Mirror.mirrorIsReady() )
301 // {
302 // nlwarning("<cbVisionAnswer> Received from %s service but mirror not yet ready", serviceName.c_str() );
303 // return;
304 // }
305 ///*
306 // if (NLMISC::nlstricmp(serviceName.c_str(),"AIS")==0)
307 // {
308 // //get the answer to the vision request
309 // sint32 rid;
310 // sint32 range;
311 // TDataSetRow id;
312 // vector<pair<CEntityId, sint32> > entities;
314 // msgin.serial(rid);
315 // const sint32 msgLength = (sint32)msgin.length();
316 // //while( msgin.getPos() <= msgin.length()-1 )
317 // while( msgin.getPos() < msgLength )
318 // {
319 // msgin.serial(id);
320 // msgin.serial(range);
321 // entities.push_back(make_pair(TheDataset.getEntityId(id),range));
322 // }
324 //#ifdef NL_DEBUG
325 // DEBUGLOG("Received entities :");
326 // for (uint i = 0 ; i < entities.size() ; ++i)
327 // {
328 // DEBUGLOG("Entity %s, distance = %d", entities[i].first.toString().c_str(),entities[i].second);
329 // }
330 //#endif
332 // // sort entities by the distance from the area center
333 // sort( entities.begin(), entities.end(), CEntitiesSortFunctor() );
335 //#ifdef NL_DEBUG
336 // DEBUGLOG("After sorting :");
337 // for (uint j = 0 ; j < entities.size() ; ++j)
338 // {
339 // DEBUGLOG("Entity %s, distance = %d", entities[j].first.toString().c_str(),entities[j].second);
340 // }
341 //#endif
343 // //get the functionalities which requested the vision
344 // map<sint32, pair<IAreaFunctionality*,CSentence*> >& functionalities = PhraseManager->getFunctionalitiesAwaitingArea();
345 // map<sint32, pair<IAreaFunctionality*,CSentence*> >::iterator it = functionalities.find(rid);
346 // if ( it != functionalities.end() )
347 // {
348 // IAreaFunctionality *areaFunc = (*it).second.first;
349 // CSentence *sentence = (*it).second.second;
351 // if ( areaFunc && sentence )
352 // {
353 // areaFunc->processEntitiesInArea( entities, sentence );
354 // }
355 // functionalities.erase(it);
356 // }
358 // }
359 // else
360 // {
361 // //get the answer to the vision request
362 // sint32 rid;
363 // sint32 range;
364 // CEntityId id;
365 // vector<pair<CEntityId, sint32> > entities;
367 // msgin.serial(rid);
368 // const sint32 msgLength = (sint32)msgin.length();
369 // //while( msgin.getPos() <= msgin.length()-1 )
370 // while( msgin.getPos() < msgLength )
371 // {
372 // msgin.serial(id);
373 // msgin.serial(range);
374 // entities.push_back(make_pair(id,range));
375 // }
377 //#ifdef NL_DEBUG
378 // DEBUGLOG("Received entities :");
379 // for (uint i = 0 ; i < entities.size() ; ++i)
380 // {
381 // DEBUGLOG("Entity %s, distance = %d", entities[i].first.toString().c_str(),entities[i].second);
382 // }
383 //#endif
385 // // sort entities by the distance from the area center
386 // sort( entities.begin(), entities.end(), CEntitiesSortFunctor() );
388 //#ifdef NL_DEBUG
389 // DEBUGLOG("After sorting :");
390 // for (uint j = 0 ; j < entities.size() ; ++j)
391 // {
392 // DEBUGLOG("Entity %s, distance = %d", entities[j].first.toString().c_str(),entities[j].second);
393 // }
394 //#endif
396 // //get the functionalities which requested the vision
397 // map<sint32, pair<IAreaFunctionality*,CSentence*> >& functionalities = PhraseManager->getFunctionalitiesAwaitingArea();
398 // map<sint32, pair<IAreaFunctionality*,CSentence*> >::iterator it = functionalities.find(rid);
399 // if ( it != functionalities.end() )
400 // {
401 // IAreaFunctionality *areaFunc = (*it).second.first;
402 // CSentence *sentence = (*it).second.second;
404 // if ( areaFunc && sentence )
405 // {
406 // areaFunc->processEntitiesInArea( entities, sentence );
407 // }
408 // functionalities.erase(it);
409 // }
411 // }
412 //*/
413 } // cbVisionAnswer //