aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bindings/scripts/CMakeLists.txt2
-rw-r--r--src/bindings/scripts/ScriptMgr.cpp14
-rw-r--r--src/bindings/scripts/VC80/80ScriptDev2.vcproj12
-rw-r--r--src/bindings/scripts/VC90/90ScriptDev2.vcproj12
-rw-r--r--src/bindings/scripts/include/sc_creature.cpp24
-rw-r--r--src/bindings/scripts/include/sc_creature.h6
-rw-r--r--src/bindings/scripts/scripts/go/go_scripts.cpp25
-rw-r--r--src/bindings/scripts/scripts/item/item_scripts.cpp47
-rw-r--r--src/bindings/scripts/scripts/npc/npcs_special.cpp3
-rw-r--r--src/bindings/scripts/scripts/zone/azuremyst_isle/azuremyst_isle.cpp15
-rw-r--r--src/bindings/scripts/scripts/zone/black_temple/boss_shade_of_akama.cpp13
-rw-r--r--src/bindings/scripts/scripts/zone/blackwing_lair/boss_broodlord_lashlayer.cpp3
-rw-r--r--src/bindings/scripts/scripts/zone/blackwing_lair/boss_nefarian.cpp3
-rw-r--r--src/bindings/scripts/scripts/zone/blackwing_lair/boss_razorgore.cpp3
-rw-r--r--src/bindings/scripts/scripts/zone/blackwing_lair/boss_vaelastrasz.cpp3
-rw-r--r--src/bindings/scripts/scripts/zone/blades_edge_mountains/blades_edge_mountains.cpp3
-rw-r--r--src/bindings/scripts/scripts/zone/borean_tundra/borean_tundra.cpp154
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/boss_temporus.cpp5
-rw-r--r--src/bindings/scripts/scripts/zone/eastern_plaguelands/the_scarlet_enclave.cpp69
-rw-r--r--src/bindings/scripts/scripts/zone/gruuls_lair/boss_gruul.cpp3
-rw-r--r--src/bindings/scripts/scripts/zone/hellfire_citadel/shattered_halls/boss_warbringer_omrogg.cpp3
-rw-r--r--src/bindings/scripts/scripts/zone/isle_of_queldanas/isle_of_queldanas.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/karazhan/boss_curator.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/karazhan/boss_midnight.cpp3
-rw-r--r--src/bindings/scripts/scripts/zone/magisters_terrace/magisters_terrace.cpp145
-rw-r--r--src/bindings/scripts/scripts/zone/obsidian_sanctum/boss_sartharion.cpp1170
-rw-r--r--src/bindings/scripts/scripts/zone/obsidian_sanctum/def_obsidian_sanctum.h16
-rw-r--r--src/bindings/scripts/scripts/zone/obsidian_sanctum/instance_obsidian_sanctum.cpp77
-rw-r--r--src/bindings/scripts/scripts/zone/onyxias_lair/boss_onyxia.cpp3
-rw-r--r--src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/sunwell_plateau/boss_muru.cpp254
-rw-r--r--src/bindings/scripts/scripts/zone/sunwell_plateau/def_sunwell_plateau.h6
-rw-r--r--src/bindings/scripts/scripts/zone/sunwell_plateau/instance_sunwell_plateau.cpp106
-rw-r--r--src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_kaelthas.cpp11
-rw-r--r--src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_twinemperors.cpp34
-rw-r--r--src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/mob_anubisath_sentinel.cpp36
-rw-r--r--src/bindings/scripts/scripts/zone/westfall/westfall.cpp34
-rw-r--r--src/bindings/scripts/scripts/zone/zuldrak/zuldrak.cpp187
-rw-r--r--src/bindings/scripts/scripts/zone/zulgurub/boss_marli.cpp3
-rw-r--r--src/bindings/scripts/scripts/zone/zulgurub/boss_thekal.cpp15
-rw-r--r--src/framework/Platform/Define.h11
-rw-r--r--src/game/Chat.cpp3
-rw-r--r--src/game/Chat.h1
-rw-r--r--src/game/Creature.cpp4
-rw-r--r--src/game/CreatureEventAI.cpp3
-rw-r--r--src/game/GameObject.cpp141
-rw-r--r--src/game/GameObject.h12
-rw-r--r--src/game/GridNotifiers.h61
-rw-r--r--src/game/Guild.cpp40
-rw-r--r--src/game/Level1.cpp5
-rw-r--r--src/game/Level3.cpp13
-rw-r--r--src/game/MiscHandler.cpp2
-rw-r--r--src/game/Object.cpp30
-rw-r--r--src/game/Object.h3
-rw-r--r--src/game/ObjectMgr.h2
-rw-r--r--src/game/Player.cpp69
-rw-r--r--src/game/Player.h19
-rw-r--r--src/game/ReputationMgr.cpp2
-rw-r--r--src/game/SharedDefines.h2
-rw-r--r--src/game/Spell.cpp72
-rw-r--r--src/game/Spell.h1
-rw-r--r--src/game/SpellAuras.cpp46
-rw-r--r--src/game/SpellEffects.cpp142
-rw-r--r--src/game/SpellMgr.cpp166
-rw-r--r--src/game/SpellMgr.h15
-rw-r--r--src/game/TemporarySummon.h2
-rw-r--r--src/game/Unit.cpp49
-rw-r--r--src/game/Unit.h2
-rw-r--r--src/game/UnitAI.h3
-rw-r--r--src/game/World.cpp3
-rw-r--r--src/game/pchdef.h4
-rw-r--r--src/shared/Errors.h4
-rw-r--r--src/trinitycore/RASocket.cpp5
-rw-r--r--src/trinitycore/trinitycore.conf.dist4
74 files changed, 2512 insertions, 957 deletions
diff --git a/src/bindings/scripts/CMakeLists.txt b/src/bindings/scripts/CMakeLists.txt
index 3f86535f5e3..6fe9c0e1ec0 100644
--- a/src/bindings/scripts/CMakeLists.txt
+++ b/src/bindings/scripts/CMakeLists.txt
@@ -208,6 +208,7 @@ SET(trinityscript_LIB_SRCS
scripts/zone/magisters_terrace/boss_vexallus.cpp
scripts/zone/magisters_terrace/def_magisters_terrace.h
scripts/zone/magisters_terrace/instance_magisters_terrace.cpp
+ scripts/zone/magisters_terrace/magisters_terrace.cpp
scripts/zone/maraudon/boss_celebras_the_cursed.cpp
scripts/zone/maraudon/boss_landslide.cpp
scripts/zone/maraudon/boss_noxxion.cpp
@@ -380,6 +381,7 @@ SET(trinityscript_LIB_SRCS
scripts/zone/zulaman/def_zulaman.h
scripts/zone/zulaman/instance_zulaman.cpp
scripts/zone/zulaman/zulaman.cpp
+ scripts/zone/zuldrak/zuldrak.cpp
scripts/zone/zulfarrak/zulfarrak.cpp
scripts/zone/zulgurub/boss_arlokk.cpp
scripts/zone/zulgurub/boss_gahzranka.cpp
diff --git a/src/bindings/scripts/ScriptMgr.cpp b/src/bindings/scripts/ScriptMgr.cpp
index 217752b340e..f81edfdfb01 100644
--- a/src/bindings/scripts/ScriptMgr.cpp
+++ b/src/bindings/scripts/ScriptMgr.cpp
@@ -356,6 +356,7 @@ extern void AddSC_boss_selin_fireheart();
extern void AddSC_boss_vexallus();
extern void AddSC_boss_priestess_delrissa();
extern void AddSC_instance_magisters_terrace();
+extern void AddSC_magisters_terrace();
//Maraudon
extern void AddSC_boss_celebras_the_cursed();
@@ -414,6 +415,9 @@ extern void AddSC_boss_ormorok();
extern void AddSC_boss_keristrasza();
extern void AddSC_instance_nexus();
+//Obsidian Sanctum
+extern void AddSC_instance_obsidian_sanctum();
+
//Onyxia's Lair
extern void AddSC_boss_onyxia();
@@ -636,6 +640,9 @@ extern void AddSC_boss_zuljin();
extern void AddSC_instance_zulaman();
extern void AddSC_zulaman();
+//Zul'Drak
+extern void AddSC_zuldrak();
+
//Northrend
//Dungeon
//Vault of Archavon
@@ -1254,6 +1261,7 @@ void ScriptsInit(char const* cfg_file = "trinitycore.conf")
AddSC_boss_vexallus();
AddSC_boss_priestess_delrissa();
AddSC_instance_magisters_terrace();
+ AddSC_magisters_terrace();
//Maraudon
AddSC_boss_celebras_the_cursed();
@@ -1312,6 +1320,9 @@ void ScriptsInit(char const* cfg_file = "trinitycore.conf")
AddSC_boss_keristrasza();
AddSC_instance_nexus();
+ //Obsidian Sanctum
+ AddSC_instance_obsidian_sanctum();
+
//Onyxia's Lair
AddSC_boss_onyxia();
@@ -1534,6 +1545,9 @@ void ScriptsInit(char const* cfg_file = "trinitycore.conf")
AddSC_instance_zulaman();
AddSC_zulaman();
+ //Zul'Drak
+ AddSC_zuldrak();
+
//Northrend
//Dungeon
//Vault of Archavon
diff --git a/src/bindings/scripts/VC80/80ScriptDev2.vcproj b/src/bindings/scripts/VC80/80ScriptDev2.vcproj
index 76167df9ae1..53a1624820c 100644
--- a/src/bindings/scripts/VC80/80ScriptDev2.vcproj
+++ b/src/bindings/scripts/VC80/80ScriptDev2.vcproj
@@ -1102,6 +1102,10 @@
RelativePath="..\scripts\zone\magisters_terrace\instance_magisters_terrace.cpp"
>
</File>
+ <File
+ RelativePath="..\scripts\zone\magisters_terrace\magisters_terrace.cpp"
+ >
+ </File>
</Filter>
<Filter
Name="Loch Modan"
@@ -1835,6 +1839,14 @@
>
</File>
</Filter>
+ <Filter
+ Name="Zul&apos;Drak"
+ >
+ <File
+ RelativePath="..\scripts\zone\zuldrak\zuldrak.cpp"
+ >
+ </File>
+ </Filter>
<Filter
Name="Wetlands"
>
diff --git a/src/bindings/scripts/VC90/90ScriptDev2.vcproj b/src/bindings/scripts/VC90/90ScriptDev2.vcproj
index 4edd104a1c6..1b8d6f0638e 100644
--- a/src/bindings/scripts/VC90/90ScriptDev2.vcproj
+++ b/src/bindings/scripts/VC90/90ScriptDev2.vcproj
@@ -1103,6 +1103,10 @@
RelativePath="..\scripts\zone\magisters_terrace\instance_magisters_terrace.cpp"
>
</File>
+ <File
+ RelativePath="..\scripts\zone\magisters_terrace\magisters_terrace.cpp"
+ >
+ </File>
</Filter>
<Filter
Name="Loch Modan"
@@ -1836,6 +1840,14 @@
>
</File>
</Filter>
+ <Filter
+ Name="Zul&apos;Drak"
+ >
+ <File
+ RelativePath="..\scripts\zone\zuldrak\zuldrak.cpp"
+ >
+ </File>
+ </Filter>
<Filter
Name="Wetlands"
>
diff --git a/src/bindings/scripts/include/sc_creature.cpp b/src/bindings/scripts/include/sc_creature.cpp
index 159fc4419ba..c80f55fc0f5 100644
--- a/src/bindings/scripts/include/sc_creature.cpp
+++ b/src/bindings/scripts/include/sc_creature.cpp
@@ -533,6 +533,25 @@ std::list<Creature*> ScriptedAI::DoFindFriendlyMissingBuff(float range, uint32 s
return pList;
}
+Player* ScriptedAI::GetPlayerAtMinimumRange(float fMinimumRange)
+{
+ Player* pPlayer = NULL;
+
+ CellPair pair(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY()));
+ Cell cell(pair);
+ cell.data.Part.reserved = ALL_DISTRICT;
+ cell.SetNoCreate();
+
+ Trinity::PlayerAtMinimumRangeAway check(m_creature, fMinimumRange);
+ Trinity::PlayerSearcher<Trinity::PlayerAtMinimumRangeAway> searcher(m_creature, pPlayer, check);
+ TypeContainerVisitor<Trinity::PlayerSearcher<Trinity::PlayerAtMinimumRangeAway>, GridTypeMapContainer> visitor(searcher);
+
+ CellLock<GridReadGuard> cell_lock(cell, pair);
+ cell_lock->Visit(cell_lock, visitor, *(m_creature->GetMap()));
+
+ return pPlayer;
+}
+
void ScriptedAI::SetEquipmentSlots(bool bLoadDefault, int32 uiMainHand, int32 uiOffHand, int32 uiRanged)
{
if (bLoadDefault)
@@ -553,11 +572,6 @@ void ScriptedAI::SetEquipmentSlots(bool bLoadDefault, int32 uiMainHand, int32 ui
m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, uint32(uiRanged));
}
-void ScriptedAI::SetSheathState(SheathState newState)
-{
- m_creature->SetByteValue(UNIT_FIELD_BYTES_2, 0, newState);
-}
-
void ScriptedAI::SetCombatMovement(bool CombatMove)
{
CombatMovement = CombatMove;
diff --git a/src/bindings/scripts/include/sc_creature.h b/src/bindings/scripts/include/sc_creature.h
index 13713a56100..666ec1fad44 100644
--- a/src/bindings/scripts/include/sc_creature.h
+++ b/src/bindings/scripts/include/sc_creature.h
@@ -169,6 +169,9 @@ struct TRINITY_DLL_DECL ScriptedAI : public CreatureAI
//Returns a list of all friendly units missing a specific buff within range
std::list<Creature*> DoFindFriendlyMissingBuff(float range, uint32 spellid);
+ //Return a player with at least minimumRange from m_creature
+ Player* GetPlayerAtMinimumRange(float fMinimumRange);
+
//Spawns a creature relative to m_creature
Creature* DoSpawnCreature(uint32 id, float x, float y, float z, float angle, uint32 type, uint32 despawntime);
Creature *DoSummon(uint32 entry, const float pos[4], uint32 despawntime = 30000, TempSummonType type = TEMPSUMMON_CORPSE_TIMED_DESPAWN);
@@ -186,8 +189,6 @@ struct TRINITY_DLL_DECL ScriptedAI : public CreatureAI
bool CanCast(Unit* Target, SpellEntry const *Spell, bool Triggered = false);
void SetEquipmentSlots(bool bLoadDefault, int32 uiMainHand = EQUIP_NO_CHANGE, int32 uiOffHand = EQUIP_NO_CHANGE, int32 uiRanged = EQUIP_NO_CHANGE);
-
- void SetSheathState(SheathState newState);
void SetCombatMovement(bool CombatMove);
@@ -248,6 +249,5 @@ struct TRINITY_DLL_DECL BossAI : public ScriptedAI
//return closest creature alive in grid, with range from pSource
Creature* GetClosestCreatureWithEntry(WorldObject* pSource, uint32 Entry, float MaxSearchRange);
-
#endif
diff --git a/src/bindings/scripts/scripts/go/go_scripts.cpp b/src/bindings/scripts/scripts/go/go_scripts.cpp
index bd0e621c3c4..b50a0b79bf4 100644
--- a/src/bindings/scripts/scripts/go/go_scripts.cpp
+++ b/src/bindings/scripts/scripts/go/go_scripts.cpp
@@ -17,7 +17,7 @@
/* ScriptData
SDName: GO_Scripts
SD%Complete: 100
-SDComment: Quest support: 4285,4287,4288(crystal pylons), 4296, 10990, 10991, 10992, Field_Repair_Bot->Teaches spell 22704. Barov_journal->Teaches spell 26089
+SDComment: Quest support: 4285,4287,4288(crystal pylons), 4296, 6481, 10990, 10991, 10992, Field_Repair_Bot->Teaches spell 22704. Barov_journal->Teaches spell 26089
SDCategory: Game Objects
EndScriptData */
@@ -33,6 +33,7 @@ go_sacred_fire_of_life
go_shrine_of_the_birds
go_field_repair_bot_74A
go_orb_of_command
+go_resonite_cask
go_tablet_of_madness
go_tablet_of_the_seven
go_tele_to_dalaran_crystal
@@ -275,6 +276,23 @@ bool GOHello_go_ethereum_stasis(Player* pPlayer, GameObject* pGo)
}
/*######
+## go_resonite_cask
+######*/
+
+enum
+{
+ NPC_GOGGEROC = 11920
+};
+
+bool GOHello_go_resonite_cask(Player* pPlayer, GameObject* pGO)
+{
+ if (pGO->GetGoType() == GAMEOBJECT_TYPE_GOOBER)
+ pGO->SummonCreature(NPC_GOGGEROC, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 300000);
+
+ return false;
+}
+
+/*######
## go_sacred_fire_of_life
######*/
@@ -434,6 +452,11 @@ void AddSC_go_scripts()
newscript->RegisterSelf();
newscript = new Script;
+ newscript->Name = "go_resonite_cask";
+ newscript->pGOHello = &GOHello_go_resonite_cask;
+ newscript->RegisterSelf();
+
+ newscript = new Script;
newscript->Name = "go_sacred_fire_of_life";
newscript->pGOHello = &GOHello_go_sacred_fire_of_life;
newscript->RegisterSelf();
diff --git a/src/bindings/scripts/scripts/item/item_scripts.cpp b/src/bindings/scripts/scripts/item/item_scripts.cpp
index f577d0fed9c..a58edb58fa2 100644
--- a/src/bindings/scripts/scripts/item/item_scripts.cpp
+++ b/src/bindings/scripts/scripts/item/item_scripts.cpp
@@ -25,6 +25,7 @@ EndScriptData */
item_area_52_special(i28132) Prevents abuse of this item
item_attuned_crystal_cores(i34368) Prevent abuse(quest 11524 & 11525)
item_blackwhelp_net(i31129) Quest Whelps of the Wyrmcult (q10747). Prevents abuse
+item_dart_gun Prevent quest provided item instakill anything but the expected
item_draenei_fishing_net(i23654) Hacklike implements chance to spawn item or creature
item_disciplinary_rod Prevents abuse
item_nether_wraith_beacon(i31742) Summons creatures for quest Becoming a Spellfire Tailor (q10832)
@@ -130,6 +131,25 @@ bool ItemUse_item_blackwhelp_net(Player *player, Item* _Item, SpellCastTargets c
}
/*#####
+# item_dart_gun
+#####*/
+
+enum
+{
+ NPC_HAMMER_SCOUT = 32201
+};
+
+bool ItemUse_item_dart_gun(Player* pPlayer, Item* pItem, const SpellCastTargets &pTargets)
+{
+ if (pTargets.getUnitTarget() && pTargets.getUnitTarget()->GetTypeId() == TYPEID_UNIT &&
+ pTargets.getUnitTarget()->GetEntry() == NPC_HAMMER_SCOUT)
+ return false;
+
+ pPlayer->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, pItem, NULL);
+ return true;
+}
+
+/*#####
# item_draenei_fishing_net
#####*/
@@ -489,6 +509,23 @@ bool ItemUse_item_zezzak_shard(Player *player, Item* _Item, SpellCastTargets con
return true;
}
+/*#####
+# item_incendiary_explosives
+#####*/
+
+bool ItemUse_item_incendiary_explosives(Player *player, Item* _Item, SpellCastTargets const& targets)
+{
+ if ( player->FindNearestCreature(26248,15) || player->FindNearestCreature(26249,15) )
+ {
+ return false;
+ }
+ else
+ {
+ player->SendEquipError(EQUIP_ERR_OUT_OF_RANGE,_Item,NULL);
+ return true;
+ }
+}
+
void AddSC_item_scripts()
{
Script *newscript;
@@ -514,6 +551,11 @@ void AddSC_item_scripts()
newscript->RegisterSelf();
newscript = new Script;
+ newscript->Name = "item_dart_gun";
+ newscript->pItemUse = &ItemUse_item_dart_gun;
+ newscript->RegisterSelf();
+
+ newscript = new Script;
newscript->Name="item_disciplinary_rod";
newscript->pItemUse = &ItemUse_item_disciplinary_rod;
newscript->RegisterSelf();
@@ -592,5 +634,10 @@ void AddSC_item_scripts()
newscript->Name="item_zezzaks_shard";
newscript->pItemUse = &ItemUse_item_zezzak_shard;
newscript->RegisterSelf();
+
+ newscript = new Script;
+ newscript->Name="item_incendiary_explosives";
+ newscript->pItemUse = &ItemUse_item_incendiary_explosives;
+ newscript->RegisterSelf();
}
diff --git a/src/bindings/scripts/scripts/npc/npcs_special.cpp b/src/bindings/scripts/scripts/npc/npcs_special.cpp
index 6c44b5b9ae3..9bf3113a9c6 100644
--- a/src/bindings/scripts/scripts/npc/npcs_special.cpp
+++ b/src/bindings/scripts/scripts/npc/npcs_special.cpp
@@ -1639,9 +1639,10 @@ CreatureAI* GetAI_mob_mojo(Creature *_Creature)
struct TRINITY_DLL_DECL npc_mirror_image : public SpellAI
{
npc_mirror_image(Creature *c) : SpellAI(c) {}
- Unit * owner;
+
void Reset()
{
+ Unit * owner = NULL;
if (m_creature->isSummon())
owner = ((TempSummon*)me)->GetOwner();
if (!owner)
diff --git a/src/bindings/scripts/scripts/zone/azuremyst_isle/azuremyst_isle.cpp b/src/bindings/scripts/scripts/zone/azuremyst_isle/azuremyst_isle.cpp
index 9974bc80fd9..f52a3bc59e9 100644
--- a/src/bindings/scripts/scripts/zone/azuremyst_isle/azuremyst_isle.cpp
+++ b/src/bindings/scripts/scripts/zone/azuremyst_isle/azuremyst_isle.cpp
@@ -441,8 +441,6 @@ struct TRINITY_DLL_DECL npc_geezleAI : public ScriptedAI
{
npc_geezleAI(Creature *c) : ScriptedAI(c) {}
- std::list<GameObject*> FlagList;
-
uint64 SparkGUID;
uint32 Step;
@@ -516,17 +514,8 @@ struct TRINITY_DLL_DECL npc_geezleAI : public ScriptedAI
void DespawnNagaFlag(bool despawn)
{
- CellPair pair(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY()));
- Cell cell(pair);
- cell.data.Part.reserved = ALL_DISTRICT;
- cell.SetNoCreate();
-
- Trinity::AllGameObjectsWithEntryInGrid go_check(GO_NAGA_FLAG);
- Trinity::GameObjectListSearcher<Trinity::AllGameObjectsWithEntryInGrid> go_search(m_creature, FlagList, go_check);
- TypeContainerVisitor
- <Trinity::GameObjectListSearcher<Trinity::AllGameObjectsWithEntryInGrid>, GridTypeMapContainer> go_visit(go_search);
- CellLock<GridReadGuard> cell_lock(cell, pair);
- cell_lock->Visit(cell_lock, go_visit, *(m_creature->GetMap()));
+ std::list<GameObject*> FlagList;
+ m_creature->GetGameObjectListWithEntryInGrid(FlagList,GO_NAGA_FLAG, 50.0f);
Player* player = NULL;
if (!FlagList.empty())
diff --git a/src/bindings/scripts/scripts/zone/black_temple/boss_shade_of_akama.cpp b/src/bindings/scripts/scripts/zone/black_temple/boss_shade_of_akama.cpp
index 5255a443b39..0cf81a8cd67 100644
--- a/src/bindings/scripts/scripts/zone/black_temple/boss_shade_of_akama.cpp
+++ b/src/bindings/scripts/scripts/zone/black_temple/boss_shade_of_akama.cpp
@@ -342,19 +342,8 @@ struct TRINITY_DLL_DECL boss_shade_of_akamaAI : public ScriptedAI
void FindChannelers()
{
- CellPair pair(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY()));
- Cell cell(pair);
- cell.data.Part.reserved = ALL_DISTRICT;
- cell.SetNoCreate();
-
std::list<Creature*> ChannelerList;
-
- Trinity::AllCreaturesOfEntryInRange check(m_creature, CREATURE_CHANNELER, 50);
- Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(m_creature, ChannelerList, check);
- TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange>, GridTypeMapContainer> visitor(searcher);
-
- CellLock<GridReadGuard> cell_lock(cell, pair);
- cell_lock->Visit(cell_lock, visitor, *(m_creature->GetMap()));
+ m_creature->GetCreatureListWithEntryInGrid(ChannelerList,CREATURE_CHANNELER,50.0f);
if(!ChannelerList.empty())
{
diff --git a/src/bindings/scripts/scripts/zone/blackwing_lair/boss_broodlord_lashlayer.cpp b/src/bindings/scripts/scripts/zone/blackwing_lair/boss_broodlord_lashlayer.cpp
index c2582ffb600..9207f5d03a4 100644
--- a/src/bindings/scripts/scripts/zone/blackwing_lair/boss_broodlord_lashlayer.cpp
+++ b/src/bindings/scripts/scripts/zone/blackwing_lair/boss_broodlord_lashlayer.cpp
@@ -48,9 +48,6 @@ struct TRINITY_DLL_DECL boss_broodlordAI : public ScriptedAI
MortalStrike_Timer = 20000;
KnockBack_Timer = 30000;
LeashCheck_Timer = 2000;
-
- m_creature->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true);
- m_creature->ApplySpellImmune(1, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, true);
}
void EnterCombat(Unit *who)
diff --git a/src/bindings/scripts/scripts/zone/blackwing_lair/boss_nefarian.cpp b/src/bindings/scripts/scripts/zone/blackwing_lair/boss_nefarian.cpp
index 808f381d197..c71b1871d94 100644
--- a/src/bindings/scripts/scripts/zone/blackwing_lair/boss_nefarian.cpp
+++ b/src/bindings/scripts/scripts/zone/blackwing_lair/boss_nefarian.cpp
@@ -79,9 +79,6 @@ struct TRINITY_DLL_DECL boss_nefarianAI : public ScriptedAI
TailLash_Timer = 10000;
ClassCall_Timer = 35000; //35-40 seconds
Phase3 = false;
-
- m_creature->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true);
- m_creature->ApplySpellImmune(1, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, true);
}
void KilledUnit(Unit* Victim)
diff --git a/src/bindings/scripts/scripts/zone/blackwing_lair/boss_razorgore.cpp b/src/bindings/scripts/scripts/zone/blackwing_lair/boss_razorgore.cpp
index 5267f1ef4b6..77e22a4d543 100644
--- a/src/bindings/scripts/scripts/zone/blackwing_lair/boss_razorgore.cpp
+++ b/src/bindings/scripts/scripts/zone/blackwing_lair/boss_razorgore.cpp
@@ -50,9 +50,6 @@ struct TRINITY_DLL_DECL boss_razorgoreAI : public ScriptedAI
WarStomp_Timer = 35000;
FireballVolley_Timer = 7000;
Conflagration_Timer = 12000;
-
- m_creature->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true);
- m_creature->ApplySpellImmune(1, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, true);
}
void EnterCombat(Unit *who)
diff --git a/src/bindings/scripts/scripts/zone/blackwing_lair/boss_vaelastrasz.cpp b/src/bindings/scripts/scripts/zone/blackwing_lair/boss_vaelastrasz.cpp
index 9925cd6d3bc..a1b87ae6f01 100644
--- a/src/bindings/scripts/scripts/zone/blackwing_lair/boss_vaelastrasz.cpp
+++ b/src/bindings/scripts/scripts/zone/blackwing_lair/boss_vaelastrasz.cpp
@@ -72,9 +72,6 @@ struct TRINITY_DLL_DECL boss_vaelAI : public ScriptedAI
TailSwipe_Timer = 20000;
HasYelled = false;
DoingSpeach = false;
-
- m_creature->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true);
- m_creature->ApplySpellImmune(1, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, true);
}
void BeginSpeach(Unit* target)
diff --git a/src/bindings/scripts/scripts/zone/blades_edge_mountains/blades_edge_mountains.cpp b/src/bindings/scripts/scripts/zone/blades_edge_mountains/blades_edge_mountains.cpp
index 9cf6d18b26f..0a90b870926 100644
--- a/src/bindings/scripts/scripts/zone/blades_edge_mountains/blades_edge_mountains.cpp
+++ b/src/bindings/scripts/scripts/zone/blades_edge_mountains/blades_edge_mountains.cpp
@@ -261,8 +261,7 @@ struct TRINITY_DLL_DECL npc_daranelleAI : public ScriptedAI
{
DoScriptText(SAY_SPELL_INFLUENCE, m_creature, who);
//TODO: Move the below to updateAI and run if this statement == true
- CAST_PLR(who)->KilledMonsterCredit(21511, m_creature->GetGUID());
- CAST_PLR(who)->RemoveAurasDueToSpell(36904);
+ DoCast(who,37028,true);
}
}
diff --git a/src/bindings/scripts/scripts/zone/borean_tundra/borean_tundra.cpp b/src/bindings/scripts/scripts/zone/borean_tundra/borean_tundra.cpp
index 94c93c8e449..7a8a2de4a39 100644
--- a/src/bindings/scripts/scripts/zone/borean_tundra/borean_tundra.cpp
+++ b/src/bindings/scripts/scripts/zone/borean_tundra/borean_tundra.cpp
@@ -87,6 +87,150 @@ bool GossipSelect_npc_surristrasz(Player *player, Creature *_Creature, uint32 se
return true;
}
+/*######
+## npc_sinkhole_kill_credit
+######*/
+
+enum
+{
+ SPELL_SET_CART = 46797,
+ SPELL_EXPLODE_CART = 46799,
+ SPELL_SUMMON_CART = 46798,
+ SPELL_SUMMON_WORM = 46800,
+};
+
+struct TRINITY_DLL_DECL npc_sinkhole_kill_creditAI : public ScriptedAI
+{
+ npc_sinkhole_kill_creditAI(Creature* c) : ScriptedAI(c){}
+
+ uint32 Phase_Timer;
+ uint8 Phase;
+ Unit* Caster;
+
+ void Reset()
+ {
+ Phase_Timer = 500;
+ Phase = 0;
+ Caster = NULL;
+ }
+
+ void SpellHit(Unit *caster, const SpellEntry *spell)
+ {
+ if (Phase)
+ return;
+
+ if (spell->Id == SPELL_SET_CART && CAST_PLR(caster)->GetQuestStatus(11897) == QUEST_STATUS_INCOMPLETE)
+ {
+ Phase = 1;
+ Caster = caster;
+ }
+ }
+
+ void EnterCombat(Unit* who) { }
+
+ void UpdateAI(const uint32 diff)
+ {
+ if (!Phase)
+ return;
+
+ if (Phase_Timer < diff)
+ {
+ switch (Phase)
+ {
+ case 1:
+ DoCast(m_creature, SPELL_EXPLODE_CART, true);
+ DoCast(m_creature, SPELL_SUMMON_CART, true);
+ if (GameObject* cart = m_creature->FindNearestGameObject(188160,3))
+ cart->SetUInt32Value(GAMEOBJECT_FACTION, 14);
+ Phase_Timer = 3000;
+ Phase = 2;
+ break;
+ case 2:
+ if (GameObject* cart = m_creature->FindNearestGameObject(188160,3))
+ cart->UseDoorOrButton();
+ DoCast(m_creature, SPELL_EXPLODE_CART, true);
+ Phase_Timer = 3000;
+ Phase = 3;
+ break;
+ case 3:
+ DoCast(m_creature, SPELL_EXPLODE_CART, true);
+ Phase_Timer = 2000;
+ Phase = 4;
+ case 5:
+ DoCast(m_creature, SPELL_SUMMON_WORM, true);
+ if (Unit* worm = m_creature->FindNearestCreature(26250, 3))
+ {
+ worm->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+ worm->HandleEmoteCommand(EMOTE_ONESHOT_EMERGE);
+ }
+ Phase_Timer = 1000;
+ Phase = 6;
+ break;
+ case 6:
+ DoCast(m_creature, SPELL_EXPLODE_CART, true);
+ if (Unit* worm = m_creature->FindNearestCreature(26250, 3))
+ {
+ m_creature->DealDamage(worm, worm->GetHealth());
+ worm->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
+ }
+ Phase_Timer = 2000;
+ Phase = 7;
+ break;
+ case 7:
+ DoCast(m_creature, SPELL_EXPLODE_CART, true);
+ CAST_PLR(Caster)->KilledMonster(m_creature->GetCreatureInfo(),m_creature->GetGUID());
+ Phase_Timer = 5000;
+ Phase = 8;
+ break;
+ case 8:
+ EnterEvadeMode();
+ break;
+ }
+ } else Phase_Timer -= diff;
+
+ }
+
+};
+
+CreatureAI* GetAI_npc_sinkhole_kill_credit(Creature* pCreature)
+{
+ return new npc_sinkhole_kill_creditAI(pCreature);
+}
+
+/*######
+## npc_khunok_the_behemoth
+######*/
+
+struct TRINITY_DLL_DECL npc_khunok_the_behemothAI : public ScriptedAI
+{
+ npc_khunok_the_behemothAI(Creature *c) : ScriptedAI(c) {}
+
+ void MoveInLineOfSight(Unit *who)
+ {
+ ScriptedAI::MoveInLineOfSight(who);
+
+ if(who->GetTypeId() != TYPEID_UNIT)
+ return;
+
+ if(who->GetEntry() == 25861 && me->IsWithinDistInMap(who, 10.0f))
+ {
+ if(Unit *owner = who->GetOwner())
+ {
+ if(owner->GetTypeId() == TYPEID_PLAYER)
+ {
+ DoCast(owner, 46231, true);
+ ((Creature*)who)->ForcedDespawn();
+ }
+ }
+ }
+ }
+};
+
+CreatureAI* GetAI_npc_khunok_the_behemoth(Creature *_Creature)
+{
+ return new npc_khunok_the_behemothAI(_Creature);
+}
+
void AddSC_borean_tundra()
{
Script *newscript;
@@ -102,4 +246,14 @@ void AddSC_borean_tundra()
newscript->pGossipHello = &GossipHello_npc_surristrasz;
newscript->pGossipSelect = &GossipSelect_npc_surristrasz;
newscript->RegisterSelf();
+
+ newscript = new Script;
+ newscript->Name="npc_sinkhole_kill_credit";
+ newscript->GetAI = &GetAI_npc_sinkhole_kill_credit;
+ newscript->RegisterSelf();
+
+ newscript = new Script;
+ newscript->Name="npc_khunok_the_behemoth";
+ newscript->GetAI = &GetAI_npc_khunok_the_behemoth;
+ newscript->RegisterSelf();
}
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/boss_temporus.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/boss_temporus.cpp
index eea9a28da36..a2e28a19d5b 100644
--- a/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/boss_temporus.cpp
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/boss_temporus.cpp
@@ -45,7 +45,7 @@ struct TRINITY_DLL_DECL boss_temporusAI : public ScriptedAI
boss_temporusAI(Creature *c) : ScriptedAI(c)
{
pInstance = c->GetInstanceData();
- HeroicMode = m_creature->GetMap()->IsHeroic();
+ HeroicMode = c->GetMap()->IsHeroic();
}
ScriptedInstance *pInstance;
@@ -58,9 +58,6 @@ struct TRINITY_DLL_DECL boss_temporusAI : public ScriptedAI
void Reset()
{
- m_creature->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true);
- m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, true);
-
Haste_Timer = 15000+rand()%8000;
SpellReflection_Timer = 30000;
MortalWound_Timer = 8000;
diff --git a/src/bindings/scripts/scripts/zone/eastern_plaguelands/the_scarlet_enclave.cpp b/src/bindings/scripts/scripts/zone/eastern_plaguelands/the_scarlet_enclave.cpp
index 213e92f762d..d8360d2c5b8 100644
--- a/src/bindings/scripts/scripts/zone/eastern_plaguelands/the_scarlet_enclave.cpp
+++ b/src/bindings/scripts/scripts/zone/eastern_plaguelands/the_scarlet_enclave.cpp
@@ -484,6 +484,7 @@ CreatureAI* GetAI_npc_a_special_surprise(Creature* pCreature)
#define SPELL_SOUL_PRISON_CHAIN_SELF 54612
#define SPELL_SOUL_PRISON_CHAIN 54613
+#define SPELL_DK_INITIATE_VISUAL 51519
#define SPELL_ICY_TOUCH 52372
#define SPELL_PLAGUE_STRIKE 52373
@@ -541,54 +542,6 @@ enum initiate_phase
Attacking
};
-float modelid_dk_armor[20] =
-{
- 25432, // bloodelf female
- 25422, // bloodelf male
- 25412, // draenei female
- 25420, // draenei male
- 25406, // dwarf female
- 25414, // dwarf male
- 25438, // forsaken female
- 25426, // forsaken male
- 25408, // gnome female
- 25426, // gnome male
- 25404, // human female
- 25375, // human male
- 25410, // nightelf female
- 25418, // nightelf male
- 25436, // orc female
- 25424, // orc male
- 25440, // tauren female
- 25430, // tauren male
- 25434, // troll female
- 25428 // troll male
-};
-
-float modelid_dk_unworthy[20] =
-{
- 25369, // bloodelf female
- 25373, // bloodelf male
- 25363, // draenei female
- 25357, // draenei male
- 25361, // dwarf female
- 25356, // dwarf male
- 25372, // forsaken female
- 25367, // forsaken male
- 25362, // gnome female
- 25359, // gnome male
- 25355, // human female
- 25354, // human male
- 25360, // nightelf female
- 25358, // nightelf male
- 25368, // orc female
- 25364, // orc male
- 25371, // tauren female
- 25366, // tauren male
- 25370, // troll female
- 25365 // troll male
-};
-
struct TRINITY_DLL_DECL npc_unworthy_initiateAI : public ScriptedAI
{
npc_unworthy_initiateAI(Creature *c) : ScriptedAI(c)
@@ -637,22 +590,6 @@ struct TRINITY_DLL_DECL npc_unworthy_initiateAI : public ScriptedAI
CAST_PLR(killer)->KilledMonsterCredit(29519,m_creature->GetGUID());
}
- void AddEquipp()
- {
- int model_counter = 0;
- for(uint8 i = 0; i< 20; i++)
- {
- if(m_creature->GetDisplayId() == modelid_dk_unworthy[i])
- {
- model_counter = i;
- break;
- }
- }
-
- m_creature->SetDisplayId(modelid_dk_armor[model_counter]);
- m_creature->LoadEquipment(m_creature->GetEquipmentId());
- }
-
void MovementInform(uint32 type, uint32 id)
{
if(type != POINT_MOTION_TYPE)
@@ -661,7 +598,7 @@ struct TRINITY_DLL_DECL npc_unworthy_initiateAI : public ScriptedAI
if(id == 1)
{
wait_timer = 5000;
- AddEquipp();
+ m_creature->CastSpell(m_creature,SPELL_DK_INITIATE_VISUAL,true);
if(Unit* starter = Unit::GetUnit((*m_creature),event_starter))
DoScriptText(say_event_attack[rand()%9],m_creature,starter);
@@ -1166,7 +1103,7 @@ struct TRINITY_DLL_DECL npc_dkc1_gothikAI : public ScriptedAI
{
if(CAST_PLR(owner)->GetQuestStatus(12698) == QUEST_STATUS_INCOMPLETE)
{
- CAST_PLR(owner)->KilledMonsterCredit(28845, me->GetGUID());
+ DoCast(owner, 52517, true);
who->setDeathState(DEAD);
}
}
diff --git a/src/bindings/scripts/scripts/zone/gruuls_lair/boss_gruul.cpp b/src/bindings/scripts/scripts/zone/gruuls_lair/boss_gruul.cpp
index a0b4f632c42..26520fc16df 100644
--- a/src/bindings/scripts/scripts/zone/gruuls_lair/boss_gruul.cpp
+++ b/src/bindings/scripts/scripts/zone/gruuls_lair/boss_gruul.cpp
@@ -80,9 +80,6 @@ struct TRINITY_DLL_DECL boss_gruulAI : public ScriptedAI
if (pInstance)
pInstance->SetData(DATA_GRUULEVENT, NOT_STARTED);
-
- m_creature->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true);
- m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, true);
}
void EnterCombat(Unit *who)
diff --git a/src/bindings/scripts/scripts/zone/hellfire_citadel/shattered_halls/boss_warbringer_omrogg.cpp b/src/bindings/scripts/scripts/zone/hellfire_citadel/shattered_halls/boss_warbringer_omrogg.cpp
index 219256f4da8..3bb9ccbd0e2 100644
--- a/src/bindings/scripts/scripts/zone/hellfire_citadel/shattered_halls/boss_warbringer_omrogg.cpp
+++ b/src/bindings/scripts/scripts/zone/hellfire_citadel/shattered_halls/boss_warbringer_omrogg.cpp
@@ -191,9 +191,6 @@ struct TRINITY_DLL_DECL boss_warbringer_omroggAI : public ScriptedAI
ThunderClap_Timer = 15000;
ResetThreat_Timer = 30000;
- m_creature->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true);
- m_creature->ApplySpellImmune(1, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, true);
-
if (pInstance)
pInstance->SetData(TYPE_OMROGG, NOT_STARTED); //End boss can use this later. O'mrogg must be defeated(DONE) or he will come to aid.
}
diff --git a/src/bindings/scripts/scripts/zone/isle_of_queldanas/isle_of_queldanas.cpp b/src/bindings/scripts/scripts/zone/isle_of_queldanas/isle_of_queldanas.cpp
index d1c90c709d0..3dd7c83a30f 100644
--- a/src/bindings/scripts/scripts/zone/isle_of_queldanas/isle_of_queldanas.cpp
+++ b/src/bindings/scripts/scripts/zone/isle_of_queldanas/isle_of_queldanas.cpp
@@ -114,7 +114,7 @@ struct TRINITY_DLL_DECL npc_greengill_slaveAI : public ScriptedAI
{
Unit* plr = Unit::GetUnit((*m_creature), PlayerGUID);
if(plr && CAST_PLR(plr)->GetQuestStatus(QUESTG) == QUEST_STATUS_INCOMPLETE)
- CAST_PLR(plr)->KilledMonsterCredit(25086, m_creature->GetGUID());
+ DoCast(plr, 45110, true);
}
DoCast(m_creature, ENRAGE);
Unit* Myrmidon = me->FindNearestCreature(DM, 70);
diff --git a/src/bindings/scripts/scripts/zone/karazhan/boss_curator.cpp b/src/bindings/scripts/scripts/zone/karazhan/boss_curator.cpp
index 4906f02281a..9fb9d2226bd 100644
--- a/src/bindings/scripts/scripts/zone/karazhan/boss_curator.cpp
+++ b/src/bindings/scripts/scripts/zone/karazhan/boss_curator.cpp
@@ -131,8 +131,6 @@ struct TRINITY_DLL_DECL boss_curatorAI : public ScriptedAI
{
AstralFlare->CastSpell(AstralFlare, SPELL_ASTRAL_FLARE_PASSIVE, false);
AstralFlare->AI()->AttackStart(target);
- AstralFlare->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true);
- AstralFlare->ApplySpellImmune(0, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, true);
}
//Reduce Mana by 10% of max health
diff --git a/src/bindings/scripts/scripts/zone/karazhan/boss_midnight.cpp b/src/bindings/scripts/scripts/zone/karazhan/boss_midnight.cpp
index ab40ad745ef..7877dcbe686 100644
--- a/src/bindings/scripts/scripts/zone/karazhan/boss_midnight.cpp
+++ b/src/bindings/scripts/scripts/zone/karazhan/boss_midnight.cpp
@@ -185,9 +185,6 @@ struct TRINITY_DLL_DECL boss_attumenAI : public ScriptedAI
void Reset()
{
ResetTimer = 2000;
-
- m_creature->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true);
- m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, true);
}
void EnterCombat(Unit* who) {}
diff --git a/src/bindings/scripts/scripts/zone/magisters_terrace/magisters_terrace.cpp b/src/bindings/scripts/scripts/zone/magisters_terrace/magisters_terrace.cpp
new file mode 100644
index 00000000000..18694fe15e6
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/magisters_terrace/magisters_terrace.cpp
@@ -0,0 +1,145 @@
+/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* ScriptData
+SDName: Magisters_Terrace
+SD%Complete: 100
+SDComment: Quest support: 11490(post-event)
+SDCategory: Magisters Terrace
+EndScriptData */
+
+/* ContentData
+npc_kalecgos
+EndContentData */
+
+#include "precompiled.h"
+
+/*######
+## npc_kalecgos
+######*/
+
+enum
+{
+ SPELL_TRANSFORM_TO_KAEL = 44670,
+ NPC_KAEL = 24848, //human form entry
+ POINT_ID_LAND = 1
+};
+
+const float afKaelLandPoint[] = {225.045, -276.236, -5.434};
+
+#define GOSSIP_ITEM_KAEL_1 "Who are you?"
+#define GOSSIP_ITEM_KAEL_2 "What can we do to assist you?"
+#define GOSSIP_ITEM_KAEL_3 "What brings you to the Sunwell?"
+#define GOSSIP_ITEM_KAEL_4 "You're not alone here?"
+#define GOSSIP_ITEM_KAEL_5 "What would Kil'jaeden want with a mortal woman?"
+
+// This is friendly keal that appear after used Orb.
+// If we assume DB handle summon, summon appear somewhere outside the platform where Orb is
+struct TRINITY_DLL_DECL npc_kalecgosAI : public ScriptedAI
+{
+ npc_kalecgosAI(Creature* pCreature) : ScriptedAI(pCreature) { }
+
+ uint32 m_uiTransformTimer;
+
+ void Reset()
+ {
+ m_uiTransformTimer = 0;
+
+ // we must assume he appear as dragon somewhere outside the platform of orb, and then move directly to here
+ if (m_creature->GetEntry() != NPC_KAEL)
+ m_creature->GetMotionMaster()->MovePoint(POINT_ID_LAND, afKaelLandPoint[0], afKaelLandPoint[1], afKaelLandPoint[2]);
+ }
+
+ void MovementInform(uint32 uiType, uint32 uiPointId)
+ {
+ if (uiType != POINT_MOTION_TYPE)
+ return;
+
+ if (uiPointId == POINT_ID_LAND)
+ m_uiTransformTimer = MINUTE*IN_MILISECONDS;
+ }
+
+ void UpdateAI(const uint32 uiDiff)
+ {
+ if (m_uiTransformTimer)
+ {
+ if (m_uiTransformTimer < uiDiff)
+ {
+ // Transform and update entry, now ready for quest/read gossip
+ m_creature->CastSpell(m_creature,SPELL_TRANSFORM_TO_KAEL,false);
+ m_creature->UpdateEntry(NPC_KAEL);
+
+ m_uiTransformTimer = 0;
+ }else m_uiTransformTimer -= uiDiff;
+ }
+ }
+};
+
+CreatureAI* GetAI_npc_kalecgos(Creature* pCreature)
+{
+ return new npc_kalecgosAI(pCreature);
+}
+
+bool GossipHello_npc_kalecgos(Player* pPlayer, Creature* pCreature)
+{
+ if (pCreature->isQuestGiver())
+ pPlayer->PrepareQuestMenu(pCreature->GetGUID());
+
+ pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KAEL_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
+ pPlayer->SEND_GOSSIP_MENU(12498, pCreature->GetGUID());
+
+ return true;
+}
+
+bool GossipSelect_npc_kalecgos(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction)
+{
+ switch(uiAction)
+ {
+ case GOSSIP_ACTION_INFO_DEF:
+ pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KAEL_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
+ pPlayer->SEND_GOSSIP_MENU(12500, pCreature->GetGUID());
+ break;
+ case GOSSIP_ACTION_INFO_DEF+1:
+ pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KAEL_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
+ pPlayer->SEND_GOSSIP_MENU(12502, pCreature->GetGUID());
+ break;
+ case GOSSIP_ACTION_INFO_DEF+2:
+ pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KAEL_4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3);
+ pPlayer->SEND_GOSSIP_MENU(12606, pCreature->GetGUID());
+ break;
+ case GOSSIP_ACTION_INFO_DEF+3:
+ pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KAEL_5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4);
+ pPlayer->SEND_GOSSIP_MENU(12607, pCreature->GetGUID());
+ break;
+ case GOSSIP_ACTION_INFO_DEF+4:
+ pPlayer->SEND_GOSSIP_MENU(12608, pCreature->GetGUID());
+ break;
+ }
+
+ return true;
+}
+
+void AddSC_magisters_terrace()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name = "npc_kalecgos";
+ newscript->GetAI = &GetAI_npc_kalecgos;
+ newscript->pGossipHello = &GossipHello_npc_kalecgos;
+ newscript->pGossipSelect = &GossipSelect_npc_kalecgos;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/obsidian_sanctum/boss_sartharion.cpp b/src/bindings/scripts/scripts/zone/obsidian_sanctum/boss_sartharion.cpp
index c7034655b11..3fc3a2ff6de 100644
--- a/src/bindings/scripts/scripts/zone/obsidian_sanctum/boss_sartharion.cpp
+++ b/src/bindings/scripts/scripts/zone/obsidian_sanctum/boss_sartharion.cpp
@@ -1,272 +1,1073 @@
-/* Script Data Start
-SDName: Boss sartharion
-SDAuthor: LordVanMartin
-SD%Complete:
-SDComment:
-SDCategory:
-Script Data End */
-
-/*** SQL START ***
-update creature_template set scriptname = '' where entry = '';
-*** SQL END ***/
+/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* ScriptData
+SDName: Boss Sartharion
+SD%Complete: 70%
+SDComment: Flame wave, achievement and portal events need to be implemented
+SDCategory: Obsidian Sanctum
+EndScriptData */
+
#include "precompiled.h"
+#include "def_obsidian_sanctum.h"
+
+enum
+{
+ //Sartharion Yell
+ SAY_SARTHARION_AGGRO = -1615018,
+ SAY_SARTHARION_BERSERK = -1615019,
+ SAY_SARTHARION_BREATH = -1615020,
+ SAY_SARTHARION_CALL_SHADRON = -1615021,
+ SAY_SARTHARION_CALL_TENEBRON = -1615022,
+ SAY_SARTHARION_CALL_VESPERON = -1615023,
+ SAY_SARTHARION_DEATH = -1615024,
+ SAY_SARTHARION_SPECIAL_1 = -1615025,
+ SAY_SARTHARION_SPECIAL_2 = -1615026,
+ SAY_SARTHARION_SPECIAL_3 = -1615027,
+ SAY_SARTHARION_SPECIAL_4 = -1615028,
+ SAY_SARTHARION_SLAY_1 = -1615029,
+ SAY_SARTHARION_SLAY_2 = -1615030,
+ SAY_SARTHARION_SLAY_3 = -1615031,
+
+ WHISPER_LAVA_CHURN = -1615032,
+
+ WHISPER_SHADRON_DICIPLE = -1615008,
+ WHISPER_VESPERON_DICIPLE = -1615041,
+ WHISPER_HATCH_EGGS = -1615017,
+ WHISPER_OPEN_PORTAL = -1615042, // whisper, shared by two dragons
+
+ //Sartharion Spells
+ SPELL_BERSERK = 61632, // Increases the caster's attack speed by 150% and all damage it deals by 500% for 5 min.
+ SPELL_CLEAVE = 56909, // Inflicts 35% weapon damage to an enemy and its nearest allies, affecting up to 10 targets.
+ SPELL_FLAME_BREATH = 56908, // Inflicts 8750 to 11250 Fire damage to enemies in a cone in front of the caster.
+ SPELL_FLAME_BREATH_H = 58956, // Inflicts 10938 to 14062 Fire damage to enemies in a cone in front of the caster.
+ SPELL_TAIL_LASH = 56910, // A sweeping tail strike hits all enemies behind the caster, inflicting 3063 to 3937 damage and stunning them for 2 sec.
+ SPELL_TAIL_LASH_H = 58957, // A sweeping tail strike hits all enemies behind the caster, inflicting 4375 to 5625 damage and stunning them for 2 sec.
+ SPELL_WILL_OF_SARTHARION = 61254, // Sartharion's presence bolsters the resolve of the Twilight Drakes, increasing their total health by 25%. This effect also increases Sartharion's health by 25%.
+ SPELL_LAVA_STRIKE = 57571, // (Real spell casted should be 57578) 57571 then trigger visual missile, then summon Lava Blaze on impact(spell 57572)
+ SPELL_TWILIGHT_REVENGE = 60639,
+
+ SPELL_TWILIGHT_SHIFT_ENTER = 57620, // enter phase. Player get this when click GO
+ SPELL_TWILIGHT_SHIFT_REMOVAL = 61187, // leave phase
+ SPELL_TWILIGHT_SHIFT_REMOVAL_ALL = 61190, // leave phase (probably version to make all leave)
+
+ //Mini bosses common spells
+ SPELL_TWILIGHT_RESIDUE = 61885, // makes immune to shadow damage, applied when leave phase
+
+ //Miniboses (Vesperon, Shadron, Tenebron)
+ SPELL_SHADOW_BREATH_H = 59126, // Inflicts 8788 to 10212 Fire damage to enemies in a cone in front of the caster.
+ SPELL_SHADOW_BREATH = 57570, // Inflicts 6938 to 8062 Fire damage to enemies in a cone in front of the caster.
+
+ SPELL_SHADOW_FISSURE_H = 59127, // Deals 9488 to 13512 Shadow damage to any enemy within the Shadow fissure after 5 sec.
+ SPELL_SHADOW_FISSURE = 57579, // Deals 6188 to 8812 Shadow damage to any enemy within the Shadow fissure after 5 sec.
+
+ //Vesperon
+ //In portal is a disciple, when disciple killed remove Power_of_vesperon, portal open multiple times
+ NPC_ACOLYTE_OF_VESPERON = 31219, // Acolyte of Vesperon
+ SPELL_POWER_OF_VESPERON = 61251, // Vesperon's presence decreases the maximum health of all enemies by 25%.
+ SPELL_TWILIGHT_TORMENT_VESP = 57948, // (Shadow only) trigger 57935 then 57988
+ SPELL_TWILIGHT_TORMENT_VESP_ACO = 58853, // (Fire and Shadow) trigger 58835 then 57988
+
+ //Shadron
+ //In portal is a disciple, when disciple killed remove Power_of_vesperon, portal open multiple times
+ NPC_ACOLYTE_OF_SHADRON = 31218, // Acolyte of Shadron
+ SPELL_POWER_OF_SHADRON = 58105, // Shadron's presence increases Fire damage taken by all enemies by 100%.
+ SPELL_GIFT_OF_TWILIGTH_SHA = 57835, // TARGET_SCRIPT shadron
+ SPELL_GIFT_OF_TWILIGTH_SAR = 58766, // TARGET_SCRIPT sartharion
+
+ //Tenebron
+ //in the portal spawns 6 eggs, if not killed in time (approx. 20s) they will hatch, whelps can cast 60708
+ SPELL_POWER_OF_TENEBRON = 61248, // Tenebron's presence increases Shadow damage taken by all enemies by 100%.
+ //Tenebron, dummy spell
+ SPELL_SUMMON_TWILIGHT_WHELP = 58035, // doesn't work, will spawn NPC_TWILIGHT_WHELP
+ SPELL_SUMMON_SARTHARION_TWILIGHT_WHELP = 58826, // doesn't work, will spawn NPC_SHARTHARION_TWILIGHT_WHELP
+
+ SPELL_HATCH_EGGS_H = 59189,
+ SPELL_HATCH_EGGS = 58542,
+ SPELL_HATCH_EGGS_EFFECT_H = 59190,
+ SPELL_HATCH_EGGS_EFFECT = 58685,
+
+ //Whelps
+ NPC_TWILIGHT_WHELP = 30890,
+ NPC_SHARTHARION_TWILIGHT_WHELP = 31214,
+ SPELL_FADE_ARMOR = 60708, // Reduces the armor of an enemy by 1500 for 15s
+
+ //flame tsunami
+ SPELL_FLAME_TSUNAMI = 57494, // the visual dummy
+ SPELL_FLAME_TSUNAMI_LEAP = 60241, // SPELL_EFFECT_138 some leap effect, causing caster to move in direction
+ SPELL_FLAME_TSUNAMI_DMG_AURA = 57492, // periodic damage, npc has this aura
+
+ NPC_FLAME_TSUNAMI = 30616, // for the flame waves
+ NPC_LAVA_BLAZE = 30643, // adds spawning from flame strike
+
+ //using these custom points for dragons start and end
+ POINT_ID_INIT = 100,
+ POINT_ID_LAND = 200
+};
+
+//POS_SARTHARION_X = 3246.57,
+//POS_SARTHARION_Y = 551.263,
+
+struct Waypoint
+{
+ float m_fX, m_fY, m_fZ;
+};
-//Sartharion Spells
-#define SPELL_BERSERK 61632 // Increases the caster's attack speed by 150% and all damage it deals by 500% for 5 min.
-#define SPELL_CLEAVE 56909 // Inflicts 35% weapon damage to an enemy and its nearest allies, affecting up to 10 targets.
-#define SPELL_FLAME_BREATH_N 56908 // Inflicts 8750 to 11250 Fire damage to enemies in a cone in front of the caster.
-#define SPELL_FLAME_BREATH_H 58956 // Inflicts 10938 to 14062 Fire damage to enemies in a cone in front of the caster.
-#define SPELL_TAIL_LASH_N 56910 // A sweeping tail strike hits all enemies behind the caster, inflicting 3063 to 3937 damage and stunning them for 2 sec.
-#define SPELL_TAIL_LASH_H 58957 // A sweeping tail strike hits all enemies behind the caster, inflicting 4375 to 5625 damage and stunning them for 2 sec.
-#define SPELL_WILL_OF_SARTHARION 61254 // Sartharion's presence bolsters the resolve of the Twilight Drakes, increasing their total health by 25%. This effect also increases Sartharion's health by 25%.
-#define SPELL_POWER_OF_SARTHARION 61254 //Shadron's presence increases Fire damage taken by all enemies by 100%.
-
-//Sartharion Yell
-#define SAY_SARTHARION_AGGRO -1615016
-#define SAY_SARTHARION_BERSERK -1615017
-#define SAY_SARTHARION_BREATH -1615018
-#define SAY_SARTHARION_CALL_SHADRON -1615019
-#define SAY_SARTHARION_CALL_TENEBRON -1615020
-#define SAY_SARTHARION_CALL_VESPERON -1615021
-#define SAY_SARTHARION_DEATH -1615022
-#define SAY_SARTHARION_SPECIAL_1 -1615023
-#define SAY_SARTHARION_SPECIAL_2 -1615024
-#define SAY_SARTHARION_SPECIAL_3 -1615025
-#define SAY_SARTHARION_SPECIAL_4 -1615026
-#define SAY_SARTHARION_SLAY_1 -1615027
-#define SAY_SARTHARION_SLAY_2 -1615028
-#define SAY_SARTHARION_SLAY_3 -1615029
-
-//Miniboses (Vesperon, Shadron, Tenebron)
-#define SPELL_SHADOW_BREATH_H 59126 //Inflicts 8788 to 10212 Fire damage to enemies in a cone in front of the caster.
-#define SPELL_SHADOW_BREATH_N 57570 //Inflicts 6938 to 8062 Fire damage to enemies in a cone in front of the caster.
-//TAIL LASH the same as Sartharion's
-#define SPELL_SHADOW_FISSURE_H 59127 //Deals 9488 to 13512 Shadow damage to any enemy within the Shadow fissure after 5 sec.
-#define SPELL_SHADOW_FISSURE_N 57579 //Deals 6188 to 8812 Shadow damage to any enemy within the Shadow fissure after 5 sec.
-
-//Vesperon
-#define MINIBOSS_VESPERON 30449 //npc 30449 //In portal is a disciple, when disciple killed remove Power_of_vesperon, portal spawns multiple times
-#define BUFF_POWER_OF_VESPERON 61251 //Vesperon's presence decreases the maximum health of all enemies by 25%.
-
-//Shadron
-#define MINIBOSS_SHADRON 30451 //npc 30451 //In portal is a disciple, when disciple killed remove Power_of_vesperon, portal spawns multiple times
-#define BUFF_POWER_OF_SHADRON 58105 //Shadron's presence increases Fire damage taken by all enemies by 100%.
-
-//Tenebron
-#define MINIBOSS_TENEBRON 30452 //npc 30452 //in the portal spawns 6 eggs, if not killed in time (approx. 20s) they will hatch, whelps can cast 60708
-#define BUFF_POWER_OF_TENEBRON 61248 //Tenebron's presence increases Shadow damage taken by all enemies by 100%.
-
-//Minibosses common spells
-#define SPELL_SHADOW_BREATH_N 57570
-#define SPELL_SHADOW_BREATH_H 59126
-#define SPELL_SHADOW_FISSURE_N 57579
-#define SPELL_SHADOW_FISSURE_H 59127
-#define SPELL_TWILIGHT_REVENGE 60639
-
-//Tenebron, dummy spell
-#define SPELL_HATCH_EGGS 58793
-
-//Whelps
-#define TWILIGHT_WHELP 30890 //npc 30890
-#define SHARTHARION_TWILIGHT_WHELP 31214 //npc 31214
-#define SPELL_FADE_ARMOR 60708 //Reduces the armor of an enemy by 1500 for 15s
-
-/*Summons a portal, which all DPS and one healer should go through and proceed to kill all eggs. After about 20 seconds these eggs will hatch into whelplings with 60k health. Whelplings that hatched should be picked up by a tank and killed.
-Hatch Eggs Tenebron summons a portal in which eggs are spawned. After about 20s the eggs hatches into Whelps (156,396 hp - amount of whelps determined by Normal or Heroic mode) that do Fade Armor. */
+//each dragons special points. First where fly to before connect to connon, second where land point is.
+Waypoint m_aTene[]=
+{
+ {3212.854, 575.597, 109.856}, //init
+ {3246.425, 565.367, 61.249} //end
+};
+
+Waypoint m_aShad[]=
+{
+ {3293.238, 472.223, 106.968},
+ {3271.669, 526.907, 61.931}
+};
+
+Waypoint m_aVesp[]=
+{
+ {3193.310, 472.861, 102.697},
+ {3227.268, 533.238, 59.995}
+};
+
+//points around raid "isle", counter clockwise. should probably be adjusted to be more alike
+Waypoint m_aDragonCommon[]=
+{
+ {3214.012, 468.932, 98.652},
+ {3244.950, 468.427, 98.652},
+ {3283.520, 496.869, 98.652},
+ {3287.316, 555.875, 98.652},
+ {3250.479, 585.827, 98.652},
+ {3209.969, 566.523, 98.652}
+};
+
+/*######
+## Boss Sartharion
+######*/
struct TRINITY_DLL_DECL boss_sartharionAI : public ScriptedAI
{
- boss_sartharionAI(Creature *c) : ScriptedAI(c) {}
+ boss_sartharionAI(Creature* pCreature) : ScriptedAI(pCreature)
+ {
+ m_pInstance = ((ScriptedInstance*)pCreature->GetInstanceData());
+ m_bIsHeroic = pCreature->GetMap()->IsHeroic();
+ }
- bool berserk;
+ ScriptedInstance* m_pInstance;
+ bool m_bIsHeroic;
- void Reset()
+ bool m_bIsBerserk;
+ uint32 m_uiEnrageTimer;
+
+ uint32 m_uiTenebronTimer;
+ uint32 m_uiShadronTimer;
+ uint32 m_uiVesperonTimer;
+
+ uint32 m_uiFlameTsunamiTimer;
+ uint32 m_uiFlameBreathTimer;
+ uint32 m_uiTailSweepTimer;
+ uint32 m_uiCleaveTimer;
+ uint32 m_uiLavaStrikeTimer;
+
+ bool m_bHasCalledTenebron;
+ bool m_bHasCalledShadron;
+ bool m_bHasCalledVesperon;
+
+ void Reset()
+ {
+ m_bIsBerserk = false;
+ m_uiEnrageTimer = MINUTE*15*IN_MILISECONDS;
+
+ m_uiTenebronTimer = 30000;
+ m_uiShadronTimer = 75000;
+ m_uiVesperonTimer = 120000;
+
+ m_uiFlameTsunamiTimer = 30000;
+ m_uiFlameBreathTimer = 20000;
+ m_uiTailSweepTimer = 20000;
+ m_uiCleaveTimer = 7000;
+ m_uiLavaStrikeTimer = 5000;
+
+ m_bHasCalledTenebron = false;
+ m_bHasCalledShadron = false;
+ m_bHasCalledVesperon = false;
+
+ if (m_pInstance)
+ {
+ if (!m_creature->isAlive())
+ return;
+
+ m_pInstance->SetData(TYPE_SARTHARION_EVENT, NOT_STARTED);
+
+ //do dragons actually respawn like this? Commented for now, until confirmed.
+
+ /*if (Unit* Temp1 = Unit::GetUnit((*m_creature),m_pInstance->GetData64(DATA_TENEBRON)))
+ if (Temp1->isDead())
+ ((Creature*)Temp1)->Respawn();
+
+ if (Unit* Temp2 = Unit::GetUnit((*m_creature),m_pInstance->GetData64(DATA_SHADRON)))
+ if (Temp2->isDead())
+ ((Creature*)Temp2)->Respawn();
+
+ if (Unit* Temp3 = Unit::GetUnit((*m_creature),m_pInstance->GetData64(DATA_VESPERON)))
+ if (Temp3->isDead())
+ ((Creature*)Temp3)->Respawn();*/
+ }
+
+ if (m_creature->HasAura(SPELL_TWILIGHT_REVENGE))
+ m_creature->RemoveAurasDueToSpell(SPELL_TWILIGHT_REVENGE);
+ }
+
+ void Aggro(Unit* pWho)
{
- berserk = false;
+ DoScriptText(SAY_SARTHARION_AGGRO,m_creature);
+ DoZoneInCombat();
+
+ if (m_pInstance)
+ m_pInstance->SetData(TYPE_SARTHARION_EVENT, IN_PROGRESS);
+
+ FetchDragons();
}
- void EnterCombat(Unit* who)
+
+ void JustDied(Unit* pKiller)
{
DoScriptText(SAY_SARTHARION_DEATH,m_creature);
+
+ if (m_pInstance)
+ m_pInstance->SetData(TYPE_SARTHARION_EVENT, DONE);
+ }
+
+ void KilledUnit(Unit* pVictim)
+ {
+ switch(rand()%3)
+ {
+ case 0: DoScriptText(SAY_SARTHARION_SLAY_1, m_creature); break;
+ case 1: DoScriptText(SAY_SARTHARION_SLAY_2, m_creature); break;
+ case 2: DoScriptText(SAY_SARTHARION_SLAY_3, m_creature); break;
+ }
+ }
+
+ void FetchDragons()
+ {
+ Unit* pTene = Unit::GetUnit(*m_creature,m_pInstance->GetData64(DATA_TENEBRON));
+ Unit* pShad = Unit::GetUnit(*m_creature,m_pInstance->GetData64(DATA_SHADRON));
+ Unit* pVesp = Unit::GetUnit(*m_creature,m_pInstance->GetData64(DATA_VESPERON));
+
+ if (pTene && pTene->isAlive() && !pTene->getVictim())
+ {
+ pTene->GetMotionMaster()->MovePoint(POINT_ID_INIT, m_aTene[0].m_fX, m_aTene[0].m_fY, m_aTene[0].m_fZ);
+
+ if (!pTene->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
+ pTene->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+ }
+
+ if (pShad && pShad->isAlive() && !pShad->getVictim())
+ {
+ pShad->GetMotionMaster()->MovePoint(POINT_ID_INIT, m_aShad[0].m_fX, m_aShad[0].m_fY, m_aShad[0].m_fZ);
+
+ if (!pShad->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
+ pShad->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+ }
+
+ if (pVesp && pVesp->isAlive() && !pVesp->getVictim())
+ {
+ pVesp->GetMotionMaster()->MovePoint(POINT_ID_INIT, m_aVesp[0].m_fX, m_aVesp[0].m_fY, m_aVesp[0].m_fZ);
+
+ if (!pVesp->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
+ pVesp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+ }
+ }
+
+ void CallDragon(uint32 uiDataId)
+ {
+ if (m_pInstance)
+ {
+ Creature* pTemp = (Creature*)Unit::GetUnit((*m_creature),m_pInstance->GetData64(uiDataId));
+
+ if (pTemp && pTemp->isAlive() && !pTemp->getVictim())
+ {
+ if (pTemp->HasUnitMovementFlag(MOVEMENTFLAG_WALK_MODE))
+ pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
+
+ if (pTemp->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
+ pTemp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+
+ int32 iTextId = 0;
+
+ switch(pTemp->GetEntry())
+ {
+ case NPC_TENEBRON:
+ iTextId = SAY_SARTHARION_CALL_TENEBRON;
+ pTemp->GetMotionMaster()->MovePoint(POINT_ID_LAND, m_aTene[1].m_fX, m_aTene[1].m_fY, m_aTene[1].m_fZ);
+ break;
+ case NPC_SHADRON:
+ iTextId = SAY_SARTHARION_CALL_SHADRON;
+ pTemp->GetMotionMaster()->MovePoint(POINT_ID_LAND, m_aShad[1].m_fX, m_aShad[1].m_fY, m_aShad[1].m_fZ);
+ break;
+ case NPC_VESPERON:
+ iTextId = SAY_SARTHARION_CALL_VESPERON;
+ pTemp->GetMotionMaster()->MovePoint(POINT_ID_LAND, m_aVesp[1].m_fX, m_aVesp[1].m_fY, m_aVesp[1].m_fZ);
+ break;
+ }
+
+ DoScriptText(iTextId, m_creature);
+ }
+ }
+ }
+
+ void SendFlameTsunami()
+ {
+ Map* pMap = m_creature->GetMap();
+
+ if (pMap && pMap->IsDungeon())
+ {
+ Map::PlayerList const &PlayerList = pMap->GetPlayers();
+
+ if (!PlayerList.isEmpty())
+ {
+ for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
+ {
+ if (i->getSource()->isAlive())
+ DoScriptText(WHISPER_LAVA_CHURN,m_creature,i->getSource());
+ }
+ }
+ }
}
- void AttackStart(Unit* who) {}
- void MoveInLineOfSight(Unit* who) {}
- void UpdateAI(const uint32 diff)
+
+ void UpdateAI(const uint32 uiDiff)
{
//Return since we have no target
- if(!UpdateVictim())
+ if (!UpdateVictim())
return;
- if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) <= 10)
+ //reset if out of his platform, must find better/faster way to do this
+ //if (m_creature->GetDistance2d(POS_SARTHARION_X, POS_SARTHARION_Y) > 55)
+ //{
+ //EnterEvadeMode();
+ //return;
+ //}
+
+ if (!m_bIsBerserk && (m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) <= 10)
{
- if(!berserk){
- DoCast(m_creature,SPELL_BERSERK);
- berserk = true;
- }
+ DoScriptText(SAY_SARTHARION_BERSERK,m_creature);
+ DoCast(m_creature,SPELL_BERSERK);
+ m_bIsBerserk = true;
+ }
+
+ // enrage
+ if (m_uiEnrageTimer)
+ {
+ if (m_uiEnrageTimer < uiDiff)
+ {
+ DoCast(m_creature, SPELL_WILL_OF_SARTHARION);
+ m_uiEnrageTimer = 0;
+ }else m_uiEnrageTimer -= uiDiff;
}
+ // flame tsunami
+ if (m_uiFlameTsunamiTimer < uiDiff)
+ {
+ SendFlameTsunami();
+ m_uiFlameTsunamiTimer = 30000;
+ }else m_uiFlameTsunamiTimer -= uiDiff;
+
+ // flame breath
+ if (m_uiFlameBreathTimer < uiDiff)
+ {
+ DoScriptText(SAY_SARTHARION_BREATH, m_creature);
+ DoCast(m_creature->getVictim(), m_bIsHeroic ? SPELL_FLAME_BREATH_H : SPELL_FLAME_BREATH);
+ m_uiFlameBreathTimer = 25000 + rand()%10000;
+ }else m_uiFlameBreathTimer -= uiDiff;
+
+ // Tail Sweep
+ if (m_uiTailSweepTimer < uiDiff)
+ {
+ DoCast(m_creature->getVictim(), m_bIsHeroic ? SPELL_TAIL_LASH_H : SPELL_TAIL_LASH);
+ m_uiTailSweepTimer = 15000 + rand()%5000;
+ }else m_uiTailSweepTimer -= uiDiff;
+
+ // Cleave
+ if (m_uiCleaveTimer < uiDiff)
+ {
+ DoCast(m_creature->getVictim(), SPELL_CLEAVE);
+ m_uiCleaveTimer = 7000 + rand()%3000;
+ }else m_uiCleaveTimer -= uiDiff;
+
+ // Lavas Strike
+ if (m_uiLavaStrikeTimer < uiDiff)
+ {
+ if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
+ {
+ DoCast(pTarget, SPELL_LAVA_STRIKE);
+
+ switch(rand()%15)
+ {
+ case 0: DoScriptText(SAY_SARTHARION_SPECIAL_1, m_creature); break;
+ case 1: DoScriptText(SAY_SARTHARION_SPECIAL_2, m_creature); break;
+ case 2: DoScriptText(SAY_SARTHARION_SPECIAL_3, m_creature); break;
+ }
+ }
+ m_uiLavaStrikeTimer = 5000 + rand()%15000;
+ }else m_uiLavaStrikeTimer -= uiDiff;
+
+ // call tenebron
+ if (!m_bHasCalledTenebron && m_uiTenebronTimer < uiDiff)
+ {
+ CallDragon(DATA_TENEBRON);
+ m_bHasCalledTenebron = true;
+ }else m_uiTenebronTimer -= uiDiff;
+
+ // call shadron
+ if (!m_bHasCalledShadron && m_uiShadronTimer < uiDiff)
+ {
+ CallDragon(DATA_SHADRON);
+ m_bHasCalledShadron = true;
+ }else m_uiShadronTimer -= uiDiff;
+
+ // call vesperon
+ if (!m_bHasCalledVesperon && m_uiVesperonTimer < uiDiff)
+ {
+ CallDragon(DATA_VESPERON);
+ m_bHasCalledVesperon = true;
+ }else m_uiVesperonTimer -= uiDiff;
+
DoMeleeAttackIfReady();
}
- void JustDied(Unit* killer)
+};
+
+CreatureAI* GetAI_boss_sartharion(Creature* pCreature)
+{
+ return new boss_sartharionAI(pCreature);
+}
+
+enum TeneText
+{
+ SAY_TENEBRON_AGGRO = -1615009,
+ SAY_TENEBRON_SLAY_1 = -1615010,
+ SAY_TENEBRON_SLAY_2 = -1615011,
+ SAY_TENEBRON_DEATH = -1615012,
+ SAY_TENEBRON_BREATH = -1615013,
+ SAY_TENEBRON_RESPOND = -1615014,
+ SAY_TENEBRON_SPECIAL_1 = -1615015,
+ SAY_TENEBRON_SPECIAL_2 = -1615016
+};
+
+enum ShadText
+{
+ SAY_SHADRON_AGGRO = -1615000,
+ SAY_SHADRON_SLAY_1 = -1615001,
+ SAY_SHADRON_SLAY_2 = -1615002,
+ SAY_SHADRON_DEATH = -1615003,
+ SAY_SHADRON_BREATH = -1615004,
+ SAY_SHADRON_RESPOND = -1615005,
+ SAY_SHADRON_SPECIAL_1 = -1615006,
+ SAY_SHADRON_SPECIAL_2 = -1615007
+};
+
+enum VespText
+{
+ SAY_VESPERON_AGGRO = -1615033,
+ SAY_VESPERON_SLAY_1 = -1615034,
+ SAY_VESPERON_SLAY_2 = -1615035,
+ SAY_VESPERON_DEATH = -1615036,
+ SAY_VESPERON_BREATH = -1615037,
+ SAY_VESPERON_RESPOND = -1615038,
+ SAY_VESPERON_SPECIAL_1 = -1615039,
+ SAY_VESPERON_SPECIAL_2 = -1615040
+};
+
+//to control each dragons common abilities
+struct TRINITY_DLL_DECL dummy_dragonAI : public ScriptedAI
+{
+ dummy_dragonAI(Creature* pCreature) : ScriptedAI(pCreature)
{
- DoScriptText(SAY_SARTHARION_DEATH,m_creature);
+ m_pInstance = ((ScriptedInstance*)pCreature->GetInstanceData());
+ m_bIsHeroic = pCreature->GetMap()->IsHeroic();
+ }
+
+ ScriptedInstance* m_pInstance;
+ bool m_bIsHeroic;
+
+ uint32 m_uiWaypointId;
+ uint32 m_uiMoveNextTimer;
+ int32 m_iPortalRespawnTime;
+ bool m_bCanMoveFree;
+
+ void Reset()
+ {
+ if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
+ m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+
+ m_uiWaypointId = 0;
+ m_uiMoveNextTimer = 500;
+ m_iPortalRespawnTime = 30000;
+ m_bCanMoveFree = false;
+ }
+
+ void MovementInform(uint32 uiType, uint32 uiPointId)
+ {
+ if (!m_pInstance || uiType != POINT_MOTION_TYPE)
+ return;
+
+ debug_log("dummy_dragonAI: %s reached point %u", m_creature->GetName(), uiPointId);
+
+ //if healers messed up the raid and we was already initialized
+ if (m_pInstance->GetData(TYPE_SARTHARION_EVENT) != IN_PROGRESS)
+ {
+ EnterEvadeMode();
+ return;
+ }
+
+ //this is end, if we reach this, don't do much
+ if (uiPointId == POINT_ID_LAND)
+ {
+ m_creature->GetMotionMaster()->Clear();
+ m_bCanMoveFree = false;
+ return;
+ }
+
+ //get amount of common points
+ uint32 uiCommonWPCount = sizeof(m_aDragonCommon)/sizeof(Waypoint);
+
+ //increase
+ m_uiWaypointId = uiPointId+1;
+
+ //if we have reached a point bigger or equal to count, it mean we must reset to point 0
+ if (m_uiWaypointId >= uiCommonWPCount)
+ {
+ if (!m_bCanMoveFree)
+ m_bCanMoveFree = true;
+
+ m_uiWaypointId = 0;
+ }
+
+ m_uiMoveNextTimer = 500;
+ }
+
+ //used when open portal and spawn mobs in phase
+ void DoRaidWhisper(int32 iTextId)
+ {
+ Map* pMap = m_creature->GetMap();
+
+ if (pMap && pMap->IsDungeon())
+ {
+ Map::PlayerList const &PlayerList = pMap->GetPlayers();
+
+ if (!PlayerList.isEmpty())
+ {
+ for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
+ DoScriptText(iTextId, m_creature, i->getSource());
+ }
+ }
+ }
+
+ //"opens" the portal and does the "opening" whisper
+ void OpenPortal()
+ {
+ int32 iTextId = 0;
+
+ //there are 4 portal spawn locations, each are expected to be spawned with negative spawntimesecs in database
+
+ //using a grid search here seem to be more efficient than caching all four guids
+ //in instance script and calculate range to each.
+ GameObject* pPortal = m_creature->FindNearestGameObject(GO_TWILIGHT_PORTAL,50.0f);
+
+ switch(m_creature->GetEntry())
+ {
+ case NPC_TENEBRON:
+ iTextId = WHISPER_HATCH_EGGS;
+ break;
+ case NPC_SHADRON:
+ case NPC_VESPERON:
+ iTextId = WHISPER_OPEN_PORTAL;
+ break;
+ }
+
+ DoRaidWhisper(iTextId);
+
+ //By using SetRespawnTime() we will actually "spawn" the object with our defined time.
+ //Once time is up, portal will disappear again.
+ if (pPortal && !pPortal->isSpawned())
+ pPortal->SetRespawnTime(m_iPortalRespawnTime);
+
+ //Unclear what are expected to happen if one drake has a portal open already
+ //Refresh respawnTime so time again are set to 30secs?
+ }
+
+ //Removes each drakes unique debuff from players
+ void RemoveDebuff(uint32 uiSpellId)
+ {
+ Map* pMap = m_creature->GetMap();
+
+ if (pMap && pMap->IsDungeon())
+ {
+ Map::PlayerList const &PlayerList = pMap->GetPlayers();
+
+ if (PlayerList.isEmpty())
+ return;
+
+ for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
+ {
+ if (i->getSource()->isAlive() && i->getSource()->HasAura(uiSpellId))
+ i->getSource()->RemoveAurasDueToSpell(uiSpellId);
+ }
+ }
+ }
+
+ void JustDied(Unit* pKiller)
+ {
+ int32 iTextId = 0;
+ uint32 uiSpellId = 0;
+
+ switch(m_creature->GetEntry())
+ {
+ case NPC_TENEBRON:
+ iTextId = SAY_TENEBRON_DEATH;
+ uiSpellId = SPELL_POWER_OF_TENEBRON;
+ break;
+ case NPC_SHADRON:
+ iTextId = SAY_SHADRON_DEATH;
+ uiSpellId = SPELL_POWER_OF_SHADRON;
+ break;
+ case NPC_VESPERON:
+ iTextId = SAY_VESPERON_DEATH;
+ uiSpellId = SPELL_POWER_OF_VESPERON;
+ break;
+ }
+
+ DoScriptText(iTextId, m_creature);
+
+ RemoveDebuff(uiSpellId);
+
+ if (m_pInstance)
+ {
+ // not if solo mini-boss fight
+ if (m_pInstance->GetData(TYPE_SARTHARION_EVENT) != IN_PROGRESS)
+ return;
+
+ // Twilight Revenge to main boss
+ if (Unit* pSartharion = Unit::GetUnit((*m_creature), m_pInstance->GetData64(DATA_SARTHARION)))
+ {
+ if (pSartharion->isAlive())
+ m_creature->CastSpell(pSartharion,SPELL_TWILIGHT_REVENGE,true);
+ }
+ }
+ }
+
+ void UpdateAI(const uint32 uiDiff)
+ {
+ if (m_bCanMoveFree && m_uiMoveNextTimer)
+ {
+ if (m_uiMoveNextTimer < uiDiff)
+ {
+ m_creature->GetMotionMaster()->MovePoint(m_uiWaypointId,
+ m_aDragonCommon[m_uiWaypointId].m_fX, m_aDragonCommon[m_uiWaypointId].m_fY, m_aDragonCommon[m_uiWaypointId].m_fZ);
+
+ debug_log("dummy_dragonAI: %s moving to point %u", m_creature->GetName(), m_uiWaypointId);
+ m_uiMoveNextTimer = 0;
+ } else m_uiMoveNextTimer -= uiDiff;
+ }
}
};
/*######
-## Mob Vesperon
+## Mob Tenebron
######*/
-//Vesperon Yell
-#define SAY_VESPERON_AGGRO -1615030
-#define SAY_VESPERON_SLAY_1 -1615031
-#define SAY_VESPERON_SLAY_2 -1615032
-#define SAY_VESPERON_DEATH -1615033
-#define SAY_VESPERON_BREATH -1615034
-#define SAY_VESPERON_RESPOND -1615035
-#define SAY_VESPERON_SPECIAL_1 -1615036
-#define SAY_VESPERON_SPECIAL_2 -1615037
-
-struct TRINITY_DLL_DECL mob_vesperonAI : public ScriptedAI
+struct TRINITY_DLL_DECL mob_tenebronAI : public dummy_dragonAI
{
- mob_vesperonAI(Creature *c) : ScriptedAI(c) {}
+ mob_tenebronAI(Creature* pCreature) : dummy_dragonAI(pCreature) { }
+
+ uint32 m_uiShadowBreathTimer;
+ uint32 m_uiShadowFissureTimer;
+ uint32 m_uiHatchEggTimer;
- void Reset() {}
- void EnterCombat(Unit* who)
+ void Reset()
{
- DoScriptText(SAY_VESPERON_AGGRO,m_creature);
+ m_uiShadowBreathTimer = 20000;
+ m_uiShadowFissureTimer = 5000;
+ m_uiHatchEggTimer = 30000;
}
- void UpdateAI(const uint32 diff)
+
+ void Aggro(Unit* pWho)
{
- //Return since we have no target
- if(!UpdateVictim())
- return;
+ DoScriptText(SAY_TENEBRON_AGGRO, m_creature);
+ DoZoneInCombat();
+ DoCast(m_creature, SPELL_POWER_OF_TENEBRON);
+ }
- DoMeleeAttackIfReady();
+ void KilledUnit(Unit* pVictim)
+ {
+ switch(rand()%2)
+ {
+ case 0: DoScriptText(SAY_TENEBRON_SLAY_1, m_creature); break;
+ case 1: DoScriptText(SAY_TENEBRON_SLAY_2, m_creature); break;
+ }
}
- void JustDied(Unit* killer)
+
+ void UpdateAI(const uint32 uiDiff)
{
- DoScriptText(SAY_VESPERON_DEATH,m_creature);
+ //if no target, update dummy and return
+ if (!UpdateVictim())
+ {
+ dummy_dragonAI::UpdateAI(uiDiff);
+ return;
+ }
+
+ // shadow fissure
+ if (m_uiShadowFissureTimer < uiDiff)
+ {
+ if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
+ DoCast(pTarget, m_bIsHeroic ? SPELL_SHADOW_FISSURE_H : SPELL_SHADOW_FISSURE);
+
+ m_uiShadowFissureTimer = 15000 + rand()%5000;
+ }else m_uiShadowFissureTimer -= uiDiff;
+
+ // shadow breath
+ if (m_uiShadowBreathTimer < uiDiff)
+ {
+ DoScriptText(SAY_TENEBRON_BREATH, m_creature);
+ DoCast(m_creature->getVictim(), m_bIsHeroic ? SPELL_SHADOW_BREATH_H : SPELL_SHADOW_BREATH);
+ m_uiShadowBreathTimer = 20000 + rand()%5000;
+ }else m_uiShadowBreathTimer -= uiDiff;
+
+ DoMeleeAttackIfReady();
}
};
+CreatureAI* GetAI_mob_tenebron(Creature* pCreature)
+{
+ return new mob_tenebronAI(pCreature);
+}
+
/*######
## Mob Shadron
######*/
-//Shadron Yell
-#define SAY_SHADRON_AGGRO -1615000
-#define SAY_SHADRON_SLAY_1 -1615001
-#define SAY_SHADRON_SLAY_2 -1615002
-#define SAY_SHADRON_DEATH -1615003
-#define SAY_SHADRON_BREATH -1615004
-#define SAY_SHADRON_RESPOND -1615005
-#define SAY_SHADRON_SPECIAL_1 -1615006
-#define SAY_SHADRON_SPECIAL_2 -1615007
-
-struct TRINITY_DLL_DECL mob_shadronAI : public ScriptedAI
+struct TRINITY_DLL_DECL mob_shadronAI : public dummy_dragonAI
{
- mob_shadronAI(Creature *c) : ScriptedAI(c) {}
+ mob_shadronAI(Creature* pCreature) : dummy_dragonAI(pCreature) { }
+
+ uint32 m_uiShadowBreathTimer;
+ uint32 m_uiShadowFissureTimer;
+ uint32 m_uiAcolyteShadronTimer;
+
+ void Reset()
+ {
+ m_uiShadowBreathTimer = 20000;
+ m_uiShadowFissureTimer = 5000;
+ m_uiAcolyteShadronTimer = 60000;
+
+ if (m_creature->HasAura(SPELL_TWILIGHT_TORMENT_VESP))
+ m_creature->RemoveAurasDueToSpell(SPELL_TWILIGHT_TORMENT_VESP);
+
+ if (m_creature->HasAura(SPELL_GIFT_OF_TWILIGTH_SHA))
+ m_creature->RemoveAurasDueToSpell(SPELL_GIFT_OF_TWILIGTH_SHA);
+ }
- void Reset(){}
- void EnterCombat(Unit* who)
+ void Aggro(Unit* pWho)
{
DoScriptText(SAY_SHADRON_AGGRO,m_creature);
+ DoZoneInCombat();
+ DoCast(m_creature, SPELL_POWER_OF_SHADRON);
}
- void UpdateAI(const uint32 diff)
+
+ void KilledUnit(Unit* pVictim)
{
- //Return since we have no target
- if(!UpdateVictim())
+ switch(rand()%2)
+ {
+ case 0: DoScriptText(SAY_SHADRON_SLAY_1, m_creature); break;
+ case 1: DoScriptText(SAY_SHADRON_SLAY_2, m_creature); break;
+ }
+ }
+
+ void UpdateAI(const uint32 uiDiff)
+ {
+ //if no target, update dummy and return
+ if (!UpdateVictim())
+ {
+ dummy_dragonAI::UpdateAI(uiDiff);
return;
+ }
+
+ // shadow fissure
+ if (m_uiShadowFissureTimer < uiDiff)
+ {
+ if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
+ DoCast(pTarget, m_bIsHeroic ? SPELL_SHADOW_FISSURE_H : SPELL_SHADOW_FISSURE);
+
+ m_uiShadowFissureTimer = 15000 + rand()%5000;
+ }else m_uiShadowFissureTimer -= uiDiff;
+
+ // shadow breath
+ if (m_uiShadowBreathTimer < uiDiff)
+ {
+ DoScriptText(SAY_SHADRON_BREATH, m_creature);
+ DoCast(m_creature->getVictim(), m_bIsHeroic ? SPELL_SHADOW_BREATH_H : SPELL_SHADOW_BREATH);
+ m_uiShadowBreathTimer = 20000 + rand()%5000;
+ }else m_uiShadowBreathTimer -= uiDiff;
DoMeleeAttackIfReady();
}
- void JustDied(Unit* killer)
- {
- DoScriptText(SAY_SHADRON_DEATH,m_creature);
- }
};
+
+CreatureAI* GetAI_mob_shadron(Creature* pCreature)
+{
+ return new mob_shadronAI(pCreature);
+}
+
/*######
-## Mob Tenebron
+## Mob Vesperon
######*/
-//Yell
-#define SAY_TENEBRON_AGGRO -1615008
-#define SAY_TENEBRON_SLAY_1 -1615009
-#define SAY_TENEBRON_SLAY_2 -1615010
-#define SAY_TENEBRON_DEATH -1615011
-#define SAY_TENEBRON_BREATH -1615012
-#define SAY_TENEBRON_RESPOND -1615013
-#define SAY_TENEBRON_SPECIAL_1 -1615014
-#define SAY_TENEBRON_SPECIAL_2 -1615015
-
-struct TRINITY_DLL_DECL mob_tenebronAI : public ScriptedAI
+struct TRINITY_DLL_DECL mob_vesperonAI : public dummy_dragonAI
{
- mob_tenebronAI(Creature *c) : ScriptedAI(c) {}
+ mob_vesperonAI(Creature* pCreature) : dummy_dragonAI(pCreature) { }
- void Reset() {}
- void EnterCombat(Unit* who)
+ uint32 m_uiShadowBreathTimer;
+ uint32 m_uiShadowFissureTimer;
+ uint32 m_uiAcolyteVesperonTimer;
+
+ void Reset()
{
- DoScriptText(SAY_TENEBRON_AGGRO,m_creature);
+ m_uiShadowBreathTimer = 20000;
+ m_uiShadowFissureTimer = 5000;
+ m_uiAcolyteVesperonTimer = 60000;
}
- void UpdateAI(const uint32 diff)
+
+ void Aggro(Unit* pWho)
{
- //Return since we have no target
- if(!UpdateVictim())
+ DoScriptText(SAY_VESPERON_AGGRO,m_creature);
+ DoZoneInCombat();
+ DoCast(m_creature, SPELL_POWER_OF_VESPERON);
+ }
+
+ void KilledUnit(Unit* pVictim)
+ {
+ switch(rand()%2)
+ {
+ case 0: DoScriptText(SAY_VESPERON_SLAY_1, m_creature); break;
+ case 1: DoScriptText(SAY_VESPERON_SLAY_2, m_creature); break;
+ }
+ }
+
+ void UpdateAI(const uint32 uiDiff)
+ {
+ //if no target, update dummy and return
+ if (!UpdateVictim())
+ {
+ dummy_dragonAI::UpdateAI(uiDiff);
return;
+ }
+
+ // shadow fissure
+ if (m_uiShadowFissureTimer < uiDiff)
+ {
+ if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
+ DoCast(pTarget, m_bIsHeroic ? SPELL_SHADOW_FISSURE_H : SPELL_SHADOW_FISSURE);
+
+ m_uiShadowFissureTimer = 15000 + rand()%5000;
+ }else m_uiShadowFissureTimer -= uiDiff;
+
+ // shadow breath
+ if (m_uiShadowBreathTimer < uiDiff)
+ {
+ DoScriptText(SAY_VESPERON_BREATH, m_creature);
+ DoCast(m_creature->getVictim(), m_bIsHeroic ? SPELL_SHADOW_BREATH_H : SPELL_SHADOW_BREATH);
+ m_uiShadowBreathTimer = 20000 + rand()%5000;
+ }else m_uiShadowBreathTimer -= uiDiff;
DoMeleeAttackIfReady();
}
+};
+
+CreatureAI* GetAI_mob_vesperon(Creature* pCreature)
+{
+ return new mob_vesperonAI(pCreature);
+}
+
+/*######
+## Mob Acolyte of Shadron
+######*/
+
+struct TRINITY_DLL_DECL mob_acolyte_of_shadronAI : public ScriptedAI
+{
+ mob_acolyte_of_shadronAI(Creature* pCreature) : ScriptedAI(pCreature)
+ {
+ m_pInstance = ((ScriptedInstance*)pCreature->GetInstanceData());
+ }
+
+ ScriptedInstance* m_pInstance;
+
+ void Reset()
+ {
+ if (m_pInstance)
+ {
+ //if not solo figth, buff main boss, else place debuff on mini-boss. both spells TARGET_SCRIPT
+ if (m_pInstance->GetData(TYPE_SARTHARION_EVENT) == IN_PROGRESS)
+ DoCast(m_creature, SPELL_GIFT_OF_TWILIGTH_SAR);
+ else
+ DoCast(m_creature, SPELL_GIFT_OF_TWILIGTH_SHA);
+ }
+ }
+
void JustDied(Unit* killer)
{
- DoScriptText(SAY_TENEBRON_DEATH,m_creature);
+ if (m_pInstance)
+ {
+ Creature* pDebuffTarget = NULL;
+
+ if (m_pInstance->GetData(TYPE_SARTHARION_EVENT) == IN_PROGRESS)
+ {
+ //not solo fight, so main boss has deduff
+ pDebuffTarget = m_pInstance->instance->GetCreature(m_pInstance->GetData64(DATA_SARTHARION));
+
+ if (pDebuffTarget && pDebuffTarget->isAlive() && pDebuffTarget->HasAura(SPELL_GIFT_OF_TWILIGTH_SAR))
+ pDebuffTarget->RemoveAurasDueToSpell(SPELL_GIFT_OF_TWILIGTH_SAR);
+ }
+ else
+ {
+ //event not in progress, then solo fight and must remove debuff mini-boss
+ pDebuffTarget = m_pInstance->instance->GetCreature(m_pInstance->GetData64(DATA_SHADRON));
+
+ if (pDebuffTarget && pDebuffTarget->isAlive() && pDebuffTarget->HasAura(SPELL_GIFT_OF_TWILIGTH_SHA))
+ pDebuffTarget->RemoveAurasDueToSpell(SPELL_GIFT_OF_TWILIGTH_SHA);
+ }
+ }
+ }
+
+ void UpdateAI(const uint32 uiDiff)
+ {
+ if (!UpdateVictim())
+ return;
+
+ DoMeleeAttackIfReady();
}
};
+CreatureAI* GetAI_mob_acolyte_of_shadron(Creature* pCreature)
+{
+ return new mob_acolyte_of_shadronAI(pCreature);
+}
+
/*######
-## Mob Whelps
+## Mob Acolyte of Vesperon
######*/
-struct TRINITY_DLL_DECL mob_whelpAI : public ScriptedAI
+
+struct TRINITY_DLL_DECL mob_acolyte_of_vesperonAI : public ScriptedAI
{
- mob_whelpAI(Creature *c) : ScriptedAI(c) {}
+ mob_acolyte_of_vesperonAI(Creature* pCreature) : ScriptedAI(pCreature)
+ {
+ m_pInstance = ((ScriptedInstance*)pCreature->GetInstanceData());
+ }
- uint32 Fade_armor_Timer;
+ ScriptedInstance* m_pInstance;
- void Reset() {}
- void EnterCombat(Unit* who) {}
- void UpdateAI(const uint32 diff)
+ void Reset()
{
- //Return since we have no target
- if(!UpdateVictim())
+ DoCast(m_creature, SPELL_TWILIGHT_TORMENT_VESP_ACO);
+ }
+
+ void JustDied(Unit* pKiller)
+ {
+ // remove twilight torment on Vesperon
+ if (m_pInstance)
+ {
+ Creature* pVesperon = m_pInstance->instance->GetCreature(m_pInstance->GetData64(DATA_VESPERON));
+
+ if (pVesperon && pVesperon->isAlive() && pVesperon->HasAura(SPELL_TWILIGHT_TORMENT_VESP))
+ pVesperon->RemoveAurasDueToSpell(SPELL_TWILIGHT_TORMENT_VESP);
+ }
+ }
+
+ void UpdateAI(const uint32 uiDiff)
+ {
+ if (!UpdateVictim())
return;
DoMeleeAttackIfReady();
}
- void JustDied(Unit* killer) {}
};
-CreatureAI* GetAI_mob_whelp(Creature *_Creature)
+CreatureAI* GetAI_mob_acolyte_of_vesperon(Creature* pCreature)
{
- return new mob_whelpAI (_Creature);
+ return new mob_acolyte_of_vesperonAI(pCreature);
}
-CreatureAI* GetAI_mob_tenebron(Creature *_Creature)
+/*######
+## Mob Twilight Eggs
+######*/
+
+struct TRINITY_DLL_DECL mob_twilight_eggsAI : public ScriptedAI
{
- return new mob_tenebronAI (_Creature);
-}
+ mob_twilight_eggsAI(Creature* pCreature) : ScriptedAI(pCreature) { }
+
+ uint32 m_uiFadeArmorTimer;
+
+ void Reset()
+ {
+ m_uiFadeArmorTimer = 1000;
+ }
-CreatureAI* GetAI_mob_shadron(Creature *_Creature)
+ void AttackStart(Unit* pWho) { }
+ void MoveInLineOfSight(Unit* pWho) { }
+};
+
+CreatureAI* GetAI_mob_twilight_eggs(Creature* pCreature)
{
- return new mob_shadronAI (_Creature);
+ return new mob_twilight_eggsAI(pCreature);
}
-CreatureAI* GetAI_mob_vesperon(Creature *_Creature)
+/*######
+## Mob Twilight Whelps
+######*/
+
+struct TRINITY_DLL_DECL mob_twilight_whelpAI : public ScriptedAI
{
- return new mob_vesperonAI (_Creature);
-}
+ mob_twilight_whelpAI(Creature* pCreature) : ScriptedAI(pCreature) { }
-CreatureAI* GetAI_boss_sartharion(Creature *_Creature)
+ uint32 m_uiFadeArmorTimer;
+
+ void Reset()
+ {
+ m_uiFadeArmorTimer = 1000;
+ }
+
+ void UpdateAI(const uint32 uiDiff)
+ {
+ //Return since we have no target
+ if (!UpdateVictim())
+ return;
+
+ // twilight torment
+ if (m_uiFadeArmorTimer < uiDiff)
+ {
+ DoCast(m_creature->getVictim(), SPELL_FADE_ARMOR);
+ m_uiFadeArmorTimer = 5000 + rand()%5000;
+ }else m_uiFadeArmorTimer -= uiDiff;
+
+ DoMeleeAttackIfReady();
+ }
+};
+
+CreatureAI* GetAI_mob_twilight_whelp(Creature* pCreature)
{
- return new boss_sartharionAI (_Creature);
+ return new mob_twilight_whelpAI(pCreature);
}
void AddSC_boss_sartharion()
@@ -294,7 +1095,22 @@ void AddSC_boss_sartharion()
newscript->RegisterSelf();
newscript = new Script;
- newscript->Name="mob_whelp";
- newscript->GetAI = &GetAI_mob_whelp;
+ newscript->Name="mob_acolyte_of_shadron";
+ newscript->GetAI = &GetAI_mob_acolyte_of_shadron;
+ newscript->RegisterSelf();
+
+ newscript = new Script;
+ newscript->Name="mob_acolyte_of_vesperon";
+ newscript->GetAI = &GetAI_mob_acolyte_of_vesperon;
+ newscript->RegisterSelf();
+
+ newscript = new Script;
+ newscript->Name="mob_twilight_eggs";
+ newscript->GetAI = &GetAI_mob_twilight_eggs;
+ newscript->RegisterSelf();
+
+ newscript = new Script;
+ newscript->Name="mob_twilight_whelp";
+ newscript->GetAI = &GetAI_mob_twilight_whelp;
newscript->RegisterSelf();
}
diff --git a/src/bindings/scripts/scripts/zone/obsidian_sanctum/def_obsidian_sanctum.h b/src/bindings/scripts/scripts/zone/obsidian_sanctum/def_obsidian_sanctum.h
index 59d76502af3..461834a2386 100644
--- a/src/bindings/scripts/scripts/zone/obsidian_sanctum/def_obsidian_sanctum.h
+++ b/src/bindings/scripts/scripts/zone/obsidian_sanctum/def_obsidian_sanctum.h
@@ -1,4 +1,20 @@
#ifndef DEF_OBSIDIAN_SANCTUM_H
#define DEF_OBSIDIAN_SANCTUM_H
+enum
+{
+ TYPE_SARTHARION_EVENT = 1,
+
+ DATA_SARTHARION = 10,
+ DATA_TENEBRON = 11,
+ DATA_SHADRON = 12,
+ DATA_VESPERON = 13,
+
+ NPC_SARTHARION = 28860,
+ NPC_TENEBRON = 30452,
+ NPC_SHADRON = 30451,
+ NPC_VESPERON = 30449,
+ GO_TWILIGHT_PORTAL = 193988
+};
+
#endif
diff --git a/src/bindings/scripts/scripts/zone/obsidian_sanctum/instance_obsidian_sanctum.cpp b/src/bindings/scripts/scripts/zone/obsidian_sanctum/instance_obsidian_sanctum.cpp
index 898574c99eb..72166261684 100644
--- a/src/bindings/scripts/scripts/zone/obsidian_sanctum/instance_obsidian_sanctum.cpp
+++ b/src/bindings/scripts/scripts/zone/obsidian_sanctum/instance_obsidian_sanctum.cpp
@@ -1,9 +1,86 @@
#include "precompiled.h"
#include "def_obsidian_sanctum.h"
+#define ENCOUNTERS 1
+
+/* Obsidian Sanctum encounters:
+0 - Sartharion
+*/
+
struct TRINITY_DLL_DECL instance_obsidian_sanctum : public ScriptedInstance
{
instance_obsidian_sanctum(Map *Map) : ScriptedInstance(Map) {Initialize();};
+
+ uint32 m_uiEncounter[ENCOUNTERS];
+ uint64 m_uiSartharionGUID;
+ uint64 m_uiTenebronGUID;
+ uint64 m_uiShadronGUID;
+ uint64 m_uiVesperonGUID;
+
+ void Initialize()
+ {
+ m_uiSartharionGUID = 0;
+ m_uiTenebronGUID = 0;
+ m_uiShadronGUID = 0;
+ m_uiVesperonGUID = 0;
+
+ for(uint8 i = 0; i < ENCOUNTERS; ++i)
+ m_uiEncounter[i] = NOT_STARTED;
+ }
+
+ void OnCreatureCreate(Creature* pCreature, uint32 entry)
+ {
+ switch(pCreature->GetEntry())
+ {
+ case NPC_SARTHARION:
+ m_uiSartharionGUID = pCreature->GetGUID();
+ break;
+ //three dragons below set to active state once created.
+ //we must expect bigger raid to encounter main boss, and then three dragons must be active due to grid differences
+ case NPC_TENEBRON:
+ m_uiTenebronGUID = pCreature->GetGUID();
+ pCreature->setActive(true);
+ break;
+ case NPC_SHADRON:
+ m_uiShadronGUID = pCreature->GetGUID();
+ pCreature->setActive(true);
+ break;
+ case NPC_VESPERON:
+ m_uiVesperonGUID = pCreature->GetGUID();
+ pCreature->setActive(true);
+ break;
+ }
+ }
+
+ void SetData(uint32 uiType, uint32 uiData)
+ {
+ if (uiType == TYPE_SARTHARION_EVENT)
+ m_uiEncounter[0] = uiData;
+ }
+
+ uint32 GetData(uint32 uiType)
+ {
+ if (uiType == TYPE_SARTHARION_EVENT)
+ return m_uiEncounter[0];
+
+ return 0;
+ }
+
+ uint64 GetData64(uint32 uiData)
+ {
+ switch(uiData)
+ {
+ case DATA_SARTHARION:
+ return m_uiSartharionGUID;
+ case DATA_TENEBRON:
+ return m_uiTenebronGUID;
+ case DATA_SHADRON:
+ return m_uiShadronGUID;
+ case DATA_VESPERON:
+ return m_uiVesperonGUID;
+ }
+ return 0;
+ }
};
InstanceData* GetInstanceData_instance_obsidian_sanctum(Map* map)
diff --git a/src/bindings/scripts/scripts/zone/onyxias_lair/boss_onyxia.cpp b/src/bindings/scripts/scripts/zone/onyxias_lair/boss_onyxia.cpp
index 96885e7e672..ceea0a66d85 100644
--- a/src/bindings/scripts/scripts/zone/onyxias_lair/boss_onyxia.cpp
+++ b/src/bindings/scripts/scripts/zone/onyxias_lair/boss_onyxia.cpp
@@ -97,9 +97,6 @@ struct TRINITY_DLL_DECL boss_onyxiaAI : public ScriptedAI
FireballTimer = 18000;
InitialSpawn = true;
-
- m_creature->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true);
- m_creature->ApplySpellImmune(1, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, true);
}
void EnterCombat(Unit* who)
diff --git a/src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp b/src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp
index 251d6f0441a..e02d077f927 100644
--- a/src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp
+++ b/src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp
@@ -269,7 +269,7 @@ struct TRINITY_DLL_DECL mob_enslaved_netherwing_drakeAI : public ScriptedAI
Player* plr = Unit::GetPlayer(PlayerGUID);
if(plr && plr->GetQuestStatus(10854) == QUEST_STATUS_INCOMPLETE)
{
- plr->KilledMonsterCredit(22316, m_creature->GetGUID());
+ DoCast(plr, SPELL_FORCE_OF_NELTHARAKU, true);
/*
float x,y,z;
m_creature->GetPosition(x,y,z);
diff --git a/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_muru.cpp b/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_muru.cpp
index 5fac071128f..debfd7da595 100644
--- a/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_muru.cpp
+++ b/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_muru.cpp
@@ -115,36 +115,40 @@ float Humanoides[6][5] =
uint32 EnrageTimer = 600000;
struct TRINITY_DLL_DECL boss_entropiusAI : public ScriptedAI
{
- boss_entropiusAI(Creature *c) : ScriptedAI(c), Summons(m_creature){
+ boss_entropiusAI(Creature *c) : ScriptedAI(c), Summons(m_creature)
+ {
pInstance = c->GetInstanceData();
- Combat = false;
}
ScriptedInstance* pInstance;
SummonList Summons;
- bool Combat;
uint32 BlackHoleSummonTimer;
- void Reset() {
- if (!Combat){
- BlackHoleSummonTimer = 15000;
- DoCastAOE(SPELL_NEGATIVE_ENERGY_E, false);
- }else{
- if(pInstance)
- pInstance->SetData(DATA_MURU_EVENT, NOT_STARTED);
- Summons.DespawnAll();
- }
+ void Reset()
+ {
+ BlackHoleSummonTimer = 15000;
+ DoCastAOE(SPELL_NEGATIVE_ENERGY_E, false);
+
+ Summons.DespawnAll();
+
+ if(pInstance)
+ pInstance->SetData(DATA_MURU_EVENT, NOT_STARTED);
}
- void EnterCombat(Unit *who) {
+ void EnterCombat(Unit *who)
+ {
DoCastAOE(SPELL_NEGATIVE_ENERGY_E, true);
DoCast(m_creature, SPELL_ENTROPIUS_SPAWN, false);
+
+ if(pInstance)
+ pInstance->SetData(DATA_MURU_EVENT, IN_PROGRESS);
}
void JustSummoned(Creature* summoned)
{
- switch(summoned->GetEntry()){
+ switch(summoned->GetEntry())
+ {
case CREATURE_DARK_FIENDS:
summoned->CastSpell(summoned,SPELL_DARKFIEND_VISUAL,false);
break;
@@ -159,13 +163,12 @@ struct TRINITY_DLL_DECL boss_entropiusAI : public ScriptedAI
Summons.Summon(summoned);
}
- void KilledUnit(Unit* victim){
-
- }
-
- void JustDied(Unit* killer){
- if(pInstance)pInstance->SetData(DATA_MURU_EVENT, DONE);
+ void JustDied(Unit* killer)
+ {
Summons.DespawnAll();
+
+ if(pInstance)
+ pInstance->SetData(DATA_MURU_EVENT, DONE);
}
void UpdateAI(const uint32 diff)
@@ -173,25 +176,29 @@ struct TRINITY_DLL_DECL boss_entropiusAI : public ScriptedAI
if(!UpdateVictim())
return;
- if(!Combat)Combat = true;
-
- if(EnrageTimer < diff && !m_creature->HasAura(SPELL_ENRAGE, 0)){
+ if(EnrageTimer < diff && !m_creature->HasAura(SPELL_ENRAGE, 0))
+ {
DoCast(m_creature,SPELL_ENRAGE, false);
}else EnrageTimer -= diff;
- if(BlackHoleSummonTimer < diff){
+ if(BlackHoleSummonTimer < diff)
+ {
Unit* random = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
- if(!random)return;
+ if(!random)
+ return;
+
DoCast(random, SPELL_DARKNESS_E, false);
+
random = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
- if(!random)return;
+ if(!random)
+ return;
+
random->CastSpell(random, SPELL_BLACKHOLE, false);
BlackHoleSummonTimer = 15000;
}else BlackHoleSummonTimer -= diff;
DoMeleeAttackIfReady();
}
-
};
CreatureAI* GetAI_boss_entropius(Creature *_Creature)
@@ -201,7 +208,8 @@ CreatureAI* GetAI_boss_entropius(Creature *_Creature)
struct TRINITY_DLL_DECL boss_muruAI : public Scripted_NoMovementAI
{
- boss_muruAI(Creature *c) : Scripted_NoMovementAI(c), Summons(m_creature){
+ boss_muruAI(Creature *c) : Scripted_NoMovementAI(c), Summons(m_creature)
+ {
pInstance = c->GetInstanceData();
}
@@ -223,36 +231,42 @@ struct TRINITY_DLL_DECL boss_muruAI : public Scripted_NoMovementAI
Timer[TIMER_HUMANOIDES] = 10000;
Timer[TIMER_PHASE] = 2000;
Timer[TIMER_SENTINEL] = 31500;
- Summons.DespawnAll();
+
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
m_creature->SetVisibility(VISIBILITY_ON);
+
+ Summons.DespawnAll();
+
if(pInstance)
pInstance->SetData(DATA_MURU_EVENT, NOT_STARTED);
}
void EnterCombat(Unit *who)
{
+ DoCastAOE(SPELL_NEGATIVE_ENERGY,false);
+
if(pInstance)
pInstance->SetData(DATA_MURU_EVENT, IN_PROGRESS);
- DoCastAOE(SPELL_NEGATIVE_ENERGY,false);
}
- void KilledUnit(Unit* victim){}
-
- void DamageTaken(Unit *done_by, uint32 &damage) {
- if(damage > m_creature->GetHealth() && Phase == 1){
+ void DamageTaken(Unit *done_by, uint32 &damage)
+ {
+ if(damage > m_creature->GetHealth() && Phase == 1)
+ {
damage = 0;
Phase = 2;
m_creature->RemoveAllAuras();
DoCast(m_creature, SPELL_OPEN_ALL_PORTALS, false);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
}
- if(Phase > 1 && Phase < 4)damage = 0;
+ if(Phase > 1 && Phase < 4)
+ damage = 0;
}
void JustSummoned(Creature* summoned)
{
- switch(summoned->GetEntry()){
+ switch(summoned->GetEntry())
+ {
case BOSS_ENTROPIUS:
m_creature->SetVisibility(VISIBILITY_OFF);
break;
@@ -269,9 +283,12 @@ struct TRINITY_DLL_DECL boss_muruAI : public Scripted_NoMovementAI
if(!UpdateVictim())
return;
- if(Phase == 3){
- if(Timer[TIMER_PHASE] <diff){
- switch(pInstance->GetData(DATA_MURU_EVENT)){
+ if(Phase == 3)
+ {
+ if(Timer[TIMER_PHASE] <diff)
+ {
+ switch(pInstance->GetData(DATA_MURU_EVENT))
+ {
case NOT_STARTED:
Reset();
break;
@@ -287,52 +304,58 @@ struct TRINITY_DLL_DECL boss_muruAI : public Scripted_NoMovementAI
}
if (EnrageTimer < diff && !m_creature->HasAura(SPELL_ENRAGE, 0))
+ {
DoCast(m_creature, SPELL_ENRAGE, false);
- else EnrageTimer -= diff;
+ }else EnrageTimer -= diff;
- for (uint8 i = 0; i < 4; ++i){
- if(Timer[i] < diff){
- switch(i){
+ for (uint8 i = 0; i < 4; ++i)
+ {
+ if(Timer[i] < diff)
+ {
+ switch(i)
+ {
case TIMER_DARKNESS:
- if(!DarkFiend){
+ if(!DarkFiend)
+ {
DoCastAOE(SPELL_DARKNESS, false);
Timer[TIMER_DARKNESS] = 3000;
DarkFiend = true;
- }else{
+ }
+ else
+ {
DarkFiend = false;
for(uint8 i = 0; i < 8; ++i)
m_creature->SummonCreature(CREATURE_DARK_FIENDS,DarkFiends[i][0],DarkFiends[i][1],DarkFiends[i][2], DarkFiends[i][3], TEMPSUMMON_CORPSE_DESPAWN, 0);
Timer[TIMER_DARKNESS] = 42000;
}
break;
-
case TIMER_HUMANOIDES:
for(uint8 i = 0; i < 6; ++i)
m_creature->SummonCreature(Humanoides[i][0],Humanoides[i][1],Humanoides[i][2],Humanoides[i][3], Humanoides[i][4], TEMPSUMMON_CORPSE_DESPAWN, 0);
Timer[TIMER_HUMANOIDES] = 60000;
break;
-
case TIMER_PHASE:
m_creature->RemoveAllAuras();
DoCast(m_creature, SPELL_SUMMON_ENTROPIUS, false);
Timer[TIMER_PHASE] = 3000;
Phase = 3;
return;
-
case TIMER_SENTINEL:
DoCastAOE(SPELL_OPEN_PORTAL_2, false);
Timer[TIMER_SENTINEL] = 30000;
break;
- }break;}
+ }
+ break;
+ }
}
//Timer
- for(uint8 i = 0; i < 4; ++i){
+ for(uint8 i = 0; i < 4; ++i)
+ {
if(i != TIMER_PHASE)Timer[i] -= diff;
else if(Phase == 2) Timer[i] -= diff;
}
}
-
};
CreatureAI* GetAI_boss_muru(Creature *_Creature)
@@ -342,37 +365,50 @@ CreatureAI* GetAI_boss_muru(Creature *_Creature)
struct TRINITY_DLL_DECL npc_muru_portalAI : public Scripted_NoMovementAI
{
- npc_muru_portalAI(Creature *c) : Scripted_NoMovementAI(c), Summons(m_creature){
+ npc_muru_portalAI(Creature *c) : Scripted_NoMovementAI(c), Summons(m_creature)
+ {
pInstance = c->GetInstanceData();
}
ScriptedInstance* pInstance;
+
SummonList Summons;
Creature* Muru;
+
bool SummonSentinel;
bool InAction;
+
uint32 SummonTimer;
- void Reset(){
- m_creature->addUnitState(UNIT_STAT_STUNNED);
+ void Reset()
+ {
SummonTimer = 5000;
+
InAction = false;
SummonSentinel = false;
+
+ m_creature->addUnitState(UNIT_STAT_STUNNED);
+
Summons.DespawnAll();
}
- void JustSummoned(Creature* summoned){
+ void JustSummoned(Creature* summoned)
+ {
Player* Target = Unit::GetPlayer(pInstance->GetData64(DATA_PLAYER_GUID));
- if(Target)summoned->AI()->AttackStart(Target);
+ if(Target)
+ summoned->AI()->AttackStart(Target);
+
Summons.Summon(summoned);
}
- void SpellHit(Unit* caster, const SpellEntry* Spell){
+ void SpellHit(Unit* caster, const SpellEntry* Spell)
+ {
float x,y,z,o;
m_creature->GetHomePosition(x,y,z,o);
DoTeleportTo(x,y,z);
InAction = true;
- switch(Spell->Id){
+ switch(Spell->Id)
+ {
case SPELL_OPEN_ALL_PORTALS:
DoCastAOE(SPELL_OPEN_PORTAL, false);
break;
@@ -383,19 +419,20 @@ struct TRINITY_DLL_DECL npc_muru_portalAI : public Scripted_NoMovementAI
}
}
- void UpdateAI(const uint32 diff){
- if(!SummonSentinel){
+ void UpdateAI(const uint32 diff)
+ {
+ if(!SummonSentinel)
+ {
if(InAction && pInstance->GetData(DATA_MURU_EVENT) == NOT_STARTED)Reset();
return;
}
- if(SummonTimer < diff){
+ if(SummonTimer < diff)
+ {
DoCastAOE(SPELL_SUMMON_VOID_SENTINEL, false);
SummonTimer = 5000;
SummonSentinel = false;
}else SummonTimer -= diff;
}
-
-
};
CreatureAI* GetAI_npc_muru_portal(Creature *_Creature)
@@ -405,23 +442,29 @@ CreatureAI* GetAI_npc_muru_portal(Creature *_Creature)
struct TRINITY_DLL_DECL npc_dark_fiendAI : public ScriptedAI
{
- npc_dark_fiendAI(Creature *c) : ScriptedAI(c){
+ npc_dark_fiendAI(Creature *c) : ScriptedAI(c)
+ {
pInstance = c->GetInstanceData();
}
ScriptedInstance* pInstance;
- bool InAction;
+
uint32 WaitTimer;
+ bool InAction;
- void Reset() {
+ void Reset()
+ {
WaitTimer = 2000;
InAction = false;
+
m_creature->addUnitState(UNIT_STAT_STUNNED);
- };
+ }
- void SpellHit(Unit* caster, const SpellEntry* Spell){
+ void SpellHit(Unit* caster, const SpellEntry* Spell)
+ {
for(uint8 i = 0; i < 3; ++i)
- if(Spell->Effect[i] == 38){
+ if(Spell->Effect[i] == 38)
+ {
m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
m_creature->RemoveCorpse();
}
@@ -433,23 +476,28 @@ struct TRINITY_DLL_DECL npc_dark_fiendAI : public ScriptedAI
return;
if (WaitTimer < diff)
- if(!InAction){
+ {
+ if(!InAction)
+ {
m_creature->clearUnitState(UNIT_STAT_STUNNED);
DoCastAOE(SPELL_DARKFIEND_SKIN, false);
AttackStart(SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true));
InAction = true;
WaitTimer = 500;
- }else{
- if(m_creature->IsWithinDist(m_creature->getVictim(), 5)){
+ }
+ else
+ {
+
+ if(m_creature->IsWithinDist(m_creature->getVictim(), 5))
+ {
DoCastAOE(SPELL_DARKFIEND_AOE, false);
m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
m_creature->RemoveCorpse();
}
WaitTimer = 500;
}
- else WaitTimer -= diff;
+ }else WaitTimer -= diff;
}
-
};
CreatureAI* GetAI_npc_dark_fiend(Creature *_Creature)
@@ -459,7 +507,8 @@ CreatureAI* GetAI_npc_dark_fiend(Creature *_Creature)
struct TRINITY_DLL_DECL npc_void_sentinelAI : public ScriptedAI
{
- npc_void_sentinelAI(Creature *c) : ScriptedAI(c){
+ npc_void_sentinelAI(Creature *c) : ScriptedAI(c)
+ {
pInstance = c->GetInstanceData();
}
@@ -468,39 +517,42 @@ struct TRINITY_DLL_DECL npc_void_sentinelAI : public ScriptedAI
uint32 PulseTimer;
uint32 VoidBlastTimer;
-
- void Reset() {
+ void Reset()
+ {
PulseTimer = 3000;
VoidBlastTimer = 45000; //is this a correct timer?
+
float x,y,z,o;
m_creature->GetHomePosition(x,y,z,o);
DoTeleportTo(x,y,71);
- };
+ }
- void JustDied(Unit* killer){
+ void JustDied(Unit* killer)
+ {
for (uint8 i = 0; i < 8; ++i){
m_creature->SummonCreature(CREATURE_VOID_SPAWN, m_creature->GetPositionX(),m_creature->GetPositionY(),m_creature->GetPositionZ(), rand()%6, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 180000);
}
-
}
+
void UpdateAI(const uint32 diff)
{
if(!UpdateVictim())
return;
- if(PulseTimer < diff){
+ if(PulseTimer < diff)
+ {
DoCastAOE(SPELL_SHADOW_PULSE, true);
PulseTimer = 3000;
}else PulseTimer -= diff;
- if(VoidBlastTimer < diff){
+ if(VoidBlastTimer < diff)
+ {
DoCast(m_creature->getVictim(), SPELL_VOID_BLAST, false);
VoidBlastTimer = 45000;
}else VoidBlastTimer -= diff;
DoMeleeAttackIfReady();
}
-
};
CreatureAI* GetAI_npc_void_sentinel(Creature *_Creature)
@@ -510,7 +562,8 @@ CreatureAI* GetAI_npc_void_sentinel(Creature *_Creature)
struct TRINITY_DLL_DECL npc_blackholeAI : public ScriptedAI
{
- npc_blackholeAI(Creature *c) : ScriptedAI(c){
+ npc_blackholeAI(Creature *c) : ScriptedAI(c)
+ {
pInstance = c->GetInstanceData();
}
@@ -521,23 +574,28 @@ struct TRINITY_DLL_DECL npc_blackholeAI : public ScriptedAI
uint8 Phase;
uint8 NeedForAHack;
- void Reset(){
+ void Reset()
+ {
DespawnTimer = 15000;
SpellTimer = 5000;
Phase = 0;
+
m_creature->addUnitState(UNIT_STAT_STUNNED);
DoCastAOE(SPELL_BLACKHOLE_SPAWN, true);
}
void UpdateAI(const uint32 diff)
{
- if(SpellTimer < diff){
+ if(SpellTimer < diff)
+ {
Unit* Victim = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_PLAYER_GUID));
- switch(NeedForAHack){
+ switch(NeedForAHack)
+ {
case 0:
m_creature->clearUnitState(UNIT_STAT_STUNNED);
DoCastAOE(SPELL_BLACKHOLE_GROW, false);
- if(Victim)AttackStart(Victim);
+ if(Victim)
+ AttackStart(Victim);
SpellTimer = 700;
NeedForAHack = 2;
break;
@@ -555,13 +613,15 @@ struct TRINITY_DLL_DECL npc_blackholeAI : public ScriptedAI
SpellTimer = 400+rand()%500;
NeedForAHack = 1;
Unit* Temp = m_creature->getVictim();
- if(!Temp) return;
+ if(!Temp)
+ return;
if(Temp->GetPositionZ() > 73 && Victim)
AttackStart(Victim);
}
}else SpellTimer -= diff;
- if (DespawnTimer < diff){
+ if (DespawnTimer < diff)
+ {
m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
m_creature->RemoveCorpse();
}else DespawnTimer -= diff;
@@ -577,32 +637,32 @@ void AddSC_boss_muru()
{
Script *newscript;
newscript = new Script;
- newscript->Name="boss_muru";
+ newscript->Name = "boss_muru";
newscript->GetAI = &GetAI_boss_muru;
newscript->RegisterSelf();
newscript = new Script;
- newscript->Name="boss_entropius";
+ newscript->Name = "boss_entropius";
newscript->GetAI = &GetAI_boss_entropius;
newscript->RegisterSelf();
newscript = new Script;
- newscript->Name="npc_muru_portal";
+ newscript->Name = "npc_muru_portal";
newscript->GetAI = &GetAI_npc_muru_portal;
newscript->RegisterSelf();
newscript = new Script;
- newscript->Name="npc_dark_fiend";
+ newscript->Name = "npc_dark_fiend";
newscript->GetAI = &GetAI_npc_dark_fiend;
newscript->RegisterSelf();
newscript = new Script;
- newscript->Name="npc_void_sentinel";
+ newscript->Name = "npc_void_sentinel";
newscript->GetAI = &GetAI_npc_void_sentinel;
newscript->RegisterSelf();
newscript = new Script;
- newscript->Name="npc_blackhole";
+ newscript->Name = "npc_blackhole";
newscript->GetAI = &GetAI_npc_blackhole;
newscript->RegisterSelf();
-} \ No newline at end of file
+}
diff --git a/src/bindings/scripts/scripts/zone/sunwell_plateau/def_sunwell_plateau.h b/src/bindings/scripts/scripts/zone/sunwell_plateau/def_sunwell_plateau.h
index 9fbb5de7300..ca8c014d9df 100644
--- a/src/bindings/scripts/scripts/zone/sunwell_plateau/def_sunwell_plateau.h
+++ b/src/bindings/scripts/scripts/zone/sunwell_plateau/def_sunwell_plateau.h
@@ -30,12 +30,6 @@
/*** GameObjects ***/
#define DATA_GO_FORCEFIELD 20
-#define DATA_GO_FIRE_BARRIER 21
-#define DATA_GATE_1 22
-#define DATA_GATE_2 23
-#define DATA_GATE_3 24
-#define DATA_GATE_4 25
-#define DATA_GATE_5 26
/*** Misc ***/
#define DATA_PLAYER_GUID 27
diff --git a/src/bindings/scripts/scripts/zone/sunwell_plateau/instance_sunwell_plateau.cpp b/src/bindings/scripts/scripts/zone/sunwell_plateau/instance_sunwell_plateau.cpp
index f8c7dde1ca2..9a8497a2df9 100644
--- a/src/bindings/scripts/scripts/zone/sunwell_plateau/instance_sunwell_plateau.cpp
+++ b/src/bindings/scripts/scripts/zone/sunwell_plateau/instance_sunwell_plateau.cpp
@@ -4,8 +4,8 @@
/* ScriptData
SDName: Instance_Sunwell_Plateau
-SD%Complete: 20
-SDComment: VERIFY SCRIPT, rename Gates
+SD%Complete: 25
+SDComment: VERIFY SCRIPT
SDCategory: Sunwell_Plateau
EndScriptData */
@@ -14,11 +14,6 @@ EndScriptData */
#define ENCOUNTERS 6
-enum GoState{
-CLOSE = 1,
-OPEN = 0
-};
-
/* Sunwell Plateau:
0 - Kalecgos and Sathrovarr
1 - Brutallus
@@ -51,8 +46,8 @@ struct TRINITY_DLL_DECL instance_sunwell_plateau : public ScriptedInstance
/** GameObjects **/
uint64 ForceField; // Kalecgos Encounter
- uint64 FireBarrier; // Brutallus Encounter
- uint64 Gate[5]; // Rename this to be more specific after door placement is verified.
+ uint64 FireBarrier; // Felmysts Encounter
+ uint64 MurusGate[2]; // Murus Encounter
/*** Misc ***/
uint32 SpectralRealmTimer;
@@ -78,11 +73,8 @@ struct TRINITY_DLL_DECL instance_sunwell_plateau : public ScriptedInstance
/*** GameObjects ***/
ForceField = 0;
FireBarrier = 0;
- Gate[0] = 0; // TODO: Rename Gate[n] with gate_<boss name> for better specificity
- Gate[1] = 0;
- Gate[2] = 0;
- Gate[3] = 0;
- Gate[4] = 0;
+ MurusGate[0] = 0;
+ MurusGate[1] = 0;
/*** Encounters ***/
for(uint8 i = 0; i < ENCOUNTERS; ++i)
@@ -144,12 +136,17 @@ struct TRINITY_DLL_DECL instance_sunwell_plateau : public ScriptedInstance
switch(go->GetEntry())
{
case 188421: ForceField = go->GetGUID(); break;
- case 188075: FireBarrier = go->GetGUID(); break;
- case 187979: Gate[0] = go->GetGUID(); break;
- case 187770: Gate[1] = go->GetGUID(); break;
- case 187896: Gate[2] = go->GetGUID(); break;
- case 187990: Gate[3] = go->GetGUID(); break;
- case 188118: Gate[4] = go->GetGUID(); break;
+ case 188075:
+ if(Encounters[2] == DONE)
+ HandleGameObject(NULL, true, go);
+ FireBarrier = go->GetGUID();
+ break;
+ case 187990: MurusGate[0] = go->GetGUID(); break;
+ case 188118:
+ if(Encounters[4] == DONE)
+ HandleGameObject(NULL, true, go);
+ MurusGate[1]= go->GetGUID();
+ break;
}
}
@@ -157,14 +154,13 @@ struct TRINITY_DLL_DECL instance_sunwell_plateau : public ScriptedInstance
{
switch(id)
{
- case DATA_KALECGOS_EVENT: return Encounters[0]; break;
- case DATA_BRUTALLUS_EVENT: return Encounters[1]; break;
- case DATA_FELMYST_EVENT: return Encounters[2]; break;
- case DATA_EREDAR_TWINS_EVENT: return Encounters[3]; break;
- case DATA_MURU_EVENT: return Encounters[4]; break;
- case DATA_KILJAEDEN_EVENT: return Encounters[5]; break;
+ case DATA_KALECGOS_EVENT: return Encounters[0];
+ case DATA_BRUTALLUS_EVENT: return Encounters[1];
+ case DATA_FELMYST_EVENT: return Encounters[2];
+ case DATA_EREDAR_TWINS_EVENT: return Encounters[3];
+ case DATA_MURU_EVENT: return Encounters[4];
+ case DATA_KILJAEDEN_EVENT: return Encounters[5];
}
-
return 0;
}
@@ -172,25 +168,24 @@ struct TRINITY_DLL_DECL instance_sunwell_plateau : public ScriptedInstance
{
switch(id)
{
- case DATA_KALECGOS_DRAGON: return Kalecgos_Dragon; break;
- case DATA_KALECGOS_HUMAN: return Kalecgos_Human; break;
- case DATA_SATHROVARR: return Sathrovarr; break;
- case DATA_BRUTALLUS: return Brutallus; break;
- case DATA_MADRIGOSA: return Madrigosa; break;
- case DATA_FELMYST: return Felmyst; break;
- case DATA_ALYTHESS: return Alythess; break;
- case DATA_SACROLASH: return Sacrolash; break;
- case DATA_MURU: return Muru; break;
- case DATA_KILJAEDEN: return KilJaeden; break;
- case DATA_KILJAEDEN_CONTROLLER: return KilJaedenController; break;
- case DATA_ANVEENA: return Anveena; break;
- case DATA_KALECGOS_KJ: return KalecgosKJ; break;
+ case DATA_KALECGOS_DRAGON: return Kalecgos_Dragon;
+ case DATA_KALECGOS_HUMAN: return Kalecgos_Human;
+ case DATA_SATHROVARR: return Sathrovarr;
+ case DATA_GO_FORCEFIELD: return ForceField;
+ case DATA_BRUTALLUS: return Brutallus;
+ case DATA_MADRIGOSA: return Madrigosa;
+ case DATA_FELMYST: return Felmyst;
+ case DATA_ALYTHESS: return Alythess;
+ case DATA_SACROLASH: return Sacrolash;
+ case DATA_MURU: return Muru;
+ case DATA_KILJAEDEN: return KilJaeden;
+ case DATA_KILJAEDEN_CONTROLLER: return KilJaedenController;
+ case DATA_ANVEENA: return Anveena;
+ case DATA_KALECGOS_KJ: return KalecgosKJ;
case DATA_PLAYER_GUID:
Player* Target = GetPlayerInMap();
return Target->GetGUID();
- break;
}
-
return 0;
}
@@ -202,22 +197,23 @@ struct TRINITY_DLL_DECL instance_sunwell_plateau : public ScriptedInstance
case DATA_BRUTALLUS_EVENT: Encounters[1] = data; break;
case DATA_FELMYST_EVENT:
if(data == DONE)
- HandleGameObject(FireBarrier, OPEN);
+ HandleGameObject(FireBarrier, true);
Encounters[2] = data; break;
case DATA_EREDAR_TWINS_EVENT: Encounters[3] = data; break;
case DATA_MURU_EVENT:
- switch(data){
+ switch(data)
+ {
case DONE:
- HandleGameObject(Gate[4], OPEN);
- HandleGameObject(Gate[3], OPEN);
+ HandleGameObject(MurusGate[0], true);
+ HandleGameObject(MurusGate[1], true);
break;
case IN_PROGRESS:
- HandleGameObject(Gate[4], CLOSE);
- HandleGameObject(Gate[3], CLOSE);
+ HandleGameObject(MurusGate[0], false);
+ HandleGameObject(MurusGate[1], false);
break;
case NOT_STARTED:
- HandleGameObject(Gate[4], CLOSE);
- HandleGameObject(Gate[3], OPEN);
+ HandleGameObject(MurusGate[0], true);
+ HandleGameObject(MurusGate[1], false);
break;
}
Encounters[4] = data; break;
@@ -228,14 +224,6 @@ struct TRINITY_DLL_DECL instance_sunwell_plateau : public ScriptedInstance
SaveToDB();
}
- void SetData64(uint32 id, uint64 guid)
- {
- }
-
- void Update(uint32 diff)
- {
- }
-
std::string GetSaveData()
{
OUT_SAVE_INST_DATA;
@@ -249,7 +237,6 @@ struct TRINITY_DLL_DECL instance_sunwell_plateau : public ScriptedInstance
OUT_SAVE_INST_DATA_COMPLETE;
return out;
}
-
return NULL;
}
@@ -280,6 +267,7 @@ InstanceData* GetInstanceData_instance_sunwell_plateau(Map* map)
void AddSC_instance_sunwell_plateau()
{
Script *newscript;
+
newscript = new Script;
newscript->Name = "instance_sunwell_plateau";
newscript->GetInstanceData = &GetInstanceData_instance_sunwell_plateau;
diff --git a/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_kaelthas.cpp b/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_kaelthas.cpp
index 1ebf18efa94..b33a3030e1d 100644
--- a/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_kaelthas.cpp
+++ b/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_kaelthas.cpp
@@ -144,7 +144,7 @@ float KaelthasWeapons[7][5] =
#define GRAVITY_Z 70.0f
#define TIME_PHASE_2_3 120000
-#define TIME_PHASE_3_4 120000
+#define TIME_PHASE_3_4 180000
#define KAEL_VISIBLE_RANGE 50.0f
#define ROOM_BASE_Z 49.0f
@@ -160,6 +160,7 @@ struct TRINITY_DLL_DECL advisorbase_ai : public ScriptedAI
advisorbase_ai(Creature *c) : ScriptedAI(c)
{
pInstance = c->GetInstanceData();
+ FakeDeath = false;
}
void MoveInLineOfSight(Unit *who)
@@ -180,6 +181,9 @@ struct TRINITY_DLL_DECL advisorbase_ai : public ScriptedAI
void Reset()
{
+ if (FakeDeath)
+ m_creature->SetMaxHealth(m_creature->GetMaxHealth() / 2);
+
m_creature->SetNoCallAssistance(true);
FakeDeath = false;
DelayRes_Timer = 0;
@@ -238,7 +242,10 @@ struct TRINITY_DLL_DECL advisorbase_ai : public ScriptedAI
m_creature->SetUInt64Value(UNIT_FIELD_TARGET,0);
m_creature->GetMotionMaster()->Clear();
m_creature->GetMotionMaster()->MoveIdle();
- m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1,UNIT_STAND_STATE_DEAD);
+ m_creature->SetStandState(UNIT_STAND_STATE_DEAD);
+
+ // Double health for Phase 3
+ m_creature->SetMaxHealth(m_creature->GetMaxHealth() * 2);
if (pInstance->GetData(DATA_KAELTHASEVENT) == 3)
JustDied(pKiller);
diff --git a/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_twinemperors.cpp b/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_twinemperors.cpp
index 3089f3267c8..9449524412c 100644
--- a/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_twinemperors.cpp
+++ b/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_twinemperors.cpp
@@ -312,40 +312,18 @@ struct TRINITY_DLL_DECL boss_twinemperorsAI : public ScriptedAI
}
}
- class AnyBugCheck
- {
- public:
- AnyBugCheck(WorldObject const* obj, float range) : i_obj(obj), i_range(range) {}
- bool operator()(Creature* u)
- {
- Creature *c = u;
- if (!i_obj->IsWithinDistInMap(c, i_range))
- return false;
- return (c->GetEntry() == 15316 || c->GetEntry() == 15317);
- }
- private:
- WorldObject const* i_obj;
- float i_range;
- };
-
Creature *RespawnNearbyBugsAndGetOne()
{
- CellPair p(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY()));
- Cell cell(p);
- cell.data.Part.reserved = ALL_DISTRICT;
- cell.SetNoCreate();
-
- std::list<Creature*> unitList;
+ std::list<Creature*> lUnitList;
+ m_creature->GetCreatureListWithEntryInGrid(lUnitList,15316,150.0f);
+ m_creature->GetCreatureListWithEntryInGrid(lUnitList,15317,150.0f);
- AnyBugCheck u_check(m_creature, 150);
- Trinity::CreatureListSearcher<AnyBugCheck> searcher(m_creature, unitList, u_check);
- TypeContainerVisitor<Trinity::CreatureListSearcher<AnyBugCheck>, GridTypeMapContainer > grid_creature_searcher(searcher);
- CellLock<GridReadGuard> cell_lock(cell, p);
- cell_lock->Visit(cell_lock, grid_creature_searcher, *(m_creature->GetMap()));
+ if (lUnitList.empty())
+ return NULL;
Creature *nearb = NULL;
- for(std::list<Creature*>::iterator iter = unitList.begin(); iter != unitList.end(); ++iter)
+ for(std::list<Creature*>::iterator iter = lUnitList.begin(); iter != lUnitList.end(); ++iter)
{
Creature *c = *iter;
if (c)
diff --git a/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/mob_anubisath_sentinel.cpp b/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/mob_anubisath_sentinel.cpp
index b45097d7f97..377c19ec491 100644
--- a/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/mob_anubisath_sentinel.cpp
+++ b/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/mob_anubisath_sentinel.cpp
@@ -53,21 +53,6 @@ EndScriptData */
#define SPELL_STORM_BUFF 2148
#define SPELL_STORM 26546
-class NearbyAQSentinel
-{
- public:
- NearbyAQSentinel(Unit const* obj) : i_obj(obj) {}
- bool operator()(Unit* u)
- {
- if (u->GetEntry() == 15264 && i_obj->IsWithinDistInMap(u, 70) && !u->isDead())
- return true;
- else
- return false;
- }
- private:
- Unit const* i_obj;
-};
-
struct TRINITY_DLL_DECL aqsentinelAI;
class TRINITY_DLL_DECL SentinelAbilityAura : public Aura
{
@@ -166,18 +151,11 @@ struct TRINITY_DLL_DECL aqsentinelAI : public ScriptedAI
void AddSentinelsNear(Unit *nears)
{
- CellPair p(Trinity::ComputeCellPair(nears->GetPositionX(), nears->GetPositionY()));
- Cell cell(p);
- cell.data.Part.reserved = ALL_DISTRICT;
- cell.SetNoCreate();
-
std::list<Creature*> assistList;
+ m_creature->GetCreatureListWithEntryInGrid(assistList,15264,70.0f);
- NearbyAQSentinel u_check(nears);
- Trinity::CreatureListSearcher<NearbyAQSentinel> searcher(m_creature, assistList, u_check);
- TypeContainerVisitor<Trinity::CreatureListSearcher<NearbyAQSentinel>, GridTypeMapContainer > grid_creature_searcher(searcher);
- CellLock<GridReadGuard> cell_lock(cell, p);
- cell_lock->Visit(cell_lock, grid_creature_searcher, *(nears->GetMap()));
+ if (assistList.empty())
+ return;
for(std::list<Creature*>::iterator iter = assistList.begin(); iter != assistList.end(); ++iter)
AddBuddyToList((*iter));
@@ -240,8 +218,6 @@ struct TRINITY_DLL_DECL aqsentinelAI : public ScriptedAI
}
ClearBudyList();
gatherOthersWhenAggro = true;
- m_creature->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, false);
- m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_ATTACK_ME, false);
}
void GainSentinelAbility(uint32 id)
@@ -256,12 +232,6 @@ struct TRINITY_DLL_DECL aqsentinelAI : public ScriptedAI
}
SentinelAbilityAura *a = new SentinelAbilityAura(this, (SpellEntry*)spell, id, eff_mask);
m_creature->AddAura(a);
-
- if (id == SPELL_KNOCK_BUFF)
- {
- m_creature->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true);
- m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_ATTACK_ME, true);
- }
}
void EnterCombat(Unit *who)
diff --git a/src/bindings/scripts/scripts/zone/westfall/westfall.cpp b/src/bindings/scripts/scripts/zone/westfall/westfall.cpp
index f9e04a5186f..3548e9ee089 100644
--- a/src/bindings/scripts/scripts/zone/westfall/westfall.cpp
+++ b/src/bindings/scripts/scripts/zone/westfall/westfall.cpp
@@ -84,24 +84,23 @@ struct TRINITY_DLL_DECL npc_daphne_stilwellAI : public npc_escortAI
{
case 4:
SetEquipmentSlots(false, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE, EQUIP_ID_RIFLE);
- SetSheathState(SHEATH_STATE_RANGED);
+ m_creature->SetSheath(SHEATH_STATE_RANGED);
m_creature->HandleEmoteCommand(EMOTE_STATE_USESTANDING_NOSHEATHE);
break;
- case 6:
- SetCombatMovement(false);
- break;
case 7:
m_creature->SummonCreature(NPC_DEFIAS_RAIDER, -11450.836, 1569.755, 54.267, 4.230, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
m_creature->SummonCreature(NPC_DEFIAS_RAIDER, -11449.697, 1569.124, 54.421, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
m_creature->SummonCreature(NPC_DEFIAS_RAIDER, -11448.237, 1568.307, 54.620, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
break;
case 8:
+ m_creature->SetSheath(SHEATH_STATE_RANGED);
m_creature->SummonCreature(NPC_DEFIAS_RAIDER, -11450.836, 1569.755, 54.267, 4.230, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
m_creature->SummonCreature(NPC_DEFIAS_RAIDER, -11449.697, 1569.124, 54.421, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
m_creature->SummonCreature(NPC_DEFIAS_RAIDER, -11448.237, 1568.307, 54.620, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
m_creature->SummonCreature(NPC_DEFIAS_RAIDER, -11448.037, 1570.213, 54.961, 4.283, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
break;
case 9:
+ m_creature->SetSheath(SHEATH_STATE_RANGED);
m_creature->SummonCreature(NPC_DEFIAS_RAIDER, -11450.836, 1569.755, 54.267, 4.230, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
m_creature->SummonCreature(NPC_DEFIAS_RAIDER, -11449.697, 1569.124, 54.421, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
m_creature->SummonCreature(NPC_DEFIAS_RAIDER, -11448.237, 1568.307, 54.620, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
@@ -115,9 +114,9 @@ struct TRINITY_DLL_DECL npc_daphne_stilwellAI : public npc_escortAI
DoScriptText(SAY_DS_PROLOGUE, m_creature);
break;
case 13:
- SetSheathState(SHEATH_STATE_UNARMED);
- m_creature->HandleEmoteCommand(EMOTE_STATE_USESTANDING_NOSHEATHE);
SetEquipmentSlots(true);
+ m_creature->SetSheath(SHEATH_STATE_UNARMED);
+ m_creature->HandleEmoteCommand(EMOTE_STATE_USESTANDING_NOSHEATHE);
break;
case 17:
pPlayer->GroupEventHappens(QUEST_TOME_VALOR, m_creature);
@@ -125,6 +124,21 @@ struct TRINITY_DLL_DECL npc_daphne_stilwellAI : public npc_escortAI
}
}
+ void AttackStart(Unit* pWho)
+ {
+ if (!pWho)
+ return;
+
+ if (m_creature->Attack(pWho, false))
+ {
+ m_creature->AddThreat(pWho, 0.0f);
+ m_creature->SetInCombatWith(pWho);
+ pWho->SetInCombatWith(m_creature);
+
+ m_creature->GetMotionMaster()->MoveChase(pWho, 30.0f);
+ }
+ }
+
void JustSummoned(Creature* pSummoned)
{
pSummoned->AI()->AttackStart(m_creature);
@@ -148,14 +162,10 @@ struct TRINITY_DLL_DECL npc_daphne_stilwellAI : public npc_escortAI
if (uiShootTimer < diff)
{
- if (m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE))
- SetCombatMovement(true);
- else
- SetCombatMovement(false);
-
uiShootTimer = 1500;
- DoCast(m_creature->getVictim(), SPELL_SHOOT);
+ if (!m_creature->IsWithinDist(m_creature->getVictim(), ATTACK_DISTANCE))
+ DoCast(m_creature->getVictim(), SPELL_SHOOT);
}else uiShootTimer -= diff;
}
};
diff --git a/src/bindings/scripts/scripts/zone/zuldrak/zuldrak.cpp b/src/bindings/scripts/scripts/zone/zuldrak/zuldrak.cpp
new file mode 100644
index 00000000000..bcb2d1f4957
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/zuldrak/zuldrak.cpp
@@ -0,0 +1,187 @@
+/*
+ * Copyright (C) 2009 Trinity <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "precompiled.h"
+
+/*####
+## npc_drakuru_shackles
+####*/
+
+enum
+{
+ SPELL_LEFT_CHAIN = 59951,
+ SPELL_RIGHT_CHAIN = 59952,
+ SPELL_UNLOCK_SHACKLE = 55083,
+ SPELL_FREE_RAGECLAW = 55223,
+
+ NPC_RAGECLAW = 29686
+};
+
+struct TRINITY_DLL_DECL npc_drakuru_shacklesAI : public ScriptedAI
+{
+ npc_drakuru_shacklesAI(Creature *c) : ScriptedAI(c) {}
+
+ Unit* Rageclaw;
+
+ void Reset()
+ {
+ m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+ float x, y, z;
+ Rageclaw = NULL;
+ m_creature->GetClosePoint(x, y, z, m_creature->GetObjectSize()/3,0.1);
+ if (Unit* summon = m_creature->SummonCreature(NPC_RAGECLAW,x,y,z,0,TEMPSUMMON_DEAD_DESPAWN,1000))
+ DoActionOnRageclaw(true,summon);
+ }
+
+ void DoActionOnRageclaw(bool locking, Unit *who)
+ {
+ if (!who)
+ return;
+
+ if (locking)
+ {
+ if (who)
+ {
+ Rageclaw = who;
+
+ m_creature->SetInFront(Rageclaw);
+ Rageclaw->SetInFront(m_creature);
+
+ m_creature->CastSpell(Rageclaw, SPELL_LEFT_CHAIN, true);
+ m_creature->CastSpell(Rageclaw, SPELL_RIGHT_CHAIN, true);
+ }
+ }
+ else
+ {
+ DoCast(Rageclaw, SPELL_FREE_RAGECLAW, true);
+ CAST_PLR(who)->KilledMonsterCredit(NPC_RAGECLAW, Rageclaw->GetGUID());
+ m_creature->setDeathState(DEAD);
+ }
+ }
+
+ void SpellHit(Unit *caster, const SpellEntry *spell)
+ {
+ if (spell->Id == SPELL_UNLOCK_SHACKLE)
+ {
+ if (Rageclaw)
+ DoActionOnRageclaw(false,caster);
+ else
+ m_creature->setDeathState(JUST_DIED);
+
+ }
+ }
+};
+
+CreatureAI* GetAI_npc_drakuru_shackles(Creature *_Creature)
+{
+ return new npc_drakuru_shacklesAI (_Creature);
+}
+
+
+/*####
+## npc_captured_rageclaw
+####*/
+
+enum
+{
+ SPELL_UNSHACKLED = 55085,
+ SPELL_KNEEL = 39656
+};
+
+const char * SAY_RAGECLAW_1 = "I poop on you, trollses!";
+const char * SAY_RAGECLAW_2 = "ARRRROOOOGGGGAAAA!";
+const char * SAY_RAGECLAW_3 = "No more mister nice wolvar!";
+#define SAY_RAGECLAW RAND(SAY_RAGECLAW_1,SAY_RAGECLAW_2,SAY_RAGECLAW_3)
+
+struct TRINITY_DLL_DECL npc_captured_rageclawAI : public ScriptedAI
+{
+ npc_captured_rageclawAI(Creature *c) : ScriptedAI(c) {}
+
+ uint32 DespawnTimer;
+ bool Despawn;
+
+ void Reset()
+ {
+ Despawn = false;
+ DespawnTimer = 0;
+ m_creature->setFaction(35);
+ m_creature->CastSpell(m_creature, SPELL_KNEEL, true); // Little Hack for kneel - Thanks Illy :P
+ }
+
+ void MoveInLineOfSight(Unit *who){}
+
+ void SpellHit(Unit *caster, const SpellEntry *spell)
+ {
+ if (spell->Id == SPELL_FREE_RAGECLAW)
+ {
+ if (m_creature->GetDummyAura(SPELL_LEFT_CHAIN))
+ m_creature->RemoveAurasDueToSpell(SPELL_LEFT_CHAIN);
+
+ if (m_creature->GetDummyAura(SPELL_RIGHT_CHAIN))
+ m_creature->RemoveAurasDueToSpell(SPELL_RIGHT_CHAIN);
+
+ if (m_creature->GetDummyAura(SPELL_KNEEL))
+ m_creature->RemoveAurasDueToSpell(SPELL_KNEEL);
+
+ m_creature->setFaction(m_creature->GetCreatureInfo()->faction_H);
+
+ DoCast(m_creature, SPELL_UNSHACKLED, true);
+ DoSay(SAY_RAGECLAW, LANG_UNIVERSAL, NULL);
+ m_creature->GetMotionMaster()->MoveRandom(10);
+
+ DespawnTimer = 10000;
+ Despawn = true;
+ }
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ if (m_creature->getVictim())
+ {
+ DoMeleeAttackIfReady();
+ return;
+ }
+
+ if (!Despawn)
+ return;
+
+ if (DespawnTimer < diff)
+ m_creature->setDeathState(JUST_DIED);
+ else DespawnTimer-=diff;
+ }
+};
+
+CreatureAI* GetAI_npc_captured_rageclaw(Creature *_Creature)
+{
+ return new npc_captured_rageclawAI (_Creature);
+}
+
+void AddSC_zuldrak()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="npc_drakuru_shackles";
+ newscript->GetAI = &GetAI_npc_drakuru_shackles;
+ newscript->RegisterSelf();
+
+ newscript = new Script;
+ newscript->Name="npc_captured_rageclaw";
+ newscript->GetAI = &GetAI_npc_captured_rageclaw;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/zulgurub/boss_marli.cpp b/src/bindings/scripts/scripts/zone/zulgurub/boss_marli.cpp
index b3b92cbc2c7..895e91c13c6 100644
--- a/src/bindings/scripts/scripts/zone/zulgurub/boss_marli.cpp
+++ b/src/bindings/scripts/scripts/zone/zulgurub/boss_marli.cpp
@@ -71,9 +71,6 @@ struct TRINITY_DLL_DECL boss_marliAI : public ScriptedAI
Spawned = false;
PhaseTwo = false;
-
- m_creature->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true);
- m_creature->ApplySpellImmune(1, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, true);
}
void EnterCombat(Unit *who)
diff --git a/src/bindings/scripts/scripts/zone/zulgurub/boss_thekal.cpp b/src/bindings/scripts/scripts/zone/zulgurub/boss_thekal.cpp
index 76d3d5268e9..5cd5fc61d8f 100644
--- a/src/bindings/scripts/scripts/zone/zulgurub/boss_thekal.cpp
+++ b/src/bindings/scripts/scripts/zone/zulgurub/boss_thekal.cpp
@@ -117,8 +117,7 @@ struct TRINITY_DLL_DECL boss_thekalAI : public ScriptedAI
if(pInstance->GetData(DATA_LORKHANISDEAD))
{
//Resurrect LorKhan
- Unit *pLorKhan = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_LORKHAN));
- if(pLorKhan)
+ if(Unit *pLorKhan = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_LORKHAN)))
{
pLorKhan->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
pLorKhan->setFaction(14);
@@ -336,8 +335,7 @@ struct TRINITY_DLL_DECL mob_zealot_lorkhanAI : public ScriptedAI
if(pInstance->GetData(DATA_THEKALISFAKEDEAD))
{
//Resurrect Thekal
- Unit *pThekal = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_THEKAL));
- if(pThekal)
+ if(Unit *pThekal = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_THEKAL)))
{
pThekal->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
pThekal->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
@@ -349,8 +347,7 @@ struct TRINITY_DLL_DECL mob_zealot_lorkhanAI : public ScriptedAI
if(pInstance->GetData(DATA_ZATHISDEAD))
{
//Resurrect Zath
- Unit *pZath = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_ZATH));
- if(pZath)
+ if(Unit *pZath = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_ZATH)))
{
pZath->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
pZath->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
@@ -473,8 +470,7 @@ struct TRINITY_DLL_DECL mob_zealot_zathAI : public ScriptedAI
if(pInstance->GetData(DATA_LORKHANISDEAD))
{
//Resurrect LorKhan
- Unit *pLorKhan = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_LORKHAN));
- if(pLorKhan)
+ if(Unit *pLorKhan = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_LORKHAN)))
{
pLorKhan->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
pLorKhan->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
@@ -486,8 +482,7 @@ struct TRINITY_DLL_DECL mob_zealot_zathAI : public ScriptedAI
if(pInstance->GetData(DATA_THEKALISFAKEDEAD))
{
//Resurrect Thekal
- Unit *pThekal = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_THEKAL));
- if(pThekal)
+ if(Unit *pThekal = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_THEKAL)))
{
pThekal->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
pThekal->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
diff --git a/src/framework/Platform/Define.h b/src/framework/Platform/Define.h
index 8f10fc20020..35bc07f5656 100644
--- a/src/framework/Platform/Define.h
+++ b/src/framework/Platform/Define.h
@@ -145,8 +145,17 @@ typedef uint64 OBJECT_HANDLE;
#define MaNGOS Trinity
#define MANGOS_DLL_DECL TRINITY_DLL_DECL
#define MANGOS_DLL_SPEC TRINITY_DLL_SPEC
-#define MANGOS_DEBUG TRINITY_DEBUG
#define GetMangosString GetTrinityString
+#if defined(MANGOS_DEBUG) || defined(TRINITY_DEBUG)
+# ifndef TRINITY_DEBUG
+# define TRINITY_DEBUG
+# endif
+# ifndef MANGOS_DEBUG
+# define MANGOS_DEBUG
+# endif
+#endif
+
+
#endif //TRINITY_DEFINE_H
diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp
index 9ae5678c752..4dcc603afc4 100644
--- a/src/game/Chat.cpp
+++ b/src/game/Chat.cpp
@@ -373,6 +373,7 @@ ChatCommand * ChatHandler::getCommandTable()
{ "tame", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcTameCommand, "", NULL },
{ "setdeathstate", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcSetDeathStateCommand, "", NULL },
{ "addformation", SEC_MODERATOR, false, &ChatHandler::HandleNpcAddFormationCommand, "", NULL },
+ { "setlink", SEC_MODERATOR, false, &ChatHandler::HandleNpcSetLinkCommand, "", NULL },
//{ TODO: fix or remove this commands
{ "addweapon", SEC_ADMINISTRATOR, false, &ChatHandler::HandleNpcAddWeaponCommand, "", NULL },
@@ -479,7 +480,6 @@ ChatCommand * ChatHandler::getCommandTable()
{ "skill_extra_item_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSkillExtraItemTemplateCommand, "", NULL },
{ "skill_fishing_base_level", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSkillFishingBaseLevelCommand, "", NULL },
{ "skinning_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesSkinningCommand, "", NULL },
- { "spell_affect", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellAffectCommand, "", NULL },
{ "spell_required", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellRequiredCommand, "", NULL },
{ "spell_area", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellAreaCommand, "", NULL },
{ "spell_bonus_data", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellBonusesCommand, "", NULL },
@@ -548,7 +548,6 @@ ChatCommand * ChatHandler::getCommandTable()
{
{ "cancel", SEC_ADMINISTRATOR, true, &ChatHandler::HandleServerShutDownCancelCommand,"", NULL },
{ "" , SEC_ADMINISTRATOR, true, &ChatHandler::HandleServerShutDownCommand, "", NULL },
- { "setlink", SEC_MODERATOR, false, &ChatHandler::HandleNpcSetLinkCommand, "", NULL },
{ NULL, 0, false, NULL, "", NULL }
};
diff --git a/src/game/Chat.h b/src/game/Chat.h
index 55116bae711..be4ad5f31c2 100644
--- a/src/game/Chat.h
+++ b/src/game/Chat.h
@@ -399,7 +399,6 @@ class ChatHandler
bool HandleReloadSkillDiscoveryTemplateCommand(const char* args);
bool HandleReloadSkillExtraItemTemplateCommand(const char* args);
bool HandleReloadSkillFishingBaseLevelCommand(const char* args);
- bool HandleReloadSpellAffectCommand(const char* args);
bool HandleReloadSpellRequiredCommand(const char* args);
bool HandleReloadSpellAreaCommand(const char* args);
bool HandleReloadSpellElixirCommand(const char* args);
diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp
index 80fb7e43fec..a1f37c65f1e 100644
--- a/src/game/Creature.cpp
+++ b/src/game/Creature.cpp
@@ -2102,6 +2102,10 @@ bool Creature::CanAssistTo(const Unit* u, const Unit* enemy, bool checkfaction /
if (!isAlive())
return false;
+ // we don't need help from non-combatant ;)
+ if (isCivilian())
+ return false;
+
// skip fighting creature
if (isInCombat())
return false;
diff --git a/src/game/CreatureEventAI.cpp b/src/game/CreatureEventAI.cpp
index b9b3d5bb488..6e8ac6a4909 100644
--- a/src/game/CreatureEventAI.cpp
+++ b/src/game/CreatureEventAI.cpp
@@ -30,6 +30,7 @@
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "InstanceData.h"
+#include "SpellMgr.h"
bool CreatureEventAIHolder::UpdateRepeatTimer( Creature* creature, uint32 repeatMin, uint32 repeatMax )
{
@@ -1297,7 +1298,7 @@ bool CreatureEventAI::CanCast(Unit* Target, SpellEntry const *Spell, bool Trigge
return false;
//Check for power
- if (!Triggered && me->GetPower((Powers)Spell->powerType) < Spell->manaCost)
+ if (!Triggered && me->GetPower((Powers)Spell->powerType) < CalculatePowerCost(Spell, me, GetSpellSchoolMask(Spell)))
return false;
SpellRangeEntry const *TempRange = NULL;
diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp
index 199e3c2d432..59ec04fc649 100644
--- a/src/game/GameObject.cpp
+++ b/src/game/GameObject.cpp
@@ -54,7 +54,6 @@ GameObject::GameObject() : WorldObject(), m_goValue(new GameObjectValue)
m_spawnedByDefault = true;
m_usetimes = 0;
m_spellId = 0;
- m_charges = 5;
m_cooldownTime = 0;
m_goInfo = NULL;
m_goData = NULL;
@@ -188,9 +187,6 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMa
switch(goinfo->type)
{
- case GAMEOBJECT_TYPE_SPELLCASTER:
- m_charges = goinfo->spellcaster.charges;
- break;
case GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING:
m_goValue->building.health = goinfo->building.intactNumHits + goinfo->building.damagedNumHits;
break;
@@ -309,87 +305,94 @@ void GameObject::Update(uint32 /*p_time*/)
}
}
- // traps can have time and can not have
- GameObjectInfo const* goInfo = GetGOInfo();
- if(goInfo->type == GAMEOBJECT_TYPE_TRAP)
+ if(isSpawned())
{
- // traps
- Unit* owner = GetOwner();
- Unit* ok = NULL; // pointer to appropriate target if found any
+ // traps can have time and can not have
+ GameObjectInfo const* goInfo = GetGOInfo();
+ if(goInfo->type == GAMEOBJECT_TYPE_TRAP)
+ {
+ if(m_cooldownTime >= time(NULL))
+ return;
- if(m_cooldownTime >= time(NULL))
- return;
+ // traps
+ Unit* owner = GetOwner();
+ Unit* ok = NULL; // pointer to appropriate target if found any
- bool IsBattleGroundTrap = false;
- //FIXME: this is activation radius (in different casting radius that must be selected from spell data)
- //TODO: move activated state code (cast itself) to GO_ACTIVATED, in this place only check activating and set state
- float radius = goInfo->trap.radius;
- if(!radius) // i think this is a hack, spell radius is determined by trap radius (spell itself does not have radius)
- if(const SpellEntry *spellEntry = sSpellStore.LookupEntry(m_spellId))
- radius = goInfo->trap.radius;
- if(!radius)
- {
- if(goInfo->trap.cooldown == 3) // cast in other case (at some triggering/linked go/etc explicit call)
+ bool IsBattleGroundTrap = false;
+ //FIXME: this is activation radius (in different casting radius that must be selected from spell data)
+ //TODO: move activated state code (cast itself) to GO_ACTIVATED, in this place only check activating and set state
+ float radius = goInfo->trap.radius;
+ if(!radius)
{
- if(m_respawnTime > 0)
- break;
+ if(goInfo->trap.cooldown != 3) // cast in other case (at some triggering/linked go/etc explicit call)
+ return;
+ else
+ {
+ if(m_respawnTime > 0)
+ break;
+
+ radius = goInfo->trap.cooldown; // battlegrounds gameobjects has data2 == 0 && data5 == 3
+ IsBattleGroundTrap = true;
- radius = goInfo->trap.cooldown; // battlegrounds gameobjects has data2 == 0 && data5 == 3
- IsBattleGroundTrap = true;
+ if(!radius)
+ return;
+ }
}
- if(!radius)
- return;
- }
- // Note: this hack with search required until GO casting not implemented
- // search unfriendly creature
- if(owner) // hunter trap
- {
- Trinity::AnyUnfriendlyNoTotemUnitInObjectRangeCheck checker(this, owner, radius);
- Trinity::UnitSearcher<Trinity::AnyUnfriendlyNoTotemUnitInObjectRangeCheck> searcher(this, ok, checker);
- VisitNearbyGridObject(radius, searcher);
- if(!ok) VisitNearbyWorldObject(radius, searcher);
- }
- else // environmental trap
- {
- // environmental damage spells already have around enemies targeting but this not help in case not existed GO casting support
- // affect only players
- Player* player = NULL;
- MaNGOS::AnyPlayerInObjectRangeCheck checker(this, radius);
- MaNGOS::PlayerSearcher<MaNGOS::AnyPlayerInObjectRangeCheck> searcher(this, player, checker);
- VisitNearbyWorldObject(radius, searcher);
- ok = player;
- }
+ // Note: this hack with search required until GO casting not implemented
+ // search unfriendly creature
+ if(owner) // hunter trap
+ {
+ Trinity::AnyUnfriendlyNoTotemUnitInObjectRangeCheck checker(this, owner, radius);
+ Trinity::UnitSearcher<Trinity::AnyUnfriendlyNoTotemUnitInObjectRangeCheck> searcher(this, ok, checker);
+ VisitNearbyGridObject(radius, searcher);
+ if(!ok) VisitNearbyWorldObject(radius, searcher);
+ }
+ else // environmental trap
+ {
+ // environmental damage spells already have around enemies targeting but this not help in case not existed GO casting support
+ // affect only players
+ Player* player = NULL;
+ MaNGOS::AnyPlayerInObjectRangeCheck checker(this, radius);
+ MaNGOS::PlayerSearcher<MaNGOS::AnyPlayerInObjectRangeCheck> searcher(this, player, checker);
+ VisitNearbyWorldObject(radius, searcher);
+ ok = player;
+ }
+
+ if (ok)
+ {
+ // some traps do not have spell but should be triggered
+ if(goInfo->trap.spellId)
+ CastSpell(ok, goInfo->trap.spellId);
- if (ok)
- {
- // some traps do not have spell but should be triggered
- if(goInfo->trap.spellId)
- CastSpell(ok, goInfo->trap.spellId);
- //Unit *caster = owner ? owner : ok;
- //caster->CastSpell(ok, goInfo->trap.spellId, true, 0, 0, GetGUID());
-
- if(goInfo->trap.cooldown)
- m_cooldownTime = time(NULL) + goInfo->trap.cooldown;
- else
m_cooldownTime = time(NULL) + 4; // 4 seconds
- if(owner)
- SetLootState(GO_JUST_DEACTIVATED); // can be despawned or destroyed
+ // count charges
+ //if(goInfo->trap.charges > 0)
+ // AddUse();
+
+ if(owner)
+ SetLootState(GO_JUST_DEACTIVATED);
- if(IsBattleGroundTrap && ok->GetTypeId() == TYPEID_PLAYER)
+ if(IsBattleGroundTrap && ok->GetTypeId() == TYPEID_PLAYER)
+ {
+ //BattleGround gameobjects case
+ if(((Player*)ok)->InBattleGround())
+ if(BattleGround *bg = ((Player*)ok)->GetBattleGround())
+ bg->HandleTriggerBuff(GetGUID());
+ }
+ }
+ }
+ else if(uint32 max_charges = goInfo->GetCharges())
+ {
+ if (m_usetimes >= max_charges)
{
- //BattleGround gameobjects case
- if(((Player*)ok)->InBattleGround())
- if(BattleGround *bg = ((Player*)ok)->GetBattleGround())
- bg->HandleTriggerBuff(GetGUID());
+ m_usetimes = 0;
+ SetLootState(GO_JUST_DEACTIVATED); // can be despawned or destroyed
}
}
}
- if (m_charges && m_usetimes >= m_charges)
- SetLootState(GO_JUST_DEACTIVATED); // can be despawned or destroyed
-
break;
}
case GO_ACTIVATED:
diff --git a/src/game/GameObject.h b/src/game/GameObject.h
index 763117de167..97c532605d3 100644
--- a/src/game/GameObject.h
+++ b/src/game/GameObject.h
@@ -444,6 +444,17 @@ struct GameObjectInfo
}
}
+ uint32 GetCharges() const // despawn at uses amount
+ {
+ switch(type)
+ {
+ //case GAMEOBJECT_TYPE_TRAP: return trap.charges;
+ case GAMEOBJECT_TYPE_GUARDPOST: return guardpost.charges;
+ case GAMEOBJECT_TYPE_SPELLCASTER: return spellcaster.charges;
+ default: return 0;
+ }
+ }
+
uint32 GetLinkedGameObjectEntry() const
{
switch(type)
@@ -692,7 +703,6 @@ class TRINITY_DLL_SPEC GameObject : public WorldObject
uint64 GetRotation() const { return m_rotation; }
protected:
- uint32 m_charges; // Spell charges for GAMEOBJECT_TYPE_SPELLCASTER (22)
uint32 m_spellId;
time_t m_respawnTime; // (secs) time of next respawn (or despawn if GO have owner()),
uint32 m_respawnDelayTime; // (secs) if 0 then current GO state no dependent from timer
diff --git a/src/game/GridNotifiers.h b/src/game/GridNotifiers.h
index 64deb0d3123..997f0806369 100644
--- a/src/game/GridNotifiers.h
+++ b/src/game/GridNotifiers.h
@@ -1135,48 +1135,69 @@ namespace Trinity
Unit const* pUnit;
};
- class AllGameObjectsWithEntryInGrid
+ class AllGameObjectsWithEntryInRange
{
public:
- AllGameObjectsWithEntryInGrid(uint32 ent) : entry(ent) {}
- bool operator() (GameObject* g)
+ AllGameObjectsWithEntryInRange(const WorldObject* pObject, uint32 uiEntry, float fMaxRange) : m_pObject(pObject), m_uiEntry(uiEntry), m_fRange(fMaxRange) {}
+ bool operator() (GameObject* pGo)
{
- if(g->GetEntry() == entry)
+ if (pGo->GetEntry() == m_uiEntry && m_pObject->IsWithinDist(pGo,m_fRange,false))
return true;
return false;
}
private:
- uint32 entry;
+ const WorldObject* m_pObject;
+ uint32 m_uiEntry;
+ float m_fRange;
};
- class GameObjectInRangeCheck
+ class AllCreaturesOfEntryInRange
{
- public:
- GameObjectInRangeCheck(float _x, float _y, float _z, float _range) : x(_x), y(_y), z(_z), range(_range) {}
- bool operator() (GameObject* go)
- {
- return go->IsInRange(x, y, z, range);
- }
- private:
- float x, y, z, range;
+ public:
+ AllCreaturesOfEntryInRange(const WorldObject* pObject, uint32 uiEntry, float fMaxRange) : m_pObject(pObject), m_uiEntry(uiEntry), m_fRange(fMaxRange) {}
+ bool operator() (Unit* pUnit)
+ {
+ if (pUnit->GetEntry() == m_uiEntry && m_pObject->IsWithinDist(pUnit,m_fRange,false))
+ return true;
+
+ return false;
+ }
+
+ private:
+ const WorldObject* m_pObject;
+ uint32 m_uiEntry;
+ float m_fRange;
};
- class AllCreaturesOfEntryInRange
+ class PlayerAtMinimumRangeAway
{
public:
- AllCreaturesOfEntryInRange(Unit const* obj, uint32 ent, float ran) : pUnit(obj), entry(ent), range(ran) {}
- bool operator() (Unit* u)
+ PlayerAtMinimumRangeAway(Unit const* unit, float fMinRange) : pUnit(unit), fRange(fMinRange) {}
+ bool operator() (Player* pPlayer)
{
- if(u->GetEntry() == entry && pUnit->IsWithinDistInMap(u, range))
+ //No threat list check, must be done explicit if expected to be in combat with creature
+ if (!pPlayer->isGameMaster() && pPlayer->isAlive() && !pUnit->IsWithinDist(pPlayer,fRange,false))
return true;
return false;
}
+
private:
Unit const* pUnit;
- uint32 entry;
- float range;
+ float fRange;
+ };
+
+ class GameObjectInRangeCheck
+ {
+ public:
+ GameObjectInRangeCheck(float _x, float _y, float _z, float _range) : x(_x), y(_y), z(_z), range(_range) {}
+ bool operator() (GameObject* go)
+ {
+ return go->IsInRange(x, y, z, range);
+ }
+ private:
+ float x, y, z, range;
};
// Player checks and do
diff --git a/src/game/Guild.cpp b/src/game/Guild.cpp
index cabf4528878..a7a5d8f5e23 100644
--- a/src/game/Guild.cpp
+++ b/src/game/Guild.cpp
@@ -713,40 +713,40 @@ void Guild::Roster(WorldSession *session)
data << (uint32)m_ranks.size();
for (RankList::const_iterator ritr = m_ranks.begin(); ritr != m_ranks.end(); ++ritr)
{
- data << (uint32)ritr->rights;
- data << (uint32)ritr->BankMoneyPerDay; // count of: withdraw gold(gold/day) Note: in game set gold, in packet set bronze.
- for (uint8 i = 0; i < GUILD_BANK_MAX_TABS; ++i)
+ data << uint32(ritr->rights);
+ data << uint32(ritr->BankMoneyPerDay); // count of: withdraw gold(gold/day) Note: in game set gold, in packet set bronze.
+ for (int i = 0; i < GUILD_BANK_MAX_TABS; ++i)
{
- data << (uint32)ritr->TabRight[i]; // for TAB_i rights: view tabs = 0x01, deposit items =0x02
- data << (uint32)ritr->TabSlotPerDay[i]; // for TAB_i count of: withdraw items(stack/day)
+ data << uint32(ritr->TabRight[i]); // for TAB_i rights: view tabs = 0x01, deposit items =0x02
+ data << uint32(ritr->TabSlotPerDay[i]); // for TAB_i count of: withdraw items(stack/day)
}
}
for (MemberList::const_iterator itr = members.begin(); itr != members.end(); ++itr)
{
if (Player *pl = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER)))
{
- data << (uint64)pl->GetGUID();
- data << (uint8)1;
- data << (std::string)pl->GetName();
- data << (uint32)itr->second.RankId;
- data << (uint8)pl->getLevel();
- data << (uint8)pl->getClass();
- data << (uint8)0; // new 2.4.0
- data << (uint32)pl->GetZoneId();
+ data << uint64(pl->GetGUID());
+ data << uint8(1);
+ data << pl->GetName();
+ data << uint32(itr->second.RankId);
+ data << uint8(pl->getLevel());
+ data << uint8(pl->getClass());
+ data << uint8(0); // new 2.4.0
+ data << uint32(pl->GetZoneId());
data << itr->second.Pnote;
data << itr->second.OFFnote;
}
else
{
data << uint64(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER));
- data << (uint8)0;
+ data << uint8(0);
data << itr->second.name;
- data << (uint32)itr->second.RankId;
- data << (uint8)itr->second.level;
- data << (uint8)itr->second.Class;
- data << (uint8)0; // new 2.4.0
- data << (uint32)itr->second.zoneId;
- data << (float(time(NULL)-itr->second.logout_time) / DAY);
+ data << uint32(itr->second.RankId);
+ data << uint8(itr->second.level);
+ data << uint8(itr->second.Class);
+ data << uint8(0); // new 2.4.0
+ data << uint32(itr->second.zoneId);
+ data << float(float(time(NULL)-itr->second.logout_time) / DAY);
data << itr->second.Pnote;
data << itr->second.OFFnote;
}
diff --git a/src/game/Level1.cpp b/src/game/Level1.cpp
index 8e234057f94..6c344b29903 100644
--- a/src/game/Level1.cpp
+++ b/src/game/Level1.cpp
@@ -400,7 +400,10 @@ bool ChatHandler::HandleGMTicketGetByNameCommand(const char* args)
if(!*args)
return false;
- Player *plr = objmgr.GetPlayer(args);
+ std::string name = (char*)args;
+ normalizePlayerName(name);
+
+ Player *plr = objmgr.GetPlayer(name.c_str());
if(!plr)
{
SendSysMessage(LANG_NO_PLAYERS_FOUND);
diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp
index b82a6a845da..5abc05260f1 100644
--- a/src/game/Level3.cpp
+++ b/src/game/Level3.cpp
@@ -644,7 +644,6 @@ bool ChatHandler::HandleReloadAllSpellCommand(const char*)
{
HandleReloadSkillDiscoveryTemplateCommand("a");
HandleReloadSkillExtraItemTemplateCommand("a");
- HandleReloadSpellAffectCommand("a");
HandleReloadSpellRequiredCommand("a");
HandleReloadSpellAreaCommand("a");
HandleReloadSpellElixirCommand("a");
@@ -992,14 +991,6 @@ bool ChatHandler::HandleReloadSkillFishingBaseLevelCommand(const char* /*args*/)
return true;
}
-bool ChatHandler::HandleReloadSpellAffectCommand(const char*)
-{
- sLog.outString( "Re-Loading SpellAffect definitions..." );
- spellmgr.LoadSpellAffects();
- SendGlobalGMSysMessage("DB table `spell_affect` (spell mods apply requirements) reloaded.");
- return true;
-}
-
bool ChatHandler::HandleReloadSpellAreaCommand(const char*)
{
sLog.outString( "Re-Loading SpellArea Data..." );
@@ -5226,6 +5217,8 @@ bool ChatHandler::HandleResetLevelCommand(const char * args)
? sWorld.getConfig(CONFIG_START_PLAYER_LEVEL)
: sWorld.getConfig(CONFIG_START_HEROIC_PLAYER_LEVEL);
+ target->_ApplyAllLevelScaleItemMods(false);
+
target->SetLevel(start_level);
target->InitRunes();
target->InitStatsForLevel(true);
@@ -5234,6 +5227,8 @@ bool ChatHandler::HandleResetLevelCommand(const char * args)
target->InitTalentForLevel();
target->SetUInt32Value(PLAYER_XP,0);
+ target->_ApplyAllLevelScaleItemMods(true);
+
// reset level for pet
if(Pet* pet = target->GetPet())
pet->SynchronizeLevelWithOwner();
diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp
index aeec27ced32..2488e7696e0 100644
--- a/src/game/MiscHandler.cpp
+++ b/src/game/MiscHandler.cpp
@@ -1493,7 +1493,7 @@ void WorldSession::HandleSetTitleOpcode( WorldPacket & recv_data )
recv_data >> title;
// -1 at none
- if(title > 0 && title < 192)
+ if(title > 0 && title < MAX_TITLE_INDEX)
{
if(!GetPlayer()->HasTitle(title))
return;
diff --git a/src/game/Object.cpp b/src/game/Object.cpp
index 76041d8792c..d565818910e 100644
--- a/src/game/Object.cpp
+++ b/src/game/Object.cpp
@@ -1992,6 +1992,36 @@ GameObject* WorldObject::FindNearestGameObject(uint32 entry, float range)
return go;
}
+void WorldObject::GetGameObjectListWithEntryInGrid(std::list<GameObject*>& lList, uint32 uiEntry, float fMaxSearchRange)
+{
+ CellPair pair(Trinity::ComputeCellPair(this->GetPositionX(), this->GetPositionY()));
+ Cell cell(pair);
+ cell.data.Part.reserved = ALL_DISTRICT;
+ cell.SetNoCreate();
+
+ Trinity::AllGameObjectsWithEntryInRange check(this, uiEntry, fMaxSearchRange);
+ Trinity::GameObjectListSearcher<Trinity::AllGameObjectsWithEntryInRange> searcher(this, lList, check);
+ TypeContainerVisitor<Trinity::GameObjectListSearcher<Trinity::AllGameObjectsWithEntryInRange>, GridTypeMapContainer> visitor(searcher);
+
+ CellLock<GridReadGuard> cell_lock(cell, pair);
+ cell_lock->Visit(cell_lock, visitor, *(this->GetMap()));
+}
+
+void WorldObject::GetCreatureListWithEntryInGrid(std::list<Creature*>& lList, uint32 uiEntry, float fMaxSearchRange)
+{
+ CellPair pair(Trinity::ComputeCellPair(this->GetPositionX(), this->GetPositionY()));
+ Cell cell(pair);
+ cell.data.Part.reserved = ALL_DISTRICT;
+ cell.SetNoCreate();
+
+ Trinity::AllCreaturesOfEntryInRange check(this, uiEntry, fMaxSearchRange);
+ Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(this, lList, check);
+ TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange>, GridTypeMapContainer> visitor(searcher);
+
+ CellLock<GridReadGuard> cell_lock(cell, pair);
+ cell_lock->Visit(cell_lock, visitor, *(this->GetMap()));
+}
+
/*
namespace MaNGOS
{
diff --git a/src/game/Object.h b/src/game/Object.h
index 2eba206ae64..b7e5a6efa3e 100644
--- a/src/game/Object.h
+++ b/src/game/Object.h
@@ -548,6 +548,9 @@ class TRINITY_DLL_SPEC WorldObject : public Object
Creature* FindNearestCreature(uint32 entry, float range, bool alive = true);
GameObject* FindNearestGameObject(uint32 entry, float range);
+ void GetGameObjectListWithEntryInGrid(std::list<GameObject*>& lList, uint32 uiEntry, float fMaxSearchRange);
+ void GetCreatureListWithEntryInGrid(std::list<Creature*>& lList, uint32 uiEntry, float fMaxSearchRange);
+
bool isActiveObject() const { return m_isActive; }
void setActive(bool isActiveObject);
void SetWorldObject(bool apply);
diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h
index 349de0a955f..b770c3044a4 100644
--- a/src/game/ObjectMgr.h
+++ b/src/game/ObjectMgr.h
@@ -234,7 +234,7 @@ enum ConditionType
CONDITION_SKILL = 7, // skill_id skill_value
CONDITION_QUESTREWARDED = 8, // quest_id 0
CONDITION_QUESTTAKEN = 9, // quest_id 0, for condition true while quest active.
- CONDITION_AD_COMMISSION_AURA = 10, // 0 0, for condition true while one from AD ńommission aura active
+ CONDITION_AD_COMMISSION_AURA = 10, // 0 0, for condition true while one from AD commission aura active
CONDITION_NO_AURA = 11, // spell_id effindex
CONDITION_ACTIVE_EVENT = 12, // event_id
CONDITION_INSTANCE_DATA = 13, // entry data
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 41ed4882826..ec31194680c 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -669,8 +669,8 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8
// Played time
m_Last_tick = time(NULL);
- m_Played_time[0] = 0;
- m_Played_time[1] = 0;
+ m_Played_time[PLAYED_TIME_TOTAL] = 0;
+ m_Played_time[PLAYED_TIME_LEVEL] = 0;
// base stats and related field values
InitStatsForLevel();
@@ -1340,8 +1340,8 @@ void Player::Update( uint32 p_time )
if (now > m_Last_tick)
{
uint32 elapsed = uint32(now - m_Last_tick);
- m_Played_time[0] += elapsed; // Total played time
- m_Played_time[1] += elapsed; // Level played time
+ m_Played_time[PLAYED_TIME_TOTAL] += elapsed; // Total played time
+ m_Played_time[PLAYED_TIME_LEVEL] += elapsed; // Level played time
m_Last_tick = now;
}
@@ -2460,9 +2460,12 @@ void Player::GiveLevel(uint32 level)
SetUInt32Value(PLAYER_NEXT_LEVEL_XP, objmgr.GetXPForLevel(level));
//update level, max level of skills
- if(getLevel()!= level)
- m_Played_time[1] = 0; // Level Played Time reset
+ m_Played_time[PLAYED_TIME_LEVEL] = 0; // Level Played Time reset
+
+ _ApplyAllLevelScaleItemMods(false);
+
SetLevel(level);
+
UpdateSkillsForLevel ();
// save base values (bonuses already included in stored stats
@@ -2490,6 +2493,8 @@ void Player::GiveLevel(uint32 level)
SetPower(POWER_FOCUS, 0);
SetPower(POWER_HAPPINESS, 0);
+ _ApplyAllLevelScaleItemMods(true);
+
// update level to hunter/summon pet
if (Pet* pet = GetPet())
pet->SynchronizeLevelWithOwner();
@@ -6666,13 +6671,16 @@ void Player::_ApplyItemMods(Item *item, uint8 slot,bool apply)
sLog.outDebug("_ApplyItemMods complete.");
}
-void Player::_ApplyItemBonuses(ItemPrototype const *proto, uint8 slot, bool apply)
+void Player::_ApplyItemBonuses(ItemPrototype const *proto, uint8 slot, bool apply, bool only_level_scale /*= false*/)
{
if(slot >= INVENTORY_SLOT_BAG_END || !proto)
return;
- ScalingStatDistributionEntry const *ssd = proto->ScalingStatDistribution ? sScalingStatDistributionStore.LookupEntry(proto->ScalingStatDistribution) : 0;
- ScalingStatValuesEntry const *ssv = proto->ScalingStatValue ? sScalingStatValuesStore.LookupEntry(getLevel()) : 0;
+ ScalingStatDistributionEntry const *ssd = proto->ScalingStatDistribution ? sScalingStatDistributionStore.LookupEntry(proto->ScalingStatDistribution) : NULL;
+ ScalingStatValuesEntry const *ssv = proto->ScalingStatValue ? sScalingStatValuesStore.LookupEntry(getLevel()) : NULL;
+
+ if(only_level_scale && !(ssd && ssv))
+ return;
for (uint8 i = 0; i < MAX_ITEM_PROTO_STATS; ++i)
{
@@ -7235,10 +7243,7 @@ void Player::CastItemCombatSpell(Unit *target, WeaponAttackType attType, uint32
float chance = pEnchant->amount[s] != 0 ? float(pEnchant->amount[s]) : GetWeaponProcChance();
if (entry && entry->PPMChance)
- {
- uint32 WeaponSpeed = GetAttackTime(attType);
- chance = GetPPMProcChance(WeaponSpeed, entry->PPMChance, spellInfo);
- }
+ chance = GetPPMProcChance(proto->Delay, entry->PPMChance, spellInfo);
else if (entry && entry->customChance)
chance = entry->customChance;
@@ -7439,6 +7444,24 @@ void Player::_ApplyAllItemMods()
sLog.outDebug("_ApplyAllItemMods complete.");
}
+void Player::_ApplyAllLevelScaleItemMods(bool apply)
+{
+ for (int i = 0; i < INVENTORY_SLOT_BAG_END; ++i)
+ {
+ if(m_items[i])
+ {
+ if(m_items[i]->IsBroken())
+ continue;
+
+ ItemPrototype const *proto = m_items[i]->GetProto();
+ if(!proto)
+ continue;
+
+ _ApplyItemBonuses(proto,i, apply, true);
+ }
+ }
+}
+
void Player::_ApplyAmmoBonuses()
{
// check ammo
@@ -14262,8 +14285,8 @@ bool Player::MinimalLoadFromDB( QueryResult *result, uint32 guid )
// the instance id is not needed at character enum
- m_Played_time[0] = fields[7].GetUInt32();
- m_Played_time[1] = fields[8].GetUInt32();
+ m_Played_time[PLAYED_TIME_TOTAL] = fields[7].GetUInt32();
+ m_Played_time[PLAYED_TIME_LEVEL] = fields[8].GetUInt32();
m_atLoginFlags = fields[9].GetUInt32();
@@ -14834,8 +14857,8 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
}
m_cinematic = fields[19].GetUInt32();
- m_Played_time[0]= fields[20].GetUInt32();
- m_Played_time[1]= fields[21].GetUInt32();
+ m_Played_time[PLAYED_TIME_TOTAL]= fields[20].GetUInt32();
+ m_Played_time[PLAYED_TIME_LEVEL]= fields[21].GetUInt32();
m_resetTalentsCost = fields[25].GetUInt32();
m_resetTalentsTime = time_t(fields[26].GetUInt64());
@@ -16177,9 +16200,9 @@ void Player::SaveToDB()
ss << m_cinematic;
ss << ", ";
- ss << m_Played_time[0];
+ ss << m_Played_time[PLAYED_TIME_TOTAL];
ss << ", ";
- ss << m_Played_time[1];
+ ss << m_Played_time[PLAYED_TIME_LEVEL];
ss << ", ";
ss << finiteAlways(m_rest_bonus);
@@ -17387,11 +17410,7 @@ void Player::RemoveSpellMods(Spell * spell)
checkedSpells.find(aur->GetParentAura()) != checkedSpells.end())
continue;
- flag96 const * mask = spellmgr.GetSpellAffect(aur->GetId(), aur->GetEffIndex());
- if (!mask)
- mask = &spellInfo->EffectSpellClassMask[aur->GetEffIndex()];
-
- if (spell->m_spellInfo->SpellFamilyFlags & *mask)
+ if (spell->m_spellInfo->SpellFamilyFlags & spellInfo->EffectSpellClassMask[aur->GetEffIndex()])
{
checkedSpells.insert(aur->GetParentAura());
spell->m_appliedMods.erase(aur->GetParentAura());
@@ -20360,7 +20379,7 @@ bool Player::isTotalImmune()
bool Player::HasTitle(uint32 bitIndex)
{
- if (bitIndex > 192)
+ if (bitIndex > MAX_TITLE_INDEX)
return false;
uint32 fieldIndexOffset = bitIndex / 32;
diff --git a/src/game/Player.h b/src/game/Player.h
index 51f17027fa7..0affa3b82fd 100644
--- a/src/game/Player.h
+++ b/src/game/Player.h
@@ -476,6 +476,8 @@ enum PlayerFlags
#define PLAYER_TITLE_HAND_OF_ADAL UI64LIT(0x0000008000000000) // 39
#define PLAYER_TITLE_VENGEFUL_GLADIATOR UI64LIT(0x0000010000000000) // 40
+#define MAX_TITLE_INDEX (3*64) // 3 uint64 fields
+
// used in PLAYER_FIELD_BYTES values
enum PlayerFieldByteFlags
{
@@ -753,6 +755,14 @@ enum EnviromentalDamage
DAMAGE_FALL_TO_VOID = 6 // custom case for fall without durability loss
};
+enum PlayedTimeIndex
+{
+ PLAYED_TIME_TOTAL = 0,
+ PLAYED_TIME_LEVEL = 1
+};
+
+#define MAX_PLAYED_TIME_INDEX 2
+
// used at player loading query list preparing, and later result selection
enum PlayerLoginQueryIndex
{
@@ -962,9 +972,9 @@ class TRINITY_DLL_SPEC Player : public Unit
// Played Time Stuff
time_t m_logintime;
time_t m_Last_tick;
- uint32 m_Played_time[2];
- uint32 GetTotalPlayedTime() { return m_Played_time[0]; };
- uint32 GetLevelPlayedTime() { return m_Played_time[1]; };
+ uint32 m_Played_time[MAX_PLAYED_TIME_INDEX];
+ uint32 GetTotalPlayedTime() { return m_Played_time[PLAYED_TIME_TOTAL]; };
+ uint32 GetLevelPlayedTime() { return m_Played_time[PLAYED_TIME_LEVEL]; };
void setDeathState(DeathState s); // overwrite Unit::setDeathState
@@ -1805,7 +1815,8 @@ class TRINITY_DLL_SPEC Player : public Unit
void _ApplyItemMods(Item *item,uint8 slot,bool apply);
void _RemoveAllItemMods();
void _ApplyAllItemMods();
- void _ApplyItemBonuses(ItemPrototype const *proto,uint8 slot,bool apply);
+ void _ApplyAllLevelScaleItemMods(bool apply);
+ void _ApplyItemBonuses(ItemPrototype const *proto,uint8 slot,bool apply, bool only_level_scale = false);
void _ApplyAmmoBonuses();
bool EnchantmentFitsRequirements(uint32 enchantmentcondition, int8 slot);
void ToggleMetaGemsActive(uint8 exceptslot, bool apply);
diff --git a/src/game/ReputationMgr.cpp b/src/game/ReputationMgr.cpp
index 10b7bbd3d62..7536fb54f03 100644
--- a/src/game/ReputationMgr.cpp
+++ b/src/game/ReputationMgr.cpp
@@ -255,7 +255,7 @@ bool ReputationMgr::SetOneFactionReputation(FactionEntry const* factionEntry, in
if(incremental)
{
// int32 *= float cause one point loss?
- standing = (int32)((float)standing * sWorld.getRate(RATE_REPUTATION_GAIN) + 0.5f);
+ standing = floor( (float)standing * sWorld.getRate(RATE_REPUTATION_GAIN) + 0.5 );
standing += itr->second.Standing + BaseRep;
}
diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h
index 748e81e89e0..b4e9940e0b7 100644
--- a/src/game/SharedDefines.h
+++ b/src/game/SharedDefines.h
@@ -908,7 +908,7 @@ enum AuraState
//AURA_STATE_UNKNOWN11 = 11, // t|
AURA_STATE_FAERIE_FIRE = 12, // c t|
AURA_STATE_HEALTHLESS_35_PERCENT = 13, // C T |
- AURA_STATE_IMMOLATE = 14, // T |
+ AURA_STATE_CONFLAGRATE = 14, // T |
AURA_STATE_SWIFTMEND = 15, // T |
AURA_STATE_DEADLY_POISON = 16, // T |
AURA_STATE_ENRAGE = 17, // C |
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index 090749b32db..8f47a8252d4 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -2621,8 +2621,8 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect* triggeredByAura
}
}
- // Fill cost data
- m_powerCost = CalculatePowerCost();
+ // Fill cost data (not use power for item casts
+ m_powerCost = m_CastItem ? 0 : CalculatePowerCost(m_spellInfo, m_caster, m_spellSchoolMask);
SpellCastResult result = CheckCast(true);
if(result != SPELL_CAST_OK && !IsAutoRepeat()) //always cast autorepeat dummy for triggering
@@ -5348,74 +5348,6 @@ SpellCastResult Spell::CheckRange(bool strict)
return SPELL_CAST_OK;
}
-int32 Spell::CalculatePowerCost()
-{
- // item cast not used power
- if(m_CastItem)
- return 0;
-
- // Spell drain all exist power on cast (Only paladin lay of Hands)
- if (m_spellInfo->AttributesEx & SPELL_ATTR_EX_DRAIN_ALL_POWER)
- {
- // If power type - health drain all
- if (m_spellInfo->powerType == POWER_HEALTH)
- return m_caster->GetHealth();
- // Else drain all power
- if (m_spellInfo->powerType < MAX_POWERS)
- return m_caster->GetPower(Powers(m_spellInfo->powerType));
- sLog.outError("Spell::CalculateManaCost: Unknown power type '%d' in spell %d", m_spellInfo->powerType, m_spellInfo->Id);
- return 0;
- }
-
- // Base powerCost
- int32 powerCost = m_spellInfo->manaCost;
- // PCT cost from total amount
- if (m_spellInfo->ManaCostPercentage)
- {
- switch (m_spellInfo->powerType)
- {
- // health as power used
- case POWER_HEALTH:
- powerCost += m_spellInfo->ManaCostPercentage * m_caster->GetCreateHealth() / 100;
- break;
- case POWER_MANA:
- powerCost += m_spellInfo->ManaCostPercentage * m_caster->GetCreateMana() / 100;
- break;
- case POWER_RAGE:
- case POWER_FOCUS:
- case POWER_ENERGY:
- case POWER_HAPPINESS:
- powerCost += m_spellInfo->ManaCostPercentage * m_caster->GetMaxPower(Powers(m_spellInfo->powerType)) / 100;
- break;
- case POWER_RUNE:
- case POWER_RUNIC_POWER:
- sLog.outDebug("Spell::CalculateManaCost: Not implemented yet!");
- break;
- default:
- sLog.outError("Spell::CalculateManaCost: Unknown power type '%d' in spell %d", m_spellInfo->powerType, m_spellInfo->Id);
- return 0;
- }
- }
- SpellSchools school = GetFirstSchoolInMask(m_spellSchoolMask);
- // Flat mod from caster auras by spell school
- powerCost += m_caster->GetInt32Value(UNIT_FIELD_POWER_COST_MODIFIER + school);
- // Shiv - costs 20 + weaponSpeed*10 energy (apply only to non-triggered spell with energy cost)
- if ( m_spellInfo->AttributesEx4 & SPELL_ATTR_EX4_SPELL_VS_EXTEND_COST )
- powerCost += m_caster->GetAttackTime(OFF_ATTACK)/100;
- // Apply cost mod by spell
- if(Player* modOwner = m_caster->GetSpellModOwner())
- modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_COST, powerCost, this);
-
- if(m_spellInfo->Attributes & SPELL_ATTR_LEVEL_DAMAGE_CALCULATION)
- powerCost = int32(powerCost/ (1.117f* m_spellInfo->spellLevel / m_caster->getLevel() -0.1327f));
-
- // PCT mod from user auras by school
- powerCost = int32(powerCost * (1.0f+m_caster->GetFloatValue(UNIT_FIELD_POWER_COST_MULTIPLIER+school)));
- if (powerCost < 0)
- powerCost = 0;
- return powerCost;
-}
-
SpellCastResult Spell::CheckPower()
{
// item cast not used power
diff --git a/src/game/Spell.h b/src/game/Spell.h
index 51a2b91e63e..1f4086280f0 100644
--- a/src/game/Spell.h
+++ b/src/game/Spell.h
@@ -390,7 +390,6 @@ class Spell
SpellCastResult CheckCasterAuras() const;
int32 CalculateDamage(uint8 i, Unit* target) { return m_caster->CalculateSpellDamage(m_spellInfo,i,m_currentBasePoints[i],target); }
- int32 CalculatePowerCost();
bool HaveTargetsForEffect(uint8 effect) const;
void Delayed();
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 085ef00d191..cb6f2caf31f 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -1203,10 +1203,13 @@ void Aura::_AddAura()
if (IsSealSpell(m_spellProto))
SetAuraState(AURA_STATE_JUDGEMENT);
- // Conflagrate aura state on Immolate or Shadowflame
- if (m_spellProto->SpellFamilyName == SPELLFAMILY_WARLOCK && (m_spellProto->SpellFamilyFlags[0] & 4
- || m_spellProto->SpellFamilyFlags[2] & 2))
- SetAuraState(AURA_STATE_IMMOLATE);
+ // Conflagrate aura state on Immolate and Shadowflame
+ if (m_spellProto->SpellFamilyName == SPELLFAMILY_WARLOCK &&
+ // Immolate
+ ((m_spellProto->SpellFamilyFlags[0] & 4) ||
+ // Shadowflame
+ (m_spellProto->SpellFamilyFlags[2] & 2)))
+ SetAuraState(AURA_STATE_CONFLAGRATE);
// Faerie Fire (druid versions)
if (m_spellProto->SpellFamilyName == SPELLFAMILY_DRUID && m_spellProto->SpellFamilyFlags[0] & 0x400)
@@ -1385,6 +1388,7 @@ void Aura::_RemoveAura()
void Aura::SetStackAmount(uint8 stackAmount, bool applied)
{
+ bool refresh = stackAmount >= m_stackAmount;
if (stackAmount != m_stackAmount)
{
m_stackAmount = stackAmount;
@@ -1396,7 +1400,11 @@ void Aura::SetStackAmount(uint8 stackAmount, bool applied)
}
}
}
- RefreshAura();
+
+ if (refresh)
+ RefreshAura();
+ else
+ SendAuraUpdate();
}
bool Aura::modStackAmount(int32 num)
@@ -1718,12 +1726,8 @@ bool AuraEffect::isAffectedOnSpell(SpellEntry const *spell) const
if (spell->SpellFamilyName != m_spellProto->SpellFamilyName)
return false;
- // Check EffectClassMask and Spell_Affect table
- flag96 const *spellAffect = spellmgr.GetSpellAffect(GetId(), m_effIndex);
- if (!spellAffect)
- spellAffect = &m_spellProto->EffectSpellClassMask[m_effIndex];
-
- if (*spellAffect & spell->SpellFamilyFlags)
+ // Check EffectClassMask
+ if (m_spellProto->EffectSpellClassMask[m_effIndex] & spell->SpellFamilyFlags)
return true;
return false;
}
@@ -1768,10 +1772,7 @@ void AuraEffect::HandleAddModifier(bool apply, bool Real, bool changeAmount)
mod->type = SpellModType(m_auraName); // SpellModType value == spell aura types
mod->spellId = GetId();
- flag96 const *spellAffect = spellmgr.GetSpellAffect(GetId(), m_effIndex);
- if (!spellAffect)
- spellAffect = &m_spellProto->EffectSpellClassMask[m_effIndex];
- mod->mask = *spellAffect;
+ mod->mask = m_spellProto->EffectSpellClassMask[m_effIndex];
mod->charges = GetParentAura()->GetAuraCharges();
m_spellmod = mod;
@@ -2548,6 +2549,9 @@ void AuraEffect::TriggerSpell()
case 29213:
case 54835:
caster->CastSpell(m_target, trigger_spell_id, true, NULL, this);
+ // Ground Slam
+ case 33525:
+ target->CastSpell(target, trigger_spell_id, true);
return;
}
}
@@ -4395,12 +4399,22 @@ void AuraEffect::HandleAuraModIncreaseSwimSpeed(bool /*apply*/, bool Real, bool
m_target->UpdateSpeed(MOVE_SWIM, true);
}
-void AuraEffect::HandleAuraModDecreaseSpeed(bool /*apply*/, bool Real, bool changeAmount)
+void AuraEffect::HandleAuraModDecreaseSpeed(bool apply, bool Real, bool changeAmount)
{
// all applied/removed only at real aura add/remove
if(!Real && !changeAmount)
return;
+ if (apply)
+ {
+ // Gronn Lord's Grasp, becomes stoned
+ if (GetId() == 33572)
+ {
+ if (GetParentAura()->GetStackAmount() >= 5 && !m_target->HasAura(33652))
+ m_target->CastSpell(m_target, 33652, true);
+ }
+ }
+
m_target->UpdateSpeed(MOVE_RUN, true);
m_target->UpdateSpeed(MOVE_SWIM, true);
m_target->UpdateSpeed(MOVE_FLIGHT, true);
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 1b13a6673db..7ee0289e329 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -444,29 +444,60 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
// Incinerate Rank 1 & 2
if((m_spellInfo->SpellFamilyFlags[1] & 0x000040) && m_spellInfo->SpellIconID==2128)
{
- // Incinerate does more dmg (dmg*0.25) if the target is Immolated.
- if(unitTarget->HasAuraState(AURA_STATE_IMMOLATE, m_spellInfo, m_caster))
- damage += int32(damage*0.25f);
+ // Incinerate does more dmg (dmg*0.25) if the target have Immolate debuff.
+ // Check aura state for speed but aura state set not only for Immolate spell
+ if(unitTarget->HasAuraState(AURA_STATE_CONFLAGRATE, m_spellInfo, m_caster))
+ {
+ Unit::AuraEffectList const& RejorRegr = unitTarget->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE);
+ for(Unit::AuraEffectList::const_iterator i = RejorRegr.begin(); i != RejorRegr.end(); ++i)
+ {
+ // Immolate
+ if((*i)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_WARLOCK &&
+ ((*i)->GetSpellProto()->SpellFamilyFlags[0] & 0x4))
+ {
+ damage += damage/4;
+ break;
+ }
+ }
+ }
}
- // Conflagrate - consumes immolate or shadowflame
- else if (m_spellInfo->TargetAuraState == AURA_STATE_IMMOLATE)
+ // Conflagrate - consumes Immolate or Shadowflame
+ else if (m_spellInfo->TargetAuraState == AURA_STATE_CONFLAGRATE)
{
- // for caster applied auras only
+ AuraEffect const* aura = NULL; // found req. aura for damage calculation
+
Unit::AuraEffectList const &mPeriodic = unitTarget->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE);
for(Unit::AuraEffectList::const_iterator i = mPeriodic.begin(); i != mPeriodic.end(); ++i)
{
- if( (*i)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_WARLOCK && ((*i)->GetSpellProto()->SpellFamilyFlags[0] & 4 || (*i)->GetSpellProto()->SpellFamilyFlags[2] & 2) &&
- (*i)->GetCasterGUID()==m_caster->GetGUID() )
+ // for caster applied auras only
+ if ((*i)->GetSpellProto()->SpellFamilyName != SPELLFAMILY_WARLOCK ||
+ (*i)->GetCasterGUID()!=m_caster->GetGUID())
+ continue;
+
+ // Immolate
+ if ((*i)->GetSpellProto()->SpellFamilyFlags[0] & 0x4)
{
- uint32 pdamage = (*i)->GetAmount() > 0 ? (*i)->GetAmount() : 0;
- pdamage = m_caster->SpellDamageBonus(unitTarget, (*i)->GetSpellProto(), pdamage, DOT, (*i)->GetParentAura()->GetStackAmount());
- damage += pdamage * 4; // 4 ticks of 3 seconds = 12 secs
- apply_direct_bonus = false;
- // Glyph of Conflagrate
- if (!m_caster->HasAura(56235))
- unitTarget->RemoveAurasDueToSpell((*i)->GetId(), m_caster->GetGUID());
+ aura = *i; // it selected always if exist
break;
}
+
+ // Shadowflame
+ if ((*i)->GetSpellProto()->SpellFamilyFlags[2] & 0x00000002)
+ aura = *i; // remember but wait possible Immolate as primary priority
+ }
+
+ // found Immolate or Shadowflame
+ if (aura)
+ {
+ uint32 pdamage = aura->GetAmount() > 0 ? aura->GetAmount() : 0;
+ pdamage = m_caster->SpellDamageBonus(unitTarget, aura->GetSpellProto(), pdamage, DOT, aura->GetParentAura()->GetStackAmount());
+ damage += pdamage * 4; // 4 ticks of 3 seconds = 12 secs
+ apply_direct_bonus = false;
+ // Glyph of Conflagrate
+ if (!m_caster->HasAura(56235))
+ unitTarget->RemoveAurasDueToSpell(aura->GetId(), m_caster->GetGUID());
+
+ break;
}
}
// Shadow Bite
@@ -588,7 +619,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
// Shield of Righteousness
else if(m_spellInfo->SpellFamilyFlags[1]&0x00100000)
{
- damage+=int32(m_caster->GetShieldBlockValue());
+ damage += int32(m_caster->GetShieldBlockValue() * 1.3f);
}
break;
}
@@ -1205,6 +1236,21 @@ void Spell::EffectDummy(uint32 i)
case 58418: // Portal to Orgrimmar
case 58420: // Portal to Stormwind
return; // implemented in EffectScript[0]
+ case 59640: // Underbelly Elixir
+ {
+ if(m_caster->GetTypeId() != TYPEID_PLAYER)
+ return;
+
+ uint32 spell_id = 0;
+ switch(urand(1,3))
+ {
+ case 1: spell_id = 59645; break;
+ case 2: spell_id = 59831; break;
+ case 3: spell_id = 59843; break;
+ }
+ m_caster->CastSpell(m_caster,spell_id,true,NULL);
+ return;
+ }
}
//All IconID Check in there
@@ -1502,7 +1548,7 @@ void Spell::EffectDummy(uint32 i)
m_caster->CastSpell(unitTarget, 5940, true);
return;
}
- case 14185: // Preparation Rogue
+ case 14185: // Preparation
{
if(m_caster->GetTypeId()!=TYPEID_PLAYER)
return;
@@ -1530,7 +1576,7 @@ void Spell::EffectDummy(uint32 i)
case SPELLFAMILY_HUNTER:
switch(m_spellInfo->Id)
{
- case 23989: //Readiness talent
+ case 23989: // Readiness talent
{
if(m_caster->GetTypeId()!=TYPEID_PLAYER)
return;
@@ -1688,8 +1734,8 @@ void Spell::EffectDummy(uint32 i)
}
break;
case SPELLFAMILY_SHAMAN:
- //Shaman Rockbiter Weapon
- if (m_spellInfo->SpellFamilyFlags.IsEqual(0x400000))
+ // Rockbiter Weapon
+ if (m_spellInfo->SpellFamilyFlags[0] & 0x400000)
{
// TODO: use expect spell for enchant (if exist talent)
// In 3.0.3 no mods present for rockbiter
@@ -1762,8 +1808,7 @@ void Spell::EffectDummy(uint32 i)
if(!unitTarget || unitTarget->getPowerType() != POWER_MANA)
return;
// Glyph of Mana Tide
- Unit *owner = m_caster->GetOwner();
- if (owner)
+ if(Unit *owner = m_caster->GetOwner())
if (AuraEffect *dummy = owner->GetDummyAura(55441))
damage+=dummy->GetAmount();
// Regenerate 6% of Total Mana Every 3 secs
@@ -4563,6 +4608,14 @@ void Spell::EffectScriptEffect(uint32 effIndex)
{
switch(m_spellInfo->Id)
{
+ // Dispelling Analysis
+ case 37028:
+ {
+ if (unitTarget->HasAura(36904))
+ unitTarget->RemoveAurasDueToSpell(36904);
+
+ return;
+ }
case 45204: // Clone Me!
case 41055: // Copy Weapon
case 45206: // Copy Off-hand Weapon
@@ -5153,6 +5206,14 @@ void Spell::EffectScriptEffect(uint32 effIndex)
}
return;
}
+ // Guarded by The Light
+ case 63521:
+ {
+ // Divine Plea
+ if(Aura *AuraDivinePlea = m_caster->GetAura(54428))
+ AuraDivinePlea->RefreshAura();
+ return;
+ }
}
break;
}
@@ -5318,6 +5379,43 @@ void Spell::EffectScriptEffect(uint32 effIndex)
{
switch(m_spellInfo->Id)
{
+ // Death Knight Initiate Visual
+ case 51519:
+ {
+ if(!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT)
+ return;
+
+ uint32 iTmpSpellId = 0;
+ switch (unitTarget->GetDisplayId())
+ {
+ case 25369: iTmpSpellId = 51552; break; // bloodelf female
+ case 25373: iTmpSpellId = 51551; break; // bloodelf male
+ case 25363: iTmpSpellId = 51542; break; // draenei female
+ case 25357: iTmpSpellId = 51541; break; // draenei male
+ case 25361: iTmpSpellId = 51537; break; // dwarf female
+ case 25356: iTmpSpellId = 51538; break; // dwarf male
+ case 25372: iTmpSpellId = 51550; break; // forsaken female
+ case 25367: iTmpSpellId = 51549; break; // forsaken male
+ case 25362: iTmpSpellId = 51540; break; // gnome female
+ case 25359: iTmpSpellId = 51539; break; // gnome male
+ case 25355: iTmpSpellId = 51534; break; // human female
+ case 25354: iTmpSpellId = 51520; break; // human male
+ case 25360: iTmpSpellId = 51536; break; // nightelf female
+ case 25358: iTmpSpellId = 51535; break; // nightelf male
+ case 25368: iTmpSpellId = 51544; break; // orc female
+ case 25364: iTmpSpellId = 51543; break; // orc male
+ case 25371: iTmpSpellId = 51548; break; // tauren female
+ case 25366: iTmpSpellId = 51547; break; // tauren male
+ case 25370: iTmpSpellId = 51545; break; // troll female
+ case 25365: iTmpSpellId = 51546; break; // troll male
+ default: return;
+ }
+
+ unitTarget->CastSpell(unitTarget, iTmpSpellId, true);
+ Creature* npc = (Creature*)unitTarget;
+ npc->LoadEquipment(npc->GetEquipmentId());
+ return;
+ }
// Dreaming Glory
case 28698:
{
diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp
index eafda06077c..9c9bb255ef2 100644
--- a/src/game/SpellMgr.cpp
+++ b/src/game/SpellMgr.cpp
@@ -342,6 +342,70 @@ bool IsHigherHankOfSpell(uint32 spellId_1, uint32 spellId_2)
return spellmgr.GetSpellRank(spellId_1)<spellmgr.GetSpellRank(spellId_2);
}
+uint32 CalculatePowerCost(SpellEntry const * spellInfo, Unit const * caster, SpellSchoolMask schoolMask)
+{
+ // Spell drain all exist power on cast (Only paladin lay of Hands)
+ if (spellInfo->AttributesEx & SPELL_ATTR_EX_DRAIN_ALL_POWER)
+ {
+ // If power type - health drain all
+ if (spellInfo->powerType == POWER_HEALTH)
+ return caster->GetHealth();
+ // Else drain all power
+ if (spellInfo->powerType < MAX_POWERS)
+ return caster->GetPower(Powers(spellInfo->powerType));
+ sLog.outError("CalculateManaCost: Unknown power type '%d' in spell %d", spellInfo->powerType, spellInfo->Id);
+ return 0;
+ }
+
+ // Base powerCost
+ int32 powerCost = spellInfo->manaCost;
+ // PCT cost from total amount
+ if (spellInfo->ManaCostPercentage)
+ {
+ switch (spellInfo->powerType)
+ {
+ // health as power used
+ case POWER_HEALTH:
+ powerCost += spellInfo->ManaCostPercentage * caster->GetCreateHealth() / 100;
+ break;
+ case POWER_MANA:
+ powerCost += spellInfo->ManaCostPercentage * caster->GetCreateMana() / 100;
+ break;
+ case POWER_RAGE:
+ case POWER_FOCUS:
+ case POWER_ENERGY:
+ case POWER_HAPPINESS:
+ powerCost += spellInfo->ManaCostPercentage * caster->GetMaxPower(Powers(spellInfo->powerType)) / 100;
+ break;
+ case POWER_RUNE:
+ case POWER_RUNIC_POWER:
+ sLog.outDebug("CalculateManaCost: Not implemented yet!");
+ break;
+ default:
+ sLog.outError("CalculateManaCost: Unknown power type '%d' in spell %d", spellInfo->powerType, spellInfo->Id);
+ return 0;
+ }
+ }
+ SpellSchools school = GetFirstSchoolInMask(schoolMask);
+ // Flat mod from caster auras by spell school
+ powerCost += caster->GetInt32Value(UNIT_FIELD_POWER_COST_MODIFIER + school);
+ // Shiv - costs 20 + weaponSpeed*10 energy (apply only to non-triggered spell with energy cost)
+ if ( spellInfo->AttributesEx4 & SPELL_ATTR_EX4_SPELL_VS_EXTEND_COST )
+ powerCost += caster->GetAttackTime(OFF_ATTACK)/100;
+ // Apply cost mod by spell
+ if(Player* modOwner = caster->GetSpellModOwner())
+ modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_COST, powerCost);
+
+ if(spellInfo->Attributes & SPELL_ATTR_LEVEL_DAMAGE_CALCULATION)
+ powerCost = int32(powerCost/ (1.117f* spellInfo->spellLevel / caster->getLevel() -0.1327f));
+
+ // PCT mod from user auras by school
+ powerCost = int32(powerCost * (1.0f+caster->GetFloatValue(UNIT_FIELD_POWER_COST_MULTIPLIER+school)));
+ if (powerCost < 0)
+ powerCost = 0;
+ return powerCost;
+}
+
SpellSpecific GetSpellSpecific(uint32 spellId)
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
@@ -1065,77 +1129,6 @@ void SpellMgr::LoadSpellTargetPositions()
sLog.outString( ">> Loaded %u spell teleport coordinates", count );
}
-void SpellMgr::LoadSpellAffects()
-{
- mSpellAffectMap.clear(); // need for reload case
-
- uint32 count = 0;
-
- // 0 1 2 3 4
- QueryResult *result = WorldDatabase.Query("SELECT entry, effectId, SpellClassMask0, SpellClassMask1, SpellClassMask2 FROM spell_affect");
- if( !result )
- {
-
- barGoLink bar( 1 );
-
- bar.step();
-
- sLog.outString();
- sLog.outString( ">> Loaded %u spell affect definitions", count );
- return;
- }
-
- barGoLink bar( result->GetRowCount() );
-
- do
- {
- Field *fields = result->Fetch();
-
- bar.step();
-
- uint32 entry = fields[0].GetUInt32();
- uint8 effectId = fields[1].GetUInt8();
-
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(entry);
-
- if (!spellInfo)
- {
- sLog.outErrorDb("Spell %u listed in `spell_affect` does not exist", entry);
- continue;
- }
-
- if (effectId >= 3)
- {
- sLog.outErrorDb("Spell %u listed in `spell_affect` have invalid effect index (%u)", entry,effectId);
- continue;
- }
-
- flag96 affect(fields[2].GetUInt32(), fields[3].GetUInt32(), fields[4].GetUInt32());
-
- // Spell.dbc have own data
- if (effectId>3)
- continue;
-
- flag96 dbc_affect;
- dbc_affect = spellInfo->EffectSpellClassMask[effectId];
- if(dbc_affect[0] == affect[0] && dbc_affect[1] == affect[1] && dbc_affect[2] == affect[2])
- {
- char text[]="ABC";
- sLog.outErrorDb("Spell %u listed in `spell_affect` have redundant (same with EffectSpellClassMask%c) data for effect index (%u) and not needed, skipped.", entry, text[effectId], effectId);
- continue;
- }
-
- mSpellAffectMap[(entry<<8) + effectId] = affect;
-
- ++count;
- } while( result->NextRow() );
-
- delete result;
-
- sLog.outString();
- sLog.outString( ">> Loaded %u custom spell affect definitions", count );
-}
-
bool SpellMgr::IsAffectedByMod(SpellEntry const *spellInfo, SpellModifier *mod) const
{
// false for spellInfo == NULL
@@ -2923,9 +2916,13 @@ DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellEntry const* spellproto
// Repentance
if (spellproto->SpellFamilyFlags[0] & 0x4)
return DIMINISHING_POLYMORPH;
- // Turn Evil
- else if (spellproto->SpellFamilyFlags[1] & 0x8040)
- return DIMINISHING_FEAR_BLIND;
+ break;
+ }
+ case SPELLFAMILY_PRIEST:
+ {
+ // Vampiric Embrace
+ if ((spellproto->SpellFamilyFlags[0] & 0x4) && spellproto->SpellIconID == 150)
+ return DIMINISHING_LIMITONLY;
break;
}
case SPELLFAMILY_DEATHKNIGHT:
@@ -2942,15 +2939,20 @@ DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellEntry const* spellproto
// Get by mechanic
uint32 mechanic = GetAllSpellMechanicMask(spellproto);
if (mechanic == MECHANIC_NONE) return DIMINISHING_NONE;
- if (mechanic & (1<<MECHANIC_STUN)) return triggered ? DIMINISHING_TRIGGER_STUN : DIMINISHING_CONTROL_STUN;
- if (mechanic & ((1<<MECHANIC_SLEEP) | (1<<MECHANIC_FREEZE))) return DIMINISHING_FREEZE_SLEEP;
+ if (mechanic & ((1<<MECHANIC_STUN) |
+ (1<<MECHANIC_SHACKLE))) return triggered ? DIMINISHING_TRIGGER_STUN : DIMINISHING_CONTROL_STUN;
+ if (mechanic & ((1<<MECHANIC_SLEEP) |
+ (1<<MECHANIC_FREEZE))) return DIMINISHING_FREEZE_SLEEP;
if (mechanic & (1<<MECHANIC_POLYMORPH)) return DIMINISHING_POLYMORPH;
if (mechanic & (1<<MECHANIC_ROOT)) return triggered ? DIMINISHING_TRIGGER_ROOT : DIMINISHING_CONTROL_ROOT;
- if (mechanic & (1<<MECHANIC_FEAR)) return DIMINISHING_FEAR_BLIND;
+ if (mechanic & ((1<<MECHANIC_FEAR) |
+ (1<<MECHANIC_TURN))) return DIMINISHING_FEAR_BLIND;
if (mechanic & (1<<MECHANIC_CHARM)) return DIMINISHING_CHARM;
if (mechanic & (1<<MECHANIC_SILENCE)) return DIMINISHING_SILENCE;
if (mechanic & (1<<MECHANIC_DISARM)) return DIMINISHING_DISARM;
- if (mechanic & ((1<<MECHANIC_KNOCKOUT) | (1<<MECHANIC_SAPPED))) return DIMINISHING_KNOCKOUT;
+ if (mechanic & (1<<MECHANIC_FREEZE)) return DIMINISHING_FREEZE_SLEEP;
+ if (mechanic & ((1<<MECHANIC_KNOCKOUT) |
+ (1<<MECHANIC_SAPPED))) return DIMINISHING_KNOCKOUT;
if (mechanic & (1<<MECHANIC_BANISH)) return DIMINISHING_BANISH;
if (mechanic & (1<<MECHANIC_HORROR)) return DIMINISHING_DEATHCOIL;
@@ -2992,6 +2994,13 @@ int32 GetDiminishingReturnsLimitDuration(DiminishingGroup group, SpellEntry cons
return 40000;
break;
}
+ case SPELLFAMILY_PRIEST:
+ {
+ // Vampiric Embrace - limit to 60 seconds in PvP (3.1)
+ if ((spellproto->SpellFamilyFlags[0] & 0x4) && spellproto->SpellIconID == 150)
+ return 60000;
+ break;
+ }
default:
break;
}
@@ -3815,6 +3824,7 @@ void SpellMgr::LoadSpellCustomAttr()
break;
case 44544: // Fingers of Frost
spellInfo->procCharges=2;
+ spellInfo->EffectSpellClassMask[0] = flag96(685904631,1151048,0);
break;
case 28200: // Ascendance (Talisman of Ascendance trinket)
spellInfo->procCharges=6;
diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h
index b32f77b18c7..8315fdc2965 100644
--- a/src/game/SpellMgr.h
+++ b/src/game/SpellMgr.h
@@ -240,6 +240,8 @@ bool IsSingleFromSpellSpecificPerTarget(uint32 spellSpec1, uint32 spellSpec2);
bool IsPassiveSpell(uint32 spellId);
bool IsAutocastableSpell(uint32 spellId);
+uint32 CalculatePowerCost(SpellEntry const * spellInfo, Unit const * caster, SpellSchoolMask schoolMask);
+
inline bool IsPassiveSpellStackableWithRanks(SpellEntry const* spellProto)
{
if(!IsPassiveSpell(spellProto->Id))
@@ -391,9 +393,6 @@ bool IsDiminishingReturnsGroupDurationLimited(DiminishingGroup group);
DiminishingReturnsType GetDiminishingReturnsGroupType(DiminishingGroup group);
int32 GetDiminishingReturnsLimitDuration(DiminishingGroup group, SpellEntry const* spellproto);
-// Spell affects related declarations (accessed using SpellMgr functions)
-typedef UNORDERED_MAP<uint32, flag96> SpellAffectMap;
-
// Spell proc event related declarations (accessed using SpellMgr functions)
enum ProcFlags
{
@@ -735,14 +734,6 @@ class SpellMgr
// Accessors (const or static functions)
public:
- // Spell affects
- flag96 const*GetSpellAffect(uint32 spellId, uint8 effectId) const
- {
- SpellAffectMap::const_iterator itr = mSpellAffectMap.find((spellId<<8) + effectId);
- if( itr != mSpellAffectMap.end( ) )
- return &itr->second;
- return 0;
- }
bool IsAffectedByMod(SpellEntry const *spellInfo, SpellModifier *mod) const;
@@ -1061,7 +1052,6 @@ class SpellMgr
void LoadSpellLearnSkills();
void LoadSpellLearnSpells();
void LoadSpellScriptTarget();
- void LoadSpellAffects();
void LoadSpellElixirs();
void LoadSpellProcEvents();
void LoadSpellBonusess();
@@ -1087,7 +1077,6 @@ class SpellMgr
SpellLearnSkillMap mSpellLearnSkills;
SpellLearnSpellMap mSpellLearnSpells;
SpellTargetPositionMap mSpellTargetPositions;
- SpellAffectMap mSpellAffectMap;
SpellElixirMap mSpellElixirs;
SpellProcEventMap mSpellProcEventMap;
SpellBonusMap mSpellBonusMap;
diff --git a/src/game/TemporarySummon.h b/src/game/TemporarySummon.h
index dc721bac25d..aa4650a02c9 100644
--- a/src/game/TemporarySummon.h
+++ b/src/game/TemporarySummon.h
@@ -54,7 +54,7 @@ class Minion : public TempSummon
void InitSummon();
void RemoveFromWorld();
Unit *GetOwner() { return m_owner; }
- float GetFollowAngle() { return m_followAngle; }
+ float GetFollowAngle() const { return m_followAngle; }
void SetFollowAngle(float angle) { m_followAngle = angle; }
bool IsPetGhoul() const {return GetEntry() == 26125;} // Ghoul may be guardian or pet
protected:
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 5f651fcd015..69f42896dbd 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -1412,7 +1412,7 @@ void Unit::CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *da
damageInfo->procEx = PROC_EX_NONE;
damageInfo->hitOutCome = MELEE_HIT_EVADE;
- if(!this || !pVictim)
+ if(!pVictim)
return;
if(!this->isAlive() || !pVictim->isAlive())
return;
@@ -5843,10 +5843,13 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
basepoints0 = triggerAmount * GetMaxHealth() / 100;
target = this;
triggered_spell_id = 34299;
- if (triggeredByAura->GetCaster() != this)
+ if (triggeredByAura->GetCasterGUID() != GetGUID())
break;
int32 basepoints1 = triggerAmount * 2;
- CastCustomSpell(this,60889,&basepoints1,0,0,true,0,triggeredByAura);
+ // Improved Leader of the Pack
+ // Check cooldown of heal spell cooldown
+ if (GetTypeId()==TYPEID_PLAYER && !((Player *)this)->HasSpellCooldown(34299))
+ CastCustomSpell(this,60889,&basepoints1,0,0,true,0,triggeredByAura);
break;
}
// Healing Touch (Dreamwalker Raiment set)
@@ -7363,7 +7366,10 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig
sLog.outError("Unit::HandleProcTriggerSpell: Spell %u miss posibly Piercing Shots",auraSpellInfo->Id);
return false;
}
- basepoints0 = int32(damage * triggerAmount / 100);
+ SpellEntry const *TriggerPS = sSpellStore.LookupEntry(trigger_spell_id);
+ if(!TriggerPS)
+ return false;
+ basepoints0 = int32(damage * triggerAmount / 100 / (GetSpellMaxDuration(TriggerPS) / TriggerPS->EffectAmplitude[0]));
target = pVictim;
}
break;
@@ -7866,6 +7872,12 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig
((Player*)this)->RemoveCategoryCooldown(82);
return true;
}
+ // Savage Defense
+ case 62606:
+ {
+ basepoints0 = int32(GetTotalAttackPowerValue(BASE_ATTACK) * triggerAmount / 100.0f);
+ break;
+ }
}
if( cooldown && GetTypeId()==TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(trigger_spell_id))
@@ -8827,19 +8839,24 @@ int32 Unit::DealHeal(Unit *pVictim, uint32 addhealth, SpellEntry const *spellPro
{
int32 gain = pVictim->ModifyHealth(int32(addhealth));
- if (GetTypeId()==TYPEID_PLAYER)
+ Unit* unit = this;
+
+ if( GetTypeId()==TYPEID_UNIT && ((Creature*)this)->isTotem())
+ unit = GetOwner();
+
+ if (unit->GetTypeId()==TYPEID_PLAYER)
{
// overheal = addhealth - gain
- SendHealSpellLog(pVictim, spellProto->Id, addhealth, addhealth > gain ? addhealth - gain : 0, critical);
+ unit->SendHealSpellLog(pVictim, spellProto->Id, addhealth, addhealth - gain, critical);
- if (BattleGround *bg = ((Player*)this)->GetBattleGround())
- bg->UpdatePlayerScore((Player*)this, SCORE_HEALING_DONE, gain);
+ if (BattleGround *bg = ((Player*)unit)->GetBattleGround())
+ bg->UpdatePlayerScore((Player*)unit, SCORE_HEALING_DONE, gain);
// use the actual gain, as the overheal shall not be counted, skip gain 0 (it ignored anyway in to criteria)
if (gain)
- ((Player*)this)->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HEALING_DONE, gain, 0, pVictim);
+ ((Player*)unit)->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HEALING_DONE, gain, 0, pVictim);
- ((Player*)this)->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEAL_CASTED, addhealth);
+ ((Player*)unit)->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEAL_CASTED, addhealth);
}
if (pVictim->GetTypeId()==TYPEID_PLAYER)
@@ -10437,8 +10454,7 @@ float Unit::GetPPMProcChance(uint32 WeaponSpeed, float PPM, const SpellEntry * s
if(Player* modOwner = GetSpellModOwner())
modOwner->ApplySpellMod(spellProto->Id,SPELLMOD_PROC_PER_MINUTE,PPM);
- uint32 result = uint32((WeaponSpeed * PPM) / 600.0f); // result is chance in percents (probability = Speed_in_sec * (PPM / 60))
- return result;
+ return uint32((WeaponSpeed * PPM) / 600.0f); // result is chance in percents (probability = Speed_in_sec * (PPM / 60))
}
void Unit::Mount(uint32 mount)
@@ -14906,15 +14922,6 @@ void Unit::SetFlying(bool apply)
}
}
-float Unit::GetFollowAngle() const
-{
- if (GetTypeId()!=TYPEID_UNIT)
- return PET_FOLLOW_ANGLE;
- if (!((Creature*)this)->HasSummonMask(SUMMON_MASK_MINION))
- return PET_FOLLOW_ANGLE;
- return ((Minion*)this)->GetFollowAngle();
-}
-
void Unit::NearTeleportTo( float x, float y, float z, float orientation, bool casting /*= false*/ )
{
if(GetTypeId() == TYPEID_PLAYER)
diff --git a/src/game/Unit.h b/src/game/Unit.h
index 9be220e03b1..6d8f8838cf3 100644
--- a/src/game/Unit.h
+++ b/src/game/Unit.h
@@ -1805,7 +1805,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
bool canFly() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_FLY_MODE); }
bool IsFlying() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_FLYING); }
void SetFlying(bool apply);
- float GetFollowAngle() const;
+ virtual float GetFollowAngle() const { return M_PI/2; }
protected:
explicit Unit ();
diff --git a/src/game/UnitAI.h b/src/game/UnitAI.h
index 9530405ed4d..3e6ce4f4a6f 100644
--- a/src/game/UnitAI.h
+++ b/src/game/UnitAI.h
@@ -23,6 +23,7 @@
#include "Platform/Define.h"
#include <list>
+#include "Unit.h"
class Unit;
class Player;
@@ -47,7 +48,7 @@ class TRINITY_DLL_SPEC UnitAI
virtual void AttackStart(Unit *);
virtual void UpdateAI(const uint32 diff) = 0;
- virtual void InitializeAI() { Reset(); }
+ virtual void InitializeAI() { if(!me->isDead()) Reset(); }
virtual void Reset() {};
diff --git a/src/game/World.cpp b/src/game/World.cpp
index 9ad5156801d..db59f101389 100644
--- a/src/game/World.cpp
+++ b/src/game/World.cpp
@@ -1364,9 +1364,6 @@ void World::SetInitialWorldSettings()
sLog.outString( "Loading Spell target coordinates..." );
spellmgr.LoadSpellTargetPositions();
- sLog.outString( "Loading SpellAffect definitions..." );
- spellmgr.LoadSpellAffects();
-
sLog.outString( "Loading spell pet auras..." );
spellmgr.LoadSpellPetAuras();
diff --git a/src/game/pchdef.h b/src/game/pchdef.h
index 4b5b9dfbe3e..7252e980e7d 100644
--- a/src/game/pchdef.h
+++ b/src/game/pchdef.h
@@ -9,8 +9,4 @@
#include "Database/SQLStorage.h"
#include "Opcodes.h"
#include "SharedDefines.h"
-
-#ifdef FASTBUILD
-//add additional headers here to speed up compilation in release builds even more
#include "ObjectMgr.h"
-#endif \ No newline at end of file
diff --git a/src/shared/Errors.h b/src/shared/Errors.h
index 5cfd109ee01..bb17b94cbd0 100644
--- a/src/shared/Errors.h
+++ b/src/shared/Errors.h
@@ -23,8 +23,10 @@
#include "Common.h"
+#if PLATFORM != PLATFORM_WINDOWS
#ifndef HAVE_CONFIG_H
-#define HAVE_ACE_STACK_TRACE_H 1
+#include <config.h>
+#endif
#endif
#ifdef HAVE_ACE_STACK_TRACE_H
diff --git a/src/trinitycore/RASocket.cpp b/src/trinitycore/RASocket.cpp
index 50a1af87256..b15f4e447d6 100644
--- a/src/trinitycore/RASocket.cpp
+++ b/src/trinitycore/RASocket.cpp
@@ -25,7 +25,6 @@
#include "Common.h"
#include "Config/ConfigEnv.h"
#include "Database/DatabaseEnv.h"
-
#include "AccountMgr.h"
#include "Log.h"
#include "RASocket.h"
@@ -198,8 +197,8 @@ void RASocket::OnRead()
LoginDatabase.escape_string(pw);
QueryResult *check = LoginDatabase.PQuery(
- "SELECT 1 FROM account WHERE username = '%s' AND sha_pass_hash=SHA1(CONCAT(username,':','%s'))",
- login.c_str(), pw.c_str());
+ "SELECT 1 FROM account WHERE username = '%s' AND sha_pass_hash=SHA1(CONCAT('%s',':','%s'))",
+ login.c_str(), login.c_str(), pw.c_str());
if(check)
{
diff --git a/src/trinitycore/trinitycore.conf.dist b/src/trinitycore/trinitycore.conf.dist
index 9a33a2daf6e..cbc2ee54f3d 100644
--- a/src/trinitycore/trinitycore.conf.dist
+++ b/src/trinitycore/trinitycore.conf.dist
@@ -632,8 +632,8 @@ ChatLogTimestamp = 0
#
# AllFlightPaths
# Players will start with all flight paths (Note: ALL flight paths, not only player's team)
-# Default: 0 (true)
-# 1 (false)
+# Default: 0 (false)
+# 1 (true)
#
# AlwaysMaxSkillForLevel
# Players will automatically gain max level dependent (weapon/defense) skill when logging in, leveling up etc.