From 5923c0559f20bbbed9441a2f5459fb7e25cf24db Mon Sep 17 00:00:00 2001 From: megamage Date: Wed, 24 Dec 2008 13:06:19 -0600 Subject: [PATCH 01/12] *Spell target selection fix. Without this patch many spells are bugged. --HG-- branch : trunk --- src/game/Spell.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index b3930a85520..f95f6dd1424 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -164,6 +164,9 @@ void SpellCastTargets::Update(Unit* caster) if(m_itemTarget) m_itemTargetEntry = m_itemTarget->GetEntry(); } + + m_originalCasterGUID = m_caster->GetGUID(); + m_originalCaster = m_caster; } bool SpellCastTargets::read ( WorldPacket * data, Unit *caster ) From 8f338a56b935e106af47283ee10c57dd63914a9b Mon Sep 17 00:00:00 2001 From: Blaymoira Date: Wed, 24 Dec 2008 21:05:05 +0100 Subject: [PATCH 02/12] *Fixed compile error. --HG-- branch : trunk --- src/game/Spell.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/game/Spell.h b/src/game/Spell.h index ba5e14b33f2..2e7aee37c94 100644 --- a/src/game/Spell.h +++ b/src/game/Spell.h @@ -180,6 +180,13 @@ class SpellCastTargets uint64 m_CorpseTargetGUID; uint64 m_itemTargetGUID; uint32 m_itemTargetEntry; + + Unit* m_caster; + + uint64 m_originalCasterGUID; // real source of cast (aura caster/etc), used for spell targets selection + // e.g. damage around area spell trigered by victim aura and damage enemies of aura caster + Unit* m_originalCaster; // cached pointer for m_originalCaster, updated at Spell::UpdatePointers() + }; enum SpellState @@ -436,7 +443,7 @@ class Spell Unit* m_caster; uint64 m_originalCasterGUID; // real source of cast (aura caster/etc), used for spell targets selection - // e.g. damage around area spell trigered by victim aura and da,age emeies of aura caster + // e.g. damage around area spell trigered by victim aura and damage enemies of aura caster Unit* m_originalCaster; // cached pointer for m_originalCaster, updated at Spell::UpdatePointers() Spell** m_selfContainer; // pointer to our spell container (if applicable) From 5fd71c003b70b9a96a907c6f344527725fefae76 Mon Sep 17 00:00:00 2001 From: Blaymoira Date: Wed, 24 Dec 2008 21:23:38 +0100 Subject: [PATCH 03/12] *Changed EventStart distance in Teron Gorefiend *Added a check for Charge distance in nalorakk *Remove unneeded include in blackrock_depths --HG-- branch : trunk --- .../zone/black_temple/boss_teron_gorefiend.cpp | 2 +- .../instance_blackrock_depths.cpp | 1 - .../scripts/zone/zulaman/boss_nalorakk.cpp | 16 ++++++++++------ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/bindings/scripts/scripts/zone/black_temple/boss_teron_gorefiend.cpp b/src/bindings/scripts/scripts/zone/black_temple/boss_teron_gorefiend.cpp index 96956b864da..4f01ea56348 100644 --- a/src/bindings/scripts/scripts/zone/black_temple/boss_teron_gorefiend.cpp +++ b/src/bindings/scripts/scripts/zone/black_temple/boss_teron_gorefiend.cpp @@ -258,7 +258,7 @@ struct TRINITY_DLL_DECL boss_teron_gorefiendAI : public ScriptedAI m_creature->AddThreat(who, 1.0f); } - if(!InCombat && !Intro && m_creature->IsWithinDistInMap(who, 200.0f) && (who->GetTypeId() == TYPEID_PLAYER)) + if(!InCombat && !Intro && m_creature->IsWithinDistInMap(who, 60.0f) && (who->GetTypeId() == TYPEID_PLAYER)) { if(pInstance) pInstance->SetData(DATA_TERONGOREFIENDEVENT, IN_PROGRESS); diff --git a/src/bindings/scripts/scripts/zone/blackrock_depths/instance_blackrock_depths.cpp b/src/bindings/scripts/scripts/zone/blackrock_depths/instance_blackrock_depths.cpp index 72002068fa8..301301c27c2 100644 --- a/src/bindings/scripts/scripts/zone/blackrock_depths/instance_blackrock_depths.cpp +++ b/src/bindings/scripts/scripts/zone/blackrock_depths/instance_blackrock_depths.cpp @@ -29,7 +29,6 @@ update `creature_template` set `npcflag`='1',`ScriptName`='npc_tobias_seecher' w update `instance_template` set `script`='instance_blackrock_depths' where `map`='230'; */ -#include "GameObject.h" #include "precompiled.h" #include "def_blackrock_depths.h" diff --git a/src/bindings/scripts/scripts/zone/zulaman/boss_nalorakk.cpp b/src/bindings/scripts/scripts/zone/zulaman/boss_nalorakk.cpp index 8017033a4bd..b804502033b 100644 --- a/src/bindings/scripts/scripts/zone/zulaman/boss_nalorakk.cpp +++ b/src/bindings/scripts/scripts/zone/zulaman/boss_nalorakk.cpp @@ -436,15 +436,19 @@ struct TRINITY_DLL_DECL boss_nalorakkAI : public ScriptedAI DoPlaySoundToSet(m_creature, SOUND_YELL_SURGE); Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 1); - if(!target) target = m_creature->getVictim(); + if(!target) + target = m_creature->getVictim(); TankGUID = m_creature->getVictim()->GetGUID(); ChargeTargetGUID = target->GetGUID(); - float x, y, z; - target->GetContactPoint(m_creature, x, y, z); - m_creature->SetSpeed(MOVE_RUN, 5.0f); - m_creature->GetMotionMaster()->Clear(); - m_creature->GetMotionMaster()->MovePoint(0, x, y, z); + if(target && m_creature->IsWithinDistInMap(target, 50.0f)) + { + float x, y, z; + target->GetContactPoint(m_creature, x, y, z); + m_creature->SetSpeed(MOVE_RUN, 5.0f); + m_creature->GetMotionMaster()->Clear(); + m_creature->GetMotionMaster()->MovePoint(0, x, y, z); + } Surge_Timer = 15000 + rand()%5000; return; From bd2ded228d4f3d4e45f7fa6a715d4cb66b3e0762 Mon Sep 17 00:00:00 2001 From: megamage Date: Wed, 24 Dec 2008 14:30:05 -0600 Subject: [PATCH 04/12] *Revert my last commit. (What am I thinking today?) --HG-- branch : trunk --- src/game/Spell.cpp | 3 --- src/game/Spell.h | 7 ------- 2 files changed, 10 deletions(-) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index f95f6dd1424..b3930a85520 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -164,9 +164,6 @@ void SpellCastTargets::Update(Unit* caster) if(m_itemTarget) m_itemTargetEntry = m_itemTarget->GetEntry(); } - - m_originalCasterGUID = m_caster->GetGUID(); - m_originalCaster = m_caster; } bool SpellCastTargets::read ( WorldPacket * data, Unit *caster ) diff --git a/src/game/Spell.h b/src/game/Spell.h index 2e7aee37c94..284e0b88fb1 100644 --- a/src/game/Spell.h +++ b/src/game/Spell.h @@ -180,13 +180,6 @@ class SpellCastTargets uint64 m_CorpseTargetGUID; uint64 m_itemTargetGUID; uint32 m_itemTargetEntry; - - Unit* m_caster; - - uint64 m_originalCasterGUID; // real source of cast (aura caster/etc), used for spell targets selection - // e.g. damage around area spell trigered by victim aura and damage enemies of aura caster - Unit* m_originalCaster; // cached pointer for m_originalCaster, updated at Spell::UpdatePointers() - }; enum SpellState From a65bf58497579e5f9123fc4fc645a60741aebcef Mon Sep 17 00:00:00 2001 From: megamage Date: Wed, 24 Dec 2008 14:42:24 -0600 Subject: [PATCH 05/12] *Fix fishing. --HG-- branch : trunk --- src/game/Spell.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index b3930a85520..c2276a24960 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -2416,8 +2416,9 @@ void Spell::_handle_immediate_phase() { if(spellmgr.EffectTargetType[m_spellInfo->Effect[j]] == SPELL_REQUIRE_DEST) { - if(m_targets.HasDest()) - HandleEffects(m_originalCaster, NULL, NULL, j); + if(!m_targets.HasDest()) + m_targets.setDestination(m_caster, false); + HandleEffects(m_originalCaster, NULL, NULL, j); } else if(spellmgr.EffectTargetType[m_spellInfo->Effect[j]] == SPELL_REQUIRE_NONE) HandleEffects(m_originalCaster, NULL, NULL, j); From f5216efa2497b73a29783cc480069a5de1c71624 Mon Sep 17 00:00:00 2001 From: megamage Date: Wed, 24 Dec 2008 15:06:06 -0600 Subject: [PATCH 06/12] *Fix the bug that owner learns pet spells when pet does not exist. --HG-- branch : trunk --- src/game/Spell.cpp | 18 +++++++++++------- src/game/SpellMgr.cpp | 2 +- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index c2276a24960..694ba2ceaa7 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -402,13 +402,11 @@ Spell::~Spell() void Spell::FillTargetMap() { - // TODO: ADD the correct target FILLS!!!!!! - - for(uint32 i=0;i<3;i++) + for(uint32 i = 0; i < 3; ++i) { // not call for empty effect. // Also some spells use not used effect targets for store targets for dummy effect in triggered spells - if(m_spellInfo->Effect[i]==0) + if(!m_spellInfo->Effect[i]) continue; // TODO: find a way so this is not needed? @@ -417,9 +415,13 @@ void Spell::FillTargetMap() AddUnitTarget(m_caster, i); std::list tmpUnitMap; + uint32 targetA = m_spellInfo->EffectImplicitTargetA[i]; + uint32 targetB = m_spellInfo->EffectImplicitTargetB[i]; - SetTargetMap(i,m_spellInfo->EffectImplicitTargetA[i],tmpUnitMap); - SetTargetMap(i,m_spellInfo->EffectImplicitTargetB[i],tmpUnitMap); + if(targetA) + SetTargetMap(i, targetA, tmpUnitMap); + if(targetB) // In very rare case !A && B + SetTargetMap(i, targetB, tmpUnitMap); if(spellmgr.EffectTargetType[m_spellInfo->Effect[i]] != SPELL_REQUIRE_UNIT) { @@ -433,7 +435,9 @@ void Spell::FillTargetMap() continue; } - if(tmpUnitMap.empty()) + if(!targetA && !targetB) + AddUnitTarget(m_caster, i); + else if(tmpUnitMap.empty()) { // add here custom effects that need default target. // FOR EVERY TARGET TYPE THERE IS A DIFFERENT FILL!! diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 705a69ea2a4..1e9ae3531dd 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -61,7 +61,7 @@ SpellMgr::SpellMgr() case SPELL_EFFECT_PARRY: // 0 case SPELL_EFFECT_BLOCK: // 0 case SPELL_EFFECT_SKILL: // always with dummy 3 as A - case SPELL_EFFECT_LEARN_SPELL: // 0 + //case SPELL_EFFECT_LEARN_SPELL: // 0 may be 5 pet case SPELL_EFFECT_TRADE_SKILL: // 0 or 1 case SPELL_EFFECT_PROFICIENCY: // 0 EffectTargetType[i] = SPELL_REQUIRE_NONE; From ffcc3d817ef5ca5accf8887b4a4296f394b599dd Mon Sep 17 00:00:00 2001 From: QAston Date: Wed, 24 Dec 2008 22:21:45 +0100 Subject: [PATCH 07/12] *Fix error message on missing spell_required table. --HG-- branch : trunk --- src/game/SpellMgr.cpp | 14 +-- win/VC80/TrinityCore.vcproj | 202 ++++++++++++++++++------------------ 2 files changed, 108 insertions(+), 108 deletions(-) diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 1e9ae3531dd..41faea5b8fb 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -1332,14 +1332,14 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2, bool // return true; //use data of highest rank spell(needed for spells which ranks have different effects) - SpellEntry const *spellInfo1=sSpellStore.LookupEntry(GetLastSpellInChain(spellId_1)); - SpellEntry const *spellInfo2=sSpellStore.LookupEntry(GetLastSpellInChain(spellId_2)); + spellInfo_1=sSpellStore.LookupEntry(GetLastSpellInChain(spellId_1)); + spellInfo_2=sSpellStore.LookupEntry(GetLastSpellInChain(spellId_2)); //if spells have exactly the same effect they cannot stack for(uint32 i = 0; i < 3; ++i) - if(spellInfo1->Effect[i] != spellInfo2->Effect[i] - || spellInfo1->EffectApplyAuraName[i] != spellInfo2->EffectApplyAuraName[i] - || spellInfo1->EffectMiscValue[i] != spellInfo2->EffectMiscValue[i]) // paladin resist aura + if(spellInfo_1->Effect[i] != spellInfo_2->Effect[i] + || spellInfo_1->EffectApplyAuraName[i] != spellInfo_2->EffectApplyAuraName[i] + || spellInfo_1->EffectMiscValue[i] != spellInfo_2->EffectMiscValue[i]) // paladin resist aura return false; // need itemtype check? need an example to add that check return true; @@ -1430,8 +1430,8 @@ void SpellMgr::LoadSpellRequired() bar.step(); sLog.outString(); - sLog.outString( ">> Loaded 0 spell chain records" ); - sLog.outErrorDb("`spell_chains` table is empty!"); + sLog.outString( ">> Loaded 0 spell required records" ); + sLog.outErrorDb("`spell_required` table is empty!"); return; } uint32 rows = 0; diff --git a/win/VC80/TrinityCore.vcproj b/win/VC80/TrinityCore.vcproj index 6209bd3f9aa..6a1051581b7 100644 --- a/win/VC80/TrinityCore.vcproj +++ b/win/VC80/TrinityCore.vcproj @@ -118,107 +118,6 @@ CommandLine="copy ..\..\dep\lib\$(PlatformName)_$(ConfigurationName)\*.dll ..\..\bin\$(PlatformName)_$(ConfigurationName) copy ..\..\src\trinitycore\trinitycore.conf.dist ..\..\bin\$(PlatformName)_$(ConfigurationName)\TrinityCore.conf.dist " /> - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + Date: Wed, 24 Dec 2008 22:26:16 +0100 Subject: [PATCH 08/12] *Reverted unintentional change in windows project file. I just love these files. --HG-- branch : trunk --- win/VC80/TrinityCore.vcproj | 202 ++++++++++++++++++------------------ 1 file changed, 101 insertions(+), 101 deletions(-) diff --git a/win/VC80/TrinityCore.vcproj b/win/VC80/TrinityCore.vcproj index 6a1051581b7..6209bd3f9aa 100644 --- a/win/VC80/TrinityCore.vcproj +++ b/win/VC80/TrinityCore.vcproj @@ -118,107 +118,6 @@ CommandLine="copy ..\..\dep\lib\$(PlatformName)_$(ConfigurationName)\*.dll ..\..\bin\$(PlatformName)_$(ConfigurationName) copy ..\..\src\trinitycore\trinitycore.conf.dist ..\..\bin\$(PlatformName)_$(ConfigurationName)\TrinityCore.conf.dist " /> - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + Date: Wed, 24 Dec 2008 23:17:21 +0100 Subject: [PATCH 09/12] *Changed distance check in Nalorakk script --HG-- branch : trunk --- .../scripts/zone/zulaman/boss_nalorakk.cpp | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/bindings/scripts/scripts/zone/zulaman/boss_nalorakk.cpp b/src/bindings/scripts/scripts/zone/zulaman/boss_nalorakk.cpp index b804502033b..44e68f0dfbf 100644 --- a/src/bindings/scripts/scripts/zone/zulaman/boss_nalorakk.cpp +++ b/src/bindings/scripts/scripts/zone/zulaman/boss_nalorakk.cpp @@ -435,20 +435,30 @@ struct TRINITY_DLL_DECL boss_nalorakkAI : public ScriptedAI DoYell(YELL_SURGE, LANG_UNIVERSAL, NULL); DoPlaySoundToSet(m_creature, SOUND_YELL_SURGE); - Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 1); + Unit *target = NULL; + std::list t_list = m_creature->getThreatManager().getThreatList(); + std::vector target_list; + for(std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + { + target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); + //50 yard radius maximum + if(target && target->GetDistance2d(m_creature) < 50) + target_list.push_back(target); + target = NULL; + } + if(target_list.size()) + target = *(target_list.begin()+rand()%target_list.size()); + if(!target) target = m_creature->getVictim(); TankGUID = m_creature->getVictim()->GetGUID(); ChargeTargetGUID = target->GetGUID(); - - if(target && m_creature->IsWithinDistInMap(target, 50.0f)) - { + float x, y, z; target->GetContactPoint(m_creature, x, y, z); m_creature->SetSpeed(MOVE_RUN, 5.0f); m_creature->GetMotionMaster()->Clear(); - m_creature->GetMotionMaster()->MovePoint(0, x, y, z); - } + m_creature->GetMotionMaster()->MovePoint(0, x, y, z); Surge_Timer = 15000 + rand()%5000; return; From c6e74cb9134f3501a59cb0f8440a12749bda0f7e Mon Sep 17 00:00:00 2001 From: Blaymoira Date: Wed, 24 Dec 2008 23:18:28 +0100 Subject: [PATCH 10/12] *Add support for quest 9645 - original patch by BroodWyrm --HG-- branch : trunk --- sql/updates/636_world_scripts.sql | 9 + .../scripts/zone/karazhan/def_karazhan.h | 1 + .../zone/karazhan/instance_karazhan.cpp | 13 ++ .../scripts/zone/karazhan/karazhan.cpp | 211 +++++++++++++++++- 4 files changed, 233 insertions(+), 1 deletion(-) create mode 100644 sql/updates/636_world_scripts.sql diff --git a/sql/updates/636_world_scripts.sql b/sql/updates/636_world_scripts.sql new file mode 100644 index 00000000000..5527d639fb2 --- /dev/null +++ b/sql/updates/636_world_scripts.sql @@ -0,0 +1,9 @@ +-- event script for Medivh's Journal +delete from event_scripts where id = 10951; +insert into event_scripts values +(10951,0,10,17651, 300000, 0,-11159,-1907.22,91.48,0); + +-- remove every Image from Medivh (should not be spawned by db) +delete from creature where id = 17651; +-- add script +update creature_template set scriptname = 'npc_image_of_medivh' where entry = 17651; \ No newline at end of file diff --git a/src/bindings/scripts/scripts/zone/karazhan/def_karazhan.h b/src/bindings/scripts/scripts/zone/karazhan/def_karazhan.h index df39785f555..78c1c488637 100644 --- a/src/bindings/scripts/scripts/zone/karazhan/def_karazhan.h +++ b/src/bindings/scripts/scripts/zone/karazhan/def_karazhan.h @@ -30,6 +30,7 @@ #define DATA_GAMEOBJECT_NETHER_DOOR 23 #define DATA_GAMEOBJECT_GAME_DOOR 24 #define DATA_GAMEOBJECT_GAME_EXIT_DOOR 25 +#define DATA_IMAGE_OF_MEDIVH 26 // Opera Performances #define EVENT_OZ 1 diff --git a/src/bindings/scripts/scripts/zone/karazhan/instance_karazhan.cpp b/src/bindings/scripts/scripts/zone/karazhan/instance_karazhan.cpp index 0ca3835d976..5af12a4fb0b 100644 --- a/src/bindings/scripts/scripts/zone/karazhan/instance_karazhan.cpp +++ b/src/bindings/scripts/scripts/zone/karazhan/instance_karazhan.cpp @@ -61,6 +61,8 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance uint64 GamesmansExitDoor; // Door after Chess uint64 NetherspaceDoor; // Door at Malchezaar + uint64 ImageGUID; + void Initialize() { for (uint8 i = 0; i < ENCOUNTERS; ++i) @@ -82,6 +84,8 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance GamesmansDoor = 0; GamesmansExitDoor = 0; NetherspaceDoor = 0; + + ImageGUID = 0; } bool IsEncounterInProgress() const @@ -111,6 +115,7 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance case DATA_NIGHTBANE_EVENT: return Encounters[11]; case DATA_OPERA_PERFORMANCE: return OperaEvent; case DATA_OPERA_OZ_DEATHCOUNT: return OzDeathCount; + case DATA_IMAGE_OF_MEDIVH: return ImageGUID; } return 0; @@ -174,6 +179,14 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance SaveToDB(); } + void SetData64(uint32 identifier, uint64 data) + { + switch(identifier) + { + case DATA_IMAGE_OF_MEDIVH: ImageGUID = data; + } + } + void OnObjectCreate(GameObject* go) { switch(go->GetEntry()) diff --git a/src/bindings/scripts/scripts/zone/karazhan/karazhan.cpp b/src/bindings/scripts/scripts/zone/karazhan/karazhan.cpp index adda6eefa98..bb44dd55cc0 100644 --- a/src/bindings/scripts/scripts/zone/karazhan/karazhan.cpp +++ b/src/bindings/scripts/scripts/zone/karazhan/karazhan.cpp @@ -17,13 +17,14 @@ /* ScriptData SDName: Karazhan SD%Complete: 100 -SDComment: Support for Barnes (Opera controller) and Berthold (Doorman). +SDComment: Support for Barnes (Opera controller) and Berthold (Doorman), Support for Quest 9645. SDCategory: Karazhan EndScriptData */ /* ContentData npc_barnes npc_berthold +npc_image_of_medivh EndContentData */ #include "precompiled.h" @@ -432,6 +433,209 @@ bool GossipSelect_npc_berthold(Player* player, Creature* _Creature, uint32 sende return true; } +/*### +# npc_image_of_medivh +####*/ + +#define SAY_DIALOG_MEDIVH_1 "You've got my attention, dragon. You'll find I'm not as easily scared as the villagers below." +#define SAY_DIALOG_ARCANAGOS_2 "Your dabbling in the arcane has gone too far, Medivh. You've attracted the attention of powers beyond your understanding. You must leave Karazhan at once!" +#define SAY_DIALOG_MEDIVH_3 "You dare challenge me at my own dwelling? Your arrogance is astounding, even for a dragon!" +#define SAY_DIALOG_ARCANAGOS_4 "A dark power seeks to use you, Medivh! If you stay, dire days will follow. You must hurry, we don't have much time!" +#define SAY_DIALOG_MEDIVH_5 "I do not know what you speak of, dragon... but I will not be bullied by this display of insolence. I'll leave Karazhan when it suits me!" +#define SAY_DIALOG_ARCANAGOS_6 "You leave me no alternative. I will stop you by force if you won't listen to reason!" +#define EMOTE_DIALOG_MEDIVH_7 "begins to cast a spell of great power, weaving his own essence into the magic." +#define SAY_DIALOG_ARCANAGOS_8 "What have you done, wizard? This cannot be! I'm burning from... within!" +#define SAY_DIALOG_MEDIVH_9 "He should not have angered me. I must go... recover my strength now..." + +#define MOB_ARCANAGOS 17652 +#define SPELL_FIRE_BALL 30967 +#define SPELL_UBER_FIREBALL 30971 +#define SPELL_CONFLAGRATION_BLAST 30977 +#define SPELL_MANA_SHIELD 31635 + +static float MedivPos[4] = {-11161.49,-1902.24,91.48,1.94}; +static float ArcanagosPos[4] = {-11169.75,-1881.48,95.39,4.83}; + +struct TRINITY_DLL_DECL npc_image_of_medivhAI : public ScriptedAI +{ + npc_image_of_medivhAI(Creature* c) : ScriptedAI(c) + { + pInstance = ((ScriptedInstance*)c->GetInstanceData()); + Reset(); + } + + ScriptedInstance *pInstance; + + uint64 ArcanagosGUID; + + uint32 YellTimer; + uint32 Step; + uint32 FireMedivhTimer; + uint32 FireArcanagosTimer; + + bool EventStarted; + + void Reset() + { + ArcanagosGUID = 0; + + if(pInstance && pInstance->GetData64(DATA_IMAGE_OF_MEDIVH) == 0) + { + pInstance->SetData64(DATA_IMAGE_OF_MEDIVH, m_creature->GetGUID()); + (*m_creature).GetMotionMaster()->MovePoint(1,MedivPos[0],MedivPos[1],MedivPos[2]); + Step = 0; + }else + { + m_creature->DealDamage(m_creature,m_creature->GetHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + m_creature->RemoveCorpse(); + } + } + void Aggro(Unit* who){} + + void MovementInform(uint32 type, uint32 id) + { + if(type != POINT_MOTION_TYPE) + return; + if(id == 1) + { + StartEvent(); + m_creature->SetOrientation(MedivPos[3]); + m_creature->SetOrientation(MedivPos[3]); + } + } + + void StartEvent() + { + Step = 1; + EventStarted = true; + Creature* Arcanagos = m_creature->SummonCreature(MOB_ARCANAGOS,ArcanagosPos[0],ArcanagosPos[1],ArcanagosPos[2],0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,20000); + ArcanagosGUID = Arcanagos->GetGUID(); + Arcanagos->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT + MOVEMENTFLAG_LEVITATING); + (*Arcanagos).GetMotionMaster()->MovePoint(0,ArcanagosPos[0],ArcanagosPos[1],ArcanagosPos[2]); + Arcanagos->SetOrientation(ArcanagosPos[3]); + m_creature->SetOrientation(MedivPos[3]); + YellTimer = 10000; + } + + + uint32 NextStep(uint32 Step) + { + Unit* arca = Unit::GetUnit((*m_creature),ArcanagosGUID); + Map *map = m_creature->GetMap(); + switch(Step) + { + case 0: return 9999999; + case 1: + m_creature->Yell(SAY_DIALOG_MEDIVH_1,LANG_UNIVERSAL,NULL); + return 10000; + case 2: + if(arca) + ((Creature*)arca)->Yell(SAY_DIALOG_ARCANAGOS_2,LANG_UNIVERSAL,NULL); + return 20000; + case 3: + m_creature->Yell(SAY_DIALOG_MEDIVH_3,LANG_UNIVERSAL,NULL); + return 10000; + case 4: + if(arca) + ((Creature*)arca)->Yell(SAY_DIALOG_ARCANAGOS_4, LANG_UNIVERSAL, NULL); + return 20000; + case 5: + m_creature->Yell(SAY_DIALOG_MEDIVH_5, LANG_UNIVERSAL, NULL); + return 20000; + case 6: + if(arca) + ((Creature*)arca)->Yell(SAY_DIALOG_ARCANAGOS_6, LANG_UNIVERSAL, NULL); + return 10000; + case 7: + FireArcanagosTimer = 500; + return 5000; + case 8: + FireMedivhTimer = 500; + DoCast(m_creature, SPELL_MANA_SHIELD); + return 10000; + case 9: + m_creature->TextEmote(EMOTE_DIALOG_MEDIVH_7, 0, false); + return 10000; + case 10: + if(arca) + m_creature->CastSpell(arca, SPELL_CONFLAGRATION_BLAST, false); + return 1000; + case 11: + if(arca) + ((Creature*)arca)->Yell(SAY_DIALOG_ARCANAGOS_8, LANG_UNIVERSAL, NULL); + return 5000; + case 12: + arca->GetMotionMaster()->MovePoint(0, -11010.82,-1761.18, 156.47); + arca->setActive(true); + arca->InterruptNonMeleeSpells(true); + arca->SetSpeed(MOVE_FLIGHT, 2.0f); + return 10000; + case 13: + m_creature->Yell(SAY_DIALOG_MEDIVH_9, LANG_UNIVERSAL, NULL); + return 10000; + case 14: + m_creature->SetVisibility(VISIBILITY_OFF); + m_creature->ClearInCombat(); + + if(map->IsDungeon()) + { + InstanceMap::PlayerList const &PlayerList = ((InstanceMap*)map)->GetPlayers(); + for (InstanceMap::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + { + if(i->getSource()->isAlive()) + { + if(i->getSource()->GetQuestStatus(9645) == QUEST_STATUS_INCOMPLETE) + i->getSource()->CompleteQuest(9645); + } + } + } + return 50000; + case 15: + arca->DealDamage(arca,arca->GetHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + return 5000; + default : return 9999999; + } + + } + + void UpdateAI(const uint32 diff) + { + + if(YellTimer < diff) + { + if(EventStarted) + { + YellTimer = NextStep(Step++); + } + }else YellTimer -= diff; + + if(Step >= 7 && Step <= 12 ) + { + Unit* arca = Unit::GetUnit((*m_creature),ArcanagosGUID); + + if(FireArcanagosTimer < diff) + { + if(arca) + arca->CastSpell(m_creature, SPELL_FIRE_BALL, false); + FireArcanagosTimer = 6000; + }else FireArcanagosTimer -= diff; + + if(FireMedivhTimer < diff) + { + if(arca) + DoCast(arca, SPELL_FIRE_BALL); + FireMedivhTimer = 5000; + }else FireMedivhTimer -= diff; + + } + } +}; + +CreatureAI* GetAI_npc_image_of_medivh(Creature *_Creature) +{ + return new npc_image_of_medivhAI(_Creature); +} + void AddSC_karazhan() { Script* newscript; @@ -447,5 +651,10 @@ void AddSC_karazhan() newscript->Name = "npc_berthold"; newscript->pGossipHello = &GossipHello_npc_berthold; newscript->pGossipSelect = &GossipSelect_npc_berthold; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "npc_image_of_medivh"; + newscript->GetAI = &GetAI_npc_image_of_medivh; newscript->RegisterSelf(); } From 4481ad517f9107992a4c0043f44e254c67a822fd Mon Sep 17 00:00:00 2001 From: megamage Date: Wed, 24 Dec 2008 16:22:19 -0600 Subject: [PATCH 11/12] *Fix the bug that auras have one less point. --HG-- branch : trunk --- src/game/SpellAuras.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 1597b4a2b25..449867c0022 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -331,14 +331,26 @@ m_periodicTimer(0), m_PeriodicEventId(0), m_AuraDRGroup(DIMINISHING_NONE) m_spellProto = spellproto; - m_currentBasePoints = currentBasePoints ? *currentBasePoints : m_spellProto->EffectBasePoints[eff]; + int32 damage; + if(currentBasePoints) + { + damage = *currentBasePoints; + m_currentBasePoints = damage - 1; + } + else + { + m_currentBasePoints = m_spellProto->EffectBasePoints[eff]; + if(caster) + damage = caster->CalculateSpellDamage(m_spellProto, m_effIndex, m_currentBasePoints, target); + else + damage = m_currentBasePoints + 1; + } m_isPassive = IsPassiveSpell(GetId()); m_positive = IsPositiveEffect(GetId(), m_effIndex); m_applyTime = time(NULL); - int32 damage; if(!caster) { m_caster_guid = target->GetGUID(); @@ -349,7 +361,7 @@ m_periodicTimer(0), m_PeriodicEventId(0), m_AuraDRGroup(DIMINISHING_NONE) { m_caster_guid = caster->GetGUID(); - damage = caster->CalculateSpellDamage(m_spellProto,m_effIndex,m_currentBasePoints,target); + //damage = caster->CalculateSpellDamage(m_spellProto,m_effIndex,m_currentBasePoints,target); m_maxduration = caster->CalculateSpellDuration(m_spellProto, m_effIndex, target); if (!damage && castItem && castItem->GetItemSuffixFactor()) From f481c04eac5514c5446a04c982b4318dda62b2c6 Mon Sep 17 00:00:00 2001 From: megamage Date: Wed, 24 Dec 2008 18:45:06 -0600 Subject: [PATCH 12/12] *Fix broken item spells. --HG-- branch : trunk --- src/game/Spell.cpp | 25 +++++++++++++++---------- src/game/SpellMgr.cpp | 7 +++++++ src/game/SpellMgr.h | 1 + 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 694ba2ceaa7..6f5dd73f724 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -425,19 +425,24 @@ void Spell::FillTargetMap() if(spellmgr.EffectTargetType[m_spellInfo->Effect[i]] != SPELL_REQUIRE_UNIT) { - if(spellmgr.EffectTargetType[m_spellInfo->Effect[i]] == SPELL_REQUIRE_DEST - && m_targets.HasDest() && m_spellInfo->speed > 0.0f) + if(spellmgr.EffectTargetType[m_spellInfo->Effect[i]] == SPELL_REQUIRE_DEST) { - float dist = m_caster->GetDistance(m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ); - if (dist < 5.0f) dist = 5.0f; - m_delayMoment = (uint64) floor(dist / m_spellInfo->speed * 1000.0f); + if(m_targets.HasDest() && m_spellInfo->speed > 0.0f) + { + float dist = m_caster->GetDistance(m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ); + if (dist < 5.0f) dist = 5.0f; + m_delayMoment = (uint64) floor(dist / m_spellInfo->speed * 1000.0f); + } + } + else if(spellmgr.EffectTargetType[m_spellInfo->Effect[i]] == SPELL_REQUIRE_ITEM) + { + if(m_targets.getItemTarget()) + AddItemTarget(m_targets.getItemTarget(), i); } continue; } if(!targetA && !targetB) - AddUnitTarget(m_caster, i); - else if(tmpUnitMap.empty()) { // add here custom effects that need default target. // FOR EVERY TARGET TYPE THERE IS A DIFFERENT FILL!! @@ -504,10 +509,10 @@ void Spell::FillTargetMap() case SPELL_EFFECT_RESURRECT: case SPELL_EFFECT_CREATE_ITEM: case SPELL_EFFECT_TRIGGER_SPELL: - //case SPELL_EFFECT_TRIGGER_MISSILE: ?? case SPELL_EFFECT_SKILL_STEP: case SPELL_EFFECT_SELF_RESURRECT: case SPELL_EFFECT_REPUTATION: + case SPELL_EFFECT_LEARN_SPELL: if(m_targets.getUnitTarget()) tmpUnitMap.push_back(m_targets.getUnitTarget()); else @@ -545,14 +550,14 @@ void Spell::FillTargetMap() if(Pet* pet = m_caster->GetPet()) tmpUnitMap.push_back(pet); break; - case SPELL_EFFECT_ENCHANT_ITEM: + /*case SPELL_EFFECT_ENCHANT_ITEM: case SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY: case SPELL_EFFECT_DISENCHANT: case SPELL_EFFECT_FEED_PET: case SPELL_EFFECT_PROSPECTING: if(m_targets.getItemTarget()) AddItemTarget(m_targets.getItemTarget(), i); - break; + break;*/ case SPELL_EFFECT_APPLY_AURA: switch(m_spellInfo->EffectApplyAuraName[i]) { diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 41faea5b8fb..78175708cba 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -66,6 +66,13 @@ SpellMgr::SpellMgr() case SPELL_EFFECT_PROFICIENCY: // 0 EffectTargetType[i] = SPELL_REQUIRE_NONE; break; + case SPELL_EFFECT_ENCHANT_ITEM: + case SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY: + case SPELL_EFFECT_DISENCHANT: + case SPELL_EFFECT_FEED_PET: + case SPELL_EFFECT_PROSPECTING: + EffectTargetType[i] = SPELL_REQUIRE_ITEM; + break; default: EffectTargetType[i] = SPELL_REQUIRE_UNIT; break; diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index 51e6fbd1d56..d8b4b866655 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -238,6 +238,7 @@ enum SpellEffectTargetTypes SPELL_REQUIRE_NONE, SPELL_REQUIRE_UNIT, SPELL_REQUIRE_DEST, + SPELL_REQUIRE_ITEM, }; enum SpellSelectTargetTypes