Skip to content

Commit

Permalink
Style cleanup from the Mangos Futures Team
Browse files Browse the repository at this point in the history
  • Loading branch information
billy1arm committed Sep 14, 2020
1 parent 809eee0 commit 283c68b
Show file tree
Hide file tree
Showing 203 changed files with 12,036 additions and 350 deletions.
26 changes: 24 additions & 2 deletions src/game/AuctionHouseBot/AuctionHouseBot.cpp
Expand Up @@ -1174,14 +1174,18 @@ bool AuctionBotSeller::Initialize()
std::stringstream includeStream(sAuctionBotConfig.GetAHBotIncludes());
std::string temp;
while (getline(includeStream, temp, ','))
{ includeItems.push_back(atoi(temp.c_str())); }
{
includeItems.push_back(atoi(temp.c_str()));
}
}

{
std::stringstream excludeStream(sAuctionBotConfig.GetAHBotExcludes());
std::string temp;
while (getline(excludeStream, temp, ','))
{ excludeItems.push_back(atoi(temp.c_str())); }
{
excludeItems.push_back(atoi(temp.c_str()));
}
}
sLog.outString("Forced Inclusion " SIZEFMTD " items", includeItems.size());
sLog.outString("Forced Exclusion " SIZEFMTD " items", excludeItems.size());
Expand Down Expand Up @@ -1492,16 +1496,24 @@ bool AuctionBotSeller::Initialize()
{
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_MISC_MOUNT_MIN_REQ_LEVEL))
if (prototype->RequiredLevel < value)
{
continue;
}
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_MISC_MOUNT_MAX_REQ_LEVEL))
if (prototype->RequiredLevel > value)
{
continue;
}
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_MISC_MOUNT_MIN_SKILL_RANK))
if (prototype->RequiredSkillRank < value)
{
continue;
}
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_MISC_MOUNT_MAX_SKILL_RANK))
if (prototype->RequiredSkillRank > value)
{
continue;
}
}

if (prototype->Flags & ITEM_FLAG_LOOTABLE)
Expand All @@ -1523,16 +1535,24 @@ bool AuctionBotSeller::Initialize()
{
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_GLYPH_MIN_REQ_LEVEL))
if (prototype->RequiredLevel < value)
{
continue;
}
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_GLYPH_MAX_REQ_LEVEL))
if (prototype->RequiredLevel > value)
{
continue;
}
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_GLYPH_MIN_ITEM_LEVEL))
if (prototype->RequiredLevel < value)
{
continue;
}
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_GLYPH_MAX_ITEM_LEVEL))
if (prototype->RequiredLevel > value)
{
continue;
}
break;
}
case ITEM_CLASS_TRADE_GOODS:
Expand Down Expand Up @@ -2177,7 +2197,9 @@ void AuctionHouseBot::Rebuild(bool all)
AuctionEntry* entry = itr->second;
if (entry->owner == sAuctionBotConfig.GetAHBotId()) // ahbot auction
if (all || entry->bid == 0) // expire auction now if no bid or forced
{
entry->expireTime = sWorld.GetGameTime();
}
}
}
}
Expand Down
50 changes: 48 additions & 2 deletions src/game/BattleGround/BattleGround.cpp
Expand Up @@ -443,12 +443,16 @@ void BattleGround::Update(uint32 diff)

for (BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
if (Player* player = sObjectMgr.GetPlayer(itr->first))
{
player->GetSession()->SendPacket(&data);
}

m_CountdownTimer = 0;
}
else
{
m_CountdownTimer += diff;
}

