Merge commit 'origin/master' into 320

This commit is contained in:
tomrus88 2009-07-05 13:19:54 +04:00
commit 54cc2dcb53
16 changed files with 486 additions and 38 deletions

View file

@ -1526,7 +1526,7 @@ void Group::ResetInstances(uint8 method, Player* SendMsgTo)
bool isEmpty = true;
// if the map is loaded, reset it
Map *map = MapManager::Instance().FindMap(p->GetMapId(), p->GetInstanceId());
if(map && map->IsDungeon())
if(map && map->IsDungeon() && !(method == INSTANCE_RESET_GROUP_DISBAND && !p->CanReset()))
isEmpty = ((InstanceMap*)map)->Reset(method);
if(SendMsgTo)

View file

@ -1074,6 +1074,9 @@ bool ChatHandler::HandleUnLearnCommand(const char* args)
else
SendSysMessage(LANG_FORGET_SPELL);
if(GetTalentSpellCost(spell_id))
target->SendTalentsInfoData(false);
return true;
}
@ -2016,6 +2019,10 @@ bool ChatHandler::HandleLearnCommand(const char* args)
else
targetPlayer->learnSpell(spell,false);
uint32 first_spell = spellmgr.GetFirstSpellInChain(spell);
if(GetTalentSpellCost(first_spell))
targetPlayer->SendTalentsInfoData(false);
return true;
}

View file

