*Some improvement of DK start zone quests (no new quest fixed)

--HG--
branch : trunk
This commit is contained in:
megamage
2009-05-27 23:33:21 -05:00
parent e81d3acda7
commit d2fe68bfef
5 changed files with 94 additions and 58 deletions
+5
View File
@@ -0,0 +1,5 @@
DELETE FROM `spell_script_target` WHERE entry IN
(52124);
INSERT INTO `spell_script_target` (`entry`, `type`, `targetEntry`) VALUES
(52124, 1, 28655);
UPDATE `creature_template` SET spell1=52372,spell2=52373,spell3=52374,spell4=52375 WHERE `entry`=28406;
@@ -366,72 +366,79 @@ bool GOHello_go_acherus_soul_prison(Player *player, GameObject* _GO)
#define GOSSIP_DKI "Duel with me!" #define GOSSIP_DKI "Duel with me!"
#define SAY_DKI_DUEL1 "Remember this day, $N, for it is the day that you will be thoroughly owned." const char * SAY_DKI_DUEL1 = "Remember this day, $N, for it is the day that you will be thoroughly owned.";
#define SAY_DKI_DUEL2 "I'm going to tear your heart out, cupcake!" const char * SAY_DKI_DUEL2 = "I'm going to tear your heart out, cupcake!";
#define SAY_DKI_DUEL3 "You have challenged death itself!" const char * SAY_DKI_DUEL3 = "You have challenged death itself!";
#define SAY_DKI_DUEL4 "Don't make me laugh." const char * SAY_DKI_DUEL4 = "Don't make me laugh.";
#define SAY_DKI_DUEL5 "Here come the tears..." const char * SAY_DKI_DUEL5 = "Here come the tears...";
#define SAY_DKI_DUEL6 "No potions!" const char * SAY_DKI_DUEL6 = "No potions!";
#define SAY_DKI_DUEL RAND(SAY_DKI_DUEL1,SAY_DKI_DUEL2,SAY_DKI_DUEL3,SAY_DKI_DUEL4,SAY_DKI_DUEL5,SAY_DKI_DUEL6)
struct TRINITY_DLL_DECL npc_death_knight_initiateAI : public ScriptedAI #define SPELL_DUEL_FLAG 52991
struct TRINITY_DLL_DECL npc_death_knight_initiateAI : public SpellAI
{ {
npc_death_knight_initiateAI(Creature *c) : ScriptedAI(c) {Reset();} npc_death_knight_initiateAI(Creature *c) : SpellAI(c) {}
void Reset() void Reset()
{ {
m_creature->setFaction(2084); me->RestoreFaction();
lose = false;
SpellAI::Reset();
} }
void EnterCombat(Unit *who) { bool lose;
if(who->GetTypeId() == TYPEID_PLAYER) {
switch(rand()%6) void EnterCombat(Unit *who)
{ {
case 0: DoSay(SAY_DKI_DUEL1, LANG_UNIVERSAL, who); break; if(who->GetTypeId() == TYPEID_PLAYER)
case 1: DoSay(SAY_DKI_DUEL2, LANG_UNIVERSAL, who); break; me->MonsterSay(SAY_DKI_DUEL, LANG_UNIVERSAL, who->GetGUID());
case 2: DoSay(SAY_DKI_DUEL3, LANG_UNIVERSAL, who); break; SpellAI::EnterCombat(who);
case 3: DoSay(SAY_DKI_DUEL4, LANG_UNIVERSAL, who); break;
case 4: DoSay(SAY_DKI_DUEL5, LANG_UNIVERSAL, who); break;
case 5: DoSay(SAY_DKI_DUEL6, LANG_UNIVERSAL, who); break;
} }
}
}
void Aggro(Unit *who) { }
void JustDied(Unit *killer) { }
void UpdateAI(const uint32 diff) void UpdateAI(const uint32 diff)
{ {
if ( !UpdateVictim() ) if(me->getVictim() && me->getVictim()->GetTypeId() == TYPEID_PLAYER)
return; {
if(lose)
Unit *victim = m_creature->getVictim(); {
if(!me->HasAura(7267)) // beg aura has faded
if(victim->GetTypeId() == TYPEID_PLAYER) { {
if ( (victim->GetHealth()*100)/victim->GetMaxHealth() <= 10 ) { ((Player*)me->getVictim())->KilledMonster(29025,m_creature->GetGUID());
m_creature->setFaction(2084);
victim->AttackStop();
m_creature->CombatStop();
m_creature->RemoveAllAuras();
EnterEvadeMode(); EnterEvadeMode();
} }
return;
}
else if(me->getVictim()->GetHealth() * 10 < me->getVictim()->GetMaxHealth())
{
me->getVictim()->CastSpell(me->getVictim(), 7267, true); // beg
me->getVictim()->RemoveGameObject(SPELL_DUEL_FLAG, true);
EnterEvadeMode();
return; // must return after enterevademode
}
} }
DoMeleeAttackIfReady(); SpellAI::UpdateAI(diff);
} }
void DamageTaken(Unit *done_by, uint32 & damage) void DamageTaken(Unit *done_by, uint32 & damage)
{ {
if(done_by->GetTypeId() == TYPEID_PLAYER && damage > m_creature->GetHealth()) if(done_by->GetTypeId() == TYPEID_PLAYER)
{
if(done_by != me->getVictim())
damage = 0; // not allow other player to help
else if(damage > me->GetHealth())
{ {
//Take 0 damage
damage = 0; damage = 0;
((Player*)done_by)->AttackStop(); done_by->AttackStop();
((Player*)done_by)->KilledMonster(29025,m_creature->GetGUID()); if(!lose)
m_creature->setFaction(2084); {
m_creature->RemoveAllAuras(); lose = true;
m_creature->CombatStop(); me->CastSpell(me, 7267, true); // beg
EnterEvadeMode(); me->getVictim()->RemoveGameObject(SPELL_DUEL_FLAG, true);
me->RestoreFaction();
}
}
} }
} }
}; };
@@ -443,7 +450,7 @@ CreatureAI* GetAI_npc_death_knight_initiate(Creature *_Creature)
bool GossipHello_npc_death_knight_initiate(Player *player, Creature *_Creature) bool GossipHello_npc_death_knight_initiate(Player *player, Creature *_Creature)
{ {
if( player->GetQuestStatus(12733) == QUEST_STATUS_INCOMPLETE ) if( player->GetQuestStatus(12733) == QUEST_STATUS_INCOMPLETE && _Creature->GetHealth() == _Creature->GetMaxHealth())
player->ADD_GOSSIP_ITEM(0, GOSSIP_DKI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); player->ADD_GOSSIP_ITEM(0, GOSSIP_DKI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
player->SEND_GOSSIP_MENU(_Creature->GetNpcTextId(),_Creature->GetGUID()); player->SEND_GOSSIP_MENU(_Creature->GetNpcTextId(),_Creature->GetGUID());
@@ -454,9 +461,9 @@ bool GossipSelect_npc_death_knight_initiate(Player *player, Creature *_Creature,
{ {
if( action == GOSSIP_ACTION_INFO_DEF ) if( action == GOSSIP_ACTION_INFO_DEF )
{ {
player->CastSpell(player, 52991, true); player->CastSpell(player, SPELL_DUEL_FLAG, true);
_Creature->setFaction(14); _Creature->setFaction(10); // make him yellow, not red (will be killed by other npc)
((npc_death_knight_initiateAI*)_Creature->AI())->AttackStart(player); _Creature->AI()->AttackStart(player);
} }
return true; return true;
} }
@@ -467,21 +474,23 @@ bool GossipSelect_npc_death_knight_initiate(Player *player, Creature *_Creature,
struct TRINITY_DLL_DECL npc_salanar_the_horsemanAI : public ScriptedAI struct TRINITY_DLL_DECL npc_salanar_the_horsemanAI : public ScriptedAI
{ {
npc_salanar_the_horsemanAI(Creature *c) : ScriptedAI(c) {Reset();} npc_salanar_the_horsemanAI(Creature *c) : ScriptedAI(c) {}
void Reset() { }
void MoveInLineOfSight(Unit *who) void MoveInLineOfSight(Unit *who)
{ {
if( (who->GetTypeId() == TYPEID_UNIT) && ((Creature*)who)->isVehicle() && m_creature->IsWithinDistInMap(who, 25.0f) ) ScriptedAI::MoveInLineOfSight(who);
if(who->GetTypeId() == TYPEID_UNIT && ((Creature*)who)->isVehicle() && me->IsWithinDistInMap(who, 10.0f))
{ {
if( Unit *charmer = who->GetCharmer() ) if( Unit *charmer = who->GetCharmer() )
{ {
if( charmer->GetTypeId() == TYPEID_PLAYER && ((Player*)charmer)->GetQuestStatus(12680) == QUEST_STATUS_INCOMPLETE ) if( charmer->GetTypeId() == TYPEID_PLAYER && ((Player*)charmer)->GetQuestStatus(12680) == QUEST_STATUS_INCOMPLETE )
{ {
((Player*)charmer)->KilledMonster(28767,m_creature->GetGUID()); ((Player*)charmer)->KilledMonster(28767, me->GetGUID());
((Player*)charmer)->ExitVehicle(); ((Player*)charmer)->ExitVehicle();
// TODO: dismiss Vehicle; Now we cant do it from script. //without this we can see npc kill the horse
//who->setDeathState(DEAD);
//((Creature*)who)->Respawn();
} }
} }
} }
+17 -1
View File
@@ -61,7 +61,7 @@ template<class T>
inline inline
const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4, const T& v5) const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4, const T& v5)
{ {
switch(rand()%4) switch(rand()%5)
{ {
default: default:
case 0: return v1; case 0: return v1;
@@ -72,6 +72,22 @@ const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4, const T& v5)
} }
} }
template<class T>
inline
const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4, const T& v5, const T& v6)
{
switch(rand()%6)
{
default:
case 0: return v1;
case 1: return v2;
case 2: return v3;
case 3: return v4;
case 4: return v5;
case 5: return v6;
}
}
class EventMap : private std::map<uint32, uint32> class EventMap : private std::map<uint32, uint32>
{ {
private: private:
+5
View File
@@ -4878,6 +4878,11 @@ void Spell::EffectScriptEffect(uint32 effIndex)
} }
break; break;
} }
// Sky Darkener Assault
case 52124:
if(unitTarget)
m_caster->CastSpell(unitTarget, 52125, false);
return;
// Death Gate // Death Gate
case 52751: case 52751:
{ {
+1
View File
@@ -3360,6 +3360,7 @@ void SpellMgr::LoadSpellCustomAttr()
case 45976: // Muru Portal Channel case 45976: // Muru Portal Channel
case 39365: // Thundering Storm case 39365: // Thundering Storm
case 41071: // Raise Dead (HACK) case 41071: // Raise Dead (HACK)
case 52124: // Sky Darkener Assault
spellInfo->MaxAffectedTargets = 1; spellInfo->MaxAffectedTargets = 1;
break; break;
case 41376: // Spite case 41376: // Spite