예제 #1
0
uint32 Quest::CalculateHonorGain(uint8 level) const
{
    if(level > GT_MAX_LEVEL)
        level = GT_MAX_LEVEL;

    uint32 honor = 0;

    if(GetRewHonorAddition() > 0 || GetRewHonorMultiplier() > 0.0f)
    {
        // values stored from 0.. for 1...
        TeamContributionPointsEntry const* tc = sTeamContributionPointsStore.LookupEntry(level-1);
        if(!tc)
            return 0;
        honor = uint32(tc->value * GetRewHonorMultiplier() * 0.1000000014901161);
        honor += GetRewHonorAddition();
    }

    return honor;
}
예제 #2
0
uint32 Quest::CalculateRewardHonor(uint32 level) const
{
    if (level > GT_MAX_LEVEL)
        level = GT_MAX_LEVEL;

    uint32 honor = 0;

    if (GetRewHonorAddition() > 0 || GetRewHonorMultiplier() > 0.0f)
    {
        // values stored from 0.. for 1...
        TeamContributionPoints const* tc = sTeamContributionPoints.LookupEntry(level - 1);
        if (!tc)
            return 0;
        uint32 i_honor = uint32(tc->Value * GetRewHonorMultiplier() * 0.1f);
        honor = i_honor + GetRewHonorAddition();
    }

    return honor;
}
예제 #3
0
uint32 Quest::CalculateHonorGain(uint8 level) const
{
    if (level > GT_MAX_LEVEL)
        level = GT_MAX_LEVEL;

    uint32 honor = 0;

    if (GetRewHonorAddition() > 0 || GetRewHonorMultiplier() > 0.0f)
    {
        // values stored from 0.. for 1...
        TeamContributionPointsEntry const* tc = sTeamContributionPointsStore.LookupEntry(level);
        if (!tc)
            return 0;
        honor = uint32(tc->value * GetRewHonorMultiplier() * 0.1000000014901161);

		// Xinef: exactly this is calculated above, however with higher precision...
		//honor += Trinity::Honor::hk_honor_at_level(level, GetRewHonorMultiplier());
        honor += GetRewHonorAddition();
    }

    return honor;
}
예제 #4
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();
}
예제 #5
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];
}