mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-27 07:36:23 +00:00
fix(Core/Events): Implement Spirit of Competition event (#16963)
* fix(Core/Events): Implement Spirit of Competition event Co-Authored-By: Benjamin Jackson <38561765+heyitsbench@users.noreply.github.com> * Update Battleground.cpp * Update rev_1691529514989936100.sql * more stuff * bye bye magic numbers * fix dberrors * Update Battleground.cpp * Update Battleground.cpp * Update Battleground.cpp Co-Authored-By: Anton Popovichenko <walkline.ua@gmail.com> * Update Battleground.cpp * Update Battleground.cpp * Update Battleground.cpp * Update Battleground.cpp * Update rev_1691529514989936100.sql * commoneers * Update src/server/game/Battlegrounds/Battleground.cpp Co-authored-by: Anton Popovichenko <walkline.ua@gmail.com> * ci * Update rev_1691529514989936100.sql * unnecessary whitespace * Update src/server/game/Battlegrounds/Battleground.cpp * Update src/server/game/Battlegrounds/Battleground.cpp * Update src/server/game/Battlegrounds/Battleground.cpp * Update Battleground.cpp --------- Co-authored-by: Benjamin Jackson <38561765+heyitsbench@users.noreply.github.com> Co-authored-by: Anton Popovichenko <walkline.ua@gmail.com>
This commit is contained in:
@@ -916,9 +916,49 @@ void Battleground::EndBattleground(PvPTeamId winnerTeamId)
|
||||
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND, player->GetMapId());
|
||||
}
|
||||
|
||||
if (IsEventActive(EVENT_SPIRIT_OF_COMPETITION) && isBattleground())
|
||||
SpiritofCompetitionEvent(winnerTeamId);
|
||||
|
||||
sScriptMgr->OnBattlegroundEnd(this, GetTeamId(winnerTeamId));
|
||||
}
|
||||
|
||||
bool Battleground::SpiritofCompetitionEvent(PvPTeamId winnerTeamId)
|
||||
{
|
||||
// Everyone is eligible for tabard reward
|
||||
for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
{
|
||||
Player* player = itr->second;
|
||||
bool questStatus = player->GetQuestStatus(QUEST_FLAG_PARTICIPANT) != QUEST_STATUS_REWARDED;
|
||||
|
||||
if (player && questStatus)
|
||||
player->CastSpell(player, SPELL_SPIRIT_OF_COMPETITION_PARTICIPANT, true);
|
||||
}
|
||||
|
||||
// In case of a draw nobody get rewarded
|
||||
if (winnerTeamId == PVP_TEAM_NEUTRAL)
|
||||
return false;
|
||||
|
||||
std::vector<Player*> filteredPlayers;
|
||||
|
||||
for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
{
|
||||
Player* player = itr->second;
|
||||
bool playerTeam = player->GetBgTeamId() == GetTeamId(winnerTeamId);
|
||||
bool questStatus = player->GetQuestStatus(QUEST_FLAG_WINNER) != QUEST_STATUS_REWARDED;
|
||||
|
||||
if (player && playerTeam && questStatus)
|
||||
filteredPlayers.push_back(player);
|
||||
}
|
||||
|
||||
if (filteredPlayers.size())
|
||||
{
|
||||
if (Player* wPlayer = filteredPlayers[rand() % filteredPlayers.size()])
|
||||
wPlayer->CastSpell(wPlayer, SPELL_SPIRIT_OF_COMPETITION_WINNER, true);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32 Battleground::GetBonusHonorFromKill(uint32 kills) const
|
||||
{
|
||||
//variable kills means how many honorable kills you scored (so we need kills * honor_for_one_kill)
|
||||
|
||||
Reference in New Issue
Block a user