本文整理汇总了C++中Mission::GetSuccessXP方法的典型用法代码示例。如果您正苦于以下问题:C++ Mission::GetSuccessXP方法的具体用法?C++ Mission::GetSuccessXP怎么用?C++ Mission::GetSuccessXP使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mission
的用法示例。
在下文中一共展示了Mission::GetSuccessXP方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnEvent
void Player::OnEvent(IEventSource* pSource, IEvent* pEvent)
{
string sourceType = (pSource ? pSource->GetType() : "World");
string eventCode = pEvent->GetCode();
string eventName = eventCode.substr(eventCode.find('.')+1, eventCode.length());
DYNLOG_ADDLOG( DYNLOG_FORMAT("Player::OnEvent(): Event [%s] received from source [%s]", eventCode.c_str(), sourceType.c_str()) );
// check for a Player event
if ( !sourceType.compare( Player::EVTSYS_ObjectType ) ) // player events
{
Player* pPlayer = (Player*)pEvent->GetParam();
// ensure that we do not handle our own event
if ( pSource != (IEventSource*)this )
{
// handle events
if ( !eventCode.compare( Player::EVT_LoggedIn ) )
{
}
}
}
// check for a mission event
else if ( !sourceType.compare( Mission::EVTSYS_ObjectType ) )
{
Mission* pMission = static_cast<Mission*>(pSource);
Player* pPlayer = (Player*)pEvent->GetPlayer();
if ( !eventCode.compare( Mission::EVT_Complete ) )
{
DYNLOG_ADDLOG( DYNLOG_FORMAT("Player %s completed mission id %ld (earned %ld XP)", GetName().c_str(), (FCULONG)(pEvent->GetParam()), pMission->GetSuccessXP()) );
// need to send a message to the client here
SendMissionComplete((FCULONG) pEvent->GetParam(), pPlayer->GetRouterSocket(), pPlayer->GetClientSocket());
// Add the xp to the player
pPlayer->AddXP( pMission->GetSuccessXP() );
}
}
else
{
// its not a player event, so it may be related to a mission or something else that happened to us
bool bHandled = false;
// check if we have any missions
if ( m_mapMissions.size() )
{
// hand the event off to all the missions we have...
MissionMap::iterator it = m_mapMissions.begin();
MissionMap::iterator limit = m_mapMissions.end();
for ( ; it != limit; it++ )
{
it->second->OnEvent(pSource, pEvent);
}
}
// if we didn't handle the event, then log the incident
if ( !bHandled )
DYNLOG_ADDLOG( DYNLOG_FORMAT("Player::OnEvent(): Unknown event received [source:%s / event:%s]", sourceType.c_str(), pEvent->GetCode().c_str()) );
}
}