From 6907d51b6b4edd6cd5639db11d18768bb583f157 Mon Sep 17 00:00:00 2001 From: MitchesD Date: Sat, 15 Feb 2014 23:15:41 +0100 Subject: Scripts/Kelthuzad: move spells into spelldifficulty_dbc and cleanup --- .../scripts/Northrend/Naxxramas/boss_kelthuzad.cpp | 84 ++++++++-------------- 1 file changed, 30 insertions(+), 54 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp index 2091b82e20c..762277ec4fa 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp @@ -70,15 +70,13 @@ enum Events EVENT_TRIGGER, EVENT_PHASE, - EVENT_MORTAL_WOUND, + EVENT_MORTAL_WOUND }; enum Spells { SPELL_FROST_BOLT = 28478, - H_SPELL_FROST_BOLT = 55802, SPELL_FROST_BOLT_AOE = 28479, - H_SPELL_FROST_BOLT_AOE = 55807, SPELL_SHADOW_FISURE = 27810, SPELL_VOID_BLAST = 27812, SPELL_MANA_DETONATION = 27819, @@ -122,7 +120,7 @@ enum Spells // Abomination spells SPELL_FRENZY = 28468, - SPELL_MORTAL_WOUND = 28467, + SPELL_MORTAL_WOUND = 28467 }; enum Creatures @@ -133,7 +131,7 @@ enum Creatures NPC_ICECROWN = 16441 // Guardians of Icecrown }; -const Position Pos[12] = +Position const Pos[12] = { {3783.272705f, -5062.697266f, 143.711203f, 3.617599f}, //LEFT_FAR {3730.291260f, -5027.239258f, 143.956909f, 4.461900f}, //LEFT_MIDDLE @@ -146,13 +144,13 @@ const Position Pos[12] = {3732.02f, -5028.53f, 143.92f, 4.49f}, //WINDOW_PORTAL02 {3687.571777f, -5126.831055f, 142.017807f, 0.604023f}, //RIGHT_FAR {3707.990733f, -5151.450195f, 142.032562f, 1.376855f}, //RIGHT_MIDDLE - {3782.76f, -5062.97f, 143.79f, 3.82f}, //WINDOW_PORTAL03 + {3782.76f, -5062.97f, 143.79f, 3.82f} //WINDOW_PORTAL03 }; //creatures in corners //Unstoppable Abominations #define MAX_ABOMINATIONS 21 -const Position PosAbominations[MAX_ABOMINATIONS] = +Position const PosAbominations[MAX_ABOMINATIONS] = { {3755.52f, -5155.22f, 143.480f, 2.0f}, {3744.35f, -5164.03f, 143.590f, 2.00f}, @@ -174,12 +172,12 @@ const Position PosAbominations[MAX_ABOMINATIONS] = {3669.74f, -5149.63f, 143.678f, 0.528643f}, {3695.53f, -5169.53f, 143.671f, 2.11908f}, {3701.98f, -5166.51f, 143.395f, 1.24257f}, - {3709.62f, -5169.15f, 143.576f, 5.97695f}, + {3709.62f, -5169.15f, 143.576f, 5.97695f} }; //Soldiers of the Frozen Wastes #define MAX_WASTES 49 -const Position PosWastes[MAX_WASTES] = +Position const PosWastes[MAX_WASTES] = { {3754.41f, -5147.24f, 143.204f, 2.0f}, {3754.68f, -5156.17f, 143.418f, 2.0f}, @@ -229,12 +227,12 @@ const Position PosWastes[MAX_WASTES] = {3708.53f, -5172.19f, 143.573f, 3.26575f}, {3712.49f, -5167.62f, 143.657f, 5.63295f}, {3704.89f, -5161.84f, 143.239f, 5.63295f}, - {3695.66f, -5164.63f, 143.674f, 1.54416f}, + {3695.66f, -5164.63f, 143.674f, 1.54416f} }; //Soul Weavers #define MAX_WEAVERS 7 -const Position PosWeavers[MAX_WEAVERS] = +Position const PosWeavers[MAX_WEAVERS] = { {3752.45f, -5168.35f, 143.562f, 1.6094f}, {3772.2f, -5070.04f, 143.329f, 1.93686f}, @@ -242,7 +240,7 @@ const Position PosWeavers[MAX_WEAVERS] = {3689.05f, -5055.7f, 143.172f, 6.09554f}, {3649.45f, -5093.17f, 143.299f, 2.51805f}, {3659.7f, -5144.49f, 143.363f, 4.08806f}, - {3704.71f, -5175.96f, 143.597f, 3.36549f}, + {3704.71f, -5175.96f, 143.597f, 3.36549f} }; // predicate function to select not charmed target @@ -278,9 +276,6 @@ public: std::map chained; - uint64 PortalsGUID[4]; - uint64 KTTriggerGUID; - SummonList spawns; // adds spawn by the trigger. kept in separated list (i.e. not in summons) void ResetPlayerScale() @@ -299,36 +294,29 @@ public: { _Reset(); - PortalsGUID[0] = PortalsGUID[1] = PortalsGUID[2] = PortalsGUID[3] = 0; - KTTriggerGUID = 0; - me->setFaction(35); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NOT_SELECTABLE); ResetPlayerScale(); spawns.DespawnAll(); - FindGameObjects(); - instance->SetData(DATA_ABOMINATION_KILLED, 0); - if (GameObject* pKTTrigger = me->GetMap()->GetGameObject(KTTriggerGUID)) + if (GameObject* trigger = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_KELTHUZAD_TRIGGER))) { - pKTTrigger->ResetDoorOrButton(); - pKTTrigger->SetPhaseMask(1, true); + trigger->ResetDoorOrButton(); + trigger->SetPhaseMask(1, true); } for (uint8 i = 0; i <= 3; ++i) { - if (GameObject* pPortal = me->GetMap()->GetGameObject(PortalsGUID[i])) - { - if (!((pPortal->getLootState() == GO_READY) || (pPortal->getLootState() == GO_NOT_READY))) - pPortal->ResetDoorOrButton(); - } + if (GameObject* portal = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_KELTHUZAD_PORTAL01 + i))) + if (!((portal->getLootState() == GO_READY) || (portal->getLootState() == GO_NOT_READY))) + portal->ResetDoorOrButton(); } nGuardiansOfIcecrownCount = 0; - uiGuardiansOfIcecrownTimer = 5000; //5 seconds for summoning each Guardian of Icecrown in phase 3 + uiGuardiansOfIcecrownTimer = 5000; // 5 seconds for summoning each Guardian of Icecrown in phase 3 Phase = 0; nAbomination = 0; @@ -353,11 +341,10 @@ public: me->setFaction(uiFaction); _EnterCombat(); - FindGameObjects(); for (uint8 i = 0; i <= 3; ++i) { - if (GameObject* pPortal = me->GetMap()->GetGameObject(PortalsGUID[i])) - pPortal->ResetDoorOrButton(); + if (GameObject* portal = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_KELTHUZAD_PORTAL01 + i))) + portal->ResetDoorOrButton(); } DoCast(me, SPELL_KELTHUZAD_CHANNEL, false); Talk(SAY_SUMMON_MINIONS); @@ -372,15 +359,6 @@ public: events.ScheduleEvent(EVENT_PHASE, 228000); } - void FindGameObjects() - { - PortalsGUID[0] = instance->GetData64(DATA_KELTHUZAD_PORTAL01); - PortalsGUID[1] = instance->GetData64(DATA_KELTHUZAD_PORTAL02); - PortalsGUID[2] = instance->GetData64(DATA_KELTHUZAD_PORTAL03); - PortalsGUID[3] = instance->GetData64(DATA_KELTHUZAD_PORTAL04); - KTTriggerGUID = instance->GetData64(DATA_KELTHUZAD_TRIGGER); - } - void UpdateAI(uint32 diff) OVERRIDE { if (!UpdateVictim()) @@ -419,8 +397,8 @@ public: events.PopEvent(); break; case EVENT_TRIGGER: - if (GameObject* pKTTrigger = me->GetMap()->GetGameObject(KTTriggerGUID)) - pKTTrigger->SetPhaseMask(2, true); + if (GameObject* trigger = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_KELTHUZAD_TRIGGER))) + trigger->SetPhaseMask(2, true); events.PopEvent(); break; case EVENT_PHASE: @@ -461,11 +439,9 @@ public: for (uint8 i = 0; i <= 3; ++i) { - if (GameObject* pPortal = me->GetMap()->GetGameObject(PortalsGUID[i])) - { - if (pPortal->getLootState() == GO_READY) - pPortal->UseDoorOrButton(); - } + if (GameObject* portal = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_KELTHUZAD_PORTAL01 + i))) + if (portal->getLootState() == GO_READY) + portal->UseDoorOrButton(); } } } @@ -474,8 +450,8 @@ public: if (uiGuardiansOfIcecrownTimer <= diff) { /// @todo Add missing text - if (Creature* pGuardian = DoSummon(NPC_ICECROWN, Pos[RAND(2, 5, 8, 11)])) - pGuardian->SetFloatValue(UNIT_FIELD_COMBATREACH, 2); + if (Creature* guardian = DoSummon(NPC_ICECROWN, Pos[RAND(2, 5, 8, 11)])) + guardian->SetFloatValue(UNIT_FIELD_COMBATREACH, 2); ++nGuardiansOfIcecrownCount; uiGuardiansOfIcecrownTimer = 5000; } @@ -490,11 +466,11 @@ public: switch (eventId) { case EVENT_BOLT: - DoCastVictim(RAID_MODE(SPELL_FROST_BOLT, H_SPELL_FROST_BOLT)); + DoCastVictim(SPELL_FROST_BOLT); events.RepeatEvent(urand(5000, 10000)); break; case EVENT_NOVA: - DoCastAOE(RAID_MODE(SPELL_FROST_BOLT_AOE, H_SPELL_FROST_BOLT_AOE)); + DoCastAOE(SPELL_FROST_BOLT_AOE); events.RepeatEvent(urand(15000, 30000)); break; case EVENT_CHAIN: @@ -666,7 +642,7 @@ public: if (!instance || instance->IsEncounterInProgress() || instance->GetBossState(BOSS_KELTHUZAD) == DONE) return false; - Creature* pKelthuzad = Unit::GetCreature(*player, instance->GetData64(DATA_KELTHUZAD)); + Creature* pKelthuzad = ObjectAccessor::GetCreature(*player, instance->GetData64(DATA_KELTHUZAD)); if (!pKelthuzad) return false; @@ -675,7 +651,7 @@ public: return false; pKelthuzadAI->AttackStart(player); - if (GameObject* trigger = instance->instance->GetGameObject(instance->GetData64(DATA_KELTHUZAD_TRIGGER))) + if (GameObject* trigger = ObjectAccessor::GetGameObject(*player, instance->GetData64(DATA_KELTHUZAD_TRIGGER))) { if (trigger->getLootState() == GO_READY) trigger->UseDoorOrButton(); -- cgit v1.2.3 From ab602837b1a9c776fe9d964f1a259aec0f5f94bd Mon Sep 17 00:00:00 2001 From: MitchesD Date: Sat, 29 Mar 2014 21:02:26 +0100 Subject: Scripts/ZulGurub: clean up the code and remove old hacks --- .../EasternKingdoms/ZulGurub/boss_arlokk.cpp | 4 +- .../EasternKingdoms/ZulGurub/boss_gahzranka.cpp | 3 +- .../EasternKingdoms/ZulGurub/boss_grilek.cpp | 3 +- .../EasternKingdoms/ZulGurub/boss_hakkar.cpp | 3 +- .../EasternKingdoms/ZulGurub/boss_hazzarah.cpp | 8 +- .../EasternKingdoms/ZulGurub/boss_jindo.cpp | 148 ++++++++------------- .../EasternKingdoms/ZulGurub/boss_mandokir.cpp | 22 +-- .../EasternKingdoms/ZulGurub/boss_marli.cpp | 41 +++--- .../EasternKingdoms/ZulGurub/boss_renataki.cpp | 19 ++- .../EasternKingdoms/ZulGurub/boss_thekal.cpp | 25 ++-- .../EasternKingdoms/ZulGurub/boss_venoxis.cpp | 4 +- .../EasternKingdoms/ZulGurub/boss_wushoolay.cpp | 3 +- 12 files changed, 121 insertions(+), 162 deletions(-) (limited to 'src') diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp index e542b3c4895..d34b3600fe9 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp @@ -139,7 +139,7 @@ class boss_arlokk : public CreatureScript _triggersSideAGUID[sideA] = trigger->GetGUID(); ++sideA; } - else + else { _triggersSideBGUID[sideB] = trigger->GetGUID(); ++sideB; @@ -364,7 +364,7 @@ class npc_zulian_prowler : public CreatureScript void JustDied(Unit* /*killer*/) OVERRIDE { - if (Unit* arlokk = me->GetUnit(*me, _instance->GetData64(NPC_ARLOKK))) + if (Unit* arlokk = ObjectAccessor::GetUnit(*me, _instance->GetData64(NPC_ARLOKK))) { if (arlokk->IsAlive()) arlokk->GetAI()->SetData(_sideData, 0); diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp index ef188dd9261..70d920c1ad4 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp @@ -43,7 +43,8 @@ enum Events class boss_gahzranka : public CreatureScript // gahzranka { - public: boss_gahzranka() : CreatureScript("boss_gahzranka") { } + public: + boss_gahzranka() : CreatureScript("boss_gahzranka") { } struct boss_gahzrankaAI : public BossAI { diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp index 120961a087e..2e7f5b2900f 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp @@ -41,7 +41,8 @@ enum Events class boss_grilek : public CreatureScript // grilek { - public: boss_grilek() : CreatureScript("boss_grilek") { } + public: + boss_grilek() : CreatureScript("boss_grilek") { } struct boss_grilekAI : public BossAI { diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp index 84ebc313b12..0d70552d306 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp @@ -66,7 +66,8 @@ enum Events class boss_hakkar : public CreatureScript { - public: boss_hakkar() : CreatureScript("boss_hakkar") { } + public: + boss_hakkar() : CreatureScript("boss_hakkar") { } struct boss_hakkarAI : public BossAI { diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp index 232c9059b47..6b938dc9276 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp @@ -42,7 +42,8 @@ enum Events class boss_hazzarah : public CreatureScript { - public: boss_hazzarah() : CreatureScript("boss_hazzarah") { } + public: + boss_hazzarah() : CreatureScript("boss_hazzarah") { } struct boss_hazzarahAI : public BossAI { @@ -94,11 +95,8 @@ class boss_hazzarah : public CreatureScript for (uint8 i = 0; i < 3; ++i) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - { - Creature* Illusion = me->SummonCreature(NPC_NIGHTMARE_ILLUSION, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000); - if (Illusion) + if (Creature* Illusion = me->SummonCreature(NPC_NIGHTMARE_ILLUSION, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000)) Illusion->AI()->AttackStart(target); - } } events.ScheduleEvent(EVENT_ILLUSIONS, urand(15000, 25000)); break; diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp index b4ba1ef71fb..240a3b1fc9a 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp @@ -16,13 +16,6 @@ * with this program. If not, see . */ -/* ScriptData -SDName: Boss_Jin'do the Hexxer -SD%Complete: 85 -SDComment: Mind Control not working because of core bug. Shades visible for all. -SDCategory: Zul'Gurub -EndScriptData */ - #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "zulgurub.h" @@ -34,32 +27,48 @@ enum Say enum Spells { - SPELL_BRAINWASHTOTEM = 24262, - SPELL_POWERFULLHEALINGWARD = 24309, // HACKED Totem summoned by script because the spell totems will not cast. + SPELL_BRAIN_WASH_TOTEM = 24262, + SPELL_POWERFULL_HEALING_WARD = 24309, SPELL_HEX = 24053, - SPELL_DELUSIONSOFJINDO = 24306, - SPELL_SHADEOFJINDO = 24308, // HACKED - //Healing Ward Spell - SPELL_HEAL = 38588, // HACKED Totems are not working right. Right heal spell ID is 24311 but this spell is not casting... - //Shade of Jindo Spell + SPELL_DELUSIONS_OF_JINDO = 24306, + SPELL_SHADE_OF_JINDO = 24308, + // Healing Ward Spell + SPELL_HEAL = 24311, + // Shade of Jindo Spell SPELL_SHADOWSHOCK = 19460, - SPELL_INVISIBLE = 24699 + SPELL_INVISIBLE = 24307 }; enum Events { - EVENT_BRAINWASHTOTEM = 1, - EVENT_POWERFULLHEALINGWARD = 2, + EVENT_BRAIN_WASH_TOTEM = 1, + EVENT_POWERFULL_HEALING_WARD = 2, EVENT_HEX = 3, - EVENT_DELUSIONSOFJINDO = 4, + EVENT_DELUSIONS_OF_JINDO = 4, EVENT_TELEPORT = 5 }; -Position const TeleportLoc = {-11583.7783f, -1249.4278f, 77.5471f, 4.745f}; +Position const TeleportLoc = { -11583.7783f, -1249.4278f, 77.5471f, 4.745f }; + +// Formation of summoned trolls +Position const Formation[] = +{ + { -11582.2998f, -1247.8599f, 77.6298f, 0.0f }, + { -11585.0996f, -1248.7600f, 77.6298f, 0.0f }, + { -11586.5996f, -1250.7199f, 77.6298f, 0.0f }, + { -11586.4003f, -1253.9200f, 77.6298f, 0.0f }, + { -11584.2001f, -1252.2099f, 77.6298f, 0.0f }, + { -11582.5000f, -1250.3199f, 77.6298f, 0.0f }, + { -11583.2001f, -1254.8299f, 77.6298f, 0.0f }, + { -11581.5000f, -1252.5400f, 77.6298f, 0.0f }, + { -11580.2001f, -1250.5999f, 77.6298f, 0.0f }, + { -11580.5996f, -1254.7900f, 77.6298f, 0.0f } +}; class boss_jindo : public CreatureScript { - public: boss_jindo() : CreatureScript("boss_jindo") { } + public: + boss_jindo() : CreatureScript("boss_jindo") { } struct boss_jindoAI : public BossAI { @@ -78,10 +87,10 @@ class boss_jindo : public CreatureScript void EnterCombat(Unit* /*who*/) OVERRIDE { _EnterCombat(); - events.ScheduleEvent(EVENT_BRAINWASHTOTEM, 20000); - events.ScheduleEvent(EVENT_POWERFULLHEALINGWARD, 16000); + events.ScheduleEvent(EVENT_BRAIN_WASH_TOTEM, 20000); + events.ScheduleEvent(EVENT_POWERFULL_HEALING_WARD, 16000); events.ScheduleEvent(EVENT_HEX, 8000); - events.ScheduleEvent(EVENT_DELUSIONSOFJINDO, 10000); + events.ScheduleEvent(EVENT_DELUSIONS_OF_JINDO, 10000); events.ScheduleEvent(EVENT_TELEPORT, 5000); Talk(SAY_AGGRO); } @@ -100,14 +109,13 @@ class boss_jindo : public CreatureScript { switch (eventId) { - case EVENT_BRAINWASHTOTEM: - DoCast(me, SPELL_BRAINWASHTOTEM); - events.ScheduleEvent(EVENT_BRAINWASHTOTEM, urand(18000, 26000)); + case EVENT_BRAIN_WASH_TOTEM: + DoCast(me, SPELL_BRAIN_WASH_TOTEM); + events.ScheduleEvent(EVENT_BRAIN_WASH_TOTEM, urand(18000, 26000)); break; - case EVENT_POWERFULLHEALINGWARD: // HACK - //DoCast(me, SPELL_POWERFULLHEALINGWARD); - me->SummonCreature(14987, me->GetPositionX()+3, me->GetPositionY()-2, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 30000); - events.ScheduleEvent(EVENT_POWERFULLHEALINGWARD, urand(14000, 20000)); + case EVENT_POWERFULL_HEALING_WARD: + DoCast(me, SPELL_POWERFULL_HEALING_WARD); + events.ScheduleEvent(EVENT_POWERFULL_HEALING_WARD, urand(14000, 20000)); break; case EVENT_HEX: if (Unit* target = me->GetVictim()) @@ -118,52 +126,27 @@ class boss_jindo : public CreatureScript } events.ScheduleEvent(EVENT_HEX, urand(12000, 20000)); break; - case EVENT_DELUSIONSOFJINDO: // HACK + case EVENT_DELUSIONS_OF_JINDO: // Casting the delusion curse with a shade so shade will attack the same target with the curse. - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) { - DoCast(target, SPELL_DELUSIONSOFJINDO); - Creature* Shade = me->SummonCreature(NPC_SHADE_OF_JINDO, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (Shade) - Shade->AI()->AttackStart(target); + DoCast(target, SPELL_SHADE_OF_JINDO, true); + DoCast(target, SPELL_DELUSIONS_OF_JINDO); } - events.ScheduleEvent(EVENT_DELUSIONSOFJINDO, urand(4000, 12000)); + events.ScheduleEvent(EVENT_DELUSIONS_OF_JINDO, urand(4000, 12000)); break; - case EVENT_TELEPORT: // Possible HACK + case EVENT_TELEPORT: // Teleports a random player and spawns 9 Sacrificed Trolls to attack player - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) { - DoTeleportPlayer(target, TeleportLoc.m_positionX, TeleportLoc.m_positionY, TeleportLoc.m_positionZ, TeleportLoc.m_orientation); + DoTeleportPlayer(target, TeleportLoc.GetPositionX(), TeleportLoc.GetPositionY(), TeleportLoc.GetPositionZ(), TeleportLoc.GetOrientation()); if (DoGetThreat(me->GetVictim())) DoModifyThreatPercent(target, -100); - Creature* SacrificedTroll; - SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, target->GetPositionX()+2, target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (SacrificedTroll) - SacrificedTroll->AI()->AttackStart(target); - SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, target->GetPositionX()-2, target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (SacrificedTroll) - SacrificedTroll->AI()->AttackStart(target); - SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, target->GetPositionX()+4, target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (SacrificedTroll) - SacrificedTroll->AI()->AttackStart(target); - SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, target->GetPositionX()-4, target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (SacrificedTroll) - SacrificedTroll->AI()->AttackStart(target); - SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, target->GetPositionX(), target->GetPositionY()+2, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (SacrificedTroll) - SacrificedTroll->AI()->AttackStart(target); - SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, target->GetPositionX(), target->GetPositionY()-2, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (SacrificedTroll) - SacrificedTroll->AI()->AttackStart(target); - SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, target->GetPositionX(), target->GetPositionY()+4, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (SacrificedTroll) - SacrificedTroll->AI()->AttackStart(target); - SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, target->GetPositionX(), target->GetPositionY()-4, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (SacrificedTroll) - SacrificedTroll->AI()->AttackStart(target); - SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, target->GetPositionX()+3, target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (SacrificedTroll) - SacrificedTroll->AI()->AttackStart(target); + + // Summon a formation of trolls + for (uint8 i = 0; i < 10; ++i) + if (Creature* SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, Formation[i].GetPositionX(), Formation[i].GetPositionY(), Formation[i].GetPositionZ(), Formation[i].GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000)) + SacrificedTroll->AI()->AttackStart(target); } events.ScheduleEvent(EVENT_TELEPORT, urand(15000, 23000)); break; @@ -182,15 +165,11 @@ class boss_jindo : public CreatureScript } }; -//Healing Ward +// Healing Ward class npc_healing_ward : public CreatureScript { public: - - npc_healing_ward() - : CreatureScript("npc_healing_ward") - { - } + npc_healing_ward() : CreatureScript("npc_healing_ward") { } struct npc_healing_wardAI : public ScriptedAI { @@ -200,7 +179,6 @@ class npc_healing_ward : public CreatureScript } uint32 Heal_Timer; - InstanceScript* instance; void Reset() OVERRIDE @@ -208,18 +186,15 @@ class npc_healing_ward : public CreatureScript Heal_Timer = 2000; } - void EnterCombat(Unit* /*who*/) OVERRIDE - { - } + void EnterCombat(Unit* /*who*/) OVERRIDE { } void UpdateAI(uint32 diff) OVERRIDE { - //Heal_Timer + // Heal_Timer if (Heal_Timer <= diff) { - Unit* pJindo = Unit::GetUnit(*me, instance->GetData64(DATA_JINDO)); - if (pJindo) - DoCast(pJindo, SPELL_HEAL); + if (Unit* jindo = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_JINDO))) + DoCast(jindo, SPELL_HEAL); Heal_Timer = 3000; } else Heal_Timer -= diff; @@ -237,11 +212,7 @@ class npc_healing_ward : public CreatureScript class npc_shade_of_jindo : public CreatureScript { public: - - npc_shade_of_jindo() - : CreatureScript("npc_shade_of_jindo") - { - } + npc_shade_of_jindo() : CreatureScript("npc_shade_of_jindo") { } struct npc_shade_of_jindoAI : public ScriptedAI { @@ -259,8 +230,7 @@ class npc_shade_of_jindo : public CreatureScript void UpdateAI(uint32 diff) OVERRIDE { - - //ShadowShock_Timer + // ShadowShock_Timer if (ShadowShock_Timer <= diff) { DoCastVictim(SPELL_SHADOWSHOCK); diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp index d307303f4f4..bb2a17704ed 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp @@ -37,7 +37,8 @@ enum Says SAY_WATCH = 2, SAY_WATCH_WHISPER = 3, SAY_OHGAN_DEAD = 4, - SAY_GRATS_JINDO = 0, + + SAY_GRATS_JINDO = 0 }; enum Spells @@ -106,7 +107,8 @@ Position const PosMandokir[2] = class boss_mandokir : public CreatureScript { - public: boss_mandokir() : CreatureScript("boss_mandokir") { } + public: + boss_mandokir() : CreatureScript("boss_mandokir") { } struct boss_mandokirAI : public BossAI { @@ -118,9 +120,9 @@ class boss_mandokir : public CreatureScript { _Reset(); killCount = 0; - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); events.ScheduleEvent(EVENT_CHECK_START, 1000); - if (Creature* speaker = Creature::GetCreature(*me, instance->GetData64(NPC_VILEBRANCH_SPEAKER))) + if (Creature* speaker = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_VILEBRANCH_SPEAKER))) if (!speaker->IsAlive()) speaker->Respawn(true); } @@ -132,7 +134,7 @@ class boss_mandokir : public CreatureScript { // Do not want to unsummon Ohgan for (int i = 0; i < CHAINED_SPIRT_COUNT; ++i) - if (Creature* unsummon = Creature::GetCreature(*me, chainedSpirtGUIDs[i])) + if (Creature* unsummon = ObjectAccessor::GetCreature(*me, chainedSpirtGUIDs[i])) unsummon->DespawnOrUnsummon(); instance->SetBossState(DATA_MANDOKIR, DONE); instance->SaveToDB(); @@ -169,7 +171,7 @@ class boss_mandokir : public CreatureScript if (++killCount == 3) { Talk(SAY_DING_KILL); - if (Creature* jindo = Creature::GetCreature(*me, instance->GetData64(DATA_JINDO))) + if (Creature* jindo = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_JINDO))) if (jindo->IsAlive()) jindo->AI()->Talk(SAY_GRATS_JINDO); DoCast(me, SPELL_LEVEL_UP, true); @@ -213,7 +215,7 @@ class boss_mandokir : public CreatureScript events.ScheduleEvent(EVENT_CHECK_START, 1000); break; case EVENT_STARTED: - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); me->GetMotionMaster()->MovePath(PATH_MANDOKIR, false); break; default: @@ -293,7 +295,8 @@ enum OhganSpells class npc_ohgan : public CreatureScript { - public: npc_ohgan() : CreatureScript("npc_ohgan") { } + public: + npc_ohgan() : CreatureScript("npc_ohgan") { } struct npc_ohganAI : public ScriptedAI { @@ -345,7 +348,8 @@ enum VilebranchSpells class npc_vilebranch_speaker : public CreatureScript { - public: npc_vilebranch_speaker() : CreatureScript("npc_vilebranch_speaker") { } + public: + npc_vilebranch_speaker() : CreatureScript("npc_vilebranch_speaker") { } struct npc_vilebranch_speakerAI : public ScriptedAI { diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp index efd79d89a2b..0afee7f66e0 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp @@ -29,10 +29,10 @@ EndScriptData */ enum Says { - SAY_AGGRO = 0, - SAY_TRANSFORM = 1, - SAY_SPIDER_SPAWN = 2, - SAY_DEATH = 3 + SAY_AGGRO = 0, + SAY_TRANSFORM = 1, + SAY_SPIDER_SPAWN = 2, + SAY_DEATH = 3 }; enum Spells @@ -64,6 +64,11 @@ enum Phases PHASE_THREE = 3 }; +enum Misc +{ + NPC_SPIDER = 15041 +}; + class boss_marli : public CreatureScript { public: boss_marli() : CreatureScript("boss_marli") { } @@ -107,23 +112,12 @@ class boss_marli : public CreatureScript switch (eventId) { case EVENT_SPAWN_START_SPIDERS: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) { Talk(SAY_SPIDER_SPAWN); - Creature* Spider = NULL; - Spider = me->SummonCreature(15041, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (Spider) - Spider->AI()->AttackStart(target); - Spider = me->SummonCreature(15041, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (Spider) - Spider->AI()->AttackStart(target); - Spider = me->SummonCreature(15041, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (Spider) - Spider->AI()->AttackStart(target); - Spider = me->SummonCreature(15041, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (Spider) - Spider->AI()->AttackStart(target); + for (uint8 i = 0; i < 4; ++i) + if (Creature* spider = me->SummonCreature(NPC_SPIDER, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000)) + spider->AI()->AttackStart(target); } events.ScheduleEvent(EVENT_ASPECT_OF_MARLI, 12000, 0, PHASE_TWO); events.ScheduleEvent(EVENT_TRANSFORM, 45000, 0, PHASE_TWO); @@ -142,11 +136,8 @@ class boss_marli : public CreatureScript break; case EVENT_SPAWN_SPIDER: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - { - Creature* Spider = me->SummonCreature(15041, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (Spider) - Spider->AI()->AttackStart(target); - } + if (Creature* spider = me->SummonCreature(NPC_SPIDER, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000)) + spider->AI()->AttackStart(target); events.ScheduleEvent(EVENT_SPAWN_SPIDER, urand(12000, 17000)); break; case EVENT_TRANSFORM: @@ -235,9 +226,7 @@ class npc_spawn_of_marli : public CreatureScript LevelUp_Timer = 3000; } - void EnterCombat(Unit* /*who*/) OVERRIDE - { - } + void EnterCombat(Unit* /*who*/) OVERRIDE { } void UpdateAI(uint32 diff) OVERRIDE { diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp index 87a8e647f53..6ed9f5e073f 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp @@ -40,7 +40,8 @@ enum Misc class boss_renataki : public CreatureScript { - public: boss_renataki() : CreatureScript("boss_renataki") { } + public: + boss_renataki() : CreatureScript("boss_renataki") { } struct boss_renatakiAI : public BossAI { @@ -101,9 +102,7 @@ class boss_renataki : public CreatureScript { if (Ambush_Timer <= diff) { - Unit* target = NULL; - target = SelectTarget(SELECT_TARGET_RANDOM, 0); - if (target) + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) { DoTeleportTo(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ()); DoCast(target, SPELL_AMBUSH); @@ -135,14 +134,12 @@ class boss_renataki : public CreatureScript { if (Aggro_Timer <= diff) { - Unit* target = NULL; - target = SelectTarget(SELECT_TARGET_RANDOM, 1); - - if (DoGetThreat(me->GetVictim())) - DoModifyThreatPercent(me->GetVictim(), -50); - - if (target) + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) + { + if (DoGetThreat(me->GetVictim())) + DoModifyThreatPercent(me->GetVictim(), -50); AttackStart(target); + } Aggro_Timer = urand(7000, 20000); } else Aggro_Timer -= diff; diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp index a70dd5e0a30..63531fc8ee9 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp @@ -78,7 +78,8 @@ enum Phases class boss_thekal : public CreatureScript { - public: boss_thekal() : CreatureScript("boss_thekal") { } + public: + boss_thekal() : CreatureScript("boss_thekal") { } struct boss_thekalAI : public BossAI { @@ -171,7 +172,7 @@ class boss_thekal : public CreatureScript if (instance->GetBossState(DATA_LORKHAN) == SPECIAL) { //Resurrect LorKhan - if (Unit* pLorKhan = Unit::GetUnit(*me, instance->GetData64(DATA_LORKHAN))) + if (Unit* pLorKhan = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_LORKHAN))) { pLorKhan->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); pLorKhan->setFaction(14); @@ -184,7 +185,7 @@ class boss_thekal : public CreatureScript if (instance->GetBossState(DATA_ZATH) == SPECIAL) { //Resurrect Zath - if (Unit* pZath = Unit::GetUnit(*me, instance->GetData64(DATA_ZATH))) + if (Unit* pZath = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_ZATH))) { pZath->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); pZath->setFaction(14); @@ -318,8 +319,8 @@ class npc_zealot_lorkhan : public CreatureScript //Casting Greaterheal to Thekal or Zath if they are in meele range. if (GreaterHeal_Timer <= diff) { - Unit* pThekal = Unit::GetUnit(*me, instance->GetData64(DATA_THEKAL)); - Unit* pZath = Unit::GetUnit(*me, instance->GetData64(DATA_ZATH)); + Unit* pThekal = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THEKAL)); + Unit* pZath = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_ZATH)); if (!pThekal || !pZath) return; @@ -352,7 +353,7 @@ class npc_zealot_lorkhan : public CreatureScript if (instance->GetBossState(DATA_THEKAL) == SPECIAL) { //Resurrect Thekal - if (Unit* pThekal = Unit::GetUnit(*me, instance->GetData64(DATA_THEKAL))) + if (Unit* pThekal = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THEKAL))) { pThekal->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); pThekal->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); @@ -364,7 +365,7 @@ class npc_zealot_lorkhan : public CreatureScript if (instance->GetBossState(DATA_ZATH) == SPECIAL) { //Resurrect Zath - if (Unit* pZath = Unit::GetUnit(*me, instance->GetData64(DATA_ZATH))) + if (Unit* pZath = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_ZATH))) { pZath->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); pZath->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); @@ -405,11 +406,7 @@ class npc_zealot_lorkhan : public CreatureScript class npc_zealot_zath : public CreatureScript { public: - - npc_zealot_zath() - : CreatureScript("npc_zealot_zath") - { - } + npc_zealot_zath() : CreatureScript("npc_zealot_zath") { } struct npc_zealot_zathAI : public ScriptedAI { @@ -500,7 +497,7 @@ class npc_zealot_zath : public CreatureScript if (instance->GetBossState(DATA_LORKHAN) == SPECIAL) { //Resurrect LorKhan - if (Unit* pLorKhan = Unit::GetUnit(*me, instance->GetData64(DATA_LORKHAN))) + if (Unit* pLorKhan = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_LORKHAN))) { pLorKhan->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); pLorKhan->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); @@ -512,7 +509,7 @@ class npc_zealot_zath : public CreatureScript if (instance->GetBossState(DATA_THEKAL) == SPECIAL) { //Resurrect Thekal - if (Unit* pThekal = Unit::GetUnit(*me, instance->GetData64(DATA_THEKAL))) + if (Unit* pThekal = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_THEKAL))) { pThekal->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); pThekal->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp index e131ed7ad12..eb795d3a9ef 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp @@ -85,7 +85,8 @@ enum NPCs class boss_venoxis : public CreatureScript { - public: boss_venoxis() : CreatureScript("boss_venoxis") { } + public: + boss_venoxis() : CreatureScript("boss_venoxis") { } struct boss_venoxisAI : public BossAI { @@ -167,7 +168,6 @@ class boss_venoxis : public CreatureScript DoCast(me, SPELL_THRASH, true); events.ScheduleEvent(EVENT_THRASH, urand(10000, 20000)); break; - // troll form spells and Actions (first part) case EVENT_DISPEL_MAGIC: DoCast(me, SPELL_DISPEL_MAGIC); diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp index a4bd38b8fa7..9b7d3863ba8 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp @@ -41,7 +41,8 @@ enum Events class boss_wushoolay : public CreatureScript { - public: boss_wushoolay() : CreatureScript("boss_wushoolay") { } + public: + boss_wushoolay() : CreatureScript("boss_wushoolay") { } struct boss_wushoolayAI : public BossAI { -- cgit v1.2.3 From 17923c3c44c7b623a5142160494209465f8e94ea Mon Sep 17 00:00:00 2001 From: Warpten Date: Sat, 12 Apr 2014 14:45:51 +0200 Subject: Scripts/Commands: Ensure gameobject template is valid from .gob add temp [...] As per Aokrome's spamming. "Avoids false positive logs" --- src/server/scripts/Commands/cs_gobject.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp index 423a47eb3c8..62a61ff741b 100644 --- a/src/server/scripts/Commands/cs_gobject.cpp +++ b/src/server/scripts/Commands/cs_gobject.cpp @@ -209,6 +209,13 @@ public: uint32 objectId = atoi(id); + if (!sObjectMgr->GetGameObjectTemplate(objectId)) + { + handler->PSendSysMessage(LANG_GAMEOBJECT_NOT_EXIST, objectId); + handler->SetSentErrorMessage(true); + return false; + } + player->SummonGameObject(objectId, x, y, z, ang, 0, 0, rot2, rot3, spawntm); return true; -- cgit v1.2.3 From e51976e17a29bd2a318dc84e42cc24d3e9c877ae Mon Sep 17 00:00:00 2001 From: Shauren Date: Sun, 13 Apr 2014 01:06:46 +0200 Subject: Core/Spells: Fixed players being able to mount with all transform auras Closes #11852 --- src/server/game/DataStores/DBCStores.cpp | 2 ++ src/server/game/DataStores/DBCStores.h | 1 + src/server/game/DataStores/DBCStructure.h | 31 +++++++++++++++++++++++++++--- src/server/game/DataStores/DBCfmt.h | 7 ++++--- src/server/game/Entities/Unit/Unit.cpp | 32 ++++++++++++++++++++++++++++--- 5 files changed, 64 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp index 37f4f4c1930..9b0465a4536 100644 --- a/src/server/game/DataStores/DBCStores.cpp +++ b/src/server/game/DataStores/DBCStores.cpp @@ -73,6 +73,7 @@ DBCStorage sChrClassesStore(ChrClassesEntryfmt); DBCStorage sChrRacesStore(ChrRacesEntryfmt); DBCStorage sCinematicSequencesStore(CinematicSequencesEntryfmt); DBCStorage sCreatureDisplayInfoStore(CreatureDisplayInfofmt); +DBCStorage sCreatureDisplayInfoExtraStore(CreatureDisplayInfoExtrafmt); DBCStorage sCreatureFamilyStore(CreatureFamilyfmt); DBCStorage sCreatureModelDataStore(CreatureModelDatafmt); DBCStorage sCreatureSpellDataStore(CreatureSpellDatafmt); @@ -306,6 +307,7 @@ void LoadDBCStores(const std::string& dataPath) LoadDBC(availableDbcLocales, bad_dbc_files, sChrRacesStore, dbcPath, "ChrRaces.dbc"); LoadDBC(availableDbcLocales, bad_dbc_files, sCinematicSequencesStore, dbcPath, "CinematicSequences.dbc"); LoadDBC(availableDbcLocales, bad_dbc_files, sCreatureDisplayInfoStore, dbcPath, "CreatureDisplayInfo.dbc"); + LoadDBC(availableDbcLocales, bad_dbc_files, sCreatureDisplayInfoExtraStore, dbcPath, "CreatureDisplayInfoExtra.dbc"); LoadDBC(availableDbcLocales, bad_dbc_files, sCreatureFamilyStore, dbcPath, "CreatureFamily.dbc"); LoadDBC(availableDbcLocales, bad_dbc_files, sCreatureModelDataStore, dbcPath, "CreatureModelData.dbc"); LoadDBC(availableDbcLocales, bad_dbc_files, sCreatureSpellDataStore, dbcPath, "CreatureSpellData.dbc"); diff --git a/src/server/game/DataStores/DBCStores.h b/src/server/game/DataStores/DBCStores.h index 39747141322..b77db950541 100644 --- a/src/server/game/DataStores/DBCStores.h +++ b/src/server/game/DataStores/DBCStores.h @@ -92,6 +92,7 @@ extern DBCStorage sChrClassesStore; extern DBCStorage sChrRacesStore; extern DBCStorage sCinematicSequencesStore; extern DBCStorage sCreatureDisplayInfoStore; +extern DBCStorage sCreatureDisplayInfoExtraStore; extern DBCStorage sCreatureFamilyStore; extern DBCStorage sCreatureModelDataStore; extern DBCStorage sCreatureSpellDataStore; diff --git a/src/server/game/DataStores/DBCStructure.h b/src/server/game/DataStores/DBCStructure.h index 976b4355957..abe7bde4bf5 100644 --- a/src/server/game/DataStores/DBCStructure.h +++ b/src/server/game/DataStores/DBCStructure.h @@ -690,7 +690,7 @@ struct ChrClassesEntry struct ChrRacesEntry { uint32 RaceID; // 0 - // 1 unused + uint32 Flags; // 1 uint32 FactionID; // 2 facton template id // 3 unused uint32 model_m; // 4 @@ -736,7 +736,7 @@ struct CreatureDisplayInfoEntry uint32 Displayid; // 0 m_ID uint32 ModelId; // 1 m_modelID // 2 m_soundID - // 3 m_extendedDisplayInfoID + uint32 ExtraId; // 3 m_extendedDisplayInfoID float scale; // 4 m_creatureModelScale // 5 m_creatureModelAlpha // 6-8 m_textureVariation[3] @@ -749,6 +749,31 @@ struct CreatureDisplayInfoEntry // 15 m_objectEffectPackageID }; +struct CreatureDisplayInfoExtraEntry +{ + //uint32 Id; // 0 + uint32 Race; // 1 + uint32 Gender; // 2 + //uint32 SkinColor; // 3 + //uint32 FaceType; // 4 + //uint32 HairType; // 5 + //uint32 HairStyle; // 6 + //uint32 FacialHair; // 7 + //uint32 HelmDisplayId; // 8 + //uint32 ShoulderDisplayId; // 9 + //uint32 ShirtDisplayId; // 10 + //uint32 ChestDisplayId; // 11 + //uint32 BeltDisplayId; // 12 + //uint32 LegsDisplayId; // 13 + //uint32 BootsDisplayId; // 14 + //uint32 WristDisplayId; // 15 + //uint32 GlovesDisplayId; // 16 + //uint32 TabardDisplayId; // 17 + //uint32 CloakDisplayId; // 18 + //uint32 CanEquip; // 19 + //char const* Texture; // 20 +}; + struct CreatureFamilyEntry { uint32 ID; // 0 m_ID @@ -768,7 +793,7 @@ struct CreatureFamilyEntry struct CreatureModelDataEntry { uint32 Id; - //uint32 Flags; + uint32 Flags; //char* ModelPath[16] //uint32 Unk1; float Scale; // Used in calculation of unit collision data diff --git a/src/server/game/DataStores/DBCfmt.h b/src/server/game/DataStores/DBCfmt.h index 448a8066434..35a8eecb708 100644 --- a/src/server/game/DataStores/DBCfmt.h +++ b/src/server/game/DataStores/DBCfmt.h @@ -36,11 +36,12 @@ char const CharStartOutfitEntryfmt[] = "dbbbXiiiiiiiiiiiiiiiiiiiiiiiixxxxxxxxxxx char const CharTitlesEntryfmt[] = "nxssssssssssssssssxssssssssssssssssxi"; char const ChatChannelsEntryfmt[] = "nixssssssssssssssssxxxxxxxxxxxxxxxxxx"; char const ChrClassesEntryfmt[] = "nxixssssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxixii"; -char const ChrRacesEntryfmt[] = "nxixiixixxxxixssssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxi"; +char const ChrRacesEntryfmt[] = "niixiixixxxxixssssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxi"; char const CinematicSequencesEntryfmt[] = "nxxxxxxxxx"; -char const CreatureDisplayInfofmt[] = "nixxfxxxxxxxxxxx"; +char const CreatureDisplayInfofmt[] = "nixifxxxxxxxxxxx"; +char const CreatureDisplayInfoExtrafmt[] = "diixxxxxxxxxxxxxxxxxx"; char const CreatureFamilyfmt[] = "nfifiiiiixssssssssssssssssxx"; -char const CreatureModelDatafmt[] = "nxxxfxxxxxxxxxxffxxxxxxxxxxx"; +char const CreatureModelDatafmt[] = "nixxfxxxxxxxxxxffxxxxxxxxxxx"; char const CreatureSpellDatafmt[] = "niiiixxxx"; char const CreatureTypefmt[] = "nxxxxxxxxxxxxxxxxxx"; char const CurrencyTypesfmt[] = "xnxi"; diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 5bf3193fc14..9cc214b7390 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -13051,9 +13051,35 @@ bool Unit::IsInFeralForm() const bool Unit::IsInDisallowedMountForm() const { - ShapeshiftForm form = GetShapeshiftForm(); - return form != FORM_NONE && form != FORM_BATTLESTANCE && form != FORM_BERSERKERSTANCE && form != FORM_DEFENSIVESTANCE && - form != FORM_SHADOW && form != FORM_STEALTH && form != FORM_UNDEAD; + if (ShapeshiftForm form = GetShapeshiftForm()) + { + SpellShapeshiftEntry const* shapeshift = sSpellShapeshiftStore.LookupEntry(form); + if (!shapeshift) + return true; + + if (!(shapeshift->flags1 & 0x1)) + return true; + } + + if (GetDisplayId() == GetNativeDisplayId()) + return false; + + CreatureDisplayInfoEntry const* display = sCreatureDisplayInfoStore.LookupEntry(GetDisplayId()); + if (!display) + return true; + + CreatureDisplayInfoExtraEntry const* displayExtra = sCreatureDisplayInfoExtraStore.LookupEntry(display->ExtraId); + if (!displayExtra) + return true; + + CreatureModelDataEntry const* model = sCreatureModelDataStore.LookupEntry(display->ModelId); + ChrRacesEntry const* race = sChrRacesStore.LookupEntry(displayExtra->Race); + + if (model && !(model->Flags & 0x80)) + if (race && !(race->Flags & 0x4)) + return true; + + return false; } /*####################################### -- cgit v1.2.3 From a07e82530f7ffaf161ae785e1fe1748cd89cc71d Mon Sep 17 00:00:00 2001 From: jackpoz Date: Sun, 13 Apr 2014 13:40:42 +0200 Subject: Scripts/Commands: Fix .mmap loc wrong coordinates Fix .mmap loc command printing swapped x and y tile coordinates --- src/server/scripts/Commands/cs_mmaps.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Commands/cs_mmaps.cpp b/src/server/scripts/Commands/cs_mmaps.cpp index 61598bf0945..47cb5636672 100644 --- a/src/server/scripts/Commands/cs_mmaps.cpp +++ b/src/server/scripts/Commands/cs_mmaps.cpp @@ -127,8 +127,8 @@ public: int32 gx = 32 - player->GetPositionX() / SIZE_OF_GRIDS; int32 gy = 32 - player->GetPositionY() / SIZE_OF_GRIDS; - handler->PSendSysMessage("%03u%02i%02i.mmtile", player->GetMapId(), gy, gx); - handler->PSendSysMessage("gridloc [%i, %i]", gx, gy); + handler->PSendSysMessage("%03u%02i%02i.mmtile", player->GetMapId(), gx, gy); + handler->PSendSysMessage("gridloc [%i, %i]", gy, gx); // calculate navmesh tile location dtNavMesh const* navmesh = MMAP::MMapFactory::createOrGetMMapManager()->GetNavMesh(handler->GetSession()->GetPlayer()->GetMapId()); -- cgit v1.2.3 From dc58ec0d6c4d33e04b74a5ca43340941bcab331c Mon Sep 17 00:00:00 2001 From: jackpoz Date: Sun, 13 Apr 2014 14:06:21 +0200 Subject: Scripts/Commands: ".modify speed" targets current Player by default Allow ".modify speed" command to target current Player if there is no target or if the selected Unit is a Creature. This behavior could be extended to other commands that require target Players. --- src/server/game/Chat/Chat.cpp | 18 ++++++++++++++++++ src/server/game/Chat/Chat.h | 2 ++ src/server/scripts/Commands/cs_modify.cpp | 10 +++++----- 3 files changed, 25 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp index 2d2266a865d..d77ee5b7f61 100644 --- a/src/server/game/Chat/Chat.cpp +++ b/src/server/game/Chat/Chat.cpp @@ -782,6 +782,24 @@ Creature* ChatHandler::getSelectedCreature() return ObjectAccessor::GetCreatureOrPetOrVehicle(*m_session->GetPlayer(), m_session->GetPlayer()->GetTarget()); } +Player* ChatHandler::getSelectedPlayerOrSelf() +{ + if (!m_session) + return NULL; + + uint64 selected = m_session->GetPlayer()->GetTarget(); + if (!selected) + return m_session->GetPlayer(); + + // first try with selected target + Player* targetPlayer = ObjectAccessor::FindPlayer(selected); + // if the target is not a player, then return self + if (!targetPlayer) + targetPlayer = m_session->GetPlayer(); + + return targetPlayer; +} + char* ChatHandler::extractKeyFromLink(char* text, char const* linkType, char** something1) { // skip empty diff --git a/src/server/game/Chat/Chat.h b/src/server/game/Chat/Chat.h index f9000f636c5..a56b79077d7 100644 --- a/src/server/game/Chat/Chat.h +++ b/src/server/game/Chat/Chat.h @@ -97,6 +97,8 @@ class ChatHandler Creature* getSelectedCreature(); Unit* getSelectedUnit(); WorldObject* getSelectedObject(); + // Returns either the selected player or self if there is no selected player + Player* getSelectedPlayerOrSelf(); char* extractKeyFromLink(char* text, char const* linkType, char** something1 = NULL); char* extractKeyFromLink(char* text, char const* const* linkTypes, int* found_idx, char** something1 = NULL); diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp index c2d6bf47154..4cd7228a24a 100644 --- a/src/server/scripts/Commands/cs_modify.cpp +++ b/src/server/scripts/Commands/cs_modify.cpp @@ -476,7 +476,7 @@ public: return false; } - Player* target = handler->getSelectedPlayer(); + Player* target = handler->getSelectedPlayerOrSelf(); if (!target) { handler->SendSysMessage(LANG_NO_CHAR_SELECTED); @@ -524,7 +524,7 @@ public: return false; } - Player* target = handler->getSelectedPlayer(); + Player* target = handler->getSelectedPlayerOrSelf(); if (!target) { handler->SendSysMessage(LANG_NO_CHAR_SELECTED); @@ -569,7 +569,7 @@ public: return false; } - Player* target = handler->getSelectedPlayer(); + Player* target = handler->getSelectedPlayerOrSelf(); if (!target) { handler->SendSysMessage(LANG_NO_CHAR_SELECTED); @@ -614,7 +614,7 @@ public: return false; } - Player* target = handler->getSelectedPlayer(); + Player* target = handler->getSelectedPlayerOrSelf(); if (!target) { handler->SendSysMessage(LANG_NO_CHAR_SELECTED); @@ -659,7 +659,7 @@ public: return false; } - Player* target = handler->getSelectedPlayer(); + Player* target = handler->getSelectedPlayerOrSelf(); if (!target) { handler->SendSysMessage(LANG_NO_CHAR_SELECTED); -- cgit v1.2.3 From 9d5841073971c7f55cf621da3a31b38656618582 Mon Sep 17 00:00:00 2001 From: jackpoz Date: Sun, 13 Apr 2014 15:01:20 +0200 Subject: Scripts/Commands: Fix memory leak in ".gobject add" command Valgrind log: 158 (104 direct, 54 indirect) bytes in 1 blocks are definitely lost in loss record 24 of 73 at operator new(unsigned long) (vg_replace_malloc.c:319) by GameObjectModel::Create(GameObject const&) (GameObjectModel.cpp:152) by GameObject::Create(unsigned int, unsigned int, Map*, unsigned int, float, float, float, float, float, float, float, float, unsigned int, GOState, unsigned int) (GameObject.cpp:237) by gobject_commandscript::HandleGameObjectAddCommand(ChatHandler*, char const*) (cs_gobject.cpp:155) --- src/server/scripts/Commands/cs_gobject.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp index 62a61ff741b..5c49a0e92c9 100644 --- a/src/server/scripts/Commands/cs_gobject.cpp +++ b/src/server/scripts/Commands/cs_gobject.cpp @@ -166,7 +166,9 @@ public: // fill the gameobject data and save to the db object->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), player->GetPhaseMaskForSpawn()); + delete object; + object = new GameObject(); // this will generate a new guid if the object is in an instance if (!object->LoadGameObjectFromDB(guidLow, map)) { -- cgit v1.2.3 From ba61ec085dd3e0c954609c8af952ca2c694ae246 Mon Sep 17 00:00:00 2001 From: jackpoz Date: Sun, 13 Apr 2014 16:02:41 +0200 Subject: Scripts/Commands: Add comment about 9d5841073971c7f55cf621da3a31b38656618582 changes --- src/server/scripts/Commands/cs_gobject.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp index 5c49a0e92c9..ce0bee0d8c5 100644 --- a/src/server/scripts/Commands/cs_gobject.cpp +++ b/src/server/scripts/Commands/cs_gobject.cpp @@ -166,6 +166,8 @@ public: // fill the gameobject data and save to the db object->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), player->GetPhaseMaskForSpawn()); + // delete the old object and do a clean load from DB with a fresh new GameObject instance. + // this is required to avoid weird behavior and memory leaks delete object; object = new GameObject(); -- cgit v1.2.3 From b9a62115b17381a7e8371c1df1ebfd4a4165ac59 Mon Sep 17 00:00:00 2001 From: untaught Date: Mon, 14 Apr 2014 19:48:13 +0200 Subject: Core/Spells: fixed Relic of the Earthen Ring Closes #11282 --- .../2014_04_14_00_world_spell_script_names.sql | 3 ++ src/server/scripts/Spells/spell_quest.cpp | 41 ++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 sql/updates/world/2014_04_14_00_world_spell_script_names.sql (limited to 'src') diff --git a/sql/updates/world/2014_04_14_00_world_spell_script_names.sql b/sql/updates/world/2014_04_14_00_world_spell_script_names.sql new file mode 100644 index 00000000000..cb1a99ddf52 --- /dev/null +++ b/sql/updates/world/2014_04_14_00_world_spell_script_names.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE `spell_id`=66744; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(66744,'spell_q14100_q14111_make_player_destroy_totems'); diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index d1b32570795..f436803cb89 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -2276,6 +2276,46 @@ class spell_q13400_illidan_kill_master : public SpellScriptLoader } }; +enum RelicOfTheEarthenRing +{ + SPELL_TOTEM_OF_THE_EARTHEN_RING = 66747 +}; + +// 66744 - Make Player Destroy Totems +class spell_q14100_q14111_make_player_destroy_totems : public SpellScriptLoader +{ + public: + spell_q14100_q14111_make_player_destroy_totems() : SpellScriptLoader("spell_q14100_q14111_make_player_destroy_totems") { } + + class spell_q14100_q14111_make_player_destroy_totems_SpellScript : public SpellScript + { + PrepareSpellScript(spell_q14100_q14111_make_player_destroy_totems_SpellScript); + + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE + { + if (!sSpellMgr->GetSpellInfo(SPELL_TOTEM_OF_THE_EARTHEN_RING)) + return false; + return true; + } + + void HandleScriptEffect(SpellEffIndex /*effIndex*/) + { + if (Player* player = GetHitPlayer()) + player->CastSpell(player, SPELL_TOTEM_OF_THE_EARTHEN_RING, TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_POWER_AND_REAGENT_COST)); + } + + void Register() OVERRIDE + { + OnEffectHitTarget += SpellEffectFn(spell_q14100_q14111_make_player_destroy_totems_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const OVERRIDE + { + return new spell_q14100_q14111_make_player_destroy_totems_SpellScript(); + } +}; + void AddSC_quest_spell_scripts() { new spell_q55_sacred_cleansing(); @@ -2331,4 +2371,5 @@ void AddSC_quest_spell_scripts() new spell_q12919_gymers_grab(); new spell_q12919_gymers_throw(); new spell_q13400_illidan_kill_master(); + new spell_q14100_q14111_make_player_destroy_totems(); } -- cgit v1.2.3 From 533cbf20bb20000ce8d20dfe376bd1b4d533b116 Mon Sep 17 00:00:00 2001 From: joschiwald Date: Mon, 14 Apr 2014 21:12:05 +0200 Subject: Core/Spells: addition to b9a62115b17381a7e8371c1df1ebfd4a4165ac59 --- src/server/scripts/Spells/spell_quest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index f436803cb89..b9fd07293cd 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -2301,7 +2301,7 @@ class spell_q14100_q14111_make_player_destroy_totems : public SpellScriptLoader void HandleScriptEffect(SpellEffIndex /*effIndex*/) { if (Player* player = GetHitPlayer()) - player->CastSpell(player, SPELL_TOTEM_OF_THE_EARTHEN_RING, TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_POWER_AND_REAGENT_COST)); + player->CastSpell(player, SPELL_TOTEM_OF_THE_EARTHEN_RING, TRIGGERED_FULL_MASK); // ignore reagent cost, consumed by quest } void Register() OVERRIDE -- cgit v1.2.3 From 057169c21c141f690891c908b8f09e63d917289d Mon Sep 17 00:00:00 2001 From: Unholychick Date: Mon, 7 Apr 2014 18:36:53 +0200 Subject: Fix done & taken procs Corrects the logic for dot/hot procs and fixes spells such as althor's abacus, egg of mortal essence, black magic, spiritual attunement etc etc. Reverts the remaining part of 8edf6247c087884acd8c873a57c6f414e19091ec --- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 2 +- src/server/game/Spells/SpellMgr.cpp | 55 +++++++++++++++-------- 2 files changed, 38 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index bd24038d88d..06bd12911ad 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -6096,7 +6096,7 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const } uint32 procAttacker = PROC_FLAG_DONE_PERIODIC; - uint32 procVictim = PROC_FLAG_TAKEN_PERIODIC | PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_POS; + uint32 procVictim = PROC_FLAG_TAKEN_PERIODIC; uint32 procEx = (crit ? PROC_EX_CRITICAL_HIT : PROC_EX_NORMAL_HIT) | PROC_EX_INTERNAL_HOT; // ignore item heals if (!haveCastItem) diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 0ae4b22b3e4..700e348c382 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -784,42 +784,61 @@ bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const* spellPr bool hasFamilyMask = false; - /* Check Periodic Auras + /** + + * @brief Check auras procced by periodics - *Dots can trigger if spell has no PROC_FLAG_SUCCESSFUL_NEGATIVE_MAGIC_SPELL - nor PROC_FLAG_TAKEN_POSITIVE_MAGIC_SPELL + *Only damaging Dots can proc auras with PROC_FLAG_TAKEN_DAMAGE - *Only Hots can trigger if spell has PROC_FLAG_TAKEN_POSITIVE_MAGIC_SPELL + *Both Dots and hots can proc if ONLY has PROC_FLAG_DONE_PERIODIC or PROC_FLAG_TAKEN_PERIODIC. Such auras need support in Unit::HandleAuraProc. - *Only dots can trigger if spell has both positivity flags or PROC_FLAG_SUCCESSFUL_NEGATIVE_MAGIC_SPELL + *Only Dots can proc auras with PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG or PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_NEG - *Aura has to have PROC_FLAG_TAKEN_POSITIVE_MAGIC_SPELL or spellfamily specified to trigger from Hot + *Only Hots can proc auras with PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS or PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS + + *Only Dots can proc auras with PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG or PROC_FLAG_TAKEN_SPELL_NONE_DMG_CLASS_NEG + + *Only Hots can proc auras with PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_POS or PROC_FLAG_TAKEN_SPELL_NONE_DMG_CLASS_POS + + * @param procSpell the spell proccing the aura + * @param procFlags proc_flags of spellProc + * @param procExtra proc_EX of procSpell + * @param EventProcFlag proc_flags of aura to be procced + */ - if (procFlags & PROC_FLAG_DONE_PERIODIC) + /// Quick Check - If PROC_FLAG_TAKEN_DAMAGE is set for aura and procSpell dealt damage, proc no matter what kind of spell that deals the damage. + if (procFlags & PROC_FLAG_TAKEN_DAMAGE && EventProcFlag & PROC_FLAG_TAKEN_DAMAGE) + return true; + + /// Any aura that has only PROC_FLAG_DONE_PERIODIC or PROC_FLAG_TAKEN_PERIODIC should always proc, if procSpell is correct or not is checked in Unit::HandleAuraProc + if (EventProcFlag == PROC_FLAG_DONE_PERIODIC || EventProcFlag == PROC_FLAG_TAKEN_PERIODIC) + return true; + + if (procFlags & PROC_FLAG_DONE_PERIODIC && EventProcFlag & PROC_FLAG_DONE_PERIODIC) { - if (EventProcFlag & PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG) + /// Aura must have positive procflags for a HOT to proc + if (procExtra & PROC_EX_INTERNAL_HOT) { - if (!(procExtra & PROC_EX_INTERNAL_DOT)) + if (!(EventProcFlag & (PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS | PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS))) return false; } - else if (procExtra & PROC_EX_INTERNAL_HOT) - procExtra |= PROC_EX_INTERNAL_REQ_FAMILY; - else if (EventProcFlag & PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS) + /// Aura must have negative procflags for a DOT to proc + else if (!(EventProcFlag & (PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG | PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_NEG))) return false; } - if (procFlags & PROC_FLAG_TAKEN_PERIODIC) + if (procFlags & PROC_FLAG_TAKEN_PERIODIC && EventProcFlag & PROC_FLAG_TAKEN_PERIODIC) { - if (EventProcFlag & PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_POS) + /// Aura must have positive procflags for a HOT to proc + if (procExtra & PROC_EX_INTERNAL_HOT) { - if (!(procExtra & PROC_EX_INTERNAL_DOT)) + if (!(EventProcFlag & (PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_POS | PROC_FLAG_TAKEN_SPELL_NONE_DMG_CLASS_POS))) return false; } - else if (procExtra & PROC_EX_INTERNAL_HOT) - procExtra |= PROC_EX_INTERNAL_REQ_FAMILY; - else if (EventProcFlag & PROC_FLAG_TAKEN_SPELL_NONE_DMG_CLASS_POS) + /// Aura must have negative procflags for a DOT to proc + else if (!(EventProcFlag & (PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG | PROC_FLAG_TAKEN_SPELL_NONE_DMG_CLASS_NEG))) return false; } // Trap casts are active by default -- cgit v1.2.3 From 0a014e1431647cc008cc4af760eb6d7a0e35d046 Mon Sep 17 00:00:00 2001 From: joschiwald Date: Thu, 17 Apr 2014 00:09:43 +0200 Subject: Scripts/UtgardeKeep: fixed some issues on Ingvar the Plunderer Closes #10859 --- sql/updates/world/2014_04_17_00_world_misc.sql | 29 +++ src/server/game/Spells/SpellMgr.cpp | 6 - .../UtgardeKeep/boss_ingvar_the_plunderer.cpp | 194 +++++++++++++-------- 3 files changed, 151 insertions(+), 78 deletions(-) create mode 100644 sql/updates/world/2014_04_17_00_world_misc.sql (limited to 'src') diff --git a/sql/updates/world/2014_04_17_00_world_misc.sql b/sql/updates/world/2014_04_17_00_world_misc.sql new file mode 100644 index 00000000000..9deeb5ddef0 --- /dev/null +++ b/sql/updates/world/2014_04_17_00_world_misc.sql @@ -0,0 +1,29 @@ +DELETE FROM `spelldifficulty_dbc` WHERE `id`=42739; +INSERT INTO `spelldifficulty_dbc` (`id`, `spellid0`, `spellid1`) VALUES +(42739,42739,59736); + +DELETE FROM `spell_script_names` WHERE `spell_id` IN (42730,59735,42912); +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(42730,'spell_ingvar_woe_strike'), +(59735,'spell_ingvar_woe_strike'), +(42912,'spell_ingvar_summon_banshee'); + +UPDATE `creature_text` SET `entry`=23980, `groupid`=`groupid`-3 WHERE `entry`=23954 AND `groupid` IN (3,4,5); + +UPDATE `creature_template` SET `flags_extra`=0 WHERE `entry` IN (23997,31835); + +UPDATE `creature_template` SET `mingold`=0, `maxgold`=0, `lootid`=0 WHERE `entry` IN (23954,31673); +UPDATE `creature_template` SET `mingold`=4056, `maxgold`=6760, `lootid`=23980 WHERE `entry`=23980; +UPDATE `creature_template` SET `mingold`=8112, `maxgold`=13520, `lootid`=31674 WHERE `entry`=31674; + +UPDATE `creature_loot_template` SET `entry`=23980 WHERE `entry`=23954; +UPDATE `creature_loot_template` SET `entry`=31674 WHERE `entry`=31673; + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=1 AND `SourceGroup` IN (23980,31674,23954,31673); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(1,23980,43228,0,0,1,0,57940,0,0,0,0,0,'','Can loot Stone Keeper''s Shard only with aura Essence of Wintergrasp'), +(1,31674,43228,0,0,1,0,57940,0,0,0,0,0,'','Can loot Stone Keeper''s Shard only with aura Essence of Wintergrasp'); + +UPDATE `instance_encounters` SET `creditEntry`=23980 WHERE `entry` IN (575,576); + +UPDATE `creature_template` SET `InhabitType`=4 WHERE `entry` IN (24068,31655); diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 0ae4b22b3e4..e8f20441605 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -2913,15 +2913,9 @@ void SpellMgr::LoadSpellInfoCorrections() case 53096: // Quetz'lun's Judgment spellInfo->MaxAffectedTargets = 1; break; - case 42730: - spellInfo->Effects[EFFECT_1].TriggerSpell = 42739; - break; case 42436: // Drink! (Brewfest) spellInfo->Effects[EFFECT_0].TargetA = SpellImplicitTargetInfo(TARGET_UNIT_TARGET_ANY); break; - case 59735: - spellInfo->Effects[EFFECT_1].TriggerSpell = 59736; - break; case 52611: // Summon Skeletons case 52612: // Summon Skeletons spellInfo->Effects[EFFECT_0].MiscValueB = 64; diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp index cc37dde57dd..fe29f4e9f7c 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp @@ -18,28 +18,25 @@ /* ScriptData SDName: Boss_Ingvar_The_Plunderer SD%Complete: 95 -SDComment: Some Problems with Annhylde Movement, Blizzlike Timers (just shadow axe summon needs a new timer) -SDCategory: Udgarde Keep +SDComment: Blizzlike Timers (just shadow axe summon needs a new timer) +SDCategory: Utgarde Keep EndScriptData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" +#include "SpellScript.h" +#include "SpellAuraEffects.h" #include "utgarde_keep.h" enum Yells { - // Ingvar (Human) - SAY_AGGRO_1 = 0, - SAY_SLAY_1 = 1, - SAY_DEATH_1 = 2, - - // Ingvar (Undead) - SAY_AGGRO_2 = 3, - SAY_SLAY_2 = 4, - SAY_DEATH_2 = 5, + // Ingvar (Human/Undead) + SAY_AGGRO = 0, + SAY_SLAY = 1, + SAY_DEATH = 2, // Annhylde The Caller - YELL_RESURRECT = 0 + YELL_RESURRECT = 0 }; enum Events @@ -83,8 +80,10 @@ enum Spells SPELL_DARK_SMASH = 42723, SPELL_DREADFUL_ROAR = 42729, SPELL_WOE_STRIKE = 42730, + SPELL_WOE_STRIKE_EFFECT = 42739, SPELL_SHADOW_AXE_SUMMON = 42748, + SPELL_SHADOW_AXE_PERIODIC_DAMAGE = 42750, // Spells for Annhylde SPELL_SCOURG_RESURRECTION_HEAL = 42704, // Heal Max + DummyAura @@ -105,16 +104,14 @@ class boss_ingvar_the_plunderer : public CreatureScript struct boss_ingvar_the_plundererAI : public BossAI { - boss_ingvar_the_plundererAI(Creature* creature) : BossAI(creature, DATA_INGVAR) - { - _isUndead = false; - } + boss_ingvar_the_plundererAI(Creature* creature) : BossAI(creature, DATA_INGVAR) { } void Reset() OVERRIDE { - _isUndead = false; + if (me->GetEntry() != NPC_INGVAR) + me->UpdateEntry(NPC_INGVAR); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); _Reset(); events.SetPhase(PHASE_HUMAN); @@ -132,12 +129,12 @@ class boss_ingvar_the_plunderer : public CreatureScript me->RemoveAllAuras(); DoCast(me, SPELL_INGVAR_FEIGN_DEATH, true); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); events.SetPhase(PHASE_EVENT); events.ScheduleEvent(EVENT_SUMMON_BANSHEE, 3 * IN_MILLISECONDS, 0, PHASE_EVENT); - Talk(SAY_DEATH_1); + Talk(SAY_DEATH); } if (events.IsInPhase(PHASE_EVENT)) @@ -152,26 +149,22 @@ class boss_ingvar_the_plunderer : public CreatureScript void StartZombiePhase() { - _isUndead = true; me->RemoveAura(SPELL_INGVAR_FEIGN_DEATH); - DoCast(me, SPELL_INGVAR_TRANSFORM, true); /// @todo: should be death persistent + DoCast(me, SPELL_INGVAR_TRANSFORM, true); + me->UpdateEntry(NPC_INGVAR_UNDEAD); events.ScheduleEvent(EVENT_JUST_TRANSFORMED, 2 * IN_MILLISECONDS, 0, PHASE_EVENT); - - Talk(SAY_AGGRO_2); } void EnterCombat(Unit* /*who*/) OVERRIDE { _EnterCombat(); - - if (!_isUndead) - Talk(SAY_AGGRO_1); + Talk(SAY_AGGRO); } void JustDied(Unit* /*killer*/) OVERRIDE { _JustDied(); - Talk(SAY_DEATH_2); + Talk(SAY_DEATH); } void ScheduleSecondPhase() @@ -183,9 +176,10 @@ class boss_ingvar_the_plunderer : public CreatureScript events.ScheduleEvent(EVENT_SHADOW_AXE, 30*IN_MILLISECONDS, 0, PHASE_UNDEAD); } - void KilledUnit(Unit* /*victim*/) OVERRIDE + void KilledUnit(Unit* who) OVERRIDE { - Talk(_isUndead ? SAY_SLAY_1 : SAY_SLAY_2); + if (who->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_SLAY); } void UpdateAI(uint32 diff) OVERRIDE @@ -220,7 +214,7 @@ class boss_ingvar_the_plunderer : public CreatureScript events.ScheduleEvent(EVENT_SMASH, urand(12, 16)*IN_MILLISECONDS, 0, PHASE_HUMAN); break; case EVENT_JUST_TRANSFORMED: - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); DoZoneInCombat(); ScheduleSecondPhase(); return; @@ -241,20 +235,18 @@ class boss_ingvar_the_plunderer : public CreatureScript events.ScheduleEvent(EVENT_WOE_STRIKE, urand(10, 14)*IN_MILLISECONDS, 0, PHASE_UNDEAD); break; case EVENT_SHADOW_AXE: - if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 1)) + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0.0f, true)) DoCast(target, SPELL_SHADOW_AXE_SUMMON); - events.ScheduleEvent(EVENT_SHADOW_AXE, 30*IN_MILLISECONDS, 0, PHASE_UNDEAD); break; + default: + break; } } if (!events.IsInPhase(PHASE_EVENT)) DoMeleeAttackIfReady(); } - - private: - bool _isUndead; }; CreatureAI* GetAI(Creature* creature) const OVERRIDE @@ -279,12 +271,8 @@ class npc_annhylde_the_caller : public CreatureScript { _events.Reset(); - //! HACK: Creature's can't have MOVEMENTFLAG_FLYING - me->SetHover(true); - me->GetPosition(x, y, z); - DoTeleportTo(x+1, y, z+30); - me->GetMotionMaster()->MovePoint(1, x, y, z+15); + me->GetMotionMaster()->MovePoint(1, x, y, z - 15.0f); } void MovementInform(uint32 type, uint32 id) OVERRIDE @@ -339,7 +327,7 @@ class npc_annhylde_the_caller : public CreatureScript ingvar->AI()->DoAction(ACTION_START_PHASE_2); } - me->GetMotionMaster()->MovePoint(2, x+1, y, z+30); + me->GetMotionMaster()->MovePoint(2, x, y, z + 15.0f); break; default: break; @@ -359,52 +347,112 @@ class npc_annhylde_the_caller : public CreatureScript } }; -enum ShadowAxe -{ - SPELL_SHADOW_AXE_DAMAGE = 42750, - H_SPELL_SHADOW_AXE_DAMAGE = 59719, - POINT_TARGET = 28 -}; - class npc_ingvar_throw_dummy : public CreatureScript { -public: - npc_ingvar_throw_dummy() : CreatureScript("npc_ingvar_throw_dummy") { } + public: + npc_ingvar_throw_dummy() : CreatureScript("npc_ingvar_throw_dummy") { } - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_ingvar_throw_dummyAI(creature); - } + struct npc_ingvar_throw_dummyAI : public ScriptedAI + { + npc_ingvar_throw_dummyAI(Creature* creature) : ScriptedAI(creature) { } + + void Reset() OVERRIDE + { + me->SetReactState(REACT_PASSIVE); + + if (Creature* target = me->FindNearestCreature(NPC_THROW_TARGET, 200.0f)) + { + float x, y, z; + target->GetPosition(x, y, z); + me->GetMotionMaster()->MoveCharge(x, y, z); + target->DespawnOrUnsummon(); + } + else + me->DespawnOrUnsummon(); + } + + void MovementInform(uint32 type, uint32 id) OVERRIDE + { + if (type == EFFECT_MOTION_TYPE && id == EVENT_CHARGE) + { + me->CastSpell(me, SPELL_SHADOW_AXE_PERIODIC_DAMAGE, true); + me->DespawnOrUnsummon(10000); + } + } + }; - struct npc_ingvar_throw_dummyAI : public ScriptedAI - { - npc_ingvar_throw_dummyAI(Creature* creature) : ScriptedAI(creature) + CreatureAI* GetAI(Creature* creature) const OVERRIDE { + return new npc_ingvar_throw_dummyAI(creature); } +}; + +// 42912 - Summon Banshee +class spell_ingvar_summon_banshee : public SpellScriptLoader +{ + public: + spell_ingvar_summon_banshee() : SpellScriptLoader("spell_ingvar_summon_banshee") { } - void Reset() OVERRIDE + class spell_ingvar_summon_banshee_SpellScript : public SpellScript { - if (Creature* target = me->FindNearestCreature(NPC_THROW_TARGET, 50.0f)) + PrepareSpellScript(spell_ingvar_summon_banshee_SpellScript); + + void SetDest(SpellDestination& dest) { - float x, y, z; - target->GetPosition(x, y, z); - me->GetMotionMaster()->MoveCharge(x, y, z, 42.0f, POINT_TARGET); - target->DisappearAndDie(); + dest.RelocateOffset({ 0.0f, 0.0f, 30.0f, 0.0f }); } - else - me->DisappearAndDie(); + + void Register() OVERRIDE + { + OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_ingvar_summon_banshee_SpellScript::SetDest, EFFECT_0, TARGET_DEST_CASTER_BACK); + } + }; + + SpellScript* GetSpellScript() const OVERRIDE + { + return new spell_ingvar_summon_banshee_SpellScript(); } +}; - void MovementInform(uint32 type, uint32 id) OVERRIDE +// 42730, 59735 - Woe Strike +class spell_ingvar_woe_strike : public SpellScriptLoader +{ + public: + spell_ingvar_woe_strike() : SpellScriptLoader("spell_ingvar_woe_strike") { } + + class spell_ingvar_woe_strike_AuraScript : public AuraScript { - if (type == EFFECT_MOTION_TYPE && id == POINT_TARGET) + PrepareAuraScript(spell_ingvar_woe_strike_AuraScript); + + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE + { + if (!sSpellMgr->GetSpellInfo(SPELL_WOE_STRIKE_EFFECT)) + return false; + return true; + } + + bool CheckProc(ProcEventInfo& eventInfo) + { + return eventInfo.GetHealInfo()->GetHeal(); + } + + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + GetTarget()->CastSpell(eventInfo.GetActor(), SPELL_WOE_STRIKE_EFFECT, true, NULL, aurEff); + } + + void Register() OVERRIDE { - DoCast(me, SPELL_SHADOW_AXE_DAMAGE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); - me->DespawnOrUnsummon(10000); + DoCheckProc += AuraCheckProcFn(spell_ingvar_woe_strike_AuraScript::CheckProc); + OnEffectProc += AuraEffectProcFn(spell_ingvar_woe_strike_AuraScript::HandleProc, EFFECT_1, SPELL_AURA_PROC_TRIGGER_SPELL); } + }; + + AuraScript* GetAuraScript() const OVERRIDE + { + return new spell_ingvar_woe_strike_AuraScript(); } - }; }; void AddSC_boss_ingvar_the_plunderer() @@ -412,4 +460,6 @@ void AddSC_boss_ingvar_the_plunderer() new boss_ingvar_the_plunderer(); new npc_annhylde_the_caller(); new npc_ingvar_throw_dummy(); + new spell_ingvar_summon_banshee(); + new spell_ingvar_woe_strike(); } -- cgit v1.2.3 From 20c9981578fc927da8b4c6c09c4431b7d0e1e538 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Fri, 18 Apr 2014 16:55:12 +0200 Subject: Core/Misc: Added missing field in npc_text table for loading --- src/server/game/Globals/ObjectMgr.cpp | 2 ++ src/server/game/Handlers/NPCHandler.h | 1 + 2 files changed, 3 insertions(+) (limited to 'src') diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 8784e2ca4e7..3cdfff7dc4b 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -5236,6 +5236,8 @@ void ObjectMgr::LoadGossipText() gText.Options[i].Text_0 = fields[cic++].GetString(); gText.Options[i].Text_1 = fields[cic++].GetString(); + gText.Options[i].BroadcastTextID = fields[cic++].GetUInt32(); // Need for correct loading order + gText.Options[i].Language = fields[cic++].GetUInt8(); gText.Options[i].Probability = fields[cic++].GetFloat(); diff --git a/src/server/game/Handlers/NPCHandler.h b/src/server/game/Handlers/NPCHandler.h index 8aa34eaafa7..7cf80bf0b9b 100644 --- a/src/server/game/Handlers/NPCHandler.h +++ b/src/server/game/Handlers/NPCHandler.h @@ -31,6 +31,7 @@ struct GossipTextOption { std::string Text_0; std::string Text_1; + uint32 BroadcastTextID; uint32 Language; float Probability; QEmote Emotes[MAX_GOSSIP_TEXT_EMOTES]; -- cgit v1.2.3 From 89cc056a506e6df2e9819860ae55bfba1699dd49 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Fri, 18 Apr 2014 17:02:04 +0200 Subject: Fix --- src/server/game/Entities/Player/Player.cpp | 2 +- src/server/game/Globals/ObjectMgr.cpp | 2 +- src/server/game/Handlers/NPCHandler.h | 2 +- src/server/game/Scripting/ScriptMgr.h | 2 +- src/server/game/Spells/SpellMgr.cpp | 8 ++++---- src/server/game/Spells/SpellMgr.h | 2 +- .../Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp | 4 ++-- .../AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp | 6 +++--- 8 files changed, 14 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 2691a6870f2..13635424cf0 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -25058,7 +25058,7 @@ void Player::HandleFall(MovementInfo const& movementInfo) if (damageperc > 0) { uint32 damage = (uint32)(damageperc * GetMaxHealth()*sWorld->getRate(RATE_DAMAGE_FALL)); - + if (GetCommandStatus(CHEAT_GOD)) damage = 0; diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 3cdfff7dc4b..e4dbe60535d 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -5236,7 +5236,7 @@ void ObjectMgr::LoadGossipText() gText.Options[i].Text_0 = fields[cic++].GetString(); gText.Options[i].Text_1 = fields[cic++].GetString(); - gText.Options[i].BroadcastTextID = fields[cic++].GetUInt32(); // Need for correct loading order + gText.Options[i].BroadcastTextID = fields[cic++].GetUInt32(); // Need for correct loading order gText.Options[i].Language = fields[cic++].GetUInt8(); gText.Options[i].Probability = fields[cic++].GetFloat(); diff --git a/src/server/game/Handlers/NPCHandler.h b/src/server/game/Handlers/NPCHandler.h index 7cf80bf0b9b..7210d9a53b5 100644 --- a/src/server/game/Handlers/NPCHandler.h +++ b/src/server/game/Handlers/NPCHandler.h @@ -31,7 +31,7 @@ struct GossipTextOption { std::string Text_0; std::string Text_1; - uint32 BroadcastTextID; + uint32 BroadcastTextID; uint32 Language; float Probability; QEmote Emotes[MAX_GOSSIP_TEXT_EMOTES]; diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h index 726ac025d3c..8ed8a2b3c49 100644 --- a/src/server/game/Scripting/ScriptMgr.h +++ b/src/server/game/Scripting/ScriptMgr.h @@ -388,7 +388,7 @@ class ItemScript : public ScriptObject // Called when the item expires (is destroyed). virtual bool OnExpire(Player* /*player*/, ItemTemplate const* /*proto*/) { return false; } - + // Called when the item is destroyed. virtual bool OnRemove(Player* /*player*/, Item* /*item*/) { return false; } }; diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 93bd409652a..0342b22d735 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -784,8 +784,8 @@ bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const* spellPr bool hasFamilyMask = false; - /** - + /** + * @brief Check auras procced by periodics *Only damaging Dots can proc auras with PROC_FLAG_TAKEN_DAMAGE @@ -799,12 +799,12 @@ bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const* spellPr *Only Dots can proc auras with PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG or PROC_FLAG_TAKEN_SPELL_NONE_DMG_CLASS_NEG *Only Hots can proc auras with PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_POS or PROC_FLAG_TAKEN_SPELL_NONE_DMG_CLASS_POS - + * @param procSpell the spell proccing the aura * @param procFlags proc_flags of spellProc * @param procExtra proc_EX of procSpell * @param EventProcFlag proc_flags of aura to be procced - + */ diff --git a/src/server/game/Spells/SpellMgr.h b/src/server/game/Spells/SpellMgr.h index 76d59bd1e85..5f11870b3e9 100644 --- a/src/server/game/Spells/SpellMgr.h +++ b/src/server/game/Spells/SpellMgr.h @@ -691,7 +691,7 @@ class SpellMgr // SpellInfo object management SpellInfo const* GetSpellInfo(uint32 spellId) const { return spellId < GetSpellInfoStoreSize() ? mSpellInfoMap[spellId] : NULL; } // Use this only with 100% valid spellIds - SpellInfo const* EnsureSpellInfo(uint32 spellId) const + SpellInfo const* EnsureSpellInfo(uint32 spellId) const { ASSERT(spellId < GetSpellInfoStoreSize()); SpellInfo const* spellInfo = mSpellInfoMap[spellId]; diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp index 31c565e5be2..3541ad0f1a3 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp @@ -286,8 +286,8 @@ class npc_prince_taldaram_flame_sphere : public CreatureScript struct npc_prince_taldaram_flame_sphereAI : public ScriptedAI { - npc_prince_taldaram_flame_sphereAI(Creature* creature) : ScriptedAI(creature) - { + npc_prince_taldaram_flame_sphereAI(Creature* creature) : ScriptedAI(creature) + { _flameSphereTargetGUID = 0; } diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp index 1281d40fe5c..916f60bd78a 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp @@ -438,7 +438,7 @@ class npc_watcher_gashra : public CreatureScript _events.ScheduleEvent(EVENT_WEB_WRAP_GASHRA, 11000); _events.ScheduleEvent(EVENT_INFECTED_BITE_GASHRA, 4000); } - + void JustDied(Unit* /*killer*/) OVERRIDE { Creature* krikthir = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_KRIKTHIR_THE_GATEWATCHER)); @@ -511,7 +511,7 @@ class npc_watcher_narjil : public CreatureScript _events.ScheduleEvent(EVENT_INFECTED_BITE_NARJIL, 4000); _events.ScheduleEvent(EVENT_BINDING_WEBS, 17000); } - + void JustDied(Unit* /*killer*/) OVERRIDE { Creature* krikthir = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_KRIKTHIR_THE_GATEWATCHER)); @@ -600,7 +600,7 @@ class npc_watcher_silthik : public CreatureScript { if (!UpdateVictim()) return; - + _events.Update(diff); if (me->HasUnitState(UNIT_STATE_CASTING)) -- cgit v1.2.3 From 574fa30ea6924902af1d845e667f38c043b32e94 Mon Sep 17 00:00:00 2001 From: Unholychick Date: Fri, 18 Apr 2014 20:21:05 +0200 Subject: Core/Spells: Convert Avenging Wrath to spellscript Closes #11896 Closes #3464 --- .../2014_04_18_00_world_spell_script_names.sql | 7 +++ src/server/game/Entities/Unit/Unit.cpp | 9 ---- src/server/scripts/Spells/spell_paladin.cpp | 50 ++++++++++++++++++++++ 3 files changed, 57 insertions(+), 9 deletions(-) create mode 100644 sql/updates/world/2014_04_18_00_world_spell_script_names.sql (limited to 'src') diff --git a/sql/updates/world/2014_04_18_00_world_spell_script_names.sql b/sql/updates/world/2014_04_18_00_world_spell_script_names.sql new file mode 100644 index 00000000000..a1cf5402219 --- /dev/null +++ b/sql/updates/world/2014_04_18_00_world_spell_script_names.sql @@ -0,0 +1,7 @@ +-- +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_pal_avenging_wrath'; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(31884,'spell_pal_avenging_wrath'); + +-- +DELETE FROM `spell_proc_event` WHERE `entry`=-53375; diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 9cc214b7390..06628de4050 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -6363,15 +6363,6 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere CastSpell(this, 57669, true, castItem, triggeredByAura); break; } - // Sanctified Wrath - if (dummySpell->SpellIconID == 3029) - { - triggered_spell_id = 57318; - target = this; - basepoints0 = triggerAmount; - CastCustomSpell(target, triggered_spell_id, &basepoints0, &basepoints0, NULL, true, castItem, triggeredByAura); - return true; - } // Righteous Vengeance if (dummySpell->SpellIconID == 3025) { diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index b5265561d85..2b1cafbdd26 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -66,6 +66,9 @@ enum PaladinSpells SPELL_PALADIN_RIGHTEOUS_DEFENSE_TAUNT = 31790, + SPELL_PALADIN_SANCTIFIED_WRATH = 57318, + SPELL_PALADIN_SANCTIFIED_WRATH_TALENT_R1 = 53375, + SPELL_PALADIN_SEAL_OF_RIGHTEOUSNESS = 25742, SPELL_PALADIN_CONCENTRACTION_AURA = 19746, @@ -236,6 +239,52 @@ class spell_pal_aura_mastery_immune : public SpellScriptLoader } }; +// 31884 - Avenging Wrath +class spell_pal_avenging_wrath : public SpellScriptLoader +{ + public: + spell_pal_avenging_wrath() : SpellScriptLoader("spell_pal_avenging_wrath") { } + + class spell_pal_avenging_wrath_AuraScript : public AuraScript + { + PrepareAuraScript(spell_pal_avenging_wrath_AuraScript); + + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE + { + if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_SANCTIFIED_WRATH) + || !sSpellMgr->GetSpellInfo(SPELL_PALADIN_SANCTIFIED_WRATH_TALENT_R1)) + return false; + return true; + } + + void HandleApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + Unit* target = GetTarget(); + if (AuraEffect const* aurEff = target->GetAuraEffectOfRankedSpell(SPELL_PALADIN_SANCTIFIED_WRATH_TALENT_R1, EFFECT_2)) + { + int32 basepoints = aurEff->GetAmount(); + target->CastCustomSpell(target, SPELL_PALADIN_SANCTIFIED_WRATH, &basepoints, &basepoints, NULL, true, NULL, aurEff); + } + } + + void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + GetTarget()->RemoveAurasDueToSpell(SPELL_PALADIN_SANCTIFIED_WRATH); + } + + void Register() OVERRIDE + { + OnEffectApply += AuraEffectApplyFn(spell_pal_avenging_wrath_AuraScript::HandleApply, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, AURA_EFFECT_HANDLE_REAL); + AfterEffectRemove += AuraEffectRemoveFn(spell_pal_avenging_wrath_AuraScript::HandleRemove, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, AURA_EFFECT_HANDLE_REAL); + } + }; + + AuraScript* GetAuraScript() const OVERRIDE + { + return new spell_pal_avenging_wrath_AuraScript(); + } +}; + // 37877 - Blessing of Faith class spell_pal_blessing_of_faith : public SpellScriptLoader { @@ -1233,6 +1282,7 @@ void AddSC_paladin_spell_scripts() new spell_pal_ardent_defender(); new spell_pal_aura_mastery(); new spell_pal_aura_mastery_immune(); + new spell_pal_avenging_wrath(); new spell_pal_blessing_of_faith(); new spell_pal_blessing_of_sanctuary(); new spell_pal_divine_sacrifice(); -- cgit v1.2.3 From 93a68a66c3009ea86569076ea05a39ce87dfb78d Mon Sep 17 00:00:00 2001 From: jackpoz Date: Sat, 19 Apr 2014 15:35:13 +0200 Subject: Core/MMAPs: Improve NPC behavior with fences and high climbs Increase the max walkable angle and max walkable climb in MMAPs generator to allow NPCs to jump on fences and climb steps. This requires MMAPs to be extracted again with mmaps_generator, old extracted MMAPs are still compatible but will not provide the benefits of this commit. Fixes #9965 --- src/tools/mmaps_generator/MapBuilder.cpp | 4 +++- src/tools/mmaps_generator/MapBuilder.h | 2 +- src/tools/mmaps_generator/PathGenerator.cpp | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/tools/mmaps_generator/MapBuilder.cpp b/src/tools/mmaps_generator/MapBuilder.cpp index d60924a83f9..cc24035b05e 100644 --- a/src/tools/mmaps_generator/MapBuilder.cpp +++ b/src/tools/mmaps_generator/MapBuilder.cpp @@ -553,7 +553,9 @@ namespace MMAP config.borderSize = config.walkableRadius + 3; config.maxEdgeLen = VERTEX_PER_TILE + 1; // anything bigger than tileSize config.walkableHeight = m_bigBaseUnit ? 3 : 6; - config.walkableClimb = m_bigBaseUnit ? 2 : 4; // keep less than walkableHeight + // a value >= 3|6 allows npcs to walk over some fences + // a value >= 4|8 allows npcs to walk over all fences + config.walkableClimb = m_bigBaseUnit ? 4 : 8; config.minRegionArea = rcSqr(60); config.mergeRegionArea = rcSqr(50); config.maxSimplificationError = 1.8f; // eliminates most jagged edges (tiny polygons) diff --git a/src/tools/mmaps_generator/MapBuilder.h b/src/tools/mmaps_generator/MapBuilder.h index 33f45a86549..86a6db2077c 100644 --- a/src/tools/mmaps_generator/MapBuilder.h +++ b/src/tools/mmaps_generator/MapBuilder.h @@ -61,7 +61,7 @@ namespace MMAP class MapBuilder { public: - MapBuilder(float maxWalkableAngle = 55.f, + MapBuilder(float maxWalkableAngle = 70.f, bool skipLiquid = false, bool skipContinents = false, bool skipJunkMaps = true, diff --git a/src/tools/mmaps_generator/PathGenerator.cpp b/src/tools/mmaps_generator/PathGenerator.cpp index 1df24cfa332..d88ab8ca16d 100644 --- a/src/tools/mmaps_generator/PathGenerator.cpp +++ b/src/tools/mmaps_generator/PathGenerator.cpp @@ -242,7 +242,7 @@ int finish(const char* message, int returnValue) int main(int argc, char** argv) { int threads = 3, mapnum = -1; - float maxAngle = 55.0f; + float maxAngle = 70.0f; int tileX = -1, tileY = -1; bool skipLiquid = false, skipContinents = false, -- cgit v1.2.3