本文整理汇总了C++中Quest::hasMobRequests方法的典型用法代码示例。如果您正苦于以下问题:C++ Quest::hasMobRequests方法的具体用法?C++ Quest::hasMobRequests怎么用?C++ Quest::hasMobRequests使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Quest
的用法示例。
在下文中一共展示了Quest::hasMobRequests方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkDone
void PlayerQuests::checkDone(ActiveQuest &quest) {
Quest *questinfo = QuestDataProvider::Instance()->getInfo(quest.id);
quest.done = true;
if (!questinfo->hasRequests()) {
return;
}
if (questinfo->hasItemRequests()) {
int32_t iid = 0;
int16_t iamt = 0;
for (ItemRequests::iterator i = questinfo->getItemBegin(); i != questinfo->getItemEnd(); i++) {
iid = i->first;
iamt = i->second;
if ((m_player->getInventory()->getItemAmount(iid) < iamt && iamt > 0) || (iamt == 0 && m_player->getInventory()->getItemAmount(iid) != 0)) {
quest.done = false;
break;
}
}
}
else if (questinfo->hasMobRequests()) {
int32_t killed = 0;
for (MobRequests::iterator i = questinfo->getMobBegin(); i != questinfo->getMobEnd(); i++) {
if (quest.kills[i->first] < i->second) {
quest.done = false;
break;
}
}
}
if (quest.done) {
QuestsPacket::doneQuest(m_player, quest.id);
}
}
示例2: finishQuest
void PlayerQuests::finishQuest(int16_t questid, int32_t npcid) {
Quest *questinfo = QuestDataProvider::Instance()->getInfo(questid);
if (!giveRewards(questid, false)) { // Failed, don't complete the quest yet
return;
}
if (questinfo->hasMobRequests()) {
for (MobRequests::iterator i = questinfo->getMobBegin(); i != questinfo->getMobEnd(); i++) {
for (size_t k = 0; k < m_mobtoquest[i->first].size(); k++) {
if (m_mobtoquest[i->first][k] == questid) {
if (m_mobtoquest[i->first].size() == 1) { // Only one quest for this mob
m_mobtoquest.erase(i->first);
}
else {
m_mobtoquest[i->first].erase(m_mobtoquest[i->first].begin() + k);
}
break;
}
}
}
}
m_quests.erase(questid);
int64_t endtime = TimeUtilities::getServerTime();
m_completed[questid] = endtime;
QuestsPacket::questFinish(m_player, questid, npcid, questinfo->getNextQuest(), endtime);
}
示例3: addQuestMobs
void PlayerQuests::addQuestMobs(int16_t questid) {
Quest *questinfo = QuestDataProvider::Instance()->getInfo(questid);
if (questinfo->hasMobRequests()) {
size_t index = 0;
for (MobRequests::iterator i = questinfo->getMobBegin(); i != questinfo->getMobEnd(); i++) {
m_quests[questid].kills[i->first] = 0;
m_mobtoquest[i->first].push_back(questid);
}
}
}