From 380db44583df7abdafb2dfa18d89017dae88d39b Mon Sep 17 00:00:00 2001 From: Spp Date: Tue, 2 Oct 2012 12:17:42 +0200 Subject: Core/Utilities: Use generic templates with AddPct, ApplyPct and CalculatePct --- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 36 ++++++------- src/server/game/Spells/Auras/SpellAuras.cpp | 6 +-- src/server/game/Spells/Spell.cpp | 6 +-- src/server/game/Spells/SpellEffects.cpp | 64 +++++++++++------------ src/server/game/Spells/SpellInfo.cpp | 6 +-- 5 files changed, 59 insertions(+), 59 deletions(-) (limited to 'src/server/game/Spells') diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index f28a02a52fc..297b4df97c4 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -474,7 +474,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster) // Glyph of Fear, Glyph of Frost nova and similar auras if ((*itr)->GetMiscValue() == 7801) { - AddPctN(amount, (*itr)->GetAmount()); + AddPct(amount, (*itr)->GetAmount()); break; } } @@ -527,7 +527,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster) // Borrowed Time if (AuraEffect const* pAurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 2899, 1)) - bonus += CalculatePctN(1.0f, pAurEff->GetAmount()); + bonus += CalculatePct(1.0f, pAurEff->GetAmount()); DoneActualBenefit += caster->SpellBaseHealingBonusDone(m_spellInfo->GetSchoolMask()) * bonus; // Improved PW: Shield: its weird having a SPELLMOD_ALL_EFFECTS here but its blizzards doing :) @@ -539,7 +539,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster) // Twin Disciplines if (AuraEffect const* pAurEff = caster->GetAuraEffect(SPELL_AURA_ADD_PCT_MODIFIER, SPELLFAMILY_PRIEST, 0x400000, 0, 0, caster->GetGUID())) - AddPctN(amount, pAurEff->GetAmount()); + AddPct(amount, pAurEff->GetAmount()); // Focused Power // Reuse variable, not sure if this code below can be moved before Twin Disciplines @@ -569,7 +569,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster) if (!pAurEff) pAurEff = caster->GetAuraEffect(74411, 0); // Battleground - Dampening if (pAurEff) - AddPctN(amount, pAurEff->GetAmount()); + AddPct(amount, pAurEff->GetAmount()); return amount; } @@ -635,7 +635,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster) else if (AuraEffect const* aurEff = caster->GetAuraEffect(60774, EFFECT_0)) amount += cp * aurEff->GetAmount(); - amount += uint32(CalculatePctU(caster->GetTotalAttackPowerValue(BASE_ATTACK), cp)); + amount += uint32(CalculatePct(caster->GetTotalAttackPowerValue(BASE_ATTACK), cp)); } // Rend else if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_WARRIOR && GetSpellInfo()->SpellFamilyFlags[0] & 0x20) @@ -653,7 +653,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster) if (m_spellInfo->GetRank() >= 9) { if (GetBase()->GetUnitOwner()->HasAuraState(AURA_STATE_HEALTH_ABOVE_75_PERCENT, m_spellInfo, caster)) - AddPctN(amount, m_spellInfo->Effects[EFFECT_2].CalcValue(caster)); + AddPct(amount, m_spellInfo->Effects[EFFECT_2].CalcValue(caster)); } } // Unholy Blight damage over time effect @@ -674,10 +674,10 @@ int32 AuraEffect::CalculateAmount(Unit* caster) amount = GetBase()->GetUnitOwner()->GetMaxPower(POWER_MANA) * 0.0025f; break; case 29166: // Innervate - ApplyPctF(amount, float(GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA)) / GetTotalTicks()); + ApplyPct(amount, float(GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA)) / GetTotalTicks()); break; case 48391: // Owlkin Frenzy - ApplyPctU(amount, GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA)); + ApplyPct(amount, GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA)); break; default: break; @@ -692,7 +692,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster) if (caster->GetTypeId() == TYPEID_PLAYER) // Bonus from Glyph of Lightwell if (AuraEffect* modHealing = caster->GetAuraEffect(55673, 0)) - AddPctN(amount, modHealing->GetAmount()); + AddPct(amount, modHealing->GetAmount()); } break; case SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN: @@ -4745,7 +4745,7 @@ void AuraEffect::HandleModPowerCostPCT(AuraApplication const* aurApp, uint8 mode Unit* target = aurApp->GetTarget(); - float amount = CalculatePctN(1.0f, GetAmount()); + float amount = CalculatePct(1.0f, GetAmount()); for (int i = 0; i < MAX_SPELL_SCHOOL; ++i) if (GetMiscValue() & (1 << i)) target->ApplyModSignedFloatValue(UNIT_FIELD_POWER_COST_MULTIPLIER + i, amount, apply); @@ -6399,25 +6399,25 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const // Tenacity increase healing % taken if (AuraEffect const* Tenacity = target->GetAuraEffect(58549, 0)) - AddPctN(TakenTotalMod, Tenacity->GetAmount()); + AddPct(TakenTotalMod, Tenacity->GetAmount()); // Healing taken percent float minval = (float)target->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_PCT); if (minval) - AddPctF(TakenTotalMod, minval); + AddPct(TakenTotalMod, minval); float maxval = (float)target->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HEALING_PCT); if (maxval) - AddPctF(TakenTotalMod, maxval); + AddPct(TakenTotalMod, maxval); // Healing over time taken percent float minval_hot = (float)target->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HOT_PCT); if (minval_hot) - AddPctF(TakenTotalMod, minval_hot); + AddPct(TakenTotalMod, minval_hot); float maxval_hot = (float)target->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HOT_PCT); if (maxval_hot) - AddPctF(TakenTotalMod, maxval_hot); + AddPct(TakenTotalMod, maxval_hot); TakenTotalMod = std::max(TakenTotalMod, 0.0f); @@ -6510,8 +6510,8 @@ void AuraEffect::HandlePeriodicManaLeechAuraTick(Unit* target, Unit* caster) con if (m_spellInfo->ManaCostPercentage) { // max value - int32 maxmana = CalculatePctF(caster->GetMaxPower(powerType), drainAmount * 2.0f); - ApplyPctU(drainAmount, target->GetMaxPower(powerType)); + int32 maxmana = CalculatePct(caster->GetMaxPower(powerType), drainAmount * 2.0f); + ApplyPct(drainAmount, target->GetMaxPower(powerType)); if (drainAmount > maxmana) drainAmount = maxmana; } @@ -6548,7 +6548,7 @@ void AuraEffect::HandlePeriodicManaLeechAuraTick(Unit* target, Unit* caster) con // Mana Feed - Drain Mana if (manaFeedVal > 0) { - int32 feedAmount = CalculatePctN(gainedAmount, manaFeedVal); + int32 feedAmount = CalculatePct(gainedAmount, manaFeedVal); caster->CastCustomSpell(caster, 32554, &feedAmount, NULL, NULL, true, NULL, this); } } diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 4060ee42206..9c08ebae5ac 100755 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -1215,7 +1215,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b uint32 damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), GetEffect(0)->GetAmount(), DOT); damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT); int32 basepoints0 = aurEff->GetAmount() * GetEffect(0)->GetTotalTicks() * int32(damage) / 100; - int32 heal = int32(CalculatePctN(basepoints0, 15)); + int32 heal = int32(CalculatePct(basepoints0, 15)); caster->CastCustomSpell(target, 63675, &basepoints0, NULL, NULL, true, NULL, GetEffect(0)); caster->CastCustomSpell(caster, 75999, &heal, NULL, NULL, true, NULL, GetEffect(0)); @@ -1433,7 +1433,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b else if (aurEff->GetId() == 47537) multiplier += 0.5f; - int32 basepoints0 = int32(CalculatePctF(caster->GetMaxPower(POWER_MANA), multiplier)); + int32 basepoints0 = int32(CalculatePct(caster->GetMaxPower(POWER_MANA), multiplier)); caster->CastCustomSpell(caster, 47755, &basepoints0, NULL, NULL, true); } // effect on aura target @@ -1447,7 +1447,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b { case POWER_MANA: { - int32 basepoints0 = int32(CalculatePctN(target->GetMaxPower(POWER_MANA), 2)); + int32 basepoints0 = int32(CalculatePct(target->GetMaxPower(POWER_MANA), 2)); caster->CastCustomSpell(target, 63654, &basepoints0, NULL, NULL, true); break; } diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 6b51f240b28..0564aa50273 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -6365,7 +6365,7 @@ void Spell::Delayed() // only called in DealDamage() if (delayReduce >= 100) return; - AddPctN(delaytime, -delayReduce); + AddPct(delaytime, -delayReduce); if (m_timer + delaytime > m_casttime) { @@ -6393,14 +6393,14 @@ void Spell::DelayedChannel() return; //check pushback reduce - int32 delaytime = CalculatePctN(m_spellInfo->GetDuration(), 25); // channeling delay is normally 25% of its time per hit + int32 delaytime = CalculatePct(m_spellInfo->GetDuration(), 25); // channeling delay is normally 25% of its time per hit int32 delayReduce = 100; // must be initialized to 100 for percent modifiers m_caster->ToPlayer()->ApplySpellMod(m_spellInfo->Id, SPELLMOD_NOT_LOSE_CASTING_TIME, delayReduce, this); delayReduce += m_caster->GetTotalAuraModifier(SPELL_AURA_REDUCE_PUSHBACK) - 100; if (delayReduce >= 100) return; - AddPctN(delaytime, -delayReduce); + AddPct(delaytime, -delayReduce); if (m_timer <= delaytime) { diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index dcbd1888b03..cbc478078e5 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -377,13 +377,13 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) } // Victory Rush else if (m_spellInfo->SpellFamilyFlags[1] & 0x100) - ApplyPctF(damage, m_caster->GetTotalAttackPowerValue(BASE_ATTACK)); + ApplyPct(damage, m_caster->GetTotalAttackPowerValue(BASE_ATTACK)); // Shockwave else if (m_spellInfo->Id == 46968) { int32 pct = m_caster->CalculateSpellDamage(unitTarget, m_spellInfo, 2); if (pct > 0) - damage += int32(CalculatePctN(m_caster->GetTotalAttackPowerValue(BASE_ATTACK), pct)); + damage += int32(CalculatePct(m_caster->GetTotalAttackPowerValue(BASE_ATTACK), pct)); break; } break; @@ -434,10 +434,10 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) pdamage = unitTarget->SpellDamageBonusTaken(m_caster, aura->GetSpellInfo(), pdamage, DOT, aura->GetBase()->GetStackAmount()); uint32 pct_dir = m_caster->CalculateSpellDamage(unitTarget, m_spellInfo, (effIndex + 1)); uint8 baseTotalTicks = uint8(m_caster->CalcSpellDuration(aura->GetSpellInfo()) / aura->GetSpellInfo()->Effects[EFFECT_0].Amplitude); - damage += int32(CalculatePctU(pdamage * baseTotalTicks, pct_dir)); + damage += int32(CalculatePct(pdamage * baseTotalTicks, pct_dir)); uint32 pct_dot = m_caster->CalculateSpellDamage(unitTarget, m_spellInfo, (effIndex + 2)) / 3; - m_spellValue->EffectBasePoints[1] = m_spellInfo->Effects[EFFECT_1].CalcBaseValue(int32(CalculatePctU(pdamage * baseTotalTicks, pct_dot))); + m_spellValue->EffectBasePoints[1] = m_spellInfo->Effects[EFFECT_1].CalcBaseValue(int32(CalculatePct(pdamage * baseTotalTicks, pct_dot))); apply_direct_bonus = false; // Glyph of Conflagrate @@ -495,7 +495,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) float multiple = ap / 410 + m_spellInfo->Effects[effIndex].DamageMultiplier; int32 energy = -(m_caster->ModifyPower(POWER_ENERGY, -30)); damage += int32(energy * multiple); - damage += int32(CalculatePctN(m_caster->ToPlayer()->GetComboPoints() * ap, 7)); + damage += int32(CalculatePct(m_caster->ToPlayer()->GetComboPoints() * ap, 7)); } // Wrath else if (m_spellInfo->SpellFamilyFlags[0] & 0x00000001) @@ -503,7 +503,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) // Improved Insect Swarm if (AuraEffect const* aurEff = m_caster->GetDummyAuraEffect(SPELLFAMILY_DRUID, 1771, 0)) if (unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DRUID, 0x00200000, 0, 0)) - AddPctN(damage, aurEff->GetAmount()); + AddPct(damage, aurEff->GetAmount()); } break; } @@ -636,7 +636,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) { uint8 level = m_caster->getLevel(); uint32 block_value = m_caster->GetShieldBlockValue(uint32(float(level) * 29.5f), uint32(float(level) * 39.5f)); - damage += CalculatePctN(block_value, m_spellInfo->Effects[EFFECT_1].CalcValue()); + damage += CalculatePct(block_value, m_spellInfo->Effects[EFFECT_1].CalcValue()); break; } break; @@ -1436,8 +1436,8 @@ void Spell::EffectPowerBurn(SpellEffIndex effIndex) // burn x% of target's mana, up to maximum of 2x% of caster's mana (Mana Burn) if (m_spellInfo->Id == 8129) { - int32 maxDamage = int32(CalculatePctN(m_caster->GetMaxPower(powerType), damage * 2)); - damage = int32(CalculatePctN(unitTarget->GetMaxPower(powerType), damage)); + int32 maxDamage = int32(CalculatePct(m_caster->GetMaxPower(powerType), damage * 2)); + damage = int32(CalculatePct(unitTarget->GetMaxPower(powerType), damage)); damage = std::min(damage, maxDamage); } @@ -1493,7 +1493,7 @@ void Spell::EffectHeal(SpellEffIndex /*effIndex*/) { if (Player* player = m_caster->ToPlayer()) if (player->HasSkill(SKILL_ENGINEERING)) - AddPctN(addhealth, 25); + AddPct(addhealth, 25); } // Swiftmend - consumes Regrowth or Rejuvenation else if (m_spellInfo->TargetAuraState == AURA_STATE_SWIFTMEND && unitTarget->HasAuraState(AURA_STATE_SWIFTMEND, m_spellInfo, m_caster)) @@ -1552,7 +1552,7 @@ void Spell::EffectHeal(SpellEffIndex /*effIndex*/) for (Unit::AuraEffectList::const_iterator i = Periodic.begin(); i != Periodic.end(); ++i) { if (m_caster->GetGUID() == (*i)->GetCasterGUID()) - AddPctN(addhealth, aurEff->GetAmount()); + AddPct(addhealth, aurEff->GetAmount()); } } } @@ -1876,20 +1876,20 @@ void Spell::EffectEnergize(SpellEffIndex effIndex) case 31930: // Judgements of the Wise case 63375: // Improved Stormstrike case 68082: // Glyph of Seal of Command - damage = int32(CalculatePctN(unitTarget->GetCreateMana(), damage)); + damage = int32(CalculatePct(unitTarget->GetCreateMana(), damage)); break; case 48542: // Revitalize - damage = int32(CalculatePctN(unitTarget->GetMaxPower(power), damage)); + damage = int32(CalculatePct(unitTarget->GetMaxPower(power), damage)); break; case 67490: // Runic Mana Injector (mana gain increased by 25% for engineers - 3.2.0 patch change) { if (Player* player = m_caster->ToPlayer()) if (player->HasSkill(SKILL_ENGINEERING)) - AddPctN(damage, 25); + AddPct(damage, 25); break; } case 71132: // Glyph of Shadow Word: Pain - damage = int32(CalculatePctN(unitTarget->GetCreateMana(), 1)); // set 1 as value, missing in dbc + damage = int32(CalculatePct(unitTarget->GetCreateMana(), 1)); // set 1 as value, missing in dbc break; default: break; @@ -1972,7 +1972,7 @@ void Spell::EffectEnergizePct(SpellEffIndex effIndex) if (maxPower == 0) return; - uint32 gain = CalculatePctN(maxPower, damage); + uint32 gain = CalculatePct(maxPower, damage); m_caster->EnergizeBySpell(unitTarget, m_spellInfo->Id, gain, power); } @@ -3363,7 +3363,7 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex) else if (m_spellInfo->SpellFamilyFlags[0] & 0x00008800 && unitTarget->HasAuraState(AURA_STATE_BLEEDING)) { if (AuraEffect const* rendAndTear = m_caster->GetDummyAuraEffect(SPELLFAMILY_DRUID, 2859, 0)) - AddPctN(totalDamagePercentMod, rendAndTear->GetAmount()); + AddPct(totalDamagePercentMod, rendAndTear->GetAmount()); } break; } @@ -3381,7 +3381,7 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex) { // Glyph of Plague Strike if (AuraEffect const* aurEff = m_caster->GetAuraEffect(58657, EFFECT_0)) - AddPctN(totalDamagePercentMod, aurEff->GetAmount()); + AddPct(totalDamagePercentMod, aurEff->GetAmount()); break; } // Blood Strike @@ -3390,13 +3390,13 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex) float bonusPct = m_spellInfo->Effects[EFFECT_2].CalcValue() * unitTarget->GetDiseasesByCaster(m_caster->GetGUID()) / 2.0f; // Death Knight T8 Melee 4P Bonus if (AuraEffect const* aurEff = m_caster->GetAuraEffect(64736, EFFECT_0)) - AddPctF(bonusPct, aurEff->GetAmount()); - AddPctF(totalDamagePercentMod, bonusPct); + AddPct(bonusPct, aurEff->GetAmount()); + AddPct(totalDamagePercentMod, bonusPct); // Glyph of Blood Strike if (m_caster->GetAuraEffect(59332, EFFECT_0)) if (unitTarget->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED)) - AddPctN(totalDamagePercentMod, 20); + AddPct(totalDamagePercentMod, 20); break; } // Death Strike @@ -3405,7 +3405,7 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex) // Glyph of Death Strike if (AuraEffect const* aurEff = m_caster->GetAuraEffect(59336, EFFECT_0)) if (uint32 runic = std::min(m_caster->GetPower(POWER_RUNIC_POWER), aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue())) - AddPctN(totalDamagePercentMod, runic); + AddPct(totalDamagePercentMod, runic); break; } // Obliterate (12.5% more damage per disease) @@ -3421,14 +3421,14 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex) float bonusPct = m_spellInfo->Effects[EFFECT_2].CalcValue() * unitTarget->GetDiseasesByCaster(m_caster->GetGUID(), consumeDiseases) / 2.0f; // Death Knight T8 Melee 4P Bonus if (AuraEffect const* aurEff = m_caster->GetAuraEffect(64736, EFFECT_0)) - AddPctF(bonusPct, aurEff->GetAmount()); - AddPctF(totalDamagePercentMod, bonusPct); + AddPct(bonusPct, aurEff->GetAmount()); + AddPct(totalDamagePercentMod, bonusPct); break; } // Blood-Caked Strike - Blood-Caked Blade if (m_spellInfo->SpellIconID == 1736) { - AddPctF(totalDamagePercentMod, unitTarget->GetDiseasesByCaster(m_caster->GetGUID()) * 12.5f); + AddPct(totalDamagePercentMod, unitTarget->GetDiseasesByCaster(m_caster->GetGUID()) * 12.5f); break; } // Heart Strike @@ -3437,9 +3437,9 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex) float bonusPct = m_spellInfo->Effects[EFFECT_2].CalcValue() * unitTarget->GetDiseasesByCaster(m_caster->GetGUID()); // Death Knight T8 Melee 4P Bonus if (AuraEffect const* aurEff = m_caster->GetAuraEffect(64736, EFFECT_0)) - AddPctF(bonusPct, aurEff->GetAmount()); + AddPct(bonusPct, aurEff->GetAmount()); - AddPctF(totalDamagePercentMod, bonusPct); + AddPct(totalDamagePercentMod, bonusPct); break; } break; @@ -3461,7 +3461,7 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex) normalized = true; break; case SPELL_EFFECT_WEAPON_PERCENT_DAMAGE: - ApplyPctN(weaponDamagePercentMod, CalculateDamage(j, unitTarget)); + ApplyPct(weaponDamagePercentMod, CalculateDamage(j, unitTarget)); break; default: break; // not weapon damage effect, just skip @@ -4937,7 +4937,7 @@ void Spell::EffectResurrect(SpellEffIndex effIndex) return; uint32 health = target->CountPctFromMaxHealth(damage); - uint32 mana = CalculatePctN(target->GetMaxPower(POWER_MANA), damage); + uint32 mana = CalculatePct(target->GetMaxPower(POWER_MANA), damage); ExecuteLogEffectResurrect(effIndex, target); @@ -5087,7 +5087,7 @@ void Spell::EffectSelfResurrect(SpellEffIndex effIndex) { health = m_caster->CountPctFromMaxHealth(damage); if (m_caster->GetMaxPower(POWER_MANA) > 0) - mana = CalculatePctN(m_caster->GetMaxPower(POWER_MANA), damage); + mana = CalculatePct(m_caster->GetMaxPower(POWER_MANA), damage); } Player* player = m_caster->ToPlayer(); @@ -5404,12 +5404,12 @@ void Spell::EffectDestroyAllTotems(SpellEffIndex /*effIndex*/) if (spellInfo) { mana += spellInfo->ManaCost; - mana += int32(CalculatePctU(m_caster->GetCreateMana(), spellInfo->ManaCostPercentage)); + mana += int32(CalculatePct(m_caster->GetCreateMana(), spellInfo->ManaCostPercentage)); } totem->ToTotem()->UnSummon(); } } - ApplyPctN(mana, damage); + ApplyPct(mana, damage); if (mana) m_caster->CastCustomSpell(m_caster, 39104, &mana, NULL, NULL, true); } diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 0531549cbd3..37f6a4b8640 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -2026,16 +2026,16 @@ uint32 SpellInfo::CalcPowerCost(Unit const* caster, SpellSchoolMask schoolMask) { // health as power used case POWER_HEALTH: - powerCost += int32(CalculatePctU(caster->GetCreateHealth(), ManaCostPercentage)); + powerCost += int32(CalculatePct(caster->GetCreateHealth(), ManaCostPercentage)); break; case POWER_MANA: - powerCost += int32(CalculatePctU(caster->GetCreateMana(), ManaCostPercentage)); + powerCost += int32(CalculatePct(caster->GetCreateMana(), ManaCostPercentage)); break; case POWER_RAGE: case POWER_FOCUS: case POWER_ENERGY: case POWER_HAPPINESS: - powerCost += int32(CalculatePctU(caster->GetMaxPower(Powers(PowerType)), ManaCostPercentage)); + powerCost += int32(CalculatePct(caster->GetMaxPower(Powers(PowerType)), ManaCostPercentage)); break; case POWER_RUNE: case POWER_RUNIC_POWER: -- cgit v1.2.3 From 7831ecdb182b62d84d0c3c31868a29263d13752e Mon Sep 17 00:00:00 2001 From: Spp Date: Tue, 2 Oct 2012 15:06:19 +0200 Subject: Core: "Initial support for C++11 compilers" --- .../game/Battlegrounds/Zones/BattlegroundAB.cpp | 23 ++-- .../game/Battlegrounds/Zones/BattlegroundAB.h | 1 - .../game/Battlegrounds/Zones/BattlegroundAV.cpp | 65 +++++------ .../game/Entities/Creature/CreatureGroups.cpp | 4 +- src/server/game/Entities/GameObject/GameObject.cpp | 16 +-- src/server/game/Entities/Object/Object.cpp | 46 ++++---- src/server/game/Entities/Player/Player.h | 4 +- src/server/game/Entities/Transport/Transport.cpp | 20 ++-- src/server/game/Entities/Unit/Unit.cpp | 4 +- src/server/game/Entities/Vehicle/Vehicle.cpp | 12 +-- src/server/game/Handlers/MiscHandler.cpp | 4 +- .../FleeingMovementGenerator.cpp | 8 +- .../MovementGenerators/RandomMovementGenerator.cpp | 4 +- src/server/game/Spells/Spell.cpp | 6 +- src/server/game/Spells/Spell.h | 4 +- src/server/scripts/Commands/cs_gobject.cpp | 4 +- .../EasternKingdoms/Karazhan/boss_midnight.cpp | 8 +- .../SunwellPlateau/boss_kiljaeden.cpp | 12 +-- .../AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp | 12 +-- .../scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp | 16 +-- .../TempestKeep/botanica/boss_warp_splinter.cpp | 4 +- src/server/scripts/World/npcs_special.cpp | 4 +- src/server/shared/CompilerDefs.h | 10 +- src/server/shared/Dynamic/HashNamespace.h | 119 +++++++++++++++++++++ src/server/shared/Dynamic/LinkedList.h | 16 +-- .../shared/Dynamic/LinkedReference/Reference.h | 13 ++- src/server/shared/Dynamic/ObjectRegistry.h | 3 +- src/server/shared/Dynamic/UnorderedMap.h | 83 +++++++------- src/server/shared/Dynamic/UnorderedSet.h | 66 ++++++++++++ 29 files changed, 394 insertions(+), 197 deletions(-) create mode 100644 src/server/shared/Dynamic/HashNamespace.h create mode 100644 src/server/shared/Dynamic/UnorderedSet.h (limited to 'src/server/game/Spells') diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp index e91c5122604..6de4bc8fbd0 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp @@ -364,6 +364,7 @@ void BattlegroundAB::_NodeOccupied(uint8 node, Team team) if (m_Nodes[node] == GetTeamIndexByTeamId(team) + BG_AB_NODE_TYPE_OCCUPIED && !m_NodeTimers[i]) ++capturedNodes; } + if (capturedNodes >= 5) CastSpellOnTeam(SPELL_AB_QUEST_REWARD_5_BASES, team); if (capturedNodes >= 4) @@ -552,14 +553,14 @@ bool BattlegroundAB::SetupBattleground() { for (int i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i) { - if (!AddObject(BG_AB_OBJECT_BANNER_NEUTRAL + 8*i, BG_AB_OBJECTID_NODE_BANNER_0 + i, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY) - || !AddObject(BG_AB_OBJECT_BANNER_CONT_A + 8*i, BG_AB_OBJECTID_BANNER_CONT_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY) - || !AddObject(BG_AB_OBJECT_BANNER_CONT_H + 8*i, BG_AB_OBJECTID_BANNER_CONT_H, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY) - || !AddObject(BG_AB_OBJECT_BANNER_ALLY + 8*i, BG_AB_OBJECTID_BANNER_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY) - || !AddObject(BG_AB_OBJECT_BANNER_HORDE + 8*i, BG_AB_OBJECTID_BANNER_H, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY) - || !AddObject(BG_AB_OBJECT_AURA_ALLY + 8*i, BG_AB_OBJECTID_AURA_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY) - || !AddObject(BG_AB_OBJECT_AURA_HORDE + 8*i, BG_AB_OBJECTID_AURA_H, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY) - || !AddObject(BG_AB_OBJECT_AURA_CONTESTED + 8*i, BG_AB_OBJECTID_AURA_C, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY) + if (!AddObject(BG_AB_OBJECT_BANNER_NEUTRAL + 8*i, BG_AB_OBJECTID_NODE_BANNER_0 + i, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3]/2), std::cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AB_OBJECT_BANNER_CONT_A + 8*i, BG_AB_OBJECTID_BANNER_CONT_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3]/2), std::cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AB_OBJECT_BANNER_CONT_H + 8*i, BG_AB_OBJECTID_BANNER_CONT_H, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3]/2), std::cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AB_OBJECT_BANNER_ALLY + 8*i, BG_AB_OBJECTID_BANNER_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3]/2), std::cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AB_OBJECT_BANNER_HORDE + 8*i, BG_AB_OBJECTID_BANNER_H, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3]/2), std::cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AB_OBJECT_AURA_ALLY + 8*i, BG_AB_OBJECTID_AURA_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3]/2), std::cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AB_OBJECT_AURA_HORDE + 8*i, BG_AB_OBJECTID_AURA_H, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3]/2), std::cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AB_OBJECT_AURA_CONTESTED + 8*i, BG_AB_OBJECTID_AURA_C, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3]/2), std::cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY) ) { sLog->outError(LOG_FILTER_SQL, "BatteGroundAB: Failed to spawn some object Battleground not created!"); @@ -576,9 +577,9 @@ bool BattlegroundAB::SetupBattleground() //buffs for (int i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i) { - if (!AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i, Buff_Entries[0], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY) - || !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 1, Buff_Entries[1], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY) - || !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 2, Buff_Entries[2], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY) + if (!AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i, Buff_Entries[0], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, std::sin(BG_AB_BuffPositions[i][3]/2), std::cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 1, Buff_Entries[1], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, std::sin(BG_AB_BuffPositions[i][3]/2), std::cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 2, Buff_Entries[2], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, std::sin(BG_AB_BuffPositions[i][3]/2), std::cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY) ) sLog->outError(LOG_FILTER_SQL, "BatteGroundAB: Failed to spawn buff object!"); } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h index 870b3965522..a7ec4ad700f 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h @@ -306,4 +306,3 @@ class BattlegroundAB : public Battleground bool m_TeamScores500Disadvantage[BG_TEAMS_COUNT]; }; #endif - diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp index aeebfb945f9..0ebe6611042 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp @@ -16,11 +16,12 @@ * with this program. If not, see . */ +#include "BattlegroundAV.h" + #include "ObjectMgr.h" #include "WorldPacket.h" #include "Battleground.h" -#include "BattlegroundAV.h" #include "Miscellaneous/Formulas.h" #include "GameObject.h" #include "Miscellaneous/Language.h" @@ -1193,9 +1194,9 @@ bool BattlegroundAV::SetupBattleground() // Create starting objects if ( // alliance gates - !AddObject(BG_AV_OBJECT_DOOR_A, BG_AV_OBJECTID_GATE_A, BG_AV_DoorPositons[0][0], BG_AV_DoorPositons[0][1], BG_AV_DoorPositons[0][2], BG_AV_DoorPositons[0][3], 0, 0, sin(BG_AV_DoorPositons[0][3]/2), cos(BG_AV_DoorPositons[0][3]/2), RESPAWN_IMMEDIATELY) + !AddObject(BG_AV_OBJECT_DOOR_A, BG_AV_OBJECTID_GATE_A, BG_AV_DoorPositons[0][0], BG_AV_DoorPositons[0][1], BG_AV_DoorPositons[0][2], BG_AV_DoorPositons[0][3], 0, 0, std::sin(BG_AV_DoorPositons[0][3]/2), std::cos(BG_AV_DoorPositons[0][3]/2), RESPAWN_IMMEDIATELY) // horde gates - || !AddObject(BG_AV_OBJECT_DOOR_H, BG_AV_OBJECTID_GATE_H, BG_AV_DoorPositons[1][0], BG_AV_DoorPositons[1][1], BG_AV_DoorPositons[1][2], BG_AV_DoorPositons[1][3], 0, 0, sin(BG_AV_DoorPositons[1][3]/2), cos(BG_AV_DoorPositons[1][3]/2), RESPAWN_IMMEDIATELY)) + || !AddObject(BG_AV_OBJECT_DOOR_H, BG_AV_OBJECTID_GATE_H, BG_AV_DoorPositons[1][0], BG_AV_DoorPositons[1][1], BG_AV_DoorPositons[1][2], BG_AV_DoorPositons[1][3], 0, 0, std::sin(BG_AV_DoorPositons[1][3]/2), std::cos(BG_AV_DoorPositons[1][3]/2), RESPAWN_IMMEDIATELY)) { sLog->outError(LOG_FILTER_SQL, "BatteGroundAV: Failed to spawn some object Battleground not created!1"); return false; @@ -1206,14 +1207,14 @@ bool BattlegroundAV::SetupBattleground() { if (i <= BG_AV_NODES_FROSTWOLF_HUT) { - if (!AddObject(i, BG_AV_OBJECTID_BANNER_A_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY) - || !AddObject(i+11, BG_AV_OBJECTID_BANNER_CONT_A_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY) - || !AddObject(i+33, BG_AV_OBJECTID_BANNER_H_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY) - || !AddObject(i+22, BG_AV_OBJECTID_BANNER_CONT_H_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY) + if (!AddObject(i, BG_AV_OBJECTID_BANNER_A_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY) + || !AddObject(i+11, BG_AV_OBJECTID_BANNER_CONT_A_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY) + || !AddObject(i+33, BG_AV_OBJECTID_BANNER_H_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY) + || !AddObject(i+22, BG_AV_OBJECTID_BANNER_CONT_H_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY) //aura - || !AddObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION+i*3, BG_AV_OBJECTID_AURA_N, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY) - || !AddObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+i*3, BG_AV_OBJECTID_AURA_A, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY) - || !AddObject(BG_AV_OBJECT_AURA_H_FIRSTAID_STATION+i*3, BG_AV_OBJECTID_AURA_H, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)) + || !AddObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION+i*3, BG_AV_OBJECTID_AURA_N, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+i*3, BG_AV_OBJECTID_AURA_A, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AV_OBJECT_AURA_H_FIRSTAID_STATION+i*3, BG_AV_OBJECTID_AURA_H, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)) { sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!2"); return false; @@ -1223,12 +1224,12 @@ bool BattlegroundAV::SetupBattleground() { if (i <= BG_AV_NODES_STONEHEART_BUNKER) //alliance towers { - if (!AddObject(i, BG_AV_OBJECTID_BANNER_A, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY) - || !AddObject(i+22, BG_AV_OBJECTID_BANNER_CONT_H, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY) - || !AddObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_A, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY) - || !AddObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_N, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY) - || !AddObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_A, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY) - || !AddObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_PH, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)) + if (!AddObject(i, BG_AV_OBJECTID_BANNER_A, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY) + || !AddObject(i+22, BG_AV_OBJECTID_BANNER_CONT_H, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_A, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_N, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_A, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_PH, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)) { sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!3"); return false; @@ -1236,12 +1237,12 @@ bool BattlegroundAV::SetupBattleground() } else //horde towers { - if (!AddObject(i+7, BG_AV_OBJECTID_BANNER_CONT_A, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY) - || !AddObject(i+29, BG_AV_OBJECTID_BANNER_H, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY) - || !AddObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_N, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY) - || !AddObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_H, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY) - || !AddObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_PA, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY) - || !AddObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_H, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)) + if (!AddObject(i+7, BG_AV_OBJECTID_BANNER_CONT_A, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY) + || !AddObject(i+29, BG_AV_OBJECTID_BANNER_H, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_N, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_H, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_PA, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_H, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)) { sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!4"); return false; @@ -1249,7 +1250,7 @@ bool BattlegroundAV::SetupBattleground() } for (uint8 j=0; j <= 9; j++) //burning aura { - if (!AddObject(BG_AV_OBJECT_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j, BG_AV_OBJECTID_FIRE, BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][0], BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][1], BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][2], BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3]/2), RESPAWN_ONE_DAY)) + if (!AddObject(BG_AV_OBJECT_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j, BG_AV_OBJECTID_FIRE, BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][0], BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][1], BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][2], BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3], 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3]/2), std::cos(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3]/2), RESPAWN_ONE_DAY)) { sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!5.%i", i); return false; @@ -1263,7 +1264,7 @@ bool BattlegroundAV::SetupBattleground() { if (j<5) { - if (!AddObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE+(i*10)+j, BG_AV_OBJECTID_SMOKE, BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][0], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][1], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][2], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), RESPAWN_ONE_DAY)) + if (!AddObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE+(i*10)+j, BG_AV_OBJECTID_SMOKE, BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][0], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][1], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][2], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3], 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), std::cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), RESPAWN_ONE_DAY)) { sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!6.%i", i); return false; @@ -1271,7 +1272,7 @@ bool BattlegroundAV::SetupBattleground() } else { - if (!AddObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE+(i*10)+j, BG_AV_OBJECTID_FIRE, BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][0], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][1], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][2], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), RESPAWN_ONE_DAY)) + if (!AddObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE+(i*10)+j, BG_AV_OBJECTID_FIRE, BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][0], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][1], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][2], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3], 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), std::cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), RESPAWN_ONE_DAY)) { sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!7.%i", i); return false; @@ -1281,7 +1282,7 @@ bool BattlegroundAV::SetupBattleground() } for (uint16 i= 0; i <= (BG_AV_OBJECT_MINE_SUPPLY_N_MAX-BG_AV_OBJECT_MINE_SUPPLY_N_MIN); i++) { - if (!AddObject(BG_AV_OBJECT_MINE_SUPPLY_N_MIN+i, BG_AV_OBJECTID_MINE_N, BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][0], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][1], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][2], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3]/2), RESPAWN_ONE_DAY)) + if (!AddObject(BG_AV_OBJECT_MINE_SUPPLY_N_MIN+i, BG_AV_OBJECTID_MINE_N, BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][0], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][1], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][2], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3], 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3]/2), std::cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3]/2), RESPAWN_ONE_DAY)) { sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some mine supplies Battleground not created!7.5.%i", i); return false; @@ -1289,24 +1290,24 @@ bool BattlegroundAV::SetupBattleground() } for (uint16 i= 0; i <= (BG_AV_OBJECT_MINE_SUPPLY_S_MAX-BG_AV_OBJECT_MINE_SUPPLY_S_MIN); i++) { - if (!AddObject(BG_AV_OBJECT_MINE_SUPPLY_S_MIN+i, BG_AV_OBJECTID_MINE_S, BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][0], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][1], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][2], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3]/2), RESPAWN_ONE_DAY)) + if (!AddObject(BG_AV_OBJECT_MINE_SUPPLY_S_MIN+i, BG_AV_OBJECTID_MINE_S, BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][0], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][1], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][2], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3], 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3]/2), std::cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3]/2), RESPAWN_ONE_DAY)) { sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some mine supplies Battleground not created!7.6.%i", i); return false; } } - if (!AddObject(BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE, BG_AV_OBJECTID_BANNER_SNOWFALL_N, BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][0], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][1], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][2], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3], 0, 0, sin(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2), cos(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2), RESPAWN_ONE_DAY)) + if (!AddObject(BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE, BG_AV_OBJECTID_BANNER_SNOWFALL_N, BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][0], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][1], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][2], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3], 0, 0, std::sin(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2), std::cos(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2), RESPAWN_ONE_DAY)) { sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!8"); return false; } for (uint8 i = 0; i < 4; i++) { - if (!AddObject(BG_AV_OBJECT_SNOW_EYECANDY_A+i, BG_AV_OBJECTID_SNOWFALL_CANDY_A, BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY) - || !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_PA+i, BG_AV_OBJECTID_SNOWFALL_CANDY_PA, BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY) - || !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_H+i, BG_AV_OBJECTID_SNOWFALL_CANDY_H, BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY) - || !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_PH+i, BG_AV_OBJECTID_SNOWFALL_CANDY_PH, BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY)) + if (!AddObject(BG_AV_OBJECT_SNOW_EYECANDY_A+i, BG_AV_OBJECTID_SNOWFALL_CANDY_A, BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), std::cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_PA+i, BG_AV_OBJECTID_SNOWFALL_CANDY_PA, BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), std::cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_H+i, BG_AV_OBJECTID_SNOWFALL_CANDY_H, BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), std::cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_PH+i, BG_AV_OBJECTID_SNOWFALL_CANDY_PH, BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), std::cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY)) { sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!9.%i", i); return false; diff --git a/src/server/game/Entities/Creature/CreatureGroups.cpp b/src/server/game/Entities/Creature/CreatureGroups.cpp index 8823a788555..c9d1944af09 100755 --- a/src/server/game/Entities/Creature/CreatureGroups.cpp +++ b/src/server/game/Entities/Creature/CreatureGroups.cpp @@ -225,8 +225,8 @@ void CreatureGroup::LeaderMoveTo(float x, float y, float z) float angle = itr->second->follow_angle; float dist = itr->second->follow_dist; - float dx = x + cos(angle + pathangle) * dist; - float dy = y + sin(angle + pathangle) * dist; + float dx = x + std::cos(angle + pathangle) * dist; + float dy = y + std::sin(angle + pathangle) * dist; float dz = z; Trinity::NormalizeMapCoord(dx); diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index c28ff21bfa5..c4d42f7a537 100755 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -1153,8 +1153,8 @@ void GameObject::Use(Unit* user) // the distance between this slot and the center of the go - imagine a 1D space float relativeDistance = (info->size*itr->first)-(info->size*(info->chair.slots-1)/2.0f); - float x_i = GetPositionX() + relativeDistance * cos(orthogonalOrientation); - float y_i = GetPositionY() + relativeDistance * sin(orthogonalOrientation); + float x_i = GetPositionX() + relativeDistance * std::cos(orthogonalOrientation); + float y_i = GetPositionY() + relativeDistance * std::sin(orthogonalOrientation); if (itr->second) { @@ -1701,8 +1701,8 @@ bool GameObject::IsInRange(float x, float y, float z, float radius) const if (!info) return IsWithinDist3d(x, y, z, radius); - float sinA = sin(GetOrientation()); - float cosA = cos(GetOrientation()); + float sinA = std::sin(GetOrientation()); + float cosA = std::cos(GetOrientation()); float dx = x - GetPositionX(); float dy = y - GetPositionY(); float dz = z - GetPositionZ(); @@ -1751,17 +1751,17 @@ void GameObject::UpdateRotationFields(float rotation2 /*=0.0f*/, float rotation3 { static double const atan_pow = atan(pow(2.0f, -20.0f)); - double f_rot1 = sin(GetOrientation() / 2.0f); - double f_rot2 = cos(GetOrientation() / 2.0f); + double f_rot1 = std::sin(GetOrientation() / 2.0f); + double f_rot2 = std::cos(GetOrientation() / 2.0f); int64 i_rot1 = int64(f_rot1 / atan_pow *(f_rot2 >= 0 ? 1.0f : -1.0f)); int64 rotation = (i_rot1 << 43 >> 43) & 0x00000000001FFFFF; - //float f_rot2 = sin(0.0f / 2.0f); + //float f_rot2 = std::sin(0.0f / 2.0f); //int64 i_rot2 = f_rot2 / atan(pow(2.0f, -20.0f)); //rotation |= (((i_rot2 << 22) >> 32) >> 11) & 0x000003FFFFE00000; - //float f_rot3 = sin(0.0f / 2.0f); + //float f_rot3 = std::sin(0.0f / 2.0f); //int64 i_rot3 = f_rot3 / atan(pow(2.0f, -21.0f)); //rotation |= (i_rot3 >> 42) & 0x7FFFFC0000000000; diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 9a7ca667b19..8647e6ddb4f 100755 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -1511,8 +1511,8 @@ bool WorldObject::IsInRange3d(float x, float y, float z, float minRange, float m void Position::RelocateOffset(const Position & offset) { - m_positionX = GetPositionX() + (offset.GetPositionX() * cos(GetOrientation()) + offset.GetPositionY() * sin(GetOrientation() + M_PI)); - m_positionY = GetPositionY() + (offset.GetPositionY() * cos(GetOrientation()) + offset.GetPositionX() * sin(GetOrientation())); + m_positionX = GetPositionX() + (offset.GetPositionX() * std::cos(GetOrientation()) + offset.GetPositionY() * std::sin(GetOrientation() + M_PI)); + m_positionY = GetPositionY() + (offset.GetPositionY() * std::cos(GetOrientation()) + offset.GetPositionX() * std::sin(GetOrientation())); m_positionZ = GetPositionZ() + offset.GetPositionZ(); m_orientation = GetOrientation() + offset.GetOrientation(); } @@ -1522,8 +1522,8 @@ void Position::GetPositionOffsetTo(const Position & endPos, Position & retOffset float dx = endPos.GetPositionX() - GetPositionX(); float dy = endPos.GetPositionY() - GetPositionY(); - retOffset.m_positionX = dx * cos(GetOrientation()) + dy * sin(GetOrientation()); - retOffset.m_positionY = dy * cos(GetOrientation()) - dx * sin(GetOrientation()); + retOffset.m_positionX = dx * std::cos(GetOrientation()) + dy * std::sin(GetOrientation()); + retOffset.m_positionY = dy * std::cos(GetOrientation()) - dx * std::sin(GetOrientation()); retOffset.m_positionZ = endPos.GetPositionZ() - GetPositionZ(); retOffset.m_orientation = endPos.GetOrientation() - GetOrientation(); } @@ -1555,8 +1555,8 @@ void Position::GetSinCos(const float x, const float y, float &vsin, float &vcos) if (fabs(dx) < 0.001f && fabs(dy) < 0.001f) { float angle = (float)rand_norm()*static_cast(2*M_PI); - vcos = cos(angle); - vsin = sin(angle); + vcos = std::cos(angle); + vsin = std::sin(angle); } else { @@ -1605,7 +1605,7 @@ bool WorldObject::IsInBetween(const WorldObject* obj1, const WorldObject* obj2, float angle = obj1->GetAngle(obj2); // not using sqrt() for performance - return (size * size) >= GetExactDist2dSq(obj1->GetPositionX() + cos(angle) * dist, obj1->GetPositionY() + sin(angle) * dist); + return (size * size) >= GetExactDist2dSq(obj1->GetPositionX() + std::cos(angle) * dist, obj1->GetPositionY() + std::sin(angle) * dist); } bool WorldObject::isInFront(WorldObject const* target, float arc) const @@ -1630,8 +1630,8 @@ void WorldObject::GetRandomPoint(const Position &pos, float distance, float &ran float angle = (float)rand_norm()*static_cast(2*M_PI); float new_dist = (float)rand_norm()*static_cast(distance); - rand_x = pos.m_positionX + new_dist * cos(angle); - rand_y = pos.m_positionY + new_dist * sin(angle); + rand_x = pos.m_positionX + new_dist * std::cos(angle); + rand_y = pos.m_positionY + new_dist * std::sin(angle); rand_z = pos.m_positionZ; Trinity::NormalizeMapCoord(rand_x); @@ -2649,8 +2649,8 @@ namespace Trinity void WorldObject::GetNearPoint2D(float &x, float &y, float distance2d, float absAngle) const { - x = GetPositionX() + (GetObjectSize() + distance2d) * cos(absAngle); - y = GetPositionY() + (GetObjectSize() + distance2d) * sin(absAngle); + x = GetPositionX() + (GetObjectSize() + distance2d) * std::cos(absAngle); + y = GetPositionY() + (GetObjectSize() + distance2d) * std::sin(absAngle); Trinity::NormalizeMapCoord(x); Trinity::NormalizeMapCoord(y); @@ -2785,8 +2785,8 @@ void WorldObject::MovePosition(Position &pos, float dist, float angle) { angle += m_orientation; float destx, desty, destz, ground, floor; - destx = pos.m_positionX + dist * cos(angle); - desty = pos.m_positionY + dist * sin(angle); + destx = pos.m_positionX + dist * std::cos(angle); + desty = pos.m_positionY + dist * std::sin(angle); // Prevent invalid coordinates here, position is unchanged if (!Trinity::IsValidMapCoord(destx, desty)) @@ -2806,8 +2806,8 @@ void WorldObject::MovePosition(Position &pos, float dist, float angle) // do not allow too big z changes if (fabs(pos.m_positionZ - destz) > 6) { - destx -= step * cos(angle); - desty -= step * sin(angle); + destx -= step * std::cos(angle); + desty -= step * std::sin(angle); ground = GetMap()->GetHeight(GetPhaseMask(), destx, desty, MAX_HEIGHT, true); floor = GetMap()->GetHeight(GetPhaseMask(), destx, desty, pos.m_positionZ, true); destz = fabs(ground - pos.m_positionZ) <= fabs(floor - pos.m_positionZ) ? ground : floor; @@ -2831,8 +2831,8 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float angle += m_orientation; float destx, desty, destz, ground, floor; pos.m_positionZ += 2.0f; - destx = pos.m_positionX + dist * cos(angle); - desty = pos.m_positionY + dist * sin(angle); + destx = pos.m_positionX + dist * std::cos(angle); + desty = pos.m_positionY + dist * std::sin(angle); // Prevent invalid coordinates here, position is unchanged if (!Trinity::IsValidMapCoord(destx, desty)) @@ -2851,8 +2851,8 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float if (col) { // move back a bit - destx -= CONTACT_DISTANCE * cos(angle); - desty -= CONTACT_DISTANCE * sin(angle); + destx -= CONTACT_DISTANCE * std::cos(angle); + desty -= CONTACT_DISTANCE * std::sin(angle); dist = sqrt((pos.m_positionX - destx)*(pos.m_positionX - destx) + (pos.m_positionY - desty)*(pos.m_positionY - desty)); } @@ -2862,8 +2862,8 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float // Collided with a gameobject if (col) { - destx -= CONTACT_DISTANCE * cos(angle); - desty -= CONTACT_DISTANCE * sin(angle); + destx -= CONTACT_DISTANCE * std::cos(angle); + desty -= CONTACT_DISTANCE * std::sin(angle); dist = sqrt((pos.m_positionX - destx)*(pos.m_positionX - destx) + (pos.m_positionY - desty)*(pos.m_positionY - desty)); } @@ -2874,8 +2874,8 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float // do not allow too big z changes if (fabs(pos.m_positionZ - destz) > 6) { - destx -= step * cos(angle); - desty -= step * sin(angle); + destx -= step * std::cos(angle); + desty -= step * std::sin(angle); ground = GetMap()->GetHeight(GetPhaseMask(), destx, desty, MAX_HEIGHT, true); floor = GetMap()->GetHeight(GetPhaseMask(), destx, desty, pos.m_positionZ, true); destz = fabs(ground - pos.m_positionZ) <= fabs(floor - pos.m_positionZ) ? ground : floor; diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 7e137018ec2..5670ca05a85 100755 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -34,10 +34,8 @@ #include "QuestDef.h" #include "ReputationMgr.h" #include "Unit.h" -#include "Util.h" // for Tokenizer typedef +#include "Util.h" // for Tokens typedef #include "WorldSession.h" - -// for template #include "SpellMgr.h" #include diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp index 558fdd72a95..e7084353491 100755 --- a/src/server/game/Entities/Transport/Transport.cpp +++ b/src/server/game/Entities/Transport/Transport.cpp @@ -646,8 +646,8 @@ uint32 Transport::AddNPCPassenger(uint32 tguid, uint32 entry, float x, float y, creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, anim); creature->Relocate( - GetPositionX() + (x * cos(GetOrientation()) + y * sin(GetOrientation() + float(M_PI))), - GetPositionY() + (y * cos(GetOrientation()) + x * sin(GetOrientation())), + GetPositionX() + (x * std::cos(GetOrientation()) + y * std::sin(GetOrientation() + float(M_PI))), + GetPositionY() + (y * std::cos(GetOrientation()) + x * std::sin(GetOrientation())), z + GetPositionZ(), o + GetOrientation()); @@ -680,8 +680,8 @@ uint32 Transport::AddNPCPassenger(uint32 tguid, uint32 entry, float x, float y, void Transport::UpdatePosition(MovementInfo* mi) { float transport_o = mi->pos.m_orientation - mi->t_pos.m_orientation; - float transport_x = mi->pos.m_positionX - (mi->t_pos.m_positionX * cos(transport_o) - mi->t_pos.m_positionY*sin(transport_o)); - float transport_y = mi->pos.m_positionY - (mi->t_pos.m_positionY * cos(transport_o) + mi->t_pos.m_positionX*sin(transport_o)); + float transport_x = mi->pos.m_positionX - (mi->t_pos.m_positionX * std::cos(transport_o) - mi->t_pos.m_positionY* std::sin(transport_o)); + float transport_y = mi->pos.m_positionY - (mi->t_pos.m_positionY * std::cos(transport_o) + mi->t_pos.m_positionX* std::sin(transport_o)); float transport_z = mi->pos.m_positionZ - mi->t_pos.m_positionZ; Relocate(transport_x, transport_y, transport_z, transport_o); @@ -708,8 +708,8 @@ void Transport::CalculatePassengerPosition(float& x, float& y, float& z, float& { float inx = x, iny = y, inz = z, ino = o; o = GetOrientation() + ino; - x = GetPositionX() + inx * cos(GetOrientation()) - iny * sin(GetOrientation()); - y = GetPositionY() + iny * cos(GetOrientation()) + inx * sin(GetOrientation()); + x = GetPositionX() + inx * std::cos(GetOrientation()) - iny * std::sin(GetOrientation()); + y = GetPositionY() + iny * std::cos(GetOrientation()) + inx * std::sin(GetOrientation()); z = GetPositionZ() + inz; } @@ -717,9 +717,9 @@ void Transport::CalculatePassengerOffset(float& x, float& y, float& z, float& o) { o -= GetOrientation(); z -= GetPositionZ(); - y -= GetPositionY(); // y = searchedY * cos(o) + searchedX * sin(o) - x -= GetPositionX(); // x = searchedX * cos(o) + searchedY * sin(o + pi) + y -= GetPositionY(); // y = searchedY * std::cos(o) + searchedX * std::sin(o) + x -= GetPositionX(); // x = searchedX * std::cos(o) + searchedY * std::sin(o + pi) float inx = x, iny = y; - y = (iny - inx * tan(GetOrientation())) / (cos(GetOrientation()) + sin(GetOrientation()) * tan(GetOrientation())); - x = (inx + iny * tan(GetOrientation())) / (cos(GetOrientation()) + sin(GetOrientation()) * tan(GetOrientation())); + y = (iny - inx * tan(GetOrientation())) / (cos(GetOrientation()) + std::sin(GetOrientation()) * tan(GetOrientation())); + x = (inx + iny * tan(GetOrientation())) / (cos(GetOrientation()) + std::sin(GetOrientation()) * tan(GetOrientation())); } diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index e530277b106..1c0501d081f 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -16985,8 +16985,8 @@ void Unit::JumpTo(float speedXY, float speedZ, bool forward) GetMotionMaster()->MoveJumpTo(angle, speedXY, speedZ); else { - float vcos = cos(angle+GetOrientation()); - float vsin = sin(angle+GetOrientation()); + float vcos = std::cos(angle+GetOrientation()); + float vsin = std::sin(angle+GetOrientation()); WorldPacket data(SMSG_MOVE_KNOCK_BACK, (8+4+4+4+4+4)); data.append(GetPackGUID()); diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp index ef4ed1a7f81..a9cd1bc3824 100755 --- a/src/server/game/Entities/Vehicle/Vehicle.cpp +++ b/src/server/game/Entities/Vehicle/Vehicle.cpp @@ -517,8 +517,8 @@ void Vehicle::CalculatePassengerPosition(float& x, float& y, float& z, float& o) { float inx = x, iny = y, inz = z, ino = o; o = GetBase()->GetOrientation() + ino; - x = GetBase()->GetPositionX() + inx * cos(GetBase()->GetOrientation()) - iny * sin(GetBase()->GetOrientation()); - y = GetBase()->GetPositionY() + iny * cos(GetBase()->GetOrientation()) + inx * sin(GetBase()->GetOrientation()); + x = GetBase()->GetPositionX() + inx * std::cos(GetBase()->GetOrientation()) - iny * std::sin(GetBase()->GetOrientation()); + y = GetBase()->GetPositionY() + iny * std::cos(GetBase()->GetOrientation()) + inx * std::sin(GetBase()->GetOrientation()); z = GetBase()->GetPositionZ() + inz; } @@ -526,9 +526,9 @@ void Vehicle::CalculatePassengerOffset(float& x, float& y, float& z, float& o) { o -= GetBase()->GetOrientation(); z -= GetBase()->GetPositionZ(); - y -= GetBase()->GetPositionY(); // y = searchedY * cos(o) + searchedX * sin(o) - x -= GetBase()->GetPositionX(); // x = searchedX * cos(o) + searchedY * sin(o + pi) + y -= GetBase()->GetPositionY(); // y = searchedY * std::cos(o) + searchedX * std::sin(o) + x -= GetBase()->GetPositionX(); // x = searchedX * std::cos(o) + searchedY * std::sin(o + pi) float inx = x, iny = y; - y = (iny - inx * tan(GetBase()->GetOrientation())) / (cos(GetBase()->GetOrientation()) + sin(GetBase()->GetOrientation()) * tan(GetBase()->GetOrientation())); - x = (inx + iny * tan(GetBase()->GetOrientation())) / (cos(GetBase()->GetOrientation()) + sin(GetBase()->GetOrientation()) * tan(GetBase()->GetOrientation())); + y = (iny - inx * tan(GetBase()->GetOrientation())) / (cos(GetBase()->GetOrientation()) + std::sin(GetBase()->GetOrientation()) * tan(GetBase()->GetOrientation())); + x = (inx + iny * tan(GetBase()->GetOrientation())) / (cos(GetBase()->GetOrientation()) + std::sin(GetBase()->GetOrientation()) * tan(GetBase()->GetOrientation())); } diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp index 1da44882ea9..e6e32e81e51 100755 --- a/src/server/game/Handlers/MiscHandler.cpp +++ b/src/server/game/Handlers/MiscHandler.cpp @@ -862,8 +862,8 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data) // 2PI = 360°, keep in mind that ingame orientation is counter-clockwise double rotation = 2 * M_PI - atEntry->box_orientation; - double sinVal = sin(rotation); - double cosVal = cos(rotation); + double sinVal = std::sin(rotation); + double cosVal = std::cos(rotation); float playerBoxDistX = player->GetPositionX() - atEntry->x; float playerBoxDistY = player->GetPositionY() - atEntry->y; diff --git a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp index 56818e95a2b..6e0c62107ff 100755 --- a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp @@ -146,8 +146,8 @@ bool FleeingMovementGenerator::_getPoint(T &owner, float &x, float &y, float break; } - temp_x = x + distance * cos(angle); - temp_y = y + distance * sin(angle); + temp_x = x + distance * std::cos(angle); + temp_y = y + distance * std::sin(angle); Trinity::NormalizeMapCoord(temp_x); Trinity::NormalizeMapCoord(temp_y); if (owner.IsWithinLOS(temp_x, temp_y, z)) @@ -172,8 +172,8 @@ bool FleeingMovementGenerator::_getPoint(T &owner, float &x, float &y, float if (!(new_z - z) || distance / fabs(new_z - z) > 1.0f) { - float new_z_left = _map->GetHeight(owner.GetPhaseMask(), temp_x + 1.0f*cos(angle+static_cast(M_PI/2)),temp_y + 1.0f*sin(angle+static_cast(M_PI/2)),z,true); - float new_z_right = _map->GetHeight(owner.GetPhaseMask(), temp_x + 1.0f*cos(angle-static_cast(M_PI/2)),temp_y + 1.0f*sin(angle-static_cast(M_PI/2)),z,true); + float new_z_left = _map->GetHeight(owner.GetPhaseMask(), temp_x + 1.0f* std::cos(angle+static_cast(M_PI/2)),temp_y + 1.0f* std::sin(angle+static_cast(M_PI/2)),z,true); + float new_z_right = _map->GetHeight(owner.GetPhaseMask(), temp_x + 1.0f* std::cos(angle-static_cast(M_PI/2)),temp_y + 1.0f* std::sin(angle-static_cast(M_PI/2)),z,true); if (fabs(new_z_left - new_z) < 1.2f && fabs(new_z_right - new_z) < 1.2f) { x = temp_x; diff --git a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp index 84cd9e88295..72725570826 100755 --- a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp @@ -46,8 +46,8 @@ void RandomMovementGenerator::_setRandomLocation(Creature& creature) const float angle = float(rand_norm()) * static_cast(M_PI*2.0f); const float range = float(rand_norm()) * wander_distance; - const float distanceX = range * cos(angle); - const float distanceY = range * sin(angle); + const float distanceX = range * std::cos(angle); + const float distanceY = range * std::sin(angle); destX = respX + distanceX; destY = respY + distanceY; diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 0564aa50273..51fbd24a3e0 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -1651,7 +1651,7 @@ void Spell::SelectImplicitTrajTargets() const float size = std::max((*itr)->GetObjectSize() * 0.7f, 1.0f); // 1/sqrt(3) // TODO: all calculation should be based on src instead of m_caster - const float objDist2d = m_targets.GetSrcPos()->GetExactDist2d(*itr) * cos(m_targets.GetSrcPos()->GetRelativeAngle(*itr)); + const float objDist2d = m_targets.GetSrcPos()->GetExactDist2d(*itr) * std::cos(m_targets.GetSrcPos()->GetRelativeAngle(*itr)); const float dz = (*itr)->GetPositionZ() - m_targets.GetSrcPos()->m_positionZ; DEBUG_TRAJ(sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell::SelectTrajTargets: check %u, dist between %f %f, height between %f %f.", (*itr)->GetEntry(), objDist2d - size, objDist2d + size, dz - size, dz + size);) @@ -1719,8 +1719,8 @@ void Spell::SelectImplicitTrajTargets() if (m_targets.GetSrcPos()->GetExactDist2d(m_targets.GetDstPos()) > bestDist) { - float x = m_targets.GetSrcPos()->m_positionX + cos(m_caster->GetOrientation()) * bestDist; - float y = m_targets.GetSrcPos()->m_positionY + sin(m_caster->GetOrientation()) * bestDist; + float x = m_targets.GetSrcPos()->m_positionX + std::cos(m_caster->GetOrientation()) * bestDist; + float y = m_targets.GetSrcPos()->m_positionY + std::sin(m_caster->GetOrientation()) * bestDist; float z = m_targets.GetSrcPos()->m_positionZ + bestDist * (a * bestDist + b); if (itr != targets.end()) diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h index d2bdf4b8970..5de81b6bd88 100755 --- a/src/server/game/Spells/Spell.h +++ b/src/server/game/Spells/Spell.h @@ -154,8 +154,8 @@ class SpellCastTargets void SetSpeed(float speed) { m_speed = speed; } float GetDist2d() const { return m_src._position.GetExactDist2d(&m_dst._position); } - float GetSpeedXY() const { return m_speed * cos(m_elevation); } - float GetSpeedZ() const { return m_speed * sin(m_elevation); } + float GetSpeedXY() const { return m_speed * std::cos(m_elevation); } + float GetSpeedZ() const { return m_speed * std::sin(m_elevation); } void Update(Unit* caster); void OutDebug() const; diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp index 167c56c20a2..6803354d29b 100644 --- a/src/server/scripts/Commands/cs_gobject.cpp +++ b/src/server/scripts/Commands/cs_gobject.cpp @@ -201,8 +201,8 @@ public: float z = player->GetPositionZ(); float ang = player->GetOrientation(); - float rot2 = sin(ang/2); - float rot3 = cos(ang/2); + float rot2 = std::sin(ang/2); + float rot3 = std::cos(ang/2); uint32 objectId = atoi(id); diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp index 08aad90f588..ea9cfe5c3c1 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp @@ -210,16 +210,16 @@ public: pAttumen->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); float angle = me->GetAngle(pAttumen); float distance = me->GetDistance2d(pAttumen); - float newX = me->GetPositionX() + cos(angle)*(distance/2); - float newY = me->GetPositionY() + sin(angle)*(distance/2); + float newX = me->GetPositionX() + std::cos(angle)*(distance/2); + float newY = me->GetPositionY() + std::sin(angle)*(distance/2); float newZ = 50; //me->Relocate(newX, newY, newZ, angle); //me->SendMonsterMove(newX, newY, newZ, 0, true, 1000); me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MovePoint(0, newX, newY, newZ); distance += 10; - newX = me->GetPositionX() + cos(angle)*(distance/2); - newY = me->GetPositionY() + sin(angle)*(distance/2); + newX = me->GetPositionX() + std::cos(angle)*(distance/2); + newY = me->GetPositionY() + std::sin(angle)*(distance/2); pAttumen->GetMotionMaster()->Clear(); pAttumen->GetMotionMaster()->MovePoint(0, newX, newY, newZ); //pAttumen->Relocate(newX, newY, newZ, -angle); diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp index 167f040bbc4..e368124abaf 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp @@ -774,8 +774,8 @@ public: for (uint8 i = 1; i < Phase; ++i) { float sx, sy; - sx = ShieldOrbLocations[0][0] + sin(ShieldOrbLocations[i][0]); - sy = ShieldOrbLocations[0][1] + sin(ShieldOrbLocations[i][1]); + sx = ShieldOrbLocations[0][0] + std::sin(ShieldOrbLocations[i][0]); + sy = ShieldOrbLocations[0][1] + std::sin(ShieldOrbLocations[i][1]); me->SummonCreature(CREATURE_SHIELD_ORB, sx, sy, SHIELD_ORB_Z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45000); } Timer[TIMER_SUMMON_SHILEDORB] = urand(30000, 60000); // 30-60seconds cooldown @@ -1207,13 +1207,13 @@ public: { if (bClockwise) { - y = my - r * sin(c); - x = mx - r * cos(c); + y = my - r * std::sin(c); + x = mx - r * std::cos(c); } else { - y = my + r * sin(c); - x = mx + r * cos(c); + y = my + r * std::sin(c); + x = mx + r * std::cos(c); } bPointReached = false; uiCheckTimer = 1000; diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp index f8e2fc0f99f..4729f68680e 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp @@ -140,8 +140,8 @@ public: { float angle, x, y; angle = pSpheres[0]->GetAngle(pSphereTarget); - x = pSpheres[0]->GetPositionX() + DATA_SPHERE_DISTANCE * cos(angle); - y = pSpheres[0]->GetPositionY() + DATA_SPHERE_DISTANCE * sin(angle); + x = pSpheres[0]->GetPositionX() + DATA_SPHERE_DISTANCE * std::cos(angle); + y = pSpheres[0]->GetPositionY() + DATA_SPHERE_DISTANCE * std::sin(angle); pSpheres[0]->GetMotionMaster()->MovePoint(0, x, y, pSpheres[0]->GetPositionZ()); } if (IsHeroic()) @@ -154,12 +154,12 @@ public: { float angle, x, y; angle = pSpheres[1]->GetAngle(pSphereTarget) + DATA_SPHERE_ANGLE_OFFSET; - x = pSpheres[1]->GetPositionX() + DATA_SPHERE_DISTANCE/2 * cos(angle); - y = pSpheres[1]->GetPositionY() + DATA_SPHERE_DISTANCE/2 * sin(angle); + x = pSpheres[1]->GetPositionX() + DATA_SPHERE_DISTANCE/2 * std::cos(angle); + y = pSpheres[1]->GetPositionY() + DATA_SPHERE_DISTANCE/2 * std::sin(angle); pSpheres[1]->GetMotionMaster()->MovePoint(0, x, y, pSpheres[1]->GetPositionZ()); angle = pSpheres[2]->GetAngle(pSphereTarget) - DATA_SPHERE_ANGLE_OFFSET; - x = pSpheres[2]->GetPositionX() + DATA_SPHERE_DISTANCE/2 * cos(angle); - y = pSpheres[2]->GetPositionY() + DATA_SPHERE_DISTANCE/2 * sin(angle); + x = pSpheres[2]->GetPositionX() + DATA_SPHERE_DISTANCE/2 * std::cos(angle); + y = pSpheres[2]->GetPositionY() + DATA_SPHERE_DISTANCE/2 * std::sin(angle); pSpheres[2]->GetMotionMaster()->MovePoint(0, x, y, pSpheres[2]->GetPositionZ()); } } diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp index 9f9223f0161..eb0b3692f01 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp @@ -129,14 +129,14 @@ public: { if (uiCrystalSpikesTimer2 <= diff) { - fSpikeXY[0][0] = fBaseX+(SPIKE_DISTANCE*uiCrystalSpikesCount*cos(fBaseO)); - fSpikeXY[0][1] = fBaseY+(SPIKE_DISTANCE*uiCrystalSpikesCount*sin(fBaseO)); - fSpikeXY[1][0] = fBaseX-(SPIKE_DISTANCE*uiCrystalSpikesCount*cos(fBaseO)); - fSpikeXY[1][1] = fBaseY-(SPIKE_DISTANCE*uiCrystalSpikesCount*sin(fBaseO)); - fSpikeXY[2][0] = fBaseX+(SPIKE_DISTANCE*uiCrystalSpikesCount*cos(fBaseO-(M_PI/2))); - fSpikeXY[2][1] = fBaseY+(SPIKE_DISTANCE*uiCrystalSpikesCount*sin(fBaseO-(M_PI/2))); - fSpikeXY[3][0] = fBaseX-(SPIKE_DISTANCE*uiCrystalSpikesCount*cos(fBaseO-(M_PI/2))); - fSpikeXY[3][1] = fBaseY-(SPIKE_DISTANCE*uiCrystalSpikesCount*sin(fBaseO-(M_PI/2))); + fSpikeXY[0][0] = fBaseX+(SPIKE_DISTANCE*uiCrystalSpikesCount* std::cos(fBaseO)); + fSpikeXY[0][1] = fBaseY+(SPIKE_DISTANCE*uiCrystalSpikesCount* std::sin(fBaseO)); + fSpikeXY[1][0] = fBaseX-(SPIKE_DISTANCE*uiCrystalSpikesCount* std::cos(fBaseO)); + fSpikeXY[1][1] = fBaseY-(SPIKE_DISTANCE*uiCrystalSpikesCount* std::sin(fBaseO)); + fSpikeXY[2][0] = fBaseX+(SPIKE_DISTANCE*uiCrystalSpikesCount* std::cos(fBaseO-(M_PI/2))); + fSpikeXY[2][1] = fBaseY+(SPIKE_DISTANCE*uiCrystalSpikesCount* std::sin(fBaseO-(M_PI/2))); + fSpikeXY[3][0] = fBaseX-(SPIKE_DISTANCE*uiCrystalSpikesCount* std::cos(fBaseO-(M_PI/2))); + fSpikeXY[3][1] = fBaseY-(SPIKE_DISTANCE*uiCrystalSpikesCount* std::sin(fBaseO-(M_PI/2))); for (uint8 i = 0; i < 4; ++i) me->SummonCreature(MOB_CRYSTAL_SPIKE, fSpikeXY[i][0], fSpikeXY[i][1], fBaseZ, 0, TEMPSUMMON_TIMED_DESPAWN, 7*IN_MILLISECONDS); if (++uiCrystalSpikesCount >= 13) diff --git a/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp b/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp index e3b1a7e94e1..2937a5b9987 100644 --- a/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp +++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp @@ -181,8 +181,8 @@ class boss_warp_splinter : public CreatureScript { float angle = (M_PI / 3) * i; - float X = Treant_Spawn_Pos_X + TREANT_SPAWN_DIST * cos(angle); - float Y = Treant_Spawn_Pos_Y + TREANT_SPAWN_DIST * sin(angle); + float X = Treant_Spawn_Pos_X + TREANT_SPAWN_DIST * std::cos(angle); + float Y = Treant_Spawn_Pos_Y + TREANT_SPAWN_DIST * std::sin(angle); float O = - me->GetAngle(X, Y); if (Creature* pTreant = me->SummonCreature(CREATURE_TREANT, treant_pos[i][0], treant_pos[i][1], treant_pos[i][2], O, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 25000)) diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index 5640a84317c..9ade37a1096 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -1954,8 +1954,8 @@ public: me->AddUnitMovementFlag(MOVEMENTFLAG_CAN_FLY|MOVEMENTFLAG_ASCENDING|MOVEMENTFLAG_FLYING); me->SetSpeed(MOVE_FLIGHT, 0.75f, true); me->SetSpeed(MOVE_RUN, 0.75f, true); - float x = me->GetPositionX() + 20 * cos(me->GetOrientation()); - float y = me->GetPositionY() + 20 * sin(me->GetOrientation()); + float x = me->GetPositionX() + 20 * std::cos(me->GetOrientation()); + float y = me->GetPositionY() + 20 * std::sin(me->GetOrientation()); float z = me->GetPositionZ() + 40; me->GetMotionMaster()->Clear(false); me->GetMotionMaster()->MovePoint(0, x, y, z); diff --git a/src/server/shared/CompilerDefs.h b/src/server/shared/CompilerDefs.h index f7e3d0b4979..b8be66d928f 100755 --- a/src/server/shared/CompilerDefs.h +++ b/src/server/shared/CompilerDefs.h @@ -50,12 +50,20 @@ # define COMPILER COMPILER_INTEL #elif defined( __GNUC__ ) # define COMPILER COMPILER_GNU +# define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) #else -# pragma error "FATAL ERROR: Unknown compiler." +# error "FATAL ERROR: Unknown compiler." #endif #if COMPILER == COMPILER_MICROSOFT # pragma warning( disable : 4267 ) // conversion from 'size_t' to 'int', possible loss of data # pragma warning( disable : 4786 ) // identifier was truncated to '255' characters in the debug information #endif + +#if defined(__cplusplus) && __cplusplus == 201103L +# define COMPILER_HAS_CPP11_SUPPORT 1 +#else +# define COMPILER_HAS_CPP11_SUPPORT 0 +#endif + #endif diff --git a/src/server/shared/Dynamic/HashNamespace.h b/src/server/shared/Dynamic/HashNamespace.h new file mode 100644 index 00000000000..c7b5a817b76 --- /dev/null +++ b/src/server/shared/Dynamic/HashNamespace.h @@ -0,0 +1,119 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * Copyright (C) 2005-2009 MaNGOS + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#ifndef TRINITY_HASH_NAMESPACE_H +#define TRINITY_HASH_NAMESPACE_H + +#include "Define.h" + +#if COMPILER_HAS_CPP11_SUPPORT +# define HASH_NAMESPACE_START namespace std { +# define HASH_NAMESPACE_END } +#elif defined(_STLPORT_VERSION) +# define HASH_NAMESPACE_START namespace std { +# define HASH_NAMESPACE_END } +#elif COMPILER == COMPILER_MICROSOFT && _MSC_VER >= 1600 // VS100 +# define HASH_NAMESPACE_START namespace std { +# define HASH_NAMESPACE_END } +#elif COMPILER == COMPILER_MICROSOFT && _MSC_VER >= 1500 && _HAS_TR1 +# define HASH_NAMESPACE_START namespace std { namespace tr1 { +# define HASH_NAMESPACE_END } } +#elif COMPILER == COMPILER_MICROSOFT && _MSC_VER >= 1300 +# define HASH_NAMESPACE_START namespace stdext { +# define HASH_NAMESPACE_END } + +#if !_HAS_TRADITIONAL_STL +#ifndef HASH_NAMESPACE +#define HASH_NAMESPACE +#else + +// can be not used by some platforms, so provide fake forward +HASH_NAMESPACE_START + +template +class hash +{ +public: + size_t operator() (K const&); +}; + +HASH_NAMESPACE_END + +#endif +#endif + +#elif COMPILER == COMPILER_INTEL +# define HASH_NAMESPACE_START namespace std { +# define HASH_NAMESPACE_END } +#elif COMPILER == COMPILER_GNU && defined(__clang__) && defined(_LIBCPP_VERSION) +# define HASH_NAMESPACE_START namespace std { +# define HASH_NAMESPACE_END } +#elif COMPILER == COMPILER_GNU && GCC_VERSION > 40200 +# define HASH_NAMESPACE_START namespace std { namespace tr1 { +# define HASH_NAMESPACE_END } } +#elif COMPILER == COMPILER_GNU && GCC_VERSION >= 30000 +# define HASH_NAMESPACE_START namespace __gnu_cxx { +# define HASH_NAMESPACE_END } + +#include +#include + +HASH_NAMESPACE_START + +template<> +class hash +{ +public: + size_t operator()(const unsigned long long &__x) const { return (size_t)__x; } +}; + +template +class hash +{ +public: + size_t operator()(T * const &__x) const { return (size_t)__x; } +}; + +template<> struct hash +{ + size_t operator()(const std::string &__x) const + { + return hash()(__x.c_str()); + } +}; + +HASH_NAMESPACE_END + +#else +# define HASH_NAMESPACE_START namespace std { +# define HASH_NAMESPACE_END } +#endif + +#if COMPILER != COMPILER_MICROSOFT + +// Visual Studio use non standard hash calculation function, so provide fake forward for other +HASH_NAMESPACE_START + +template +size_t hash_value(K const&); + +HASH_NAMESPACE_END + +#endif + +#endif diff --git a/src/server/shared/Dynamic/LinkedList.h b/src/server/shared/Dynamic/LinkedList.h index 29cbeb2e66c..3969e22aa14 100755 --- a/src/server/shared/Dynamic/LinkedList.h +++ b/src/server/shared/Dynamic/LinkedList.h @@ -19,7 +19,8 @@ #ifndef _LINKEDLIST #define _LINKEDLIST -#include "Common.h" +#include "Define.h" +#include //============================================ class LinkedListHead; @@ -32,7 +33,7 @@ class LinkedListElement LinkedListElement* iNext; LinkedListElement* iPrev; public: - LinkedListElement() { iNext = NULL; iPrev = NULL; } + LinkedListElement(): iNext(NULL), iPrev(NULL) {} ~LinkedListElement() { delink(); } bool hasNext() const { return(iNext && iNext->iNext != NULL); } @@ -83,13 +84,12 @@ class LinkedListHead LinkedListElement iLast; uint32 iSize; public: - LinkedListHead() + LinkedListHead(): iSize(0) { // create empty list iFirst.iNext = &iLast; iLast.iPrev = &iFirst; - iSize = 0; } bool isEmpty() const { return(!iFirst.iNext->isInList()); } @@ -153,13 +153,14 @@ class LinkedListHead Iterator& operator=(Iterator const &_Right) { - return (*this) = _Right._Ptr; + _Ptr = _Right._Ptr; + return *this; } Iterator& operator=(const_pointer const &_Right) { - _Ptr = (pointer)_Right; - return (*this); + _Ptr = pointer(_Right); + return *this; } reference operator*() @@ -242,4 +243,3 @@ class LinkedListHead //============================================ #endif - diff --git a/src/server/shared/Dynamic/LinkedReference/Reference.h b/src/server/shared/Dynamic/LinkedReference/Reference.h index d4c607470cc..6c9710381b9 100755 --- a/src/server/shared/Dynamic/LinkedReference/Reference.h +++ b/src/server/shared/Dynamic/LinkedReference/Reference.h @@ -57,13 +57,21 @@ template class Reference : public LinkedListElement // We don't need the reference anymore. Call comes from the refFrom object // Tell our refTo object, that the link is cut - void unlink() { targetObjectDestroyLink(); delink(); iRefTo = NULL; iRefFrom = NULL; } + void unlink() + { + targetObjectDestroyLink(); + delink(); + iRefTo = NULL; + iRefFrom = NULL; + } // Link is invalid due to destruction of referenced target object. Call comes from the refTo object // Tell our refFrom object, that the link is cut void invalidate() // the iRefFrom MUST remain!! { - sourceObjectDestroyLink(); delink(); iRefTo = NULL; + sourceObjectDestroyLink(); + delink(); + iRefTo = NULL; } bool isValid() const // Only check the iRefTo @@ -89,4 +97,3 @@ template class Reference : public LinkedListElement //===================================================== #endif - diff --git a/src/server/shared/Dynamic/ObjectRegistry.h b/src/server/shared/Dynamic/ObjectRegistry.h index ca481671796..bb3227514a7 100755 --- a/src/server/shared/Dynamic/ObjectRegistry.h +++ b/src/server/shared/Dynamic/ObjectRegistry.h @@ -101,7 +101,6 @@ class ObjectRegistry } private: RegistryMapType i_registeredObjects; - }; -#endif +#endif diff --git a/src/server/shared/Dynamic/UnorderedMap.h b/src/server/shared/Dynamic/UnorderedMap.h index 5e7b48f9b7b..5d485efa89b 100755 --- a/src/server/shared/Dynamic/UnorderedMap.h +++ b/src/server/shared/Dynamic/UnorderedMap.h @@ -19,55 +19,54 @@ #ifndef TRINITY_UNORDERED_MAP_H #define TRINITY_UNORDERED_MAP_H -#include "CompilerDefs.h" -#include "Define.h" +#include "HashNamespace.h" -#if COMPILER == COMPILER_INTEL -#include -#elif COMPILER == COMPILER_GNU && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 3) -#include -#elif COMPILER == COMPILER_GNU && __GNUC__ >= 3 -#include -#elif COMPILER == COMPILER_MICROSOFT && _MSC_VER >= 1500 && _HAS_TR1 // VC9.0 and later -#include +#if COMPILER_HAS_CPP11_SUPPORT +# include +#elif COMPILER == COMPILER_INTEL +# include +#elif COMPILER == COMPILER_GNU && defined(__clang__) && defined(_LIBCPP_VERSION) +# include +#elif COMPILER == COMPILER_GNU && GCC_VERSION > 40200 +# include +#elif COMPILER == COMPILER_GNU && GCC_VERSION >= 30000 +# include +#elif COMPILER == COMPILER_MICROSOFT && ((_MSC_VER >= 1500 && _HAS_TR1) || _MSC_VER >= 1700) // VC9.0 SP1 and later +# include #else -#include +# include #endif #ifdef _STLPORT_VERSION -#define UNORDERED_MAP std::hash_map -using std::hash_map; +# define UNORDERED_MAP std::hash_map +# define UNORDERED_MULTIMAP std::hash_multimap +#elif COMPILER_HAS_CPP11_SUPPORT +# define UNORDERED_MAP std::unordered_map +# define UNORDERED_MULTIMAP std::unordered_multimap +#elif COMPILER == COMPILER_MICROSOFT && _MSC_VER >= 1600 // VS100 +# define UNORDERED_MAP std::tr1::unordered_map +# define UNORDERED_MULTIMAP std::tr1::unordered_multimap #elif COMPILER == COMPILER_MICROSOFT && _MSC_VER >= 1500 && _HAS_TR1 -#define UNORDERED_MAP std::tr1::unordered_map +# define UNORDERED_MAP std::tr1::unordered_map +# define UNORDERED_MULTIMAP std::tr1::unordered_multimap #elif COMPILER == COMPILER_MICROSOFT && _MSC_VER >= 1300 -#define UNORDERED_MAP stdext::hash_map -using stdext::hash_map; -#elif COMPILER == COMPILER_GNU && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 3) -#define UNORDERED_MAP std::tr1::unordered_map -#elif (COMPILER == COMPILER_GNU && __GNUC__ >= 3) || COMPILER == COMPILER_INTEL -#define UNORDERED_MAP __gnu_cxx::hash_map - -namespace __gnu_cxx -{ - template<> struct hash - { - size_t operator()(const unsigned long long &__x) const { return (size_t)__x; } - }; - template struct hash - { - size_t operator()(T * const &__x) const { return (size_t)__x; } - }; - template<> struct hash - { - size_t operator()(const std::string &__x) const - { - return hash()(__x.c_str()); - } - }; -}; - +# define UNORDERED_MAP stdext::hash_map +# define UNORDERED_MULTIMAP stdext::hash_multimap +#elif COMPILER == COMPILER_INTEL +# define UNORDERED_MAP std::hash_map +# define UNORDERED_MULTIMAP std::hash_multimap +#elif COMPILER == COMPILER_GNU && defined(__clang__) && defined(_LIBCPP_VERSION) +# define UNORDERED_MAP std::unordered_map +# define UNORDERED_MULTIMAP std::unordered_multimap +#elif COMPILER == COMPILER_GNU && GCC_VERSION > 40200 +# define UNORDERED_MAP std::tr1::unordered_map +# define UNORDERED_MULTIMAP std::tr1::unordered_multimap +#elif COMPILER == COMPILER_GNU && GCC_VERSION >= 30000 +# define UNORDERED_MAP __gnu_cxx::hash_map +# define UNORDERED_MULTIMAP __gnu_cxx::hash_multimap #else -#define UNORDERED_MAP std::hash_map -using std::hash_map; +# define UNORDERED_MAP std::hash_map +# define UNORDERED_MULTIMAP std::hash_multimap #endif + #endif diff --git a/src/server/shared/Dynamic/UnorderedSet.h b/src/server/shared/Dynamic/UnorderedSet.h new file mode 100644 index 00000000000..8c8d7c0d5dc --- /dev/null +++ b/src/server/shared/Dynamic/UnorderedSet.h @@ -0,0 +1,66 @@ +/* +* Copyright (C) 2008-2012 TrinityCore +* Copyright (C) 2005-2009 MaNGOS +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* This program is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along +* with this program. If not, see . +*/ + +#ifndef TRINITY_UNORDERED_SET_H +#define TRINITY_UNORDERED_SET_H + +#include "HashNamespace.h" + +#if COMPILER_HAS_CPP11_SUPPORT +# include +#elif COMPILER == COMPILER_INTEL +# include +#elif COMPILER == COMPILER_GNU && defined(__clang__) && defined(_LIBCPP_VERSION) +# include +#elif COMPILER == COMPILER_GNU && GCC_VERSION > 40200 +# include +#elif COMPILER == COMPILER_GNU && GCC_VERSION >= 30000 +# include +#elif COMPILER == COMPILER_MICROSOFT && ((_MSC_VER >= 1500 && _HAS_TR1) || _MSC_VER >= 1700) // VC9.0 SP1 and later +# include +#else +# include +#endif + +#ifdef _STLPORT_VERSION +# define UNORDERED_SET std::hash_set +using std::hash_set; +#elif COMPILER_HAS_CPP11_SUPPORT +# define UNORDERED_SET std::unordered_set +#elif COMPILER == COMPILER_MICROSOFT && _MSC_VER >= 1600 // VS100 +# define UNORDERED_SET std::tr1::unordered_set +#elif COMPILER == COMPILER_MICROSOFT && _MSC_VER >= 1500 && _HAS_TR1 +# define UNORDERED_SET std::tr1::unordered_set +#elif COMPILER == COMPILER_MICROSOFT && _MSC_VER >= 1300 +# define UNORDERED_SET stdext::hash_set +using stdext::hash_set; +#elif COMPILER == COMPILER_INTEL +# define UNORDERED_SET std::hash_set +using std::hash_set; +#elif COMPILER == COMPILER_GNU && defined(__clang__) && defined(_LIBCPP_VERSION) +# define UNORDERED_SET std::unordered_set +#elif COMPILER == COMPILER_GNU && GCC_VERSION > 40200 +# define UNORDERED_SET std::tr1::unordered_set +#elif COMPILER == COMPILER_GNU && GCC_VERSION >= 30000 +# define UNORDERED_SET __gnu_cxx::hash_set +#else +# define UNORDERED_SET std::hash_set +using std::hash_set; +#endif + +#endif -- cgit v1.2.3 From 91367bb39f6dbf6f718b905a7ced4e82f61c62fa Mon Sep 17 00:00:00 2001 From: thesensei Date: Tue, 2 Oct 2012 22:13:40 +0300 Subject: Core/Oculus: Fixes here and there, implement phasing * Implement phasing (sniffed) * Add drakes proper support (events, texts, conditions for spells), remove npc_spellclick_spells * Add proper support for Gossip npcs * Removed the arcane shield Urom use first time we are about to meet him, because he only get it after he spawns a wave, added Evocation casts from sniff/retail that also break the teleportation visual bug * Some db updates based on Aokromes sniffs I intended to do it all, but there are core issues I have no knowledge to fix and I don't want to jump to other things before fixing them. :) So, I will submit boss updates, if I ever fix them. There are still stuff do do for drakes spells left from before. * Majour thanks to Shauren for helping me with summoning spells and w/e I ask him and all who answered my questions. --- sql/updates/world/2012_10_02_00_world_oculus.sql | 80 ++++++ src/server/game/Spells/SpellMgr.cpp | 7 + .../scripts/Northrend/Nexus/Oculus/boss_eregos.cpp | 45 --- .../scripts/Northrend/Nexus/Oculus/boss_urom.cpp | 13 +- .../Northrend/Nexus/Oculus/instance_oculus.cpp | 83 +++++- .../scripts/Northrend/Nexus/Oculus/oculus.cpp | 302 ++++++++++++++++++++- src/server/scripts/Northrend/Nexus/Oculus/oculus.h | 13 +- 7 files changed, 473 insertions(+), 70 deletions(-) create mode 100644 sql/updates/world/2012_10_02_00_world_oculus.sql (limited to 'src/server/game/Spells') diff --git a/sql/updates/world/2012_10_02_00_world_oculus.sql b/sql/updates/world/2012_10_02_00_world_oculus.sql new file mode 100644 index 00000000000..2db8bd8fed1 --- /dev/null +++ b/sql/updates/world/2012_10_02_00_world_oculus.sql @@ -0,0 +1,80 @@ +-- Addon data based on sniff fixed by Vincent-Michael +DELETE FROM `creature_template_addon` WHERE `entry` IN (27692,27755,27756); +INSERT INTO `creature_template_addon` (`entry`,`path_id`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES +(27692,0,0,0x3000000,0x1,0,'50296 50325'), -- Emerald Drake +(27755,0,0,0x3000000,0x1,0,'50296 50325'), -- Amber Drake +(27756,0,0,0x3000000,0x1,0,'50296 50248 50325'); -- Ruby Drake // Evasive aura should be here from the start +-- Change InhabitType to prevent drakes falling on summon +UPDATE `creature_template` SET `InhabitType`=4 WHERE `entry` IN (27692,27755,27756); +-- Change script name for gossip npcs and drakes and set npc_flag to 0, since only after Ist boss is dead, they should acquire gossip flag +UPDATE `creature_template` SET `npcflag`=2,`ScriptName`='npc_verdisa_beglaristrasz_eternos' WHERE `entry` IN (27657,27658,27659); +UPDATE `creature_template` SET `spell2`=50240,`spell3`=50253,`spell4`=0 WHERE `entry`=27756; -- Remove Evasive Aura and set Evasive Manouvres since it is an aura always applied, also set Martyr as 3rd +UPDATE `creature_template` SET `spell6`=53389,`ScriptName`='npc_ruby_emerald_amber_drake' WHERE `entry` IN (27692,27755,27756); -- Add GPS spell for all drakes and script names for drakes +-- Add spell_script name for Call Ruby/Emerald/Amber Drake spells +DELETE FROM `spell_script_names` WHERE `spell_id` IN (49462,49345,49461); +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(49462,'spell_call_ruby_emerald_amber_drake'), -- Ruby +(49345,'spell_call_ruby_emerald_amber_drake'), -- Emerald +(49461,'spell_call_ruby_emerald_amber_drake'); -- Amber +-- Remove wrong use of npc_spellclick_spell, the drake should auto do all on summon +DELETE FROM `npc_spellclick_spells` WHERE `npc_entry` IN (27692,27755,27756); +-- Add conditions +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry` IN (49464,49346,49460,66667,49838); +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=17 AND `SourceEntry` IN (49840,49592,50328,50341,50232); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(13,1|4,49464,0,0,33,0,1,5,0,0,0,'','Ruby Drake Saddle control vehicle aura can hit only created unit'), +(13,1|4,49346,0,0,33,0,1,5,0,0,0,'','Emerald Drake Saddle control vehicle aura can hit only created unit'), +(13,1|4,49460,0,0,33,0,1,5,0,0,0,'','Amber Drake Saddle control vehicle aura can hit only created unit'), +(13,1|2|4,66667,0,0,33,1,0,0,0,0,0,'','Gear scaling for Oculus drakes can only be casted on self'), +(17,0,49840,0,1,31,1,3,28236,0,0,0,'','Shock Lance target can be Azure Ring Captain'), +(17,0,49840,0,2,31,1,3,27638,0,0,0,'','Shock Lance target can be Azure Ring Guardian'), +(17,0,49840,0,3,31,1,3,28276,0,0,0,'','Shock Lance target can be Greater Lay Whelp'), +(17,0,49840,0,4,31,1,3,27656,0,0,0,'','Shock Lance target can be Eregos'), +(13,1,49838,0,1,31,0,3,28236,0,0,0,'','Stop Time can hit Azure Ring Captain'), +(13,1,49838,0,2,31,0,3,27638,0,0,0,'','Stop Time can hit Azure Ring Guardian'), +(13,1,49838,0,3,31,0,3,28276,0,0,0,'','Stop Time can hit Greater Lay Whelp'), +(13,1,49838,0,4,31,0,3,27656,0,0,0,'','Stop Time can hit Eregos'), +(17,0,49592,0,1,31,1,3,28236,0,0,0,'','Temporal Rift target can be Azure Ring Captain'), +(17,0,49592,0,2,31,1,3,27638,0,0,0,'','Temporal Rift target can be Azure Ring Guardian'), +(17,0,49592,0,3,31,1,3,28276,0,0,0,'','Temporal Rift target can be Greater Lay Whelp'), +(17,0,49592,0,4,31,1,3,27656,0,0,0,'','Temporal Rift target can be Eregos'), +(17,0,50328,0,1,31,1,3,28236,0,0,0,'','Leeching Poison target can be Azure Ring Captain'), +(17,0,50328,0,2,31,1,3,27638,0,0,0,'','Leeching Poison target can be Azure Ring Guardian'), +(17,0,50328,0,3,31,1,3,28276,0,0,0,'','Leeching Poison target can be Greater Lay Whelp'), +(17,0,50328,0,4,31,1,3,27656,0,0,0,'','Leeching Poison target can be Eregos'), +(17,0,50341,0,1,31,1,3,28236,0,0,0,'','Touch the Nightmare target can be Azure Ring Captain'), +(17,0,50341,0,2,31,1,3,27638,0,0,0,'','Touch the Nightmare target can be Azure Ring Guardian'), +(17,0,50341,0,3,31,1,3,28276,0,0,0,'','Touch the Nightmare target can be Greater Lay Whelp'), +(17,0,50341,0,4,31,1,3,27656,0,0,0,'','Touch the Nightmare target can be Eregos'), +(17,0,50232,0,1,31,1,3,28236,0,0,0,'','Searing Wrath target can be Azure Ring Captain'), +(17,0,50232,0,2,31,1,3,27638,0,0,0,'','Searing Wrath target can be Azure Ring Guardian'), +(17,0,50232,0,3,31,1,3,28276,0,0,0,'','Searing Wrath target can be Greater Lay Whelp'), +(17,0,50232,0,4,31,1,3,27656,0,0,0,'','Searing Wrath target can be Eregos'); +-- Add text for Belgaristrasz +SET @Belgaristrasz := 27658; +DELETE FROM `creature_text` WHERE `entry`=@Belgaristrasz; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(@Belgaristrasz,0,0,'Thank you for freeing us, mortals. Beware, the blue flight is alerted to your presence. Even now, Malygos sends Varos Cloudstrider and his ring guardians to defend the Oculus. You will need our help to stand a chance.',12,0,100,1,3500,0,'Belgaristrasz - On freed'); +-- Add text for Ruby, Amber and Emerald drakes +SET @Ruby := 27756; +SET @Emerald := 27692; +SET @Amber := 27755; +DELETE FROM `creature_text` WHERE `entry` IN (@Ruby,@Emerald,@Amber); +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(@Ruby,0,0,'Ruby Drake flies away.',16,0,100,1,0,2858,'Ruby - On take off'), +(@Ruby,1,0,'Welcome Friend. Keep your head down and hold on tight!',15,0,100,1,0,0,'Ruby - On welcome'), +(@Ruby,2,0,'Use Searing Wrath to damage enemies and Evasive Maneuvers if I start taking damage. Remember I need to build up Evasive Charges by taking damage to perform Evasive Maneuvers!',15,0,100,1,0,0,'Ruby - On explaining abilities'), +(@Ruby,3,0,'Now that I am at my full power I can perform Martyr. You can use it to protect other drakes, but I will take lots of damage, so make sure you''re using Evasive Maneuvers too!',15,0,100,1,0,0,'Ruby - On ultimate ability unlocked'), +(@Ruby,4,0,'I''m badly injured! I can''t take much more of this!',15,0,100,1,0,0,'Ruby - On below 40%'), +(@Emerald,0,0,'Emerald Drake flies away.',16,0,100,1,0,2858,'Emerald - On take off'), +(@Emerald,1,0,'Welcome Friend. Keep your head down and hold on tight!',15,0,100,1,0,0,'Emerald - On welcome'), +(@Emerald,2,0,'Use Leeching Poison to damage enemies and keep me healed. Touch the Nightmare is very powerful, but it hurts me, so only use it when I have a lot of health!',15,0,100,1,0,0,'Emerald - On explaining abilities'), +(@Emerald,3,0,'Now that I am at my full power I can perform Dream Funnel. You can use it to heal other drakes, but it drains my health, so make sure you''re using Leeching Poison too!',15,0,100,1,0,0,'Emerald - On ultimate ability unlocked'), +(@Emerald,4,0,'I''m badly injured! I can''t take much more of this!',15,0,100,1,0,0,'Emerald - On below 40%'), +(@Amber,0,0,'Amber Drake flies away.',16,0,100,1,0,2858,'Amber - On take off'), +(@Amber,1,0,'Welcome Friend. Keep your head down and hold on tight!',15,0,100,1,0,0,'Amber - On welcome'), +(@Amber,2,0,'Use Shock Lance to damage enemies. If we get in trouble, Stop Time to freeze all enemies in place, then hit them with Shock Lance for massive damage!',15,0,100,1,0,0,'Amber - On explaining abilities'), +(@Amber,3,0,'Now that I am at my full power I can perform Temporal Rift. You can use it to make enemies take extra damage and to get Shock Charges. Save up Shock Charges and then Shock Lance for huge damage!',15,0,100,1,0,0,'Amber - On ultimate ability unlocked'), +(@Amber,4,0,'I''m badly injured! I can''t take much more of this!',15,0,100,1,0,0,'Amber - On below 40%'); +-- Fix Oculus phasing db side, all listed get changed only on specific isntance data +UPDATE `creature` SET `phaseMask`=2 WHERE `id` IN (27447,27655,28276,27656); diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 70ec7bd4d68..c89442855e1 100755 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -3599,6 +3599,13 @@ void SpellMgr::LoadDbcDataCorrections() spellInfo->manaCost = 0; spellInfo->manaPerSecond = 0; break; + // OCULUS SPELLS + // The spells below are here, because their effect 1 is giving warning, because the triggered spell is not found in dbc and is missing from encounter sniff. + case 49462: // Call Ruby Drake + case 49461: // Call Amber Drake + case 49345: // Call Emerald Drake + spellInfo->Effect[1] = 0; + break; default: break; } diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp index 270e31f4350..c691db4230c 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp @@ -68,51 +68,6 @@ enum Actions ACTION_SET_NORMAL_EVENTS = 1 }; -/*Ruby Drake, -(npc 27756) (item 37860) -(summoned by spell Ruby Essence = 37860 ---> Call Amber Drake == 49462 ---> Summon 27756) -*/ -enum RubyDrake -{ - NPC_RUBY_DRAKE_VEHICLE = 27756, - SPELL_RIDE_RUBY_DRAKE_QUE = 49463, //Apply Aura: Periodic Trigger, Interval: 3 seconds ---> 49464 - SPELL_RUBY_DRAKE_SADDLE = 49464, //Allows you to ride on the back of an Amber Drake. ---> Dummy - SPELL_RUBY_SEARING_WRATH = 50232, //(60 yds) - Instant - Breathes a stream of fire at an enemy dragon, dealing 6800 to 9200 Fire damage and then jumping to additional dragons within 30 yards. Each jump increases the damage by 50%. Affects up to 5 total targets - SPELL_RUBY_EVASIVE_AURA = 50248, //Instant - Allows the Ruby Drake to generate Evasive Charges when hit by hostile attacks and spells. - SPELL_RUBY_EVASIVE_MANEUVERS = 50240, //Instant - 5 sec. cooldown - Allows your drake to dodge all incoming attacks and spells. Requires Evasive Charges to use. Each attack or spell dodged while this ability is active burns one Evasive Charge. Lasts 30 sec. or until all charges are exhausted. - //you do not have acces to until you kill Mage-Lord Urom - SPELL_RUBY_MARTYR = 50253 //Instant - 10 sec. cooldown - Redirect all harmful spells cast at friendly drakes to yourself for 10 sec. -}; -/*Amber Drake, -(npc 27755) (item 37859) -(summoned by spell Amber Essence = 37859 ---> Call Amber Drake == 49461 ---> Summon 27755) -*/ -enum AmberDrake -{ - NPC_AMBER_DRAKE_VEHICLE = 27755, - SPELL_RIDE_AMBER_DRAKE_QUE = 49459, //Apply Aura: Periodic Trigger, Interval: 3 seconds ---> 49460 - SPELL_AMBER_DRAKE_SADDLE = 49460, //Allows you to ride on the back of an Amber Drake. ---> Dummy - SPELL_AMBER_SHOCK_LANCE = 49840, //(60 yds) - Instant - Deals 4822 to 5602 Arcane damage and detonates all Shock Charges on an enemy dragon. Damage is increased by 6525 for each detonated. -// SPELL_AMBER_STOP_TIME //Instant - 1 min cooldown - Halts the passage of time, freezing all enemy dragons in place for 10 sec. This attack applies 5 Shock Charges to each affected target. - //you do not have access to until you kill the Mage-Lord Urom. - SPELL_AMBER_TEMPORAL_RIFT = 49592 //(60 yds) - Channeled - Channels a temporal rift on an enemy dragon for 10 sec. While trapped in the rift, all damage done to the target is increased by 100%. In addition, for every 15, 000 damage done to a target affected by Temporal Rift, 1 Shock Charge is generated. -}; - -/*Emerald Drake, -(npc 27692) (item 37815), - (summoned by spell Emerald Essence = 37815 ---> Call Emerald Drake == 49345 ---> Summon 27692) -*/ -enum EmeraldDrake -{ - NPC_EMERALD_DRAKE_VEHICLE = 27692, - SPELL_RIDE_EMERALD_DRAKE_QUE = 49427, //Apply Aura: Periodic Trigger, Interval: 3 seconds ---> 49346 - SPELL_EMERALD_DRAKE_SADDLE = 49346, //Allows you to ride on the back of an Amber Drake. ---> Dummy - SPELL_EMERALD_LEECHING_POISON = 50328, //(60 yds) - Instant - Poisons the enemy dragon, leeching 1300 to the caster every 2 sec. for 12 sec. Stacks up to 3 times. - SPELL_EMERALD_TOUCH_THE_NIGHTMARE = 50341, //(60 yds) - Instant - Consumes 30% of the caster's max health to inflict 25, 000 nature damage to an enemy dragon and reduce the damage it deals by 25% for 30 sec. - // you do not have access to until you kill the Mage-Lord Urom - SPELL_EMERALD_DREAM_FUNNEL = 50344 //(60 yds) - Channeled - Transfers 5% of the caster's max health to a friendly drake every second for 10 seconds as long as the caster channels. -}; - enum EregosData { DATA_RUBY_VOID = 0, // http://www.wowhead.com/achievement=2044 diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp index 791bc0180e5..8e7863259ad 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp @@ -38,7 +38,8 @@ enum Spells SPELL_SUMMON_MENAGERIE_3 = 50496, SPELL_TELEPORT = 51112, //Teleports to the center of Oculus SPELL_TIME_BOMB = 51121, //Deals arcane damage to a random player, and after 6 seconds, deals zone damage to nearby equal to the health missing of the target afflicted by the debuff. - SPELL_TIME_BOMB_2 = 59376 + SPELL_TIME_BOMB_2 = 59376, + SPELL_EVOCATE = 51602 // He always cast it on reset or after teleportation }; enum Yells @@ -103,10 +104,9 @@ public: void Reset() { - if (instance->GetBossState(DATA_VAROS_EVENT) != DONE) - DoCast(SPELL_ARCANE_SHIELD); - - _Reset(); + me->CastSpell(me, SPELL_EVOCATE); + + _Reset(); if (instance->GetData(DATA_UROM_PLATAFORM) == 0) { @@ -307,14 +307,17 @@ public: case SPELL_SUMMON_MENAGERIE: me->SetHomePosition(968.66f, 1042.53f, 527.32f, 0.077f); LeaveCombat(); + me->CastSpell(me, SPELL_EVOCATE); break; case SPELL_SUMMON_MENAGERIE_2: me->SetHomePosition(1164.02f, 1170.85f, 527.321f, 3.66f); LeaveCombat(); + me->CastSpell(me, SPELL_EVOCATE); break; case SPELL_SUMMON_MENAGERIE_3: me->SetHomePosition(1118.31f, 1080.377f, 508.361f, 4.25f); LeaveCombat(); + me->CastSpell(me, SPELL_EVOCATE); break; case SPELL_TELEPORT: //! Unconfirmed, previous below diff --git a/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp index ca4ae883747..1f4a3d1b229 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp @@ -56,9 +56,13 @@ public: eregosCacheGUID = 0; - azureDragonsList.clear(); + gwhelpList.clear(); gameObjectList.clear(); - } + + belgaristraszGUID = 0; + eternosGUID = 0; + verdisaGUID = 0; +} void OnUnitDeath(Unit* unit) { @@ -112,17 +116,49 @@ public: break; case NPC_VAROS: varosGUID = creature->GetGUID(); + if (GetBossState(DATA_DRAKOS_EVENT) == DONE) + creature->SetPhaseMask(1, true); break; case NPC_UROM: uromGUID = creature->GetGUID(); + if (GetBossState(DATA_VAROS_EVENT) == DONE) + creature->SetPhaseMask(1, true); break; case NPC_EREGOS: eregosGUID = creature->GetGUID(); + if (GetBossState(DATA_UROM_EVENT) == DONE) + creature->SetPhaseMask(1, true); break; case NPC_CENTRIFUGE_CONSTRUCT: if (creature->isAlive()) DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, ++centrifugueConstructCounter); break; + case NPC_BELGARISTRASZ: + belgaristraszGUID = creature->GetGUID(); + if (GetBossState(DATA_DRAKOS_EVENT) == DONE) + creature->SetWalk(true), + creature->GetMotionMaster()->MovePoint(0, 941.453f, 1044.1f, 359.967f), + creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + break; + case NPC_ETERNOS: + eternosGUID = creature->GetGUID(); + if (GetBossState(DATA_DRAKOS_EVENT) == DONE) + creature->SetWalk(true), + creature->GetMotionMaster()->MovePoint(0, 943.202f, 1059.35f, 359.967f), + creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + break; + case NPC_VERDISA: + verdisaGUID = creature->GetGUID(); + if (GetBossState(DATA_DRAKOS_EVENT) == DONE) + creature->SetWalk(true), + creature->GetMotionMaster()->MovePoint(0, 949.188f, 1032.91f, 359.967f), + creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + break; + case NPC_GREATER_WHELP: + if (GetBossState(DATA_UROM_EVENT) == DONE) + creature->SetPhaseMask(1, true); + gwhelpList.push_back(creature->GetGUID()); + break; } } @@ -159,11 +195,22 @@ public: DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW, 1); DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, centrifugueConstructCounter); OpenCageDoors(); + FreeDragons(); + if (Creature* varos = instance->GetCreature(varosGUID)) + varos->SetPhaseMask(1, true); } break; case DATA_VAROS_EVENT: if (state == DONE) DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW, 0); + if (Creature* urom = instance->GetCreature(uromGUID)) + urom->SetPhaseMask(1, true); + break; + case DATA_UROM_EVENT: + if (state == DONE) + if (Creature* eregos = instance->GetCreature(eregosGUID)) + eregos->SetPhaseMask(1, true); + GreaterWhelps(); break; case DATA_EREGOS_EVENT: if (state == DONE) @@ -221,6 +268,31 @@ public: } } + void FreeDragons() + { + if (Creature* belgaristrasz = instance->GetCreature(belgaristraszGUID)) + belgaristrasz->SetWalk(true), + belgaristrasz->GetMotionMaster()->MovePoint(0, 941.453f, 1044.1f, 359.967f); + if (Creature* eternos = instance->GetCreature(eternosGUID)) + eternos->SetWalk(true), + eternos->GetMotionMaster()->MovePoint(0, 943.202f, 1059.35f, 359.967f); + if (Creature* verdisa = instance->GetCreature(verdisaGUID)) + verdisa->SetWalk(true), + verdisa->GetMotionMaster()->MovePoint(0, 949.188f, 1032.91f, 359.967f); + } + + void GreaterWhelps() + { + if (gwhelpList.empty()) + return; + + for (std::list::const_iterator itr = gwhelpList.begin(); itr != gwhelpList.end(); ++itr) + { + if (Creature* gwhelp = instance->GetCreature(*itr)) + gwhelp->SetPhaseMask(1, true); + } + } + std::string GetSaveData() { OUT_SAVE_INST_DATA; @@ -269,6 +341,10 @@ public: uint64 uromGUID; uint64 eregosGUID; + uint64 belgaristraszGUID; + uint64 eternosGUID; + uint64 verdisaGUID; + uint8 platformUrom; uint8 centrifugueConstructCounter; @@ -277,9 +353,8 @@ public: std::string str_data; std::list gameObjectList; - std::list azureDragonsList; + std::list gwhelpList; }; - }; void AddSC_instance_oculus() diff --git a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp index 1d8b5b986f6..362f99fbfab 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp @@ -20,6 +20,7 @@ #include "ScriptedGossip.h" #include "SpellScript.h" #include "SpellAuraEffects.h" +#include "Vehicle.h" #include "oculus.h" #define GOSSIP_ITEM_DRAKES "So where do we go from here?" @@ -32,7 +33,7 @@ #define HAS_ESSENCE(a) ((a)->HasItemCount(ITEM_EMERALD_ESSENCE, 1) || (a)->HasItemCount(ITEM_AMBER_ESSENCE, 1) || (a)->HasItemCount(ITEM_RUBY_ESSENCE, 1)) -enum Drakes +enum GossipNPCs { GOSSIP_TEXTID_DRAKES = 13267, GOSSIP_TEXTID_BELGARISTRASZ1 = 12916, @@ -49,25 +50,67 @@ enum Drakes ITEM_AMBER_ESSENCE = 37859, ITEM_RUBY_ESSENCE = 37860, - NPC_VERDISA = 27657, - NPC_BELGARISTRASZ = 27658, - NPC_ETERNOS = 27659, + SPELL_SHOCK_CHARGE = 49836 +}; + +enum Drakes +{ +/*Ruby Drake, +(npc 27756) (item 37860) +(summoned by spell Ruby Essence = 37860 ---> Call Amber Drake == 49462 ---> Summon 27756) +*/ + SPELL_RIDE_RUBY_DRAKE_QUE = 49463, //Apply Aura: Periodic Trigger, Interval: 3 seconds ---> 49464 + SPELL_RUBY_DRAKE_SADDLE = 49464, //Allows you to ride on the back of an Amber Drake. ---> Dummy + SPELL_RUBY_SEARING_WRATH = 50232, //(60 yds) - Instant - Breathes a stream of fire at an enemy dragon, dealing 6800 to 9200 Fire damage and then jumping to additional dragons within 30 yards. Each jump increases the damage by 50%. Affects up to 5 total targets + SPELL_RUBY_EVASIVE_AURA = 50248, //Instant - Allows the Ruby Drake to generate Evasive Charges when hit by hostile attacks and spells. + SPELL_RUBY_EVASIVE_MANEUVERS = 50240, //Instant - 5 sec. cooldown - Allows your drake to dodge all incoming attacks and spells. Requires Evasive Charges to use. Each attack or spell dodged while this ability is active burns one Evasive Charge. Lasts 30 sec. or until all charges are exhausted. + //you do not have acces to until you kill Mage-Lord Urom + SPELL_RUBY_MARTYR = 50253, //Instant - 10 sec. cooldown - Redirect all harmful spells cast at friendly drakes to yourself for 10 sec. + +/*Amber Drake, +(npc 27755) (item 37859) +(summoned by spell Amber Essence = 37859 ---> Call Amber Drake == 49461 ---> Summon 27755) +*/ - SPELL_SHOCK_CHARGE = 49836, + SPELL_RIDE_AMBER_DRAKE_QUE = 49459, //Apply Aura: Periodic Trigger, Interval: 3 seconds ---> 49460 + SPELL_AMBER_DRAKE_SADDLE = 49460, //Allows you to ride on the back of an Amber Drake. ---> Dummy + SPELL_AMBER_SHOCK_LANCE = 49840, //(60 yds) - Instant - Deals 4822 to 5602 Arcane damage and detonates all Shock Charges on an enemy dragon. Damage is increased by 6525 for each detonated. + // SPELL_AMBER_STOP_TIME //Instant - 1 min cooldown - Halts the passage of time, freezing all enemy dragons in place for 10 sec. This attack applies 5 Shock Charges to each affected target. + //you do not have access to until you kill the Mage-Lord Urom. + SPELL_AMBER_TEMPORAL_RIFT = 49592, //(60 yds) - Channeled - Channels a temporal rift on an enemy dragon for 10 sec. While trapped in the rift, all damage done to the target is increased by 100%. In addition, for every 15, 000 damage done to a target affected by Temporal Rift, 1 Shock Charge is generated. + +/*Emerald Drake, +(npc 27692) (item 37815), + (summoned by spell Emerald Essence = 37815 ---> Call Emerald Drake == 49345 ---> Summon 27692) +*/ + SPELL_RIDE_EMERALD_DRAKE_QUE = 49427, //Apply Aura: Periodic Trigger, Interval: 3 seconds ---> 49346 + SPELL_EMERALD_DRAKE_SADDLE = 49346, //Allows you to ride on the back of an Amber Drake. ---> Dummy + SPELL_EMERALD_LEECHING_POISON = 50328, //(60 yds) - Instant - Poisons the enemy dragon, leeching 1300 to the caster every 2 sec. for 12 sec. Stacks up to 3 times. + SPELL_EMERALD_TOUCH_THE_NIGHTMARE = 50341, //(60 yds) - Instant - Consumes 30% of the caster's max health to inflict 25, 000 nature damage to an enemy dragon and reduce the damage it deals by 25% for 30 sec. + // you do not have access to until you kill the Mage-Lord Urom + SPELL_EMERALD_DREAM_FUNNEL = 50344, //(60 yds) - Channeled - Transfers 5% of the caster's max health to a friendly drake every second for 10 seconds as long as the caster channels. }; enum Says { - SAY_VAROS = 0, - SAY_UROM = 1 + SAY_VAROS = 0, + SAY_UROM = 1, + SAY_BELGARISTRASZ = 0, + SAY_DRAKES_TAKEOFF = 0, + WHISPER_DRAKES_WELCOME = 1, + WHISPER_DRAKES_ABILITIES = 2, + WHISPER_DRAKES_SPECIAL = 3, + WHISPER_DRAKES_LOWHEALTH = 4 }; -class npc_oculus_drake : public CreatureScript +class npc_verdisa_beglaristrasz_eternos : public CreatureScript { public: - npc_oculus_drake() : CreatureScript("npc_oculus_drake") { } - - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) + npc_verdisa_beglaristrasz_eternos() : CreatureScript("npc_verdisa_beglaristrasz_eternos") { } + + InstanceScript* instance; + + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); switch (creature->GetEntry()) @@ -184,6 +227,28 @@ public: return true; } + struct npc_verdisa_beglaristrasz_eternosAI : public ScriptedAI + { + npc_verdisa_beglaristrasz_eternosAI(Creature* creature) : ScriptedAI(creature) { } + + void MovementInform(uint32 type, uint32 id) + { + // When Belgaristraz finish his moving say grateful text + if (me->GetEntry() == NPC_BELGARISTRASZ) + if (id == 0) + { + Talk(SAY_BELGARISTRASZ); + } + // The gossip flag should activate when Drakos die and not from DB + if (id == 0) + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + } + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new npc_verdisa_beglaristrasz_eternosAI(creature); + } }; class npc_image_belgaristrasz : public CreatureScript @@ -193,7 +258,7 @@ public: struct npc_image_belgaristraszAI : public ScriptedAI { - npc_image_belgaristraszAI(Creature* creature) : ScriptedAI(creature) {} + npc_image_belgaristraszAI(Creature* creature) : ScriptedAI(creature) { } void IsSummonedBy(Unit* summoner) { @@ -216,6 +281,176 @@ public: } }; +class npc_ruby_emerald_amber_drake : public CreatureScript +{ +public: + npc_ruby_emerald_amber_drake() : CreatureScript("npc_ruby_emerald_amber_drake") { } + + struct npc_ruby_emerald_amber_drakeAI : public VehicleAI + { + npc_ruby_emerald_amber_drakeAI(Creature* creature) : VehicleAI(creature) + { + instance = creature->GetInstanceScript(); + } + + InstanceScript* instance; + + uint64 summonerGUID; + uint32 WelcomeTimer; + uint32 WelcomeSequelTimer; + uint32 SpecialTimer; + uint32 WarningTimer; + uint32 TakeOffTimer; + + bool WelcomeOff; + bool WelcomeSequelOff; + bool SpecialOff; + bool HealthWarningOff; + bool DisableTakeOff; + + void Reset() + { + summonerGUID = 0; + WelcomeTimer = 4500; + WelcomeSequelTimer = 4500; + SpecialTimer = 10000; + WarningTimer = 25000; + TakeOffTimer = 3500; + + WelcomeOff = false; + WelcomeSequelOff = false; + SpecialOff = false; + HealthWarningOff = false; + DisableTakeOff = false; + } + + void IsSummonedBy(Unit* summoner) + { + if (instance->GetBossState(DATA_EREGOS_EVENT) == IN_PROGRESS) + if (Creature* eregos = me->FindNearestCreature(NPC_EREGOS, 450.0f, true)) + { + eregos->DespawnOrUnsummon(); // On retail this kills abusive call of drake during engaged Eregos + } + summonerGUID = summoner->GetGUID(); + me->SetFacingToObject(summoner); + // TO DO: Drake Ques should be casted from vehicle to player, however the way core handle triggered spells from auras break it no matter the conditions. So this change the caster and give the same result until someone fix triggered spells from auras that involve implicit targets or make exception for this case. + if (me->GetEntry() == NPC_RUBY_DRAKE_VEHICLE) + summoner->CastSpell(summoner, SPELL_RIDE_RUBY_DRAKE_QUE); + if (me->GetEntry() == NPC_EMERALD_DRAKE_VEHICLE) + summoner->CastSpell(summoner, SPELL_RIDE_EMERALD_DRAKE_QUE); + if (me->GetEntry() == NPC_AMBER_DRAKE_VEHICLE) + summoner->CastSpell(summoner, SPELL_RIDE_AMBER_DRAKE_QUE); + Position pos; + summoner->GetPosition(&pos); + me->GetMotionMaster()->MovePoint(0, pos); + } + + void MovementInform(uint32 type, uint32 id) + { + if (type == POINT_MOTION_TYPE && id == 0) + { + me->SetDisableGravity(false); // Needed this for proper animation after spawn, the summon in air fall to ground bug leave no other option for now, if this isn't used the drake will only walk on move. + } + } + + void UpdateAI(const uint32 diff) + { + if (!(instance->GetBossState(DATA_VAROS_EVENT) == DONE)) + { + if (me->HasAuraType(SPELL_AURA_CONTROL_VEHICLE)) + { + if (!(WelcomeOff)) + { + if (WelcomeTimer <= diff) + { + Talk(WHISPER_DRAKES_WELCOME, me->GetCreatorGUID()); + WelcomeOff = true; + WelcomeSequelOff = true; + } + else WelcomeTimer -= diff; + } + } + } + if (me->HasAuraType(SPELL_AURA_CONTROL_VEHICLE)) + { + if (WelcomeSequelOff) + { + if (WelcomeSequelTimer <= diff) + { + Talk(WHISPER_DRAKES_ABILITIES, me->GetCreatorGUID()); + WelcomeSequelOff = false; + } + else WelcomeSequelTimer -= diff; + } + } + if (me->HasAuraType(SPELL_AURA_CONTROL_VEHICLE)) + { + if (instance->GetBossState(DATA_UROM_EVENT) == DONE) + { + if (!(SpecialOff)) + { + if (SpecialTimer <= diff) + { + Talk(WHISPER_DRAKES_SPECIAL, me->GetCreatorGUID()); + SpecialOff = true; + } + else SpecialTimer -= diff; + } + } + } + if (me->HasAuraType(SPELL_AURA_CONTROL_VEHICLE)) + { + if (!(HealthWarningOff)) + { + if (me->GetHealthPct() <= 40.0f) + { + Talk(WHISPER_DRAKES_LOWHEALTH, me->GetCreatorGUID()); + HealthWarningOff = true; + } + } + } + if (me->HasAuraType(SPELL_AURA_CONTROL_VEHICLE)) + { + if (HealthWarningOff) + { + if (WarningTimer <= diff) + { + HealthWarningOff = false; + WarningTimer = 25000; + } + else WarningTimer -= diff; + } + } + if (!(me->HasAuraType(SPELL_AURA_CONTROL_VEHICLE))) + { + if (!(DisableTakeOff)) + { + if (TakeOffTimer <= diff) + { + me->DespawnOrUnsummon(2050); + me->SetOrientation(2.5f); + me->SetSpeed(MOVE_FLIGHT, 1.0f, true); + Talk(SAY_DRAKES_TAKEOFF); + Position pos; + me->GetPosition(&pos); + pos.m_positionX += 10.0f; + pos.m_positionY += 10.0f; + pos.m_positionZ += 12.0f; + me->GetMotionMaster()->MovePoint(1, pos); + DisableTakeOff = true; + } + else TakeOffTimer -= diff; + } + } + }; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new npc_ruby_emerald_amber_drakeAI(creature); + } +}; + class spell_gen_stop_time : public SpellScriptLoader { public: @@ -247,9 +482,50 @@ public: } }; +class spell_call_ruby_emerald_amber_drake : public SpellScriptLoader +{ +public: + spell_call_ruby_emerald_amber_drake() : SpellScriptLoader("spell_call_ruby_emerald_amber_drake") { } + + class spell_call_ruby_emerald_amber_drake_SpellScript : public SpellScript + { + PrepareSpellScript(spell_call_ruby_emerald_amber_drake_SpellScript); + + void ChangeSummonPos(SpellEffIndex /*effIndex*/) + { + // Adjust effect summon position + WorldLocation summonPos = *GetExplTargetDest(); + Position offset = {0.0f, 0.0f, 12.0f, 0.0f}; + summonPos.RelocateOffset(offset); + SetExplTargetDest(summonPos); + GetHitDest()->RelocateOffset(offset); + } + + void ModDestHeight(SpellEffIndex /*effIndex*/) + { + // Used to cast visual effect at proper position + Position offset = {0.0f, 0.0f, 12.0f, 0.0f}; + const_cast(GetExplTargetDest())->RelocateOffset(offset); + } + + void Register() + { + OnEffectHit += SpellEffectFn(spell_call_ruby_emerald_amber_drake_SpellScript::ChangeSummonPos, EFFECT_0, SPELL_EFFECT_SUMMON); + OnEffectLaunch += SpellEffectFn(spell_call_ruby_emerald_amber_drake_SpellScript::ModDestHeight, EFFECT_0, SPELL_EFFECT_SUMMON); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_call_ruby_emerald_amber_drake_SpellScript(); + } +}; + void AddSC_oculus() { - new npc_oculus_drake(); + new npc_verdisa_beglaristrasz_eternos(); new npc_image_belgaristrasz(); + new npc_ruby_emerald_amber_drake(); new spell_gen_stop_time(); + new spell_call_ruby_emerald_amber_drake(); } diff --git a/src/server/scripts/Northrend/Nexus/Oculus/oculus.h b/src/server/scripts/Northrend/Nexus/Oculus/oculus.h index 81d1e9f9ea8..c536b43f905 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/oculus.h +++ b/src/server/scripts/Northrend/Nexus/Oculus/oculus.h @@ -35,15 +35,22 @@ enum Data64 DATA_EREGOS }; -enum Bosses +enum Bosses_NPCs { NPC_DRAKOS = 27654, NPC_VAROS = 27447, NPC_UROM = 27655, NPC_EREGOS = 27656, - NPC_AZURE_RING_GUARDIAN = 28236, - NPC_CENTRIFUGE_CONSTRUCT = 27641, + NPC_AZURE_RING_GUARDIAN = 28236, + NPC_CENTRIFUGE_CONSTRUCT = 27641, + NPC_RUBY_DRAKE_VEHICLE = 27756, + NPC_EMERALD_DRAKE_VEHICLE = 27692, + NPC_AMBER_DRAKE_VEHICLE = 27755, + NPC_VERDISA = 27657, + NPC_BELGARISTRASZ = 27658, + NPC_ETERNOS = 27659, + NPC_GREATER_WHELP = 28276 }; enum GameObjects -- cgit v1.2.3 From 2c961814c1e65feb7e82be193adcea0a0081f00c Mon Sep 17 00:00:00 2001 From: Spp Date: Thu, 4 Oct 2012 12:49:58 +0200 Subject: Core/Battleground: Some minor optimizations here and there. --- src/server/game/Achievements/AchievementMgr.cpp | 4 +- src/server/game/Battlegrounds/Battleground.cpp | 16 +- src/server/game/Battlegrounds/Battleground.h | 34 +-- .../game/Battlegrounds/Zones/BattlegroundAA.h | 8 +- .../game/Battlegrounds/Zones/BattlegroundAB.cpp | 7 +- .../game/Battlegrounds/Zones/BattlegroundAB.h | 32 +-- .../game/Battlegrounds/Zones/BattlegroundAV.cpp | 269 ++++++++++++++++----- .../game/Battlegrounds/Zones/BattlegroundAV.h | 45 ++-- .../game/Battlegrounds/Zones/BattlegroundBE.cpp | 7 +- .../game/Battlegrounds/Zones/BattlegroundBE.h | 20 +- .../game/Battlegrounds/Zones/BattlegroundDS.cpp | 10 +- .../game/Battlegrounds/Zones/BattlegroundDS.h | 22 +- .../game/Battlegrounds/Zones/BattlegroundEY.cpp | 20 +- .../game/Battlegrounds/Zones/BattlegroundEY.h | 35 ++- .../game/Battlegrounds/Zones/BattlegroundIC.cpp | 90 +++---- .../game/Battlegrounds/Zones/BattlegroundIC.h | 61 +++-- .../game/Battlegrounds/Zones/BattlegroundNA.cpp | 17 +- .../game/Battlegrounds/Zones/BattlegroundNA.h | 20 +- .../game/Battlegrounds/Zones/BattlegroundRB.h | 8 +- .../game/Battlegrounds/Zones/BattlegroundRL.cpp | 17 +- .../game/Battlegrounds/Zones/BattlegroundRL.h | 20 +- .../game/Battlegrounds/Zones/BattlegroundRV.cpp | 11 +- .../game/Battlegrounds/Zones/BattlegroundRV.h | 21 +- .../game/Battlegrounds/Zones/BattlegroundSA.cpp | 1 - .../game/Battlegrounds/Zones/BattlegroundSA.h | 31 ++- .../game/Battlegrounds/Zones/BattlegroundWS.cpp | 112 +++++---- .../game/Battlegrounds/Zones/BattlegroundWS.h | 40 +-- src/server/game/Spells/SpellEffects.cpp | 34 +-- 28 files changed, 521 insertions(+), 491 deletions(-) (limited to 'src/server/game/Spells') diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp index 93a3378c3c5..b77de70c399 100755 --- a/src/server/game/Achievements/AchievementMgr.cpp +++ b/src/server/game/Achievements/AchievementMgr.cpp @@ -376,7 +376,9 @@ bool AchievementCriteriaData::Meets(uint32 criteria_id, Player const* source, Un Battleground* bg = source->GetBattleground(); if (!bg) return false; - return bg->IsTeamScoreInRange(source->GetTeam() == ALLIANCE ? HORDE : ALLIANCE, bg_loss_team_score.min_score, bg_loss_team_score.max_score); + + uint32 score = bg->GetTeamScore(source->GetTeamId() == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE); + return score >= bg_loss_team_score.min_score && score <= bg_loss_team_score.max_score; } case ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT: { diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index 74fb3b7c878..b33140a3419 100755 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -1907,13 +1907,6 @@ WorldSafeLocsEntry const* Battleground::GetClosestGraveYard(Player* player) return sObjectMgr->GetClosestGraveYard(player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), player->GetTeam()); } -bool Battleground::IsTeamScoreInRange(uint32 team, uint32 minScore, uint32 maxScore) const -{ - TeamId teamIndex = GetTeamIndexByTeamId(team); - uint32 score = std::max(m_TeamScores[teamIndex], 0); - return score >= minScore && score <= maxScore; -} - void Battleground::StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry) { for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr) @@ -1933,6 +1926,15 @@ void Battleground::RewardXPAtKill(Player* killer, Player* victim) killer->RewardPlayerAndGroupAtKill(victim, true); } +uint32 Battleground::GetTeamScore(uint32 teamId) const +{ + if (teamId == TEAM_ALLIANCE || teamId == TEAM_HORDE) + return m_TeamScores[teamId]; + + sLog->outError(LOG_FILTER_BATTLEGROUND, "GetTeamScore with wrong Team %u for BG %u", teamId, GetTypeID()); + return 0; +} + void Battleground::HandleAreaTrigger(Player* player, uint32 trigger) { sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Unhandled AreaTrigger %u in Battleground %u. Player coords (x: %f, y: %f, z: %f)", diff --git a/src/server/game/Battlegrounds/Battleground.h b/src/server/game/Battlegrounds/Battleground.h index 4d376f05d69..6d188d1367a 100755 --- a/src/server/game/Battlegrounds/Battleground.h +++ b/src/server/game/Battlegrounds/Battleground.h @@ -274,20 +274,20 @@ enum GroupJoinBattlegroundResult ERR_IN_NON_RANDOM_BG = -15 // Can't queue for Random Battleground while in another Battleground queue. }; -class BattlegroundScore +struct BattlegroundScore { - public: - BattlegroundScore() : KillingBlows(0), Deaths(0), HonorableKills(0), - BonusHonor(0), DamageDone(0), HealingDone(0) - {} - virtual ~BattlegroundScore() {} //virtual destructor is used when deleting score from scores map - - uint32 KillingBlows; - uint32 Deaths; - uint32 HonorableKills; - uint32 BonusHonor; - uint32 DamageDone; - uint32 HealingDone; + BattlegroundScore() : KillingBlows(0), Deaths(0), HonorableKills(0), BonusHonor(0), + DamageDone(0), HealingDone(0) + { } + + virtual ~BattlegroundScore() { } //virtual destructor is used when deleting score from scores map + + uint32 KillingBlows; + uint32 Deaths; + uint32 HonorableKills; + uint32 BonusHonor; + uint32 DamageDone; + uint32 HealingDone; }; enum BGHonorMode @@ -328,7 +328,6 @@ class Battleground /* achievement req. */ virtual bool IsAllNodesConrolledByTeam(uint32 /*team*/) const { return false; } - bool IsTeamScoreInRange(uint32 team, uint32 minScore, uint32 maxScore) const; void StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry); /* Battleground */ @@ -561,13 +560,12 @@ class Battleground bool ToBeDeleted() const { return m_SetDeleteThis; } void SetDeleteThis() { m_SetDeleteThis = true; } - // virtual score-array - get's used in bg-subclasses - int32 m_TeamScores[BG_TEAMS_COUNT]; - void RewardXPAtKill(Player* killer, Player* victim); bool CanAwardArenaPoints() const { return m_LevelMin >= BG_AWARD_ARENA_POINTS_MIN_LEVEL; } virtual uint64 GetFlagPickerGUID(int32 /*team*/ = -1) const { return 0; } + virtual void SetDroppedFlagGUID(uint64 /*guid*/, int32 /*team*/ = -1) {} + uint32 GetTeamScore(uint32 TeamID) const; protected: // this method is called, when BG cannot spawn its own spirit guide, or something is wrong, It correctly ends Battleground @@ -606,6 +604,8 @@ class Battleground bool m_IsRandom; BGHonorMode m_HonorMode; + int32 m_TeamScores[BG_TEAMS_COUNT]; + private: // Battleground BattlegroundTypeId m_TypeID; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAA.h b/src/server/game/Battlegrounds/Zones/BattlegroundAA.h index 79af4269fbf..f17de911ae9 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAA.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAA.h @@ -24,7 +24,7 @@ class BattlegroundAAScore : public BattlegroundScore { public: BattlegroundAAScore() {}; - virtual ~BattlegroundAAScore() {}; + ~BattlegroundAAScore() {}; //TODO fix me }; @@ -35,9 +35,9 @@ class BattlegroundAA : public Battleground ~BattlegroundAA(); /* inherited from BattlegroundClass */ - virtual void AddPlayer(Player* player); - virtual void StartingEventCloseDoors(); - virtual void StartingEventOpenDoors(); + void AddPlayer(Player* player); + void StartingEventCloseDoors(); + void StartingEventOpenDoors(); void RemovePlayer(Player* player, uint64 guid, uint32 team); void HandleAreaTrigger(Player* Source, uint32 Trigger); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp index fb855f7828f..5a887c647b1 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp @@ -16,12 +16,11 @@ * with this program. If not, see . */ +#include "BattlegroundAB.h" #include "World.h" #include "WorldPacket.h" #include "ObjectMgr.h" #include "BattlegroundMgr.h" -#include "Battleground.h" -#include "BattlegroundAB.h" #include "Creature.h" #include "Language.h" #include "Object.h" @@ -622,12 +621,12 @@ void BattlegroundAB::Reset() void BattlegroundAB::EndBattleground(uint32 winner) { - //win reward + // 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) + // Complete map_end rewards (even if no team wins) RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE); RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h index a7ec4ad700f..63c89717c8f 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h @@ -15,10 +15,11 @@ * You should have received a copy of the GNU General Public License along * with this program. If not, see . */ + #ifndef __BATTLEGROUNDAB_H #define __BATTLEGROUNDAB_H -class Battleground; +#include "Battleground.h" enum BG_AB_WorldStates { @@ -236,13 +237,12 @@ struct BG_AB_BannerTimer uint8 teamIndex; }; -class BattlegroundABScore : public BattlegroundScore +struct BattlegroundABScore : public BattlegroundScore { - public: - BattlegroundABScore(): BasesAssaulted(0), BasesDefended(0) {}; - virtual ~BattlegroundABScore() {}; - uint32 BasesAssaulted; - uint32 BasesDefended; + BattlegroundABScore(): BasesAssaulted(0), BasesDefended(0) { } + ~BattlegroundABScore() { } + uint32 BasesAssaulted; + uint32 BasesDefended; }; class BattlegroundAB : public Battleground @@ -252,28 +252,28 @@ class BattlegroundAB : public Battleground ~BattlegroundAB(); void AddPlayer(Player* player); - virtual void StartingEventCloseDoors(); - virtual void StartingEventOpenDoors(); + void StartingEventCloseDoors(); + void StartingEventOpenDoors(); void RemovePlayer(Player* player, uint64 guid, uint32 team); void HandleAreaTrigger(Player* Source, uint32 Trigger); - virtual bool SetupBattleground(); - virtual void Reset(); + bool SetupBattleground(); + void Reset(); void EndBattleground(uint32 winner); - virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player); + WorldSafeLocsEntry const* GetClosestGraveYard(Player* player); /* Scorekeeping */ - virtual void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true); + void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true); - virtual void FillInitialWorldStates(WorldPacket& data); + void FillInitialWorldStates(WorldPacket& data); /* Nodes occupying */ - virtual void EventPlayerClickedOnFlag(Player* source, GameObject* target_obj); + void EventPlayerClickedOnFlag(Player* source, GameObject* target_obj); /* achievement req. */ bool IsAllNodesConrolledByTeam(uint32 team) const; // overwrited bool IsTeamScores500Disadvantage(uint32 team) const { return m_TeamScores500Disadvantage[GetTeamIndexByTeamId(team)]; } private: - virtual void PostUpdateImpl(uint32 diff); + void PostUpdateImpl(uint32 diff); /* Gameobject spawning/despawning */ void _CreateBanner(uint8 node, uint8 type, uint8 teamIndex, bool delay); void _DelBanner(uint8 node, uint8 type, uint8 teamIndex); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp index 61dd4cb6fd4..c57eeff9911 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp @@ -269,14 +269,30 @@ Creature* BattlegroundAV::AddAVCreature(uint16 cinfoid, uint16 type) { type -= AV_CPLACE_MAX; cinfoid=uint16(BG_AV_StaticCreaturePos[type][4]); - creature = AddCreature(BG_AV_StaticCreatureInfo[cinfoid][0], (type+AV_CPLACE_MAX), BG_AV_StaticCreatureInfo[cinfoid][1], BG_AV_StaticCreaturePos[type][0], BG_AV_StaticCreaturePos[type][1], BG_AV_StaticCreaturePos[type][2], BG_AV_StaticCreaturePos[type][3]); - level = (BG_AV_StaticCreatureInfo[cinfoid][2] == BG_AV_StaticCreatureInfo[cinfoid][3]) ? BG_AV_StaticCreatureInfo[cinfoid][2] : urand(BG_AV_StaticCreatureInfo[cinfoid][2], BG_AV_StaticCreatureInfo[cinfoid][3]); + creature = AddCreature(BG_AV_StaticCreatureInfo[cinfoid][0], + (type+AV_CPLACE_MAX), + BG_AV_StaticCreatureInfo[cinfoid][1], + BG_AV_StaticCreaturePos[type][0], + BG_AV_StaticCreaturePos[type][1], + BG_AV_StaticCreaturePos[type][2], + BG_AV_StaticCreaturePos[type][3]); + level = (BG_AV_StaticCreatureInfo[cinfoid][2] == BG_AV_StaticCreatureInfo[cinfoid][3]) + ? BG_AV_StaticCreatureInfo[cinfoid][2] + : urand(BG_AV_StaticCreatureInfo[cinfoid][2], BG_AV_StaticCreatureInfo[cinfoid][3]); isStatic = true; } else { - creature = AddCreature(BG_AV_CreatureInfo[cinfoid][0], type, BG_AV_CreatureInfo[cinfoid][1], BG_AV_CreaturePos[type][0], BG_AV_CreaturePos[type][1], BG_AV_CreaturePos[type][2], BG_AV_CreaturePos[type][3]); - level = (BG_AV_CreatureInfo[cinfoid][2] == BG_AV_CreatureInfo[cinfoid][3]) ? BG_AV_CreatureInfo[cinfoid][2] : urand(BG_AV_CreatureInfo[cinfoid][2], BG_AV_CreatureInfo[cinfoid][3]); + creature = AddCreature(BG_AV_CreatureInfo[cinfoid][0], + type, + BG_AV_CreatureInfo[cinfoid][1], + BG_AV_CreaturePos[type][0], + BG_AV_CreaturePos[type][1], + BG_AV_CreaturePos[type][2], + BG_AV_CreaturePos[type][3]); + level = (BG_AV_CreatureInfo[cinfoid][2] == BG_AV_CreatureInfo[cinfoid][3]) + ? BG_AV_CreatureInfo[cinfoid][2] + : urand(BG_AV_CreatureInfo[cinfoid][2], BG_AV_CreatureInfo[cinfoid][3]); } if (!creature) return NULL; @@ -329,7 +345,13 @@ Creature* BattlegroundAV::AddAVCreature(uint16 cinfoid, uint16 type) } if (triggerSpawnID && newFaction) { - if (Creature* trigger = AddCreature(WORLD_TRIGGER, triggerSpawnID, BG_AV_CreatureInfo[creature->GetEntry()][1], BG_AV_CreaturePos[triggerSpawnID][0], BG_AV_CreaturePos[triggerSpawnID][1], BG_AV_CreaturePos[triggerSpawnID][2], BG_AV_CreaturePos[triggerSpawnID][3])) + if (Creature* trigger = AddCreature(WORLD_TRIGGER, + triggerSpawnID, + BG_AV_CreatureInfo[creature->GetEntry()][1], + BG_AV_CreaturePos[triggerSpawnID][0], + BG_AV_CreaturePos[triggerSpawnID][1], + BG_AV_CreaturePos[triggerSpawnID][2], + BG_AV_CreaturePos[triggerSpawnID][3])) { trigger->setFaction(newFaction); trigger->CastSpell(trigger, SPELL_HONORABLE_DEFENDER_25Y, false); @@ -433,15 +455,14 @@ void BattlegroundAV::AddPlayer(Player* player) PlayerScores[player->GetGUID()] = sc; if (m_MaxLevel == 0) m_MaxLevel=(player->getLevel()%10 == 0)? player->getLevel() : (player->getLevel()-(player->getLevel()%10))+10; //TODO: just look at the code \^_^/ --but queue-info should provide this information.. - } void BattlegroundAV::EndBattleground(uint32 winner) { //calculate bonuskills for both teams: //first towers: - uint8 kills[2]={0, 0}; //0=ally 1=horde - uint8 rep[2]={0, 0}; //0=ally 1=horde + uint8 kills[2] = {0, 0}; // 0 = Alliance 1 = Horde + uint8 rep[2] = {0, 0}; // 0 = Alliance 1 = Horde for (BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_FROSTWOLF_WTOWER; ++i) { if (m_Nodes[i].State == POINT_CONTROLED) @@ -459,7 +480,7 @@ void BattlegroundAV::EndBattleground(uint32 winner) } } - for (int i=0; i <= 1; i++) //0=ally 1=horde + for (int i = TEAM_ALLIANCE; i <= TEAM_HORDE; ++i) { if (m_CaptainAlive[i]) { @@ -467,9 +488,9 @@ void BattlegroundAV::EndBattleground(uint32 winner) rep[i] += BG_AV_REP_SURVIVING_CAPTAIN; } if (rep[i] != 0) - RewardReputationToTeam((i == 0)?730:729, rep[i], (i == 0)?ALLIANCE:HORDE); + RewardReputationToTeam(i == 0 ? 730 : 729, rep[i], i == 0 ? ALLIANCE : HORDE); if (kills[i] != 0) - RewardHonorToTeam(GetBonusHonor(kills[i]), (i == 0)?ALLIANCE:HORDE); + RewardHonorToTeam(GetBonusHonor(kills[i]), i == 0 ? ALLIANCE : HORDE); } //TODO add enterevademode for all attacking creatures @@ -525,7 +546,6 @@ void BattlegroundAV::HandleAreaTrigger(Player* player, uint32 trigger) void BattlegroundAV::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor) { - BattlegroundScoreMap::iterator itr = PlayerScores.find(Source->GetGUID()); if (itr == PlayerScores.end()) // player not found... return; @@ -565,7 +585,6 @@ void BattlegroundAV::UpdatePlayerScore(Player* Source, uint32 type, uint32 value void BattlegroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node) { - uint32 object = GetObjectThroughNode(node); sLog->outDebug(LOG_FILTER_BATTLEGROUND, "bg_av: player destroyed point node %i object %i", node, object); @@ -587,8 +606,8 @@ void BattlegroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node) for (uint8 i=0; i <= 9; i++) SpawnBGObject(BG_AV_OBJECT_BURN_DUNBALDAR_SOUTH + i + (tmp * 10), RESPAWN_IMMEDIATELY); - UpdateScore((owner == ALLIANCE) ? HORDE : ALLIANCE, (-1)*BG_AV_RES_TOWER); - RewardReputationToTeam((owner == ALLIANCE)?730:729, BG_AV_REP_TOWER, owner); + UpdateScore((owner == ALLIANCE) ? HORDE : ALLIANCE, -1 * BG_AV_RES_TOWER); + RewardReputationToTeam(owner == ALLIANCE ? 730 : 729, BG_AV_REP_TOWER, owner); RewardHonorToTeam(GetBonusHonor(BG_AV_KILL_TOWER), owner); SpawnBGObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+GetTeamIndexByTeamId(owner)+(2*tmp), RESPAWN_ONE_DAY); @@ -625,8 +644,10 @@ void BattlegroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node) } void BattlegroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial) -{ //mine=0 northmine mine=1 southmin -//changing the owner results in setting respawntim to infinite for current creatures, spawning new mine owners creatures and changing the chest-objects so that the current owning team can use them +{ + // mine=0 northmine mine=1 southmin + // changing the owner results in setting respawntim to infinite for current creatures, + // spawning new mine owners creatures and changing the chest-objects so that the current owning team can use them ASSERT(mine == AV_NORTH_MINE || mine == AV_SOUTH_MINE); if (team != ALLIANCE && team != HORDE) team = AV_NEUTRAL_TEAM; @@ -689,16 +710,13 @@ void BattlegroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial) for (uint16 i=((mine == AV_NORTH_MINE)?AV_CPLACE_MINE_N_2_MIN:AV_CPLACE_MINE_S_2_MIN); i <= ((mine == AV_NORTH_MINE)?AV_CPLACE_MINE_N_2_MAX:AV_CPLACE_MINE_S_2_MAX); i++) AddAVCreature(miner+(urand(1, 2)), i); AddAVCreature(miner+3, (mine == AV_NORTH_MINE)?AV_CPLACE_MINE_N_3:AV_CPLACE_MINE_S_3); - //because the gameobjects in this mine have changed, update all surrounding players: -// for (uint16 i = ((mine == AV_NORTH_MINE)?BG_AV_OBJECT_MINE_SUPPLY_N_MIN:BG_AV_OBJECT_MINE_SUPPLY_N_MIN); i <= ((mine == AV_NORTH_MINE)?BG_AV_OBJECT_MINE_SUPPLY_N_MAX:BG_AV_OBJECT_MINE_SUPPLY_N_MAX); i++) -// { - //TODO: add gameobject-update code -// } + if (team == ALLIANCE || team == HORDE) { m_Mine_Reclaim_Timer[mine]=AV_MINE_RECLAIM_TIMER; char buf[256]; - sprintf(buf, GetTrinityString(LANG_BG_AV_MINE_TAKEN), GetTrinityString((mine == AV_NORTH_MINE) ? LANG_BG_AV_MINE_NORTH : LANG_BG_AV_MINE_SOUTH), (team == ALLIANCE) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE)); + sprintf(buf, GetTrinityString(LANG_BG_AV_MINE_TAKEN), GetTrinityString((mine == AV_NORTH_MINE) ? LANG_BG_AV_MINE_NORTH : LANG_BG_AV_MINE_SOUTH), + (team == ALLIANCE) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE)); Creature* creature = GetBGCreature(AV_CPLACE_HERALD); if (creature) YellToAll(creature, buf, LANG_UNIVERSAL); @@ -748,7 +766,6 @@ void BattlegroundAV::PopulateNode(BG_AV_Nodes node) DelCreature(node); if (!AddSpiritGuide(node, BG_AV_CreaturePos[node][0], BG_AV_CreaturePos[node][1], BG_AV_CreaturePos[node][2], BG_AV_CreaturePos[node][3], owner)) sLog->outError(LOG_FILTER_BATTLEGROUND, "AV: couldn't spawn spiritguide at node %i", node); - } for (uint8 i=0; i<4; i++) AddAVCreature(creatureid, c_place+i); @@ -757,7 +774,15 @@ void BattlegroundAV::PopulateNode(BG_AV_Nodes node) return; Creature* trigger = GetBGCreature(node + 302);//0-302 other creatures if (!trigger) - trigger = AddCreature(WORLD_TRIGGER, node + 302, owner, BG_AV_CreaturePos[node + 302][0], BG_AV_CreaturePos[node + 302][1], BG_AV_CreaturePos[node + 302][2], BG_AV_CreaturePos[node + 302][3]); + { + trigger = AddCreature(WORLD_TRIGGER, + node + 302, + owner, + BG_AV_CreaturePos[node + 302][0], + BG_AV_CreaturePos[node + 302][1], + BG_AV_CreaturePos[node + 302][2], + BG_AV_CreaturePos[node + 302][3]); + } //add bonus honor aura trigger creature when node is accupied //cast bonus aura (+50% honor in 25yards) @@ -937,7 +962,8 @@ void BattlegroundAV::EventPlayerDefendsPoint(Player* player, uint32 object) } //send a nice message to all :) char buf[256]; - sprintf(buf, GetTrinityString((IsTower(node)) ? LANG_BG_AV_TOWER_DEFENDED : LANG_BG_AV_GRAVE_DEFENDED), GetNodeName(node), (team == ALLIANCE) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE)); + sprintf(buf, GetTrinityString((IsTower(node)) ? LANG_BG_AV_TOWER_DEFENDED : LANG_BG_AV_GRAVE_DEFENDED), GetNodeName(node), + (team == ALLIANCE) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE)); Creature* creature = GetBGCreature(AV_CPLACE_HERALD); if (creature) YellToAll(creature, buf, LANG_UNIVERSAL); @@ -1051,7 +1077,8 @@ void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object) //send a nice message to all :) char buf[256]; - sprintf(buf, (IsTower(node)) ? GetTrinityString(LANG_BG_AV_TOWER_ASSAULTED) : GetTrinityString(LANG_BG_AV_GRAVE_ASSAULTED), GetNodeName(node), (team == ALLIANCE) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE)); + sprintf(buf, (IsTower(node)) ? GetTrinityString(LANG_BG_AV_TOWER_ASSAULTED) : GetTrinityString(LANG_BG_AV_GRAVE_ASSAULTED), GetNodeName(node), + (team == ALLIANCE) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE)); Creature* creature = GetBGCreature(AV_CPLACE_HERALD); if (creature) YellToAll(creature, buf, LANG_UNIVERSAL); @@ -1193,9 +1220,13 @@ bool BattlegroundAV::SetupBattleground() // Create starting objects if ( // alliance gates - !AddObject(BG_AV_OBJECT_DOOR_A, BG_AV_OBJECTID_GATE_A, BG_AV_DoorPositons[0][0], BG_AV_DoorPositons[0][1], BG_AV_DoorPositons[0][2], BG_AV_DoorPositons[0][3], 0, 0, std::sin(BG_AV_DoorPositons[0][3]/2), std::cos(BG_AV_DoorPositons[0][3]/2), RESPAWN_IMMEDIATELY) + !AddObject(BG_AV_OBJECT_DOOR_A, BG_AV_OBJECTID_GATE_A, + BG_AV_DoorPositons[0][0], BG_AV_DoorPositons[0][1], BG_AV_DoorPositons[0][2], BG_AV_DoorPositons[0][3], + 0, 0, std::sin(BG_AV_DoorPositons[0][3]/2), std::cos(BG_AV_DoorPositons[0][3]/2), RESPAWN_IMMEDIATELY) // horde gates - || !AddObject(BG_AV_OBJECT_DOOR_H, BG_AV_OBJECTID_GATE_H, BG_AV_DoorPositons[1][0], BG_AV_DoorPositons[1][1], BG_AV_DoorPositons[1][2], BG_AV_DoorPositons[1][3], 0, 0, std::sin(BG_AV_DoorPositons[1][3]/2), std::cos(BG_AV_DoorPositons[1][3]/2), RESPAWN_IMMEDIATELY)) + || !AddObject(BG_AV_OBJECT_DOOR_H, BG_AV_OBJECTID_GATE_H, + BG_AV_DoorPositons[1][0], BG_AV_DoorPositons[1][1], BG_AV_DoorPositons[1][2], BG_AV_DoorPositons[1][3], + 0, 0, std::sin(BG_AV_DoorPositons[1][3]/2), std::cos(BG_AV_DoorPositons[1][3]/2), RESPAWN_IMMEDIATELY)) { sLog->outError(LOG_FILTER_SQL, "BatteGroundAV: Failed to spawn some object Battleground not created!1"); return false; @@ -1206,14 +1237,28 @@ bool BattlegroundAV::SetupBattleground() { if (i <= BG_AV_NODES_FROSTWOLF_HUT) { - if (!AddObject(i, BG_AV_OBJECTID_BANNER_A_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY) - || !AddObject(i+11, BG_AV_OBJECTID_BANNER_CONT_A_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY) - || !AddObject(i+33, BG_AV_OBJECTID_BANNER_H_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY) - || !AddObject(i+22, BG_AV_OBJECTID_BANNER_CONT_H_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY) + if (!AddObject(i, BG_AV_OBJECTID_BANNER_A_B, + BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], + 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY) + || !AddObject(i+11, BG_AV_OBJECTID_BANNER_CONT_A_B, + BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], + 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY) + || !AddObject(i+33, BG_AV_OBJECTID_BANNER_H_B, + BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], + 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY) + || !AddObject(i+22, BG_AV_OBJECTID_BANNER_CONT_H_B, + BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], + 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY) //aura - || !AddObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION+i*3, BG_AV_OBJECTID_AURA_N, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY) - || !AddObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+i*3, BG_AV_OBJECTID_AURA_A, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY) - || !AddObject(BG_AV_OBJECT_AURA_H_FIRSTAID_STATION+i*3, BG_AV_OBJECTID_AURA_H, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)) + || !AddObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION+i*3, BG_AV_OBJECTID_AURA_N, + BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], + 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+i*3, BG_AV_OBJECTID_AURA_A, + BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], + 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AV_OBJECT_AURA_H_FIRSTAID_STATION+i*3, BG_AV_OBJECTID_AURA_H, + BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], + 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)) { sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!2"); return false; @@ -1223,12 +1268,24 @@ bool BattlegroundAV::SetupBattleground() { if (i <= BG_AV_NODES_STONEHEART_BUNKER) //alliance towers { - if (!AddObject(i, BG_AV_OBJECTID_BANNER_A, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY) - || !AddObject(i+22, BG_AV_OBJECTID_BANNER_CONT_H, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY) - || !AddObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_A, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY) - || !AddObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_N, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY) - || !AddObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_A, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY) - || !AddObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_PH, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)) + if (!AddObject(i, BG_AV_OBJECTID_BANNER_A, + BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], + 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY) + || !AddObject(i+22, BG_AV_OBJECTID_BANNER_CONT_H, + BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], + 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_A, + BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], + 0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_N, + BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], + 0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_A, + BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], + 0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_PH, + BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], + 0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)) { sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!3"); return false; @@ -1236,12 +1293,24 @@ bool BattlegroundAV::SetupBattleground() } else //horde towers { - if (!AddObject(i+7, BG_AV_OBJECTID_BANNER_CONT_A, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY) - || !AddObject(i+29, BG_AV_OBJECTID_BANNER_H, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY) - || !AddObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_N, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY) - || !AddObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_H, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY) - || !AddObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_PA, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY) - || !AddObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_H, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)) + if (!AddObject(i+7, BG_AV_OBJECTID_BANNER_CONT_A, + BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], + 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY) + || !AddObject(i+29, BG_AV_OBJECTID_BANNER_H, + BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], + 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_N, + BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], + 0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_H, + BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], + 0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_PA, + BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], + 0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_H, + BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], + 0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)) { sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!4"); return false; @@ -1249,7 +1318,17 @@ bool BattlegroundAV::SetupBattleground() } for (uint8 j=0; j <= 9; j++) //burning aura { - if (!AddObject(BG_AV_OBJECT_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j, BG_AV_OBJECTID_FIRE, BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][0], BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][1], BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][2], BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3], 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3]/2), std::cos(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3]/2), RESPAWN_ONE_DAY)) + if (!AddObject(BG_AV_OBJECT_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j, + BG_AV_OBJECTID_FIRE, + BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][0], + BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][1], + BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][2], + BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3], + 0, + 0, + std::sin(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3]/2), + std::cos(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3]/2), + RESPAWN_ONE_DAY)) { sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!5.%i", i); return false; @@ -1263,7 +1342,17 @@ bool BattlegroundAV::SetupBattleground() { if (j<5) { - if (!AddObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE+(i*10)+j, BG_AV_OBJECTID_SMOKE, BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][0], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][1], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][2], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3], 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), std::cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), RESPAWN_ONE_DAY)) + if (!AddObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE+(i*10)+j, + BG_AV_OBJECTID_SMOKE, + BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][0], + BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][1], + BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][2], + BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3], + 0, + 0, + std::sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), + std::cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), + RESPAWN_ONE_DAY)) { sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!6.%i", i); return false; @@ -1271,7 +1360,17 @@ bool BattlegroundAV::SetupBattleground() } else { - if (!AddObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE+(i*10)+j, BG_AV_OBJECTID_FIRE, BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][0], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][1], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][2], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3], 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), std::cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), RESPAWN_ONE_DAY)) + if (!AddObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE+(i*10)+j, + BG_AV_OBJECTID_FIRE, + BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][0], + BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][1], + BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][2], + BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3], + 0, + 0, + std::sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), + std::cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), + RESPAWN_ONE_DAY)) { sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!7.%i", i); return false; @@ -1281,7 +1380,17 @@ bool BattlegroundAV::SetupBattleground() } for (uint16 i= 0; i <= (BG_AV_OBJECT_MINE_SUPPLY_N_MAX-BG_AV_OBJECT_MINE_SUPPLY_N_MIN); i++) { - if (!AddObject(BG_AV_OBJECT_MINE_SUPPLY_N_MIN+i, BG_AV_OBJECTID_MINE_N, BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][0], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][1], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][2], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3], 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3]/2), std::cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3]/2), RESPAWN_ONE_DAY)) + if (!AddObject(BG_AV_OBJECT_MINE_SUPPLY_N_MIN+i, + BG_AV_OBJECTID_MINE_N, + BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][0], + BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][1], + BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][2], + BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3], + 0, + 0, + std::sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3]/2), + std::cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3]/2), + RESPAWN_ONE_DAY)) { sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some mine supplies Battleground not created!7.5.%i", i); return false; @@ -1289,24 +1398,52 @@ bool BattlegroundAV::SetupBattleground() } for (uint16 i= 0; i <= (BG_AV_OBJECT_MINE_SUPPLY_S_MAX-BG_AV_OBJECT_MINE_SUPPLY_S_MIN); i++) { - if (!AddObject(BG_AV_OBJECT_MINE_SUPPLY_S_MIN+i, BG_AV_OBJECTID_MINE_S, BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][0], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][1], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][2], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3], 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3]/2), std::cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3]/2), RESPAWN_ONE_DAY)) + if (!AddObject(BG_AV_OBJECT_MINE_SUPPLY_S_MIN+i, + BG_AV_OBJECTID_MINE_S, + BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][0], + BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][1], + BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][2], + BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3], + 0, + 0, + std::sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3]/2), + std::cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3]/2), + RESPAWN_ONE_DAY)) { sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some mine supplies Battleground not created!7.6.%i", i); return false; } } - if (!AddObject(BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE, BG_AV_OBJECTID_BANNER_SNOWFALL_N, BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][0], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][1], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][2], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3], 0, 0, std::sin(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2), std::cos(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2), RESPAWN_ONE_DAY)) + if (!AddObject(BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE, + BG_AV_OBJECTID_BANNER_SNOWFALL_N, + BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][0], + BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][1], + BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][2], + BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3], + 0, + 0, + std::sin(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2), + std::cos(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2), + RESPAWN_ONE_DAY)) { sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!8"); return false; } for (uint8 i = 0; i < 4; i++) { - if (!AddObject(BG_AV_OBJECT_SNOW_EYECANDY_A+i, BG_AV_OBJECTID_SNOWFALL_CANDY_A, BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), std::cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY) - || !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_PA+i, BG_AV_OBJECTID_SNOWFALL_CANDY_PA, BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), std::cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY) - || !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_H+i, BG_AV_OBJECTID_SNOWFALL_CANDY_H, BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), std::cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY) - || !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_PH+i, BG_AV_OBJECTID_SNOWFALL_CANDY_PH, BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), std::cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY)) + if (!AddObject(BG_AV_OBJECT_SNOW_EYECANDY_A+i, BG_AV_OBJECTID_SNOWFALL_CANDY_A, + BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], + 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), std::cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_PA+i, BG_AV_OBJECTID_SNOWFALL_CANDY_PA, + BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], + 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), std::cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_H+i, BG_AV_OBJECTID_SNOWFALL_CANDY_H, + BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], + 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), std::cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_PH+i, BG_AV_OBJECTID_SNOWFALL_CANDY_PH, + BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], + 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), std::cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY)) { sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!9.%i", i); return false; @@ -1355,10 +1492,10 @@ bool BattlegroundAV::SetupBattleground() //creatures sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV start poputlating nodes"); - for (i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i) + for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i) { if (m_Nodes[i].Owner) - PopulateNode(BG_AV_Nodes(i)); + PopulateNode(i); } //all creatures which don't get despawned through the script are static sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV: start spawning static creatures"); @@ -1376,7 +1513,7 @@ bool BattlegroundAV::SetupBattleground() return true; } -const char* BattlegroundAV::GetNodeName(BG_AV_Nodes node) +char const* BattlegroundAV::GetNodeName(BG_AV_Nodes node) { switch (node) { @@ -1408,22 +1545,22 @@ void BattlegroundAV::AssaultNode(BG_AV_Nodes node, uint16 team) if (m_Nodes[node].TotalOwner == team) { sLog->outFatal(LOG_FILTER_BATTLEGROUND, "Assaulting team is TotalOwner of node"); - ASSERT (false); + ASSERT(false); } if (m_Nodes[node].Owner == team) { sLog->outFatal(LOG_FILTER_BATTLEGROUND, "Assaulting team is owner of node"); - ASSERT (false); + ASSERT(false); } if (m_Nodes[node].State == POINT_DESTROYED) { sLog->outFatal(LOG_FILTER_BATTLEGROUND, "Destroyed node is being assaulted"); - ASSERT (false); + ASSERT(false); } if (m_Nodes[node].State == POINT_ASSAULTED && m_Nodes[node].TotalOwner) //only assault an assaulted node if no totalowner exists { sLog->outFatal(LOG_FILTER_BATTLEGROUND, "Assault on an not assaulted node with total owner"); - ASSERT (false); + ASSERT(false); } //the timer gets another time, if the previous owner was 0 == Neutral m_Nodes[node].Timer = (m_Nodes[node].PrevOwner)? BG_AV_CAPTIME : BG_AV_SNOWFALL_FIRSTCAP; @@ -1471,6 +1608,7 @@ void BattlegroundAV::DefendNode(BG_AV_Nodes node, uint16 team) void BattlegroundAV::ResetBGSubclass() { m_MaxLevel=0; + for (uint8 i=0; i<2; i++) //forloop for both teams (it just make 0 == alliance and 1 == horde also for both mines 0=north 1=south { for (uint8 j=0; j<9; j++) @@ -1482,6 +1620,7 @@ void BattlegroundAV::ResetBGSubclass() m_Mine_Owner[i] = AV_NEUTRAL_TEAM; m_Mine_PrevOwner[i] = m_Mine_Owner[i]; } + for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i <= BG_AV_NODES_STONEHEART_GRAVE; ++i) //alliance graves InitNode(i, ALLIANCE, false); for (BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_STONEHEART_BUNKER; ++i) //alliance towers diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h index 5a80594f1da..28d524977fc 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h @@ -96,7 +96,6 @@ horde: AV_SOUND_ALLIANCE_CAPTAIN = 8232, //gets called when someone attacks them and at the beginning after 3min+rand(x)*10sec (maybe buff) AV_SOUND_HORDE_CAPTAIN = 8333 - }; enum BG_AV_OTHER_VALUES @@ -986,7 +985,6 @@ const float BG_AV_CreaturePos[AV_CPLACE_MAX][4] = enum BG_AV_CreatureIds { - AV_NPC_A_TOWERDEFENSE = 0, // stormpike bowman AV_NPC_A_GRAVEDEFENSE0 = 1, // stormpike Defender AV_NPC_A_GRAVEDEFENSE1 = 2, // seasoned defender @@ -1038,7 +1036,6 @@ enum BG_AV_CreatureIds AV_NPC_S_MINE_H_4 = 46, AV_NPC_HERALD = 47, AV_NPC_INFO_MAX = 48 - }; //entry, team, minlevel, maxlevel @@ -1100,7 +1097,6 @@ const uint32 BG_AV_CreatureInfo[AV_NPC_INFO_MAX][4] = {13089, 67, 54, 55}, //guard {13088, 67, 58, 58}, {14848, 67, 58, 58} //Herald - }; //x, y, z, o, static_creature_info-id @@ -1230,7 +1226,6 @@ const float BG_AV_StaticCreaturePos[AV_STATICCPLACE_MAX][5] = {773.651f, -497.482f, 99.0408f, 2.11185f, 46 }, //14284 - Stormpike Battleguard {949.1f, -506.913f, 95.4237f, 3.31613f, 46 }, //14284 - Stormpike Battleguard {-1370.9f, -219.793f, 98.4258f, 5.04381f, 47}, //drek thar - }; const uint32 BG_AV_StaticCreatureInfo[51][4] = @@ -1439,7 +1434,6 @@ enum BG_AV_WorldStates AV_FROSTWOLFE_UNUSED = 1393, AV_FROSTWOLFW_UNUSED = 1392 */ - }; //alliance_control neutral_control horde_control @@ -1531,18 +1525,17 @@ struct BG_AV_NodeInfo inline BG_AV_Nodes &operator++(BG_AV_Nodes &i){ return i = BG_AV_Nodes(i + 1); } -class BattlegroundAVScore : public BattlegroundScore +struct BattlegroundAVScore : public BattlegroundScore { - public: - BattlegroundAVScore() : GraveyardsAssaulted(0), GraveyardsDefended(0), TowersAssaulted(0), TowersDefended(0), MinesCaptured(0), LeadersKilled(0), SecondaryObjectives(0) {}; - virtual ~BattlegroundAVScore() {}; - uint32 GraveyardsAssaulted; - uint32 GraveyardsDefended; - uint32 TowersAssaulted; - uint32 TowersDefended; - uint32 MinesCaptured; - uint32 LeadersKilled; - uint32 SecondaryObjectives; + BattlegroundAVScore() : GraveyardsAssaulted(0), GraveyardsDefended(0), TowersAssaulted(0), TowersDefended(0), MinesCaptured(0), LeadersKilled(0), SecondaryObjectives(0) { } + ~BattlegroundAVScore() { } + uint32 GraveyardsAssaulted; + uint32 GraveyardsDefended; + uint32 TowersAssaulted; + uint32 TowersDefended; + uint32 MinesCaptured; + uint32 LeadersKilled; + uint32 SecondaryObjectives; }; class BattlegroundAV : public Battleground @@ -1552,21 +1545,21 @@ class BattlegroundAV : public Battleground ~BattlegroundAV(); /* inherited from BattlegroundClass */ - virtual void AddPlayer(Player* player); - virtual void StartingEventCloseDoors(); - virtual void StartingEventOpenDoors(); + void AddPlayer(Player* player); + void StartingEventCloseDoors(); + void StartingEventOpenDoors(); void RemovePlayer(Player* player, uint64 guid, uint32 team); void HandleAreaTrigger(Player* Source, uint32 Trigger); bool SetupBattleground(); - virtual void ResetBGSubclass(); + void ResetBGSubclass(); /*general stuff*/ void UpdateScore(uint16 team, int16 points); void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true); /*handlestuff*/ //these are functions which get called from extern - virtual void EventPlayerClickedOnFlag(Player* source, GameObject* target_obj); + void EventPlayerClickedOnFlag(Player* source, GameObject* target_obj); void HandleKillPlayer(Player* player, Player* killer); void HandleKillUnit(Creature* unit, Player* killer); void HandleQuestComplete(uint32 questid, Player* player); @@ -1574,14 +1567,14 @@ class BattlegroundAV : public Battleground void EndBattleground(uint32 winner); - virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player); + WorldSafeLocsEntry const* GetClosestGraveYard(Player* player); /* achievement req. */ bool IsBothMinesControlledByTeam(uint32 team) const; bool IsAllTowersControlledAndCaptainAlive(uint32 team) const; private: - virtual void PostUpdateImpl(uint32 diff); + void PostUpdateImpl(uint32 diff); /* Nodes occupying */ void EventPlayerAssaultsPoint(Player* player, uint32 object); @@ -1598,7 +1591,7 @@ class BattlegroundAV : public Battleground BG_AV_Nodes GetNodeThroughObject(uint32 object); uint32 GetObjectThroughNode(BG_AV_Nodes node); - const char* GetNodeName(BG_AV_Nodes node); + char const* GetNodeName(BG_AV_Nodes node); bool IsTower(BG_AV_Nodes node) { return m_Nodes[node].Tower; } /*mine*/ @@ -1629,8 +1622,6 @@ class BattlegroundAV : public Battleground uint8 m_MaxLevel; //TODO remove this when battleground-getmaxlevel() returns something usefull bool m_IsInformedNearVictory[2]; - }; #endif - diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp index 4b34422f31b..d4086b2e48e 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp @@ -16,7 +16,6 @@ * with this program. If not, see . */ -#include "Battleground.h" #include "BattlegroundBE.h" #include "Language.h" #include "Object.h" @@ -65,11 +64,7 @@ void BattlegroundBE::StartingEventOpenDoors() void BattlegroundBE::AddPlayer(Player* player) { Battleground::AddPlayer(player); - //create score and add it to map, default values are set in constructor - BattlegroundBEScore* sc = new BattlegroundBEScore; - - PlayerScores[player->GetGUID()] = sc; - + PlayerScores[player->GetGUID()] = new BattlegroundScore; UpdateArenaWorldState(); } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundBE.h b/src/server/game/Battlegrounds/Zones/BattlegroundBE.h index 8c0df2bc329..27a88fcfc33 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundBE.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundBE.h @@ -15,10 +15,11 @@ * You should have received a copy of the GNU General Public License along * with this program. If not, see . */ + #ifndef __BATTLEGROUNDBE_H #define __BATTLEGROUNDBE_H -class Battleground; +#include "Battleground.h" enum BattlegroundBEObjectTypes { @@ -41,13 +42,6 @@ enum BattlegroundBEObjects BG_BE_OBJECT_TYPE_BUFF_2 = 184664 }; -class BattlegroundBEScore : public BattlegroundScore -{ - public: - BattlegroundBEScore() {}; - virtual ~BattlegroundBEScore() {}; -}; - class BattlegroundBE : public Battleground { public: @@ -55,15 +49,15 @@ class BattlegroundBE : public Battleground ~BattlegroundBE(); /* inherited from BattlegroundClass */ - virtual void AddPlayer(Player* player); - virtual void StartingEventCloseDoors(); - virtual void StartingEventOpenDoors(); + void AddPlayer(Player* player); + void StartingEventCloseDoors(); + void StartingEventOpenDoors(); void RemovePlayer(Player* player, uint64 guid, uint32 team); void HandleAreaTrigger(Player* Source, uint32 Trigger); bool SetupBattleground(); - virtual void Reset(); - virtual void FillInitialWorldStates(WorldPacket &d); + void Reset(); + void FillInitialWorldStates(WorldPacket &d); void HandleKillPlayer(Player* player, Player* killer); bool HandlePlayerUnderMap(Player* player); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp index be947458964..a39350d1f45 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp @@ -16,12 +16,10 @@ * with this program. If not, see . */ -#include "Battleground.h" #include "BattlegroundDS.h" +#include "ObjectAccessor.h" #include "Language.h" #include "Player.h" -#include "Object.h" -#include "ObjectMgr.h" #include "WorldPacket.h" BattlegroundDS::BattlegroundDS() @@ -147,11 +145,7 @@ void BattlegroundDS::StartingEventOpenDoors() void BattlegroundDS::AddPlayer(Player* player) { Battleground::AddPlayer(player); - //create score and add it to map, default values are set in constructor - BattlegroundDSScore* score = new BattlegroundDSScore; - - PlayerScores[player->GetGUID()] = score; - + PlayerScores[player->GetGUID()] = new BattlegroundScore; UpdateArenaWorldState(); } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h index d9e60079bf6..ff4b279a2cf 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h @@ -19,7 +19,7 @@ #ifndef __BATTLEGROUNDDS_H #define __BATTLEGROUNDDS_H -class Battleground; +#include "Battleground.h" enum BattlegroundDSObjectTypes { @@ -79,14 +79,6 @@ enum BattlegroundDSData BG_DS_WATERFALL_STATUS_OFF = 3 }; -class BattlegroundDSScore : public BattlegroundScore -{ - public: - BattlegroundDSScore() {}; - virtual ~BattlegroundDSScore() {}; - //TODO fix me -}; - class BattlegroundDS : public Battleground { public: @@ -94,15 +86,15 @@ class BattlegroundDS : public Battleground ~BattlegroundDS(); /* inherited from BattlegroundClass */ - virtual void AddPlayer(Player* player); - virtual void StartingEventCloseDoors(); - virtual void StartingEventOpenDoors(); + void AddPlayer(Player* player); + void StartingEventCloseDoors(); + void StartingEventOpenDoors(); void RemovePlayer(Player* player, uint64 guid, uint32 team); void HandleAreaTrigger(Player* Source, uint32 Trigger); bool SetupBattleground(); - virtual void Reset(); - virtual void FillInitialWorldStates(WorldPacket &d); + void Reset(); + void FillInitialWorldStates(WorldPacket &d); void HandleKillPlayer(Player* player, Player* killer); bool HandlePlayerUnderMap(Player* player); private: @@ -112,7 +104,7 @@ class BattlegroundDS : public Battleground uint32 _pipeKnockBackTimer; uint8 _pipeKnockBackCount; - virtual void PostUpdateImpl(uint32 diff); + void PostUpdateImpl(uint32 diff); protected: uint32 getWaterFallStatus() { return _waterfallStatus; }; void setWaterFallStatus(uint8 status) { _waterfallStatus = status; }; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp index 10b2cc58a7b..ee25f72b382 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp @@ -16,12 +16,11 @@ * with this program. If not, see . */ +#include "BattlegroundEY.h" #include "ObjectMgr.h" #include "World.h" #include "WorldPacket.h" #include "BattlegroundMgr.h" -#include "Battleground.h" -#include "BattlegroundEY.h" #include "Creature.h" #include "Language.h" #include "Object.h" @@ -136,7 +135,7 @@ void BattlegroundEY::AddPoints(uint32 Team, uint32 Points) RewardHonorToTeam(GetBonusHonorFromKill(1), Team); m_HonorScoreTics[team_index] -= m_HonorTics; } - UpdateTeamScore(Team); + UpdateTeamScore(team_index); } void BattlegroundEY::CheckSomeoneJoinedPoint() @@ -281,10 +280,13 @@ void BattlegroundEY::UpdateTeamScore(uint32 Team) if (score >= BG_EY_MAX_TEAM_SCORE) { score = BG_EY_MAX_TEAM_SCORE; - EndBattleground(Team); + if (Team == TEAM_ALLIANCE) + EndBattleground(ALLIANCE); + else + EndBattleground(HORDE); } - if (Team == ALLIANCE) + if (Team == TEAM_ALLIANCE) UpdateWorldState(EY_ALLIANCE_RESOURCES, score); else UpdateWorldState(EY_HORDE_RESOURCES, score); @@ -292,12 +294,12 @@ void BattlegroundEY::UpdateTeamScore(uint32 Team) void BattlegroundEY::EndBattleground(uint32 winner) { - //win reward + // Win reward if (winner == ALLIANCE) RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE); if (winner == HORDE) RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE); - //complete map reward + // Complete map reward RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE); RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE); @@ -864,8 +866,8 @@ void BattlegroundEY::FillInitialWorldStates(WorldPacket& data) data << uint32(0xad2) << uint32(0x1); data << uint32(0xad1) << uint32(0x1); - data << uint32(0xabe) << uint32(GetTeamScore(HORDE)); - data << uint32(0xabd) << uint32(GetTeamScore(ALLIANCE)); + data << uint32(0xabe) << uint32(GetTeamScore(TEAM_HORDE)); + data << uint32(0xabd) << uint32(GetTeamScore(TEAM_ALLIANCE)); data << uint32(0xa05) << uint32(0x8e); data << uint32(0xaa0) << uint32(0x0); data << uint32(0xa9f) << uint32(0x0); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h index f7487a46653..61ee5b16c1c 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h @@ -20,8 +20,7 @@ #define __BATTLEGROUNDEY_H #include "Language.h" - -class Battleground; +#include "Battleground.h" enum BG_EY_Misc { @@ -324,12 +323,11 @@ const BattlegroundEYCapturingPointStruct m_CapturingPointTypes[EY_POINTS_MAX] = BattlegroundEYCapturingPointStruct(BG_EY_OBJECT_N_BANNER_MAGE_TOWER_CENTER, BG_EY_OBJECT_A_BANNER_MAGE_TOWER_CENTER, LANG_BG_EY_HAS_TAKEN_A_M_TOWER, BG_EY_OBJECT_H_BANNER_MAGE_TOWER_CENTER, LANG_BG_EY_HAS_TAKEN_H_M_TOWER, EY_GRAVEYARD_MAGE_TOWER) }; -class BattlegroundEYScore : public BattlegroundScore +struct BattlegroundEYScore : public BattlegroundScore { - public: - BattlegroundEYScore() : FlagCaptures(0) {}; - virtual ~BattlegroundEYScore() {}; - uint32 FlagCaptures; + BattlegroundEYScore() : FlagCaptures(0) { } + ~BattlegroundEYScore() { } + uint32 FlagCaptures; }; class BattlegroundEY : public Battleground @@ -339,9 +337,9 @@ class BattlegroundEY : public Battleground ~BattlegroundEY(); /* inherited from BattlegroundClass */ - virtual void AddPlayer(Player* player); - virtual void StartingEventCloseDoors(); - virtual void StartingEventOpenDoors(); + void AddPlayer(Player* player); + void StartingEventCloseDoors(); + void StartingEventOpenDoors(); /* BG Flags */ uint64 GetFlagPickerGUID(int32 /*team*/ = -1) const { return m_FlagKeeper; } @@ -355,24 +353,24 @@ class BattlegroundEY : public Battleground void HandleBuffUse(uint64 buff_guid); void HandleAreaTrigger(Player* Source, uint32 Trigger); void HandleKillPlayer(Player* player, Player* killer); - virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player); - virtual bool SetupBattleground(); - virtual void Reset(); + WorldSafeLocsEntry const* GetClosestGraveYard(Player* player); + bool SetupBattleground(); + void Reset(); void UpdateTeamScore(uint32 Team); void EndBattleground(uint32 winner); void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true); - virtual void FillInitialWorldStates(WorldPacket& data); - void SetDroppedFlagGUID(uint64 guid) { m_DroppedFlagGUID = guid;} + void FillInitialWorldStates(WorldPacket& data); + void SetDroppedFlagGUID(uint64 guid, int32 /*TeamID*/ = -1) { m_DroppedFlagGUID = guid;} uint64 GetDroppedFlagGUID() const { return m_DroppedFlagGUID;} /* Battleground Events */ - virtual void EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj); - virtual void EventPlayerDroppedFlag(Player* Source); + void EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj); + void EventPlayerDroppedFlag(Player* Source); /* achievement req. */ bool IsAllNodesConrolledByTeam(uint32 team) const; private: - virtual void PostUpdateImpl(uint32 diff); + void PostUpdateImpl(uint32 diff); void EventPlayerCapturedFlag(Player* Source, uint32 BgObjectType); void EventTeamCapturedPoint(Player* Source, uint32 Point); @@ -386,7 +384,6 @@ class BattlegroundEY : public Battleground void UpdatePointStatuses(); /* Scorekeeping */ - uint32 GetTeamScore(uint32 Team) const { return m_TeamScores[GetTeamIndexByTeamId(Team)]; } void AddPoints(uint32 Team, uint32 Points); void RemovePoint(uint32 TeamID, uint32 Points = 1) { m_TeamScores[GetTeamIndexByTeamId(TeamID)] -= Points; } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp index 0ed577d0bd1..132c63ad16d 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp @@ -36,17 +36,17 @@ BattlegroundIC::BattlegroundIC() StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_IC_START_HALF_MINUTE; StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_IC_HAS_BEGUN; - for (uint8 i = 0; i < 2; i++) + for (uint8 i = 0; i < 2; ++i) factionReinforcements[i] = MAX_REINFORCEMENTS; - for (uint8 i = 0; i < BG_IC_MAXDOOR; i++) + for (uint8 i = 0; i < BG_IC_MAXDOOR; ++i) GateStatus[i] = BG_IC_GATE_OK; closeFortressDoorsTimer = CLOSE_DOORS_TIME; // the doors are closed again... in a special way doorsClosed = false; resourceTimer = IC_RESOURCE_TIME; - for (uint8 i = NODE_TYPE_REFINERY; i < MAX_NODE_TYPES; i++) + for (uint8 i = NODE_TYPE_REFINERY; i < MAX_NODE_TYPES; ++i) nodePoint[i] = nodePointInitial[i]; siegeEngineWorkshopTimer = WORKSHOP_UPDATE_TIME; @@ -91,13 +91,12 @@ void BattlegroundIC::DoAction(uint32 action, uint64 var) if (action != ACTION_TELEPORT_PLAYER_TO_TRANSPORT) return; - Player* player = ObjectAccessor::FindPlayer(var); - - if (!player || !gunshipAlliance || !gunshipHorde) + if (!gunshipAlliance || !gunshipHorde) return; - player->CastSpell(player, SPELL_PARACHUTE, true); // this must be changed, there is a trigger in each transport that casts the spell. - player->CastSpell(player, SPELL_SLOW_FALL, true); + Player* player = ObjectAccessor::FindPlayer(var); + if (!player) + return; player->SetTransport(player->GetTeamId() == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde); @@ -106,7 +105,15 @@ void BattlegroundIC::DoAction(uint32 action, uint64 var) player->m_movementInfo.t_pos.m_positionZ = TransportMovementInfo.GetPositionZ(); player->m_movementInfo.t_guid = (player->GetTeamId() == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde)->GetGUID(); - player->TeleportTo(GetMapId(), TeleportToTransportPosition.GetPositionX(), TeleportToTransportPosition.GetPositionY(), TeleportToTransportPosition.GetPositionZ(), TeleportToTransportPosition.GetOrientation(), TELE_TO_NOT_LEAVE_TRANSPORT); + if (player->TeleportTo(GetMapId(), TeleportToTransportPosition.GetPositionX(), + TeleportToTransportPosition.GetPositionY(), + TeleportToTransportPosition.GetPositionZ(), + TeleportToTransportPosition.GetOrientation(), + TELE_TO_NOT_LEAVE_TRANSPORT)) + { + player->CastSpell(player, SPELL_PARACHUTE, true); // this must be changed, there is a trigger in each transport that casts the spell. + player->CastSpell(player, SPELL_SLOW_FALL, true); + } } void BattlegroundIC::PostUpdateImpl(uint32 diff) @@ -129,7 +136,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff) } else closeFortressDoorsTimer -= diff; } - for (uint8 i = NODE_TYPE_REFINERY; i < MAX_NODE_TYPES; i++) + for (uint8 i = NODE_TYPE_REFINERY; i < MAX_NODE_TYPES; ++i) { if (nodePoint[i].nodeType == NODE_TYPE_DOCKS) { @@ -139,7 +146,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff) if (docksTimer <= diff) { // we need to confirm this, i am not sure if this every 3 minutes - for (uint8 u = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_A : BG_IC_NPC_CATAPULT_1_H); u < (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_4_A : BG_IC_NPC_CATAPULT_4_H); u++) + for (uint8 u = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_A : BG_IC_NPC_CATAPULT_1_H); u < (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_4_A : BG_IC_NPC_CATAPULT_4_H); ++u) { if (Creature* catapult = GetBGCreature(u)) { @@ -149,7 +156,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff) } // we need to confirm this is blizzlike, not sure if it is every 3 minutes - for (uint8 u = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_A : BG_IC_NPC_GLAIVE_THROWER_1_H); u < (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_2_A : BG_IC_NPC_GLAIVE_THROWER_2_H); u++) + for (uint8 u = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_A : BG_IC_NPC_GLAIVE_THROWER_1_H); u < (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_2_A : BG_IC_NPC_GLAIVE_THROWER_2_H); ++u) { if (Creature* glaiveThrower = GetBGCreature(u)) { @@ -187,7 +194,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff) } // we need to confirm if it is every 3 minutes - for (uint8 u = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_A : BG_IC_NPC_DEMOLISHER_1_H); u < (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_4_A : BG_IC_NPC_DEMOLISHER_4_H); u++) + for (uint8 u = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_A : BG_IC_NPC_DEMOLISHER_1_H); u < (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_4_A : BG_IC_NPC_DEMOLISHER_4_H); ++u) { if (Creature* demolisher = GetBGCreature(u)) { @@ -236,7 +243,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff) if (resourceTimer <= diff) { - for (uint8 i = 0; i < NODE_TYPE_DOCKS; i++) + for (uint8 i = 0; i < NODE_TYPE_DOCKS; ++i) { if (nodePoint[i].nodeState == NODE_STATE_CONTROLLED_A || nodePoint[i].nodeState == NODE_STATE_CONTROLLED_H) @@ -270,13 +277,15 @@ void BattlegroundIC::StartingEventOpenDoors() DoorOpen(BG_IC_GO_DOODAD_VR_PORTCULLIS01_1); DoorOpen(BG_IC_GO_DOODAD_VR_PORTCULLIS01_2); - for (uint8 i = 0; i < MAX_FORTRESS_TELEPORTERS_SPAWNS; i++) + for (uint8 i = 0; i < MAX_FORTRESS_TELEPORTERS_SPAWNS; ++i) { if (!AddObject(BG_IC_Teleporters[i].type, BG_IC_Teleporters[i].entry, - BG_IC_Teleporters[i].x, BG_IC_Teleporters[i].y, - BG_IC_Teleporters[i].z, BG_IC_Teleporters[i].o, - 0, 0, 0, 0, RESPAWN_ONE_DAY)) + BG_IC_Teleporters[i].x, BG_IC_Teleporters[i].y, + BG_IC_Teleporters[i].z, BG_IC_Teleporters[i].o, + 0, 0, 0, 0, RESPAWN_ONE_DAY)) + { sLog->outError(LOG_FILTER_BATTLEGROUND, "Isle of Conquest | Starting Event Open Doors: There was an error spawning gameobject %u", BG_IC_Teleporters[i].entry); + } } } @@ -287,7 +296,7 @@ bool BattlegroundIC::IsAllNodesConrolledByTeam(uint32 team) const for (int i = 0; i < NODE_TYPE_WORKSHOP; ++i) { if (nodePoint[i].nodeState == controlledState) - count++; + ++count; } return count == NODE_TYPE_WORKSHOP; @@ -296,10 +305,7 @@ bool BattlegroundIC::IsAllNodesConrolledByTeam(uint32 team) const void BattlegroundIC::AddPlayer(Player* player) { Battleground::AddPlayer(player); - //create score and add it to map, default values are set in constructor - BattlegroundICScore* sc = new BattlegroundICScore; - - PlayerScores[player->GetGUID()] = sc; + PlayerScores[player->GetGUID()] = new BattlegroundICScore; if (nodePoint[NODE_TYPE_QUARRY].nodeState == (player->GetTeamId() == TEAM_ALLIANCE ? NODE_STATE_CONTROLLED_A : NODE_STATE_CONTROLLED_H)) player->CastSpell(player, SPELL_QUARRY, true); @@ -354,19 +360,19 @@ void BattlegroundIC::FillInitialWorldStates(WorldPacket& data) data << uint32(BG_IC_ALLIANCE_RENFORT) << uint32(factionReinforcements[TEAM_ALLIANCE]); data << uint32(BG_IC_HORDE_RENFORT) << uint32(factionReinforcements[TEAM_HORDE]); - for (uint8 i = 0; i < MAX_FORTRESS_GATES_SPAWNS; i++) + for (uint8 i = 0; i < MAX_FORTRESS_GATES_SPAWNS; ++i) { uint32 uws = GetWorldStateFromGateEntry(BG_IC_ObjSpawnlocs[i].entry, (GateStatus[GetGateIDFromEntry(BG_IC_ObjSpawnlocs[i].entry)] == BG_IC_GATE_DESTROYED ? true : false)); data << uint32(uws) << uint32(1); } - for (uint8 i = 0; i < MAX_NODE_TYPES; i++) + for (uint8 i = 0; i < MAX_NODE_TYPES; ++i) data << uint32(nodePoint[i].worldStates[nodePoint[i].nodeState]) << uint32(1); } bool BattlegroundIC::SetupBattleground() { - for (uint8 i = 0; i < MAX_NORMAL_GAMEOBJECTS_SPAWNS; i++) + for (uint8 i = 0; i < MAX_NORMAL_GAMEOBJECTS_SPAWNS; ++i) { if (!AddObject(BG_IC_ObjSpawnlocs[i].type, BG_IC_ObjSpawnlocs[i].entry, BG_IC_ObjSpawnlocs[i].x, BG_IC_ObjSpawnlocs[i].y, @@ -378,7 +384,7 @@ bool BattlegroundIC::SetupBattleground() } } - for (uint8 i = 0; i < MAX_NORMAL_NPCS_SPAWNS; i++) + for (uint8 i = 0; i < MAX_NORMAL_NPCS_SPAWNS; ++i) { if (!AddCreature(BG_IC_NpcSpawnlocs[i].entry, BG_IC_NpcSpawnlocs[i].type, BG_IC_NpcSpawnlocs[i].team, BG_IC_NpcSpawnlocs[i].x, BG_IC_NpcSpawnlocs[i].y, @@ -416,13 +422,13 @@ bool BattlegroundIC::SetupBattleground() } // setting correct factions for Keep Cannons - for (uint8 i = BG_IC_NPC_KEEP_CANNON_1; i < BG_IC_NPC_KEEP_CANNON_12; i++) + for (uint8 i = BG_IC_NPC_KEEP_CANNON_1; i < BG_IC_NPC_KEEP_CANNON_12; ++i) GetBGCreature(i)->setFaction(BG_IC_Factions[0]); - for (uint8 i = BG_IC_NPC_KEEP_CANNON_13; i < BG_IC_NPC_KEEP_CANNON_25; i++) + for (uint8 i = BG_IC_NPC_KEEP_CANNON_13; i < BG_IC_NPC_KEEP_CANNON_25; ++i) GetBGCreature(i)->setFaction(BG_IC_Factions[1]); // correcting spawn time for keeps bombs - for (uint8 i = BG_IC_GO_HUGE_SEAFORIUM_BOMBS_A_1; i < BG_IC_GO_HUGE_SEAFORIUM_BOMBS_H_4; i++) + for (uint8 i = BG_IC_GO_HUGE_SEAFORIUM_BOMBS_A_1; i < BG_IC_GO_HUGE_SEAFORIUM_BOMBS_H_4; ++i) GetBGObject(i)->SetRespawnTime(10); return true; @@ -502,7 +508,7 @@ void BattlegroundIC::EventPlayerClickedOnFlag(Player* player, GameObject* target return; // All the node points are iterated to find the clicked one - for (uint8 i = 0; i < MAX_NODE_TYPES; i++) + for (uint8 i = 0; i < MAX_NODE_TYPES; ++i) { if (nodePoint[i].gameobject_entry == target_obj->GetEntry()) { @@ -589,7 +595,7 @@ void BattlegroundIC::UpdateNodeWorldState(ICNodePoint* nodePoint) uint32 worldstate = nodePoint->worldStates[nodePoint->nodeState]; // with this we are sure we dont bug the client - for (uint8 i = 0; i < 4; i++) + for (uint8 i = 0; i < 4; ++i) UpdateWorldState(nodePoint->worldStates[i], 0); UpdateWorldState(worldstate, 1); @@ -627,7 +633,7 @@ void BattlegroundIC::HandleContestedNodes(ICNodePoint* nodePoint) if (gunshipAlliance && gunshipHorde) (nodePoint->faction == TEAM_ALLIANCE ? gunshipHorde : gunshipAlliance)->BuildStopMovePacket(GetBgMap()); - for (uint8 u = BG_IC_GO_HANGAR_TELEPORTER_1; u < BG_IC_GO_HANGAR_TELEPORTER_3; u++) + for (uint8 u = BG_IC_GO_HANGAR_TELEPORTER_1; u < BG_IC_GO_HANGAR_TELEPORTER_3; ++u) DelObject(u); } } @@ -650,7 +656,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture) if (!gunshipAlliance || !gunshipHorde) break; - for (uint8 u = 0; u < MAX_HANGAR_TELEPORTERS_SPAWNS; u++) + for (uint8 u = 0; u < MAX_HANGAR_TELEPORTERS_SPAWNS; ++u) { uint8 type = BG_IC_GO_HANGAR_TELEPORTER_1+u; AddObject(type, (nodePoint->faction == TEAM_ALLIANCE ? GO_ALLIANCE_GUNSHIP_PORTAL : GO_HORDE_GUNSHIP_PORTAL), @@ -682,7 +688,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture) docksTimer = DOCKS_UPDATE_TIME; // we must del opposing faction vehicles when the node is captured (unused ones) - for (uint8 i = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_H : BG_IC_NPC_GLAIVE_THROWER_1_A); i < (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_2_H : BG_IC_NPC_GLAIVE_THROWER_2_A); i++) + for (uint8 i = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_H : BG_IC_NPC_GLAIVE_THROWER_1_A); i < (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_2_H : BG_IC_NPC_GLAIVE_THROWER_2_A); ++i) { if (Creature* glaiveThrower = GetBGCreature(i)) { @@ -694,7 +700,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture) } } - for (uint8 i = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_H : BG_IC_NPC_CATAPULT_1_A); i < (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_4_H : BG_IC_NPC_CATAPULT_4_A); i++) + for (uint8 i = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_H : BG_IC_NPC_CATAPULT_1_A); i < (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_4_H : BG_IC_NPC_CATAPULT_4_A); ++i) { if (Creature* catapult = GetBGCreature(i)) { @@ -707,7 +713,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture) } // spawning glaive throwers - for (uint8 i = 0; i < MAX_GLAIVE_THROWERS_SPAWNS_PER_FACTION; i++) + for (uint8 i = 0; i < MAX_GLAIVE_THROWERS_SPAWNS_PER_FACTION; ++i) { uint8 type = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_A : BG_IC_NPC_GLAIVE_THROWER_1_H)+i; @@ -722,7 +728,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture) } // spawning catapults - for (uint8 i = 0; i < MAX_CATAPULTS_SPAWNS_PER_FACTION; i++) + for (uint8 i = 0; i < MAX_CATAPULTS_SPAWNS_PER_FACTION; ++i) { uint8 type = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_A : BG_IC_NPC_CATAPULT_1_H)+i; @@ -744,7 +750,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture) if (!recapture) { // we must del opposing faction vehicles when the node is captured (unused ones) - for (uint8 i = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_H : BG_IC_NPC_DEMOLISHER_1_A); i < (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_4_H : BG_IC_NPC_DEMOLISHER_4_A); i++) + for (uint8 i = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_H : BG_IC_NPC_DEMOLISHER_1_A); i < (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_4_H : BG_IC_NPC_DEMOLISHER_4_A); ++i) { if (Creature* demolisher = GetBGCreature(i)) { @@ -757,7 +763,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture) } } - for (uint8 i = 0; i < MAX_DEMOLISHERS_SPAWNS_PER_FACTION; i++) + for (uint8 i = 0; i < MAX_DEMOLISHERS_SPAWNS_PER_FACTION; ++i) { uint8 type = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_A : BG_IC_NPC_DEMOLISHER_1_H)+i; @@ -800,7 +806,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture) } } - for (uint8 i = 0; i < MAX_WORKSHOP_BOMBS_SPAWNS_PER_FACTION; i++) + for (uint8 i = 0; i < MAX_WORKSHOP_BOMBS_SPAWNS_PER_FACTION; ++i) { AddObject(BG_IC_GO_SEAFORIUM_BOMBS_1+i, GO_SEAFORIUM_BOMBS, workshopBombs[i].GetPositionX(), workshopBombs[i].GetPositionY(), @@ -941,7 +947,7 @@ Transport* BattlegroundIC::CreateTransport(uint32 goEntry, uint32 period) //If we someday decide to use the grid to track transports, here: t->SetMap(GetBgMap()); - for (uint8 i = 0; i < 5; i++) + for (uint8 i = 0; i < 5; ++i) t->AddNPCPassenger(0, (goEntry == GO_HORDE_GUNSHIP ? NPC_HORDE_GUNSHIP_CANNON : NPC_ALLIANCE_GUNSHIP_CANNON), (goEntry == GO_HORDE_GUNSHIP ? hordeGunshipPassengers[i].GetPositionX() : allianceGunshipPassengers[i].GetPositionX()), (goEntry == GO_HORDE_GUNSHIP ? hordeGunshipPassengers[i].GetPositionY() : allianceGunshipPassengers[i].GetPositionY()), (goEntry == GO_HORDE_GUNSHIP ? hordeGunshipPassengers[i].GetPositionZ() : allianceGunshipPassengers[i].GetPositionZ()), (goEntry == GO_HORDE_GUNSHIP ? hordeGunshipPassengers[i].GetOrientation() : allianceGunshipPassengers[i].GetOrientation())); return t; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.h b/src/server/game/Battlegrounds/Zones/BattlegroundIC.h index 20f44acc14f..1386af13186 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.h @@ -19,7 +19,7 @@ #ifndef __BATTLEGROUNDIC_H #define __BATTLEGROUNDIC_H -class Battleground; +#include "Battleground.h" const uint32 BG_IC_Factions[2] = { @@ -185,12 +185,12 @@ enum gameobjectsIC enum Times { - WORKSHOP_UPDATE_TIME = 180000, // 3 minutes - DOCKS_UPDATE_TIME = 180000, // not sure if it is 3 minutes - IC_RESOURCE_TIME = 45000, // not sure, need more research - CLOSE_DOORS_TIME = 20000, + WORKSHOP_UPDATE_TIME = 180000, // 3 minutes + DOCKS_UPDATE_TIME = 180000, // not sure if it is 3 minutes + IC_RESOURCE_TIME = 45000, // not sure, need more research + CLOSE_DOORS_TIME = 20000, BANNER_STATE_CHANGE_TIME = 60000, - TRANSPORT_PERIOD_TIME = 120000 + TRANSPORT_PERIOD_TIME = 120000 }; enum Actions @@ -654,18 +654,15 @@ const Position workshopBombs[2] = enum Spells { - SPELL_OIL_REFINERY = 68719, - SPELL_QUARRY = 68720, - - SPELL_PARACHUTE = 66656, - SPELL_SLOW_FALL = 12438, - - SPELL_DESTROYED_VEHICLE_ACHIEVEMENT = 68357, - - SPELL_DRIVING_CREDIT_DEMOLISHER = 68365, - SPELL_DRIVING_CREDIT_GLAIVE = 68363, - SPELL_DRIVING_CREDIT_SIEGE = 68364, - SPELL_DRIVING_CREDIT_CATAPULT = 68362 + SPELL_OIL_REFINERY = 68719, + SPELL_QUARRY = 68720, + SPELL_PARACHUTE = 66656, + SPELL_SLOW_FALL = 12438, + SPELL_DESTROYED_VEHICLE_ACHIEVEMENT = 68357, + SPELL_DRIVING_CREDIT_DEMOLISHER = 68365, + SPELL_DRIVING_CREDIT_GLAIVE = 68363, + SPELL_DRIVING_CREDIT_SIEGE = 68364, + SPELL_DRIVING_CREDIT_CATAPULT = 68362, }; enum BG_IC_Objectives @@ -847,13 +844,12 @@ enum HonorRewards WINNER_HONOR_AMOUNT = 500 }; -class BattlegroundICScore : public BattlegroundScore +struct BattlegroundICScore : public BattlegroundScore { - public: - BattlegroundICScore() : BasesAssaulted(0), BasesDefended(0) {}; - virtual ~BattlegroundICScore() {}; - uint32 BasesAssaulted; - uint32 BasesDefended; + BattlegroundICScore() : BasesAssaulted(0), BasesDefended(0) { } + ~BattlegroundICScore() { } + uint32 BasesAssaulted; + uint32 BasesDefended; }; class BattlegroundIC : public Battleground @@ -863,10 +859,10 @@ class BattlegroundIC : public Battleground ~BattlegroundIC(); /* inherited from BattlegroundClass */ - virtual void AddPlayer(Player* player); - virtual void StartingEventCloseDoors(); - virtual void StartingEventOpenDoors(); - virtual void PostUpdateImpl(uint32 diff); + void AddPlayer(Player* player); + void StartingEventCloseDoors(); + void StartingEventOpenDoors(); + void PostUpdateImpl(uint32 diff); void RemovePlayer(Player* player, uint64 guid, uint32 team); void HandleAreaTrigger(Player* Source, uint32 Trigger); @@ -880,7 +876,7 @@ class BattlegroundIC : public Battleground void EventPlayerDamagedGO(Player* /*player*/, GameObject* go, uint32 eventType); void DestroyGate(Player* player, GameObject* go); - virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player); + WorldSafeLocsEntry const* GetClosestGraveYard(Player* player); /* Scorekeeping */ void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true); @@ -889,11 +885,11 @@ class BattlegroundIC : public Battleground void DoAction(uint32 action, uint64 var); - virtual void HandlePlayerResurrect(Player* player); + void HandlePlayerResurrect(Player* player); - uint32 GetNodeState(uint8 nodeType) { return (uint8)nodePoint[nodeType].nodeState; } + uint32 GetNodeState(uint8 nodeType) const { return (uint8)nodePoint[nodeType].nodeState; } - virtual bool IsAllNodesConrolledByTeam(uint32 team) const; // overwrited + bool IsAllNodesConrolledByTeam(uint32 team) const; // overwrited private: uint32 closeFortressDoorsTimer; bool doorsClosed; @@ -959,4 +955,5 @@ class BattlegroundIC : public Battleground Transport* CreateTransport(uint32 goEntry, uint32 period); void SendTransportInit(Player* player); }; + #endif diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp index 6c45d4a8873..deb2e565b07 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp @@ -16,7 +16,6 @@ * with this program. If not, see . */ -#include "Battleground.h" #include "BattlegroundNA.h" #include "Language.h" #include "Object.h" @@ -62,11 +61,7 @@ void BattlegroundNA::StartingEventOpenDoors() void BattlegroundNA::AddPlayer(Player* player) { Battleground::AddPlayer(player); - //create score and add it to map, default values are set in constructor - BattlegroundNAScore* sc = new BattlegroundNAScore; - - PlayerScores[player->GetGUID()] = sc; - + PlayerScores[player->GetGUID()] = new BattlegroundScore; UpdateArenaWorldState(); } @@ -147,13 +142,3 @@ bool BattlegroundNA::SetupBattleground() return true; } - -/* -20:12:14 id:036668 [S2C] SMSG_INIT_WORLD_STATES (706 = 0x02C2) len: 86 -0000: 2f 02 00 00 72 0e 00 00 00 00 00 00 09 00 11 0a | /...r........... -0010: 00 00 01 00 00 00 0f 0a 00 00 00 00 00 00 10 0a | ................ -0020: 00 00 00 00 00 00 d4 08 00 00 00 00 00 00 d8 08 | ................ -0030: 00 00 00 00 00 00 d7 08 00 00 00 00 00 00 d6 08 | ................ -0040: 00 00 00 00 00 00 d5 08 00 00 00 00 00 00 d3 08 | ................ -0050: 00 00 00 00 00 00 | ...... -*/ diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundNA.h b/src/server/game/Battlegrounds/Zones/BattlegroundNA.h index 53c0faf1c6f..0241cf182a7 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundNA.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundNA.h @@ -18,7 +18,7 @@ #ifndef __BATTLEGROUNDNA_H #define __BATTLEGROUNDNA_H -class Battleground; +#include "Battleground.h" enum BattlegroundNAObjectTypes { @@ -41,14 +41,6 @@ enum BattlegroundNAObjects BG_NA_OBJECT_TYPE_BUFF_2 = 184664 }; -class BattlegroundNAScore : public BattlegroundScore -{ - public: - BattlegroundNAScore() {}; - virtual ~BattlegroundNAScore() {}; - //TODO fix me -}; - class BattlegroundNA : public Battleground { public: @@ -56,15 +48,15 @@ class BattlegroundNA : public Battleground ~BattlegroundNA(); /* inherited from BattlegroundClass */ - virtual void AddPlayer(Player* player); - virtual void StartingEventCloseDoors(); - virtual void StartingEventOpenDoors(); + void AddPlayer(Player* player); + void StartingEventCloseDoors(); + void StartingEventOpenDoors(); void RemovePlayer(Player* player, uint64 guid, uint32 team); void HandleAreaTrigger(Player* Source, uint32 Trigger); bool SetupBattleground(); - virtual void Reset(); - virtual void FillInitialWorldStates(WorldPacket &d); + void Reset(); + void FillInitialWorldStates(WorldPacket &d); void HandleKillPlayer(Player* player, Player* killer); bool HandlePlayerUnderMap(Player* player); }; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRB.h b/src/server/game/Battlegrounds/Zones/BattlegroundRB.h index cda1351ca12..1ad7dba1a8e 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRB.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRB.h @@ -25,7 +25,7 @@ class BattlegroundRBScore : public BattlegroundScore { public: BattlegroundRBScore() {}; - virtual ~BattlegroundRBScore() {}; + ~BattlegroundRBScore() {}; }; class BattlegroundRB : public Battleground @@ -34,9 +34,9 @@ class BattlegroundRB : public Battleground BattlegroundRB(); ~BattlegroundRB(); - virtual void AddPlayer(Player* player); - virtual void StartingEventCloseDoors(); - virtual void StartingEventOpenDoors(); + void AddPlayer(Player* player); + void StartingEventCloseDoors(); + void StartingEventOpenDoors(); void RemovePlayer(Player* player, uint64 guid, uint32 team); void HandleAreaTrigger(Player* Source, uint32 Trigger); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp index 3dd4fb32da4..14c1052ed64 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp @@ -16,7 +16,6 @@ * with this program. If not, see . */ -#include "Battleground.h" #include "BattlegroundRL.h" #include "Language.h" #include "Object.h" @@ -62,11 +61,7 @@ void BattlegroundRL::StartingEventOpenDoors() void BattlegroundRL::AddPlayer(Player* player) { Battleground::AddPlayer(player); - //create score and add it to map, default values are set in constructor - BattlegroundRLScore* sc = new BattlegroundRLScore; - - PlayerScores[player->GetGUID()] = sc; - + PlayerScores[player->GetGUID()] = new BattlegroundScore; UpdateArenaWorldState(); } @@ -145,13 +140,3 @@ bool BattlegroundRL::SetupBattleground() return true; } - -/* -Packet S->C, id 600, SMSG_INIT_WORLD_STATES (706), len 86 -0000: 3C 02 00 00 80 0F 00 00 00 00 00 00 09 00 BA 0B | <............... -0010: 00 00 01 00 00 00 B9 0B 00 00 02 00 00 00 B8 0B | ................ -0020: 00 00 00 00 00 00 D8 08 00 00 00 00 00 00 D7 08 | ................ -0030: 00 00 00 00 00 00 D6 08 00 00 00 00 00 00 D5 08 | ................ -0040: 00 00 00 00 00 00 D3 08 00 00 00 00 00 00 D4 08 | ................ -0050: 00 00 00 00 00 00 | ...... -*/ diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRL.h b/src/server/game/Battlegrounds/Zones/BattlegroundRL.h index dc041a18a1c..56d089909e0 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRL.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRL.h @@ -18,7 +18,7 @@ #ifndef __BATTLEGROUNDRL_H #define __BATTLEGROUNDRL_H -class Battleground; +#include "Battleground.h" enum BattlegroundRLObjectTypes { @@ -37,14 +37,6 @@ enum BattlegroundRLObjects BG_RL_OBJECT_TYPE_BUFF_2 = 184664 }; -class BattlegroundRLScore : public BattlegroundScore -{ - public: - BattlegroundRLScore() {}; - virtual ~BattlegroundRLScore() {}; - //TODO fix me -}; - class BattlegroundRL : public Battleground { public: @@ -52,11 +44,11 @@ class BattlegroundRL : public Battleground ~BattlegroundRL(); /* inherited from BattlegroundClass */ - virtual void AddPlayer(Player* player); - virtual void Reset(); - virtual void FillInitialWorldStates(WorldPacket &d); - virtual void StartingEventCloseDoors(); - virtual void StartingEventOpenDoors(); + void AddPlayer(Player* player); + void Reset(); + void FillInitialWorldStates(WorldPacket &d); + void StartingEventCloseDoors(); + void StartingEventOpenDoors(); void RemovePlayer(Player* player, uint64 guid, uint32 team); void HandleAreaTrigger(Player* Source, uint32 Trigger); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp index 2cc48648022..80018bce0a2 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp @@ -32,17 +32,13 @@ BattlegroundRV::BattlegroundRV() StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S; StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S; StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE; - // we must set messageIds StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE; StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS; StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS; StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN; } -BattlegroundRV::~BattlegroundRV() -{ - -} +BattlegroundRV::~BattlegroundRV() { } void BattlegroundRV::PostUpdateImpl(uint32 diff) { @@ -103,10 +99,7 @@ void BattlegroundRV::StartingEventOpenDoors() void BattlegroundRV::AddPlayer(Player* player) { Battleground::AddPlayer(player); - //create score and add it to map, default values are set in constructor - BattlegroundRVScore* sc = new BattlegroundRVScore; - - PlayerScores[player->GetGUID()] = sc; + PlayerScores[player->GetGUID()] = new BattlegroundScore; UpdateWorldState(BG_RV_WORLD_STATE_A, GetAlivePlayersCountByTeam(ALLIANCE)); UpdateWorldState(BG_RV_WORLD_STATE_H, GetAlivePlayersCountByTeam(HORDE)); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRV.h b/src/server/game/Battlegrounds/Zones/BattlegroundRV.h index d8ac082ec19..115fd95d1b0 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.h @@ -18,7 +18,7 @@ #ifndef __BATTLEGROUNDRV_H #define __BATTLEGROUNDRV_H -class Battleground; +#include "Battleground.h" enum BattlegroundRVObjectTypes { @@ -91,13 +91,6 @@ enum BattlegroundRVData BG_RV_WORLD_STATE = 0xe1a }; -class BattlegroundRVScore : public BattlegroundScore -{ - public: - BattlegroundRVScore() {}; - virtual ~BattlegroundRVScore() {}; -}; - class BattlegroundRV : public Battleground { public: @@ -105,11 +98,11 @@ class BattlegroundRV : public Battleground ~BattlegroundRV(); /* inherited from BattlegroundClass */ - virtual void AddPlayer(Player* player); - virtual void StartingEventCloseDoors(); - virtual void StartingEventOpenDoors(); - virtual void Reset(); - virtual void FillInitialWorldStates(WorldPacket &d); + void AddPlayer(Player* player); + void StartingEventCloseDoors(); + void StartingEventOpenDoors(); + void Reset(); + void FillInitialWorldStates(WorldPacket &d); void RemovePlayer(Player* player, uint64 guid, uint32 team); void HandleAreaTrigger(Player* Source, uint32 Trigger); @@ -122,7 +115,7 @@ class BattlegroundRV : public Battleground uint32 State; bool PillarCollision; - virtual void PostUpdateImpl(uint32 diff); + void PostUpdateImpl(uint32 diff); protected: uint32 getTimer() { return Timer; }; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp index f082744d833..eae1c1e3545 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp @@ -16,7 +16,6 @@ * with this program. If not, see . */ -#include "Battleground.h" #include "BattlegroundSA.h" #include "Language.h" #include "Player.h" diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h index 78653a993a0..748db56dc77 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h @@ -19,13 +19,12 @@ #ifndef __BATTLEGROUNDSA_H #define __BATTLEGROUNDSA_H -class Battleground; +#include "Battleground.h" -class BattlegroundSAScore : public BattlegroundScore +struct BattlegroundSAScore : public BattlegroundScore { - public: - BattlegroundSAScore(): demolishers_destroyed(0), gates_destroyed(0) {}; - virtual ~BattlegroundSAScore() {}; + BattlegroundSAScore(): demolishers_destroyed(0), gates_destroyed(0) { } + ~BattlegroundSAScore() { } uint8 demolishers_destroyed; uint8 gates_destroyed; }; @@ -444,25 +443,25 @@ class BattlegroundSA : public Battleground /* inherited from BattlegroundClass */ /// Called when a player join battle - virtual void AddPlayer(Player* player); + void AddPlayer(Player* player); /// Called when battle start - virtual void StartingEventCloseDoors(); - virtual void StartingEventOpenDoors(); + void StartingEventCloseDoors(); + void StartingEventOpenDoors(); /// Called for ini battleground, after that the first player be entered - virtual bool SetupBattleground(); - virtual void Reset(); + bool SetupBattleground(); + void Reset(); /// Called for generate packet contain worldstate data - virtual void FillInitialWorldStates(WorldPacket& data); + void FillInitialWorldStates(WorldPacket& data); /// Called when a player deal damage to building (door) - virtual void EventPlayerDamagedGO(Player* player, GameObject* go, uint32 eventType); + void EventPlayerDamagedGO(Player* player, GameObject* go, uint32 eventType); /// Called when a player kill a unit in bg - virtual void HandleKillUnit(Creature* creature, Player* killer); + void HandleKillUnit(Creature* creature, Player* killer); /// Return the nearest graveyard where player can respawn - virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player); + WorldSafeLocsEntry const* GetClosestGraveYard(Player* player); /// Called when a player click on flag (graveyard flag) - virtual void EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj); + void EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj); /// Called when a player use a gamobject (relic) - virtual void EventPlayerUsedGO(Player* Source, GameObject* object); + void EventPlayerUsedGO(Player* Source, GameObject* object); /// Return gate id, relative to bg data, according to gameobject id uint32 getGateIdFromDamagedOrDestroyEventId(uint32 id) { diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp index 9eb84b1f83d..5fd6e43c029 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp @@ -16,7 +16,6 @@ * with this program. If not, see . */ -#include "Battleground.h" #include "BattlegroundWS.h" #include "Creature.h" #include "GameObject.h" @@ -67,18 +66,18 @@ void BattlegroundWS::PostUpdateImpl(uint32 diff) { if (GetStartTime() >= 27*MINUTE*IN_MILLISECONDS) { - if (GetTeamScore(ALLIANCE) == 0) + if (GetTeamScore(TEAM_ALLIANCE) == 0) { - if (GetTeamScore(HORDE) == 0) // No one scored - result is tie - EndBattleground(0); + if (GetTeamScore(TEAM_HORDE) == 0) // No one scored - result is tie + EndBattleground(WINNER_NONE); else // Horde has more points and thus wins EndBattleground(HORDE); } - else if (GetTeamScore(HORDE) == 0) + else if (GetTeamScore(TEAM_HORDE) == 0) EndBattleground(ALLIANCE); // Alliance has > 0, Horde has 0, alliance wins - else if (GetTeamScore(HORDE) == GetTeamScore(ALLIANCE)) // Team score equal, winner is team that scored the last flag + else if (GetTeamScore(TEAM_HORDE) == GetTeamScore(TEAM_ALLIANCE)) // Team score equal, winner is team that scored the last flag EndBattleground(_lastFlagCaptureTeam); - else if (GetTeamScore(HORDE) > GetTeamScore(ALLIANCE)) // Last but not least, check who has the higher score + else if (GetTeamScore(TEAM_HORDE) > GetTeamScore(TEAM_ALLIANCE)) // Last but not least, check who has the higher score EndBattleground(HORDE); else EndBattleground(ALLIANCE); @@ -100,6 +99,7 @@ void BattlegroundWS::PostUpdateImpl(uint32 diff) RespawnFlag(ALLIANCE, true); } } + if (_flagState[TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND) { _flagsDropTimer[TEAM_ALLIANCE] -= diff; @@ -111,6 +111,7 @@ void BattlegroundWS::PostUpdateImpl(uint32 diff) _bothFlagsKept = false; } } + if (_flagState[TEAM_HORDE] == BG_WS_FLAG_STATE_WAIT_RESPAWN) { _flagsTimer[TEAM_HORDE] -= diff; @@ -121,6 +122,7 @@ void BattlegroundWS::PostUpdateImpl(uint32 diff) RespawnFlag(HORDE, true); } } + if (_flagState[TEAM_HORDE] == BG_WS_FLAG_STATE_ON_GROUND) { _flagsDropTimer[TEAM_HORDE] -= diff; @@ -132,6 +134,7 @@ void BattlegroundWS::PostUpdateImpl(uint32 diff) _bothFlagsKept = false; } } + if (_bothFlagsKept) { _flagSpellForceTimer += diff; @@ -267,7 +270,7 @@ void BattlegroundWS::RespawnFlagAfterDrop(uint32 team) else sLog->outError(LOG_FILTER_BATTLEGROUND, "unknown droped flag bg, guid: %u", GUID_LOPART(GetDroppedFlagGUID(team))); - SetDroppedFlagGUID(0, team); + SetDroppedFlagGUID(0, GetTeamIndexByTeamId(team)); _bothFlagsKept = false; } @@ -281,7 +284,7 @@ void BattlegroundWS::EventPlayerCapturedFlag(Player* Source) Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); if (Source->GetTeam() == ALLIANCE) { - if (!this->IsHordeFlagPickedup()) + if (!IsHordeFlagPickedup()) return; SetHordeFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time // horde flag in base (but not respawned yet) @@ -292,14 +295,14 @@ void BattlegroundWS::EventPlayerCapturedFlag(Player* Source) Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT); if (_flagDebuffState == 2) Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT); - if (GetTeamScore(ALLIANCE) < BG_WS_MAX_TEAM_SCORE) + if (GetTeamScore(TEAM_ALLIANCE) < BG_WS_MAX_TEAM_SCORE) AddPoint(ALLIANCE, 1); PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_ALLIANCE); RewardReputationToTeam(890, m_ReputationCapture, ALLIANCE); } else { - if (!this->IsAllianceFlagPickedup()) + if (!IsAllianceFlagPickedup()) return; SetAllianceFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time // alliance flag in base (but not respawned yet) @@ -310,7 +313,7 @@ void BattlegroundWS::EventPlayerCapturedFlag(Player* Source) Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT); if (_flagDebuffState == 2) Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT); - if (GetTeamScore(HORDE) < BG_WS_MAX_TEAM_SCORE) + if (GetTeamScore(TEAM_HORDE) < BG_WS_MAX_TEAM_SCORE) AddPoint(HORDE, 1); PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_HORDE); RewardReputationToTeam(889, m_ReputationCapture, HORDE); @@ -327,17 +330,17 @@ void BattlegroundWS::EventPlayerCapturedFlag(Player* Source) SendMessageToAll(LANG_BG_WS_CAPTURED_AF, CHAT_MSG_BG_SYSTEM_HORDE, Source); UpdateFlagState(Source->GetTeam(), 1); // flag state none - UpdateTeamScore(Source->GetTeam()); + UpdateTeamScore(Source->GetTeamId()); // only flag capture should be updated UpdatePlayerScore(Source, SCORE_FLAG_CAPTURES, 1); // +1 flag captures // update last flag capture to be used if teamscore is equal SetLastFlagCapture(Source->GetTeam()); - if (GetTeamScore(ALLIANCE) == BG_WS_MAX_TEAM_SCORE) + if (GetTeamScore(TEAM_ALLIANCE) == BG_WS_MAX_TEAM_SCORE) winner = ALLIANCE; - if (GetTeamScore(HORDE) == BG_WS_MAX_TEAM_SCORE) + if (GetTeamScore(TEAM_HORDE) == BG_WS_MAX_TEAM_SCORE) winner = HORDE; if (winner) @@ -365,7 +368,7 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* Source) // just take off the aura if (Source->GetTeam() == ALLIANCE) { - if (!this->IsHordeFlagPickedup()) + if (!IsHordeFlagPickedup()) return; if (GetFlagPickerGUID(TEAM_HORDE) == Source->GetGUID()) { @@ -375,7 +378,7 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* Source) } else { - if (!this->IsAllianceFlagPickedup()) + if (!IsAllianceFlagPickedup()) return; if (GetFlagPickerGUID(TEAM_ALLIANCE) == Source->GetGUID()) { @@ -490,7 +493,8 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target } //Alliance flag on ground(not in base) (returned or picked up again from ground!) - if (GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10) && target_obj->GetGOInfo()->entry == BG_OBJECT_A_FLAG_GROUND_WS_ENTRY) + if (GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10) + && target_obj->GetGOInfo()->entry == BG_OBJECT_A_FLAG_GROUND_WS_ENTRY) { if (Source->GetTeam() == ALLIANCE) { @@ -524,7 +528,8 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target } //Horde flag on ground(not in base) (returned or picked up again) - if (GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10) && target_obj->GetGOInfo()->entry == BG_OBJECT_H_FLAG_GROUND_WS_ENTRY) + if (GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10) + && target_obj->GetGOInfo()->entry == BG_OBJECT_H_FLAG_GROUND_WS_ENTRY) { if (Source->GetTeam() == HORDE) { @@ -572,22 +577,22 @@ void BattlegroundWS::RemovePlayer(Player* player, uint64 guid, uint32 /*team*/) if (!player) { sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundWS: Removing offline player who has the FLAG!!"); - this->SetAllianceFlagPicker(0); - this->RespawnFlag(ALLIANCE, false); + SetAllianceFlagPicker(0); + RespawnFlag(ALLIANCE, false); } else - this->EventPlayerDroppedFlag(player); + EventPlayerDroppedFlag(player); } if (IsHordeFlagPickedup() && m_FlagKeepers[TEAM_HORDE] == guid) { if (!player) { sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundWS: Removing offline player who has the FLAG!!"); - this->SetHordeFlagPicker(0); - this->RespawnFlag(HORDE, false); + SetHordeFlagPicker(0); + RespawnFlag(HORDE, false); } else - this->EventPlayerDroppedFlag(player); + EventPlayerDroppedFlag(player); } } @@ -601,7 +606,7 @@ void BattlegroundWS::UpdateFlagState(uint32 team, uint32 value) void BattlegroundWS::UpdateTeamScore(uint32 team) { - if (team == ALLIANCE) + if (team == TEAM_ALLIANCE) UpdateWorldState(BG_WS_FLAG_CAPTURES_ALLIANCE, GetTeamScore(team)); else UpdateWorldState(BG_WS_FLAG_CAPTURES_HORDE, GetTeamScore(team)); @@ -712,17 +717,14 @@ void BattlegroundWS::Reset() //call parent's class reset Battleground::Reset(); - m_FlagKeepers[TEAM_ALLIANCE] = 0; - m_FlagKeepers[TEAM_HORDE] = 0; - + m_FlagKeepers[TEAM_ALLIANCE] = 0; + m_FlagKeepers[TEAM_HORDE] = 0; m_DroppedFlagGUID[TEAM_ALLIANCE] = 0; - m_DroppedFlagGUID[TEAM_HORDE] = 0; - - _flagState[TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE; - _flagState[TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE; - - m_TeamScores[TEAM_ALLIANCE] = 0; - m_TeamScores[TEAM_HORDE] = 0; + m_DroppedFlagGUID[TEAM_HORDE] = 0; + _flagState[TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE; + _flagState[TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE; + m_TeamScores[TEAM_ALLIANCE] = 0; + m_TeamScores[TEAM_HORDE] = 0; if (sBattlegroundMgr->IsBGWeekend(GetTypeID())) { @@ -736,25 +738,25 @@ void BattlegroundWS::Reset() m_HonorWinKills = 1; m_HonorEndKills = 2; } - _minutesElapsed = 0; - _lastFlagCaptureTeam = 0; - _bothFlagsKept = false; - _flagDebuffState = 0; - _flagSpellForceTimer = 0; - _flagsDropTimer[TEAM_ALLIANCE] = 0; - _flagsDropTimer[TEAM_HORDE] = 0; - _flagsTimer[TEAM_ALLIANCE] = 0; - _flagsTimer[TEAM_HORDE] = 0; + _minutesElapsed = 0; + _lastFlagCaptureTeam = 0; + _bothFlagsKept = false; + _flagDebuffState = 0; + _flagSpellForceTimer = 0; + _flagsDropTimer[TEAM_ALLIANCE] = 0; + _flagsDropTimer[TEAM_HORDE] = 0; + _flagsTimer[TEAM_ALLIANCE] = 0; + _flagsTimer[TEAM_HORDE] = 0; } void BattlegroundWS::EndBattleground(uint32 winner) { - //win reward + // Win reward if (winner == ALLIANCE) RewardHonorToTeam(GetBonusHonorFromKill(m_HonorWinKills), ALLIANCE); if (winner == HORDE) RewardHonorToTeam(GetBonusHonorFromKill(m_HonorWinKills), HORDE); - //complete map_end rewards (even if no team wins) + // Complete map_end rewards (even if no team wins) RewardHonorToTeam(GetBonusHonorFromKill(m_HonorEndKills), ALLIANCE); RewardHonorToTeam(GetBonusHonorFromKill(m_HonorEndKills), HORDE); @@ -773,7 +775,6 @@ void BattlegroundWS::HandleKillPlayer(Player* player, Player* killer) void BattlegroundWS::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor) { - BattlegroundScoreMap::iterator itr = PlayerScores.find(Source->GetGUID()); if (itr == PlayerScores.end()) // player not found return; @@ -819,8 +820,8 @@ WorldSafeLocsEntry const* BattlegroundWS::GetClosestGraveYard(Player* player) void BattlegroundWS::FillInitialWorldStates(WorldPacket& data) { - data << uint32(BG_WS_FLAG_CAPTURES_ALLIANCE) << uint32(GetTeamScore(ALLIANCE)); - data << uint32(BG_WS_FLAG_CAPTURES_HORDE) << uint32(GetTeamScore(HORDE)); + data << uint32(BG_WS_FLAG_CAPTURES_ALLIANCE) << uint32(GetTeamScore(TEAM_ALLIANCE)); + data << uint32(BG_WS_FLAG_CAPTURES_HORDE) << uint32(GetTeamScore(TEAM_HORDE)); if (_flagState[TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND) data << uint32(BG_WS_FLAG_UNK_ALLIANCE) << uint32(-1); @@ -838,6 +839,14 @@ void BattlegroundWS::FillInitialWorldStates(WorldPacket& data) data << uint32(BG_WS_FLAG_CAPTURES_MAX) << uint32(BG_WS_MAX_TEAM_SCORE); + if (GetStatus() == STATUS_IN_PROGRESS) + { + data << uint32(BG_WS_STATE_TIMER_ACTIVE) << uint32(1); + data << uint32(BG_WS_STATE_TIMER) << uint32(25-_minutesElapsed); + } + else + data << uint32(BG_WS_STATE_TIMER_ACTIVE) << uint32(0); + if (_flagState[TEAM_HORDE] == BG_WS_FLAG_STATE_ON_PLAYER) data << uint32(BG_WS_FLAG_STATE_HORDE) << uint32(2); else @@ -847,8 +856,5 @@ void BattlegroundWS::FillInitialWorldStates(WorldPacket& data) data << uint32(BG_WS_FLAG_STATE_ALLIANCE) << uint32(2); else data << uint32(BG_WS_FLAG_STATE_ALLIANCE) << uint32(1); - - data << uint32(BG_WS_STATE_TIMER_ACTIVE) << uint32(1); - data << uint32(BG_WS_STATE_TIMER) << uint32(25 - _minutesElapsed); } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h index 4cd3c129beb..ec9f4ab1506 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h @@ -146,13 +146,12 @@ enum BG_WS_Objectives #define WS_EVENT_START_BATTLE 8563 -class BattlegroundWGScore : public BattlegroundScore +struct BattlegroundWGScore : public BattlegroundScore { - public: - BattlegroundWGScore() : FlagCaptures(0), FlagReturns(0) {}; - virtual ~BattlegroundWGScore() {}; - uint32 FlagCaptures; - uint32 FlagReturns; + BattlegroundWGScore() : FlagCaptures(0), FlagReturns(0) { } + ~BattlegroundWGScore() { } + uint32 FlagCaptures; + uint32 FlagReturns; }; class BattlegroundWS : public Battleground @@ -163,9 +162,9 @@ class BattlegroundWS : public Battleground ~BattlegroundWS(); /* inherited from BattlegroundClass */ - virtual void AddPlayer(Player* player); - virtual void StartingEventCloseDoors(); - virtual void StartingEventOpenDoors(); + void AddPlayer(Player* player); + void StartingEventCloseDoors(); + void StartingEventOpenDoors(); /* BG Flags */ uint64 GetFlagPickerGUID(int32 team) const @@ -183,28 +182,32 @@ class BattlegroundWS : public Battleground uint8 GetFlagState(uint32 team) { return _flagState[GetTeamIndexByTeamId(team)]; } /* Battleground Events */ - virtual void EventPlayerDroppedFlag(Player* Source); - virtual void EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj); - virtual void EventPlayerCapturedFlag(Player* Source); + void EventPlayerDroppedFlag(Player* Source); + void EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj); + void EventPlayerCapturedFlag(Player* Source); void RemovePlayer(Player* player, uint64 guid, uint32 team); void HandleAreaTrigger(Player* Source, uint32 Trigger); void HandleKillPlayer(Player* player, Player* killer); bool SetupBattleground(); - virtual void Reset(); + void Reset(); void EndBattleground(uint32 winner); - virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player); + WorldSafeLocsEntry const* GetClosestGraveYard(Player* player); void UpdateFlagState(uint32 team, uint32 value); void SetLastFlagCapture(uint32 team) { _lastFlagCaptureTeam = team; } void UpdateTeamScore(uint32 team); void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true); - void SetDroppedFlagGUID(uint64 guid, uint32 TeamID) { m_DroppedFlagGUID[GetTeamIndexByTeamId(TeamID)] = guid;} + void SetDroppedFlagGUID(uint64 guid, int32 team = -1) + { + if (team == TEAM_ALLIANCE || team == TEAM_HORDE) + m_DroppedFlagGUID[team] = guid; + } + uint64 GetDroppedFlagGUID(uint32 TeamID) { return m_DroppedFlagGUID[GetTeamIndexByTeamId(TeamID)];} - virtual void FillInitialWorldStates(WorldPacket& data); + void FillInitialWorldStates(WorldPacket& data); /* Scorekeeping */ - uint32 GetTeamScore(uint32 TeamID) const { return m_TeamScores[GetTeamIndexByTeamId(TeamID)]; } void AddPoint(uint32 TeamID, uint32 Points = 1) { m_TeamScores[GetTeamIndexByTeamId(TeamID)] += Points; } void SetTeamPoint(uint32 TeamID, uint32 Points = 0) { m_TeamScores[GetTeamIndexByTeamId(TeamID)] = Points; } void RemovePoint(uint32 TeamID, uint32 Points = 1) { m_TeamScores[GetTeamIndexByTeamId(TeamID)] -= Points; } @@ -224,7 +227,6 @@ class BattlegroundWS : public Battleground uint8 _flagDebuffState; // 0 - no debuffs, 1 - focused assault, 2 - brutal assault uint8 _minutesElapsed; - virtual void PostUpdateImpl(uint32 diff); + void PostUpdateImpl(uint32 diff); }; #endif - diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index cbc478078e5..b0db83e0187 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -3632,36 +3632,10 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex) // Wild object not have owner and check clickable by players map->AddToMap(pGameObj); - if (pGameObj->GetGoType() == GAMEOBJECT_TYPE_FLAGDROP && m_caster->GetTypeId() == TYPEID_PLAYER) - { - Player* player = m_caster->ToPlayer(); - Battleground* bg = player->GetBattleground(); - - switch (pGameObj->GetMapId()) - { - case 489: //WS - { - if (bg && bg->GetTypeID(true) == BATTLEGROUND_WS && bg->GetStatus() == STATUS_IN_PROGRESS) - { - uint32 team = ALLIANCE; - - if (player->GetTeam() == team) - team = HORDE; - - ((BattlegroundWS*)bg)->SetDroppedFlagGUID(pGameObj->GetGUID(), team); - } - break; - } - case 566: //EY - { - if (bg && bg->GetTypeID(true) == BATTLEGROUND_EY && bg->GetStatus() == STATUS_IN_PROGRESS) - { - ((BattlegroundEY*)bg)->SetDroppedFlagGUID(pGameObj->GetGUID()); - } - break; - } - } - } + if (pGameObj->GetGoType() == GAMEOBJECT_TYPE_FLAGDROP) + if (Player* player = m_caster->ToPlayer()) + if (Battleground* bg = player->GetBattleground()) + bg->SetDroppedFlagGUID(pGameObj->GetGUID(), player->GetTeam() == ALLIANCE ? TEAM_HORDE: TEAM_ALLIANCE); if (uint32 linkedEntry = pGameObj->GetGOInfo()->GetLinkedGameObjectEntry()) { -- cgit v1.2.3