Want more features on Pastebin? Sign Up, it's FREE!
Guest

wowarmory_arena_chart.patch

By: a guest on Dec 14th, 2010  |  syntax: None  |  size: 8.64 KB  |  views: 36  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. # HG changeset patch
  2. # User Zuus
  3. # Date 1292358839 -7200
  4. # Branch trunk
  5. # Node ID 567b9506d51dd962e1e1570017becacc43763168
  6. # Parent  2d8ad8c446303777643c150505e30d7f66a9fe6d
  7. Apply armory arena
  8.  
  9. diff -r 2d8ad8c44630 -r 567b9506d51d src/server/game/Battlegrounds/Battleground.cpp
  10. --- a/src/server/game/Battlegrounds/Battleground.cpp    Mon Dec 13 23:10:58 2010 +0200
  11. +++ b/src/server/game/Battlegrounds/Battleground.cpp    Tue Dec 14 22:33:59 2010 +0200
  12. @@ -763,6 +763,49 @@
  13.                      winner_matchmaker_rating, loser_matchmaker_rating, winner_change, loser_change);
  14.                  SetArenaTeamRatingChangeForTeam(winner, winner_change);
  15.                  SetArenaTeamRatingChangeForTeam(GetOtherTeam(winner), loser_change);
  16. +
  17. +            /** World of Warcraft Armory **/
  18. +            uint32 maxChartID;
  19. +            QueryResult result = CharacterDatabase.Query("SELECT MAX(gameid) FROM armory_game_chart");
  20. +            if(!result)
  21. +                maxChartID = 0;
  22. +            else
  23. +            {
  24. +                maxChartID = (*result)[0].GetUInt32();
  25. +                result.release();
  26. +            }
  27. +            uint32 gameID = maxChartID+1;
  28. +            for(BattlegroundScoreMap::const_iterator itr = m_PlayerScores.begin(); itr != m_PlayerScores.end(); ++itr)
  29. +            {
  30. +                Player *plr = sObjectMgr.GetPlayer(itr->first);
  31. +                if (!plr)
  32. +                   continue;
  33. +                uint32 plTeamID = plr->GetArenaTeamId(winner_arena_team->GetSlot());
  34. +                int changeType;
  35. +                uint32 resultRating;
  36. +                uint32 resultTeamID;
  37. +                int32 ratingChange;
  38. +                if (plTeamID == winner_arena_team->GetId())
  39. +                {
  40. +                    changeType = 1; //win
  41. +                    resultRating = winner_team_rating;
  42. +                    resultTeamID = plTeamID;
  43. +                    ratingChange = winner_change;
  44. +                }
  45. +                else
  46. +                {
  47. +                    changeType = 2; //lose
  48. +                    resultRating = loser_team_rating;
  49. +                    resultTeamID = loser_arena_team->GetId();
  50. +                    ratingChange = loser_change;
  51. +                }
  52. +                std::ostringstream sql_query;
  53. +                //                                                        gameid,              teamid,                     guid,                    changeType,             ratingChange,               teamRating,                  damageDone,                          deaths,                          healingDone,                           damageTaken,                           healingTaken,                         killingBlows,                      mapId,                 start,                   end
  54. +                sql_query << "INSERT INTO armory_game_chart VALUES ('" << gameID << "', '" << resultTeamID << "', '" << plr->GetGUID() << "', '" << changeType << "', '" << ratingChange  << "', '" << resultRating << "', '" << itr->second->DamageDone << "', '" << itr->second->Deaths << "', '" << itr->second->HealingDone << "', '" << itr->second->DamageTaken << "', '" << itr->second->HealingTaken << "', '" << itr->second->KillingBlows << "', '" << m_MapId << "', '" << m_StartTime << "', '" << m_EndTime << "')";
  55. +                CharacterDatabase.Execute(sql_query.str().c_str());
  56. +            }
  57. +            /** World of Warcraft Armory **/
  58. +
  59.                  sLog.outArena("Arena match Type: %u for Team1Id: %u - Team2Id: %u ended. WinnerTeamId: %u. Winner rating: +%d, Loser rating: %d", m_ArenaType, m_ArenaTeamIds[BG_TEAM_ALLIANCE], m_ArenaTeamIds[BG_TEAM_HORDE], winner_arena_team->GetId(), winner_change, loser_change);
  60.                  if (sWorld.getBoolConfig(CONFIG_ARENA_LOG_EXTENDED_INFO))
  61.                      for (Battleground::BattlegroundScoreMap::const_iterator itr = GetPlayerScoresBegin(); itr != GetPlayerScoresEnd(); itr++)
  62. @@ -1404,6 +1447,14 @@
  63.          case SCORE_HEALING_DONE:                            // Healing Done
  64.              itr->second->HealingDone += value;
  65.              break;
  66. +        /** World of Warcraft Armory **/
  67. +        case SCORE_DAMAGE_TAKEN:
  68. +            itr->second->DamageTaken += value;              // Damage Taken
  69. +            break;
  70. +        case SCORE_HEALING_TAKEN:
  71. +            itr->second->HealingTaken += value;             // Healing Taken
  72. +            break;
  73. +        /** World of Warcraft Armory **/
  74.          default:
  75.              sLog.outError("Battleground: Unknown player score type %u", type);
  76.              break;
  77. diff -r 2d8ad8c44630 -r 567b9506d51d src/server/game/Battlegrounds/Battleground.h
  78. --- a/src/server/game/Battlegrounds/Battleground.h      Mon Dec 13 23:10:58 2010 +0200
  79. +++ b/src/server/game/Battlegrounds/Battleground.h      Tue Dec 14 22:33:59 2010 +0200
  80.  
  81.  #ifndef __BATTLEGROUND_H
  82. @@ -134,12 +132,12 @@
  83.  
  84.  enum BattlegroundRandomRewards
  85.  {
  86. -    BG_REWARD_WINNER_HONOR_FIRST    = 20,
  87. +    BG_REWARD_WINNER_HONOR_FIRST    = 30,
  88.      BG_REWARD_WINNER_ARENA_FIRST    = 25,
  89. -    BG_REWARD_WINNER_HONOR_LAST     = 12,
  90. +    BG_REWARD_WINNER_HONOR_LAST     = 15,
  91.      BG_REWARD_WINNER_ARENA_LAST     = 0,
  92. -    BG_REWARD_LOSER_HONOR_FIRST    = 3,
  93. -    BG_REWARD_LOSER_HONOR_LAST     = 3
  94. +    BG_REWARD_LOSER_HONOR_FIRST    = 5,
  95. +    BG_REWARD_LOSER_HONOR_LAST     = 5
  96.  };
  97.  
  98.  const uint32 Buff_Entries[3] = { BG_OBJECTID_SPEEDBUFF_ENTRY, BG_OBJECTID_REGENBUFF_ENTRY, BG_OBJECTID_BERSERKERBUFF_ENTRY };
  99. @@ -210,7 +208,11 @@
  100.      SCORE_SECONDARY_OBJECTIVES  = 17,
  101.      //SOTA
  102.      SCORE_DESTROYED_DEMOLISHER  = 18,
  103. -    SCORE_DESTROYED_WALL        = 19
  104. +    SCORE_DESTROYED_WALL        = 19,
  105. +    /** World of Warcraft Armory **/
  106. +    SCORE_DAMAGE_TAKEN          = 20,
  107. +    SCORE_HEALING_TAKEN         = 21
  108. +    /** World of Warcraft Armory **/
  109.  };
  110.  
  111.  enum ArenaType
  112. @@ -302,6 +304,10 @@
  113.          uint32 BonusHonor;
  114.          uint32 DamageDone;
  115.          uint32 HealingDone;
  116. +        /** World of Warcraft Armory **/
  117. +        uint32 DamageTaken;
  118. +        uint32 HealingTaken;
  119. +        /** World of Warcraft Armory **/
  120.  };
  121.  
  122.  enum BGHonorMode
  123. @@ -454,7 +460,7 @@
  124.          void SetBgMap(BattlegroundMap* map) { m_Map = map; }
  125.          BattlegroundMap* GetBgMap()
  126.          {
  127. -//            ASSERT(m_Map);
  128. +            ASSERT(m_Map);
  129.              return m_Map;
  130.          }
  131.  
  132. @@ -519,8 +525,8 @@
  133.          int32 GetArenaTeamRatingChangeForTeam(uint32 Team) const    { return m_ArenaTeamRatingChanges[GetTeamIndexByTeamId(Team)]; }
  134.          void SetArenaMatchmakerRating(uint32 Team, uint32 MMR){ m_ArenaTeamMMR[GetTeamIndexByTeamId(Team)] = MMR; }
  135.          uint32 GetArenaMatchmakerRating(uint32 Team)                { return m_ArenaTeamMMR[GetTeamIndexByTeamId(Team)]; }
  136. +        void CheckArenaAfterTimerConditions();
  137.          void CheckArenaWinConditions();
  138. -        void CheckArenaAfterTimerConditions();
  139.          void UpdateArenaWorldState();
  140.  
  141.          /* Triggers handle */
  142. @@ -635,7 +641,7 @@
  143.          bool   m_IsRated;                                   // is this battle rated?
  144.          bool   m_PrematureCountDown;
  145.          uint32 m_PrematureCountDownTimer;
  146. -               uint32 m_balance;
  147. +        uint32 m_balance;
  148.          char const *m_Name;
  149.  
  150.          /* Player lists */
  151.  
  152. diff -r 2d8ad8c44630 -r 567b9506d51d src/server/game/Entities/Unit/Unit.cpp
  153. --- a/src/server/game/Entities/Unit/Unit.cpp    Mon Dec 13 23:10:58 2010 +0200
  154. +++ b/src/server/game/Entities/Unit/Unit.cpp    Tue Dec 14 22:33:59 2010 +0200
  155. @@ -645,6 +645,10 @@
  156.          if (pVictim->GetTypeId() == TYPEID_PLAYER)
  157.              if (Battleground *bg = killer->GetBattleground())
  158.                  bg->UpdatePlayerScore(killer, SCORE_DAMAGE_DONE, damage);
  159. +                /** World of Warcraft Armory **/
  160. +                if (Battleground *bg = ((Player*)pVictim)->GetBattleground())
  161. +                    bg->UpdatePlayerScore(((Player*)pVictim), SCORE_DAMAGE_TAKEN, damage);
  162. +                /** World of Warcraft Armory **/
  163.  
  164.          killer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE, damage, 0, pVictim);
  165.          killer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HIT_DEALT, damage);
  166. @@ -10405,6 +10409,10 @@
  167.      {
  168.          pVictim->ToPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_TOTAL_HEALING_RECEIVED, gain);
  169.          pVictim->ToPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEALING_RECEIVED, addhealth);
  170. +        /** World of Warcraft Armory **/
  171. +        if (Battleground *bg = pVictim->ToPlayer()->GetBattleground())
  172. +            bg->UpdatePlayerScore((Player*)pVictim, SCORE_HEALING_TAKEN, gain);
  173. +        /** World of Warcraft Armory **/
  174.      }
  175.  
  176.      return gain;
clone this paste RAW Paste Data