diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Entities/Creature/GossipDef.cpp | 15 | ||||
-rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 190 | ||||
-rw-r--r-- | src/server/game/Entities/Player/Player.h | 6 | ||||
-rw-r--r-- | src/server/game/Globals/ObjectMgr.cpp | 102 | ||||
-rw-r--r-- | src/server/game/Miscellaneous/SharedDefines.h | 39 | ||||
-rw-r--r-- | src/server/game/Quests/QuestDef.cpp | 56 | ||||
-rw-r--r-- | src/server/game/Quests/QuestDef.h | 33 | ||||
-rw-r--r-- | src/server/game/Server/Packets/QuestPackets.h | 4 |
8 files changed, 231 insertions, 214 deletions
diff --git a/src/server/game/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp index 2b2de44a10d..975a4e74a81 100644 --- a/src/server/game/Entities/Creature/GossipDef.cpp +++ b/src/server/game/Entities/Creature/GossipDef.cpp @@ -229,7 +229,7 @@ void PlayerMenu::SendGossipMenu(uint32 titleTextId, ObjectGuid objectGUID) text.QuestType = item.QuestIcon; text.QuestLevel = quest->GetQuestLevel(); text.QuestFlags[0] = quest->GetFlags(); - text.QuestFlags[1] = 0; + text.QuestFlags[1] = quest->GetFlagsEx(); text.Repeatable = quest->IsRepeatable(); std::string title = quest->GetLogTitle(); @@ -504,12 +504,12 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const packet.QuestID = quest->GetQuestId(); packet.Info.QuestID = quest->GetQuestId(); - packet.Info.QuestType = quest->GetQuestMethod(); + packet.Info.QuestType = quest->GetQuestType(); packet.Info.QuestLevel = quest->GetQuestLevel(); packet.Info.QuestPackageID = quest->GetQuestPackageID(); packet.Info.QuestMinLevel = quest->GetMinLevel(); packet.Info.QuestSortID = quest->GetZoneOrSort(); - packet.Info.QuestInfoID = quest->GetType(); // quest type + packet.Info.QuestInfoID = quest->GetQuestInfoID(); packet.Info.SuggestedGroupNum = quest->GetSuggestedPlayers(); packet.Info.RewardNextQuest = quest->GetNextQuestInChain(); packet.Info.RewardXPDifficulty = quest->GetXPDifficulty(); @@ -517,7 +517,7 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const packet.Info.Float13 = quest->Float13; // Unk if (quest->HasFlag(QUEST_FLAGS_HIDDEN_REWARDS)) - packet.Info.RewardMoney = quest->GetRewMoney(); + packet.Info.RewardMoney = quest->RewardMoney; packet.Info.RewardMoneyDifficulty = quest->GetRewMoneyDifficulty(); packet.Info.RewardBonusMoney = quest->GetRewMoneyMaxLevel(); @@ -575,10 +575,11 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const packet.Info.QuestCompletionLog = questCompletionLog; packet.Info.AllowableRaces = quest->GetAllowableRaces(); - for (uint32 i = 0; i < quest->Objectives.size(); ++i) + for (QuestObjective const& obj : quest->Objectives) { - packet.Info.Objectives.push_back(quest->Objectives[i]); - packet.Info.Objectives.back().Description = questObjectiveDescription[i]; + packet.Info.Objectives.push_back(obj); + // @todo update quets objective locales + //packet.Info.Objectives.back().Description = questObjectiveDescription[i]; } for (uint32 i = 0; i < QUEST_REWARD_CURRENCY_COUNT; ++i) diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index bb0c754ad03..1de521f30cd 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -14316,7 +14316,7 @@ bool Player::CanSeeStartQuest(Quest const* quest) SatisfyQuestPrevChain(quest, false) && SatisfyQuestDay(quest, false) && SatisfyQuestWeek(quest, false) && SatisfyQuestMonth(quest, false) && SatisfyQuestSeasonal(quest, false)) { - return getLevel() + sWorld->getIntConfig(CONFIG_QUEST_HIGH_LEVEL_HIDE_DIFF) >= quest->GetMinLevel(); + return int32(getLevel() + sWorld->getIntConfig(CONFIG_QUEST_HIGH_LEVEL_HIDE_DIFF)) >= quest->GetMinLevel(); } return false; @@ -14382,17 +14382,16 @@ bool Player::CanCompleteQuest(uint32 quest_id) if (q_status.Status == QUEST_STATUS_INCOMPLETE) { - for (uint32 i = 0; i < qInfo->Objectives.size(); ++i) + for (QuestObjective const& obj : qInfo->GetObjectives()) { - QuestObjective const& obj = qInfo->Objectives[i]; - switch (obj.Type) { case QUEST_OBJECTIVE_MONSTER: case QUEST_OBJECTIVE_ITEM: case QUEST_OBJECTIVE_GAMEOBJECT: case QUEST_OBJECTIVE_PLAYERKILLS: - if (q_status.ObjectiveData[i] < obj.Amount) + case QUEST_OBJECTIVE_TALKTO: + if (GetQuestObjectiveData(qInfo, obj.StorageIndex) < obj.Amount) return false; break; case QUEST_OBJECTIVE_MIN_REPUTATION: @@ -14408,7 +14407,7 @@ bool Player::CanCompleteQuest(uint32 quest_id) return false; break; case QUEST_OBJECTIVE_AREATRIGGER: - if (!q_status.ObjectiveData[i]) + if (!GetQuestObjectiveData(qInfo, obj.StorageIndex)) return false; break; default: @@ -14435,8 +14434,8 @@ bool Player::CanCompleteRepeatableQuest(Quest const* quest) return false; if (quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_DELIVER)) - for (uint8 i = 0; i < quest->Objectives.size(); i++) - if (quest->Objectives[i].Type == QUEST_OBJECTIVE_ITEM && quest->Objectives[i].Amount && !HasItemCount(quest->Objectives[i].ObjectID, quest->Objectives[i].Amount)) + for (QuestObjective const& obj : quest->GetObjectives()) + if (obj.Type == QUEST_OBJECTIVE_ITEM && !HasItemCount(obj.ObjectID, obj.Amount)) return false; if (!CanRewardQuest(quest, false)) @@ -14462,21 +14461,21 @@ bool Player::CanRewardQuest(Quest const* quest, bool msg) // prevent receive reward with quest items in bank if (quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_DELIVER)) { - for (uint8 i = 0; i < quest->Objectives.size(); i++) + for (QuestObjective const& obj : quest->GetObjectives()) { - if (quest->Objectives[i].Type != QUEST_OBJECTIVE_ITEM) + if (obj.Type != QUEST_OBJECTIVE_ITEM) continue; - if (GetItemCount(quest->Objectives[i].ObjectID) < uint32(quest->Objectives[i].Amount)) + if (GetItemCount(obj.ObjectID) < uint32(obj.Amount)) { if (msg) - SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL, quest->Objectives[i].ObjectID); + SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL, obj.ObjectID); return false; } } } - for (QuestObjective const& obj : quest->Objectives) + for (QuestObjective const& obj : quest->GetObjectives()) { switch (obj.Type) { @@ -14518,7 +14517,7 @@ void Player::AddQuestAndCheckCompletion(Quest const* quest, Object* questGiver) // destroy not required for quest finish quest starting item bool destroyItem = true; - for (QuestObjective const& obj : quest->Objectives) + for (QuestObjective const& obj : quest->GetObjectives()) { if (obj.Type == QUEST_OBJECTIVE_ITEM && uint32(obj.ObjectID) == item->GetEntry() && item->GetTemplate()->GetMaxCount() > 0) { @@ -14595,12 +14594,17 @@ void Player::AddQuest(Quest const* quest, Object* questGiver) // check for repeatable quests status reset questStatusData.Status = QUEST_STATUS_INCOMPLETE; - questStatusData.ObjectiveData.resize(quest->Objectives.size(), 0); + int32 maxStorageIndex = 0; + for (QuestObjective const& obj : quest->GetObjectives()) + if (obj.StorageIndex > maxStorageIndex) + maxStorageIndex = obj.StorageIndex; + + questStatusData.ObjectiveData.resize(maxStorageIndex+1, 0); GiveQuestSourceItem(quest); AdjustQuestReqItemCount(quest); - for (QuestObjective const& obj : quest->Objectives) + for (QuestObjective const& obj : quest->GetObjectives()) if (obj.Type == QUEST_OBJECTIVE_MIN_REPUTATION || obj.Type == QUEST_OBJECTIVE_MAX_REPUTATION) if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(obj.ObjectID)) GetReputationMgr().SetVisible(factionEntry); @@ -14718,7 +14722,7 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver, uint32 quest_id = quest->GetQuestId(); - for (QuestObjective const& obj : quest->Objectives) + for (QuestObjective const& obj : quest->GetObjectives()) { switch (obj.Type) { @@ -14929,7 +14933,7 @@ void Player::FailQuest(uint32 questId) SendQuestFailed(questId); // Destroy quest items on quest failure. - for (QuestObjective const& obj : quest->Objectives) + for (QuestObjective const& obj : quest->GetObjectives()) if (obj.Type == QUEST_OBJECTIVE_ITEM) DestroyItemCount(obj.ObjectID, obj.Amount, true, true); // Destroy items received during the quest. @@ -15425,7 +15429,7 @@ bool Player::TakeQuestSourceItem(uint32 questId, bool msg) ASSERT(item); bool destroyItem = true; if (item->GetStartQuest() == questId) - for (QuestObjective const& obj : quest->Objectives) + for (QuestObjective const& obj : quest->GetObjectives()) if (obj.Type == QUEST_OBJECTIVE_ITEM && srcItemId == uint32(obj.ObjectID)) destroyItem = false; @@ -15658,9 +15662,9 @@ uint16 Player::GetReqKillOrCastCurrentCount(uint32 quest_id, int32 entry) if (!qInfo) return 0; - for (uint8 j = 0; j < qInfo->Objectives.size(); ++j) - if (qInfo->Objectives[j].ObjectID == entry) - return GetQuestObjectiveData(qInfo, j); + for (QuestObjective const& obj : qInfo->GetObjectives()) + if (obj.ObjectID == entry) + return GetQuestObjectiveData(qInfo, obj.StorageIndex); return 0; } @@ -15669,14 +15673,14 @@ void Player::AdjustQuestReqItemCount(Quest const* quest) { if (quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_DELIVER)) { - for (uint8 i = 0; i < quest->Objectives.size(); ++i) + for (QuestObjective const& obj : quest->GetObjectives()) { - if (quest->Objectives[i].Type != QUEST_OBJECTIVE_ITEM) + if (obj.Type != QUEST_OBJECTIVE_ITEM) continue; - uint32 reqItemCount = quest->Objectives[i].Amount; - uint32 curItemCount = GetItemCount(quest->Objectives[i].ObjectID, true); - SetQuestObjectiveData(quest, i, std::min(curItemCount, reqItemCount)); + uint32 reqItemCount = obj.Amount; + uint32 curItemCount = GetItemCount(obj.ObjectID, true); + SetQuestObjectiveData(quest, obj.StorageIndex, std::min(curItemCount, reqItemCount)); } } } @@ -15814,20 +15818,20 @@ void Player::ItemAddedQuestCheck(uint32 entry, uint32 count) if (!qInfo || !qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAGS_DELIVER)) continue; - for (uint8 j = 0; j < qInfo->Objectives.size(); ++j) + for (QuestObjective const& obj : qInfo->GetObjectives()) { - if (qInfo->Objectives[j].Type != QUEST_OBJECTIVE_ITEM) + if (obj.Type != QUEST_OBJECTIVE_ITEM) continue; - uint32 reqItem = qInfo->Objectives[j].ObjectID; + uint32 reqItem = obj.ObjectID; if (reqItem == entry) { - uint32 reqItemCount = qInfo->Objectives[j].Amount; - uint32 curItemCount = GetQuestObjectiveData(qInfo, j); + uint32 reqItemCount = obj.Amount; + uint32 curItemCount = GetQuestObjectiveData(qInfo, obj.StorageIndex); if (curItemCount < reqItemCount) { uint32 newItemCount = std::min<uint32>(curItemCount + count, reqItemCount); - SetQuestObjectiveData(qInfo, j, newItemCount); + SetQuestObjectiveData(qInfo, obj.StorageIndex, newItemCount); //SendQuestUpdateAddItem(qInfo, j, additemcount); // FIXME: verify if there's any packet sent updating item @@ -15858,16 +15862,16 @@ void Player::ItemRemovedQuestCheck(uint32 entry, uint32 count) if (!qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAGS_DELIVER)) continue; - for (uint8 j = 0; j < qInfo->Objectives.size(); ++j) + for (QuestObjective const& obj : qInfo->GetObjectives()) { - if (qInfo->Objectives[j].Type != QUEST_OBJECTIVE_ITEM) + if (obj.Type != QUEST_OBJECTIVE_ITEM) continue; - uint32 reqItem = qInfo->Objectives[j].ObjectID; + uint32 reqItem = obj.ObjectID; if (reqItem == entry) { - uint32 reqItemCount = qInfo->Objectives[j].Amount; - uint16 curItemCount = GetQuestObjectiveData(qInfo, j); + uint32 reqItemCount = obj.Amount; + uint16 curItemCount = GetQuestObjectiveData(qInfo, obj.StorageIndex); if (curItemCount >= reqItemCount) // we may have more than what the status shows curItemCount = GetItemCount(entry, false); @@ -15876,7 +15880,7 @@ void Player::ItemRemovedQuestCheck(uint32 entry, uint32 count) if (newItemCount < reqItemCount) { - SetQuestObjectiveData(qInfo, j, newItemCount); + SetQuestObjectiveData(qInfo, obj.StorageIndex, newItemCount); IncompleteQuest(questid); } return; @@ -15922,27 +15926,28 @@ void Player::KilledMonsterCredit(uint32 entry, ObjectGuid guid /*= ObjectGuid::E Quest const* qInfo = sObjectMgr->GetQuestTemplate(questid); if (!qInfo) continue; + // just if !ingroup || !noraidgroup || raidgroup QuestStatusData& q_status = m_QuestStatus[questid]; if (q_status.Status == QUEST_STATUS_INCOMPLETE && (!GetGroup() || !GetGroup()->isRaidGroup() || qInfo->IsAllowedInRaid(GetMap()->GetDifficulty()))) { if (qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAGS_KILL) /*&& !qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAGS_CAST)*/) { - for (uint8 j = 0; j < qInfo->Objectives.size(); ++j) + for (QuestObjective const& obj : qInfo->GetObjectives()) { - if (qInfo->Objectives[j].Type != QUEST_OBJECTIVE_MONSTER) + if (obj.Type != QUEST_OBJECTIVE_MONSTER) continue; - uint32 reqkill = qInfo->Objectives[j].ObjectID; + uint32 reqkill = obj.ObjectID; if (reqkill == real_entry) { - uint32 reqKillCount = qInfo->Objectives[j].Amount; - uint16 curKillCount = GetQuestObjectiveData(qInfo, j); + uint32 reqKillCount = obj.Amount; + uint16 curKillCount = GetQuestObjectiveData(qInfo, obj.StorageIndex); if (curKillCount < reqKillCount) { - SetQuestObjectiveData(qInfo, j, curKillCount + addKillCount); - SendQuestUpdateAddCredit(qInfo, guid, j, curKillCount + addKillCount); + SetQuestObjectiveData(qInfo, obj.StorageIndex, curKillCount + addKillCount); + SendQuestUpdateAddCredit(qInfo, guid, obj, curKillCount + addKillCount); } if (CanCompleteQuest(questid)) @@ -15979,16 +15984,16 @@ void Player::KilledPlayerCredit() QuestStatusData& q_status = m_QuestStatus[questid]; if (q_status.Status == QUEST_STATUS_INCOMPLETE && (!GetGroup() || !GetGroup()->isRaidGroup() || qInfo->IsAllowedInRaid(GetMap()->GetDifficulty()))) { - for (uint32 i = 0; i < qInfo->Objectives.size(); ++i) + for (QuestObjective const& obj : qInfo->GetObjectives()) { - if (qInfo->Objectives[i].Type != QUEST_OBJECTIVE_PLAYERKILLS) + if (obj.Type != QUEST_OBJECTIVE_PLAYERKILLS) continue; - uint32 curKillCount = GetQuestObjectiveData(qInfo, i); - if (curKillCount < uint32(qInfo->Objectives[i].Amount)) + uint32 curKillCount = GetQuestObjectiveData(qInfo, obj.StorageIndex); + if (curKillCount < uint32(obj.Amount)) { - SetQuestObjectiveData(qInfo, i, curKillCount + addKillCount); - SendQuestUpdateAddPlayer(qInfo, curKillCount + addKillCount, qInfo->Objectives[i].Amount); + SetQuestObjectiveData(qInfo, obj.StorageIndex, curKillCount + addKillCount); + SendQuestUpdateAddPlayer(qInfo, curKillCount + addKillCount, obj.Amount); } if (CanCompleteQuest(questid)) @@ -16020,23 +16025,23 @@ void Player::KillCreditGO(uint32 entry, ObjectGuid guid) { if (qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAGS_CAST) /*&& !qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAGS_KILL)*/) { - for (uint8 j = 0; j < qInfo->Objectives.size(); ++j) + for (QuestObjective const& obj : qInfo->GetObjectives()) { - if (qInfo->Objectives[j].Type != QUEST_OBJECTIVE_GAMEOBJECT) + if (obj.Type != QUEST_OBJECTIVE_GAMEOBJECT) continue; - uint32 reqTarget = qInfo->Objectives[j].ObjectID; + uint32 reqTarget = obj.ObjectID; // other not this creature/GO related objectives if (reqTarget != entry) continue; - uint32 reqCastCount = qInfo->Objectives[j].Amount; - uint32 curCastCount = GetQuestObjectiveData(qInfo, j); + uint32 reqCastCount = obj.Amount; + uint32 curCastCount = GetQuestObjectiveData(qInfo, obj.StorageIndex); if (curCastCount < reqCastCount) { - SetQuestObjectiveData(qInfo, j, curCastCount + addCastCount); - SendQuestUpdateAddCredit(qInfo, guid, j, curCastCount + addCastCount); + SetQuestObjectiveData(qInfo, obj.StorageIndex, curCastCount + addCastCount); + SendQuestUpdateAddCredit(qInfo, guid, obj, curCastCount + addCastCount); } if (CanCompleteQuest(questid)) @@ -16069,21 +16074,21 @@ void Player::TalkedToCreature(uint32 entry, ObjectGuid guid) { if (qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAGS_KILL | QUEST_SPECIAL_FLAGS_CAST | QUEST_SPECIAL_FLAGS_SPEAKTO)) { - for (uint8 j = 0; j < qInfo->Objectives.size(); ++j) + for (QuestObjective const& obj : qInfo->GetObjectives()) { - if (qInfo->Objectives[j].Type != QUEST_OBJECTIVE_TALKTO) + if (obj.Type != QUEST_OBJECTIVE_TALKTO) continue; - uint32 reqTarget = qInfo->Objectives[j].ObjectID; + uint32 reqTarget = obj.ObjectID; if (reqTarget == entry) { - uint32 reqTalkCount = qInfo->Objectives[j].Amount; - uint32 curTalkCount = GetQuestObjectiveData(qInfo, j); + uint32 reqTalkCount = obj.Amount; + uint32 curTalkCount = GetQuestObjectiveData(qInfo, obj.StorageIndex); if (curTalkCount < reqTalkCount) { - SetQuestObjectiveData(qInfo, j, curTalkCount + addTalkCount); - SendQuestUpdateAddCredit(qInfo, guid, j, curTalkCount + addTalkCount); + SetQuestObjectiveData(qInfo, obj.StorageIndex, curTalkCount + addTalkCount); + SendQuestUpdateAddCredit(qInfo, guid, obj, curTalkCount + addTalkCount); } if (CanCompleteQuest(questid)) @@ -16144,7 +16149,7 @@ void Player::ReputationChanged(FactionEntry const* factionEntry) { QuestStatusData& q_status = m_QuestStatus[questid]; - for (QuestObjective const& obj : qInfo->Objectives) + for (QuestObjective const& obj : qInfo->GetObjectives()) { if (uint32(obj.ObjectID) != factionEntry->ID) continue; @@ -16210,9 +16215,9 @@ bool Player::HasQuestForItem(uint32 itemid) const // There should be no mixed ReqItem/ReqSource drop // This part for ReqItem drop - for (uint8 j = 0; j < qInfo->Objectives.size(); ++j) + for (QuestObjective const& obj : qInfo->GetObjectives()) { - if (qInfo->Objectives[j].Type == QUEST_OBJECTIVE_ITEM && itemid == uint32(qInfo->Objectives[j].ObjectID) && q_status.ObjectiveData[j] < qInfo->Objectives[j].Amount) + if (obj.Type == QUEST_OBJECTIVE_ITEM && itemid == uint32(obj.ObjectID) && GetQuestObjectiveData(qInfo, obj.StorageIndex) < obj.Amount) return true; } // This part - for ReqSource @@ -16241,8 +16246,11 @@ bool Player::HasQuestForItem(uint32 itemid) const return false; } -int32 Player::GetQuestObjectiveData(Quest const* quest, uint32 objective) const +int32 Player::GetQuestObjectiveData(Quest const* quest, int8 storageIndex) const { + if (storageIndex < 0) + TC_LOG_ERROR("entities.player.quest", "GetQuestObjectiveData: called for quest %u with invalid StorageIndex %d (objective data is not tracked)", quest->GetQuestId(), storageIndex); + auto itr = m_QuestStatus.find(quest->GetQuestId()); if (itr == m_QuestStatus.end()) @@ -16253,17 +16261,20 @@ int32 Player::GetQuestObjectiveData(Quest const* quest, uint32 objective) const QuestStatusData const& status = itr->second; - if (objective >= status.ObjectiveData.size()) + if (uint8(storageIndex) >= status.ObjectiveData.size()) { - TC_LOG_ERROR("entities.player.quest", "GetQuestObjectiveData: player %s (%s) quest %u out of range objective index %u", GetName().c_str(), GetGUID().ToString().c_str(), quest->GetQuestId(), objective); + TC_LOG_ERROR("entities.player.quest", "GetQuestObjectiveData: player %s (%s) quest %u out of range StorageIndex %u", GetName().c_str(), GetGUID().ToString().c_str(), quest->GetQuestId(), storageIndex); return 0; } - return status.ObjectiveData[objective]; + return status.ObjectiveData[storageIndex]; } -void Player::SetQuestObjectiveData(Quest const* quest, uint32 objective, int32 data) +void Player::SetQuestObjectiveData(Quest const* quest, int8 storageIndex, int32 data) { + if (storageIndex < 0) + TC_LOG_ERROR("entities.player.quest", "SetQuestObjectiveData: called for quest %u with invalid StorageIndex %d (objective data is not tracked)", quest->GetQuestId(), storageIndex); + auto itr = m_QuestStatus.find(quest->GetQuestId()); if (itr == m_QuestStatus.end()) @@ -16274,18 +16285,18 @@ void Player::SetQuestObjectiveData(Quest const* quest, uint32 objective, int32 d QuestStatusData& status = itr->second; - if (objective >= status.ObjectiveData.size()) + if (uint8(storageIndex) >= status.ObjectiveData.size()) { - TC_LOG_ERROR("entities.player.quest", "SetQuestObjectiveData: player %s (%s) quest %u out of range objective index %u", GetName().c_str(), GetGUID().ToString().c_str(), quest->GetQuestId(), objective); + TC_LOG_ERROR("entities.player.quest", "SetQuestObjectiveData: player %s (%s) quest %u out of range StorageIndex %u", GetName().c_str(), GetGUID().ToString().c_str(), quest->GetQuestId(), storageIndex); return; } // No change - if (status.ObjectiveData[objective] == data) + if (status.ObjectiveData[storageIndex] == data) return; // Set data - status.ObjectiveData[objective] = data; + status.ObjectiveData[storageIndex] = data; // Add to save m_QuestStatusSave[quest->GetQuestId()] = QUEST_DEFAULT_SAVE_TYPE; @@ -16293,7 +16304,7 @@ void Player::SetQuestObjectiveData(Quest const* quest, uint32 objective, int32 d // Update quest fields uint16 log_slot = FindQuestSlot(quest->GetQuestId()); if (log_slot < MAX_QUEST_LOG_SIZE) - SetQuestSlotCounter(log_slot, objective, status.ObjectiveData[objective]); + SetQuestSlotCounter(log_slot, storageIndex, status.ObjectiveData[storageIndex]); } void Player::SendQuestComplete(Quest const* quest) @@ -16408,15 +16419,15 @@ void Player::SendPushToPartyResponse(Player* player, uint8 msg) } } -void Player::SendQuestUpdateAddCredit(Quest const* quest, ObjectGuid guid, uint32 objective, uint16 count) +void Player::SendQuestUpdateAddCredit(Quest const* quest, ObjectGuid guid, QuestObjective const& obj, uint16 count) { WorldPackets::Quest::QuestUpdateAddCredit packet; packet.VictimGUID = guid; packet.QuestID = quest->GetQuestId(); - packet.ObjectID = quest->Objectives[objective].ObjectID; + packet.ObjectID = obj.ObjectID; packet.Count = count; - packet.Required = quest->Objectives[objective].Amount; - packet.ObjectiveType = quest->Objectives[objective].Type; + packet.Required = obj.Amount; + packet.ObjectiveType = obj.Type; GetSession()->SendPacket(packet.Write()); } @@ -18061,7 +18072,12 @@ void Player::_LoadQuestStatus(PreparedQueryResult result) } // Resize quest objective data to proper size - questStatusData.ObjectiveData.resize(quest->GetObjectives().size()); + int32 maxStorageIndex = 0; + for (QuestObjective const& obj : quest->GetObjectives()) + if (obj.StorageIndex > maxStorageIndex) + maxStorageIndex = obj.StorageIndex; + + questStatusData.ObjectiveData.resize(maxStorageIndex+1); TC_LOG_DEBUG("entities.player.loading", "Quest status is {%u} for quest {%u} for player (%s)", questStatusData.Status, quest_id, GetGUID().ToString().c_str()); } @@ -23588,12 +23604,12 @@ bool Player::HasQuestForGO(int32 GOId) const if (GetGroup() && GetGroup()->isRaidGroup() && !qInfo->IsAllowedInRaid(GetMap()->GetDifficulty())) continue; - for (uint32 j = 0; j < qInfo->Objectives.size(); ++j) + for (QuestObjective const& obj : qInfo->GetObjectives()) { - if (qInfo->Objectives[j].Type != QUEST_OBJECTIVE_GAMEOBJECT) //skip non GO case + if (obj.Type != QUEST_OBJECTIVE_GAMEOBJECT) //skip non GO case continue; - if (GOId == qInfo->Objectives[j].ObjectID && qs.ObjectiveData[j] < qInfo->Objectives[j].Amount) + if (GOId == obj.ObjectID && GetQuestObjectiveData(qInfo, obj.StorageIndex) < obj.Amount) return true; } } diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 92556f106bf..d0da77eb881 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1660,8 +1660,8 @@ class Player : public Unit, public GridObject<Player> void UpdateForQuestWorldObjects(); bool CanShareQuest(uint32 questId) const; - int32 GetQuestObjectiveData(Quest const* quest, uint32 objective) const; - void SetQuestObjectiveData(Quest const* quest, uint32 objective, int32 data); + int32 GetQuestObjectiveData(Quest const* quest, int8 storageIndex) const; + void SetQuestObjectiveData(Quest const* quest, int8 storageIndex, int32 data); void SendQuestComplete(Quest const* quest); void SendQuestReward(Quest const* quest, uint32 XP); void SendQuestFailed(uint32 questId, InventoryResult reason = EQUIP_ERR_OK); @@ -1669,7 +1669,7 @@ class Player : public Unit, public GridObject<Player> void SendCanTakeQuestResponse(QuestFailedReason msg) const; void SendQuestConfirmAccept(Quest const* quest, Player* pReceiver); void SendPushToPartyResponse(Player* player, uint8 msg); - void SendQuestUpdateAddCredit(Quest const* quest, ObjectGuid guid, uint32 objective, uint16 count); + void SendQuestUpdateAddCredit(Quest const* quest, ObjectGuid guid, QuestObjective const& obj, uint16 count); void SendQuestUpdateAddPlayer(Quest const* quest, uint16 newCount, uint32 required); ObjectGuid GetDivider() const { return m_divider; } diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 1a5c7ad64c5..8240b0c3482 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -3629,8 +3629,8 @@ void ObjectMgr::LoadQuests() } // Load `quest_visual_effect` join table with quest_objectives because visual effects are based on objective ID (core stores objectives by their index in quest) - // 0 1 2 3 4 5 - result = WorldDatabase.Query("SELECT v.ID, o.ID, o.QuestID, o.StorageIndex, v.Index, v.VisualEffect FROM quest_visual_effect AS v LEFT JOIN quest_objectives AS o ON v.ID = o.ID ORDER BY v.Index DESC"); + // 0 1 2 3 4 + result = WorldDatabase.Query("SELECT v.ID, o.ID, o.QuestID, v.Index, v.VisualEffect FROM quest_visual_effect AS v LEFT JOIN quest_objectives AS o ON v.ID = o.ID ORDER BY v.Index DESC"); if (!result) { @@ -3679,8 +3679,8 @@ void ObjectMgr::LoadQuests() // additional quest integrity checks (GO, creature_template and item_template must be loaded already) - if (qinfo->GetQuestMethod() >= 3) - TC_LOG_ERROR("sql.sql", "Quest %u has `Method` = %u, expected values are 0, 1 or 2.", qinfo->GetQuestId(), qinfo->GetQuestMethod()); + if (qinfo->GetQuestType() >= MAX_QUEST_TYPES) + TC_LOG_ERROR("sql.sql", "Quest %u has `Method` = %u, expected values are 0, 1 or 2.", qinfo->GetQuestId(), qinfo->GetQuestType()); if (qinfo->SpecialFlags & ~QUEST_SPECIAL_FLAGS_DB_ALLOWED) { @@ -3743,32 +3743,32 @@ void ObjectMgr::LoadQuests() } // client quest log visual (area case) - if (qinfo->ZoneOrSort > 0) + if (qinfo->QuestSortID > 0) { - if (!GetAreaEntryByAreaID(qinfo->ZoneOrSort)) + if (!GetAreaEntryByAreaID(qinfo->QuestSortID)) { - TC_LOG_ERROR("sql.sql", "Quest %u has `ZoneOrSort` = %u (zone case) but zone with this id does not exist.", - qinfo->GetQuestId(), qinfo->ZoneOrSort); + TC_LOG_ERROR("sql.sql", "Quest %u has `QuestSortID` = %u (zone case) but zone with this id does not exist.", + qinfo->GetQuestId(), qinfo->QuestSortID); // no changes, quest not dependent from this value but can have problems at client } } // client quest log visual (sort case) - if (qinfo->ZoneOrSort < 0) + if (qinfo->QuestSortID < 0) { - QuestSortEntry const* qSort = sQuestSortStore.LookupEntry(-int32(qinfo->ZoneOrSort)); + QuestSortEntry const* qSort = sQuestSortStore.LookupEntry(-int32(qinfo->QuestSortID)); if (!qSort) { - TC_LOG_ERROR("sql.sql", "Quest %u has `ZoneOrSort` = %i (sort case) but quest sort with this id does not exist.", - qinfo->GetQuestId(), qinfo->ZoneOrSort); + TC_LOG_ERROR("sql.sql", "Quest %u has `QuestSortID` = %i (sort case) but quest sort with this id does not exist.", + qinfo->GetQuestId(), qinfo->QuestSortID); // no changes, quest not dependent from this value but can have problems at client (note some may be 0, we must allow this so no check) } //check for proper RequiredSkillId value (skill case) - if (uint32 skill_id = SkillByQuestSort(-int32(qinfo->ZoneOrSort))) + if (uint32 skill_id = SkillByQuestSort(-int32(qinfo->QuestSortID))) { if (qinfo->RequiredSkillId != skill_id) { - TC_LOG_ERROR("sql.sql", "Quest %u has `ZoneOrSort` = %i but `RequiredSkillId` does not have a corresponding value (%d).", - qinfo->GetQuestId(), qinfo->ZoneOrSort, skill_id); + TC_LOG_ERROR("sql.sql", "Quest %u has `QuestSortID` = %i but `RequiredSkillId` does not have a corresponding value (%d).", + qinfo->GetQuestId(), qinfo->QuestSortID, skill_id); //override, and force proper value here? } } @@ -3902,31 +3902,24 @@ void ObjectMgr::LoadQuests() } } - for (uint32 j = 0; j < qinfo->Objectives.size(); ++j) + for (QuestObjective const& obj : qinfo->GetObjectives()) { - QuestObjective& obj = qinfo->Objectives[j]; - - // Might be intended in blizz so it is debug output - if (!obj.ID) - { - TC_LOG_DEBUG("sql.sql", "Quest %u is missing objective %u", qinfo->GetQuestId(), j); - // Prevent objective to be parsed as QUEST_OBJECTIVE_MONSTER - obj.Type = QUEST_OBJECTIVE_NONE; - continue; - } - - if (!obj.ObjectID) - { - TC_LOG_ERROR("sql.sql", "Quest %u objective %u has `ObjectID` = 0, quest can't be done.", qinfo->GetQuestId(), j); - // no changes, quest can't be done for this requirement - continue; - } - - if (!obj.Amount) + // Check storage index for objectives which store data + if (obj.StorageIndex < 0) { - TC_LOG_ERROR("sql.sql", "Quest %u objective %u has `Amount` = 0, quest can't be done.", qinfo->GetQuestId(), j); - // no changes, quest can't be done for this requirement - continue; + switch (obj.Type) + { + case QUEST_OBJECTIVE_MONSTER: + case QUEST_OBJECTIVE_ITEM: + case QUEST_OBJECTIVE_GAMEOBJECT: + case QUEST_OBJECTIVE_TALKTO: + case QUEST_OBJECTIVE_PLAYERKILLS: + case QUEST_OBJECTIVE_AREATRIGGER: + TC_LOG_ERROR("sql.sql", "Quest %u objective %u has invalid StorageIndex = %d for objective type %u", qinfo->GetQuestId(), obj.ID, obj.StorageIndex, obj.Type); + break; + default: + break; + } } switch (obj.Type) @@ -3934,48 +3927,43 @@ void ObjectMgr::LoadQuests() case QUEST_OBJECTIVE_ITEM: qinfo->SetSpecialFlag(QUEST_SPECIAL_FLAGS_DELIVER); if (!sObjectMgr->GetItemTemplate(obj.ObjectID)) - { TC_LOG_ERROR("sql.sql", "Quest %u objective %u has non existing item entry %u, quest can't be done.", - qinfo->GetQuestId(), j, obj.ObjectID); - obj.Amount = 0; // prevent incorrect work of quest - } + qinfo->GetQuestId(), obj.ID, obj.ObjectID); break; case QUEST_OBJECTIVE_MONSTER: - qinfo->SetSpecialFlag(QUEST_SPECIAL_FLAGS_KILL | QUEST_SPECIAL_FLAGS_CAST | QUEST_SPECIAL_FLAGS_SPEAKTO); + qinfo->SetSpecialFlag(QUEST_SPECIAL_FLAGS_KILL | QUEST_SPECIAL_FLAGS_CAST); if (!sObjectMgr->GetCreatureTemplate(obj.ObjectID)) - { TC_LOG_ERROR("sql.sql", "Quest %u objective %u has non existing creature entry %u, quest can't be done.", - qinfo->GetQuestId(), j, uint32(obj.ObjectID)); - obj.Amount = 0; // quest can't be done for this requirement - } + qinfo->GetQuestId(), obj.ID, uint32(obj.ObjectID)); break; case QUEST_OBJECTIVE_GAMEOBJECT: - qinfo->SetSpecialFlag(QUEST_SPECIAL_FLAGS_KILL | QUEST_SPECIAL_FLAGS_CAST | QUEST_SPECIAL_FLAGS_SPEAKTO); + qinfo->SetSpecialFlag(QUEST_SPECIAL_FLAGS_KILL | QUEST_SPECIAL_FLAGS_CAST); if (!sObjectMgr->GetGameObjectTemplate(obj.ObjectID)) - { TC_LOG_ERROR("sql.sql", "Quest %u objective %u has non existing gameobject entry %u, quest can't be done.", - qinfo->GetQuestId(), j, uint32(obj.ObjectID)); - obj.Amount = 0; // quest can't be done for this requirement - } + qinfo->GetQuestId(), obj.ID, uint32(obj.ObjectID)); + break; + case QUEST_OBJECTIVE_TALKTO: + // Need checks (is it creature only?) + qinfo->SetSpecialFlag(QUEST_SPECIAL_FLAGS_CAST | QUEST_SPECIAL_FLAGS_SPEAKTO); break; case QUEST_OBJECTIVE_MIN_REPUTATION: case QUEST_OBJECTIVE_MAX_REPUTATION: if (!sFactionStore.LookupEntry(obj.ObjectID)) - TC_LOG_ERROR("sql.sql", "Quest %u objective %u has non existing faction id %u", qinfo->GetQuestId(), j, obj.ObjectID); + TC_LOG_ERROR("sql.sql", "Quest %u objective %u has non existing faction id %u", qinfo->GetQuestId(), obj.ID, obj.ObjectID); break; case QUEST_OBJECTIVE_PLAYERKILLS: qinfo->SetSpecialFlag(QUEST_SPECIAL_FLAGS_PLAYER_KILL); if (obj.Amount <= 0) - TC_LOG_ERROR("sql.sql", "Quest %u objective %u has invalid player kills count %d", qinfo->GetQuestId(), j, obj.Amount); + TC_LOG_ERROR("sql.sql", "Quest %u objective %u has invalid player kills count %d", qinfo->GetQuestId(), obj.ID, obj.Amount); break; case QUEST_OBJECTIVE_CURRENCY: if (!sCurrencyTypesStore.LookupEntry(obj.ObjectID)) - TC_LOG_ERROR("sql.sql", "Quest %u objective %u has non existing currency %u", qinfo->GetQuestId(), j, obj.ObjectID); + TC_LOG_ERROR("sql.sql", "Quest %u objective %u has non existing currency %u", qinfo->GetQuestId(), obj.ID, obj.ObjectID); if (obj.Amount <= 0) - TC_LOG_ERROR("sql.sql", "Quest %u objective %u has invalid currency amount %d", qinfo->GetQuestId(), j, obj.Amount); + TC_LOG_ERROR("sql.sql", "Quest %u objective %u has invalid currency amount %d", qinfo->GetQuestId(), obj.ID, obj.Amount); break; default: - TC_LOG_ERROR("sql.sql", "Quest %u objective %u has unknown type %u", qinfo->GetQuestId(), j, obj.Type); + TC_LOG_ERROR("sql.sql", "Quest %u objective %u has unhandled type %u", qinfo->GetQuestId(), obj.ID, obj.Type); } } diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h index 0f84ebf692b..a8ec552cd0a 100644 --- a/src/server/game/Miscellaneous/SharedDefines.h +++ b/src/server/game/Miscellaneous/SharedDefines.h @@ -3722,23 +3722,32 @@ enum HolidayIds //HOLIDAY_CALL_TO_ARMS_DG = 516 }; +enum QuestType +{ + QUEST_TYPE_AUTOCOMPLETE = 0, + QUEST_TYPE_DISABLED = 1, + QUEST_TYPE_NORMAL = 2, + QUEST_TYPE_UNK = 3, + MAX_QUEST_TYPES = 4 +}; + // QuestInfo.dbc (6.0.2.18988) -enum QuestTypes +enum QuestInfo { - QUEST_TYPE_GROUP = 1, - QUEST_TYPE_CLASS = 21, - QUEST_TYPE_PVP = 41, - QUEST_TYPE_RAID = 62, - QUEST_TYPE_DUNGEON = 81, - QUEST_TYPE_WORLD_EVENT = 82, - QUEST_TYPE_LEGENDARY = 83, - QUEST_TYPE_ESCORT = 84, - QUEST_TYPE_HEROIC = 85, - QUEST_TYPE_RAID_10 = 88, - QUEST_TYPE_RAID_25 = 89, - QUEST_TYPE_SCENARIO = 98, - QUEST_TYPE_ACCOUNT = 102, - QUEST_TYPE_SIDE_QUEST = 104 + QUEST_INFO_GROUP = 1, + QUEST_INFO_CLASS = 21, + QUEST_INFO_PVP = 41, + QUEST_INFO_RAID = 62, + QUEST_INFO_DUNGEON = 81, + QUEST_INFO_WORLD_EVENT = 82, + QUEST_INFO_LEGENDARY = 83, + QUEST_INFO_ESCORT = 84, + QUEST_INFO_HEROIC = 85, + QUEST_INFO_RAID_10 = 88, + QUEST_INFO_RAID_25 = 89, + QUEST_INFO_SCENARIO = 98, + QUEST_INFO_ACCOUNT = 102, + QUEST_INFO_SIDE_QUEST = 104 }; // QuestSort.dbc (6.0) diff --git a/src/server/game/Quests/QuestDef.cpp b/src/server/game/Quests/QuestDef.cpp index 11d175ce6ab..ca69806e689 100644 --- a/src/server/game/Quests/QuestDef.cpp +++ b/src/server/game/Quests/QuestDef.cpp @@ -24,13 +24,13 @@ Quest::Quest(Field* questRecord) { - Id = questRecord[0].GetUInt32(); - Method = questRecord[1].GetUInt8(); + ID = questRecord[0].GetUInt32(); + Type = questRecord[1].GetUInt8(); Level = questRecord[2].GetInt32(); PackageID = questRecord[3].GetUInt32(); - MinLevel = questRecord[4].GetUInt32(); - ZoneOrSort = questRecord[5].GetInt16(); - Type = questRecord[6].GetUInt16(); + MinLevel = questRecord[4].GetInt32(); + QuestSortID = questRecord[5].GetInt16(); + QuestInfoID = questRecord[6].GetUInt16(); SuggestedPlayers = questRecord[7].GetUInt8(); NextQuestInChain = questRecord[8].GetUInt32(); RewardXPDifficulty = questRecord[9].GetUInt32(); @@ -179,34 +179,35 @@ void Quest::LoadQuestTemplateAddon(Field* fields) void Quest::LoadQuestObjective(Field* fields) { - uint8 storageIndex = fields[3].GetUInt8(); - - // Allocate space - if (storageIndex >= Objectives.size()) - Objectives.resize(storageIndex+1); - - QuestObjective& obj = Objectives[storageIndex]; + QuestObjective obj; obj.ID = fields[0].GetUInt32(); obj.Type = fields[2].GetUInt8(); - obj.StorageIndex = storageIndex; + obj.StorageIndex = fields[3].GetInt8(); obj.ObjectID = fields[4].GetInt32(); obj.Amount = fields[5].GetInt32(); obj.Flags = fields[6].GetUInt32(); obj.UnkFloat = fields[7].GetFloat(); obj.Description = fields[8].GetString(); + + Objectives.push_back(obj); } void Quest::LoadQuestObjectiveVisualEffect(Field* fields) { - // No need to check index because checks is objective exists are done in ObjectMgr while loading quest_visual_effect - uint8 storageIndex = fields[3].GetUInt8(); - QuestObjective& obj = Objectives[storageIndex]; + uint8 objID = fields[1].GetUInt32(); - uint8 effectIndex = fields[4].GetUInt8(); - if (effectIndex >= obj.VisualEffects.size()) - obj.VisualEffects.resize(effectIndex+1, 0); + for (QuestObjective& obj : Objectives) + { + if (obj.ID == objID) + { + uint8 effectIndex = fields[3].GetUInt8(); + if (effectIndex >= obj.VisualEffects.size()) + obj.VisualEffects.resize(effectIndex+1, 0); - obj.VisualEffects[effectIndex] = fields[5].GetInt32(); + obj.VisualEffects[effectIndex] = fields[4].GetInt32(); + break; + } + } } uint32 Quest::XPValue(uint32 playerLevel) const @@ -240,9 +241,12 @@ uint32 Quest::XPValue(uint32 playerLevel) const return 0; } -int32 Quest::GetRewMoney() const +uint32 Quest::GetRewMoney() const { - return int32(RewardMoney * sWorld->getRate(RATE_MONEY_QUEST)); + if (RewardMoney > 0) + return RewardMoney * sWorld->getRate(RATE_MONEY_QUEST); + else + return 0; } void Quest::BuildQuestRewards(WorldPackets::Quest::QuestRewards& rewards, Player* player) const @@ -302,18 +306,18 @@ bool Quest::IsAutoAccept() const bool Quest::IsAutoComplete() const { - return !sWorld->getBoolConfig(CONFIG_QUEST_IGNORE_AUTO_COMPLETE) && Method == 0; + return !sWorld->getBoolConfig(CONFIG_QUEST_IGNORE_AUTO_COMPLETE) && Type == QUEST_TYPE_AUTOCOMPLETE; } bool Quest::IsRaidQuest(Difficulty difficulty) const { switch (Type) { - case QUEST_TYPE_RAID: + case QUEST_INFO_RAID: return true; - case QUEST_TYPE_RAID_10: + case QUEST_INFO_RAID_10: return !(difficulty & RAID_DIFFICULTY_MASK_25MAN); - case QUEST_TYPE_RAID_25: + case QUEST_INFO_RAID_25: return difficulty & RAID_DIFFICULTY_MASK_25MAN; default: break; diff --git a/src/server/game/Quests/QuestDef.h b/src/server/game/Quests/QuestDef.h index 8db3e0d6d88..b508c1c7b66 100644 --- a/src/server/game/Quests/QuestDef.h +++ b/src/server/game/Quests/QuestDef.h @@ -199,8 +199,7 @@ enum QuestObjectiveType QUEST_OBJECTIVE_AREATRIGGER = 10, QUEST_OBJECTIVE_WINPETBATTLEAGAINSTNPC = 11, QUEST_OBJECTIVE_DEFEATBATTLEPET = 12, - QUEST_OBJECTIVE_WINPVPPETBATTLES = 13, - QUEST_OBJECTIVE_NONE = 255 // Used on empty objectives to not confuse with QUEST_OBJECTIVE_MONSTER + QUEST_OBJECTIVE_WINPVPPETBATTLES = 13 }; struct QuestLocale @@ -224,7 +223,7 @@ struct QuestObjective { uint32 ID = 0; uint8 Type = 0; - uint8 StorageIndex = 0; + int8 StorageIndex = 0; int32 ObjectID = 0; int32 Amount = 0; uint32 Flags = 0; @@ -262,14 +261,14 @@ class Quest void SetSpecialFlag(uint32 flag) { SpecialFlags |= flag; } // table data accessors: - uint32 GetQuestId() const { return Id; } - uint32 GetQuestMethod() const { return Method; } + uint32 GetQuestId() const { return ID; } + uint32 GetQuestType() const { return Type; } uint32 GetQuestPackageID() const { return PackageID; } - int32 GetZoneOrSort() const { return ZoneOrSort; } - uint32 GetMinLevel() const { return MinLevel; } + int32 GetZoneOrSort() const { return QuestSortID; } + int32 GetMinLevel() const { return MinLevel; } uint32 GetMaxLevel() const { return MaxLevel; } int32 GetQuestLevel() const { return Level; } - uint32 GetType() const { return Type; } + uint32 GetQuestInfoID() const { return QuestInfoID; } uint32 GetAllowableClasses() const { return AllowableClasses; } int32 GetAllowableRaces() const { return AllowableRaces; } uint32 GetRequiredSkill() const { return RequiredSkillId; } @@ -302,7 +301,7 @@ class Quest std::string const& GetPortraitTurnInText() const { return PortraitTurnInText; } std::string const& GetPortraitTurnInName() const { return PortraitTurnInName; } QuestObjectives const& GetObjectives() const { return Objectives; }; - int32 GetRewMoney() const; + uint32 GetRewMoney() const; uint32 GetRewMoneyDifficulty() const { return RewardMoneyDifficulty; } uint32 GetRewHonor() const { return RewardHonor; } uint32 GetRewKillHonor() const { return RewardKillHonor; } @@ -335,7 +334,7 @@ class Quest bool IsDaily() const { return (Flags & QUEST_FLAGS_DAILY) != 0; } bool IsWeekly() const { return (Flags & QUEST_FLAGS_WEEKLY) != 0; } bool IsMonthly() const { return (SpecialFlags & QUEST_SPECIAL_FLAGS_MONTHLY) != 0; } - bool IsSeasonal() const { return (ZoneOrSort == -QUEST_SORT_SEASONAL || ZoneOrSort == -QUEST_SORT_SPECIAL || ZoneOrSort == -QUEST_SORT_LUNAR_FESTIVAL || ZoneOrSort == -QUEST_SORT_MIDSUMMER || ZoneOrSort == -QUEST_SORT_BREWFEST || ZoneOrSort == -QUEST_SORT_LOVE_IS_IN_THE_AIR || ZoneOrSort == -QUEST_SORT_NOBLEGARDEN) && !IsRepeatable(); } + bool IsSeasonal() const { return (QuestSortID == -QUEST_SORT_SEASONAL || QuestSortID == -QUEST_SORT_SPECIAL || QuestSortID == -QUEST_SORT_LUNAR_FESTIVAL || QuestSortID == -QUEST_SORT_MIDSUMMER || QuestSortID == -QUEST_SORT_BREWFEST || QuestSortID == -QUEST_SORT_LOVE_IS_IN_THE_AIR || QuestSortID == -QUEST_SORT_NOBLEGARDEN) && !IsRepeatable(); } bool IsDailyOrWeekly() const { return (Flags & (QUEST_FLAGS_DAILY | QUEST_FLAGS_WEEKLY)) != 0; } bool IsRaidQuest(Difficulty difficulty) const; bool IsAllowedInRaid(Difficulty difficulty) const; @@ -360,18 +359,18 @@ class Quest public: // wdb data (quest query response) - uint32 Id; - uint32 Method; - uint32 PackageID; - int32 ZoneOrSort; - uint32 MinLevel; - int32 Level; + uint32 ID; uint32 Type; + int32 Level; + uint32 PackageID; + int32 MinLevel; + int32 QuestSortID; + uint32 QuestInfoID; uint32 SuggestedPlayers; uint32 NextQuestInChain; uint32 RewardXPDifficulty; float Float10; - uint32 RewardMoney; + int32 RewardMoney; uint32 RewardMoneyDifficulty; float Float13; uint32 RewardBonusMoney; diff --git a/src/server/game/Server/Packets/QuestPackets.h b/src/server/game/Server/Packets/QuestPackets.h index 674efe144c0..66f97dcfc30 100644 --- a/src/server/game/Server/Packets/QuestPackets.h +++ b/src/server/game/Server/Packets/QuestPackets.h @@ -124,8 +124,8 @@ namespace WorldPackets int32 RewardHonor = 0; float RewardKillHonor = 0.0f; int32 StartItem = 0; - int32 Flags = 0; - int32 FlagsEx = 0; + uint32 Flags = 0; + uint32 FlagsEx = 0; int32 POIContinent = 0; float POIx = 0.0f; float POIy = 0.0f; |