@ -798,16 +798,19 @@ bool Pet::CreateBaseAtCreature(Creature* creature)
return true;
}
bool Pet::InitStatsForLevel(uint32 petlevel)
bool Pet::InitStatsForLevel(uint32 petlevel, Unit* owner)
{
CreatureInfo const *cinfo = GetCreatureInfo();
assert(cinfo);
Unit* owner = GetOwner();
if(!owner)
{
sLog.outError("attempt to summon pet (Entry %u) without owner! Attempt terminated.", cinfo->Entry);
return false;
owner = GetOwner();
if(!owner)
{
sLog.outError("attempt to summon pet (Entry %u) without owner! Attempt terminated.", cinfo->Entry);
return false;
}
}
uint32 creature_ID = (getPetType() == HUNTER_PET) ? 1 : cinfo->Entry;

View file

@ -161,7 +161,7 @@ class Pet : public Creature
void GivePetXP(uint32 xp);
void GivePetLevel(uint32 level);
void SynchronizeLevelWithOwner();
bool InitStatsForLevel(uint32 level);
bool InitStatsForLevel(uint32 level, Unit* owner = NULL);
bool HaveInDiet(ItemPrototype const* item) const;
uint32 GetCurrentFoodBenefitLevel(uint32 itemlevel);
void SetDuration(int32 dur) { m_duration = dur; }

View file

@ -2909,7 +2909,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
if(!rankSpellId || rankSpellId==spell_id)
continue;
removeSpell(rankSpellId);
removeSpell(rankSpellId,false,false);
}
}
}
@ -3158,7 +3158,7 @@ void Player::learnSpell(uint32 spell_id, bool dependent)
GetSession()->SendPacket(&data);
}
void Player::removeSpell(uint32 spell_id, bool disabled, bool update_action_bar_for_low_rank)
void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank)
{
PlayerSpellMap::iterator itr = m_spells.find(spell_id);
if (itr == m_spells.end())
@ -3171,7 +3171,7 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool update_action_bar_
SpellChainMapNext const& nextMap = spellmgr.GetSpellChainNext();
for(SpellChainMapNext::const_iterator itr2 = nextMap.lower_bound(spell_id); itr2 != nextMap.upper_bound(spell_id); ++itr2)
if(HasSpell(itr2->second) && !GetTalentSpellPos(itr2->second))
removeSpell(itr2->second,disabled);
removeSpell(itr2->second,disabled,false);
// re-search, it can be corrupted in prev loop
itr = m_spells.find(spell_id);
@ -3300,13 +3300,16 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool update_action_bar_
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id);
// if talent then lesser rank also talent and need learn
// if talent then lesser rank also talent and need learn
if(talentCosts)
learnSpell (prev_id,false);
// if ranked non-stackable spell: need activate lesser rank and update dendence state
{
if(learn_low_rank)
learnSpell (prev_id,false);
}
// if ranked non-stackable spell: need activate lesser rank and update dendence state
else if(cur_active && !SpellMgr::canStackSpellRanks(spellInfo) && spellmgr.GetSpellRank(spellInfo->Id) != 0)
{
// need manually update dependence state (learn spell ignore like attempts)
// need manually update dependence state (learn spell ignore like attempts)
PlayerSpellMap::iterator prev_itr = m_spells.find(prev_id);
if (prev_itr != m_spells.end())
{
@ -3318,19 +3321,16 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool update_action_bar_
}
// now re-learn if need re-activate
if(cur_active && !prev_itr->second->active)
if(cur_active && !prev_itr->second->active && learn_low_rank)
{
if(addSpell(prev_id,true,false,prev_itr->second->dependent,prev_itr->second->disabled))
{
if(update_action_bar_for_low_rank)
{
// downgrade spell ranks in spellbook and action bar
WorldPacket data(SMSG_SUPERCEDED_SPELL, 4 + 4);
data << uint32(spell_id);
data << uint32(prev_id);
GetSession()->SendPacket( &data );
prev_activate = true;
}
// downgrade spell ranks in spellbook and action bar
WorldPacket data(SMSG_SUPERCEDED_SPELL, 4 + 4);
data << uint32(spell_id);
data << uint32(prev_id);
GetSession()->SendPacket( &data );
prev_activate = true;
}
}
}
@ -3537,7 +3537,13 @@ bool Player::resetTalents(bool no_cost)
uint32 itrFirstId = spellmgr.GetFirstSpellInChain(itr->first);
// unlearn if first rank is talent or learned by talent
if (itrFirstId == talentInfo->RankID[j] || spellmgr.IsSpellLearnToSpell(talentInfo->RankID[j],itrFirstId))
if (itrFirstId == talentInfo->RankID[j])
{
removeSpell(itr->first,!IsPassiveSpell(itr->first),false);
itr = GetSpellMap().begin();
continue;
}
else if (spellmgr.IsSpellLearnToSpell(talentInfo->RankID[j],itrFirstId))
{
removeSpell(itr->first,!IsPassiveSpell(itr->first));
itr = GetSpellMap().begin();
@ -18224,7 +18230,7 @@ void Player::resetSpells()
PlayerSpellMap smap = GetSpellMap();
for(PlayerSpellMap::const_iterator iter = smap.begin();iter != smap.end(); ++iter)
removeSpell(iter->first); // only iter->first can be accessed, object by iter->second can be deleted already
removeSpell(iter->first,false,false); // only iter->first can be accessed, object by iter->second can be deleted already
learnDefaultSpells();
learnQuestRewardedSpells();
@ -19395,6 +19401,7 @@ void Player::EnterVehicle(Vehicle *vehicle)
SetFarSightGUID(vehicle->GetGUID()); // set view
SetClientControl(vehicle, 1); // redirect controls to vehicle
SetMover(vehicle);
WorldPacket data(SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, 0);
GetSession()->SendPacket(&data);
@ -19446,6 +19453,7 @@ void Player::ExitVehicle(Vehicle *vehicle)
SetFarSightGUID(0);
SetClientControl(vehicle, 0);
SetMover(NULL);
WorldPacket data(MSG_MOVE_TELEPORT_ACK, 30);
data.append(GetPackGUID());

View file

@ -1453,7 +1453,7 @@ class MANGOS_DLL_SPEC Player : public Unit
void SendInitialSpells();
bool addSpell(uint32 spell_id, bool active, bool learning, bool dependent, bool disabled);
void learnSpell(uint32 spell_id, bool dependent);
void removeSpell(uint32 spell_id, bool disabled = false, bool update_action_bar_for_low_rank = false);
void removeSpell(uint32 spell_id, bool disabled = false, bool learn_low_rank = true);
void resetSpells();
void learnDefaultSpells();
void learnQuestRewardedSpells();
@ -2033,6 +2033,7 @@ class MANGOS_DLL_SPEC Player : public Unit
bool IsAllowUseFlyMountsHere() const;
void SetClientControl(Unit* target, uint8 allowMove);
void SetMover(Unit* target) { m_mover = target ? target : this; }
void EnterVehicle(Vehicle *vehicle);
void ExitVehicle(Vehicle *vehicle);

View file

@ -35,7 +35,7 @@ struct SkillDiscoveryEntry
SkillDiscoveryEntry()
: spellId(0), reqSkillValue(0), chance(0) {}
SkillDiscoveryEntry(uint16 _spellId, uint32 req_skill_val, float _chance)
SkillDiscoveryEntry(uint32 _spellId, uint32 req_skill_val, float _chance)
: spellId(_spellId), reqSkillValue(req_skill_val), chance(_chance) {}
};

View file

