DB/SAI: Convert quests 10987, 10107, 10108, 9918, 9849 from core scripts to SAI

Closes #1544
Closes #3055
Closes #3056
Closes #3058
Closes #3059
This commit is contained in:
Nay
2011-10-23 11:00:56 +01:00
parent 238e8e5ea1
commit 8e2440133e
2 changed files with 161 additions and 400 deletions

View File

@@ -19,229 +19,20 @@
/* ScriptData
SDName: Nagrand
SD%Complete: 90
SDComment: Quest support: 9849, 9868, 9918, 9874, 9991, 10107, 10108, 10044, 10172, 10646, 10085, 10987. TextId's unknown for altruis_the_sufferer and greatmother_geyah (npc_text)
SDComment: Quest support: 9868, 9874, 9991, 10044, 10172, 10646, 10085. TextId's unknown for altruis_the_sufferer and greatmother_geyah (npc_text)
SDCategory: Nagrand
EndScriptData */
/* ContentData
mob_shattered_rumbler
mob_lump
npc_altruis_the_sufferer
npc_greatmother_geyah
npc_lantresor_of_the_blade
npc_maghar_captive
npc_creditmarker_visit_with_ancestors
mob_sparrowhawk
EndContentData */
#include "ScriptPCH.h"
#include "ScriptedEscortAI.h"
/*######
## mob_shattered_rumbler - this should be done with ACID
######*/
class mob_shattered_rumbler : public CreatureScript
{
public:
mob_shattered_rumbler() : CreatureScript("mob_shattered_rumbler") { }
CreatureAI* GetAI(Creature* creature) const
{
return new mob_shattered_rumblerAI (creature);
}
struct mob_shattered_rumblerAI : public ScriptedAI
{
bool Spawn;
mob_shattered_rumblerAI(Creature* c) : ScriptedAI(c) {}
void Reset()
{
Spawn = false;
}
void EnterCombat(Unit* /*who*/) {}
void SpellHit(Unit* Hitter, const SpellInfo* Spellkind)
{
if (Spellkind->Id == 32001 && !Spawn)
{
float x = me->GetPositionX();
float y = me->GetPositionY();
float z = me->GetPositionZ();
Hitter->SummonCreature(18181, x+(0.7f * (rand()%30)), y+(rand()%5), z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000);
Hitter->SummonCreature(18181, x+(rand()%5), y-(rand()%5), z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000);
Hitter->SummonCreature(18181, x-(rand()%5), y+(0.5f *(rand()%60)), z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000);
me->setDeathState(CORPSE);
Spawn = true;
}
return;
}
};
};
/*######
## mob_lump
######*/
#define SPELL_VISUAL_SLEEP 16093
#define SPELL_SPEAR_THROW 32248
#define LUMP_SAY0 -1000190
#define LUMP_SAY1 -1000191
#define LUMP_DEFEAT -1000192
#define GOSSIP_HL "I need answers, ogre!"
#define GOSSIP_SL1 "Why are Boulderfist out this far? You know that this is Kurenai territory."
#define GOSSIP_SL2 "And you think you can just eat anything you want? You're obviously trying to eat the Broken of Telaar."
#define GOSSIP_SL3 "This means war, Lump! War I say!"
class mob_lump : public CreatureScript
{
public:
mob_lump() : CreatureScript("mob_lump") { }
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction)
{
player->PlayerTalkClass->ClearMenus();
switch (uiAction)
{
case GOSSIP_ACTION_INFO_DEF:
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SL1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
player->SEND_GOSSIP_MENU(9353, creature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+1:
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SL2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
player->SEND_GOSSIP_MENU(9354, creature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+2:
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SL3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3);
player->SEND_GOSSIP_MENU(9355, creature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+3:
player->SEND_GOSSIP_MENU(9356, creature->GetGUID());
player->TalkedToCreature(18354, creature->GetGUID());
break;
}
return true;
}
bool OnGossipHello(Player* player, Creature* creature)
{
if (player->GetQuestStatus(9918) == QUEST_STATUS_INCOMPLETE)
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
player->SEND_GOSSIP_MENU(9352, creature->GetGUID());
return true;
}
CreatureAI* GetAI(Creature* creature) const
{
return new mob_lumpAI(creature);
}
struct mob_lumpAI : public ScriptedAI
{
mob_lumpAI(Creature* c) : ScriptedAI(c)
{
bReset = false;
}
uint32 Reset_Timer;
uint32 Spear_Throw_Timer;
bool bReset;
void Reset()
{
Reset_Timer = 60000;
Spear_Throw_Timer = 2000;
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
}
void AttackedBy(Unit* pAttacker)
{
if (me->getVictim())
return;
if (me->IsFriendlyTo(pAttacker))
return;
AttackStart(pAttacker);
}
void DamageTaken(Unit* done_by, uint32 & damage)
{
if (done_by->GetTypeId() == TYPEID_PLAYER && me->HealthBelowPctDamaged(30, damage))
{
if (!bReset && CAST_PLR(done_by)->GetQuestStatus(9918) == QUEST_STATUS_INCOMPLETE)
{
//Take 0 damage
damage = 0;
CAST_PLR(done_by)->AttackStop();
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->RemoveAllAuras();
me->DeleteThreatList();
me->CombatStop(true);
me->setFaction(1080); //friendly
me->SetStandState(UNIT_STAND_STATE_SIT);
DoScriptText(LUMP_DEFEAT, me);
bReset = true;
}
}
}
void EnterCombat(Unit* /*who*/)
{
if (me->HasAura(SPELL_VISUAL_SLEEP))
me->RemoveAura(SPELL_VISUAL_SLEEP);
if (!me->IsStandState())
me->SetStandState(UNIT_STAND_STATE_STAND);
DoScriptText(RAND(LUMP_SAY0, LUMP_SAY1), me);
}
void UpdateAI(const uint32 diff)
{
//check if we waiting for a reset
if (bReset)
{
if (Reset_Timer <= diff)
{
EnterEvadeMode();
bReset = false;
me->setFaction(1711); //hostile
return;
}
else Reset_Timer -= diff;
}
//Return since we have no target
if (!UpdateVictim())
return;
//Spear_Throw_Timer
if (Spear_Throw_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_SPEAR_THROW);
Spear_Throw_Timer = 20000;
} else Spear_Throw_Timer -= diff;
DoMeleeAttackIfReady();
}
};
};
/*######
## npc_altruis_the_sufferer
######*/
@@ -453,83 +244,6 @@ public:
};
/*######
## npc_lantresor_of_the_blade
######*/
#define GOSSIP_HLB "I have killed many of your ogres, Lantresor. I have no fear."
#define GOSSIP_SLB1 "Should I know? You look like an orc to me."
#define GOSSIP_SLB2 "And the other half?"
#define GOSSIP_SLB3 "I have heard of your kind, but I never thought to see the day when I would meet a half-breed."
#define GOSSIP_SLB4 "My apologies. I did not mean to offend. I am here on behalf of my people."
#define GOSSIP_SLB5 "My people ask that you pull back your Boulderfist ogres and cease all attacks on our territories. In return, we will also pull back our forces."
#define GOSSIP_SLB6 "We will fight you until the end, then, Lantresor. We will not stand idly by as you pillage our towns and kill our people."
#define GOSSIP_SLB7 "What do I need to do?"
class npc_lantresor_of_the_blade : public CreatureScript
{
public:
npc_lantresor_of_the_blade() : CreatureScript("npc_lantresor_of_the_blade") { }
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction)
{
player->PlayerTalkClass->ClearMenus();
switch (uiAction)
{
case GOSSIP_ACTION_INFO_DEF:
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SLB1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
player->SEND_GOSSIP_MENU(9362, creature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+1:
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SLB2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
player->SEND_GOSSIP_MENU(9363, creature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+2:
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SLB3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3);
player->SEND_GOSSIP_MENU(9364, creature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+3:
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SLB4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4);
player->SEND_GOSSIP_MENU(9365, creature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+4:
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SLB5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5);
player->SEND_GOSSIP_MENU(9366, creature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+5:
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SLB6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6);
player->SEND_GOSSIP_MENU(9367, creature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+6:
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SLB7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7);
player->SEND_GOSSIP_MENU(9368, creature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+7:
player->SEND_GOSSIP_MENU(9369, creature->GetGUID());
if (player->GetQuestStatus(10107) == QUEST_STATUS_INCOMPLETE)
player->AreaExploredOrEventHappens(10107);
if (player->GetQuestStatus(10108) == QUEST_STATUS_INCOMPLETE)
player->AreaExploredOrEventHappens(10108);
break;
}
return true;
}
bool OnGossipHello(Player* player, Creature* creature)
{
if (creature->isQuestGiver())
player->PrepareQuestMenu(creature->GetGUID());
if (player->GetQuestStatus(10107) == QUEST_STATUS_INCOMPLETE || player->GetQuestStatus(10108) == QUEST_STATUS_INCOMPLETE)
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HLB, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
player->SEND_GOSSIP_MENU(9361, creature->GetGUID());
return true;
}
};
/*#####
## npc_maghar_captive
#####*/
@@ -747,113 +461,9 @@ public:
};
/*######
## mob_sparrowhawk
## go_corkis_prison and npc_corki
######*/
#define SPELL_SPARROWHAWK_NET 39810
#define SPELL_ITEM_CAPTIVE_SPARROWHAWK 39812
class mob_sparrowhawk : public CreatureScript
{
public:
mob_sparrowhawk() : CreatureScript("mob_sparrowhawk") { }
CreatureAI* GetAI(Creature* creature) const
{
return new mob_sparrowhawkAI (creature);
}
struct mob_sparrowhawkAI : public ScriptedAI
{
mob_sparrowhawkAI(Creature* c) : ScriptedAI(c) {}
uint32 Check_Timer;
uint64 PlayerGUID;
bool fleeing;
void Reset()
{
me->RemoveAurasDueToSpell(SPELL_SPARROWHAWK_NET);
Check_Timer = 1000;
PlayerGUID = 0;
fleeing = false;
}
void AttackStart(Unit* who)
{
if (PlayerGUID)
return;
ScriptedAI::AttackStart(who);
}
void EnterCombat(Unit* /*who*/) {}
void MoveInLineOfSight(Unit* who)
{
if (!who || PlayerGUID)
return;
if (!PlayerGUID && who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 30) && CAST_PLR(who)->GetQuestStatus(10987) == QUEST_STATUS_INCOMPLETE)
{
PlayerGUID = who->GetGUID();
return;
}
ScriptedAI::MoveInLineOfSight(who);
}
void UpdateAI(const uint32 diff)
{
if (Check_Timer <= diff)
{
if (PlayerGUID)
{
if (fleeing && me->GetMotionMaster()->GetCurrentMovementGeneratorType() != FLEEING_MOTION_TYPE)
fleeing = false;
Player* player = Unit::GetPlayer(*me, PlayerGUID);
if (player && me->IsWithinDistInMap(player, 30))
{
if (!fleeing)
{
me->DeleteThreatList();
me->GetMotionMaster()->MoveFleeing(player);
fleeing = true;
}
}
else if (fleeing)
{
me->GetMotionMaster()->MovementExpired(false);
PlayerGUID = 0;
fleeing = false;
}
}
Check_Timer = 1000;
} else Check_Timer -= diff;
if (PlayerGUID)
return;
ScriptedAI::UpdateAI(diff);
}
void SpellHit(Unit* caster, const SpellInfo* spell)
{
if (caster->GetTypeId() == TYPEID_PLAYER)
{
if (spell->Id == SPELL_SPARROWHAWK_NET && CAST_PLR(caster)->GetQuestStatus(10987) == QUEST_STATUS_INCOMPLETE)
{
DoCast(caster, SPELL_ITEM_CAPTIVE_SPARROWHAWK, true);
me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
}
}
return;
}
};
};
enum CorkiData
{
// first quest
@@ -916,10 +526,6 @@ public:
}
};
/*######
## npc_corki
######*/
class npc_corki : public CreatureScript
{
public:
@@ -1200,14 +806,10 @@ public:
void AddSC_nagrand()
{
new mob_shattered_rumbler();
new mob_lump();
new npc_altruis_the_sufferer();
new npc_greatmother_geyah();
new npc_lantresor_of_the_blade();
new npc_maghar_captive();
new npc_creditmarker_visit_with_ancestors();
new mob_sparrowhawk();
new npc_corki();
new go_corkis_prison();
new npc_kurenai_captive();