[Cleanup] Identical conditions right beside each other in aa.cpp (#3213)

# Notes
- These conditions were identical and could be consolidated.
This commit is contained in:
Alex King 2023-04-05 10:30:27 -04:00 committed by GitHub
parent 1bafe0b6b3
commit 89b3a04eb3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1398,27 +1398,28 @@ int Mob::GetAlternateAdvancementCooldownReduction(AA::Rank *rank_in) {
void Mob::ExpendAlternateAdvancementCharge(uint32 aa_id) {
for (auto &iter : aa_ranks) {
AA::Ability *ability = zone->GetAlternateAdvancementAbility(iter.first);
auto ability = zone->GetAlternateAdvancementAbility(iter.first);
if (ability && aa_id == ability->id) {
if (iter.second.second > 0) {
iter.second.second -= 1;
if (iter.second.second == 0) {
if (IsClient()) {
AA::Rank *r = ability->GetRankByPointsSpent(iter.second.first);
if (r) {
CastToClient()->GetEPP().expended_aa += r->cost;
}
}
if (IsClient()) {
auto c = CastToClient();
auto r = ability->GetRankByPointsSpent(iter.second.first);
if (r) {
c->GetEPP().expended_aa += r->cost;
}
c->RemoveExpendedAA(ability->first_rank_id);
}
aa_ranks.erase(iter.first);
}
if (IsClient()) {
Client *c = CastToClient();
auto c = CastToClient();
c->SaveAA();
c->SendAlternateAdvancementPoints();
}