aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/updates/world/2013_08_14_00_world_gameobject_loot_template.sql246
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.cpp3
-rw-r--r--src/server/game/Entities/Pet/Pet.cpp10
-rw-r--r--src/server/game/Entities/Totem/Totem.cpp2
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp16
-rw-r--r--src/server/game/Entities/Unit/Unit.h8
-rw-r--r--src/server/game/Handlers/PetHandler.cpp38
-rw-r--r--src/server/game/Spells/Spell.cpp58
-rw-r--r--src/server/game/Spells/Spell.h3
-rw-r--r--src/server/scripts/EasternKingdoms/BaradinHold/boss_occuthar.cpp12
10 files changed, 313 insertions, 83 deletions
diff --git a/sql/updates/world/2013_08_14_00_world_gameobject_loot_template.sql b/sql/updates/world/2013_08_14_00_world_gameobject_loot_template.sql
new file mode 100644
index 00000000000..db3d6659ba5
--- /dev/null
+++ b/sql/updates/world/2013_08_14_00_world_gameobject_loot_template.sql
@@ -0,0 +1,246 @@
+SET @FrostLotus := 12009;
+
+DELETE FROM `reference_loot_template` WHERE `entry` = @FrostLotus;
+INSERT INTO `reference_loot_template` (`entry`,`item`,`ChanceOrQuestChance`,`lootmode`,`groupid`,`mincountOrRef`,`maxcount`) VALUES
+(@FrostLotus,36908,100,1,0,1,1); -- Frost Lotus (trick)
+
+DELETE FROM `gameobject_loot_template` WHERE `entry` IN (1414,1415,1416,1417,1418,1419,1420,1421,1424,1730,1731,1423,1732,1733,1734,2292,2512,2511,2513,2514,2515,2516,6142,6150,6151,6152,6312,6313,13945,13946,13947,13948,13949,13950,13965,13966,13967,13968,13969,13970,17201,17200,17204,17202,17203,18009,18111,18112,18113,18114,18115,18116,18117,18118,18119,19627,19628,19629,19630,22071,24093,24224,24225,24226,24227,25094,25096,25095,24228,25093,25089,34868);
+INSERT INTO `gameobject_loot_template` (`entry`,`item`,`ChanceOrQuestChance`,`lootmode`,`groupid`,`mincountOrRef`,`maxcount`) VALUES
+-- -------------------
+-- -- Classic Zones --
+-- -------------------
+-- Peacebloom
+(1415,2447,100,1,0,1,3), -- Peacebloom
+(2512,2447,100,1,0,2,2), -- Peacebloom
+-- Silverleaf
+(1414, 765,100,1,0,1,3), -- Silverleaf
+(1414,5056,-40,1,0,1,1), -- Root Sample (Quest Item)
+(2511,765,100,1,0,2,2), -- Silverleaf
+-- Earthroot
+(1416,2449,100,1,0,1,3), -- Earthroot
+(2513,2449,100,1,0,2,2), -- Earthroot
+-- Mageroyal
+(1417,785,100,1,0,1,3), -- Mageroyal
+(1417,2452,20,1,0,1,2), -- Swiftthistle
+(2514,785,100,1,0,2,2), -- Mageroyal
+-- Briarthorn
+(1418,2450,100,1,0,1,3), -- Briarthorn
+(1418,2452,40,1,0,1,2), -- Swiftthistle
+(2515,2450,100,1,0,2,2), -- Briarthorn
+-- Bruiseweed
+(1419,2453,100,1,0,1,3), -- Bruiseweed
+(2516,2453,100,1,0,2,2), -- Bruiseweed
+-- Strangekelp
+(1733,3820,100,1,0,1,3), -- Strangekelp
+-- Grave Moss
+(1424,3369,100,1,0,1,3), -- Grave Moss
+-- Wild Steelbloom
+(1420,3355,100,1,0,1,3), -- Wild Steelbloom
+-- Kingsblood
+(1421,3356,100,1,0,1,3), -- Kingsblood
+-- Liferoot
+(1730,3357,100,1,0,1,3), -- Liferoot
+-- Fadeleaf
+(1731,3818,100,1,0,1,3), -- Fadeleaf
+-- Goldthorn
+(1734,3821,100,1,0,1,3), -- Goldthorn
+-- Khadgar's Whisker
+(1423,3358,100,1,0,1,3), -- Khadgar's Whisker
+-- Dragon's Teeth (WINTERSBITE rename only, ids are same)
+(1732,3819,100,1,0,1,3), -- Dragon's Teeth
+-- Firebloom
+(2292,4625,100,1,0,1,3), -- Firebloom
+-- Purple Lotus
+(6142,8831,100,1,0,1,3), -- Purple Lotus
+(6142,8153, 10,1,0,1,1), -- Wildvine
+-- Arthas' Tears
+(6150,8836,100,1,0,1,3), -- Arthas' Tears
+-- Sungrass
+(6151,8838,100,1,0,1,3), -- Sungrass
+-- Blindweed
+(6152,8839,100,1,0,1,3), -- Blindweed
+-- Ghost Mushroom
+(6312,8845,100,1,0,1,3), -- Ghost Mushroom
+-- Gromsblood
+(6313,8846,100,1,0,1,3), -- Gromsblood (Default)
+-- Golden Sansam
+(13945,13464,100,1,0,1,3), -- Golden Sansam (Default)
+-- Dreamfoil
+(13946,13463,100,1,0,1,3), -- Dreamfoil (Default)
+-- Mountain Silversage
+(13947,13465,100,1,0,1,3), -- Mountain Silversage (Default)
+-- Sorrowmoss (Plaguebloom)
+(13948,13466,100,1,0,1,3), -- Sorrowmoss
+-- Black Lotus
+(13950,13468,100,1,0,1,3), -- Black Lotus
+-- Icecap
+(13949,13467,100,1,0,1,3), -- Icecap
+-- -------------------------
+-- -- The Burning Crusade --
+-- -------------------------
+-- Bloodthistle
+(18009,22710,100,1,0,1,3), -- Bloodthistle
+-- Felweed
+(18111,22785,100,1,0,1,3), -- Felweed
+(18111,22575, 15,1,0,1,2), -- Mote of life
+(18111,22794, 2,1,0,1,1), -- Fel Lotus
+-- Dreaming Glory
+(18112,22786,100,1,0,1,3), -- Dreaming Glory
+(18112,22575, 15,1,0,1,3), -- Mote of life
+(18112,22794, 2,1,0,1,1), -- Fel Lotus
+-- Ragveil
+(18113,22787,100,1,0,1,3), -- Ragveil
+(18113,22575, 15,1,0,1,3), -- Mote of life
+(18113,22794, 2,1,0,1,1), -- Fel Lotus
+-- Flame Cap
+(18114,22788,100,1,0,1,3), -- Flame Cap
+(18114,22794, 2,1,0,1,1), -- Fel Lotus
+(18114,35229,-25,1,0,1,1), -- Nether Residue (Questitem)
+-- Terocone
+(18115,22789,100,1,0,1,3), -- Terocone
+(18115,22575, 15,1,0,1,3), -- Mote of life
+(18115,22794, 3,1,0,1,1), -- Fel Lotus
+(18115,35229,-25,1,0,1,1), -- Nether Residue (Questitem)
+-- Ancient Lichen
+(18116,22790,100,1,0,1,3), -- Ancient Lichen
+(18116,22794, 2,1,0,1,1), -- Fel Lotus
+(18116,35229,-25,1,0,1,1), -- Nether Residue (Questitem)
+-- Netherbloom
+(18117,22791,100,1,0,1,3), -- Netherbloom
+(18117,22576, 15,1,0,1,3), -- Mote of mana
+(18117,22794, 3,1,0,1,1), -- Fel Lotus
+(18117,35229,-25,1,0,1,1), -- Nether Residue (Questitem)
+-- Nightmare Vine
+(18118,22792,100,1,0,1,3), -- Nightmare Vine
+(18118,22575, 10,1,0,1,3), -- Nightmare Seed
+(18118,22794, 3,1,0,1,1), -- Fel Lotus
+(18118,35229,-25,1,0,1,1), -- Nether Residue (Questitem)
+-- Mana Thistle
+(18119,22793,100,1,0,1,3), -- Mana Thistle
+(18119,22575, 15,1,0,1,3), -- Mote of life
+(18119,22794, 3,1,0,1,1), -- Fel Lotus
+(18119,35229,-25,1,0,1,1), -- Nether Residue (Questitem)
+-- Netherdust Bush
+(22071,32468,100,1,0,1,3), -- Netherdust Pollen
+(22071,22576,15,1,0,1,3), -- Mote of Mana
+(22071,22794, 2,1,0,1,1), -- Fel Lotus
+(22071,32506, 1,1,0,1,1), -- Netherwing Egg
+-- ----------------------------------
+-- -- Wrath of the Lich King Zones --
+-- ----------------------------------
+-- Goldclover
+(24093,36901,100,1,0,1,3), -- GoldClover
+(24093,37921, 35,1,0,1,3), -- Deadnettle
+(24093,37704, 20,1,0,1,3), -- Crystallized Life
+(24093,36908, 5,1,0,1,1), -- Frost Lotus
+-- Firethorn
+(25089,39969,50,1,1,2,3), -- Fire Seed
+(25089,39970,50,1,1,2,3), -- Fire Leaf
+(25089,37704,25,1,0,1,3), -- Crystallized Life
+(25089,36908, 5,1,0,1,1), -- Frost Lotus
+-- Tiger Lily
+(24224,36904,100,1,0,1,3), -- Tiger Lily
+(24224,37921, 35,1,0,1,3), -- Deadnettle
+(24224,37704, 20,1,0,1,3), -- Crystallized Life
+(24224,36908, 5,1,0,1,1), -- Frost Lotus
+-- Talandra's Rose
+(24225,36907,100,1,0,1,3), -- Talandra's
+(24225,37921, 35,1,0,1,3), -- Deadnettle
+(24225,37704, 20,1,0,1,3), -- Crystallized Life
+(24225,36908, 5,1,0,1,1), -- Frost LotusRose
+-- Frozen Herb
+-- Dragonblight
+(25094,36901,60,1,1,1,3), -- Goldclover
+(25094,36904,20,1,1,1,3), -- Tiger Lily
+(25094,36907,20,1,1,1,3), -- Talandra's Rose
+-- Zul Drak & Wintergrasp
+(25095,36901,60,1,1,1,4), -- Goldclover
+(25095,36904,20,1,1,1,4), -- Tiger Lily
+(25095,36907,20,1,1,1,4), -- Talandra's Rose
+-- The Nexus
+(25096,36901,60,1,1,2,6), -- Goldclover
+(25096,36904,20,1,1,2,6), -- Tiger Lily
+(25096,36907,20,1,1,2,6), -- Talandra's Rose
+-- Adder's Tongue
+(25093,36903,100,1,0,1,3), -- Adder's Tongue
+(25093,37704, 25,1,0,1,3), -- Crystallized Life
+(25093,36908, 5,1,0,1,1), -- Frost Lotus
+-- Lichbloom
+(24226,36905,100,1,0,1,3), -- Lichbloom
+(24226,37704, 25,1,0,1,3), -- Crystallized Life
+(24226,36908, 5,1,0,1,1), -- Frost Lotus
+-- Icethorn
+(24227,36906,100,1,0,1,3), -- Icethorn
+(24227,37704, 25,1,0,1,3), -- Crystallized Life
+(24227,36908, 5,1,0,1,3), -- Frost Lotus
+-- Frost Lotus
+(24228,36908,95,1,1,1,1), -- Frost Lotus (95% for 1)
+(24228,1, 5,1,1,-@FrostLotus,1), -- Frost Lotus (5% for 2)
+(24228,37921, 35,1,0,1,3), -- Deadnettle
+(24228,37704, 25,1,0,1,3), -- Crystallized Life
+-- --------------------------------
+-- -- Felwood Fel Creep Specials --
+-- --------------------------------
+-- Sungrass
+(13965, 8838,100,1,0,1,3), -- Sungrass
+(13965,11514, 50,1,0,1,2), -- Fel Creep
+-- Gromsblood
+(13966, 8846,100,1,0,1,3), -- Gromsblood
+(13966,11514, 50,1,0,1,2), -- Fel Creep
+-- Golden Sansam
+(13967,13464,100,1,0,1,3), -- Golden Sansam
+(13967,11514, 50,1,0,1,2), -- Fel Creep
+-- Dreamfoil
+(13968,13463,100,1,0,1,3), -- Dreamfoil
+(13968,11514, 50,1,0,1,2), -- Fel Creep
+-- Mountain Silversage
+(13969,13465,100,1,0,1,3), -- Mountain Silversage
+(13969,11514, 10,1,0,1,2), -- Fel Creep
+-- Arthas'Tears
+(13970, 8836,100,1,0,1,3), -- Arthas' Tears
+(13970,11514, 50,1,0,1,3), -- Fel Creep
+-- ----------------------------------
+-- -- Zul Gurub Bloodvine Specials --
+-- ----------------------------------
+-- Purple Lotus
+(17200,8831,100,1,0,1,3), -- Purple Lotus
+(17200, 8153, 10,1,0,1,1), -- Wildvine
+(17200,19726,15,1,0,1,3), -- Bloodvine
+-- Sungrass
+(17201,8838,100,1,0,1,3), -- Sungrass
+(17201,19726,15,1,0,1,3), -- Bloodvine
+-- Golden Sansam
+(17202,13464,100,1,0,1,3), -- Golden Sansam
+(17202,19726, 15,1,0,1,3), -- Bloodvine
+-- Dreamfoil
+(17203,13463,100,1,0,1,3), -- Dreamfoil
+(17203,19726, 15,1,0,1,3), -- Bloodvine
+-- Mountain Silversage
+(17204,13465,100,1,0,1,3), -- Mountain Silversage
+(17204,19726, 15,1,0,1,3), -- Bloodvine
+-- --------------------------
+-- -- Zangermarsh Specials --
+-- --------------------------
+-- Ragveil
+(19627,22787,100,1,0,1,3), -- Ragveil
+(19627,22575, 15,1,0,1,3), -- Mote of life
+(19627,22794, 2,1,0,1,1), -- Fel Lotus
+(19627,24401, 10,1,0,1,3), -- Unidentified Plant Parts
+-- Felweed
+(19628,22785,100,1,0,1,3), -- Felweed
+(19628,22575, 15,1,0,1,2), -- Mote of life
+(19628,22794, 2,1,0,1,1), -- Fel Lotus
+(19628,24401, 10,1,0,1,3), -- Unidentified Plant Parts
+-- Dreaming Glory
+(19629,22786,100,1,0,1,3), -- Dreaming Glory
+(19629,22575, 15,1,0,1,3), -- Mote of life
+(19629,22794, 2,1,0,1,1), -- Fel Lotus
+(19629,24401, 10,1,0,1,3), -- Unidentified Plant Parts
+-- Blindweed (Zangermarsh)
+(19630, 8839,100,1,0,1,3), -- Blindweed
+(19630,24401, 10,1,0,1,3); -- Unidentified Plant Parts
+
+-- Cleanups
+DELETE FROM `reference_loot_template` WHERE `entry` IN (12010,12011,12012,12013,12014,12015,12016,12017);
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`= 4 AND `SourceGroup` IN (6150,6313,13948) AND `SourceEntry`=11514;
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=10 AND `SourceGroup` IN (12010,12012,12013,12014) AND `SourceEntry`=11514; \ No newline at end of file
diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp
index f43a7f91f32..c5b5cd5dfef 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.cpp
+++ b/src/server/game/AI/SmartScripts/SmartAI.cpp
@@ -433,11 +433,12 @@ void SmartAI::MovementInform(uint32 MovementType, uint32 Data)
void SmartAI::RemoveAuras()
{
+ /// @fixme: duplicated logic in CreatureAI::_EnterEvadeMode (could use RemoveAllAurasExceptType)
Unit::AuraApplicationMap& appliedAuras = me->GetAppliedAuras();
for (Unit::AuraApplicationMap::iterator iter = appliedAuras.begin(); iter != appliedAuras.end();)
{
Aura const* aura = iter->second->GetBase();
- if (!aura->IsPassive() && !aura->HasEffectType(SPELL_AURA_CONTROL_VEHICLE) && aura->GetCasterGUID() != me->GetGUID())
+ if (!aura->IsPassive() && !aura->HasEffectType(SPELL_AURA_CONTROL_VEHICLE) && !aura->HasEffectType(SPELL_AURA_CLONE_CASTER) && aura->GetCasterGUID() != me->GetGUID())
me->RemoveAura(iter);
else
++iter;
diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp
index 4fa02decdf8..088098275e9 100644
--- a/src/server/game/Entities/Pet/Pet.cpp
+++ b/src/server/game/Entities/Pet/Pet.cpp
@@ -1506,16 +1506,16 @@ void Pet::InitLevelupSpellsForLevel()
{
for (uint8 i = 0; i < MAX_CREATURE_SPELL_DATA_SLOT; ++i)
{
- SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(defSpells->spellid[i]);
- if (!spellEntry)
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(defSpells->spellid[i]);
+ if (!spellInfo)
continue;
// will called first if level down
- if (spellEntry->SpellLevel > level)
- unlearnSpell(spellEntry->Id, true);
+ if (spellInfo->SpellLevel > level)
+ unlearnSpell(spellInfo->Id, true);
// will called if level up
else
- learnSpell(spellEntry->Id);
+ learnSpell(spellInfo->Id);
}
}
}
diff --git a/src/server/game/Entities/Totem/Totem.cpp b/src/server/game/Entities/Totem/Totem.cpp
index efdf386f80e..9784f6194ee 100644
--- a/src/server/game/Entities/Totem/Totem.cpp
+++ b/src/server/game/Entities/Totem/Totem.cpp
@@ -107,7 +107,7 @@ void Totem::UnSummon(uint32 msTime)
RemoveAurasDueToSpell(GetSpell(), GetGUID());
// clear owner's totem slot
- for (int i = SUMMON_SLOT_TOTEM; i < MAX_TOTEM_SLOT; ++i)
+ for (uint8 i = SUMMON_SLOT_TOTEM; i < MAX_TOTEM_SLOT; ++i)
{
if (GetOwner()->m_SummonSlot[i] == GetGUID())
{
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 8f7c26e3ab6..27e8453cfc3 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -162,7 +162,7 @@ ProcEventInfo::ProcEventInfo(Unit* actor, Unit* actionTarget, Unit* procTarget,
#endif
Unit::Unit(bool isWorldObject) :
WorldObject(isWorldObject), m_movedPlayer(NULL), m_lastSanctuaryTime(0),
- m_TempSpeed(0.0f), IsAIEnabled(false), NeedChangeAI(false),
+ IsAIEnabled(false), NeedChangeAI(false),
m_ControlledByPlayer(false), movespline(new Movement::MoveSpline()),
i_AI(NULL), i_disabledAI(NULL), m_AutoRepeatFirstCast(false), m_procDeep(0),
m_removedAurasCount(0), i_motionMaster(this), m_ThreatManager(this),
@@ -195,8 +195,6 @@ Unit::Unit(bool isWorldObject) :
for (uint8 i = 0; i < CURRENT_MAX_SPELL; ++i)
m_currentSpells[i] = NULL;
- m_addDmgOnce = 0;
-
for (uint8 i = 0; i < MAX_SUMMON_SLOT; ++i)
m_SummonSlot[i] = 0;
@@ -12631,18 +12629,6 @@ Player* Unit::GetSpellModOwner() const
}
///----------Pet responses methods-----------------
-void Unit::SendPetCastFail(uint8 castCount, SpellInfo const* spellInfo, SpellCastResult result)
-{
- if (result == SPELL_CAST_OK)
- return;
-
- Unit* owner = GetCharmerOrOwner();
- if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
- return;
-
- Spell::SendCastResult(owner->ToPlayer(), spellInfo, castCount, result, SPELL_CUSTOM_ERROR_NONE, SMSG_PET_CAST_FAILED);
-}
-
void Unit::SendPetActionFeedback(uint8 msg)
{
Unit* owner = GetOwner();
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index c51be5d460e..9aade75a536 100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -967,7 +967,8 @@ struct CalcDamageInfo
};
// Spell damage info structure based on structure sending in SMSG_SPELLNONMELEEDAMAGELOG opcode
-struct SpellNonMeleeDamage{
+struct SpellNonMeleeDamage
+{
SpellNonMeleeDamage(Unit* _attacker, Unit* _target, uint32 _SpellID, uint32 _schoolMask)
: target(_target), attacker(_attacker), SpellID(_SpellID), damage(0), overkill(0), schoolMask(_schoolMask),
absorb(0), resist(0), physicalLog(false), unused(false), blocked(0), HitInfo(0), cleanDamage(0)
@@ -1851,7 +1852,6 @@ class Unit : public WorldObject
Spell* FindCurrentSpellBySpellId(uint32 spell_id) const;
int32 GetCurrentSpellCastTime(uint32 spell_id) const;
- uint32 m_addDmgOnce;
uint64 m_SummonSlot[MAX_SUMMON_SLOT];
uint64 m_ObjectSlot[MAX_GAMEOBJECT_SLOT];
@@ -2004,9 +2004,6 @@ class Unit : public WorldObject
float GetSpeed(UnitMoveType mtype) const;
float GetSpeedRate(UnitMoveType mtype) const { return m_speed_rate[mtype]; }
void SetSpeed(UnitMoveType mtype, float rate, bool forced = false);
- float m_TempSpeed;
-
- bool isHover() const { return HasAuraType(SPELL_AURA_HOVER); }
float ApplyEffectModifiers(SpellInfo const* spellProto, uint8 effect_index, float value) const;
int32 CalculateSpellDamage(Unit const* target, SpellInfo const* spellProto, uint8 effect_index, int32 const* basePoints = NULL) const;
@@ -2049,7 +2046,6 @@ class Unit : public WorldObject
void ClearComboPointHolders();
///----------Pet responses methods-----------------
- void SendPetCastFail(uint8 castCount, SpellInfo const* spellInfo, SpellCastResult result);
void SendPetActionFeedback (uint8 msg);
void SendPetTalk (uint32 pettalk);
void SendPetAIReaction(uint64 guid);
diff --git a/src/server/game/Handlers/PetHandler.cpp b/src/server/game/Handlers/PetHandler.cpp
index a608eb500c7..2e7ca070924 100644
--- a/src/server/game/Handlers/PetHandler.cpp
+++ b/src/server/game/Handlers/PetHandler.cpp
@@ -312,10 +312,6 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint32 spellid
return;
}
- if (spellInfo->StartRecoveryCategory > 0)
- if (pet->GetCharmInfo() && pet->GetCharmInfo()->GetGlobalCooldownMgr().HasGlobalCooldown(spellInfo))
- return;
-
for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (spellInfo->Effects[i].TargetA.GetTarget() == TARGET_UNIT_SRC_AREA_ENEMY || spellInfo->Effects[i].TargetA.GetTarget() == TARGET_UNIT_DEST_AREA_ENEMY || spellInfo->Effects[i].TargetA.GetTarget() == TARGET_DEST_DYNOBJ_ENEMY)
@@ -395,10 +391,10 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint32 spellid
}
else
{
- if (pet->isPossessed() || pet->IsVehicle())
+ if (pet->isPossessed() || pet->IsVehicle()) /// @todo: confirm this check
Spell::SendCastResult(GetPlayer(), spellInfo, 0, result);
else
- pet->SendPetCastFail(0, spellInfo, result);
+ spell->SendPetCastResult(result);
if (!pet->ToCreature()->HasSpellCooldown(spellid))
GetPlayer()->SendClearCooldown(spellid, pet);
@@ -780,13 +776,6 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket)
return;
}
- if (spellInfo->StartRecoveryCategory > 0) // Check if spell is affected by GCD
- if (caster->GetTypeId() == TYPEID_UNIT && caster->GetCharmInfo() && caster->GetCharmInfo()->GetGlobalCooldownMgr().HasGlobalCooldown(spellInfo))
- {
- caster->SendPetCastFail(castCount, spellInfo, SPELL_FAILED_NOT_READY);
- return;
- }
-
// do not cast not learned spells
if (!caster->HasSpell(spellId) || spellInfo->IsPassive())
return;
@@ -801,25 +790,19 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket)
spell->m_cast_count = castCount; // probably pending spell cast
spell->m_targets = targets;
- /// @todo need to check victim?
- SpellCastResult result;
- if (caster->m_movedPlayer)
- result = spell->CheckPetCast(caster->m_movedPlayer->GetSelectedUnit());
- else
- result = spell->CheckPetCast(NULL);
+ SpellCastResult result = spell->CheckPetCast(NULL);
+
if (result == SPELL_CAST_OK)
{
- if (caster->GetTypeId() == TYPEID_UNIT)
+ if (Creature* creature = caster->ToCreature())
{
- Creature* pet = caster->ToCreature();
- pet->AddCreatureSpellCooldown(spellId);
- if (pet->IsPet())
+ creature->AddCreatureSpellCooldown(spellId);
+ if (Pet* pet = creature->ToPet())
{
- Pet* p = (Pet*)pet;
// 10% chance to play special pet attack talk, else growl
// actually this only seems to happen on special spells, fire shield for imp, torment for voidwalker, but it's stupid to check every spell
- if (p->getPetType() == SUMMON_PET && (urand(0, 100) < 10))
- pet->SendPetTalk((uint32)PET_TALK_SPECIAL_SPELL);
+ if (pet->getPetType() == SUMMON_PET && (urand(0, 100) < 10))
+ pet->SendPetTalk(PET_TALK_SPECIAL_SPELL);
else
pet->SendPetAIReaction(guid);
}
@@ -829,7 +812,8 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket)
}
else
{
- caster->SendPetCastFail(castCount, spellInfo, result);
+ spell->SendPetCastResult(result);
+
if (caster->GetTypeId() == TYPEID_PLAYER)
{
if (!caster->ToPlayer()->HasSpellCooldown(spellId))
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 4bffd35af38..7b30c3e6634 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -2025,6 +2025,15 @@ void Spell::SearchChainTargets(std::list<WorldObject*>& targets, uint32 chainTar
}
}
+GameObject* Spell::SearchSpellFocus()
+{
+ GameObject* focus = NULL;
+ Trinity::GameObjectFocusCheck check(m_caster, m_spellInfo->RequiresSpellFocus);
+ Trinity::GameObjectSearcher<Trinity::GameObjectFocusCheck> searcher(m_caster, focus, check);
+ SearchTargets<Trinity::GameObjectSearcher<Trinity::GameObjectFocusCheck> > (searcher, GRID_MAP_TYPE_MASK_GAMEOBJECT, m_caster, m_caster, m_caster->GetVisibilityRange());
+ return focus;
+}
+
void Spell::prepareDataForTriggerSystem(AuraEffect const* /*triggeredByAura*/)
{
//==========================================================================================
@@ -3777,13 +3786,25 @@ void Spell::SendCastResult(SpellCastResult result)
SendCastResult(m_caster->ToPlayer(), m_spellInfo, m_cast_count, result, m_customError);
}
+void Spell::SendPetCastResult(SpellCastResult result)
+{
+ if (result == SPELL_CAST_OK)
+ return;
+
+ Unit* owner = m_caster->GetCharmerOrOwner();
+ if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
+ return;
+
+ SendCastResult(owner->ToPlayer(), m_spellInfo, m_cast_count, result, SPELL_CUSTOM_ERROR_NONE, SMSG_PET_CAST_FAILED);
+}
+
void Spell::SendCastResult(Player* caster, SpellInfo const* spellInfo, uint8 cast_count, SpellCastResult result, SpellCustomErrors customError /*= SPELL_CUSTOM_ERROR_NONE*/, Opcodes opcode /*= SMSG_CAST_FAILED*/)
{
if (result == SPELL_CAST_OK)
return;
WorldPacket data(opcode, (4+1+1));
- data << uint8(cast_count); // single cast or multi 2.3 (0/1)
+ data << uint8(cast_count);
data << uint32(spellInfo->Id);
data << uint8(result); // problem
switch (result)
@@ -5053,9 +5074,17 @@ SpellCastResult Spell::CheckCast(bool strict)
return SPELL_FAILED_NOT_MOUNTED;
}
+ // check spell focus object
+ if (m_spellInfo->RequiresSpellFocus)
+ {
+ focusObject = SearchSpellFocus();
+ if (!focusObject)
+ return SPELL_FAILED_REQUIRES_SPELL_FOCUS;
+ }
+
SpellCastResult castResult = SPELL_CAST_OK;
- // always (except passive spells) check items (focus object can be required for any type casts)
+ // always (except passive spells) check items (only player related checks)
if (!m_spellInfo->IsPassive())
{
castResult = CheckItems();
@@ -5655,6 +5684,11 @@ SpellCastResult Spell::CheckPetCast(Unit* target)
if (creatureCaster->HasSpellCooldown(m_spellInfo->Id))
return SPELL_FAILED_NOT_READY;
+ // Check if spell is affected by GCD
+ if (m_spellInfo->StartRecoveryCategory > 0)
+ if (m_caster->GetCharmInfo() && m_caster->GetCharmInfo()->GetGlobalCooldownMgr().HasGlobalCooldown(m_spellInfo))
+ return SPELL_FAILED_NOT_READY;
+
return CheckCast(true);
}
@@ -6049,26 +6083,6 @@ SpellCastResult Spell::CheckItems()
return SPELL_FAILED_EQUIPPED_ITEM_CLASS;
}
- // check spell focus object
- if (m_spellInfo->RequiresSpellFocus)
- {
- CellCoord p(Trinity::ComputeCellCoord(m_caster->GetPositionX(), m_caster->GetPositionY()));
- Cell cell(p);
-
- GameObject* ok = NULL;
- Trinity::GameObjectFocusCheck go_check(m_caster, m_spellInfo->RequiresSpellFocus);
- Trinity::GameObjectSearcher<Trinity::GameObjectFocusCheck> checker(m_caster, ok, go_check);
-
- TypeContainerVisitor<Trinity::GameObjectSearcher<Trinity::GameObjectFocusCheck>, GridTypeMapContainer > object_checker(checker);
- Map& map = *m_caster->GetMap();
- cell.Visit(p, object_checker, map, *m_caster, m_caster->GetVisibilityRange());
-
- if (!ok)
- return SPELL_FAILED_REQUIRES_SPELL_FOCUS;
-
- focusObject = ok; // game object found in range
- }
-
// do not take reagents for these item casts
if (!(m_CastItem && m_CastItem->GetTemplate()->Flags & ITEM_PROTO_FLAG_TRIGGERED_CAST))
{
diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h
index 244615c848a..37316e1d6bb 100644
--- a/src/server/game/Spells/Spell.h
+++ b/src/server/game/Spells/Spell.h
@@ -375,6 +375,8 @@ class Spell
void SearchAreaTargets(std::list<WorldObject*>& targets, float range, Position const* position, Unit* referer, SpellTargetObjectTypes objectType, SpellTargetCheckTypes selectionType, ConditionList* condList);
void SearchChainTargets(std::list<WorldObject*>& targets, uint32 chainTargets, WorldObject* target, SpellTargetObjectTypes objectType, SpellTargetCheckTypes selectType, ConditionList* condList, bool isChainHeal);
+ GameObject* SearchSpellFocus();
+
void prepare(SpellCastTargets const* targets, AuraEffect const* triggeredByAura = NULL);
void cancel();
void update(uint32 difftime);
@@ -422,6 +424,7 @@ class Spell
static void SendCastResult(Player* caster, SpellInfo const* spellInfo, uint8 cast_count, SpellCastResult result, SpellCustomErrors customError = SPELL_CUSTOM_ERROR_NONE, Opcodes opcode = SMSG_CAST_FAILED);
void SendCastResult(SpellCastResult result);
+ void SendPetCastResult(SpellCastResult result);
void SendSpellStart();
void SendSpellGo();
void SendSpellCooldown();
diff --git a/src/server/scripts/EasternKingdoms/BaradinHold/boss_occuthar.cpp b/src/server/scripts/EasternKingdoms/BaradinHold/boss_occuthar.cpp
index 678bd884cb7..9876da73004 100644
--- a/src/server/scripts/EasternKingdoms/BaradinHold/boss_occuthar.cpp
+++ b/src/server/scripts/EasternKingdoms/BaradinHold/boss_occuthar.cpp
@@ -23,9 +23,9 @@
enum Spells
{
SPELL_SEARING_SHADOWS = 96913,
- SPEll_FOCUSED_FIRE_FIRST_DAMAGE = 97212,
- SPEll_FOCUSED_FIRE_TRIGGER = 96872,
- SPEll_FOCUSED_FIRE_VISUAL = 96886,
+ SPELL_FOCUSED_FIRE_FIRST_DAMAGE = 97212,
+ SPELL_FOCUSED_FIRE_TRIGGER = 96872,
+ SPELL_FOCUSED_FIRE_VISUAL = 96886,
SPELL_FOCUSED_FIRE = 96884,
SPELL_EYES_OF_OCCUTHAR = 96920,
SPELL_GAZE_OF_OCCUTHAR = 96942,
@@ -95,7 +95,7 @@ class boss_occuthar : public CreatureScript
for (uint8 i = 0; i < MAX_OCCUTHAR_VEHICLE_SEATS; ++i)
{
if (Unit* vehicle = _vehicle->GetPassenger(i))
- vehicle->CastSpell(summon, SPEll_FOCUSED_FIRE_VISUAL);
+ vehicle->CastSpell(summon, SPELL_FOCUSED_FIRE_VISUAL);
}
}
}
@@ -119,7 +119,7 @@ class boss_occuthar : public CreatureScript
events.ScheduleEvent(EVENT_SEARING_SHADOWS, 25 * IN_MILLISECONDS);
break;
case EVENT_FOCUSED_FIRE:
- DoCastAOE(SPEll_FOCUSED_FIRE_TRIGGER, true);
+ DoCastAOE(SPELL_FOCUSED_FIRE_TRIGGER, true);
events.ScheduleEvent(EVENT_FOCUSED_FIRE, 15 * IN_MILLISECONDS);
break;
case EVENT_EYES_OF_OCCUTHAR:
@@ -180,7 +180,7 @@ class npc_eyestalk : public CreatureScript
if (_events.ExecuteEvent() == EVENT_FOCUSED_FIRE_FIRST_DAMAGE)
{
- DoCastAOE(SPEll_FOCUSED_FIRE_FIRST_DAMAGE);
+ DoCastAOE(SPELL_FOCUSED_FIRE_FIRST_DAMAGE);
if (++_damageCount < 2)
_events.ScheduleEvent(EVENT_FOCUSED_FIRE_FIRST_DAMAGE, 1 * IN_MILLISECONDS);
}