void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPackets::Quest::QuestGiverStatusMultipleQuery& /*packet*/) { TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_STATUS_MULTIPLE_QUERY"); WorldPackets::Quest::QuestGiverStatusMultiple response; for (GuidSet::const_iterator itr = _player->m_clientGUIDs.begin(); itr != _player->m_clientGUIDs.end(); ++itr) { if (itr->IsAnyTypeCreature()) { // need also pet quests case support Creature* questgiver = ObjectAccessor::GetCreatureOrPetOrVehicle(*GetPlayer(), *itr); if (!questgiver || questgiver->IsHostileTo(_player)) continue; if (!questgiver->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER)) continue; response.QuestGiver.emplace_back(questgiver->GetGUID(), _player->GetQuestDialogStatus(questgiver)); } else if (itr->IsGameObject()) { GameObject* questgiver = GetPlayer()->GetMap()->GetGameObject(*itr); if (!questgiver || questgiver->GetGoType() != GAMEOBJECT_TYPE_QUESTGIVER) continue; response.QuestGiver.emplace_back(questgiver->GetGUID(), _player->GetQuestDialogStatus(questgiver)); } } SendPacket(response.Write()); }
void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPacket& /*recvPacket*/) { DEBUG_LOG("WORLD: Received CMSG_QUESTGIVER_STATUS_MULTIPLE_QUERY"); uint32 count = 0; WorldPacket data(SMSG_QUESTGIVER_STATUS_MULTIPLE, 4); data << uint32(count); // placeholder for(GuidSet::const_iterator itr = _player->m_clientGUIDs.begin(); itr != _player->m_clientGUIDs.end(); ++itr) { uint8 dialogStatus = DIALOG_STATUS_NONE; if (itr->IsAnyTypeCreature()) { // need also pet quests case support Creature *questgiver = GetPlayer()->GetMap()->GetAnyTypeCreature(*itr); if (!questgiver || questgiver->IsHostileTo(_player)) continue; if (!questgiver->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER)) continue; dialogStatus = sScriptMgr.GetDialogStatus(_player, questgiver); if (dialogStatus > DIALOG_STATUS_REWARD_REP) dialogStatus = getDialogStatus(_player, questgiver, DIALOG_STATUS_NONE); data << questgiver->GetObjectGuid(); data << uint8(dialogStatus); ++count; } else if (itr->IsGameObject()) { GameObject *questgiver = GetPlayer()->GetMap()->GetGameObject(*itr); if (!questgiver) continue; if (questgiver->GetGoType() != GAMEOBJECT_TYPE_QUESTGIVER) continue; dialogStatus = sScriptMgr.GetDialogStatus(_player, questgiver); if (dialogStatus > DIALOG_STATUS_REWARD_REP) dialogStatus = getDialogStatus(_player, questgiver, DIALOG_STATUS_NONE); data << questgiver->GetObjectGuid(); data << uint8(dialogStatus); ++count; } } data.put<uint32>(0, count); // write real count SendPacket(&data); }
void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPacket& /*recvPacket*/) { TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_STATUS_MULTIPLE_QUERY"); uint32 count = 0; WorldPacket data(SMSG_QUESTGIVER_STATUS_MULTIPLE, 4); data << uint32(count); // placeholder for (GuidSet::const_iterator itr = _player->m_clientGUIDs.begin(); itr != _player->m_clientGUIDs.end(); ++itr) { uint32 questStatus = DIALOG_STATUS_NONE; if (itr->IsAnyTypeCreature()) { // need also pet quests case support Creature* questgiver = ObjectAccessor::GetCreatureOrPetOrVehicle(*GetPlayer(), *itr); if (!questgiver || questgiver->IsHostileTo(_player)) continue; if (!questgiver->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER)) continue; questStatus = _player->GetQuestDialogStatus(questgiver); data << uint64(questgiver->GetGUID()); data << uint8(questStatus); ++count; } else if (itr->IsGameObject()) { GameObject* questgiver = GetPlayer()->GetMap()->GetGameObject(*itr); if (!questgiver || questgiver->GetGoType() != GAMEOBJECT_TYPE_QUESTGIVER) continue; questStatus = _player->GetQuestDialogStatus(questgiver); data << uint64(questgiver->GetGUID()); data << uint8(questStatus); ++count; } } data.put<uint32>(0, count); // write real count SendPacket(&data); }