if (!(m_Events & BG_STARTING_EVENT_1))
{
Expand Down Expand Up @@ -491,7 +495,9 @@ void BattleGround::Update(uint32 diff)
for (BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
{
if (Player* player = sObjectMgr.GetPlayer(itr->first))
{
player->RemoveAurasDueToSpell(SPELL_ARENA_PREPARATION);
}
}

CheckArenaWinConditions();
Expand All @@ -502,7 +508,9 @@ void BattleGround::Update(uint32 diff)

for (BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
if (Player* plr = sObjectMgr.GetPlayer(itr->first))
{
plr->RemoveAurasDueToSpell(SPELL_PREPARATION);
}
// Announce BG starting
if (sWorld.getConfig(CONFIG_BOOL_BATTLEGROUND_QUEUE_ANNOUNCER_START))
{
Expand Down Expand Up @@ -922,9 +930,13 @@ void BattleGround::EndBattleGround(Team winner)
if (isArena() && isRated() && winner_arena_team && loser_arena_team)
{
if (team == winner)
{
winner_arena_team->OfflineMemberLost(itr->first, loser_rating);
}
else
{
loser_arena_team->OfflineMemberLost(itr->first, winner_rating);
}
}
continue;
}
Expand Down Expand Up @@ -965,7 +977,9 @@ void BattleGround::EndBattleGround(Team winner)
// update achievement BEFORE personal rating update
ArenaTeamMember* member = winner_arena_team->GetMember(plr->GetObjectGuid());
if (member)
{
plr->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, member->personal_rating);
}

winner_arena_team->MemberWon(plr, loser_rating);
plr->ModifyCurrencyCount(CURRENCY_CONQUEST_ARENA_META, sWorld.getConfig(CONFIG_UINT32_CURRENCY_ARENA_CONQUEST_POINTS_REWARD));
Expand Down Expand Up @@ -1344,7 +1358,9 @@ void BattleGround::RemovePlayerAtLeave(ObjectGuid guid, bool Transport, bool Sen
ArenaTeam* winner_arena_team = sObjectMgr.GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(team)));
ArenaTeam* loser_arena_team = sObjectMgr.GetArenaTeamById(GetArenaTeamIdForTeam(team));
if (winner_arena_team && loser_arena_team)
{
loser_arena_team->MemberLost(plr, winner_arena_team->GetRating());
}
}
}
if (SendPacket)
Expand All @@ -1366,7 +1382,9 @@ void BattleGround::RemovePlayerAtLeave(ObjectGuid guid, bool Transport, bool Sen
ArenaTeam* others_arena_team = sObjectMgr.GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(team)));
ArenaTeam* players_arena_team = sObjectMgr.GetArenaTeamById(GetArenaTeamIdForTeam(team));
if (others_arena_team && players_arena_team)
{
players_arena_team->OfflineMemberLost(guid, others_arena_team->GetRating());
}
}
}

Expand Down Expand Up @@ -1476,7 +1494,9 @@ void BattleGround::StartTimedAchievement(AchievementCriteriaTypes type, uint32 e
{
for (BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
if (Player* pPlayer = GetBgMap()->GetPlayer(itr->first))
{
pPlayer->GetAchievementMgr().StartTimedAchievementCriteria(type, entry);
}
}

void BattleGround::AddPlayer(Player* plr)
Expand Down Expand Up @@ -1514,30 +1534,42 @@ void BattleGround::AddPlayer(Player* plr)
if (team == ALLIANCE) // gold
{
if (plr->GetTeam() == HORDE)
{
plr->CastSpell(plr, SPELL_HORDE_GOLD_FLAG, true);
}
else
{
plr->CastSpell(plr, SPELL_ALLIANCE_GOLD_FLAG, true);
}
}
else // green
{
if (plr->GetTeam() == HORDE)
{
plr->CastSpell(plr, SPELL_HORDE_GREEN_FLAG, true);
}
else
{
plr->CastSpell(plr, SPELL_ALLIANCE_GREEN_FLAG, true);
}
}

plr->DestroyConjuredItems(true);
plr->UnsummonPetTemporaryIfAny();

if (GetStatus() == STATUS_WAIT_JOIN) // not started yet
{
plr->CastSpell(plr, SPELL_ARENA_PREPARATION, true);
}

plr->CastSpell(plr, SPELL_ARENA_DAMPENING, true);
}
else
{
if (GetStatus() == STATUS_WAIT_JOIN) // not started yet
{
plr->CastSpell(plr, SPELL_PREPARATION, true); // reduces all mana cost of spells.
}

plr->CastSpell(plr, SPELL_BATTLEGROUND_DAMPENING, true);
}
Expand Down Expand Up @@ -1636,7 +1668,9 @@ void BattleGround::EventPlayerLoggedOut(Player* player)
// 1 player is logging out, if it is the last, then end arena!
if (isArena())
if (GetAlivePlayersCountByTeam(player->GetTeam()) <= 1 && GetPlayersCountByTeam(GetOtherTeam(player->GetTeam())))
{
EndBattleGround(GetOtherTeam(player->GetTeam()));
}
}
}

