Advertisement
slp13at420

Grumboz VIP Engine Quest Stats

Mar 1st, 2016
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 15.29 KB | None | 0 0
  1. diff --git a/src/server/game/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp
  2. index 711196f..66580d1 100644
  3. --- a/src/server/game/Entities/Creature/GossipDef.cpp
  4. +++ b/src/server/game/Entities/Creature/GossipDef.cpp
  5. @@ -18,6 +18,7 @@
  6.  
  7.  #include "QuestDef.h"
  8.  #include "GossipDef.h"
  9. +#include "Grumboz_VIP_Core.h"
  10.  #include "ObjectMgr.h"
  11.  #include "WorldSession.h"
  12.  #include "Formulas.h"
  13. @@ -381,7 +382,14 @@ void PlayerMenu::SendQuestGiverStatus(uint8 questStatus, ObjectGuid npcGUID) con
  14.  
  15.  void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, ObjectGuid npcGUID, bool activateAccept) const
  16.  {
  17. -    std::string questTitle            = quest->GetTitle();
  18. +   float VIP_OFFSET = VIP::GetVIPOFFSET();
  19. +   uint32 acctId = _session->GetAccountId();
  20. +   uint8 Pvip = VIP::GetPlayerVIP(acctId);
  21. +   float MOD = (Pvip * VIP_OFFSET);
  22. +
  23. +   Player* player = _session->GetPlayer();
  24. +  
  25. +   std::string questTitle = quest->GetTitle();
  26.      std::string questDetails          = quest->GetDetails();
  27.      std::string questObjectives       = quest->GetObjectives();
  28.      std::string questAreaDescription  = quest->GetAreaDescription();
  29. @@ -429,7 +437,11 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, ObjectGuid npcGU
  30.                  continue;
  31.  
  32.              data << uint32(quest->RewardChoiceItemId[i]);
  33. -            data << uint32(quest->RewardChoiceItemCount[i]);
  34. +
  35. +           uint32 Item_Reward_Choice_Count = quest->RewardChoiceItemCount[i];
  36. +           uint32 extra_Reward_Choice_Item_Count = Item_Reward_Choice_Count * MOD;
  37. +
  38. +           data << uint32(quest->RewardChoiceItemCount[i] + extra_Reward_Choice_Item_Count);
  39.  
  40.              if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RewardChoiceItemId[i]))
  41.                  data << uint32(itemTemplate->DisplayInfoID);
  42. @@ -445,7 +457,11 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, ObjectGuid npcGU
  43.                  continue;
  44.  
  45.              data << uint32(quest->RewardItemId[i]);
  46. -            data << uint32(quest->RewardItemIdCount[i]);
  47. +
  48. +           uint32 Item_Reward_Count = quest->RewardItemIdCount[i];
  49. +           uint32 extra_Item_Reward_Count = Item_Reward_Count * MOD;
  50. +
  51. +           data << uint32(quest->RewardItemIdCount[i] + extra_Item_Reward_Count);
  52.  
  53.              if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RewardItemId[i]))
  54.                  data << uint32(itemTemplate->DisplayInfoID);
  55. @@ -453,9 +469,16 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, ObjectGuid npcGU
  56.                  data << uint32(0);
  57.          }
  58.  
  59. -        data << uint32(quest->GetRewOrReqMoney());
  60. -        data << uint32(quest->XPValue(_session->GetPlayer()) * sWorld->getRate(RATE_XP_QUEST));
  61. -    }
  62. +       uint32 XP = quest->XPValue(player);
  63. +       float xp_rate = sWorld->getRate(RATE_XP_QUEST);
  64. +       uint32 MONEY = quest->GetRewOrReqMoney();
  65. +
  66. +       XP = XP + (XP * (xp_rate + (xp_rate * MOD)));
  67. +       MONEY = MONEY + (MONEY * MOD);
  68. +
  69. +       data << uint32(MONEY);
  70. +       data << uint32(XP);
  71. +   }
  72.  
  73.      // rewarded honor points. Multiply with 10 to satisfy client
  74.      data << uint32(10 * quest->CalculateHonorGain(_session->GetPlayer()->GetQuestLevel(quest)));
  75. @@ -489,7 +512,14 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, ObjectGuid npcGU
  76.  
  77.  void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const
  78.  {
  79. -    std::string questTitle            = quest->GetTitle();
  80. +   float VIP_OFFSET = VIP::GetVIPOFFSET();
  81. +   uint32 acctId = _session->GetAccountId();
  82. +   uint8 Pvip = VIP::GetPlayerVIP(acctId);
  83. +   float MOD = (Pvip * VIP_OFFSET);
  84. +
  85. +   Player* player = _session->GetPlayer();
  86. +  
  87. +   std::string questTitle = quest->GetTitle();
  88.      std::string questDetails          = quest->GetDetails();
  89.      std::string questObjectives       = quest->GetObjectives();
  90.      std::string questAreaDescription  = quest->GetAreaDescription();
  91. @@ -535,13 +565,16 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const
  92.      data << uint32(quest->GetNextQuestInChain());           // client will request this quest from NPC, if not 0
  93.      data << uint32(quest->GetXPId());                       // used for calculating rewarded experience
  94.  
  95. -    if (quest->HasFlag(QUEST_FLAGS_HIDDEN_REWARDS))
  96. -        data << uint32(0);                                  // Hide money rewarded
  97. -    else
  98. -        data << uint32(quest->GetRewOrReqMoney());          // reward money (below max lvl)
  99. +   uint32 MONEY = quest->GetRewOrReqMoney();
  100. +   MONEY = MONEY + (MONEY * MOD);
  101.  
  102. -    data << uint32(quest->GetRewMoneyMaxLevel());           // used in XP calculation at client
  103. -    data << uint32(quest->GetRewSpell());                   // reward spell, this spell will display (icon) (cast if RewSpellCast == 0)
  104. +   if (quest->HasFlag(QUEST_FLAGS_HIDDEN_REWARDS))
  105. +       data << uint32(0);                                  // Hide money rewarded
  106. +   else
  107. +       data << uint32(MONEY);              // reward money (below max lvl)
  108. +
  109. +   data << uint32(quest->GetRewMoneyMaxLevel());           // used in XP calculation at client
  110. +   data << uint32(quest->GetRewSpell());                   // reward spell, this spell will display (icon) (cast if RewSpellCast == 0)
  111.      data << int32(quest->GetRewSpellCast());                // cast spell
  112.  
  113.      // rewarded honor points
  114. @@ -555,9 +588,9 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const
  115.      data << uint32(quest->GetRewArenaPoints());             // bonus arena points
  116.      data << uint32(0);                                      // review rep show mask
  117.  
  118. -    if (quest->HasFlag(QUEST_FLAGS_HIDDEN_REWARDS))
  119. +       if (quest->HasFlag(QUEST_FLAGS_HIDDEN_REWARDS))
  120.      {
  121. -        for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i)
  122. +       for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i)
  123.              data << uint32(0) << uint32(0);
  124.          for (uint8 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
  125.              data << uint32(0) << uint32(0);
  126. @@ -567,13 +600,22 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const
  127.          for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i)
  128.          {
  129.              data << uint32(quest->RewardItemId[i]);
  130. -            data << uint32(quest->RewardItemIdCount[i]);
  131. -        }
  132. +
  133. +           uint32 Item_Reward_Count = quest->RewardItemIdCount[i];
  134. +           uint32 extra_Item_Reward_Count = Item_Reward_Count * MOD;
  135. +
  136. +           data << uint32(quest->RewardItemIdCount[i] + extra_Item_Reward_Count);
  137. +       }
  138. +
  139.          for (uint8 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
  140.          {
  141.              data << uint32(quest->RewardChoiceItemId[i]);
  142. -            data << uint32(quest->RewardChoiceItemCount[i]);
  143. -        }
  144. +
  145. +           uint32 Item_Choice_Reward_Count = quest->RewardItemIdCount[i];
  146. +           uint32 extra_Item_Choice_Reward_Count = Item_Choice_Reward_Count * MOD;
  147. +
  148. +           data << uint32(quest->RewardChoiceItemCount[i] + extra_Item_Choice_Reward_Count);
  149. +       }
  150.      }
  151.  
  152.      for (uint8 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)        // reward factions ids
  153. @@ -626,7 +668,14 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const
  154.  
  155.  void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, ObjectGuid npcGUID, bool enableNext) const
  156.  {
  157. -    std::string questTitle = quest->GetTitle();
  158. +   float VIP_OFFSET = VIP::GetVIPOFFSET();
  159. +   uint32 acctId = _session->GetAccountId();
  160. +   uint8 Pvip = VIP::GetPlayerVIP(acctId);
  161. +   float MOD = (Pvip * VIP_OFFSET);
  162. +
  163. +   Player* player = _session->GetPlayer();
  164. +  
  165. +   std::string questTitle = quest->GetTitle();
  166.      std::string questOfferRewardText = quest->GetOfferRewardText();
  167.  
  168.      int32 locale = _session->GetSessionDbLocaleIndex();
  169. @@ -671,7 +720,11 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, ObjectGuid npcGUI
  170.      for (uint32 i=0; i < quest->GetRewChoiceItemsCount(); ++i)
  171.      {
  172.          data << uint32(quest->RewardChoiceItemId[i]);
  173. -        data << uint32(quest->RewardChoiceItemCount[i]);
  174. +
  175. +       uint32 Item_Choice_Reward_Count = quest->RewardItemIdCount[i];
  176. +       uint32 extra_Item_Choice_Reward_Count = Item_Choice_Reward_Count * MOD;
  177. +
  178. +       data << uint32(quest->RewardChoiceItemCount[i] + extra_Item_Choice_Reward_Count);
  179.  
  180.          if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RewardChoiceItemId[i]))
  181.              data << uint32(itemTemplate->DisplayInfoID);
  182. @@ -683,7 +736,11 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, ObjectGuid npcGUI
  183.      for (uint32 i = 0; i < quest->GetRewItemsCount(); ++i)
  184.      {
  185.          data << uint32(quest->RewardItemId[i]);
  186. -        data << uint32(quest->RewardItemIdCount[i]);
  187. +
  188. +       uint32 Item_Reward_Count = quest->RewardItemIdCount[i];
  189. +       uint32 extra_Item_Reward_Count = Item_Reward_Count * MOD;
  190. +
  191. +       data << uint32(quest->RewardItemIdCount[i] + extra_Item_Reward_Count);
  192.  
  193.          if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RewardItemId[i]))
  194.              data << uint32(itemTemplate->DisplayInfoID);
  195. @@ -691,8 +748,15 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, ObjectGuid npcGUI
  196.              data << uint32(0);
  197.      }
  198.  
  199. -    data << uint32(quest->GetRewOrReqMoney());
  200. -    data << uint32(quest->XPValue(_session->GetPlayer()) * sWorld->getRate(RATE_XP_QUEST));
  201. +   uint32 XP = quest->XPValue(player);
  202. +   float xp_rate = sWorld->getRate(RATE_XP_QUEST);
  203. +   uint32 MONEY = quest->GetRewOrReqMoney();
  204. +
  205. +   XP = XP + (XP * (xp_rate + (xp_rate * MOD)));
  206. +   MONEY = MONEY + (MONEY * MOD);
  207. +
  208. +   data << uint32(MONEY);
  209. +   data << uint32(XP);
  210.  
  211.      // rewarded honor points. Multiply with 10 to satisfy client
  212.      data << uint32(10 * quest->CalculateHonorGain(_session->GetPlayer()->GetQuestLevel(quest)));
  213. \ No newline at end of file
  214. diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
  215. index e4a2918..7b3df51 100644
  216. --- a/src/server/game/Entities/Player/Player.cpp
  217. +++ b/src/server/game/Entities/Player/Player.cpp
  218. @@ -14883,7 +14895,14 @@ void Player::IncompleteQuest(uint32 quest_id)
  219.  
  220.  void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver, bool announce)
  221.  {
  222. -    //this THING should be here to protect code from quest, which cast on player far teleport as a reward
  223. +   float VIP_OFFSET = VIP::GetVIPOFFSET();
  224. +   uint32 acctId = GetSession()->GetAccountId();
  225. +   uint8 Pvip = VIP::GetPlayerVIP(acctId);
  226. +   float MOD = (Pvip * VIP_OFFSET);
  227. +
  228. +   Player* player = GetSession()->GetPlayer();
  229. +  
  230. +   //this THING should be here to protect code from quest, which cast on player far teleport as a reward
  231.      //should work fine, cause far teleport will be executed in Player::Update()
  232.      SetCanDelayTeleport(true);
  233.  
  234. @@ -14927,7 +14946,10 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
  235.                  if (CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, quest->RewardItemIdCount[i]) == EQUIP_ERR_OK)
  236.                  {
  237.                      Item* item = StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId));
  238. -                    SendNewItem(item, quest->RewardItemIdCount[i], true, false);
  239. +
  240. +                   uint32 RewardItemCount = quest->RewardItemIdCount[i];
  241. +
  242. +                   SendNewItem(item, RewardItemCount + (RewardItemCount * MOD), true, false);
  243.                  }
  244.                  else if (quest->IsDFQuest())
  245.                      SendItemRetrievalMail(quest->RewardItemId[i], quest->RewardItemIdCount[i]);
  246. @@ -14944,7 +14966,8 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
  247.      bool rewarded = (m_RewardedQuests.find(quest_id) != m_RewardedQuests.end());
  248.  
  249.      // Not give XP in case already completed once repeatable quest
  250. -    uint32 XP = rewarded && !quest->IsDFQuest() ? 0 : uint32(quest->XPValue(this)*sWorld->getRate(RATE_XP_QUEST));
  251. +   uint32 XP = rewarded && !quest->IsDFQuest() ? 0 : uint32(quest->XPValue(this)*sWorld->getRate(RATE_XP_QUEST));
  252. +   XP = XP + (XP*MOD);
  253.  
  254.      // handle SPELL_AURA_MOD_XP_QUEST_PCT auras
  255.      Unit::AuraEffectList const& ModXPPctAuras = GetAuraEffectsByType(SPELL_AURA_MOD_XP_QUEST_PCT);
  256. @@ -14952,10 +14975,13 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
  257.          AddPct(XP, (*i)->GetAmount());
  258.  
  259.      int32 moneyRew = 0;
  260. -    if (getLevel() < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
  261. +   uint32 reward_money = quest->GetRewMoneyMaxLevel();
  262. +   reward_money = reward_money + (reward_money * (sWorld->getRate(RATE_DROP_MONEY) + MOD));
  263. +
  264. +   if (getLevel() < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
  265.          GiveXP(XP, NULL);
  266.      else
  267. -        moneyRew = int32(quest->GetRewMoneyMaxLevel() * sWorld->getRate(RATE_DROP_MONEY));
  268. +       moneyRew = int32(reward_money);
  269.  
  270.      // Give player extra money if GetRewOrReqMoney > 0 and get ReqMoney if negative
  271.      if (quest->GetRewOrReqMoney())
  272. @@ -14970,8 +14996,11 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
  273.      }
  274.  
  275.      // honor reward
  276. -    if (uint32 honor = quest->CalculateHonorGain(getLevel()))
  277. -        RewardHonor(NULL, 0, honor);
  278. +   if (uint32 honor = quest->CalculateHonorGain(getLevel()))
  279. +   {
  280. +       honor = honor + (honor * MOD);
  281. +       RewardHonor(NULL, 0, honor);
  282. +   }
  283.  
  284.      // title reward
  285.      if (quest->GetCharTitleId())
  286. @@ -14986,8 +15015,12 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
  287.          InitTalentForLevel();
  288.      }
  289.  
  290. -    if (quest->GetRewArenaPoints())
  291. -        ModifyArenaPoints(quest->GetRewArenaPoints());
  292. +   if (quest->GetRewArenaPoints())
  293. +   {
  294. +       int32 ArenaPoints = quest->GetRewArenaPoints();
  295. +       int32 RewardArenaPoints = ArenaPoints + (ArenaPoints * MOD);
  296. +       ModifyArenaPoints(RewardArenaPoints);
  297. +   }
  298.  
  299.      // Send reward mail
  300.      if (uint32 mail_template_id = quest->GetRewMailTemplateId())
  301. @@ -16457,22 +16490,38 @@ void Player::SendQuestComplete(uint32 quest_id)
  302.  
  303.  void Player::SendQuestReward(Quest const* quest, uint32 XP)
  304.  {
  305. -    uint32 questid = quest->GetQuestId();
  306. +   float VIP_OFFSET = VIP::GetVIPOFFSET();
  307. +   uint32 acctId = GetSession()->GetAccountId();
  308. +   uint8 Pvip = VIP::GetPlayerVIP(acctId);
  309. +   float MOD = (Pvip * VIP_OFFSET);
  310. +
  311. +   Player* player = GetSession()->GetPlayer();
  312. +  
  313. +   uint32 questid = quest->GetQuestId();
  314.      TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_QUEST_COMPLETE quest = %u", questid);
  315.      sGameEventMgr->HandleQuestComplete(questid);
  316.      WorldPacket data(SMSG_QUESTGIVER_QUEST_COMPLETE, (4+4+4+4+4));
  317.      data << uint32(questid);
  318.  
  319. -    if (getLevel() < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
  320. -    {
  321. -        data << uint32(XP);
  322. -        data << uint32(quest->GetRewOrReqMoney());
  323. -    }
  324. -    else
  325. +   int32 RewMoney = quest->GetRewOrReqMoney();
  326. +   RewMoney = RewMoney + (RewMoney * MOD);
  327. +   XP = XP + (XP * MOD);
  328. +
  329. +   if (getLevel() < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
  330. +   {
  331. +       data << uint32(XP);
  332. +
  333. +       data << uint32(RewMoney);
  334. +   }
  335. +   else
  336.      {
  337.          data << uint32(0);
  338. -        data << uint32(quest->GetRewOrReqMoney() + int32(quest->GetRewMoneyMaxLevel() * sWorld->getRate(RATE_DROP_MONEY)));
  339. -    }
  340. +
  341. +       float DropMoneyRate = sWorld->getRate(RATE_DROP_MONEY);
  342. +       DropMoneyRate = DropMoneyRate + (DropMoneyRate * MOD);
  343. +
  344. +       data << uint32(RewMoney + int32(quest->GetRewMoneyMaxLevel() * DropMoneyRate));
  345. +   }
  346.  
  347.      data << uint32(10 * quest->CalculateHonorGain(GetQuestLevel(quest)));
  348.      data << uint32(quest->GetBonusTalents());              // bonus talents
  349. \ No newline at end of file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement