aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Battlegrounds/Battleground.cpp2
-rw-r--r--src/server/game/Battlegrounds/Battleground.h1
-rw-r--r--src/server/game/Battlegrounds/BattlegroundMgr.cpp32
-rw-r--r--src/server/game/Spells/SpellInfo.cpp2
4 files changed, 32 insertions, 5 deletions
diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp
index 7c81db402ac..4860f226a67 100644
--- a/src/server/game/Battlegrounds/Battleground.cpp
+++ b/src/server/game/Battlegrounds/Battleground.cpp
@@ -1181,10 +1181,12 @@ void Battleground::AddPlayer(Player* player)
uint64 guid = player->GetGUID();
uint32 team = player->GetBGTeam();
+ int32 primaryTree = player->GetPrimaryTalentTree(player->GetActiveSpec());
BattlegroundPlayer bp;
bp.OfflineRemoveTime = 0;
bp.Team = team;
+ bp.PrimaryTree = primaryTree;
// Add to list/maps
m_Players[guid] = bp;
diff --git a/src/server/game/Battlegrounds/Battleground.h b/src/server/game/Battlegrounds/Battleground.h
index 59163539f87..824a71bc89b 100644
--- a/src/server/game/Battlegrounds/Battleground.h
+++ b/src/server/game/Battlegrounds/Battleground.h
@@ -160,6 +160,7 @@ struct BattlegroundPlayer
{
time_t OfflineRemoveTime; // for tracking and removing offline players from queue after 5 minutes
uint32 Team; // Player's team
+ int32 PrimaryTree; // Player's primary tree
};
struct BattlegroundObjectInfo
diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp
index 01abd82d380..4aa4fe56290 100644
--- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp
+++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp
@@ -376,7 +376,10 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg)
}
}
- data->WriteBits(bg->GetPlayerScoresSize(), 21);
+ size_t count_pos = data->bitwpos();
+ data->WriteBits(0, 21);
+ uint32 count = 0;
+ BattlegroundPlayerMap const& bgPlayers = bg->GetPlayers();
for (Battleground::BattlegroundScoreMap::const_iterator itr = bg->GetPlayerScoresBegin(); itr != bg->GetPlayerScoresEnd(); ++itr)
{
if (!bg->IsPlayerInBattleground(itr->first))
@@ -385,7 +388,26 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg)
continue;
}
- Player* player = ObjectAccessor::FindPlayer(itr->first);
+ uint32 team;
+ int32 primaryTree;
+ if (Player* player = ObjectAccessor::FindPlayer(itr->first))
+ {
+ team = player->GetBGTeam();
+ primaryTree = player->GetPrimaryTalentTree(player->GetActiveSpec());
+ }
+ else
+ {
+ BattlegroundPlayerMap::const_iterator itr2 = bgPlayers.find(itr->first);
+ if (itr2 == bgPlayers.end())
+ {
+ TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "Player " UI64FMTD " has scoreboard entry for battleground %u but do not have battleground data!", itr->first, bg->GetTypeID(true));
+ continue;
+ }
+
+ team = itr2->second.Team;
+ primaryTree = itr2->second.PrimaryTree;
+ }
+
ObjectGuid playerGUID = itr->first;
BattlegroundScore* score = itr->second;
@@ -401,7 +423,7 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg)
data->WriteBit(playerGUID[5]);
data->WriteBit(playerGUID[1]);
data->WriteBit(playerGUID[6]);
- data->WriteBit(player->GetBGTeam() == HORDE ? 0 : 1);
+ data->WriteBit(team == HORDE ? 0 : 1);
data->WriteBit(playerGUID[7]);
buff << uint32(score->HealingDone); // healing done
@@ -423,7 +445,7 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg)
buff.WriteByteSeq(playerGUID[1]);
buff.WriteByteSeq(playerGUID[6]);
- buff << int32(player->GetPrimaryTalentTree(player->GetActiveSpec()));
+ buff << int32(primaryTree);
switch (bg->GetTypeID(true)) // Custom values
{
@@ -539,8 +561,10 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg)
// if (unk 4) << uint32() unk
buff.WriteByteSeq(playerGUID[7]);
buff.WriteByteSeq(playerGUID[2]);
+ ++count;
}
+ data->PutBits(count_pos, count, 21);
data->WriteBit(bg->GetStatus() == STATUS_WAIT_LEAVE); // If Ended
if (isRated) // arena
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp
index 334f0cd80d5..1e48de9710f 100644
--- a/src/server/game/Spells/SpellInfo.cpp
+++ b/src/server/game/Spells/SpellInfo.cpp
@@ -452,7 +452,7 @@ int32 SpellEffectInfo::CalcValue(Unit const* caster, int32 const* bp, Unit const
float preciseBasePoints = ScalingMultiplier * multiplier;
if (DeltaScalingMultiplier)
{
- float delta = DeltaScalingMultiplier * ScalingMultiplier * multiplier * 0.5f;
+ float delta = fabs(DeltaScalingMultiplier * ScalingMultiplier * multiplier * 0.5f);
preciseBasePoints += frand(-delta, delta);
}