Expand Down Expand Up @@ -1729,7 +1763,9 @@ void BattleGround::UpdatePlayerScore(Player* Source, uint32 type, uint32 value)
{
// reward honor instantly
if (Source->RewardHonor(NULL, 1, (float)value))
{
itr->second->BonusHonor += value;
}
}
break;
// used only in EY, but in MSG_PVP_LOG_DATA opcode
Expand Down Expand Up @@ -1917,7 +1953,9 @@ void BattleGround::SpawnEvent(uint8 event1, uint8 event2, bool spawn)
// or despawn something which was already despawned
if (event2 == BG_EVENT_NONE || (spawn && m_ActiveEvents[event1] == event2)
|| (!spawn && m_ActiveEvents[event1] != event2))
{ return; }
{
return;
}

if (spawn)
{
Expand All @@ -1926,7 +1964,9 @@ void BattleGround::SpawnEvent(uint8 event1, uint8 event2, bool spawn)
m_ActiveEvents[event1] = event2; // set this event to active
}
else
{ m_ActiveEvents[event1] = BG_EVENT_NONE; } // no event active if event2 gets despawned
{
m_ActiveEvents[event1] = BG_EVENT_NONE; // no event active if event2 gets despawned
}

GuidVector::const_iterator itr = m_EventObjects[MAKE_PAIR32(event1, event2)].creatures.begin();
for (; itr != m_EventObjects[MAKE_PAIR32(event1, event2)].creatures.end(); ++itr)
Expand Down Expand Up @@ -2149,7 +2189,9 @@ void BattleGround::HandleKillPlayer(Player* player, Player* killer)

// to be able to remove insignia -- ONLY IN BattleGrounds
if (!isArena())
{
player->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
}
}

/// <summary>
Expand Down Expand Up @@ -2231,9 +2273,13 @@ uint32 BattleGround::GetAlivePlayersCountByTeam(Team team) const
void BattleGround::CheckArenaWinConditions()
{
if (!GetAlivePlayersCountByTeam(ALLIANCE) && GetPlayersCountByTeam(HORDE))
{
EndBattleGround(HORDE);
}
else if (GetPlayersCountByTeam(ALLIANCE) && !GetAlivePlayersCountByTeam(HORDE))
{
EndBattleGround(ALLIANCE);
}
}

/// <summary>
Expand Down
6 changes: 6 additions & 0 deletions src/game/BattleGround/BattleGroundAB.cpp
Expand Up @@ -175,7 +175,9 @@ void BattleGroundAB::Update(uint32 diff)
// horde will be a bit disadvantaged, but we can assume that points aren't updated for both team in same Update() call
uint8 otherTeam = (team + 1) % PVP_TEAM_COUNT;
if (m_TeamScores[team] > m_TeamScores[otherTeam] + 500)
{
m_TeamScores500Disadvantage[otherTeam] = true;
}
}
}

Expand Down Expand Up @@ -596,9 +598,13 @@ void BattleGroundAB::EndBattleGround(Team 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);
Expand Down
6 changes: 6 additions & 0 deletions src/game/BattleGround/BattleGroundBE.cpp
Expand Up @@ -62,7 +62,9 @@ void BattleGroundBE::AddPlayer(Player* plr)
void BattleGroundBE::RemovePlayer(Player* /*plr*/, ObjectGuid /*guid*/)
{
if (GetStatus() == STATUS_WAIT_LEAVE)
{
return;
}

UpdateWorldState(0x9f1, GetAlivePlayersCountByTeam(ALLIANCE));
UpdateWorldState(0x9f0, GetAlivePlayersCountByTeam(HORDE));
Expand All @@ -73,7 +75,9 @@ void BattleGroundBE::RemovePlayer(Player* /*plr*/, ObjectGuid /*guid*/)
void BattleGroundBE::HandleKillPlayer(Player* player, Player* killer)
{
if (GetStatus() != STATUS_IN_PROGRESS)
{
return;
}

if (!killer)
{
Expand Down Expand Up @@ -106,7 +110,9 @@ void BattleGroundBE::UpdatePlayerScore(Player* source, uint32 type, uint32 value
{
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(source->GetObjectGuid());
if (itr == m_PlayerScores.end()) // player not found...
{
return;
}

// there is nothing special in this score
BattleGround::UpdatePlayerScore(source, type, value);
Expand Down

0 comments on commit 283c68b

Please sign in to comment.