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/>.
22 //#include "game_share/msg_combat_move_service.h"
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() )
40 // nlwarning("CEGSExecuteMsgImp::callback(): Message received from %s(%d) service but mirror not yet ready", serviceName.c_str(), sid );
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
);
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
);
64 } // CBSAIEventReportMsg::callback //
70 //--------------------------------------------------------------
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() )
78 // nlwarning("<cbCancelPhrase> Received from %s service but mirror not yet ready", serviceName.c_str() );
82 // if (NLMISC::nlstricmp(serviceName.c_str(),"AIS")==0)
84 // TDataSetRow playerId;
85 // msgin.serial( playerId );
87 // BRICK_TYPE::EBrickType type = BRICK_TYPE::UNKNOWN;
88 // msgin.serialEnum( type );
91 // msgin.serial( index );
93 // //PhraseManager->cancelSentence( TheDataset.getEntityId(playerId), type, index );
97 // NLMISC::CEntityId playerId;
98 // msgin.serial( playerId );
100 // BRICK_TYPE::EBrickType type = BRICK_TYPE::UNKNOWN;
101 // msgin.serialEnum( type );
104 // msgin.serial( index );
106 // //PhraseManager->cancelSentence( playerId, type, index );
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() )
120 // nlwarning("<cbCancelCurrentPhrase> Received from %s service but mirror not yet ready", serviceName.c_str() );
124 // if (NLMISC::nlstricmp(serviceName.c_str(),"AIS")==0)
126 // TDataSetRow playerId;
127 // msgin.serial( playerId );
129 //// PhraseManager->cancelCurrentSentence( TheDataset.getEntityId(playerId) );
133 // NLMISC::CEntityId playerId;
134 // msgin.serial( playerId );
136 //// PhraseManager->cancelCurrentSentence( playerId );
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() )
150 // nlwarning("<cbCancelAllPhrases> Received from %s service but mirror not yet ready", serviceName.c_str() );
154 // if (NLMISC::nlstricmp(serviceName.c_str(),"AIS")==0)
156 // TDataSetRow playerId;
157 // msgin.serial( playerId );
159 //// PhraseManager->cancelAllSentences( TheDataset.getEntityId(playerId) );
163 // NLMISC::CEntityId playerId;
164 // msgin.serial( playerId );
166 //// PhraseManager->cancelAllSentences( playerId );
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() )
219 // nlwarning("<cbDisengageNotification> Received from %s service but mirror not yet ready", serviceName.c_str() );
223 // if (NLMISC::nlstricmp(serviceName.c_str(),"AIS")==0)
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 );
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 );
241 } // cbDisengageNotification //
244 //--------------------------------------------------------------
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() )
253 // nlwarning("<cbDisengage> Received from %s service but mirror not yet ready", serviceName.c_str() );
257 // if (NLMISC::nlstricmp(serviceName.c_str(),"AIS")==0)
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*/);
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 );
281 //class CEntitiesSortFunctor
284 // inline CEntitiesSortFunctor()
287 // inline bool operator() (const pair<CEntityId, sint32> &arg1, const pair<CEntityId, sint32> &arg2)
289 // return ( arg1.second < arg2.second);
294 //--------------------------------------------------------------
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() )
302 // nlwarning("<cbVisionAnswer> Received from %s service but mirror not yet ready", serviceName.c_str() );
306 // if (NLMISC::nlstricmp(serviceName.c_str(),"AIS")==0)
308 // //get the answer to the vision request
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 )
320 // msgin.serial(range);
321 // entities.push_back(make_pair(TheDataset.getEntityId(id),range));
325 // DEBUGLOG("Received entities :");
326 // for (uint i = 0 ; i < entities.size() ; ++i)
328 // DEBUGLOG("Entity %s, distance = %d", entities[i].first.toString().c_str(),entities[i].second);
332 // // sort entities by the distance from the area center
333 // sort( entities.begin(), entities.end(), CEntitiesSortFunctor() );
336 // DEBUGLOG("After sorting :");
337 // for (uint j = 0 ; j < entities.size() ; ++j)
339 // DEBUGLOG("Entity %s, distance = %d", entities[j].first.toString().c_str(),entities[j].second);
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() )
348 // IAreaFunctionality *areaFunc = (*it).second.first;
349 // CSentence *sentence = (*it).second.second;
351 // if ( areaFunc && sentence )
353 // areaFunc->processEntitiesInArea( entities, sentence );
355 // functionalities.erase(it);
361 // //get the answer to the vision request
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 )
373 // msgin.serial(range);
374 // entities.push_back(make_pair(id,range));
378 // DEBUGLOG("Received entities :");
379 // for (uint i = 0 ; i < entities.size() ; ++i)
381 // DEBUGLOG("Entity %s, distance = %d", entities[i].first.toString().c_str(),entities[i].second);
385 // // sort entities by the distance from the area center
386 // sort( entities.begin(), entities.end(), CEntitiesSortFunctor() );
389 // DEBUGLOG("After sorting :");
390 // for (uint j = 0 ; j < entities.size() ; ++j)
392 // DEBUGLOG("Entity %s, distance = %d", entities[j].first.toString().c_str(),entities[j].second);
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() )
401 // IAreaFunctionality *areaFunc = (*it).second.first;
402 // CSentence *sentence = (*it).second.second;
404 // if ( areaFunc && sentence )
406 // areaFunc->processEntitiesInArea( entities, sentence );
408 // functionalities.erase(it);
413 } // cbVisionAnswer //