Ejemplo n.º 1
0
void Quest::BuildExtraQuestInfo(WorldPacket& data, Player* player) const
{
	data << uint32(GetRewChoiceItemsCount());
	for (uint8 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
	{
		data << uint32(RewardChoiceItemId[i]);
		data << uint32(RewardChoiceItemCount[i]);
		if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(RewardChoiceItemId[i]))
			data << uint32(itemTemplate->DisplayInfoID);
		else
			data << uint32(0);            
	}

	data << uint32(GetReqItemsCount());

	for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i)
		data << uint32(RewardItemId[i]);
	for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i)
		data << uint32(RewardItemIdCount[i]);
	for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i)
	{
		if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(RewardItemId[i]))
			data << uint32(itemTemplate->DisplayInfoID);
		else
			data << uint32(0);
	}

    data << uint32(GetRewOrReqMoney());
    data << uint32(XPValue(player) * sWorld->getRate(RATE_XP_QUEST));

    data << uint32(GetCharTitleId());                                
    data << uint32(GetBonusTalents());
    data << uint32(GetRewardReputationMask());

    for (uint8 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)    // reward factions ids
        data << uint32(RewardFactionId[i]);

    for (uint8 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)    // columnid in QuestFactionReward.dbc (zero based)?
        data << int32(RewardFactionValueId[i]);

    for (uint8 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)    // reward reputation override?
        data << uint32(RewardFactionValueIdOverride[i]);

    data << uint32(GetRewSpell());
    data << uint32(GetRewSpellCast());

    for (uint8 i = 0; i < QUEST_REWARD_CURRENCY_COUNT; ++i)
        data << uint32(RewardCurrencyId[i]);

    for (uint8 i = 0; i < QUEST_REWARD_CURRENCY_COUNT; ++i)
        data << uint32(RewardCurrencyCount[i]);

    data << uint32(GetRewardSkillId());
    data << uint32(GetRewardSkillPoints());
}
Ejemplo n.º 2
0
WorldPacket Quest::BuildQueryData(LocaleConstant loc) const
{
    WorldPackets::Quest::QueryQuestInfoResponse response;

    std::string locQuestTitle = GetTitle();
    std::string locQuestDetails = GetDetails();
    std::string locQuestObjectives = GetObjectives();
    std::string locQuestAreaDescription = GetAreaDescription();
    std::string locQuestCompletedText = GetCompletedText();

    std::string locQuestObjectiveText[QUEST_OBJECTIVES_COUNT];
    for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
        locQuestObjectiveText[i] = ObjectiveText[i];

    if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(GetQuestId()))
    {
        ObjectMgr::GetLocaleString(localeData->Title, loc, locQuestTitle);
        ObjectMgr::GetLocaleString(localeData->Details, loc, locQuestDetails);
        ObjectMgr::GetLocaleString(localeData->Objectives, loc, locQuestObjectives);
        ObjectMgr::GetLocaleString(localeData->AreaDescription, loc, locQuestAreaDescription);
        ObjectMgr::GetLocaleString(localeData->CompletedText, loc, locQuestCompletedText);

        for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
            ObjectMgr::GetLocaleString(localeData->ObjectiveText[i], loc, locQuestObjectiveText[i]);
    }

    response.Info.QuestID = GetQuestId();
    response.Info.QuestMethod = GetQuestMethod();
    response.Info.QuestLevel = GetQuestLevel();
    response.Info.QuestMinLevel = GetMinLevel();
    response.Info.QuestSortID = GetZoneOrSort();

    response.Info.QuestType = GetType();
    response.Info.SuggestedGroupNum = GetSuggestedPlayers();

    response.Info.RequiredFactionId[0] = GetRepObjectiveFaction();
    response.Info.RequiredFactionValue[0] = GetRepObjectiveValue();

    response.Info.RequiredFactionId[1] = GetRepObjectiveFaction2();
    response.Info.RequiredFactionValue[1] = GetRepObjectiveValue2();

    response.Info.RewardNextQuest = GetNextQuestInChain();
    response.Info.RewardXPDifficulty = GetXPId();

    response.Info.RewardMoney = GetRewOrReqMoney();
    response.Info.RewardBonusMoney = GetRewMoneyMaxLevel();
    response.Info.RewardDisplaySpell = GetRewSpell();
    response.Info.RewardSpell = GetRewSpellCast();

    response.Info.RewardHonor = GetRewHonorAddition();
    response.Info.RewardKillHonor = GetRewHonorMultiplier();

    response.Info.StartItem = GetSrcItemId();
    response.Info.Flags = GetFlags();
    response.Info.RewardTitleId = GetCharTitleId();
    response.Info.RequiredPlayerKills = GetPlayersSlain();
    response.Info.RewardTalents = GetBonusTalents();
    response.Info.RewardArenaPoints = GetRewArenaPoints();

    for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i)
    {
        response.Info.RewardItems[i] = RewardItemId[i];
        response.Info.RewardAmount[i] = RewardItemIdCount[i];
    }

    for (uint8 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
    {
        response.Info.UnfilteredChoiceItems[i].ItemID = RewardChoiceItemId[i];
        response.Info.UnfilteredChoiceItems[i].Quantity = RewardChoiceItemCount[i];
    }

    for (uint8 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)             // reward factions ids
        response.Info.RewardFactionID[i] = RewardFactionId[i];

    for (uint8 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)             // columnid+1 QuestFactionReward.dbc?
        response.Info.RewardFactionValue[i] = RewardFactionValueId[i];

    for (uint8 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)             // unk (0)
        response.Info.RewardFactionValueOverride[i] = RewardFactionValueIdOverride[i];

    response.Info.POIContinent = GetPOIContinent();
    response.Info.POIx = GetPOIx();
    response.Info.POIy = GetPOIy();
    response.Info.POIPriority = GetPointOpt();

    if (sWorld->getBoolConfig(CONFIG_UI_QUESTLEVELS_IN_DIALOGS))
        Quest::AddQuestLevelToTitle(locQuestTitle, GetQuestLevel());

    response.Info.Title = locQuestTitle;
    response.Info.Objectives = locQuestObjectives;
    response.Info.Details = locQuestDetails;
    response.Info.AreaDescription = locQuestAreaDescription;
    response.Info.CompletedText = locQuestCompletedText;

    for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
    {
        response.Info.RequiredNpcOrGo[i] = RequiredNpcOrGo[i];
        response.Info.RequiredNpcOrGoCount[i] = RequiredNpcOrGoCount[i];
        response.Info.ItemDrop[i] = ItemDrop[i];
    }

    for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
    {
        response.Info.RequiredItemId[i] = RequiredItemId[i];
        response.Info.RequiredItemCount[i] = RequiredItemCount[i];
    }

    for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
        response.Info.ObjectiveText[i] = locQuestObjectiveText[i];

    return *response.Write();
}
Ejemplo n.º 3
0
void Quest::InitializeQueryData()
{
	queryData.Initialize(SMSG_QUEST_QUERY_RESPONSE, 1);

	queryData << uint32(GetQuestId());                    // quest id
	queryData << uint32(GetQuestMethod());                // Accepted values: 0, 1 or 2. 0 == IsAutoComplete() (skip objectives/details)
	queryData << uint32(GetQuestLevel());                 // may be -1, static data, in other cases must be used dynamic level: Player::GetQuestLevel (0 is not known, but assuming this is no longer valid for quest intended for client)
	queryData << uint32(GetMinLevel());                   // min level
	queryData << uint32(GetZoneOrSort());                 // zone or sort to display in quest log

	queryData << uint32(GetType());                       // quest type
	queryData << uint32(GetSuggestedPlayers());           // suggested players count

	queryData << uint32(GetRepObjectiveFaction());        // shown in quest log as part of quest objective
	queryData << uint32(GetRepObjectiveValue());          // shown in quest log as part of quest objective

	queryData << uint32(GetRepObjectiveFaction2());       // shown in quest log as part of quest objective OPPOSITE faction
	queryData << uint32(GetRepObjectiveValue2());         // shown in quest log as part of quest objective OPPOSITE faction

	queryData << uint32(GetNextQuestInChain());           // client will request this quest from NPC, if not 0
	queryData << uint32(GetXPId());                       // used for calculating rewarded experience

	if (HasFlag(QUEST_FLAGS_HIDDEN_REWARDS))
		queryData << uint32(0);                                  // Hide money rewarded
	else
		queryData << uint32(GetRewOrReqMoney());          // reward money (below max lvl)

	queryData << uint32(GetRewMoneyMaxLevel());           // used in XP calculation at client
	queryData << uint32(GetRewSpell());                   // reward spell, this spell will display (icon) (casted if RewSpellCast == 0)
	queryData << int32(GetRewSpellCast());                // casted spell

	// rewarded honor points
	queryData << uint32(GetRewHonorAddition());
	queryData << float(GetRewHonorMultiplier());
	queryData << uint32(GetSrcItemId());                  // source item id
	queryData << uint32(GetFlags() & 0xFFFF);             // quest flags
	queryData << uint32(GetCharTitleId());                // CharTitleId, new 2.4.0, player gets this title (id from CharTitles)
	queryData << uint32(GetPlayersSlain());               // players slain
	queryData << uint32(GetBonusTalents());               // bonus talents
	queryData << uint32(GetRewArenaPoints());             // bonus arena points
	queryData << uint32(0);                                      // review rep show mask

	if (HasFlag(QUEST_FLAGS_HIDDEN_REWARDS))
	{
		for (uint32 i = 0; i < QUEST_REWARDS_COUNT; ++i)
			queryData << uint32(0) << uint32(0);
		for (uint32 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
			queryData << uint32(0) << uint32(0);
	}
	else
	{
		for (uint32 i = 0; i < QUEST_REWARDS_COUNT; ++i)
		{
			queryData << uint32(RewardItemId[i]);
			queryData << uint32(RewardItemIdCount[i]);
		}
		for (uint32 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
		{
			queryData << uint32(RewardChoiceItemId[i]);
			queryData << uint32(RewardChoiceItemCount[i]);
		}
	}

	for (uint32 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)        // reward factions ids
		queryData << uint32(RewardFactionId[i]);

	for (uint32 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)        // columnid+1 QuestFactionReward.dbc?
		queryData << int32(RewardFactionValueId[i]);

	for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)           // unk (0)
		queryData << int32(RewardFactionValueIdOverride[i]);

	queryData << GetPointMapId();
	queryData << GetPointX();
	queryData << GetPointY();
	queryData << GetPointOpt();

	queryData << GetTitle();
	queryData << GetObjectives();
	queryData << GetDetails();
	queryData << GetEndText();
	queryData << GetCompletedText();                                  // display in quest objectives window once all objectives are completed

	for (uint32 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
	{
		if (RequiredNpcOrGo[i] < 0)
			queryData << uint32((RequiredNpcOrGo[i] * (-1)) | 0x80000000);    // client expects gameobject template id in form (id|0x80000000)
		else
			queryData << uint32(RequiredNpcOrGo[i]);

		queryData << uint32(RequiredNpcOrGoCount[i]);
		queryData << uint32(RequiredSourceItemId[i]);
		queryData << uint32(0);                                  // req source count?
	}

	for (uint32 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
	{
		queryData << uint32(RequiredItemId[i]);
		queryData << uint32(RequiredItemCount[i]);
	}

	for (uint32 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
		queryData << ObjectiveText[i];
}
Ejemplo n.º 4
0
void Quest::BuildExtraQuestInfo(WorldPacket& data, Player* player) const
{
    data << uint32(GetRewChoiceItemsCount());
    for (uint8 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
        data << uint32(RewardChoiceItemId[i]);
    for (uint8 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
        data << uint32(RewardChoiceItemCount[i]);
    for (uint8 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
    {
        if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(RewardChoiceItemId[i]))
            data << uint32(itemTemplate->DisplayInfoID);
        else
            data << uint32(0);
    }

    data << uint32(GetReqItemsCount());
    for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i)
        data << uint32(RewardItemId[i]);
    for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i)
        data << uint32(RewardItemIdCount[i]);
    for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i)
    {
        if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(RewardItemId[i]))
            data << uint32(itemTemplate->DisplayInfoID);
        else
            data << uint32(0);
    }

    data << uint32(GetRewOrReqMoney());
    data << uint32(XPValue(player) * sWorld->getRate(RATE_XP_QUEST));

    data << uint32(GetCharTitleId());
    data << uint32(0);                                      // unk
    data << float(0.0f);                                    // unk
    data << uint32(GetBonusTalents());
    data << uint32(0);                                      // unk
    data << uint32(GetRewardReputationMask());

    /* Pre cata struct, some of these unks might be the missing values in cata:
    // rewarded honor points. Multiply with 10 to satisfy client
    data << 10 * Trinity::Honor::hk_honor_at_level(_session->GetPlayer()->getLevel(), quest->GetRewHonorMultiplier());
    data << float(0);                                       // unk, honor multiplier?
    data << uint32(0x08);                                   // unused by client?
    data << uint32(quest->GetRewSpell());                   // reward spell, this spell will display (icon) (casted if RewSpellCast == 0)
    data << int32(quest->GetRewSpellCast());                // casted spell
    data << uint32(0);                                      // unknown
    data << uint32(quest->GetBonusTalents());               // bonus talents
    data << uint32(quest->GetRewArenaPoints());             // arena points
    data << uint32(0);
    */

    for (uint8 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)    // reward factions ids
        data << uint32(RewardFactionId[i]);

    for (uint8 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)    // columnid in QuestFactionReward.dbc (zero based)?
        data << int32(RewardFactionValueId[i]);

    for (uint8 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)    // reward reputation override?
        data << uint32(RewardFactionValueIdOverride[i]);

    data << uint32(GetRewSpell());
    data << uint32(GetRewSpellCast());

    for (uint8 i = 0; i < QUEST_REWARD_CURRENCY_COUNT; ++i)
        data << uint32(RewardCurrencyId[i]);

    for (uint8 i = 0; i < QUEST_REWARD_CURRENCY_COUNT; ++i)
        data << uint32(RewardCurrencyCount[i]);

    data << uint32(GetRewardSkillId());
    data << uint32(GetRewardSkillPoints());
}