Core/Battlegrounds: Implement mercenary system

Port From (https://github.com/TrinityCore/TrinityCore/commit/87723e32e24f03ac1d062e33edcbe935e4e59421)
This commit is contained in:
hondacrx
2022-05-31 11:46:04 -04:00
parent 6751370788
commit 1ba88f81db
9 changed files with 90 additions and 3 deletions
+16
View File
@@ -625,6 +625,9 @@ namespace Game.BattleGrounds
if (!player)
continue;
if (player.GetNativeTeam() != team)
continue;
uint repGain = Reputation;
MathFunctions.AddPct(ref repGain, player.GetTotalAuraModifier(AuraType.ModReputationGain));
MathFunctions.AddPct(ref repGain, player.GetTotalAuraModifierByMiscValue(AuraType.ModFactionReputationGain, (int)faction_id));
@@ -850,6 +853,8 @@ namespace Game.BattleGrounds
player.RemoveAurasByType(AuraType.ModShapeshift);
player.RemoveAurasByType(AuraType.Mounted);
player.RemoveAurasByType(AuraType.SwitchTeam);
player.RemoveAurasByType(AuraType.ModFaction);
if (!player.IsAlive()) // resurrect on exit
{
@@ -1065,6 +1070,17 @@ namespace Game.BattleGrounds
player.SendPacket(timer);
}
if (player.HasAura(PlayerConst.SpellMercenaryContractHorde))
{
player.CastSpell(player, BattlegroundConst.SpellMercenaryHorde1, true);
player.CastSpell(player, BattlegroundConst.SpellMercenaryHorde2, true);
}
else if (player.HasAura(PlayerConst.SpellMercenaryContractAlliance))
{
player.CastSpell(player, BattlegroundConst.SpellMercenaryAlliance1, true);
player.CastSpell(player, BattlegroundConst.SpellMercenaryAlliance2, true);
}
}
// reset all map criterias on map enter
@@ -67,7 +67,7 @@ namespace Game.BattleGrounds
ginfo.IsInvitedToBGInstanceGUID = 0;
ginfo.JoinTime = GameTime.GetGameTimeMS();
ginfo.RemoveInviteTime = 0;
ginfo.Team = leader.GetTeam();
ginfo.Team = leader.GetBgQueueTeam();
ginfo.ArenaTeamRating = ArenaRating;
ginfo.ArenaMatchmakerRating = MatchmakerRating;
ginfo.OpponentsTeamRating = 0;
@@ -109,6 +109,14 @@ namespace Game.BattleGrounds
m_QueuedPlayers[member.GetGUID()] = pl_info;
// add the pinfo to ginfo's list
ginfo.Players[member.GetGUID()] = pl_info;
if (ginfo.Team != member.GetTeam())
{
if (member.GetTeam() == Team.Alliance)
member.CastSpell(member, PlayerConst.SpellMercenaryContractHorde);
else
member.CastSpell(member, PlayerConst.SpellMercenaryContractAlliance);
}
}
}
else