@ -279,7 +279,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
&Aura::HandleAuraPeriodicDummy, //226 SPELL_AURA_PERIODIC_DUMMY
&Aura::HandlePeriodicTriggerSpellWithValue, //227 SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE
&Aura::HandleNoImmediateEffect, //228 stealth detection
&Aura::HandleNULL, //229 SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE
&Aura::HandleNoImmediateEffect, //229 SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE implemented in Unit::SpellDamageBonus
&Aura::HandleAuraModIncreaseMaxHealth, //230 Commanding Shout
&Aura::HandleNoImmediateEffect, //231 SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE
&Aura::HandleNoImmediateEffect, //232 SPELL_AURA_MECHANIC_DURATION_MOD implement in Unit::CalculateSpellDuration
@ -3087,6 +3087,7 @@ void Aura::HandleModPossess(bool apply, bool Real)
{
((Player*)caster)->SetFarSightGUID(m_target->GetGUID());
((Player*)caster)->SetClientControl(m_target, 1);
((Player*)caster)->SetMover(m_target);
}
m_target->CombatStop();
@ -3130,6 +3131,7 @@ void Aura::HandleModPossess(bool apply, bool Real)
{
((Player*)caster)->SetFarSightGUID(0);
((Player*)caster)->SetClientControl(m_target, 0);
((Player*)caster)->SetMover(NULL);
WorldPacket data(SMSG_PET_SPELLS, 8);
data << uint64(0);
@ -3167,6 +3169,7 @@ void Aura::HandleModPossessPet(bool apply, bool Real)
((Player*)caster)->SetFarSightGUID(apply ? pet->GetGUID() : 0);
((Player*)caster)->SetCharm(apply ? pet : NULL);
((Player*)caster)->SetClientControl(pet, apply ? 1 : 0);
((Player*)caster)->SetMover(apply ? pet : NULL);
if(apply)
{

View file

@ -398,6 +398,11 @@ void Spell::EffectSchoolDMG(uint32 effect_idx)
damage+= int32(m_caster->GetTotalAttackPowerValue(BASE_ATTACK) * pct / 100);
break;
}
// Thunder Clap
else if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000000080))
{
damage+=int32(m_caster->GetTotalAttackPowerValue(BASE_ATTACK) * 12 / 100);
}
break;
}
case SPELLFAMILY_WARLOCK:
@ -3271,7 +3276,7 @@ void Spell::EffectSummon(uint32 i)
spawnCreature->SetCreatorGUID(m_caster->GetGUID());
spawnCreature->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id);
spawnCreature->InitStatsForLevel(level);
spawnCreature->InitStatsForLevel(level, m_caster);
spawnCreature->GetCharmInfo()->SetPetNumber(pet_number, false);
@ -3701,7 +3706,7 @@ void Spell::EffectSummonGuardian(uint32 i)
spawnCreature->SetCreatorGUID(m_caster->GetGUID());
spawnCreature->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id);
spawnCreature->InitStatsForLevel(level);
spawnCreature->InitStatsForLevel(level, m_caster);
spawnCreature->GetCharmInfo()->SetPetNumber(pet_number, false);
spawnCreature->AIM_Initialize();
@ -4191,7 +4196,7 @@ void Spell::EffectSummonPet(uint32 i)
if(m_caster->IsPvP())
NewSummon->SetPvP(true);
NewSummon->InitStatsForLevel(petlevel);
NewSummon->InitStatsForLevel(petlevel, m_caster);
NewSummon->InitPetCreateSpells();
NewSummon->InitLevelupSpellsForLevel();
NewSummon->InitTalentForLevel();

View file

