stoneharry

Untitled

Jul 6th, 2015
396
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.94 KB | None | 0 0
  1. void Player::KillCreditGO(uint32 entry, ObjectGuid guid)
  2. {
  3.     uint16 addCastCount = 1;
  4.     for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i)
  5.     {
  6.         uint32 questid = GetQuestSlotQuestId(i);
  7.         if (!questid)
  8.             continue;
  9.  
  10.         Quest const* qInfo = sObjectMgr->GetQuestTemplate(questid);
  11.         if (!qInfo)
  12.             continue;
  13.  
  14.         QuestStatusData& q_status = m_QuestStatus[questid];
  15.  
  16.         if (q_status.Status == QUEST_STATUS_INCOMPLETE)
  17.         {
  18.             if (qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAGS_CAST) /*&& !qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAGS_KILL)*/)
  19.             {
  20.                 for (uint8 j = 0; j < QUEST_OBJECTIVES_COUNT; ++j)
  21.                 {
  22.                     uint32 reqTarget = 0;
  23.  
  24.                     // GO activate objective
  25.                     if (qInfo->RequiredNpcOrGo[j] < 0)
  26.                         // checked at quest_template loading
  27.                         reqTarget = - qInfo->RequiredNpcOrGo[j];
  28.  
  29.                     // other not this creature/GO related objectives
  30.                     if (reqTarget != entry)
  31.                         continue;
  32.  
  33.                     uint32 reqCastCount = qInfo->RequiredNpcOrGoCount[j];
  34.                     uint16 curCastCount = q_status.CreatureOrGOCount[j];
  35.                     if (curCastCount < reqCastCount)
  36.                     {
  37.                         q_status.CreatureOrGOCount[j] = curCastCount + addCastCount;
  38.  
  39.                         m_QuestStatusSave[questid] = QUEST_DEFAULT_SAVE_TYPE;
  40.  
  41.                         SendQuestUpdateAddCreatureOrGo(qInfo, guid, j, curCastCount, addCastCount);
  42.                     }
  43.  
  44.                     if (CanCompleteQuest(questid))
  45.                         CompleteQuest(questid);
  46.  
  47.                     // same objective target can be in many active quests, but not in 2 objectives for single quest (code optimization).
  48.                     break;
  49.                 }
  50.             }
  51.         }
  52.     }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment