Merge branch 'master' into 4.x

Conflicts:
	src/server/game/Achievements/AchievementMgr.cpp
	src/server/game/Achievements/AchievementMgr.h
	src/server/game/Entities/Corpse/Corpse.cpp
	src/server/game/Entities/Unit/Unit.cpp
	src/server/game/Quests/QuestDef.cpp
	src/server/shared/Database/Implementation/CharacterDatabase.cpp
	src/server/shared/Database/Implementation/CharacterDatabase.h
This commit is contained in:
Nay committed 2012-01-07 17:13:42 +00:00
commit 9c26ce8da5
1155 files changed
+6850 -2233

No files matched your search

+66 -62
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2008-2011 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify it
@@ -1127,7 +1127,7 @@ void Unit::DealSpellDamage(SpellNonMeleeDamage* damageInfo, bool durabilityLoss)
SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(damageInfo->SpellID);
if (spellProto == NULL)
{
sLog->outDebug(LOG_FILTER_UNITS, "Unit::DealSpellDamage have wrong damageInfo->SpellID: %u", damageInfo->SpellID);
sLog->outDebug(LOG_FILTER_UNITS, "Unit::DealSpellDamage has wrong damageInfo->SpellID: %u", damageInfo->SpellID);
return;
}
@@ -2405,7 +2405,7 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spell)
case MELEE_HIT_BLOCK: canBlock = false; break;
case MELEE_HIT_PARRY: canParry = false; break;
default:
sLog->outStaticDebug("Spell %u SPELL_AURA_IGNORE_COMBAT_RESULT have unhandled state %d", (*i)->GetId(), (*i)->GetMiscValue());
sLog->outStaticDebug("Spell %u SPELL_AURA_IGNORE_COMBAT_RESULT has unhandled state %d", (*i)->GetId(), (*i)->GetMiscValue());
break;
}
}
@@ -4651,7 +4651,7 @@ void Unit::AddGameObject(GameObject* gameObj)
SpellInfo const* createBySpell = sSpellMgr->GetSpellInfo(gameObj->GetSpellId());
// Need disable spell use for owner
if (createBySpell && createBySpell->Attributes & SPELL_ATTR0_DISABLED_WHILE_ACTIVE)
// note: item based cooldowns and cooldown spell mods with charges ignored (unknown existed cases)
// note: item based cooldowns and cooldown spell mods with charges ignored (unknown existing cases)
ToPlayer()->AddSpellAndCategoryCooldowns(createBySpell, 0, NULL, true);
}
}
@@ -4681,7 +4681,7 @@ void Unit::RemoveGameObject(GameObject* gameObj, bool del)
SpellInfo const* createBySpell = sSpellMgr->GetSpellInfo(spellid);
// Need activate spell use for owner
if (createBySpell && createBySpell->Attributes & SPELL_ATTR0_DISABLED_WHILE_ACTIVE)
// note: item based cooldowns and cooldown spell mods with charges ignored (unknown existed cases)
// note: item based cooldowns and cooldown spell mods with charges ignored (unknown existing cases)
ToPlayer()->SendCooldownEvent(createBySpell);
}
}
@@ -4976,7 +4976,7 @@ bool Unit::HandleHasteAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
if (!triggerEntry)
{
sLog->outError("Unit::HandleHasteAuraProc: Spell %u have not existed triggered spell %u", hasteSpell->Id, triggered_spell_id);
sLog->outError("Unit::HandleHasteAuraProc: Spell %u has non-existing triggered spell %u", hasteSpell->Id, triggered_spell_id);
return false;
}
@@ -5034,7 +5034,7 @@ bool Unit::HandleSpellCritChanceAuraProc(Unit* victim, uint32 /*damage*/, AuraEf
if (!triggerEntry)
{
sLog->outError("Unit::HandleHasteAuraProc: Spell %u have not existed triggered spell %u", triggeredByAuraSpell->Id, triggered_spell_id);
sLog->outError("Unit::HandleHasteAuraProc: Spell %u has non-existing triggered spell %u", triggeredByAuraSpell->Id, triggered_spell_id);
return false;
}
@@ -5630,7 +5630,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
case SPELLFAMILY_MAGE:
{
// Magic Absorption
if (dummySpell->SpellIconID == 459) // only this spell have SpellIconID == 459 and dummy aura
if (dummySpell->SpellIconID == 459) // only this spell has SpellIconID == 459 and dummy aura
{
if (getPowerType() != POWER_MANA)
return false;
@@ -7011,26 +7011,6 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
{
switch (dummySpell->Id)
{
// Earthen Power (Rank 1, 2)
case 51523:
case 51524:
{
// Totem itself must be a caster of this spell
Unit* caster = NULL;
for (ControlList::iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr) {
if ((*itr)->GetEntry() != 2630)
continue;
caster = *itr;
break;
}
if (!caster)
return false;
caster->CastSpell(caster, 59566, true, castItem, triggeredByAura, originalCaster);
return true;
}
// Tidal Force
case 55198:
{
@@ -7077,7 +7057,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
triggered_spell_id = 28850;
break;
}
// Windfury Weapon (Passive) 1-5 Ranks
// Windfury Weapon (Passive) 1-8 Ranks
case 33757:
{
Player* player = ToPlayer();
@@ -7092,8 +7072,10 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
return false;
WeaponAttackType attType = WeaponAttackType(player->GetAttackBySlot(castItem->GetSlot()));
if ((attType != BASE_ATTACK && attType != OFF_ATTACK) || !isAttackReady(attType))
return false;
if ((attType != BASE_ATTACK && attType != OFF_ATTACK)
|| attType == BASE_ATTACK && procFlag & PROC_FLAG_DONE_OFFHAND_ATTACK
|| attType == OFF_ATTACK && procFlag & PROC_FLAG_DONE_MAINHAND_ATTACK)
return false;
// Now compute real proc chance...
uint32 chance = 20;
@@ -7132,15 +7114,20 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
SpellInfo const* windfurySpellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!windfurySpellInfo)
{
sLog->outError("Unit::HandleDummyAuraProc: non existed spell id: %u (Windfury)", spellId);
sLog->outError("Unit::HandleDummyAuraProc: non-existing spell id: %u (Windfury)", spellId);
return false;
}
int32 extra_attack_power = CalculateSpellDamage(victim, windfurySpellInfo, 1);
// Value gained from additional AP
basepoints0 = int32(extra_attack_power / 14.0f * GetAttackTime(BASE_ATTACK) / 1000);
triggered_spell_id = 25504;
basepoints0 = int32(extra_attack_power / 14.0f * GetAttackTime(attType) / 1000);
if (procFlag & PROC_FLAG_DONE_MAINHAND_ATTACK)
triggered_spell_id = 25504;
if (procFlag & PROC_FLAG_DONE_OFFHAND_ATTACK)
triggered_spell_id = 33750;
// apply cooldown before cast to prevent processing itself
if (cooldown)
@@ -7378,6 +7365,13 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
if (GetTypeId() != TYPEID_PLAYER || !victim || !victim->isAlive() || !castItem || !castItem->IsEquipped())
return false;
Player* player = ToPlayer();
WeaponAttackType attType = WeaponAttackType(player->GetAttackBySlot(castItem->GetSlot()));
if ((attType != BASE_ATTACK && attType != OFF_ATTACK)
|| attType == BASE_ATTACK && procFlag & PROC_FLAG_DONE_OFFHAND_ATTACK
|| attType == OFF_ATTACK && procFlag & PROC_FLAG_DONE_MAINHAND_ATTACK)
return false;
float fire_onhit = float(CalculatePctF(dummySpell->Effects[EFFECT_0]. CalcValue(), 1.0f));
float add_spellpower = (float)(SpellBaseDamageBonus(SPELL_SCHOOL_MASK_FIRE)
@@ -7387,7 +7381,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
ApplyPctF(add_spellpower, 3.84f);
// Enchant on Off-Hand and ready?
if (castItem->GetSlot() == EQUIPMENT_SLOT_OFFHAND && isAttackReady(OFF_ATTACK))
if (castItem->GetSlot() == EQUIPMENT_SLOT_OFFHAND && procFlag & PROC_FLAG_DONE_OFFHAND_ATTACK)
{
float BaseWeaponSpeed = GetAttackTime(OFF_ATTACK) / 1000.0f;
@@ -7397,7 +7391,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
}
// Enchant on Main-Hand and ready?
else if (castItem->GetSlot() == EQUIPMENT_SLOT_MAINHAND && isAttackReady(BASE_ATTACK))
else if (castItem->GetSlot() == EQUIPMENT_SLOT_MAINHAND && procFlag & PROC_FLAG_DONE_MAINHAND_ATTACK)
{
float BaseWeaponSpeed = GetAttackTime(BASE_ATTACK) / 1000.0f;
@@ -7439,7 +7433,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
return false;
}
// Lightning Overload
if (dummySpell->SpellIconID == 2018) // only this spell have SpellFamily Shaman SpellIconID == 2018 and dummy aura
if (dummySpell->SpellIconID == 2018) // only this spell has SpellFamily Shaman SpellIconID == 2018 and dummy aura
{
if (!procSpell || GetTypeId() != TYPEID_PLAYER || !victim)
return false;
@@ -7491,7 +7485,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
if (!roll_chance_f(chance))
return false;
// Remove cooldown (Chain Lightning - have Category Recovery time)
// Remove cooldown (Chain Lightning - has Category Recovery time)
ToPlayer()->RemoveSpellCooldown(spellId);
}
@@ -7802,7 +7796,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
SpellInfo const* triggerEntry = sSpellMgr->GetSpellInfo(triggered_spell_id);
if (!triggerEntry)
{
sLog->outError("Unit::HandleDummyAuraProc: Spell %u have not existed triggered spell %u", dummySpell->Id, triggered_spell_id);
sLog->outError("Unit::HandleDummyAuraProc: Spell %u has non-existing triggered spell %u", dummySpell->Id, triggered_spell_id);
return false;
}
@@ -7860,7 +7854,7 @@ bool Unit::HandleObsModEnergyAuraProc(Unit* victim, uint32 /*damage*/, AuraEffec
// Try handle unknown trigger spells
if (!triggerEntry)
{
sLog->outError("Unit::HandleObsModEnergyAuraProc: Spell %u have not existed triggered spell %u", dummySpell->Id, triggered_spell_id);
sLog->outError("Unit::HandleObsModEnergyAuraProc: Spell %u has non-existing triggered spell %u", dummySpell->Id, triggered_spell_id);
return false;
}
@@ -7913,7 +7907,7 @@ bool Unit::HandleModDamagePctTakenAuraProc(Unit* victim, uint32 /*damage*/, Aura
if (!triggerEntry)
{
sLog->outError("Unit::HandleModDamagePctTakenAuraProc: Spell %u have not existed triggered spell %u", dummySpell->Id, triggered_spell_id);
sLog->outError("Unit::HandleModDamagePctTakenAuraProc: Spell %u has non-existing triggered spell %u", dummySpell->Id, triggered_spell_id);
return false;
}
@@ -8659,8 +8653,8 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
SpellInfo const* triggerEntry = sSpellMgr->GetSpellInfo(trigger_spell_id);
if (triggerEntry == NULL)
{
// Not cast unknown spell
// sLog->outError("Unit::HandleProcTriggerSpell: Spell %u have 0 in EffectTriggered[%d], not handled custom case?", auraSpellInfo->Id, triggeredByAura->GetEffIndex());
// Don't cast unknown spell
// sLog->outError("Unit::HandleProcTriggerSpell: Spell %u has 0 in EffectTriggered[%d]. Unhandled custom case?", auraSpellInfo->Id, triggeredByAura->GetEffIndex());
return false;
}
@@ -8747,7 +8741,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
if (!victim || !victim->isAlive())
return false;
// Not give if target already have full health
// Doesn't proc if target already has full health
if (victim->IsFullHealth())
return false;
// If your Greater Heal brings the target to full health, you gain $37595s1 mana.
@@ -8958,7 +8952,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
if ((maelstrom->GetStackAmount() == maelstrom->GetSpellInfo()->StackAmount) && roll_chance_i(aurEff->GetAmount()))
CastSpell(this, 70831, true, castItem, triggeredByAura);
// have rank dependent proc chance, ignore too often cases
// has rank dependant proc chance, ignore too often cases
// PPM = 2.5 * (rank of talent),
uint32 rank = auraSpellInfo->GetRank();
// 5 rank -> 100% 4 rank -> 80% and etc from full rate
@@ -9308,7 +9302,7 @@ ReputationRank Unit::GetReactionTo(Unit const* target) const
&& selfPlayerOwner->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_CONTESTED_PVP))
return REP_HOSTILE;
// if faction have reputation then hostile state dependent only from at_war state
// if faction has reputation, hostile state depends only from AtWar state
if (selfPlayerOwner->GetReputationMgr().IsAtWar(targetFactionEntry))
return REP_HOSTILE;
return REP_FRIENDLY;
@@ -10454,7 +10448,7 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellInfo const* spellProto, uint32
{
if (victim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, this))
{
// effect 0 have expected value but in negative state
// effect 0 has expected value but in negative state
int32 bonus = -(*i)->GetBase()->GetEffect(0)->GetAmount();
AddPctN(DoneTotalMod, bonus);
}
@@ -11490,7 +11484,8 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo)
return true;
}
if (spellInfo->Mechanic)
// Spells that don't have effectMechanics.
if (!spellInfo->HasAnyEffectMechanic() && spellInfo->Mechanic)
{
SpellImmuneList const& mechanicList = m_spellImmune[IMMUNITY_MECHANIC];
for (SpellImmuneList::const_iterator itr = mechanicList.begin(); itr != mechanicList.end(); ++itr)
@@ -11498,14 +11493,19 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo)
return true;
}
for (int i = 0; i < MAX_SPELL_EFFECTS; ++i)
bool immuneToAllEffects = true;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
// State/effect immunities applied by aura expect full spell immunity
// Ignore effects with mechanic, they are supposed to be checked separately
if (!spellInfo->Effects[i].Mechanic)
if (IsImmunedToSpellEffect(spellInfo, i))
return true;
if (spellInfo->Effects[i].Mechanic || !IsImmunedToSpellEffect(spellInfo, i))
{
immuneToAllEffects = false;
break;
}
}
if (immuneToAllEffects) //Return immune only if the target is immune to all spell effects.
return true;
if (spellInfo->Id != 42292 && spellInfo->Id !=59752)
{
@@ -11733,7 +11733,7 @@ void Unit::MeleeDamageBonus(Unit* victim, uint32 *pdamage, WeaponAttackType attT
{
if (victim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, this))
{
// effect 0 have expected value but in negative state
// effect 0 has expected value but in negative state
int32 bonus = -(*i)->GetBase()->GetEffect(0)->GetAmount();
AddPctN(DoneTotalMod, bonus);
}
@@ -12775,6 +12775,10 @@ void Unit::setDeathState(DeathState s)
// do not why since in IncreaseMaxHealth currenthealth is checked
SetHealth(0);
SetPower(getPowerType(), 0);
// players in instance don't have ZoneScript, but they have InstanceScript
if (ZoneScript* zoneScript = GetZoneScript() ? GetZoneScript() : (ZoneScript*)GetInstanceScript())
zoneScript->OnUnitDeath(this);
}
else if (s == JUST_ALIVED)
RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); // clear skinnable for creature and player (at battleground)
@@ -12998,7 +13002,7 @@ Unit* Creature::SelectVictim()
// last case when creature must not go to evade mode:
// it in combat but attacker not make any damage and not enter to aggro radius to have record in threat list
// for example at owner command to pet attack some far away creature
// Note: creature not have targeted movement generator but have attacker in this case
// Note: creature does not have targeted movement generator but has attacker in this case
for (AttackerSet::const_iterator itr = m_attackers.begin(); itr != m_attackers.end(); ++itr)
{
if ((*itr) && !canCreatureAttack(*itr) && (*itr)->GetTypeId() != TYPEID_PLAYER
@@ -13384,7 +13388,7 @@ bool Unit::HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, f
{
if (unitMod >= UNIT_MOD_END || modifierType >= MODIFIER_TYPE_END)
{
sLog->outError("ERROR in HandleStatModifier(): non existed UnitMods or wrong UnitModifierType!");
sLog->outError("ERROR in HandleStatModifier(): non-existing UnitMods or wrong UnitModifierType!");
return false;
}
@@ -13448,7 +13452,7 @@ float Unit::GetModifierValue(UnitMods unitMod, UnitModifierType modifierType) co
{
if (unitMod >= UNIT_MOD_END || modifierType >= MODIFIER_TYPE_END)
{
sLog->outError("trial to access non existed modifier value from UnitMods!");
sLog->outError("attempt to access non-existing modifier value from UnitMods!");
return 0.0f;
}
@@ -13478,7 +13482,7 @@ float Unit::GetTotalAuraModValue(UnitMods unitMod) const
{
if (unitMod >= UNIT_MOD_END)
{
sLog->outError("trial to access non existed UnitMods in GetTotalAuraModValue()!");
sLog->outError("attempt to access non-existing UnitMods in GetTotalAuraModValue()!");
return 0.0f;
}
@@ -14167,12 +14171,12 @@ bool InitTriggerAuraData()
isTriggerAura[SPELL_AURA_DUMMY] = true;
isTriggerAura[SPELL_AURA_MOD_CONFUSE] = true;
isTriggerAura[SPELL_AURA_MOD_THREAT] = true;
isTriggerAura[SPELL_AURA_MOD_STUN] = true; // Aura not have charges but need remove him on trigger
isTriggerAura[SPELL_AURA_MOD_STUN] = true; // Aura does not have charges but needs to be removed on trigger
isTriggerAura[SPELL_AURA_MOD_DAMAGE_DONE] = true;
isTriggerAura[SPELL_AURA_MOD_DAMAGE_TAKEN] = true;
isTriggerAura[SPELL_AURA_MOD_RESISTANCE] = true;
isTriggerAura[SPELL_AURA_MOD_STEALTH] = true;
isTriggerAura[SPELL_AURA_MOD_FEAR] = true; // Aura not have charges but need remove him on trigger
isTriggerAura[SPELL_AURA_MOD_FEAR] = true; // Aura does not have charges but needs to be removed on trigger
isTriggerAura[SPELL_AURA_MOD_ROOT] = true;
isTriggerAura[SPELL_AURA_TRANSFORM] = true;
isTriggerAura[SPELL_AURA_REFLECT_SPELLS] = true;
@@ -15381,7 +15385,7 @@ bool Unit::HandleAuraRaidProcFromCharge(AuraEffect* triggeredByAura)
damageSpellId = 43594;
break;
default:
sLog->outError("Unit::HandleAuraRaidProcFromCharge, received not handled spell: %u", spellProto->Id);
sLog->outError("Unit::HandleAuraRaidProcFromCharge, received unhandled spell: %u", spellProto->Id);
return false;
}
@@ -15794,7 +15798,7 @@ void Unit::SetStunned(bool apply)
if (!owner || (owner->GetTypeId() == TYPEID_PLAYER && !owner->ToPlayer()->IsMounted()))
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
if (!HasUnitState(UNIT_STAT_ROOT)) // prevent allow move if have also root effect
if (!HasUnitState(UNIT_STAT_ROOT)) // prevent moving if it also has root effect
{
WorldPacket data(SMSG_FORCE_MOVE_UNROOT, 8+4);
data.append(GetPackGUID());
@@ -15836,7 +15840,7 @@ void Unit::SetRooted(bool apply)
}
else
{
if (!HasUnitState(UNIT_STAT_STUNNED)) // prevent allow move if have also stun effect
if (!HasUnitState(UNIT_STAT_STUNNED)) // prevent moving if it also has stun effect
{
if (GetTypeId() == TYPEID_PLAYER)
{