@ -2722,6 +2722,16 @@ DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellEntry const* spellproto
// Explicit Diminishing Groups
switch(spellproto->SpellFamilyName)
{
case SPELLFAMILY_MAGE:
{
// Shattered Barrier (triggered so doesn't share with Frost Nova)
if (spellproto->SpellFamilyFlags & UI64LIT(0x00000080000))
return DIMINISHING_TRIGGER_ROOT;
// Frost Nova / Freeze (Water Elemental)
else if (spellproto->SpellIconID == 193)
return DIMINISHING_CONTROL_ROOT;
break;
}
case SPELLFAMILY_ROGUE:
{
// Blind
@ -2730,6 +2740,9 @@ DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellEntry const* spellproto
// Cheap Shot
else if (spellproto->SpellFamilyFlags & UI64LIT(0x00000000400))
return DIMINISHING_CHEAPSHOT_POUNCE;
// Crippling poison - Limit to 10 seconds in PvP (No SpellFamilyFlags)
else if (spellproto->SpellIconID == 163)
return DIMINISHING_LIMITONLY;
break;
}
case SPELLFAMILY_WARLOCK:
@ -2750,6 +2763,9 @@ DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellEntry const* spellproto
// Pounce
else if (spellproto->SpellFamilyFlags & UI64LIT(0x00000020000))
return DIMINISHING_CHEAPSHOT_POUNCE;
// Faerie Fire
else if (spellproto->SpellFamilyFlags & UI64LIT(0x00000000400))
return DIMINISHING_LIMITONLY;
break;
}
case SPELLFAMILY_WARRIOR:
@ -2787,7 +2803,7 @@ DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellEntry const* spellproto
if (mechanic & (1<<MECHANIC_FEAR)) return DIMINISHING_FEAR_BLIND;
if (mechanic & (1<<MECHANIC_CHARM)) return DIMINISHING_CHARM;
if (mechanic & (1<<MECHANIC_SILENCE)) return DIMINISHING_SILENCE;
if (mechanic & (1<<DIMINISHING_DISARM)) return DIMINISHING_DISARM;
if (mechanic & (1<<MECHANIC_DISARM)) return DIMINISHING_DISARM;
if (mechanic & (1<<MECHANIC_FREEZE)) return DIMINISHING_FREEZE_SLEEP;
if (mechanic & ((1<<MECHANIC_KNOCKOUT) | (1<<MECHANIC_SAPPED))) return DIMINISHING_POLYMORPH_GOUGE_SAP;
if (mechanic & (1<<MECHANIC_BANISH)) return DIMINISHING_BANISH;
@ -2819,6 +2835,13 @@ int32 GetDiminishingReturnsLimitDuration(DiminishingGroup group, SpellEntry cons
return 6000;
break;
}
case SPELLFAMILY_DRUID:
{
// Faerie Fire - limit to 40 seconds in PvP (3.1)
if (spellproto->SpellFamilyFlags & UI64LIT(0x00000000400))
return 40000;
break;
}
default:
break;
}

View file

@ -6704,6 +6704,21 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB
return false;
break;
}
// Decimation
case 63156:
case 63158:
{
// Looking for dummy effect
Aura *aur = GetAura(auraSpellInfo->Id, 1);
if (!aur)
return false;
// If target's health is not below equal certain value (35%) not proc
if ((pVictim->GetHealth() * 100 / pVictim->GetMaxHealth()) > aur->GetModifier()->m_amount)
return false;
break;
}
}
// Custom basepoints/target for exist spell
@ -7549,9 +7564,6 @@ void Unit::SetPet(Pet* pet)
void Unit::SetCharm(Unit* pet)
{
SetUInt64Value(UNIT_FIELD_CHARM, pet ? pet->GetGUID() : 0);
if(GetTypeId() == TYPEID_PLAYER)
((Player*)this)->m_mover = pet ? pet : this;
}
@ -7894,6 +7906,14 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
TakenTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f;
}
// Mod damage taken from AoE spells
if(IsAreaOfEffectSpell(spellProto))
{
AuraList const& avoidAuras = pVictim->GetAurasByType(SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE);
for(AuraList::const_iterator itr = avoidAuras.begin(); itr != avoidAuras.end(); ++itr)
TakenTotalMod *= ((*itr)->GetModifier()->m_amount+100.0f)/100.0f;
}
// Taken/Done fixed damage bonus auras
int32 DoneAdvertisedBenefit = SpellBaseDamageBonus(GetSpellSchoolMask(spellProto));
int32 TakenAdvertisedBenefit = SpellBaseDamageBonusForVictim(GetSpellSchoolMask(spellProto), pVictim);
@ -8737,6 +8757,14 @@ void Unit::MeleeDamageBonus(Unit *pVictim, uint32 *pdamage,WeaponAttackType attT
TakenTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f;
}
// Mod damage taken from AoE spells
if(spellProto && IsAreaOfEffectSpell(spellProto))
{
AuraList const& avoidAuras = pVictim->GetAurasByType(SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE);
for(AuraList::const_iterator itr = avoidAuras.begin(); itr != avoidAuras.end(); ++itr)
TakenTotalMod *= ((*itr)->GetModifier()->m_amount+100.0f)/100.0f;
}
float tmpDamage = float(int32(*pdamage) + DoneFlatBenefit) * DoneTotalMod;
// apply spellmod to Done damage

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "8107"
#define REVISION_NR "8118"
#endif // __REVISION_NR_H__