From 32604a75f694fa7182961a540a79c9a5060d0348 Mon Sep 17 00:00:00 2001 From: Blaymoira Date: Sat, 14 Mar 2009 10:14:22 +0100 Subject: *Fixed creature following in dungeons --HG-- branch : trunk --- src/game/CreatureGroups.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/game/CreatureGroups.cpp b/src/game/CreatureGroups.cpp index 6b69a9102dd..55b56e0b94e 100644 --- a/src/game/CreatureGroups.cpp +++ b/src/game/CreatureGroups.cpp @@ -187,7 +187,7 @@ void CreatureGroup::SetMemberDestination(Creature *member) return; float x,y,z; - uint32 lowguid = member->GetGUIDLow(); + uint32 lowguid = member->GetDBTableGUIDLow(); UNORDERED_MAP::iterator itr2 = CreatureGroupMap.find(lowguid); -- cgit v1.2.3 From 648a8d505fe188ac5bc8b3fec045a1730c8e990a Mon Sep 17 00:00:00 2001 From: QAston Date: Sat, 14 Mar 2009 12:13:22 +0100 Subject: *Fix hunter's tame beast. --HG-- branch : trunk --- src/game/Spell.cpp | 2 +- src/game/SpellAuras.cpp | 7 ++++++- src/game/Unit.cpp | 10 ---------- 3 files changed, 7 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 34f52daa974..294d016e33d 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -3381,7 +3381,7 @@ void Spell::TakeRunePower() } // you can gain some runic power when use runes - float rp = src->runePowerGain;; + float rp = src->runePowerGain; rp *= sWorld.getRate(RATE_POWER_RUNICPOWER_INCOME); plr->ModifyPower(POWER_RUNIC_POWER, (int32)rp); } diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index efca1bdc600..ff818b7dbc8 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -433,7 +433,12 @@ m_updated(false), m_isRemovedOnShapeLost(true), m_in_use(false) sLog.outDebug("Aura: construct Spellid : %u, Aura : %u Duration : %d Target : %d Damage : %d", m_spellProto->Id, m_spellProto->EffectApplyAuraName[eff], m_maxduration, m_spellProto->EffectImplicitTargetA[eff],damage); m_effIndex = eff; - SetModifier(AuraType(m_spellProto->EffectApplyAuraName[eff]), damage, m_spellProto->EffectAmplitude[eff], m_spellProto->EffectMiscValue[eff]); + int32 periodicTime = m_spellProto->EffectAmplitude[eff]; + //apply casting time mods for channeled spells + if (caster && IsChanneledSpell(m_spellProto)) + caster->ModSpellCastTime(m_spellProto, periodicTime); + + SetModifier(AuraType(m_spellProto->EffectApplyAuraName[eff]), damage,periodicTime , m_spellProto->EffectMiscValue[eff]); // Apply periodic time mod if(modOwner && m_modifier.periodictime) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index d91a6bf83e6..303270ee8fe 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -8715,16 +8715,11 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 { // Damage Done from spell damage bonus int32 CastingTime = !IsChanneledSpell(spellProto) ? GetSpellCastTime(spellProto) : GetSpellDuration(spellProto); - if (IsChanneledSpell(spellProto)) - ModSpellCastTime(spellProto, CastingTime); // Damage over Time spells bonus calculation float DotFactor = 1.0f; if(damagetype == DOT) { int32 DotDuration = GetSpellDuration(spellProto); - //apply casting time mods for channeled spells - if (IsChanneledSpell(spellProto)) - ModSpellCastTime(spellProto, DotDuration); // 200% limit if(DotDuration > 0) { @@ -9211,16 +9206,11 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint { // Damage Done from spell damage bonus int32 CastingTime = !IsChanneledSpell(spellProto) ? GetSpellCastTime(spellProto) : GetSpellDuration(spellProto); - if (IsChanneledSpell(spellProto)) - ModSpellCastTime(spellProto, CastingTime); // Damage over Time spells bonus calculation float DotFactor = 1.0f; if(damagetype == DOT) { int32 DotDuration = GetSpellDuration(spellProto); - //apply casting time mods for channeled spells - if (IsChanneledSpell(spellProto)) - ModSpellCastTime(spellProto, DotDuration); // 200% limit if(DotDuration > 0) { -- cgit v1.2.3 From 4a0bb67f8373afdbac8e54596b5f7936ed94acc7 Mon Sep 17 00:00:00 2001 From: QAston Date: Sat, 14 Mar 2009 13:34:05 +0100 Subject: *Fix positivity checks for some triggering spells. --HG-- branch : trunk --- src/game/SpellMgr.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 4a7ab708c3d..4dd6c2215c6 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -521,7 +521,6 @@ bool IsPositiveEffect(uint32 spellId, uint32 effIndex, bool deep) switch(spellId) { case 23333: case 23335: case 34976: // BG spell - case 30482: case 43045: case 43046: // Molten armor expection need find the real bug return true; case 28441: // not positive dummy spell case 37675: // Chaos Blast @@ -702,7 +701,10 @@ bool IsPositiveEffect(uint32 spellId, uint32 effIndex, bool deep) if(spellproto->AttributesEx & SPELL_ATTR_EX_NEGATIVE) return false; - if (!deep && spellproto->EffectTriggerSpell[effIndex] && !IsPositiveSpell(spellproto->EffectTriggerSpell[effIndex], true)) + if (!deep && spellproto->EffectTriggerSpell[effIndex] + && !spellproto->procFlags + && IsPositiveTarget(spellproto->EffectImplicitTargetA[effIndex],spellproto->EffectImplicitTargetB[effIndex]) + && !IsPositiveSpell(spellproto->EffectTriggerSpell[effIndex], true)) return false; // ok, positive -- cgit v1.2.3 From e82dd549b881609dc736837012f5daf71d941bb9 Mon Sep 17 00:00:00 2001 From: megamage Date: Sat, 14 Mar 2009 09:01:55 -0600 Subject: *Fix a typo that causes crash. --HG-- branch : trunk --- src/game/Unit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 76a2cb264d4..848fe87cd0b 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -539,7 +539,7 @@ void Unit::RemoveAuraTypeByCaster(AuraType auraType, uint64 casterGUID) { if (auraType >= TOTAL_AURAS) return; AuraList::iterator iter, next; - for(iter = m_modAuras[auraType].begin(); iter != m_modAuras[auraType].end(); ++iter) + for(iter = m_modAuras[auraType].begin(); iter != m_modAuras[auraType].end(); iter = next) { next = iter; ++next; -- cgit v1.2.3 From 25720e5a9034ae5d50a9bf3d9a3b854035558ff9 Mon Sep 17 00:00:00 2001 From: megamage Date: Sat, 14 Mar 2009 09:18:55 -0600 Subject: *Move creature spell init from updateentry to initentry. This allows pet have spells defined in db. --HG-- branch : trunk --- src/game/Creature.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 8a5e6e52018..51f24389c95 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -297,6 +297,11 @@ bool Creature::InitEntry(uint32 Entry, uint32 team, const CreatureData *data ) if(!m_respawnradius && m_defaultMovementType==RANDOM_MOTION_TYPE) m_defaultMovementType = IDLE_MOTION_TYPE; + m_spells[0] = GetCreatureInfo()->spell1; + m_spells[1] = GetCreatureInfo()->spell2; + m_spells[2] = GetCreatureInfo()->spell3; + m_spells[3] = GetCreatureInfo()->spell4; + return true; } @@ -353,11 +358,6 @@ bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData *data ) SetPvP(true); } - m_spells[0] = GetCreatureInfo()->spell1; - m_spells[1] = GetCreatureInfo()->spell2; - m_spells[2] = GetCreatureInfo()->spell3; - m_spells[3] = GetCreatureInfo()->spell4; - // HACK: trigger creature is always not selectable if(isTrigger()) SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); -- cgit v1.2.3 From 076ccce8c16b60f84f635cdb85795aba63c0c863 Mon Sep 17 00:00:00 2001 From: QAston Date: Sat, 14 Mar 2009 16:20:04 +0100 Subject: *Fix glyph of aspect of the monkey. *Fix aspect of the dragonhawk. *Turn off combat log for some periodic auras when power regenerated is full. --HG-- branch : trunk --- sql/updates/1886_world.sql | 6 ++++++ sql/updates/CMakeLists.txt | 1 + src/game/SpellAuras.cpp | 39 +++++++++++++++++++++++++++++++++++---- src/game/SpellMgr.cpp | 2 +- src/game/Unit.cpp | 24 ++++++++++++++++++++++-- 5 files changed, 65 insertions(+), 7 deletions(-) create mode 100644 sql/updates/1886_world.sql (limited to 'src') diff --git a/sql/updates/1886_world.sql b/sql/updates/1886_world.sql new file mode 100644 index 00000000000..d682101ff6f --- /dev/null +++ b/sql/updates/1886_world.sql @@ -0,0 +1,6 @@ +INSERT INTO `spell_linked_spell` VALUES (61847, 61848, 2, 'Aspect of te dragonhawk'); +INSERT INTO `spell_linked_spell` VALUES (61846, 61848, 2, 'Aspect of te dragonhawk'); + +-- Glyph of Aspect of the Monkey +REPLACE INTO `spell_proc_event` VALUES (13163, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000010, 0.000000, 0.000000, 0); +REPLACE INTO `spell_proc_event` VALUES (61848, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000010, 0.000000, 0.000000, 0); diff --git a/sql/updates/CMakeLists.txt b/sql/updates/CMakeLists.txt index dc5d2c1f557..8cd388d7b97 100644 --- a/sql/updates/CMakeLists.txt +++ b/sql/updates/CMakeLists.txt @@ -81,4 +81,5 @@ INSTALL(FILES 1857_world.sql 1881_world.sql 1884_world.sql +1886_world.sql DESTINATION share/trinity/sql/updates) \ No newline at end of file diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index ff818b7dbc8..20878e0679a 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -2239,6 +2239,25 @@ void Aura::HandleAuraDummy(bool apply, bool Real) ((Player*)m_target)->AddSpellMod(m_spellmod, apply); return; } + // Glyph of Aspect of the Monkey + if(m_spellProto->Id==56833) + { + if(apply) + { + // Reduce backfire damage (dot damage) from Shadow Word: Death + SpellModifier *mod = new SpellModifier; + mod->op = SPELLMOD_CHANCE_OF_SUCCESS; + mod->value = 100; + mod->type = SPELLMOD_FLAT; + mod->spellId = GetId(); + mod->mask[2] = 8192; + mod->mask[1] = 0x00000000; + mod->mask[0] = 524288; + m_spellmod = mod; + } + ((Player*)m_target)->AddSpellMod(m_spellmod, apply); + return; + } break; } case SPELLFAMILY_SHAMAN: @@ -5668,6 +5687,9 @@ void Aura::PeriodicTick() if(m_target != pCaster && GetSpellProto()->SpellVisual[0]==163 && !pCaster->isAlive()) return; + if(m_duration ==-1 && m_target->GetHealth()==m_target->GetMaxHealth()) + return; + // ignore non positive values (can be result apply spellmods to aura damage //uint32 amount = GetModifierValuePerStack() > 0 ? GetModifierValuePerStack() : 0; uint32 pdamage = GetModifier()->m_amount > 0 ? GetModifier()->m_amount : 0; @@ -5858,7 +5880,7 @@ void Aura::PeriodicTick() case SPELL_AURA_OBS_MOD_ENERGY: { if(m_modifier.m_miscvalue < 0) - break; + return; Powers power; if (m_modifier.m_miscvalue == POWER_ALL) @@ -5867,7 +5889,10 @@ void Aura::PeriodicTick() power = Powers(m_modifier.m_miscvalue); if(m_target->GetMaxPower(power) == 0) - break; + return; + + if(m_duration ==-1 && m_target->GetPower(power)==m_target->GetMaxPower(power)) + return; uint32 amount = m_modifier.m_amount * m_target->GetMaxPower(power) /100; sLog.outDetail("PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u dmg inflicted by %u", @@ -5893,12 +5918,15 @@ void Aura::PeriodicTick() { // ignore non positive values (can be result apply spellmods to aura damage if(m_modifier.m_amount < 0 || m_modifier.m_miscvalue >= MAX_POWERS) - break; + return; Powers power = Powers(m_modifier.m_miscvalue); if(m_target->GetMaxPower(power) == 0) - break; + return; + + if(m_duration ==-1 && m_target->GetPower(power)==m_target->GetMaxPower(power)) + return; uint32 amount = m_modifier.m_amount; @@ -5938,6 +5966,9 @@ void Aura::PeriodicTick() if(!m_target->isAlive() || m_target->getPowerType() != powerType) return; + if(m_duration ==-1 && m_target->GetPower(powerType)==m_target->GetMaxPower(powerType)) + return; + // resilience reduce mana draining effect at spell crit damage reduction (added in 2.4) if (powerType == POWER_MANA && m_target->GetTypeId() == TYPEID_PLAYER) pdamage -= ((Player*)m_target)->GetSpellCritDamageReduction(pdamage); diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 4dd6c2215c6..a976ca04a68 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -378,7 +378,7 @@ SpellSpecific GetSpellSpecific(uint32 spellId) return SPELL_STING; // only hunter aspects have this - if( spellInfo->SpellFamilyFlags[1] & 0x00440000 || spellInfo->SpellFamilyFlags[0] & 0x00380000 || spellInfo->SpellFamilyFlags[2] & 0x00003010) + if( spellInfo->SpellFamilyFlags[1] & 0x00440000 || spellInfo->SpellFamilyFlags[0] & 0x00380000 || spellInfo->SpellFamilyFlags[2] & 0x00001010) return SPELL_ASPECT; if( spellInfo->SpellFamilyFlags[2] & 0x00000002 ) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 303270ee8fe..118636edcc0 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -3981,6 +3981,8 @@ bool Unit::RemoveNoStackAurasDueToAura(Aura *Aur) SpellSpecific spellId_spec = GetSpellSpecific(spellId); + //bool linked = spellmgr.GetSpellCustomAttr(spellId) & SPELL_ATTR_CU_LINK_AURA? true : false; + AuraMap::iterator i,next; for (i = m_Auras.begin(); i != m_Auras.end(); i = next) { @@ -4017,11 +4019,29 @@ bool Unit::RemoveNoStackAurasDueToAura(Aura *Aur) if (i_spellProto->EffectTriggerSpell[j] == spellProto->Id) is_triggered_by_spell = true; - if (is_triggered_by_spell) - continue; + for(int j = 0; j < 3; ++j) + if (i_spellProto->EffectTriggerSpell[j] == spellProto->Id) + is_triggered_by_spell = true; // check if they can stack bool sameCaster = Aur->GetCasterGUID() == (*i).second->GetCasterGUID(); + + /*// Dont remove by stack with linked auras + // Not needed for now + if(sameCaster && linked) + { + if(const std::vector *spell_triggered = spellmgr.GetSpellLinked(spellId + SPELL_LINK_AURA)) + for(std::vector::const_iterator itr = spell_triggered->begin(); itr != spell_triggered->end(); ++itr) + if(*itr>0 && *itr==i_spellId) + { + is_triggered_by_spell=true; + break; + } + }*/ + + if (is_triggered_by_spell) + continue; + if(!spellmgr.IsNoStackSpellDueToSpell(spellId, i_spellId, sameCaster)) continue; -- cgit v1.2.3 From c9874ee715480b41881704d40cc26f72562d5836 Mon Sep 17 00:00:00 2001 From: megamage Date: Sat, 14 Mar 2009 09:20:23 -0600 Subject: *Fix the bug that possessed creature cannot melee. --HG-- branch : trunk --- src/game/NullCreatureAI.cpp | 5 +++++ src/game/NullCreatureAI.h | 1 + 2 files changed, 6 insertions(+) (limited to 'src') diff --git a/src/game/NullCreatureAI.cpp b/src/game/NullCreatureAI.cpp index 1bb787b25c3..8bea03d0216 100644 --- a/src/game/NullCreatureAI.cpp +++ b/src/game/NullCreatureAI.cpp @@ -27,6 +27,11 @@ void PassiveAI::UpdateAI(const uint32) EnterEvadeMode(); } +void PossessedAI::AttackStart(Unit *target) +{ + me->Attack(target, true); +} + void PossessedAI::UpdateAI(const uint32 diff) { if(me->getVictim()) diff --git a/src/game/NullCreatureAI.h b/src/game/NullCreatureAI.h index b64bf43ce5f..d20d727690a 100644 --- a/src/game/NullCreatureAI.h +++ b/src/game/NullCreatureAI.h @@ -41,6 +41,7 @@ class TRINITY_DLL_DECL PossessedAI : public PassiveAI public: PossessedAI(Creature *c) : PassiveAI(c) {} + void AttackStart(Unit *target); void UpdateAI(const uint32); void EnterEvadeMode() {} -- cgit v1.2.3 From 5d440f28986f4ab4ee886d24fde2d53440a33560 Mon Sep 17 00:00:00 2001 From: megamage Date: Sat, 14 Mar 2009 09:49:10 -0600 Subject: *Init spells for vehicles. --HG-- branch : trunk --- src/game/Player.cpp | 48 +++++++++++++++++++++++++++++++++--------------- src/game/Player.h | 1 + src/game/Unit.cpp | 11 ++--------- 3 files changed, 36 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 61968fae0c4..d3af537026f 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -17367,6 +17367,38 @@ void Player::PossessSpellInitialize() GetSession()->SendPacket(&data); } +void Player::VehicleSpellInitialize() +{ + Unit* charm = GetCharm(); + if(!charm || charm->GetTypeId() != TYPEID_UNIT) + return; + + WorldPacket data(SMSG_PET_SPELLS, 8+4+4+4+4*10+1+1); + data << uint64(charm->GetGUID()); + data << uint32(0x00000000); + data << uint32(0x00000000); + data << uint32(0x00000101); + + for(uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i) + { + uint32 spellId = ((Creature*)charm)->m_spells[i]; + if(IsPassiveSpell(spellId)) + { + charm->CastSpell(charm, spellId, true); + data << uint16(0) << uint8(0) << uint8(i+8); + } + else + data << uint16(spellId) << uint8(0) << uint8(i+8); + } + + for(uint32 i = CREATURE_MAX_SPELLS; i < 10; ++i) + data << uint16(0) << uint8(0) << uint8(i+8); + + data << uint8(0); + data << uint8(0); + GetSession()->SendPacket(&data); +} + void Player::CharmSpellInitialize() { Unit* charm = GetCharm(); @@ -20302,21 +20334,7 @@ void Player::EnterVehicle(Vehicle *vehicle) data << uint32(0); // fall time GetSession()->SendPacket(&data); - data.Initialize(SMSG_PET_SPELLS, 8+4+4+4+4*10+1+1); - data << uint64(vehicle->GetGUID()); - data << uint32(0x00000000); - data << uint32(0x00000000); - data << uint32(0x00000101); - - for(uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i) - data << uint16(vehicle->m_spells[i]) << uint8(0) << uint8(i+8); - - for(uint32 i = CREATURE_MAX_SPELLS; i < 10; ++i) - data << uint16(0) << uint8(0) << uint8(i+8); - - data << uint8(0); - data << uint8(0); - GetSession()->SendPacket(&data); + VehicleSpellInitialize(); } void Player::ExitVehicle(Vehicle *vehicle) diff --git a/src/game/Player.h b/src/game/Player.h index fcf3b0b005e..c0d2483e1ef 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1454,6 +1454,7 @@ class TRINITY_DLL_SPEC Player : public Unit void PetSpellInitialize(); void CharmSpellInitialize(); void PossessSpellInitialize(); + void VehicleSpellInitialize(); bool HasSpell(uint32 spell) const; bool HasActiveSpell(uint32 spell) const; // show in spellbook TrainerSpellState GetTrainerSpellState(TrainerSpell const* trainer_spell) const; diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index bf750be34f5..eb20ee91845 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -11435,20 +11435,13 @@ void CharmInfo::InitPossessCreateSpells() InitEmptyActionBar(); if(m_unit->GetTypeId() == TYPEID_UNIT) { - /*for(uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i) + for(uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i) { uint32 spellid = ((Creature*)m_unit)->m_spells[i]; if(IsPassiveSpell(spellid)) m_unit->CastSpell(m_unit, spellid, true); else - AddSpellToAB(0, spellid, ACT_CAST); - }*/ - for(uint32 x = 0; x < CREATURE_MAX_SPELLS; ++x) - { - if (IsPassiveSpell(((Creature*)m_unit)->m_spells[x])) - m_unit->CastSpell(m_unit, ((Creature*)m_unit)->m_spells[x], true); - else - AddSpellToAB(0, ((Creature*)m_unit)->m_spells[x], ACT_PASSIVE); + AddSpellToAB(0, spellid, ACT_DISABLED); } } } -- cgit v1.2.3