Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/server/game/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp
- index 711196f..66580d1 100644
- --- a/src/server/game/Entities/Creature/GossipDef.cpp
- +++ b/src/server/game/Entities/Creature/GossipDef.cpp
- @@ -18,6 +18,7 @@
- #include "QuestDef.h"
- #include "GossipDef.h"
- +#include "Grumboz_VIP_Core.h"
- #include "ObjectMgr.h"
- #include "WorldSession.h"
- #include "Formulas.h"
- @@ -381,7 +382,14 @@ void PlayerMenu::SendQuestGiverStatus(uint8 questStatus, ObjectGuid npcGUID) con
- void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, ObjectGuid npcGUID, bool activateAccept) const
- {
- - std::string questTitle = quest->GetTitle();
- + float VIP_OFFSET = VIP::GetVIPOFFSET();
- + uint32 acctId = _session->GetAccountId();
- + uint8 Pvip = VIP::GetPlayerVIP(acctId);
- + float MOD = (Pvip * VIP_OFFSET);
- +
- + Player* player = _session->GetPlayer();
- +
- + std::string questTitle = quest->GetTitle();
- std::string questDetails = quest->GetDetails();
- std::string questObjectives = quest->GetObjectives();
- std::string questAreaDescription = quest->GetAreaDescription();
- @@ -429,7 +437,11 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, ObjectGuid npcGU
- continue;
- data << uint32(quest->RewardChoiceItemId[i]);
- - data << uint32(quest->RewardChoiceItemCount[i]);
- +
- + uint32 Item_Reward_Choice_Count = quest->RewardChoiceItemCount[i];
- + uint32 extra_Reward_Choice_Item_Count = Item_Reward_Choice_Count * MOD;
- +
- + data << uint32(quest->RewardChoiceItemCount[i] + extra_Reward_Choice_Item_Count);
- if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RewardChoiceItemId[i]))
- data << uint32(itemTemplate->DisplayInfoID);
- @@ -445,7 +457,11 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, ObjectGuid npcGU
- continue;
- data << uint32(quest->RewardItemId[i]);
- - data << uint32(quest->RewardItemIdCount[i]);
- +
- + uint32 Item_Reward_Count = quest->RewardItemIdCount[i];
- + uint32 extra_Item_Reward_Count = Item_Reward_Count * MOD;
- +
- + data << uint32(quest->RewardItemIdCount[i] + extra_Item_Reward_Count);
- if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RewardItemId[i]))
- data << uint32(itemTemplate->DisplayInfoID);
- @@ -453,9 +469,16 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, ObjectGuid npcGU
- data << uint32(0);
- }
- - data << uint32(quest->GetRewOrReqMoney());
- - data << uint32(quest->XPValue(_session->GetPlayer()) * sWorld->getRate(RATE_XP_QUEST));
- - }
- + uint32 XP = quest->XPValue(player);
- + float xp_rate = sWorld->getRate(RATE_XP_QUEST);
- + uint32 MONEY = quest->GetRewOrReqMoney();
- +
- + XP = XP + (XP * (xp_rate + (xp_rate * MOD)));
- + MONEY = MONEY + (MONEY * MOD);
- +
- + data << uint32(MONEY);
- + data << uint32(XP);
- + }
- // rewarded honor points. Multiply with 10 to satisfy client
- data << uint32(10 * quest->CalculateHonorGain(_session->GetPlayer()->GetQuestLevel(quest)));
- @@ -489,7 +512,14 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, ObjectGuid npcGU
- void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const
- {
- - std::string questTitle = quest->GetTitle();
- + float VIP_OFFSET = VIP::GetVIPOFFSET();
- + uint32 acctId = _session->GetAccountId();
- + uint8 Pvip = VIP::GetPlayerVIP(acctId);
- + float MOD = (Pvip * VIP_OFFSET);
- +
- + Player* player = _session->GetPlayer();
- +
- + std::string questTitle = quest->GetTitle();
- std::string questDetails = quest->GetDetails();
- std::string questObjectives = quest->GetObjectives();
- std::string questAreaDescription = quest->GetAreaDescription();
- @@ -535,13 +565,16 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const
- data << uint32(quest->GetNextQuestInChain()); // client will request this quest from NPC, if not 0
- data << uint32(quest->GetXPId()); // used for calculating rewarded experience
- - if (quest->HasFlag(QUEST_FLAGS_HIDDEN_REWARDS))
- - data << uint32(0); // Hide money rewarded
- - else
- - data << uint32(quest->GetRewOrReqMoney()); // reward money (below max lvl)
- + uint32 MONEY = quest->GetRewOrReqMoney();
- + MONEY = MONEY + (MONEY * MOD);
- - data << uint32(quest->GetRewMoneyMaxLevel()); // used in XP calculation at client
- - data << uint32(quest->GetRewSpell()); // reward spell, this spell will display (icon) (cast if RewSpellCast == 0)
- + if (quest->HasFlag(QUEST_FLAGS_HIDDEN_REWARDS))
- + data << uint32(0); // Hide money rewarded
- + else
- + data << uint32(MONEY); // reward money (below max lvl)
- +
- + data << uint32(quest->GetRewMoneyMaxLevel()); // used in XP calculation at client
- + data << uint32(quest->GetRewSpell()); // reward spell, this spell will display (icon) (cast if RewSpellCast == 0)
- data << int32(quest->GetRewSpellCast()); // cast spell
- // rewarded honor points
- @@ -555,9 +588,9 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const
- data << uint32(quest->GetRewArenaPoints()); // bonus arena points
- data << uint32(0); // review rep show mask
- - if (quest->HasFlag(QUEST_FLAGS_HIDDEN_REWARDS))
- + if (quest->HasFlag(QUEST_FLAGS_HIDDEN_REWARDS))
- {
- - for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i)
- + for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i)
- data << uint32(0) << uint32(0);
- for (uint8 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
- data << uint32(0) << uint32(0);
- @@ -567,13 +600,22 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const
- for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i)
- {
- data << uint32(quest->RewardItemId[i]);
- - data << uint32(quest->RewardItemIdCount[i]);
- - }
- +
- + uint32 Item_Reward_Count = quest->RewardItemIdCount[i];
- + uint32 extra_Item_Reward_Count = Item_Reward_Count * MOD;
- +
- + data << uint32(quest->RewardItemIdCount[i] + extra_Item_Reward_Count);
- + }
- +
- for (uint8 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
- {
- data << uint32(quest->RewardChoiceItemId[i]);
- - data << uint32(quest->RewardChoiceItemCount[i]);
- - }
- +
- + uint32 Item_Choice_Reward_Count = quest->RewardItemIdCount[i];
- + uint32 extra_Item_Choice_Reward_Count = Item_Choice_Reward_Count * MOD;
- +
- + data << uint32(quest->RewardChoiceItemCount[i] + extra_Item_Choice_Reward_Count);
- + }
- }
- for (uint8 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward factions ids
- @@ -626,7 +668,14 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const
- void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, ObjectGuid npcGUID, bool enableNext) const
- {
- - std::string questTitle = quest->GetTitle();
- + float VIP_OFFSET = VIP::GetVIPOFFSET();
- + uint32 acctId = _session->GetAccountId();
- + uint8 Pvip = VIP::GetPlayerVIP(acctId);
- + float MOD = (Pvip * VIP_OFFSET);
- +
- + Player* player = _session->GetPlayer();
- +
- + std::string questTitle = quest->GetTitle();
- std::string questOfferRewardText = quest->GetOfferRewardText();
- int32 locale = _session->GetSessionDbLocaleIndex();
- @@ -671,7 +720,11 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, ObjectGuid npcGUI
- for (uint32 i=0; i < quest->GetRewChoiceItemsCount(); ++i)
- {
- data << uint32(quest->RewardChoiceItemId[i]);
- - data << uint32(quest->RewardChoiceItemCount[i]);
- +
- + uint32 Item_Choice_Reward_Count = quest->RewardItemIdCount[i];
- + uint32 extra_Item_Choice_Reward_Count = Item_Choice_Reward_Count * MOD;
- +
- + data << uint32(quest->RewardChoiceItemCount[i] + extra_Item_Choice_Reward_Count);
- if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RewardChoiceItemId[i]))
- data << uint32(itemTemplate->DisplayInfoID);
- @@ -683,7 +736,11 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, ObjectGuid npcGUI
- for (uint32 i = 0; i < quest->GetRewItemsCount(); ++i)
- {
- data << uint32(quest->RewardItemId[i]);
- - data << uint32(quest->RewardItemIdCount[i]);
- +
- + uint32 Item_Reward_Count = quest->RewardItemIdCount[i];
- + uint32 extra_Item_Reward_Count = Item_Reward_Count * MOD;
- +
- + data << uint32(quest->RewardItemIdCount[i] + extra_Item_Reward_Count);
- if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RewardItemId[i]))
- data << uint32(itemTemplate->DisplayInfoID);
- @@ -691,8 +748,15 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, ObjectGuid npcGUI
- data << uint32(0);
- }
- - data << uint32(quest->GetRewOrReqMoney());
- - data << uint32(quest->XPValue(_session->GetPlayer()) * sWorld->getRate(RATE_XP_QUEST));
- + uint32 XP = quest->XPValue(player);
- + float xp_rate = sWorld->getRate(RATE_XP_QUEST);
- + uint32 MONEY = quest->GetRewOrReqMoney();
- +
- + XP = XP + (XP * (xp_rate + (xp_rate * MOD)));
- + MONEY = MONEY + (MONEY * MOD);
- +
- + data << uint32(MONEY);
- + data << uint32(XP);
- // rewarded honor points. Multiply with 10 to satisfy client
- data << uint32(10 * quest->CalculateHonorGain(_session->GetPlayer()->GetQuestLevel(quest)));
- \ No newline at end of file
- diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
- index e4a2918..7b3df51 100644
- --- a/src/server/game/Entities/Player/Player.cpp
- +++ b/src/server/game/Entities/Player/Player.cpp
- @@ -14883,7 +14895,14 @@ void Player::IncompleteQuest(uint32 quest_id)
- void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver, bool announce)
- {
- - //this THING should be here to protect code from quest, which cast on player far teleport as a reward
- + float VIP_OFFSET = VIP::GetVIPOFFSET();
- + uint32 acctId = GetSession()->GetAccountId();
- + uint8 Pvip = VIP::GetPlayerVIP(acctId);
- + float MOD = (Pvip * VIP_OFFSET);
- +
- + Player* player = GetSession()->GetPlayer();
- +
- + //this THING should be here to protect code from quest, which cast on player far teleport as a reward
- //should work fine, cause far teleport will be executed in Player::Update()
- SetCanDelayTeleport(true);
- @@ -14927,7 +14946,10 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
- if (CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, quest->RewardItemIdCount[i]) == EQUIP_ERR_OK)
- {
- Item* item = StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId));
- - SendNewItem(item, quest->RewardItemIdCount[i], true, false);
- +
- + uint32 RewardItemCount = quest->RewardItemIdCount[i];
- +
- + SendNewItem(item, RewardItemCount + (RewardItemCount * MOD), true, false);
- }
- else if (quest->IsDFQuest())
- SendItemRetrievalMail(quest->RewardItemId[i], quest->RewardItemIdCount[i]);
- @@ -14944,7 +14966,8 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
- bool rewarded = (m_RewardedQuests.find(quest_id) != m_RewardedQuests.end());
- // Not give XP in case already completed once repeatable quest
- - uint32 XP = rewarded && !quest->IsDFQuest() ? 0 : uint32(quest->XPValue(this)*sWorld->getRate(RATE_XP_QUEST));
- + uint32 XP = rewarded && !quest->IsDFQuest() ? 0 : uint32(quest->XPValue(this)*sWorld->getRate(RATE_XP_QUEST));
- + XP = XP + (XP*MOD);
- // handle SPELL_AURA_MOD_XP_QUEST_PCT auras
- Unit::AuraEffectList const& ModXPPctAuras = GetAuraEffectsByType(SPELL_AURA_MOD_XP_QUEST_PCT);
- @@ -14952,10 +14975,13 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
- AddPct(XP, (*i)->GetAmount());
- int32 moneyRew = 0;
- - if (getLevel() < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
- + uint32 reward_money = quest->GetRewMoneyMaxLevel();
- + reward_money = reward_money + (reward_money * (sWorld->getRate(RATE_DROP_MONEY) + MOD));
- +
- + if (getLevel() < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
- GiveXP(XP, NULL);
- else
- - moneyRew = int32(quest->GetRewMoneyMaxLevel() * sWorld->getRate(RATE_DROP_MONEY));
- + moneyRew = int32(reward_money);
- // Give player extra money if GetRewOrReqMoney > 0 and get ReqMoney if negative
- if (quest->GetRewOrReqMoney())
- @@ -14970,8 +14996,11 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
- }
- // honor reward
- - if (uint32 honor = quest->CalculateHonorGain(getLevel()))
- - RewardHonor(NULL, 0, honor);
- + if (uint32 honor = quest->CalculateHonorGain(getLevel()))
- + {
- + honor = honor + (honor * MOD);
- + RewardHonor(NULL, 0, honor);
- + }
- // title reward
- if (quest->GetCharTitleId())
- @@ -14986,8 +15015,12 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
- InitTalentForLevel();
- }
- - if (quest->GetRewArenaPoints())
- - ModifyArenaPoints(quest->GetRewArenaPoints());
- + if (quest->GetRewArenaPoints())
- + {
- + int32 ArenaPoints = quest->GetRewArenaPoints();
- + int32 RewardArenaPoints = ArenaPoints + (ArenaPoints * MOD);
- + ModifyArenaPoints(RewardArenaPoints);
- + }
- // Send reward mail
- if (uint32 mail_template_id = quest->GetRewMailTemplateId())
- @@ -16457,22 +16490,38 @@ void Player::SendQuestComplete(uint32 quest_id)
- void Player::SendQuestReward(Quest const* quest, uint32 XP)
- {
- - uint32 questid = quest->GetQuestId();
- + float VIP_OFFSET = VIP::GetVIPOFFSET();
- + uint32 acctId = GetSession()->GetAccountId();
- + uint8 Pvip = VIP::GetPlayerVIP(acctId);
- + float MOD = (Pvip * VIP_OFFSET);
- +
- + Player* player = GetSession()->GetPlayer();
- +
- + uint32 questid = quest->GetQuestId();
- TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_QUEST_COMPLETE quest = %u", questid);
- sGameEventMgr->HandleQuestComplete(questid);
- WorldPacket data(SMSG_QUESTGIVER_QUEST_COMPLETE, (4+4+4+4+4));
- data << uint32(questid);
- - if (getLevel() < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
- - {
- - data << uint32(XP);
- - data << uint32(quest->GetRewOrReqMoney());
- - }
- - else
- + int32 RewMoney = quest->GetRewOrReqMoney();
- + RewMoney = RewMoney + (RewMoney * MOD);
- + XP = XP + (XP * MOD);
- +
- + if (getLevel() < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
- + {
- + data << uint32(XP);
- +
- + data << uint32(RewMoney);
- + }
- + else
- {
- data << uint32(0);
- - data << uint32(quest->GetRewOrReqMoney() + int32(quest->GetRewMoneyMaxLevel() * sWorld->getRate(RATE_DROP_MONEY)));
- - }
- +
- + float DropMoneyRate = sWorld->getRate(RATE_DROP_MONEY);
- + DropMoneyRate = DropMoneyRate + (DropMoneyRate * MOD);
- +
- + data << uint32(RewMoney + int32(quest->GetRewMoneyMaxLevel() * DropMoneyRate));
- + }
- data << uint32(10 * quest->CalculateHonorGain(GetQuestLevel(quest)));
- data << uint32(quest->GetBonusTalents()); // bonus talents
- \ No newline at end of file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement