diff options
| author | Vincent-Michael <Vincent_Michael@gmx.de> | 2013-08-18 18:13:14 +0200 |
|---|---|---|
| committer | Vincent-Michael <Vincent_Michael@gmx.de> | 2013-08-18 18:13:14 +0200 |
| commit | f16f427c48cb7fb9a62b75066f831af541d0ca02 (patch) | |
| tree | cef1f28b26e234ad088169eb0d83132f0754af52 /src/server/game | |
| parent | 74689b1d93c2150130907b6baac861bfbcc47dd3 (diff) | |
| parent | 19343ddd557fd03aecf7a19d310f46c62a8f336f (diff) | |
Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4
Conflicts:
src/server/game/Entities/Unit/Unit.cpp
src/server/game/Entities/Unit/Unit.h
src/server/game/Handlers/CharacterHandler.cpp
src/server/game/Server/WorldSocket.cpp
src/server/game/Spells/Spell.cpp
src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp
src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp
src/server/scripts/EasternKingdoms/zone_tirisfal_glades.cpp
src/server/scripts/Kalimdor/CMakeLists.txt
src/server/scripts/Kalimdor/zone_azshara.cpp
src/server/scripts/Kalimdor/zone_moonglade.cpp
src/server/scripts/Kalimdor/zone_orgrimmar.cpp
src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_anzu.cpp
src/server/scripts/Spells/spell_hunter.cpp
Diffstat (limited to 'src/server/game')
19 files changed, 203 insertions, 156 deletions
diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp index 8f46896f6e8..befd6b9d16e 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp @@ -311,7 +311,7 @@ void FollowerAI::StartFollow(Player* player, uint32 factionForFollower, const Qu Player* FollowerAI::GetLeaderForFollower() { - if (Player* player = Unit::GetPlayer(*me, m_uiLeaderGUID)) + if (Player* player = ObjectAccessor::GetPlayer(*me, m_uiLeaderGUID)) { if (player->IsAlive()) return player; diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp index c5b5cd5dfef..febf2e789a2 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.cpp +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp @@ -343,7 +343,7 @@ void SmartAI::UpdateAI(uint32 diff) { if (me->FindNearestCreature(mFollowArrivedEntry, INTERACTION_DISTANCE, true)) { - if (Player* player = me->GetPlayer(*me, mFollowGuid)) + if (Player* player = ObjectAccessor::GetPlayer(*me, mFollowGuid)) { if (!mFollowCreditType) player->RewardPlayerAndGroupAtEvent(mFollowCredit, me); @@ -365,7 +365,9 @@ void SmartAI::UpdateAI(uint32 diff) return; } mFollowArrivedTimer = 1000; - } else mFollowArrivedTimer -= diff; + } + else + mFollowArrivedTimer -= diff; } if (!UpdateVictim()) diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index a957f0fb5ba..4050797335d 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -2529,7 +2529,7 @@ void Creature::SetDisplayId(uint32 modelId) if (CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelInfo(modelId)) { - SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, minfo->bounding_radius * GetFloatValue(OBJECT_FIELD_SCALE_X)); - SetFloatValue(UNIT_FIELD_COMBATREACH, minfo->combat_reach * GetFloatValue(OBJECT_FIELD_SCALE_X)); + SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, minfo->bounding_radius * GetObjectScale()); + SetFloatValue(UNIT_FIELD_COMBATREACH, minfo->combat_reach * GetObjectScale()); } } diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index 0dbd92d19f5..f09a5503944 100644 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.h @@ -192,6 +192,7 @@ class Object uint32 GetEntry() const { return GetUInt32Value(OBJECT_FIELD_ENTRY); } void SetEntry(uint32 entry) { SetUInt32Value(OBJECT_FIELD_ENTRY, entry); } + float GetObjectScale() const { return GetFloatValue(OBJECT_FIELD_SCALE_X); } virtual void SetObjectScale(float scale) { SetFloatValue(OBJECT_FIELD_SCALE_X, scale); } TypeID GetTypeId() const { return m_objectTypeId; } diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 5a43e87a151..ba5868da072 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -8280,8 +8280,7 @@ void Player::_ApplyItemBonuses(ItemTemplate const* proto, uint8 slot, bool apply ApplyHealthRegenBonus(int32(val), apply); break; case ITEM_MOD_SPELL_PENETRATION: - ApplyModInt32Value(PLAYER_FIELD_MOD_TARGET_RESISTANCE, -val, apply); - m_spellPenetrationItemMod += apply ? val : -val; + ApplySpellPenetrationBonus(val, apply); break; case ITEM_MOD_MASTERY_RATING: ApplyRatingMod(CR_MASTERY, int32(val), apply); @@ -14201,8 +14200,7 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "+ %u HEALTH_REGENERATION", enchant_amount); break; case ITEM_MOD_SPELL_PENETRATION: - ApplyModInt32Value(PLAYER_FIELD_MOD_TARGET_RESISTANCE, enchant_amount, apply); - m_spellPenetrationItemMod += apply ? int32(enchant_amount) : -int32(enchant_amount); + ApplySpellPenetrationBonus(enchant_amount, apply); TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "+ %u SPELL_PENETRATION", enchant_amount); break; case ITEM_MOD_BLOCK_VALUE: @@ -27148,7 +27146,7 @@ float Player::GetCollisionHeight(bool mounted) const CreatureModelDataEntry const* modelData = sCreatureModelDataStore.LookupEntry(displayInfo->ModelId); ASSERT(modelData); - float scaleMod = GetFloatValue(OBJECT_FIELD_SCALE_X); // 99% sure about this + float scaleMod = GetObjectScale(); // 99% sure about this return scaleMod * mountModelData->MountHeight + modelData->CollisionHeight * 0.5f; } diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 9a2a2c0429d..8fc7deb59ff 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1957,6 +1957,7 @@ class Player : public Unit, public GridObject<Player> bool UpdateStats(Stats stat); bool UpdateAllStats(); + void ApplySpellPenetrationBonus(int32 amount, bool apply); void UpdateResistances(uint32 school); void UpdateArmor(); void UpdateMaxHealth(); diff --git a/src/server/game/Entities/Unit/StatSystem.cpp b/src/server/game/Entities/Unit/StatSystem.cpp index e319f45f6f2..b7f4aa909c0 100644 --- a/src/server/game/Entities/Unit/StatSystem.cpp +++ b/src/server/game/Entities/Unit/StatSystem.cpp @@ -170,6 +170,12 @@ bool Player::UpdateAllStats() return true; } +void Player::ApplySpellPenetrationBonus(int32 amount, bool apply) +{ + ApplyModInt32Value(PLAYER_FIELD_MOD_TARGET_RESISTANCE, -amount, apply); + m_spellPenetrationItemMod += apply ? amount : -amount; +} + void Player::UpdateResistances(uint32 school) { if (school > SPELL_SCHOOL_NORMAL) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index b7c713dd49c..473cc3a8ed4 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -1488,70 +1488,88 @@ uint32 Unit::CalcArmorReducedDamage(Unit* victim, const uint32 damage, SpellInfo return std::max<uint32>(damage * (1.0f - tmpvalue), 1); } -void Unit::CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffectType damagetype, uint32 const damage, uint32 *absorb, uint32 *resist, SpellInfo const* spellInfo) +uint32 Unit::CalcSpellResistance(Unit* victim, SpellSchoolMask schoolMask, SpellInfo const* spellInfo) const { - if (!victim || !victim->IsAlive() || !damage) - return; + // Magic damage, check for resists + if (!(schoolMask & SPELL_SCHOOL_MASK_SPELL)) + return 0; - DamageInfo dmgInfo = DamageInfo(this, victim, damage, spellInfo, schoolMask, damagetype); + // Ignore spells that can't be resisted + if (spellInfo && spellInfo->AttributesEx4 & SPELL_ATTR4_IGNORE_RESISTANCES) + return 0; - // Magic damage, check for resists - // Ignore spells that cant be resisted - if ((schoolMask & SPELL_SCHOOL_MASK_NORMAL) == 0 && (!spellInfo || (spellInfo->AttributesEx4 & SPELL_ATTR4_IGNORE_RESISTANCES) == 0)) - { - float victimResistance = float(victim->GetResistance(schoolMask)); - victimResistance += float(GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, schoolMask)); + uint8 const bossLevel = 83; + uint32 const bossResistanceConstant = 510; + uint32 resistanceConstant = 0; + uint8 level = victim->getLevel(); - if (Player* player = ToPlayer()) - victimResistance -= float(player->GetSpellPenetrationItemMod()); + if (level == bossLevel) + resistanceConstant = bossResistanceConstant; + else + resistanceConstant = level * 5; - // Resistance can't be lower then 0. - if (victimResistance < 0.0f) - victimResistance = 0.0f; + int32 baseVictimResistance = victim->GetResistance(schoolMask); + baseVictimResistance += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, schoolMask); - static uint32 const BOSS_LEVEL = 83; - static float const BOSS_RESISTANCE_CONSTANT = 510.0f; - uint32 level = victim->getLevel(); - float resistanceConstant = 0.0f; + if (Player const* player = ToPlayer()) + baseVictimResistance -= player->GetSpellPenetrationItemMod(); - if (level == BOSS_LEVEL) - resistanceConstant = BOSS_RESISTANCE_CONSTANT; - else - resistanceConstant = level * 5.0f; + // Resistance can't be lower then 0 + int32 victimResistance = std::max<int32>(baseVictimResistance, 0); - float averageResist = victimResistance / (victimResistance + resistanceConstant); - float discreteResistProbability[11]; - for (uint32 i = 0; i < 11; ++i) - { - discreteResistProbability[i] = 0.5f - 2.5f * fabs(0.1f * i - averageResist); - if (discreteResistProbability[i] < 0.0f) - discreteResistProbability[i] = 0.0f; - } + if (victimResistance > 0) + { + int32 ignoredResistance = 0; - if (averageResist <= 0.1f) - { - discreteResistProbability[0] = 1.0f - 7.5f * averageResist; - discreteResistProbability[1] = 5.0f * averageResist; - discreteResistProbability[2] = 2.5f * averageResist; - } + AuraEffectList const& ResIgnoreAuras = GetAuraEffectsByType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST); + for (AuraEffectList::const_iterator itr = ResIgnoreAuras.begin(); itr != ResIgnoreAuras.end(); ++itr) + if ((*itr)->GetMiscValue() & schoolMask) + ignoredResistance += (*itr)->GetAmount(); - float r = float(rand_norm()); - uint32 i = 0; - float probabilitySum = discreteResistProbability[0]; + ignoredResistance = std::min<int32>(ignoredResistance, 100); + ApplyPct(victimResistance, 100 - ignoredResistance); + } - while (r >= probabilitySum && i < 10) - probabilitySum += discreteResistProbability[++i]; + if (victimResistance <= 0) + return 0; - float damageResisted = float(damage * i / 10); + float averageResist = float(victimResistance) / float(victimResistance + resistanceConstant); - AuraEffectList const& ResIgnoreAuras = GetAuraEffectsByType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST); - for (AuraEffectList::const_iterator j = ResIgnoreAuras.begin(); j != ResIgnoreAuras.end(); ++j) - if ((*j)->GetMiscValue() & schoolMask) - AddPct(damageResisted, -(*j)->GetAmount()); + float discreteResistProbability[11]; + for (uint32 i = 0; i < 11; ++i) + { + discreteResistProbability[i] = 0.5f - 2.5f * fabs(0.1f * i - averageResist); + if (discreteResistProbability[i] < 0.0f) + discreteResistProbability[i] = 0.0f; + } - dmgInfo.ResistDamage(uint32(damageResisted)); + if (averageResist <= 0.1f) + { + discreteResistProbability[0] = 1.0f - 7.5f * averageResist; + discreteResistProbability[1] = 5.0f * averageResist; + discreteResistProbability[2] = 2.5f * averageResist; } + uint32 resistance = 0; + float r = float(rand_norm()); + float probabilitySum = discreteResistProbability[0]; + + while (r >= probabilitySum && resistance < 10) + probabilitySum += discreteResistProbability[++resistance]; + + return resistance * 10; +} + +void Unit::CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffectType damagetype, uint32 const damage, uint32* absorb, uint32* resist, SpellInfo const* spellInfo /*= NULL*/) +{ + if (!victim || !victim->IsAlive() || !damage) + return; + + DamageInfo dmgInfo = DamageInfo(this, victim, damage, spellInfo, schoolMask, damagetype); + + uint32 spellResistance = CalcSpellResistance(victim, schoolMask, spellInfo); + dmgInfo.ResistDamage(CalculatePct(damage, spellResistance)); + // Ignore Absorption Auras float auraAbsorbMod = 0; AuraEffectList const& AbsIgnoreAurasA = GetAuraEffectsByType(SPELL_AURA_MOD_TARGET_ABSORB_SCHOOL); @@ -1734,7 +1752,7 @@ void Unit::CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffe *absorb = dmgInfo.GetAbsorb(); } -void Unit::CalcHealAbsorb(Unit* victim, const SpellInfo* healSpell, uint32 &healAmount, uint32 &absorb) +void Unit::CalcHealAbsorb(Unit* victim, SpellInfo const* healSpell, uint32 &healAmount, uint32 &absorb) { if (!healAmount) return; @@ -2132,24 +2150,26 @@ bool Unit::isBlockCritical() return false; } -int32 Unit::GetMechanicResistChance(const SpellInfo* spell) const +int32 Unit::GetMechanicResistChance(SpellInfo const* spellInfo) const { - if (!spell) + if (!spellInfo) return 0; - int32 resist_mech = 0; + + int32 resistMech = 0; for (uint8 eff = 0; eff < MAX_SPELL_EFFECTS; ++eff) { - if (!spell->Effects[eff].IsEffect()) - break; - int32 effect_mech = spell->GetEffectMechanic(eff); - if (effect_mech) + if (!spellInfo->Effects[eff].IsEffect()) + break; + + int32 effectMech = spellInfo->GetEffectMechanic(eff); + if (effectMech) { - int32 temp = GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_MECHANIC_RESISTANCE, effect_mech); - if (resist_mech < temp) - resist_mech = temp; + int32 temp = GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_MECHANIC_RESISTANCE, effectMech); + if (resistMech < temp) + resistMech = temp; } } - return resist_mech; + return resistMech; } bool Unit::CanUseAttackType(uint8 attacktype) const @@ -2168,23 +2188,24 @@ bool Unit::CanUseAttackType(uint8 attacktype) const } // Melee based spells hit result calculations -SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spell) +SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spellInfo) { // Spells with SPELL_ATTR3_IGNORE_HIT_RESULT will additionally fully ignore // resist and deflect chances - if (spell->AttributesEx3 & SPELL_ATTR3_IGNORE_HIT_RESULT) + if (spellInfo->AttributesEx3 & SPELL_ATTR3_IGNORE_HIT_RESULT) return SPELL_MISS_NONE; WeaponAttackType attType = BASE_ATTACK; // Check damage class instead of attack type to correctly handle judgements // - they are meele, but can't be dodged/parried/deflected because of ranged dmg class - if (spell->DmgClass == SPELL_DAMAGE_CLASS_RANGED) + if (spellInfo->DmgClass == SPELL_DAMAGE_CLASS_RANGED) attType = RANGED_ATTACK; - uint32 roll = urand (0, 10000); + uint32 roll = urand(0, 10000); + + uint32 missChance = uint32(MeleeSpellMissChance(victim, attType, spellInfo->Id) * 100.0f); - uint32 missChance = uint32(MeleeSpellMissChance(victim, attType, spell->Id) * 100.0f); // Roll miss uint32 tmp = missChance; if (roll < tmp) @@ -2195,12 +2216,12 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spell) // Get effects mechanic and chance for (uint8 eff = 0; eff < MAX_SPELL_EFFECTS; ++eff) { - int32 effect_mech = spell->GetEffectMechanic(eff); + int32 effect_mech = spellInfo->GetEffectMechanic(eff); if (effect_mech) { int32 temp = victim->GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_MECHANIC_RESISTANCE, effect_mech); - if (resist_mech < temp*100) - resist_mech = temp*100; + if (resist_mech < temp * 100) + resist_mech = temp * 100; } } // Roll chance @@ -2210,14 +2231,14 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spell) bool canDodge = true; bool canParry = true; - bool canBlock = spell->AttributesEx3 & SPELL_ATTR3_BLOCKABLE_SPELL; + bool canBlock = spellInfo->AttributesEx3 & SPELL_ATTR3_BLOCKABLE_SPELL; // Same spells cannot be parry/dodge - if (spell->Attributes & SPELL_ATTR0_IMPOSSIBLE_DODGE_PARRY_BLOCK) + if (spellInfo->Attributes & SPELL_ATTR0_IMPOSSIBLE_DODGE_PARRY_BLOCK) return SPELL_MISS_NONE; // Chance resist mechanic - int32 resist_chance = victim->GetMechanicResistChance(spell) * 100; + int32 resist_chance = victim->GetMechanicResistChance(spellInfo) * 100; tmp += resist_chance; if (roll < tmp) return SPELL_MISS_RESIST; @@ -2232,7 +2253,7 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spell) if (victim->HasInArc(M_PI, this) || victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION)) { int32 deflect_chance = victim->GetTotalAuraModifier(SPELL_AURA_DEFLECT_SPELLS) * 100; - tmp+=deflect_chance; + tmp += deflect_chance; if (roll < tmp) return SPELL_MISS_DEFLECT; } @@ -2253,7 +2274,7 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spell) } else // Only deterrence as of 3.3.5 { - if (spell->AttributesCu & SPELL_ATTR0_CU_REQ_CASTER_BEHIND_TARGET) + if (spellInfo->AttributesCu & SPELL_ATTR0_CU_REQ_CASTER_BEHIND_TARGET) canParry = false; } } @@ -2271,13 +2292,19 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spell) AuraEffectList const& ignore = GetAuraEffectsByType(SPELL_AURA_IGNORE_COMBAT_RESULT); for (AuraEffectList::const_iterator i = ignore.begin(); i != ignore.end(); ++i) { - if (!(*i)->IsAffectingSpell(spell)) + if (!(*i)->IsAffectingSpell(spellInfo)) continue; switch ((*i)->GetMiscValue()) { - case MELEE_HIT_DODGE: canDodge = false; break; - case MELEE_HIT_BLOCK: canBlock = false; break; - case MELEE_HIT_PARRY: canParry = false; break; + case MELEE_HIT_DODGE: + canDodge = false; + break; + case MELEE_HIT_BLOCK: + canBlock = false; + break; + case MELEE_HIT_PARRY: + canParry = false; + break; default: TC_LOG_DEBUG(LOG_FILTER_UNITS, "Spell %u SPELL_AURA_IGNORE_COMBAT_RESULT has unhandled state %d", (*i)->GetId(), (*i)->GetMiscValue()); break; @@ -2335,18 +2362,18 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spell) } /// @todo need use unit spell resistances in calculations -SpellMissInfo Unit::MagicSpellHitResult(Unit* victim, SpellInfo const* spell) +SpellMissInfo Unit::MagicSpellHitResult(Unit* victim, SpellInfo const* spellInfo) { // Can`t miss on dead target (on skinning for example) if (!victim->IsAlive() && victim->GetTypeId() != TYPEID_PLAYER) return SPELL_MISS_NONE; - SpellSchoolMask schoolMask = spell->GetSchoolMask(); + SpellSchoolMask schoolMask = spellInfo->GetSchoolMask(); // PvP - PvE spell misschances per leveldif > 2 int32 lchance = victim->GetTypeId() == TYPEID_PLAYER ? 7 : 11; int32 thisLevel = getLevelForTarget(victim); if (GetTypeId() == TYPEID_UNIT && ToCreature()->IsTrigger()) - thisLevel = std::max<int32>(thisLevel, spell->SpellLevel); + thisLevel = std::max<int32>(thisLevel, spellInfo->SpellLevel); int32 leveldif = int32(victim->getLevelForTarget(this)) - thisLevel; // Base hit chance from attacker and victim levels @@ -2358,10 +2385,10 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit* victim, SpellInfo const* spell) // Spellmod from SPELLMOD_RESIST_MISS_CHANCE if (Player* modOwner = GetSpellModOwner()) - modOwner->ApplySpellMod(spell->Id, SPELLMOD_RESIST_MISS_CHANCE, modHitChance); + modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_RESIST_MISS_CHANCE, modHitChance); // Spells with SPELL_ATTR3_IGNORE_HIT_RESULT will ignore target's avoidance effects - if (!(spell->AttributesEx3 & SPELL_ATTR3_IGNORE_HIT_RESULT)) + if (!(spellInfo->AttributesEx3 & SPELL_ATTR3_IGNORE_HIT_RESULT)) { // Chance hit from victim SPELL_AURA_MOD_ATTACKER_SPELL_HIT_CHANCE auras modHitChance += victim->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_ATTACKER_SPELL_HIT_CHANCE, schoolMask); @@ -2371,10 +2398,7 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit* victim, SpellInfo const* spell) // Increase hit chance from attacker SPELL_AURA_MOD_SPELL_HIT_CHANCE and attacker ratings HitChance += int32(m_modSpellHitChance * 100.0f); - if (HitChance < 100) - HitChance = 100; - else if (HitChance > 10000) - HitChance = 10000; + RoundToInterval(HitChance, 100, 10000); int32 tmp = 10000 - HitChance; @@ -2385,11 +2409,11 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit* victim, SpellInfo const* spell) // Spells with SPELL_ATTR3_IGNORE_HIT_RESULT will additionally fully ignore // resist and deflect chances - if (spell->AttributesEx3 & SPELL_ATTR3_IGNORE_HIT_RESULT) + if (spellInfo->AttributesEx3 & SPELL_ATTR3_IGNORE_HIT_RESULT) return SPELL_MISS_NONE; // Chance resist mechanic (select max value from every mechanic spell effect) - int32 resist_chance = victim->GetMechanicResistChance(spell) * 100; + int32 resist_chance = victim->GetMechanicResistChance(spellInfo) * 100; tmp += resist_chance; // Roll chance @@ -2416,19 +2440,19 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit* victim, SpellInfo const* spell) // Parry // For spells // Resist -SpellMissInfo Unit::SpellHitResult(Unit* victim, SpellInfo const* spell, bool CanReflect) +SpellMissInfo Unit::SpellHitResult(Unit* victim, SpellInfo const* spellInfo, bool CanReflect) { // Check for immune - if (victim->IsImmunedToSpell(spell)) + if (victim->IsImmunedToSpell(spellInfo)) return SPELL_MISS_IMMUNE; // All positive spells can`t miss /// @todo client not show miss log for this spells - so need find info for this in dbc and use it! - if (spell->IsPositive() - &&(!IsHostileTo(victim))) // prevent from affecting enemy by "positive" spell + if (spellInfo->IsPositive() && !IsHostileTo(victim)) // prevent from affecting enemy by "positive" spell return SPELL_MISS_NONE; + // Check for immune - if (victim->IsImmunedToDamage(spell)) + if (victim->IsImmunedToDamage(spellInfo)) return SPELL_MISS_IMMUNE; if (this == victim) @@ -2444,25 +2468,25 @@ SpellMissInfo Unit::SpellHitResult(Unit* victim, SpellInfo const* spell, bool Ca int32 reflectchance = victim->GetTotalAuraModifier(SPELL_AURA_REFLECT_SPELLS); Unit::AuraEffectList const& mReflectSpellsSchool = victim->GetAuraEffectsByType(SPELL_AURA_REFLECT_SPELLS_SCHOOL); for (Unit::AuraEffectList::const_iterator i = mReflectSpellsSchool.begin(); i != mReflectSpellsSchool.end(); ++i) - if ((*i)->GetMiscValue() & spell->GetSchoolMask()) + if ((*i)->GetMiscValue() & spellInfo->GetSchoolMask()) reflectchance += (*i)->GetAmount(); if (reflectchance > 0 && roll_chance_i(reflectchance)) { // Start triggers for remove charges if need (trigger only for victim, and mark as active spell) - ProcDamageAndSpell(victim, PROC_FLAG_NONE, PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG, PROC_EX_REFLECT, 1, BASE_ATTACK, spell); + ProcDamageAndSpell(victim, PROC_FLAG_NONE, PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG, PROC_EX_REFLECT, 1, BASE_ATTACK, spellInfo); return SPELL_MISS_REFLECT; } } - switch (spell->DmgClass) + switch (spellInfo->DmgClass) { case SPELL_DAMAGE_CLASS_RANGED: case SPELL_DAMAGE_CLASS_MELEE: - return MeleeSpellHitResult(victim, spell); + return MeleeSpellHitResult(victim, spellInfo); case SPELL_DAMAGE_CLASS_NONE: return SPELL_MISS_NONE; case SPELL_DAMAGE_CLASS_MAGIC: - return MagicSpellHitResult(victim, spell); + return MagicSpellHitResult(victim, spellInfo); } return SPELL_MISS_NONE; } @@ -5458,8 +5482,8 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere // if damage is more than need or target die from damage deal finish spell if (triggeredByAura->GetAmount() <= int32(damage) || GetHealth() <= damage) { - // remember guid before aura delete - uint64 casterGuid = triggeredByAura->GetCasterGUID(); + // remember caster before aura delete + Unit* caster = triggeredByAura->GetCaster(); // Remove aura (before cast for prevent infinite loop handlers) RemoveAurasDueToSpell(triggeredByAura->GetId()); @@ -5467,7 +5491,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere uint32 spell = sSpellMgr->GetSpellWithRank(27285, dummySpell->GetRank()); // Cast finish spell (triggeredByAura already not exist!) - if (Unit* caster = GetUnit(*this, casterGuid)) + if (caster) caster->CastSpell(this, spell, true, castItem); return true; // no hidden cooldown } @@ -5482,14 +5506,14 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere // if damage is more than need deal finish spell if (triggeredByAura->GetAmount() <= int32(damage)) { - // remember guid before aura delete - uint64 casterGuid = triggeredByAura->GetCasterGUID(); + // remember caster before aura delete + Unit* caster = triggeredByAura->GetCaster(); // Remove aura (before cast for prevent infinite loop handlers) RemoveAurasDueToSpell(triggeredByAura->GetId()); // Cast finish spell (triggeredByAura already not exist!) - if (Unit* caster = GetUnit(*this, casterGuid)) + if (caster) caster->CastSpell(this, 32865, true, castItem); return true; // no hidden cooldown } @@ -14166,7 +14190,7 @@ void Unit::RestoreFaction() Unit* Unit::GetRedirectThreatTarget() { - return _redirectThreadInfo.GetTargetGUID() ? GetUnit(*this, _redirectThreadInfo.GetTargetGUID()) : NULL; + return _redirectThreadInfo.GetTargetGUID() ? ObjectAccessor::GetUnit(*this, _redirectThreadInfo.GetTargetGUID()) : NULL; } bool Unit::CreateVehicleKit(uint32 id, uint32 creatureEntry) diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 9aade75a536..e5005e0ad02 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1483,16 +1483,16 @@ class Unit : public WorldObject void ApplyResilience(Unit const* victim, int32 * damage, bool isCrit) const; float MeleeSpellMissChance(Unit const* victim, WeaponAttackType attType, uint32 spellId) const; - SpellMissInfo MeleeSpellHitResult(Unit* victim, SpellInfo const* spell); - SpellMissInfo MagicSpellHitResult(Unit* victim, SpellInfo const* spell); - SpellMissInfo SpellHitResult(Unit* victim, SpellInfo const* spell, bool canReflect = false); + SpellMissInfo MeleeSpellHitResult(Unit* victim, SpellInfo const* spellInfo); + SpellMissInfo MagicSpellHitResult(Unit* victim, SpellInfo const* spellInfo); + SpellMissInfo SpellHitResult(Unit* victim, SpellInfo const* spellInfo, bool canReflect = false); float GetUnitDodgeChance() const; float GetUnitParryChance() const; float GetUnitBlockChance() const; float GetUnitMissChance(WeaponAttackType attType) const; float GetUnitCriticalChance(WeaponAttackType attackType, const Unit* victim) const; - int32 GetMechanicResistChance(const SpellInfo* spell) const; + int32 GetMechanicResistChance(SpellInfo const* spellInfo) const; bool CanUseAttackType(uint8 attacktype) const; virtual uint32 GetBlockPercent() const { return 30; } @@ -1989,16 +1989,17 @@ class Unit : public WorldObject void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply); void ApplySpellDispelImmunity(const SpellInfo* spellProto, DispelType type, bool apply); - virtual bool IsImmunedToSpell(SpellInfo const* spellInfo) const; - // redefined in Creature + virtual bool IsImmunedToSpell(SpellInfo const* spellInfo) const; // redefined in Creature + bool IsImmunedToDamage(SpellSchoolMask meleeSchoolMask) const; bool IsImmunedToDamage(SpellInfo const* spellInfo) const; - virtual bool IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const; - // redefined in Creature + virtual bool IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const; // redefined in Creature + static bool IsDamageReducedByArmor(SpellSchoolMask damageSchoolMask, SpellInfo const* spellInfo = NULL, uint8 effIndex = MAX_SPELL_EFFECTS); - uint32 CalcArmorReducedDamage(Unit* victim, const uint32 damage, SpellInfo const* spellInfo, WeaponAttackType attackType=MAX_ATTACK); - void CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffectType damagetype, const uint32 damage, uint32 *absorb, uint32 *resist, SpellInfo const* spellInfo = NULL); - void CalcHealAbsorb(Unit* victim, const SpellInfo* spellProto, uint32 &healAmount, uint32 &absorb); + uint32 CalcArmorReducedDamage(Unit* victim, const uint32 damage, SpellInfo const* spellInfo, WeaponAttackType attackType = MAX_ATTACK); + uint32 CalcSpellResistance(Unit* victim, SpellSchoolMask schoolMask, SpellInfo const* spellInfo) const; + void CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffectType damagetype, uint32 const damage, uint32* absorb, uint32* resist, SpellInfo const* spellInfo = NULL); + void CalcHealAbsorb(Unit* victim, SpellInfo const* spellInfo, uint32& healAmount, uint32& absorb); void UpdateSpeed(UnitMoveType mtype, bool forced); float GetSpeed(UnitMoveType mtype) const; @@ -2009,7 +2010,7 @@ class Unit : public WorldObject int32 CalculateSpellDamage(Unit const* target, SpellInfo const* spellProto, uint8 effect_index, int32 const* basePoints = NULL) const; int32 CalcSpellDuration(SpellInfo const* spellProto); int32 ModSpellDuration(SpellInfo const* spellProto, Unit const* target, int32 duration, bool positive, uint32 effectMask); - void ModSpellCastTime(SpellInfo const* spellProto, int32 & castTime, Spell* spell=NULL); + void ModSpellCastTime(SpellInfo const* spellProto, int32& castTime, Spell* spell = NULL); float CalculateLevelPenalty(SpellInfo const* spellProto) const; void addFollower(FollowerReference* pRef) { m_FollowingRefManager.insertFirst(pRef); } diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index 15676d17c43..d6cd2d3fa45 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -245,7 +245,10 @@ void WorldSession::HandleCharEnum(PreparedQueryResult result) Player::BuildEnumData(result, &dataBuffer, &bitBuffer); - _legitCharacters.insert(guidLow); + // Do not allow banned characters to log in + if (!(*result)[20].GetUInt32()) + _legitCharacters.insert(guidLow); + if (!sWorld->HasCharacterNameData(guidLow)) // This can happen if characters are inserted into the database manually. Core hasn't loaded name data yet. sWorld->AddCharacterNameData(guidLow, (*result)[1].GetString(), (*result)[4].GetUInt8(), (*result)[2].GetUInt8(), (*result)[3].GetUInt8(), (*result)[7].GetUInt8()); } while (result->NextRow()); diff --git a/src/server/game/Scripting/ScriptLoader.cpp b/src/server/game/Scripting/ScriptLoader.cpp index 8d155badd6d..3c1ec5db0a8 100644 --- a/src/server/game/Scripting/ScriptLoader.cpp +++ b/src/server/game/Scripting/ScriptLoader.cpp @@ -176,6 +176,7 @@ void AddSC_boss_sulfuron(); void AddSC_boss_majordomo(); void AddSC_boss_ragnaros(); void AddSC_instance_molten_core(); +void AddSC_instance_ragefire_chasm(); //Ragefire Chasm void AddSC_the_scarlet_enclave(); //Scarlet Enclave void AddSC_the_scarlet_enclave_c1(); void AddSC_the_scarlet_enclave_c2(); @@ -234,6 +235,7 @@ void AddSC_boss_archaedas(); //Uldaman void AddSC_boss_ironaya(); void AddSC_uldaman(); void AddSC_instance_uldaman(); +void AddSC_instance_the_stockade(); //The Stockade void AddSC_boss_akilzon(); //Zul'Aman void AddSC_boss_halazzi(); void AddSC_boss_hex_lord_malacrass(); @@ -307,10 +309,12 @@ void AddSC_boss_mal_ganis(); void AddSC_boss_meathook(); void AddSC_culling_of_stratholme(); void AddSC_instance_culling_of_stratholme(); +void AddSC_instance_dire_maul(); //Dire Maul void AddSC_boss_celebras_the_cursed(); //Maraudon void AddSC_boss_landslide(); void AddSC_boss_noxxion(); void AddSC_boss_ptheradras(); +void AddSC_instance_maraudon(); void AddSC_boss_onyxia(); //Onyxia's Lair void AddSC_instance_onyxias_lair(); void AddSC_boss_amnennar_the_coldbringer(); //Razorfen Downs @@ -568,8 +572,10 @@ void AddSC_boss_hydromancer_thespia(); //CR Steam Vault void AddSC_boss_mekgineer_steamrigger(); void AddSC_boss_warlord_kalithresh(); void AddSC_instance_steam_vault(); +void AddSC_instance_the_slave_pens(); //The Slave Pens void AddSC_boss_hungarfen(); //CR Underbog void AddSC_boss_the_black_stalker(); +void AddSC_instance_the_underbog(); void AddSC_boss_gruul(); //Gruul's Lair void AddSC_boss_high_king_maulgar(); void AddSC_instance_gruuls_lair(); @@ -837,6 +843,7 @@ void AddEasternKingdomsScripts() AddSC_boss_majordomo(); AddSC_boss_ragnaros(); AddSC_instance_molten_core(); + AddSC_instance_ragefire_chasm(); //Ragefire Chasm AddSC_the_scarlet_enclave(); //Scarlet Enclave AddSC_the_scarlet_enclave_c1(); AddSC_the_scarlet_enclave_c2(); @@ -891,6 +898,7 @@ void AddEasternKingdomsScripts() AddSC_boss_muru(); AddSC_boss_kiljaeden(); AddSC_sunwell_plateau(); + AddSC_instance_the_stockade(); //The Stockade AddSC_boss_archaedas(); //Uldaman AddSC_boss_ironaya(); AddSC_uldaman(); @@ -973,10 +981,12 @@ void AddKalimdorScripts() AddSC_boss_meathook(); AddSC_culling_of_stratholme(); AddSC_instance_culling_of_stratholme(); + AddSC_instance_dire_maul(); //Dire Maul AddSC_boss_celebras_the_cursed(); //Maraudon AddSC_boss_landslide(); AddSC_boss_noxxion(); AddSC_boss_ptheradras(); + AddSC_instance_maraudon(); AddSC_boss_onyxia(); //Onyxia's Lair AddSC_instance_onyxias_lair(); AddSC_boss_amnennar_the_coldbringer(); //Razorfen Downs @@ -1079,8 +1089,10 @@ void AddOutlandScripts() AddSC_boss_mekgineer_steamrigger(); AddSC_boss_warlord_kalithresh(); AddSC_instance_steam_vault(); + AddSC_instance_the_slave_pens(); //The Slave Pens AddSC_boss_hungarfen(); //CR Underbog AddSC_boss_the_black_stalker(); + AddSC_instance_the_underbog(); AddSC_boss_gruul(); //Gruul's Lair AddSC_boss_high_king_maulgar(); AddSC_instance_gruuls_lair(); diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp index 2b5c22c1b14..15cb32113dd 100644 --- a/src/server/game/Server/WorldSocket.cpp +++ b/src/server/game/Server/WorldSocket.cpp @@ -773,11 +773,11 @@ int WorldSocket::HandleSendAuthSession() WorldPacket packet(SMSG_AUTH_CHALLENGE, 37); BigNumber seed1; seed1.SetRand(16 * 8); - packet.append(seed1.AsByteArray(16), 16); // new encryption seeds + packet.append(seed1.AsByteArray(16).get(), 16); // new encryption seeds BigNumber seed2; seed2.SetRand(16 * 8); - packet.append(seed2.AsByteArray(16), 16); // new encryption seeds + packet.append(seed2.AsByteArray(16).get(), 16); // new encryption seeds packet << m_Seed; packet << uint8(1); diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index d44845a389e..617a50c2344 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -2113,7 +2113,7 @@ void AuraEffect::HandleAuraModScale(AuraApplication const* aurApp, uint8 mode, b Unit* target = aurApp->GetTarget(); - float scale = target->GetFloatValue(OBJECT_FIELD_SCALE_X); + float scale = target->GetObjectScale(); ApplyPercentModFloatVar(scale, float(GetAmount()), apply); target->SetObjectScale(scale); } @@ -2133,7 +2133,7 @@ void AuraEffect::HandleAuraCloneCaster(AuraApplication const* aurApp, uint8 mode // What must be cloned? at least display and scale target->SetDisplayId(caster->GetDisplayId()); - //target->SetObjectScale(caster->GetFloatValue(OBJECT_FIELD_SCALE_X)); // we need retail info about how scaling is handled (aura maybe?) + //target->SetObjectScale(caster->GetObjectScale()); // we need retail info about how scaling is handled (aura maybe?) target->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_MIRROR_IMAGE); } else diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 1ca3e08a8b4..4cb6fcc40e5 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -1027,8 +1027,7 @@ int32 Aura::CalcDispelChance(Unit* auraTarget, bool offensive) const if (offensive && auraTarget) resistChance += auraTarget->GetTotalAuraModifier(SPELL_AURA_MOD_DISPEL_RESIST); - resistChance = resistChance < 0 ? 0 : resistChance; - resistChance = resistChance > 100 ? 100 : resistChance; + RoundToInterval(resistChance, 0, 100); return 100 - resistChance; } diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index ef30e99dcfc..22da5257663 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -3053,12 +3053,12 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggered if (Player* player = m_caster->ToPlayer()) { - if (!m_caster->ToPlayer()->GetCommandStatus(CHEAT_CASTTIME)) + if (!player->GetCommandStatus(CHEAT_CASTTIME)) { - m_caster->ToPlayer()->SetSpellModTakingSpell(this, true); + player->SetSpellModTakingSpell(this, true); // calculate cast time (calculated after first CheckCast check to prevent charge counting for first CheckCast fail) - m_casttime = m_spellInfo->CalcCastTime(m_caster->getLevel(), this); - m_caster->ToPlayer()->SetSpellModTakingSpell(this, false); + m_casttime = m_spellInfo->CalcCastTime(player->getLevel(), this); + player->SetSpellModTakingSpell(this, false); } else m_casttime = 0; // Set cast time to 0 if .cheat casttime is enabled. diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h index 6f1df2560dc..f7940b2b8da 100644 --- a/src/server/game/Spells/SpellScript.h +++ b/src/server/game/Spells/SpellScript.h @@ -74,9 +74,9 @@ class _SpellScript EffectHook(uint8 _effIndex); virtual ~EffectHook() { } - uint8 GetAffectedEffectsMask(SpellInfo const* spellEntry); - bool IsEffectAffected(SpellInfo const* spellEntry, uint8 effIndex); - virtual bool CheckEffect(SpellInfo const* spellEntry, uint8 effIndex) = 0; + uint8 GetAffectedEffectsMask(SpellInfo const* spellInfo); + bool IsEffectAffected(SpellInfo const* spellInfo, uint8 effIndex); + virtual bool CheckEffect(SpellInfo const* spellInfo, uint8 effIndex) = 0; std::string EffIndexToString(); protected: uint8 effIndex; @@ -86,7 +86,7 @@ class _SpellScript { public: EffectNameCheck(uint16 _effName) { effName = _effName; } - bool Check(SpellInfo const* spellEntry, uint8 effIndex); + bool Check(SpellInfo const* spellInfo, uint8 effIndex); std::string ToString(); private: uint16 effName; @@ -96,7 +96,7 @@ class _SpellScript { public: EffectAuraNameCheck(uint16 _effAurName) { effAurName = _effAurName; } - bool Check(SpellInfo const* spellEntry, uint8 effIndex); + bool Check(SpellInfo const* spellInfo, uint8 effIndex); std::string ToString(); private: uint16 effAurName; @@ -114,7 +114,7 @@ class _SpellScript virtual void Register() = 0; // Function called on server startup, if returns false script won't be used in core // use for: dbc/template data presence/correctness checks - virtual bool Validate(SpellInfo const* /*spellEntry*/) { return true; } + virtual bool Validate(SpellInfo const* /*spellInfo*/) { return true; } // Function called when script is created, if returns false script will be unloaded afterwards // use for: initializing local script variables (DO NOT USE CONSTRUCTOR FOR THIS PURPOSE!) virtual bool Load() { return true; } @@ -185,7 +185,7 @@ class SpellScript : public _SpellScript public: EffectHandler(SpellEffectFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName); std::string ToString(); - bool CheckEffect(SpellInfo const* spellEntry, uint8 effIndex); + bool CheckEffect(SpellInfo const* spellInfo, uint8 effIndex); void Call(SpellScript* spellScript, SpellEffIndex effIndex); private: SpellEffectFnType pEffectHandlerScript; @@ -204,7 +204,7 @@ class SpellScript : public _SpellScript { public: TargetHook(uint8 _effectIndex, uint16 _targetType, bool _area); - bool CheckEffect(SpellInfo const* spellEntry, uint8 effIndex); + bool CheckEffect(SpellInfo const* spellInfo, uint8 effIndex); std::string ToString(); protected: uint16 targetType; @@ -488,7 +488,7 @@ class AuraScript : public _SpellScript public: EffectBase(uint8 _effIndex, uint16 _effName); std::string ToString(); - bool CheckEffect(SpellInfo const* spellEntry, uint8 effIndex); + bool CheckEffect(SpellInfo const* spellInfo, uint8 effIndex); }; class EffectPeriodicHandler : public EffectBase { diff --git a/src/server/game/Warden/WardenCheckMgr.cpp b/src/server/game/Warden/WardenCheckMgr.cpp index 51bb2e52342..a8bcd61db73 100644 --- a/src/server/game/Warden/WardenCheckMgr.cpp +++ b/src/server/game/Warden/WardenCheckMgr.cpp @@ -94,7 +94,7 @@ void WardenCheckMgr::LoadWardenChecks() { uint8 temp[24]; memset(temp, 0, len); - memcpy(temp, wardenCheck->Data.AsByteArray(), wardenCheck->Data.GetNumBytes()); + memcpy(temp, wardenCheck->Data.AsByteArray().get(), wardenCheck->Data.GetNumBytes()); std::reverse(temp, temp + len); wardenCheck->Data.SetBinary((uint8*)temp, len); } @@ -126,7 +126,7 @@ void WardenCheckMgr::LoadWardenChecks() { uint8 *temp = new uint8[len]; memset(temp, 0, len); - memcpy(temp, wr->Result.AsByteArray(), wr->Result.GetNumBytes()); + memcpy(temp, wr->Result.AsByteArray().get(), wr->Result.GetNumBytes()); std::reverse(temp, temp + len); wr->Result.SetBinary((uint8*)temp, len); delete [] temp; diff --git a/src/server/game/Warden/WardenMac.cpp b/src/server/game/Warden/WardenMac.cpp index 74ca285c525..27e859e741d 100644 --- a/src/server/game/Warden/WardenMac.cpp +++ b/src/server/game/Warden/WardenMac.cpp @@ -42,7 +42,7 @@ void WardenMac::Init(WorldSession* pClient, BigNumber* K) { _session = pClient; // Generate Warden Key - SHA1Randx WK(K->AsByteArray(), K->GetNumBytes()); + SHA1Randx WK(K->AsByteArray().get(), K->GetNumBytes()); WK.Generate(_inputKey, 16); WK.Generate(_outputKey, 16); /* diff --git a/src/server/game/Warden/WardenWin.cpp b/src/server/game/Warden/WardenWin.cpp index 1ce96b44ee6..60a1fecedc9 100644 --- a/src/server/game/Warden/WardenWin.cpp +++ b/src/server/game/Warden/WardenWin.cpp @@ -46,7 +46,7 @@ void WardenWin::Init(WorldSession* session, BigNumber* k) { _session = session; // Generate Warden Key - SHA1Randx WK(k->AsByteArray(), k->GetNumBytes()); + SHA1Randx WK(k->AsByteArray().get(), k->GetNumBytes()); WK.Generate(_inputKey, 16); WK.Generate(_outputKey, 16); @@ -266,7 +266,7 @@ void WardenWin::RequestData() case PAGE_CHECK_A: case PAGE_CHECK_B: { - buff.append(wd->Data.AsByteArray(0, false), wd->Data.GetNumBytes()); + buff.append(wd->Data.AsByteArray(0, false).get(), wd->Data.GetNumBytes()); buff << uint32(wd->Address); buff << uint8(wd->Length); break; @@ -279,7 +279,7 @@ void WardenWin::RequestData() } case DRIVER_CHECK: { - buff.append(wd->Data.AsByteArray(0, false), wd->Data.GetNumBytes()); + buff.append(wd->Data.AsByteArray(0, false).get(), wd->Data.GetNumBytes()); buff << uint8(index++); break; } @@ -295,7 +295,7 @@ void WardenWin::RequestData() } /*case PROC_CHECK: { - buff.append(wd->i.AsByteArray(0, false), wd->i.GetNumBytes()); + buff.append(wd->i.AsByteArray(0, false).get(), wd->i.GetNumBytes()); buff << uint8(index++); buff << uint8(index++); buff << uint32(wd->Address); @@ -395,7 +395,7 @@ void WardenWin::HandleData(ByteBuffer &buff) continue; } - if (memcmp(buff.contents() + buff.rpos(), rs->Result.AsByteArray(0, false), rd->Length) != 0) + if (memcmp(buff.contents() + buff.rpos(), rs->Result.AsByteArray(0, false).get(), rd->Length) != 0) { TC_LOG_DEBUG(LOG_FILTER_WARDEN, "RESULT MEM_CHECK fail CheckId %u account Id %u", *itr, _session->GetAccountId()); checkFailed = *itr; @@ -474,7 +474,7 @@ void WardenWin::HandleData(ByteBuffer &buff) continue; } - if (memcmp(buff.contents() + buff.rpos(), rs->Result.AsByteArray(0, false), 20) != 0) // SHA1 + if (memcmp(buff.contents() + buff.rpos(), rs->Result.AsByteArray(0, false).get(), 20) != 0) // SHA1 { TC_LOG_DEBUG(LOG_FILTER_WARDEN, "RESULT MPQ_CHECK fail, CheckId %u account Id %u", *itr, _session->GetAccountId()); checkFailed = *itr; |
