本文整理汇总了C++中nlnet::CMessage类的典型用法代码示例。如果您正苦于以下问题:C++ CMessage类的具体用法?C++ CMessage怎么用?C++ CMessage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CMessage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pushMessageToLocalQueueFromMessage
void CMirrorService::pushMessageToLocalQueueFromMessage( std::vector<TMessageCarrier>& msgQueue, NLNET::CMessage& msgin )
{
TMessageCarrier mc( true );
msgQueue.push_back( mc );
msgin.serial( msgQueue.back().SenderId );
msgin.serialMemStream( msgQueue.back().Msg );
}
示例2: cbDisengageNotification
//--------------------------------------------------------------
// cbDisengageNotification()
//--------------------------------------------------------------
void cbDisengageNotification( NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId )
{
H_AUTO(cbDisengageNotification);
if ( ! Mirror.mirrorIsReady() )
{
nlwarning("<cbDisengageNotification> Received from %s service but mirror not yet ready", serviceName.c_str() );
return;
}
if (NLMISC::nlstricmp(serviceName.c_str(),"AIS")==0)
{
TDataSetRow entityRowId;
msgin.serial( entityRowId );
INFOLOG("<cbDisengageNotification> received disengage notification for entity %s", TheDataset.getEntityId(entityRowId).toString().c_str());
CPhraseManager::getInstance().disengage( entityRowId, true );
}
else
{
CEntityId entityId;
msgin.serial( entityId );
INFOLOG("<cbDisengageNotification> received disengage notification for entity %s", entityId.toString().c_str());
CPhraseManager::getInstance().disengage( TheDataset.getDataSetRow(entityId), true );
}
} // cbDisengageNotification //
示例3: cbDisengage
//--------------------------------------------------------------
// cbDisengage()
//--------------------------------------------------------------
void cbDisengage( NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId )
{
H_AUTO(cbDisengage);
if ( ! Mirror.mirrorIsReady() )
{
nlwarning("<cbDisengage> Received from %s service but mirror not yet ready", serviceName.c_str() );
return;
}
if (serviceName == "AIS")
{
TDataSetRow entityRowId;
msgin.serial( entityRowId );
DEBUGLOG("<cbDisengage> AIS Disengage entity %s", TheDataset.getEntityId(entityRowId).toString().c_str() );
CPhraseManager::getInstance().disengage( entityRowId, true /*chatMsg*/, true /*disengageCreature*/);
}
else
{
CEntityId entityId;
msgin.serial( entityId );
DEBUGLOG("<cbDisengage> Service %s Disengage entity %s", serviceName.c_str(), entityId.toString().c_str() );
CPhraseManager::getInstance().disengage( TheDataset.getDataSetRow(entityId), true );
}
} // cbDisengage //
示例4: cbReleaseRange
void cbReleaseRange( NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId mirrorServiceId )
{
vector<string> datasetNames;
NLNET::TServiceId declaratorServiceId;
msgin.serialCont( datasetNames );
msgin.serial( declaratorServiceId );
RMMInstance->releaseRanges( datasetNames, declaratorServiceId, mirrorServiceId );
}
示例5:
/*
* PDS init failed, stop everything!
*/
void cbPDSInitFailed(NLNET::CMessage& msgin, const std::string &serviceName, TServiceId serviceId)
{
uint32 databaseId;
msgin.serial(databaseId);
string error;
msgin.serial(error);
nlerror("Database '%d' initialisation failed: '%s'", databaseId, error.c_str());
}
示例6: cbClientBotChatPickStaticMission
//----------------------------------------------------------------------------
void cbClientBotChatPickStaticMission( NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId )
{
if ( !MissionSystemEnabled )
return;
CEntityId userId;
uint8 index;
msgin.serial(userId);
msgin.serial(index);
//get the user and the asked mission
if (!checkPlayer(userId, "cbClientBotChatPickStaticMission")) return;
CCharacter * user = PlayerManager.getChar( userId );
// Create the debug string
string sDebugPrefix = string("user:") + userId.toString().c_str() + " cbClientBotChatPickStaticMission :";
// Check for user
if ( user == NULL )
{
MISLOG("%s cant find user.", sDebugPrefix.c_str());
return;
}
// Check that index falls in good range
if ( index >= user->getCurrentMissionList().size() )
{
MISLOG("%s invalid index %u, there are %u", sDebugPrefix.c_str(), index, user->getCurrentMissionList().size() );
return;
}
// Check if the user is not cheating (trying to get a mission grayed)
if ( user->getCurrentMissionList()[index].PreReqState != MISSION_DESC::PreReqSuccess)
{
MISLOG("%s user choose a mission with failed prerequesit (index %u)", sDebugPrefix.c_str(), index);
return;
}
CCreature * bot = CreatureManager.getCreature( user->getCurrentInterlocutor() );
if (!bot || bot->getAlias() == CAIAliasTranslator::Invalid )
{
MISLOG("%s invalid interlocutor", sDebugPrefix.c_str());
return;
}
// End the user bot chat (must be done before instanciateMission() because it would clear any dynchat's interlocutor open by the mission
user->endBotChat();
user->setAfkState(false);
std::list< CMissionEvent* > eventList;
CMissionManager::getInstance()->instanciateMission(user, user->getCurrentMissionList()[index].Mission,
bot->getAlias(), eventList);
user->processMissionEventList( eventList,true, CAIAliasTranslator::Invalid );
}
示例7: cbStopNpcControlNotification
static void cbStopNpcControlNotification(NLNET::CMessage &msgin, const std::string &serviceName, TServiceId sid)
{
TAIAlias alias;
CEntityId creatureId;
msgin.serial(alias);
msgin.serial(creatureId);
CDynamicMapService* dms = CDynamicMapService::getInstance();
IServerAnimationModule* imodule= dms->getAnimationModule();
CServerAnimationModule* module = safe_cast<CServerAnimationModule*>(imodule);
module->onStopNpcControlNotification(creatureId);
}
示例8: nextTaskId
/*
* Add RBS Task
*/
NLNET::CMessage& CDbManager::addTask(const std::string& msg, ITaskEventListener* listener, void* arg)
{
NLNET::CMessage* msgrbs = new NLNET::CMessage(msg);
_RBSMessages.push_back(msgrbs);
uint32 id = nextTaskId();
msgrbs->serial(id);
// add listener to task listeners
if (listener != NULL)
_TaskListeners[id] = std::make_pair<ITaskEventListener*, void*>(listener, arg);
return *msgrbs;
}
示例9: cbClientMissionGroupWake
//----------------------------------------------------------------------------
void cbClientMissionGroupWake( NLNET::CMessage& msgin, const std::string & serviceName, NLNET::TServiceId serviceId )
{
CEntityId userId;
msgin.serial(userId);
uint8 missionGroupIndex;
msgin.serial(missionGroupIndex);
CCharacter * user = PlayerManager.getChar(userId);
if ( !user || !user->getEnterFlag() )
return;
user->setAfkState(false);
CTeam * team = TeamManager.getRealTeam( user->getTeamId() );
if ( !team )
{
MISLOG("user:%s cbClientMissionGroupWake : Invalid team", userId.toString().c_str());
return;
}
if ( team->getLeader() != userId )
{
return;
}
if ( missionGroupIndex >= team->getMissions().size() )
{
MISLOG("user:%s cbClientMissionGroupWake : Invalid group mission %u ( count %u )",
userId.toString().c_str(), missionGroupIndex, team->getMissions().size());
return;
}
CMissionTeam* mission = team->getMissions()[missionGroupIndex];
nlassert(mission);
if ( mission->getFinished() == false )
{
CMissionTemplate * templ = CMissionManager::getInstance()->getTemplate( mission->getTemplateId() );
if ( !templ )
{
MISLOG("user:%s cbClientGroupAbandonMission : invalid group mission alias %u",
userId.toString().c_str(), mission->getTemplateId());
return;
}
CMissionQueueManager::getInstance()->playerWakesUp (userId, templ->Alias );
}
}
示例10: cbClientContinueMission
//----------------------------------------------------------------------------
void cbClientContinueMission( NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId )
{
CEntityId userId;
uint8 index;
msgin.serial(userId);
msgin.serial(index);
if (!checkPlayer(userId, "cbClientContinueMission")) return;
CCharacter * user = PlayerManager.getChar( userId );
if ( !user->startBotChat( BOTCHATTYPE::UnknownFlag ) )
return;
user->botChatMissionAdvance(index);
user->setAfkState(false);
}
示例11: cbClientBotChatDynChatSend
//----------------------------------------------------------------------------
void cbClientBotChatDynChatSend( NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId )
{
CEntityId userId;
TDataSetIndex index;
uint8 choice;
msgin.serial(userId);
msgin.serial(index);
msgin.serial(choice);
if (!checkPlayer(userId, "cbClientBotChatDynChatSend")) return;
CCharacter* user = PlayerManager.getChar( userId );
CMissionManager::getInstance()->dynChatChoice( user, TheDataset.getCurrentDataSetRow(index) , choice);
user->setAfkState(false);
}
示例12:
void cbStallMode( NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId )
{
try
{
bool stalled;
std::string reason;
msgin.serial(stalled, reason);
if (stalled)
{
CMessage msgout("HALT_TICK");
msgout.serial(reason);
nlwarning("Shard stalled by %s: %s", serviceName.c_str(), reason.c_str());
CUnifiedNetwork::getInstance()->send("TICKS", msgout);
}
else
{
CMessage msgout("RESUME_TICK");
nlwarning("Shard resumed by %s: %s", serviceName.c_str(), reason.c_str());
CUnifiedNetwork::getInstance()->send("TICKS", msgout);
}
}
catch (Exception&)
{
}
}
示例13: cbClientMissionWake
//----------------------------------------------------------------------------
void cbClientMissionWake( NLNET::CMessage& msgin, const std::string & serviceName, NLNET::TServiceId serviceId )
{
CEntityId userId;
msgin.serial(userId);
uint8 missionIndex;
msgin.serial(missionIndex);
CCharacter * user = PlayerManager.getChar(userId);
if ( !user || !user->getEnterFlag() )
return;
user->setAfkState(false);
CMission* mission = NULL;
CMissionTemplate * templ = NULL;
for ( map<TAIAlias, CMission*>::iterator it = user->getMissionsBegin(); it != user->getMissionsEnd(); ++it )
{
mission = (*it).second;
if ( mission && mission->getClientIndex() == missionIndex )
{
templ = CMissionManager::getInstance()->getTemplate( mission->getTemplateId() );
if ( templ->Tags.NoList ) // skip invisible missions
continue;
break;
}
}
if ( !mission )
{
MISDBG( "user:%s abandonMission : ERROR : invalid mission index %u sent ",userId.toString().c_str(), missionIndex);
return;
}
if ( mission->getFinished() == false )
{
if ( !templ )
{
MISDBG( "user:%s abandonMission : ERROR : invalid mission alias %u", userId.toString().c_str(), mission->getTemplateId() );
return;
}
}
CMissionQueueManager::getInstance()->playerWakesUp (userId, templ->Alias );
}
示例14: cbOutpostSquadDied
//----------------------------------------------------------------------------
static void cbOutpostSquadDied( NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId )
{
COutpostSquadDiedMsg params;
msgin.serial(params);
NLMISC::CSmartPtr<COutpost> outpost = COutpostManager::getInstance().getOutpostFromAlias(params.Outpost);
if (outpost)
{
outpost->aieventSquadDied(params.GroupId);
}
}
示例15: cbClientGroupAbandonMission
//----------------------------------------------------------------------------
void cbClientGroupAbandonMission( NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId )
{
CEntityId userId;
uint8 index;
msgin.serial(userId,index);
if (!checkPlayer(userId, "cbClientGroupAbandonMission")) return;
CCharacter * user = PlayerManager.getChar( userId );
user->setAfkState(false);
CTeam * team = TeamManager.getRealTeam( user->getTeamId() );
if ( !team )
{
MISLOG("user:%s cbClientGroupAbandonMission : Invalid team", userId.toString().c_str());
return;
}
if ( team->getLeader() != userId )
{
CCharacter::sendDynamicSystemMessage( user->getEntityRowId(), "REQ_LEADER_TO_ABANDON_MISSION" );
return;
}
if ( index >= team->getMissions().size() )
{
MISLOG("user:%s cbClientGroupAbandonMission : Invalid group mission %u ( count %u )",
userId.toString().c_str(), index, team->getMissions().size());
return;
}
CMissionTeam* mission = team->getMissions()[index];
nlassert(mission);
if ( mission->getFinished() == false )
{
CMissionTemplate * templ = CMissionManager::getInstance()->getTemplate( mission->getTemplateId() );
if ( !templ )
{
MISLOG("user:%s cbClientGroupAbandonMission : invalid group mission alias %u",
userId.toString().c_str(), mission->getTemplateId());
return;
}
if ( templ->Tags.NonAbandonnable )
{
MISLOG("user:%s cbClientGroupAbandonMission : group mission alias %u is not abandonnable but user tries to abandon it",
userId.toString().c_str(), mission->getTemplateId());
return;
}
set<CEntityId> excluded;
excluded.insert( userId );
team->sendDynamicMessageToMembers( "ABANDON_GROUP_MISSION",TVectorParamCheck(), excluded );
}
team->removeMission( index, mr_abandon );
}