Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4

Conflicts:
	src/server/game/Entities/Corpse/Corpse.cpp
	src/server/game/Globals/ObjectMgr.cpp
This commit is contained in:
Vincent-Michael
2013-07-19 22:33:35 +02:00
18 changed files with 395 additions and 55 deletions

View File

@@ -279,8 +279,8 @@ public:
bool found = false;
float x, y, z, o;
uint32 guidLow, id;
uint16 mapId, phase;
uint32 guidLow, id, phase;
uint16 mapId;
uint32 poolId;
do
@@ -293,7 +293,7 @@ public:
z = fields[4].GetFloat();
o = fields[5].GetFloat();
mapId = fields[6].GetUInt16();
phase = fields[7].GetUInt16();
phase = fields[7].GetUInt32();
poolId = sPoolMgr->IsPartOfAPool<GameObject>(guidLow);
if (!poolId || sPoolMgr->IsSpawnedObject<GameObject>(guidLow))
found = true;

View File

@@ -216,7 +216,7 @@ public:
void SummonedCreatureDespawn(Creature* summon) OVERRIDE
{
uint32 phase= summon->GetPhaseMask();
uint32 phase = summon->GetPhaseMask();
uint32 nextPhase = 0;
Summons.Despawn(summon);

View File

@@ -17,9 +17,11 @@
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "forge_of_souls.h"
#include "Player.h"
#include "SpellInfo.h"
#include "SpellAuraEffects.h"
#include "SpellScript.h"
#include "forge_of_souls.h"
/*
* @todo
@@ -48,7 +50,10 @@ enum Spells
{
SPELL_PHANTOM_BLAST = 68982,
H_SPELL_PHANTOM_BLAST = 70322,
SPELL_MIRRORED_SOUL = 69051,
SPELL_MIRRORED_SOUL_PROC_AURA = 69023,
SPELL_MIRRORED_SOUL_DAMAGE = 69034,
SPELL_MIRRORED_SOUL_TARGET_SELECTOR = 69048,
SPELL_MIRRORED_SOUL_BUFF = 69051,
SPELL_WELL_OF_SOULS = 68820,
SPELL_UNLEASHED_SOULS = 68939,
SPELL_WAILING_SOULS_STARTING = 68912, // Initial spell cast at begining of wailing souls phase
@@ -145,7 +150,6 @@ class boss_devourer_of_souls : public CreatureScript
summons.DespawnAll();
threeFaced = true;
mirroredSoulTarget = 0;
instance->SetData(DATA_DEVOURER_EVENT, NOT_STARTED);
}
@@ -165,23 +169,6 @@ class boss_devourer_of_souls : public CreatureScript
instance->SetData(DATA_DEVOURER_EVENT, IN_PROGRESS);
}
void DamageTaken(Unit* /*pDoneBy*/, uint32 &uiDamage) OVERRIDE
{
if (mirroredSoulTarget && me->HasAura(SPELL_MIRRORED_SOUL))
{
if (Player* player = Unit::GetPlayer(*me, mirroredSoulTarget))
{
if (player->GetAura(SPELL_MIRRORED_SOUL))
{
int32 mirrorDamage = (uiDamage* 45)/100;
me->CastCustomSpell(player, 69034, &mirrorDamage, 0, 0, true);
}
else
mirroredSoulTarget = 0;
}
}
}
void KilledUnit(Unit* victim) OVERRIDE
{
if (victim->GetTypeId() != TYPEID_PLAYER)
@@ -270,12 +257,8 @@ class boss_devourer_of_souls : public CreatureScript
events.ScheduleEvent(EVENT_PHANTOM_BLAST, 5000);
break;
case EVENT_MIRRORED_SOUL:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0, true))
{
mirroredSoulTarget = target->GetGUID();
DoCast(target, SPELL_MIRRORED_SOUL);
Talk(EMOTE_MIRRORED_SOUL);
}
DoCastAOE(SPELL_MIRRORED_SOUL_TARGET_SELECTOR);
Talk(EMOTE_MIRRORED_SOUL);
events.ScheduleEvent(EVENT_MIRRORED_SOUL, urand(15000, 30000));
break;
case EVENT_WELL_OF_SOULS:
@@ -358,8 +341,6 @@ class boss_devourer_of_souls : public CreatureScript
float beamAngle;
float beamAngleDiff;
int8 wailingSoulTick;
uint64 mirroredSoulTarget;
};
CreatureAI* GetAI(Creature* creature) const OVERRIDE
@@ -368,6 +349,139 @@ class boss_devourer_of_souls : public CreatureScript
}
};
// 69051 - Mirrored Soul
class spell_devourer_of_souls_mirrored_soul : public SpellScriptLoader
{
public:
spell_devourer_of_souls_mirrored_soul() : SpellScriptLoader("spell_devourer_of_souls_mirrored_soul") { }
class spell_devourer_of_souls_mirrored_soul_SpellScript : public SpellScript
{
PrepareSpellScript(spell_devourer_of_souls_mirrored_soul_SpellScript);
bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE
{
if (!sSpellMgr->GetSpellInfo(SPELL_MIRRORED_SOUL_PROC_AURA))
return false;
return true;
}
void HandleScript(SpellEffIndex /*effIndex*/)
{
if (Unit* target = GetHitUnit())
target->CastSpell(GetCaster(), SPELL_MIRRORED_SOUL_PROC_AURA, true);
}
void Register() OVERRIDE
{
OnEffectHitTarget += SpellEffectFn(spell_devourer_of_souls_mirrored_soul_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const OVERRIDE
{
return new spell_devourer_of_souls_mirrored_soul_SpellScript();
}
};
// 69023 - Mirrored Soul (Proc)
class spell_devourer_of_souls_mirrored_soul_proc : public SpellScriptLoader
{
public:
spell_devourer_of_souls_mirrored_soul_proc() : SpellScriptLoader("spell_devourer_of_souls_mirrored_soul_proc") { }
class spell_devourer_of_souls_mirrored_soul_proc_AuraScript : public AuraScript
{
PrepareAuraScript(spell_devourer_of_souls_mirrored_soul_proc_AuraScript);
bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE
{
if (!sSpellMgr->GetSpellInfo(SPELL_MIRRORED_SOUL_DAMAGE))
return false;
return true;
}
bool Load() OVERRIDE
{
_procTarget = NULL;
return true;
}
bool CheckProc(ProcEventInfo& /*eventInfo*/)
{
_procTarget = GetCaster();
return _procTarget && _procTarget->IsAlive();
}
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
int32 damage = int32(CalculatePct(eventInfo.GetDamageInfo()->GetDamage(), 45));
GetTarget()->CastCustomSpell(SPELL_MIRRORED_SOUL_DAMAGE, SPELLVALUE_BASE_POINT0, damage, _procTarget, true);
}
void Register() OVERRIDE
{
DoCheckProc += AuraCheckProcFn(spell_devourer_of_souls_mirrored_soul_proc_AuraScript::CheckProc);
OnEffectProc += AuraEffectProcFn(spell_devourer_of_souls_mirrored_soul_proc_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL);
}
private:
Unit* _procTarget;
};
AuraScript* GetAuraScript() const OVERRIDE
{
return new spell_devourer_of_souls_mirrored_soul_proc_AuraScript();
}
};
// 69048 - Mirrored Soul (Target Selector)
class spell_devourer_of_souls_mirrored_soul_target_selector : public SpellScriptLoader
{
public:
spell_devourer_of_souls_mirrored_soul_target_selector() : SpellScriptLoader("spell_devourer_of_souls_mirrored_soul_target_selector") { }
class spell_devourer_of_souls_mirrored_soul_target_selector_SpellScript : public SpellScript
{
PrepareSpellScript(spell_devourer_of_souls_mirrored_soul_target_selector_SpellScript);
bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE
{
if (!sSpellMgr->GetSpellInfo(SPELL_MIRRORED_SOUL_BUFF))
return false;
return true;
}
void FilterTargets(std::list<WorldObject*>& targets)
{
if (targets.empty())
return;
WorldObject* target = Trinity::Containers::SelectRandomContainerElement(targets);
targets.clear();
targets.push_back(target);
}
void HandleScript(SpellEffIndex /*effIndex*/)
{
if (Unit* target = GetHitUnit())
GetCaster()->CastSpell(target, SPELL_MIRRORED_SOUL_BUFF, false);
}
void Register() OVERRIDE
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_devourer_of_souls_mirrored_soul_target_selector_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY);
OnEffectHitTarget += SpellEffectFn(spell_devourer_of_souls_mirrored_soul_target_selector_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const OVERRIDE
{
return new spell_devourer_of_souls_mirrored_soul_target_selector_SpellScript();
}
};
class achievement_three_faced : public AchievementCriteriaScript
{
public:
@@ -391,5 +505,8 @@ class achievement_three_faced : public AchievementCriteriaScript
void AddSC_boss_devourer_of_souls()
{
new boss_devourer_of_souls();
new spell_devourer_of_souls_mirrored_soul();
new spell_devourer_of_souls_mirrored_soul_proc();
new spell_devourer_of_souls_mirrored_soul_target_selector();
new achievement_three_faced();
}

View File

@@ -16,17 +16,6 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* ScriptData
SDName: Icecrown
SD%Complete: 100
SDComment: Quest support: 12807
SDCategory: Icecrown
EndScriptData */
/* ContentData
npc_arete
EndContentData */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
@@ -966,6 +955,197 @@ class npc_frostbrood_skytalon : public CreatureScript
}
};
/*######
## The Flesh Giant Champion - Id: 13235
######*/
enum FleshGiant
{
QUEST_FLESH_GIANT_CHAMPION = 13235,
NPC_MORBIDUS = 30698,
NPC_LICH_KING = 31301,
NPC_OLAKIN = 31428,
NPC_DHAKAR = 31306,
FACTION_HOSTILE = 14,
FACTION_BASIC = 2102,
EVENT_INTRO = 1,
EVENT_LK_SAY_1 = 2,
EVENT_LK_SAY_2 = 3,
EVENT_LK_SAY_3 = 4,
EVENT_LK_SAY_4 = 5,
EVENT_LK_SAY_5 = 6,
EVENT_OUTRO = 7,
EVENT_START = 8,
SPELL_SIMPLE_TELEPORT = 64195,
SAY_DHAKAR_START = 0,
SAY_LK_1 = 0,
SAY_LK_2 = 1,
SAY_LK_3 = 2,
SAY_LK_4 = 3,
SAY_LK_5 = 4,
SAY_OLAKIN_PAY = 0
};
class npc_margrave_dhakar : public CreatureScript
{
public:
npc_margrave_dhakar() : CreatureScript("npc_margrave_dhakar") { }
struct npc_margrave_dhakarAI : public ScriptedAI
{
npc_margrave_dhakarAI(Creature* creature) : ScriptedAI(creature) , _summons(me), _lichKingGuid(0) { }
void Reset() OVERRIDE
{
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE);
_events.Reset();
_summons.DespawnAll();
}
void sGossipSelect(Player* player, uint32 sender, uint32 action) OVERRIDE
{
if (player->GetQuestStatus(QUEST_FLESH_GIANT_CHAMPION) == QUEST_STATUS_INCOMPLETE && !player->IsInCombat())
{
if (me->GetCreatureTemplate()->GossipMenuId == sender && !action)
{
_events.ScheduleEvent(EVENT_INTRO, 1000);
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
}
}
}
void UpdateAI(uint32 diff) OVERRIDE
{
_events.Update(diff);
while (uint32 eventId = _events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_INTRO:
{
Talk(SAY_DHAKAR_START);
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H);
if (Creature* morbidus = me->FindNearestCreature(NPC_MORBIDUS, 50.0f, true))
{
Creature* lichKing = me->SummonCreature(NPC_LICH_KING, morbidus->GetPositionX()+10, morbidus->GetPositionY(), morbidus->GetPositionZ());
_lichKingGuid = lichKing->GetGUID();
lichKing = me->SummonCreature(NPC_LICH_KING, morbidus->GetPositionX()+10, morbidus->GetPositionY(), morbidus->GetPositionZ());
lichKing->SetFacingTo(morbidus->GetOrientation());
lichKing->CastSpell(lichKing, SPELL_SIMPLE_TELEPORT, true);
}
_events.ScheduleEvent(EVENT_LK_SAY_1, 5000);
break;
}
case EVENT_LK_SAY_1:
{
if (Creature* lichKing = Unit::GetCreature(*me, _lichKingGuid))
lichKing->AI()->Talk(SAY_LK_1);
_events.ScheduleEvent(EVENT_LK_SAY_2, 5000);
break;
}
case EVENT_LK_SAY_2:
{
if (Creature* lichKing = Unit::GetCreature(*me, _lichKingGuid))
lichKing->AI()->Talk(SAY_LK_2);
_events.ScheduleEvent(EVENT_LK_SAY_3, 5000);
break;
}
case EVENT_LK_SAY_3:
{
if (Creature* lichKing = Unit::GetCreature(*me, _lichKingGuid))
lichKing->AI()->Talk(SAY_LK_3);
_events.ScheduleEvent(EVENT_LK_SAY_4, 5000);
break;
}
case EVENT_LK_SAY_4:
{
if (Creature* lichKing = Unit::GetCreature(*me, _lichKingGuid))
lichKing->AI()->Talk(SAY_LK_4);
_events.ScheduleEvent(EVENT_OUTRO, 12000);
break;
}
case EVENT_LK_SAY_5:
{
if (Creature* lichKing = Unit::GetCreature(*me, _lichKingGuid))
lichKing->AI()->Talk(SAY_LK_5);
_events.ScheduleEvent(EVENT_OUTRO, 8000);
break;
}
case EVENT_OUTRO:
{
if (Creature* olakin = me->FindNearestCreature(NPC_OLAKIN, 50.0f, true))
olakin->AI()->Talk(SAY_OLAKIN_PAY);
if (Creature* lichKing = Unit::GetCreature(*me, _lichKingGuid))
lichKing->DespawnOrUnsummon(0);
_events.ScheduleEvent(EVENT_START, 5000);
break;
}
case EVENT_START:
{
if (Creature* morbidus = me->FindNearestCreature(NPC_MORBIDUS, 50.0f, true))
{
morbidus->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_DISABLE_MOVE);
morbidus->setFaction(FACTION_HOSTILE);
}
break;
}
}
}
DoMeleeAttackIfReady();
}
private:
EventMap _events;
uint64 _lichKingGuid;
SummonList _summons;
};
CreatureAI* GetAI(Creature* creature) const OVERRIDE
{
return new npc_margrave_dhakarAI(creature);
}
};
class npc_morbidus : public CreatureScript
{
public:
npc_morbidus() : CreatureScript("npc_morbidus") { }
struct npc_morbidusAI : public ScriptedAI
{
npc_morbidusAI(Creature* creature) : ScriptedAI(creature) { }
void Reset() OVERRIDE
{
if (Creature* dhakar = me->FindNearestCreature(NPC_DHAKAR, 50.0f, true))
dhakar->AI()->Reset();
// this will prevent the event to start without morbidus being alive
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->SetReactState(REACT_PASSIVE);
me->setFaction(FACTION_BASIC);
}
};
CreatureAI* GetAI(Creature* creature) const OVERRIDE
{
return new npc_morbidusAI(creature);
}
};
void AddSC_icecrown()
{
new npc_arete;
@@ -976,4 +1156,6 @@ void AddSC_icecrown()
new npc_tournament_training_dummy;
new npc_blessed_banner();
new npc_frostbrood_skytalon();
new npc_margrave_dhakar();
new npc_morbidus();
}