Public feed #724635

arathi reward

public text v1 · immutable
Raw Edit
·published 2007-10-03 19:05 UTC
rendered paste body
Index: BattleGround.cpp
===================================================================
--- BattleGround.cpp	(revision 4531)
+++ BattleGround.cpp	(working copy)
@@ -41,6 +41,7 @@
     m_startDelay        = 0;
     m_doorsSpawned      = false;
     m_IsRated           = false;
+    m_BattlegroundWeekend = 0;
     m_Name              = "";
     m_LevelMin          = 0;
     m_LevelMax          = 0;
@@ -424,12 +425,15 @@
             {
                 case BATTLEGROUND_AV:
                     mark = ITEM_AV_MARK_WINNER;
+                    honor = HONOR_AV_WINNER;
                     break;
                 case BATTLEGROUND_WS:
                     mark = ITEM_WSG_MARK_WINNER;
+                    honor = HONOR_WSG_WINNER;
                     break;
                 case BATTLEGROUND_AB:
                     mark = ITEM_AB_MARK_WINNER;
+                    honor = HONOR_AB_WINNER;
                     break;
             }
         }
@@ -452,6 +456,10 @@
         {
             plr->CastSpell(plr, mark, true);
         }
+        if(honor)
+		{
+           plr->RewardHonor(NULL, 1, honor);
+		}
     }
 
     if(Source)
Index: BattleGround.h
===================================================================
--- BattleGround.h	(revision 4531)
+++ BattleGround.h	(working copy)
@@ -37,6 +37,10 @@
 #define ITEM_AV_MARK_LOSER          24954
 #define ITEM_AV_MARK_WINNER         24955
 
+#define HONOR_WSG_WINNER            20
+#define HONOR_AB_WINNER             20
+#define HONOR_AV_WINNER             20
+
 #define SPELL_WAITING_FOR_RESURRECT 2584
 #define SPELL_SPIRIT_HEAL_CHANNEL   22011
 #define SPELL_SPIRIT_HEAL           22012
@@ -204,6 +208,9 @@
         uint8 GetWinner() { return m_Winner; }
         void SetWinner(uint8 winner) { m_Winner = winner; }
 
+        uint8 GetBgWeekend() {return m_BattlegroundWeekend; }
+        void SetBgWeekend(uint8 type) { m_BattlegroundWeekend = type; }
+
         bool isDoorsSpawned() { return m_doorsSpawned; }
         void SetDoorsSpawned(bool state) { m_doorsSpawned = state; }
 
@@ -310,6 +317,7 @@
         uint8  m_ArenaType;                                 // 2=2v2, 3=3v3, 5=5v5
         uint8  m_BattleGroundType;                          // 3=BG, 4=arena
         uint8  m_Winner;                                    // 0=alliance, 1=horde, 2=none
+        uint8  m_BattlegroundWeekend;                       // 0=none, 1=alterac, 2= warsong, 3=arathi
         int32  m_startDelay;
         bool   m_doorsSpawned;
         bool   m_IsRated;                                   // is this battle rated?
Index: BattleGroundAB.cpp
===================================================================
--- BattleGroundAB.cpp	(revision 4531)
+++ BattleGroundAB.cpp	(working copy)
@@ -154,8 +154,42 @@
             m_lastTick[team] += diff;
             if (m_lastTick[team] > BG_AB_TickIntervals[points])
             {
+                uint8 ArathiHonorTick = 330;
+                uint8 ArathiRepTick = 200;
+
+                if(GetBgWeekend() == GetID())
+				{
+                    ArathiHonorTick = 200;
+                    ArathiRepTick = 150;
+				}
+
+                uint8 honorfirstdiff = floor((float)m_TeamScores[team]/ArathiHonorTick);
+                uint8 repfirstdiff = floor((float)m_TeamScores[team]/ArathiRepTick);
                 m_lastTick[team] -= BG_AB_TickIntervals[points];
                 m_TeamScores[team] += BG_AB_TickPoints[points];
+                uint8 honorlastdiff = floor((float)m_TeamScores[team]/ArathiHonorTick);
+                uint8 replastdiff = floor((float)m_TeamScores[team]/ArathiRepTick);
+				if(honorlastdiff > honorfirstdiff)
+					for(std::map<uint64, BattleGroundPlayer>::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
+					{
+						Player *plr = objmgr.GetPlayer(itr->first);
+						if(!plr) continue;
+						if(itr->second.Team==team)
+								plr->RewardHonor(NULL, 1, BG_AB_HONOR_PER_TICK);
+					}
+				if(replastdiff > repfirstdiff)
+				{
+                    for(std::map<uint64, BattleGroundPlayer>::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
+					{
+						Player *plr = objmgr.GetPlayer(itr->first);
+						if(!plr) continue;
+						if(itr->second.Team==team)
+                            if(team==0)
+                            plr->ModifyFactionReputation(BG_AB_REP_FACTION1, BG_AB_REP_PER_TICK);
+                            else
+                            plr->ModifyFactionReputation(BG_AB_REP_FACTION2, BG_AB_REP_PER_TICK);
+					}
+				}
                 if (m_TeamScores[team] > 2000)
                     m_TeamScores[team] = 2000;
                 if(team == 0)
Index: BattleGroundAB.h
===================================================================
--- BattleGroundAB.h	(revision 4531)
+++ BattleGroundAB.h	(working copy)
@@ -53,6 +53,13 @@
 #define BG_AB_OBJECTID_GATE_A            180255
 #define BG_AB_OBJECTID_GATE_H            180256
 
+// BG Rewards:
+
+#define BG_AB_HONOR_PER_TICK             20
+#define BG_AB_REP_PER_TICK               10
+#define BG_AB_REP_FACTION1               1577
+#define BG_AB_REP_FACTION2               412
+
 enum BG_AB_ObjectType
 {
     // for all 5 node points 8*5=40 objects