mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 10:26:28 +01:00
[7432] Fixed BattleGround's bonus_honor based on player level and reputation rewards. Implement functions for BattleGroundWeekends. Author: balrok, Triply
Correctly assigned some comments. --HG-- branch : trunk
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
#include "ObjectMgr.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "Util.h"
|
||||
#include "Formulas.h"
|
||||
#include "GridNotifiersImpl.h"
|
||||
|
||||
namespace MaNGOS
|
||||
@@ -318,7 +319,13 @@ void BattleGround::Update(uint32 diff)
|
||||
else if(m_PrematureCountDownTimer < diff)
|
||||
{
|
||||
// time's up!
|
||||
EndBattleGround(0); // noone wins
|
||||
uint32 winner = 0;
|
||||
if( GetPlayersCountByTeam(ALLIANCE) >= GetMinPlayersPerTeam() )
|
||||
winner = ALLIANCE;
|
||||
else if( GetPlayersCountByTeam(HORDE) >= GetMinPlayersPerTeam() )
|
||||
winner = HORDE;
|
||||
|
||||
EndBattleGround(winner);
|
||||
m_PrematureCountDown = false;
|
||||
}
|
||||
else
|
||||
@@ -714,7 +721,6 @@ void BattleGround::EndBattleGround(uint32 winner)
|
||||
if(team == winner)
|
||||
{
|
||||
RewardMark(plr,ITEM_WINNER_COUNT);
|
||||
UpdatePlayerScore(plr, SCORE_BONUS_HONOR, 20);
|
||||
RewardQuest(plr);
|
||||
}
|
||||
else
|
||||
@@ -753,7 +759,13 @@ void BattleGround::EndBattleGround(uint32 winner)
|
||||
sBattleGroundMgr.m_BattleGroundQueues[BattleGroundMgr::BGQueueTypeId(GetTypeID(), GetArenaType())].BGEndedRemoveInvites(this);
|
||||
|
||||
if(winmsg_id)
|
||||
SendMessageToAll(winmsg_id,CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
SendMessageToAll(winmsg_id, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
}
|
||||
|
||||
uint32 BattleGround::GetBonusHonorFromKill(uint32 kills) const
|
||||
{
|
||||
//variable kills means how many honorable kills you scored (so we need kills * honor_for_one_kill)
|
||||
return MaNGOS::Honor::hk_honor_at_level(GetMaxLevel(), kills);
|
||||
}
|
||||
|
||||
uint32 BattleGround::GetBattlemasterEntry() const
|
||||
@@ -892,7 +904,7 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
|
||||
BattleGroundPlayerMap::iterator itr = m_Players.find(guid);
|
||||
if(itr != m_Players.end())
|
||||
{
|
||||
UpdatePlayersCountByTeam(team, true); // -1 player
|
||||
UpdatePlayersCountByTeam(team, true); // -1 player
|
||||
m_Players.erase(itr);
|
||||
// check if the player was a participant of the match, or only entered through gm command (goname)
|
||||
participant = true;
|
||||
@@ -934,8 +946,8 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
|
||||
// if arena, remove the specific arena auras
|
||||
if(isArena())
|
||||
{
|
||||
plr->RemoveArenaAuras(true); // removes debuffs / dots etc., we don't want the player to die after porting out
|
||||
bgTypeId=BATTLEGROUND_AA; // set the bg type to all arenas (it will be used for queue refreshing)
|
||||
plr->RemoveArenaAuras(true); // removes debuffs / dots etc., we don't want the player to die after porting out
|
||||
bgTypeId=BATTLEGROUND_AA; // set the bg type to all arenas (it will be used for queue refreshing)
|
||||
|
||||
// summon old pet if there was one and there isn't a current pet
|
||||
if(!plr->GetPet() && plr->GetTemporaryUnsummonedPetNumber())
|
||||
@@ -982,7 +994,7 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
|
||||
// remove from raid group if player is member
|
||||
if(Group *group = GetBgRaid(team))
|
||||
{
|
||||
if( !group->RemoveMember(guid, 0) ) // group was disbanded
|
||||
if( !group->RemoveMember(guid, 0) ) // group was disbanded
|
||||
{
|
||||
SetBgRaid(team, NULL);
|
||||
delete group;
|
||||
@@ -1001,7 +1013,7 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
|
||||
if( plr )
|
||||
{
|
||||
// Do next only if found in battleground
|
||||
plr->SetBattleGroundId(0, BATTLEGROUND_TYPE_NONE); // We're not in BG.
|
||||
plr->SetBattleGroundId(0, BATTLEGROUND_TYPE_NONE); // We're not in BG.
|
||||
// reset destination bg team
|
||||
plr->SetBGTeam(0);
|
||||
|
||||
|
||||
@@ -93,7 +93,6 @@ enum BattleGroundTimeIntervals
|
||||
RESPAWN_ONE_DAY = 86400, // secs
|
||||
RESPAWN_IMMEDIATELY = 0, // secs
|
||||
BUFF_RESPAWN_TIME = 180, // secs
|
||||
BG_HONOR_SCORE_TICKS = 330 // points
|
||||
};
|
||||
|
||||
enum BattleGroundStartTimeIntervals
|
||||
@@ -322,6 +321,7 @@ class BattleGround
|
||||
uint8 GetArenaType() const { return m_ArenaType; }
|
||||
uint8 GetWinner() const { return m_Winner; }
|
||||
uint32 GetBattlemasterEntry() const;
|
||||
uint32 GetBonusHonorFromKill(uint32 kills) const;
|
||||
|
||||
// Set methods:
|
||||
void SetName(char const* Name) { m_Name = Name; }
|
||||
|
||||
@@ -131,15 +131,15 @@ void BattleGroundAB::Update(uint32 diff)
|
||||
m_TeamScores[team] += BG_AB_TickPoints[points];
|
||||
m_HonorScoreTics[team] += BG_AB_TickPoints[points];
|
||||
m_ReputationScoreTics[team] += BG_AB_TickPoints[points];
|
||||
if( m_ReputationScoreTics[team] >= BG_AB_ReputationScoreTicks[m_HonorMode] )
|
||||
if( m_ReputationScoreTics[team] >= m_ReputationTics )
|
||||
{
|
||||
(team == BG_TEAM_ALLIANCE) ? RewardReputationToTeam(509, 10, ALLIANCE) : RewardReputationToTeam(510, 10, HORDE);
|
||||
m_ReputationScoreTics[team] -= BG_AB_ReputationScoreTicks[m_HonorMode];
|
||||
m_ReputationScoreTics[team] -= m_ReputationTics;
|
||||
}
|
||||
if( m_HonorScoreTics[team] >= BG_AB_HonorScoreTicks[m_HonorMode] )
|
||||
if( m_HonorScoreTics[team] >= m_HonorTics )
|
||||
{
|
||||
(team == BG_TEAM_ALLIANCE) ? RewardHonorToTeam(20, ALLIANCE) : RewardHonorToTeam(20, HORDE);
|
||||
m_HonorScoreTics[team] -= BG_AB_HonorScoreTicks[m_HonorMode];
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), (team == BG_TEAM_ALLIANCE) ? ALLIANCE : HORDE);
|
||||
m_HonorScoreTics[team] -= m_HonorTics;
|
||||
}
|
||||
if( !m_IsInformedNearVictory && m_TeamScores[team] > 1800 )
|
||||
{
|
||||
@@ -587,6 +587,10 @@ void BattleGroundAB::Reset()
|
||||
m_ReputationScoreTics[BG_TEAM_ALLIANCE] = 0;
|
||||
m_ReputationScoreTics[BG_TEAM_HORDE] = 0;
|
||||
m_IsInformedNearVictory = false;
|
||||
bool isBGWeekend = false; //TODO FIXME - call sBattleGroundMgr.IsBGWeekend(m_TypeID); - you must also implement that call!
|
||||
m_HonorTics = (isBGWeekend) ? BG_AB_ABBGWeekendHonorTicks : BG_AB_NotABBGWeekendHonorTicks;
|
||||
m_ReputationTics = (isBGWeekend) ? BG_AB_ABBGWeekendReputationTicks : BG_AB_NotABBGWeekendReputationTicks;
|
||||
|
||||
for (uint8 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
|
||||
{
|
||||
m_Nodes[i] = 0;
|
||||
@@ -600,6 +604,20 @@ void BattleGroundAB::Reset()
|
||||
DelCreature(i);
|
||||
}
|
||||
|
||||
void BattleGroundAB::EndBattleGround(uint32 winner)
|
||||
{
|
||||
//win reward
|
||||
if( winner == ALLIANCE )
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE);
|
||||
if( winner == HORDE )
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE);
|
||||
//complete map_end rewards (even if no team wins)
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE);
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE);
|
||||
|
||||
BattleGround::EndBattleGround(winner);
|
||||
}
|
||||
|
||||
WorldSafeLocsEntry const* BattleGroundAB::GetClosestGraveYard(Player* player)
|
||||
{
|
||||
uint8 teamIndex = GetTeamIndexByTeamId(player->GetTeam());
|
||||
|
||||
@@ -172,6 +172,11 @@ enum BG_AB_Sounds
|
||||
SOUND_NEAR_VICTORY = 8456
|
||||
};
|
||||
|
||||
#define BG_AB_NotABBGWeekendHonorTicks 330
|
||||
#define BG_AB_ABBGWeekendHonorTicks 200
|
||||
#define BG_AB_NotABBGWeekendReputationTicks 200
|
||||
#define BG_AB_ABBGWeekendReputationTicks 150
|
||||
|
||||
// x, y, z, o
|
||||
const float BG_AB_NodePositions[BG_AB_DYNAMIC_NODES_COUNT][4] = {
|
||||
{1166.785f, 1200.132f, -56.70859f, 0.9075713f}, // stables
|
||||
@@ -246,6 +251,7 @@ class BattleGroundAB : public BattleGround
|
||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||
virtual bool SetupBattleGround();
|
||||
virtual void Reset();
|
||||
void EndBattleGround(uint32 winner);
|
||||
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
|
||||
|
||||
/* Scorekeeping */
|
||||
@@ -275,15 +281,19 @@ class BattleGroundAB : public BattleGround
|
||||
2: horde contested
|
||||
3: ally occupied
|
||||
4: horde occupied */
|
||||
uint8 m_Nodes[BG_AB_DYNAMIC_NODES_COUNT];
|
||||
uint8 m_prevNodes[BG_AB_DYNAMIC_NODES_COUNT];
|
||||
BG_AB_BannerTimer m_BannerTimers[BG_AB_DYNAMIC_NODES_COUNT];
|
||||
int32 m_NodeTimers[BG_AB_DYNAMIC_NODES_COUNT];
|
||||
uint32 m_TeamScores[2];
|
||||
uint32 m_lastTick[2];
|
||||
uint32 m_HonorScoreTics[2];
|
||||
uint32 m_ReputationScoreTics[2];
|
||||
bool m_IsInformedNearVictory;
|
||||
uint8 m_Nodes[BG_AB_DYNAMIC_NODES_COUNT];
|
||||
uint8 m_prevNodes[BG_AB_DYNAMIC_NODES_COUNT];
|
||||
BG_AB_BannerTimer m_BannerTimers[BG_AB_DYNAMIC_NODES_COUNT];
|
||||
int32 m_NodeTimers[BG_AB_DYNAMIC_NODES_COUNT];
|
||||
uint32 m_TeamScores[2];
|
||||
uint32 m_lastTick[2];
|
||||
uint32 m_HonorScoreTics[2];
|
||||
uint32 m_ReputationScoreTics[2];
|
||||
bool m_IsInformedNearVictory;
|
||||
uint32 m_HonorTics;
|
||||
uint32 m_ReputationTics;
|
||||
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
@@ -130,10 +130,10 @@ void BattleGroundEY::AddPoints(uint32 Team, uint32 Points)
|
||||
uint8 team_index = GetTeamIndexByTeamId(Team);
|
||||
m_TeamScores[team_index] += Points;
|
||||
m_HonorScoreTics[team_index] += Points;
|
||||
if (m_HonorScoreTics[team_index] >= BG_EY_HonorScoreTicks[m_HonorMode])
|
||||
if (m_HonorScoreTics[team_index] >= m_HonorTics )
|
||||
{
|
||||
RewardHonorToTeam(20, Team);
|
||||
m_HonorScoreTics[team_index] -= BG_EY_HonorScoreTicks[m_HonorMode];
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), Team);
|
||||
m_HonorScoreTics[team_index] -= m_HonorTics;
|
||||
}
|
||||
UpdateTeamScore(Team);
|
||||
}
|
||||
@@ -279,6 +279,20 @@ void BattleGroundEY::UpdateTeamScore(uint32 Team)
|
||||
UpdateWorldState(EY_HORDE_RESOURCES, score);
|
||||
}
|
||||
|
||||
void BattleGroundEY::EndBattleGround(uint32 winner)
|
||||
{
|
||||
//win reward
|
||||
if( winner == ALLIANCE )
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE);
|
||||
if( winner == HORDE )
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE);
|
||||
//complete map reward
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE);
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE);
|
||||
|
||||
BattleGround::EndBattleGround(winner);
|
||||
}
|
||||
|
||||
void BattleGroundEY::UpdatePointsCount(uint32 Team)
|
||||
{
|
||||
if(Team == ALLIANCE)
|
||||
@@ -503,6 +517,8 @@ void BattleGroundEY::Reset()
|
||||
m_DroppedFlagGUID = 0;
|
||||
m_PointAddingTimer = 0;
|
||||
m_TowerCapCheckTimer = 0;
|
||||
bool isBGWeekend = false; //TODO FIXME - call sBattleGroundMgr.IsBGWeekend(m_TypeID); - you must also implement that call!
|
||||
uint32 m_HonorTics = (isBGWeekend) ? BG_EY_EYWeekendHonorTicks : BG_EY_NotEYWeekendHonorTicks;
|
||||
|
||||
for(uint8 i = 0; i < EY_POINTS_MAX; ++i)
|
||||
{
|
||||
|
||||
@@ -212,6 +212,9 @@ enum EYBattleGroundObjectTypes
|
||||
BG_EY_OBJECT_MAX = 59
|
||||
};
|
||||
|
||||
#define BG_EY_NotEYWeekendHonorTicks 330
|
||||
#define BG_EY_EYWeekendHonorTicks 200
|
||||
|
||||
enum BG_EY_FlagState
|
||||
{
|
||||
BG_EY_FLAG_STATE_ON_BASE = 0,
|
||||
@@ -323,6 +326,7 @@ class BattleGroundEY : public BattleGround
|
||||
virtual bool SetupBattleGround();
|
||||
virtual void Reset();
|
||||
void UpdateTeamScore(uint32 Team);
|
||||
void EndBattleGround(uint32 winner);
|
||||
void UpdatePlayerScore(Player *Source, uint32 type, uint32 value);
|
||||
virtual void FillInitialWorldStates(WorldPacket& data);
|
||||
void SetDroppedFlagGUID(uint64 guid) { m_DroppedFlagGUID = guid;}
|
||||
@@ -372,6 +376,7 @@ class BattleGroundEY : public BattleGround
|
||||
uint8 m_CurrentPointPlayersCount[2*EY_POINTS_MAX];
|
||||
|
||||
int32 m_PointAddingTimer;
|
||||
uint32 m_HonorTics;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
@@ -206,8 +206,6 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
|
||||
|
||||
uint32 winner = 0;
|
||||
|
||||
//TODO FIX reputation and honor gains for low level players!
|
||||
|
||||
Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
||||
if(Source->GetTeam() == ALLIANCE)
|
||||
{
|
||||
@@ -221,8 +219,7 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
|
||||
if(GetTeamScore(ALLIANCE) < BG_WS_MAX_TEAM_SCORE)
|
||||
AddPoint(ALLIANCE, 1);
|
||||
PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_ALLIANCE);
|
||||
RewardReputationToTeam(890, BG_WSG_Reputation[m_HonorMode][BG_WSG_FLAG_CAP], ALLIANCE); // +35 reputation
|
||||
RewardHonorToTeam(BG_WSG_Honor[m_HonorMode][BG_WSG_FLAG_CAP], ALLIANCE); // +40 bonushonor
|
||||
RewardReputationToTeam(890, m_ReputationCapture, ALLIANCE);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -236,9 +233,10 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
|
||||
if(GetTeamScore(HORDE) < BG_WS_MAX_TEAM_SCORE)
|
||||
AddPoint(HORDE, 1);
|
||||
PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_HORDE);
|
||||
RewardReputationToTeam(889, BG_WSG_Reputation[m_HonorMode][BG_WSG_FLAG_CAP], HORDE); // +35 reputation
|
||||
RewardHonorToTeam(BG_WSG_Honor[m_HonorMode][BG_WSG_FLAG_CAP], HORDE); // +40 bonushonor
|
||||
RewardReputationToTeam(889, m_ReputationCapture, HORDE);
|
||||
}
|
||||
//for flag capture is reward 2 honorable kills
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(2), Source->GetTeam());
|
||||
|
||||
SpawnBGObject(BG_WS_OBJECT_H_FLAG, BG_WS_FLAG_RESPAWN_TIME);
|
||||
SpawnBGObject(BG_WS_OBJECT_A_FLAG, BG_WS_FLAG_RESPAWN_TIME);
|
||||
@@ -251,7 +249,7 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
|
||||
UpdateFlagState(Source->GetTeam(), 1); // flag state none
|
||||
UpdateTeamScore(Source->GetTeam());
|
||||
// only flag capture should be updated
|
||||
UpdatePlayerScore(Source, SCORE_FLAG_CAPTURES, 1); // +1 flag captures...
|
||||
UpdatePlayerScore(Source, SCORE_FLAG_CAPTURES, 1); // +1 flag captures
|
||||
|
||||
if(GetTeamScore(ALLIANCE) == BG_WS_MAX_TEAM_SCORE)
|
||||
winner = ALLIANCE;
|
||||
@@ -616,16 +614,33 @@ void BattleGroundWS::Reset()
|
||||
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE;
|
||||
m_TeamScores[BG_TEAM_ALLIANCE] = 0;
|
||||
m_TeamScores[BG_TEAM_HORDE] = 0;
|
||||
bool isBGWeekend = false; //TODO FIXME - call sBattleGroundMgr.IsBGWeekend(m_TypeID); - you must also implement that call!
|
||||
m_ReputationCapture = (isBGWeekend) ? 45 : 35;
|
||||
m_HonorWinKills = (isBGWeekend) ? 3 : 1;
|
||||
m_HonorEndKills = (isBGWeekend) ? 4 : 2;
|
||||
|
||||
/* Spirit nodes is static at this BG and then not required deleting at BG reset.
|
||||
if(m_BgCreatures[WS_SPIRIT_MAIN_ALLIANCE])
|
||||
DelCreature(WS_SPIRIT_MAIN_ALLIANCE);
|
||||
|
||||
if(m_BgCreatures[WS_SPIRIT_MAIN_HORDE])
|
||||
DelCreature(WS_SPIRIT_MAIN_HORDE);
|
||||
*/
|
||||
}
|
||||
|
||||
void BattleGroundWS::EndBattleGround(uint32 winner)
|
||||
{
|
||||
//win reward
|
||||
if( winner == ALLIANCE )
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(m_HonorWinKills), ALLIANCE);
|
||||
if( winner == HORDE )
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(m_HonorWinKills), HORDE);
|
||||
//complete map_end rewards (even if no team wins)
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(m_HonorEndKills), ALLIANCE);
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(m_HonorEndKills), HORDE);
|
||||
|
||||
BattleGround::EndBattleGround(winner);
|
||||
}
|
||||
|
||||
void BattleGroundWS::HandleKillPlayer(Player *player, Player *killer)
|
||||
{
|
||||
if(GetStatus() != STATUS_IN_PROGRESS)
|
||||
|
||||
@@ -179,6 +179,7 @@ class BattleGroundWS : public BattleGround
|
||||
void HandleKillPlayer(Player *player, Player *killer);
|
||||
bool SetupBattleGround();
|
||||
virtual void Reset();
|
||||
void EndBattleGround(uint32 winner);
|
||||
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
|
||||
|
||||
void UpdateFlagState(uint32 team, uint32 value);
|
||||
@@ -202,8 +203,9 @@ class BattleGroundWS : public BattleGround
|
||||
int32 m_FlagsTimer[2];
|
||||
int32 m_FlagsDropTimer[2];
|
||||
|
||||
int32 m_FlagSpellForceTimer;
|
||||
int32 m_FlagSpellBrutalTimer;
|
||||
uint32 m_ReputationCapture;
|
||||
uint32 m_HonorWinKills;
|
||||
uint32 m_HonorEndKills;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "7431"
|
||||
#define REVISION_NR "7432"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
||||
Reference in New Issue
Block a user