本文整理汇总了C++中Quest::GenerateQuestXP方法的典型用法代码示例。如果您正苦于以下问题:C++ Quest::GenerateQuestXP方法的具体用法?C++ Quest::GenerateQuestXP怎么用?C++ Quest::GenerateQuestXP使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Quest
的用法示例。
在下文中一共展示了Quest::GenerateQuestXP方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleQuestgiverChooseRewardOpcode
//.........这里部分代码省略.........
if ( pQuest->m_questItemId[1] > 0 )
if (!chr->HasItemInBackpack( pQuest->m_questItemId[1], pQuest->m_questItemCount[1]))
{
QuestPacketHandler::getSingleton().SendQuestInvalid( this, INVALIDREASON_DONT_HAVE_REQ_ITEMS );
return;
}
if ( pQuest->m_questItemId[2] > 0 )
if (!chr->HasItemInBackpack( pQuest->m_questItemId[2], pQuest->m_questItemCount[2]))
{
QuestPacketHandler::getSingleton().SendQuestInvalid( this, INVALIDREASON_DONT_HAVE_REQ_ITEMS );
return;
}
if ( pQuest->m_questItemId[3] > 0 )
if (!chr->HasItemInBackpack( pQuest->m_questItemId[3], pQuest->m_questItemCount[3]))
{
QuestPacketHandler::getSingleton().SendQuestInvalid( this, INVALIDREASON_DONT_HAVE_REQ_ITEMS );
return;
}
if ( pQuest->m_questItemId[0] > 0 ) chr->RemoveItemFromBackpack( pQuest->m_questItemId[0], pQuest->m_questItemCount[0]);
if ( pQuest->m_questItemId[1] > 0 ) chr->RemoveItemFromBackpack( pQuest->m_questItemId[1], pQuest->m_questItemCount[1]);
if ( pQuest->m_questItemId[2] > 0 ) chr->RemoveItemFromBackpack( pQuest->m_questItemId[2], pQuest->m_questItemCount[2]);
if ( pQuest->m_questItemId[3] > 0 ) chr->RemoveItemFromBackpack( pQuest->m_questItemId[3], pQuest->m_questItemCount[3]);
if (pQuest->m_rewardGold < 0)
chr->ModifyMoney(pQuest->m_rewardGold);
// Rewards ...
if ( ( rewardid >= pQuest->m_choiceRewards ) && ( pQuest->m_choiceRewards > 0 ) )
{
sLog.outString("WORLD: Attempt to select an unexisting rewardid !");
return;
}
QuestPacketHandler::getSingleton().SendQuestUpdateComplete( this, pQuest );
QuestPacketHandler::getSingleton().SendQuestCompleteToPlayer( this, pQuest );
GetPlayer()->setQuestStatus(quest_id, QUEST_STATUS_COMPLETE, true);
uint16 log_slot = GetPlayer()->getQuestSlot(quest_id);
if (pQuest->m_rewardGold > 0) chr->ModifyMoney( pQuest->m_rewardGold );
// Add items to backpack
bool bkFull = false;
for ( int iI = 0; iI < pQuest->m_itemRewards; ++iI )
if (!GetPlayer()->AddItemToBackpack( pQuest->m_rewardItemId[iI], pQuest->m_rewardItemCount[iI] ))
{
bkFull = true;
break;
}
if ( pQuest->m_choiceRewards > 0 )
{
if (!bkFull)
GetPlayer()->AddItemToBackpack( pQuest->m_choiceItemId[rewardid], pQuest->m_choiceItemCount[rewardid] ); else
QuestPacketHandler::getSingleton().SendQuestFailedToPlayer ( this, FAILEDREASON_INV_FULL );
}
// -- Teach the spell to the player
if ( pQuest->m_learnSpell > 0 )
{
WorldPacket sdata;
if ( GetPlayer()->AddSpell( pQuest->m_learnSpell ) )
{
sdata.Initialize (SMSG_LEARNED_SPELL);
sdata << pQuest->m_learnSpell;
SendPacket( &sdata );
Make_SMSG_SPELL_GO (&sdata, 476, GetPlayer(), GetPlayer());
GetPlayer()->SendMessageToSet (&sdata, true);
}
}
// -- Free the quest occupied slot --
chr->SetUInt32Value(log_slot+0, 0);
chr->SetUInt32Value(log_slot+1, 0);
chr->SetUInt32Value(log_slot+2, 0);
chr->GiveXP( pQuest->GenerateQuestXP( chr ), guid1 );
chr->setQuestStatus( quest_id, QUEST_STATUS_AVAILABLE, true); // reset the qs.
Creature *pCreature = objmgr.GetObject<Creature>(guid1);
GameObject *pGameObject = objmgr.GetObject<GameObject>(guid1);
if (pCreature)
QuestScriptBackend::getSingleton().scriptCallChooseReward( GetPlayer(), pCreature, pQuest, rewardid ); else
if (pGameObject)
QuestScriptBackend::getSingleton().scriptCallGOChooseReward( GetPlayer(), pGameObject, pQuest, rewardid );
GetPlayer()->SaveToDB();
}