Code:
/*
* EclipseWoW
* Copyright (C) 2007-2008
*/
#include "StdAfx.h"
#include "Setup.h"
struct Coords
{
float x;
float y;
float z;
float o;
};
/*********************************************************************************/
/* TheMafia.cpp Script */
/*********************************************************************************/
/*
/////Mobs////
Miner
Slave
Assassins
Taskmasters
Jewel Protector
Jewel Melter
Spell Weaver
/////Bosses//////
Osbourne
Slave Taskmaster
Slave Leader
The Don
****************************************************************************************************************************************
* The Mafia Instance - Mobs *
****************************************************************************************************************************************/
// Miners + Slaves
#define CN_MAFIAMINER 100001
#define CN_MAFIASLAVE1 100007
#define CN_MAFIASLAVE2 100008
#define CN_ASSASSINLEAD 100013
#define CN_GUTGORE 800011
#define PIERCE_ARMOR 12097
#define HEROIC_STRIKE 1611
//Mafia Spellweaver
#define CN_SPELLWEAVER 100015
#define FIRECAST 38692
#define FIREAOE 27086
#define FROSTCAST 38697
#define FROSTAOE 27384
#define SHADOWCAST 27209
#define SHADOWAOE 30414
#define FIRESHIELD 30663
#define FROSTSHIELD 27124
#define SHADOWSHIELD 27260
#define FIRESUMMON 40133
#define FROSTSUMMON 45067
#define SHADOWSUMMON 34237
//Assassin
#define CN_ASSASSIN 100003
#define EXPOSE_ARMOR 26866
#define SINISTER_STRIKE 26862
//Taskmaster
#define CN_TASKMASTER 100000
#define NET 38338
#define AIMED_SHOT 27065
#define GOUGE 38764
//Melter
#define CN_MELTER 100009
#define FIRE_BLAST 27079
#define INCINERATE 32231
//Protector
#define CN_PROTECTOR 100020
#define WINDFURY 25584
#define STORMSTRIKE 32175
#define PHASE3ID 19617
//Phase 0Spells
#define STRIKE 26862
#define BLOODTHIRST 30335
#define RIP 32022
//Phase 1 Spells
//Phase 0 +
#define STUN 34510
//Phase 2 Spells
#define MINIONS 5200
#define SHADOWMEND 33249
#define FISSURE 27810
#define NOVA 39005
#define SHADOWBOLT 40070
//Phase 3 Spells
#define RAGE 7484
#define SHADOWFORM 34205
#define SCREECH 16576
#define CN_THEDON 100010
#define CN_OSBOURNE 100012
#define CN_SLAVELEAD 100014
#define CN_SLAVETASK 100006
//Osbourne
//STRIKE from The Don
#define HERO 30324
//BLOODTHIRST from The Don
#define EVICERATE 26865
#define CRACK 35161
#define KIDNEY_SHOT 8643
class MafiaProtectorAI : CreatureAIScript
{
public:
ADD_CREATURE_FACTORY_FUNCTION(MafiaProtectorAI);
MafiaProtectorAI(Creature* pCreature) : CreatureAIScript(pCreature)
{
m_strike = m_fury = true;
infostrike = dbcSpell.LookupEntry(STORMSTRIKE);
infofury = dbcSpell.LookupEntry(WINDFURY);
}
void OnCombatStart(Unit* mTarget)
{
RegisterAIUpdateEvent(_unit->GetUInt32Value(UNIT_FIELD_BASEATTACKTIME));
_unit->CastSpell(mTarget, infofury, false);
m_fury = false;
int randAnnounce;
randAnnounce=rand()%4;
switch (randAnnounce)
{
case 0://Edit this message
_unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "Intruder!!!!!!!!!!!!!");
break;
case 1://Edit this message
_unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "They're After the Jewels Stop them");
break;
case 2://Edit this Message
break;
case 3://Edit this message
break;
}
}
void OnCombatStop(Unit *mTarget)
{
_unit->GetAIInterface()->setCurrentAgent(AGENT_NULL);
_unit->GetAIInterface()->SetAIState(STATE_IDLE);
RemoveAIUpdateEvent();
}
void OnDied(Unit * mKiller)
{
RemoveAIUpdateEvent();
}
void AIUpdate()
{
uint32 val = RandomUInt(1000);
SpellCast(val);
}
void SpellCast(uint32 val)
{
if(_unit->GetCurrentSpell() == NULL && _unit->GetAIInterface()->GetNextTarget())//_unit->getAttackTarget())
{
if(m_fury)
{
_unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infofury, false);
m_fury = false;
return;
}
if(m_strike)
{
_unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infostrike, false);
m_strike = false;
return;
}
if(val >= 100 && val <= 225)
{
_unit->setAttackTimer(2000, false);
m_fury = true;
}
if(val >= 790 && val <= 900)
{
_unit->setAttackTimer(4000, false);
m_strike = true;
}
}
}
protected:
bool m_strike;
bool m_fury;
SpellEntry *infofury, *infostrike;
};
class MafiaMelterAI : CreatureAIScript
{
public:
ADD_CREATURE_FACTORY_FUNCTION(MafiaMelterAI);
MafiaMelterAI(Creature* pCreature) : CreatureAIScript(pCreature)
{
m_blast = m_incin = true;
infoblast = dbcSpell.LookupEntry(FIRE_BLAST);
infoincin = dbcSpell.LookupEntry(INCINERATE);
}
void OnCombatStart(Unit* mTarget)
{
RegisterAIUpdateEvent(_unit->GetUInt32Value(UNIT_FIELD_BASEATTACKTIME));
_unit->CastSpell(mTarget, infoincin, false);
m_incin = false;
int randAnnounce;
randAnnounce=rand()%4;
switch (randAnnounce)
{
case 0://Edit this message
_unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "Intruder!!!!!!!!!!!!!");
break;
case 1://Edit this message
_unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "They're After the Jewels Stop them");
break;
case 2://Edit this Message
break;
case 3://Edit this message
break;
}
}
void OnCombatStop(Unit *mTarget)
{
_unit->GetAIInterface()->setCurrentAgent(AGENT_NULL);
_unit->GetAIInterface()->SetAIState(STATE_IDLE);
RemoveAIUpdateEvent();
}
void OnDied(Unit * mKiller)
{
RemoveAIUpdateEvent();
}
void AIUpdate()
{
uint32 val = RandomUInt(1000);
SpellCast(val);
}
void SpellCast(uint32 val)
{
if(_unit->GetCurrentSpell() == NULL && _unit->GetAIInterface()->GetNextTarget())//_unit->getAttackTarget())
{
if(m_incin)
{
_unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infoincin, false);
m_incin = false;
return;
}
if(m_blast)
{
_unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infoblast, false);
m_blast = false;
return;
}
if(val >= 100 && val <= 225)
{
_unit->setAttackTimer(2000, false);
m_incin = true;
}
if(val >= 790 && val <= 900)
{
_unit->setAttackTimer(4000, false);
m_blast = true;
}
}
}
protected:
bool m_blast;
bool m_incin;
SpellEntry *infoincin, *infoblast;
};
class MafiaTaskmasterAI : CreatureAIScript
{
public:
ADD_CREATURE_FACTORY_FUNCTION(MafiaTaskmasterAI);
MafiaTaskmasterAI(Creature* pCreature) : CreatureAIScript(pCreature)
{
m_net = m_gouge = m_shot = true;
infonet = dbcSpell.LookupEntry(NET);
infogouge = dbcSpell.LookupEntry(GOUGE);
infoshot = dbcSpell.LookupEntry(AIMED_SHOT);
}
void OnCombatStart(Unit* mTarget)
{
RegisterAIUpdateEvent(_unit->GetUInt32Value(UNIT_FIELD_BASEATTACKTIME));
_unit->CastSpell(mTarget, infoshot, false);
m_shot = false;
int randAnnounce;
randAnnounce=rand()%4;
switch (randAnnounce)
{
case 0:///Edit this message
_unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "Intruder!!!!!!!!!!!!!");
break;
case 1://Edit this message
_unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "They're After the Jewels Stop them");
break;
case 2://Edit this Message
break;
case 3://Edit this message
break;
}
}
void OnCombatStop(Unit *mTarget)
{
_unit->GetAIInterface()->setCurrentAgent(AGENT_NULL);
_unit->GetAIInterface()->SetAIState(STATE_IDLE);
RemoveAIUpdateEvent();
}
void OnDied(Unit * mKiller)
{
RemoveAIUpdateEvent();
}
void AIUpdate()
{
uint32 val = RandomUInt(1000);
SpellCast(val);
}
void SpellCast(uint32 val)
{
if(_unit->GetCurrentSpell() == NULL && _unit->GetAIInterface()->GetNextTarget())//_unit->getAttackTarget())
{
if(m_gouge)
{
_unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infogouge, false);
m_gouge = false;
return;
}
if(m_net)
{
_unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infonet, false);
m_net = false;
_unit->GetAIInterface()->setCurrentAgent(AGENT_RANGED);
return;
}
if(m_shot)
{
_unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infoshot, false);
m_shot = false;
return;
}
if(val >= 100 && val <= 225)
{
_unit->setAttackTimer(2000, false);
m_gouge = true;
}
if(val >= 790 && val <= 900)
{
_unit->setAttackTimer(4000, false);
m_net = true;
}
if(val >= 500 && val <= 700)
{
_unit->setAttackTimer(3000, false);
m_shot = true;
}
}
}
protected:
bool m_net;
bool m_gouge;
bool m_shot;
SpellEntry *infogouge, *infonet, *infoshot;
};
class MafiaMinerAI : CreatureAIScript
{
public:
ADD_CREATURE_FACTORY_FUNCTION(MafiaMinerAI);
MafiaMinerAI(Creature* pCreature) : CreatureAIScript(pCreature)
{
m_pierce = m_hero = true;
infopierce = dbcSpell.LookupEntry(PIERCE_ARMOR);
infohero = dbcSpell.LookupEntry(HEROIC_STRIKE);
}
void OnCombatStart(Unit* mTarget)
{
RegisterAIUpdateEvent(_unit->GetUInt32Value(UNIT_FIELD_BASEATTACKTIME));
_unit->CastSpell(mTarget, infohero, false);
m_hero = false;
int randAnnounce;
randAnnounce=rand()%4;
switch (randAnnounce)
{
case 0:///Edit this message
_unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "Intruder!!!!!!!!!!!!!");
break;
case 1://Edit this message
_unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "They're After the Jewels Stop them");
break;
case 2://Edit this Message
break;
case 3://Edit this message
break;
}
}
void OnCombatStop(Unit *mTarget)
{
_unit->GetAIInterface()->setCurrentAgent(AGENT_NULL);
_unit->GetAIInterface()->SetAIState(STATE_IDLE);
RemoveAIUpdateEvent();
}
void OnDied(Unit * mKiller)
{
RemoveAIUpdateEvent();
}
void AIUpdate()
{
uint32 val = RandomUInt(1000);
SpellCast(val);
}
void SpellCast(uint32 val)
{
if(_unit->GetCurrentSpell() == NULL && _unit->GetAIInterface()->GetNextTarget())//_unit->getAttackTarget())
{
if(m_hero)
{
_unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infohero, false);
m_hero = false;
return;
}
if(m_pierce)
{
_unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infopierce, false);
m_pierce = false;
return;
}
if(val >= 100 && val <= 225)
{
_unit->setAttackTimer(2000, false);
m_hero = true;
}
if(val >= 790 && val <= 900)
{
_unit->setAttackTimer(4000, false);
m_pierce = true;
}
}
}
protected:
bool m_pierce;
bool m_hero;
SpellEntry *infohero, *infopierce;
};
class MafiaAssassinAI : CreatureAIScript
{
public:
ADD_CREATURE_FACTORY_FUNCTION(MafiaAssassinAI);
MafiaAssassinAI(Creature* pCreature) : CreatureAIScript(pCreature)
{
m_strike = m_armor = true;
infostrike = dbcSpell.LookupEntry(SINISTER_STRIKE);
infoarmor = dbcSpell.LookupEntry(EXPOSE_ARMOR);
}
void OnCombatStart(Unit* mTarget)
{
RegisterAIUpdateEvent(_unit->GetUInt32Value(UNIT_FIELD_BASEATTACKTIME));
_unit->CastSpell(mTarget, infostrike, false);
m_strike = false;
int randAnnounce;
randAnnounce=rand()%4;
switch (randAnnounce)
{
case 0:///Edit this message
_unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "You'll die at my hands");
break;
case 1://Edit this message
break;
case 2://Edit this Message
break;
case 3://Edit this message
break;
}
}
void OnCombatStop(Unit *mTarget)
{
_unit->GetAIInterface()->setCurrentAgent(AGENT_NULL);
_unit->GetAIInterface()->SetAIState(STATE_IDLE);
RemoveAIUpdateEvent();
}
void OnDied(Unit * mKiller)
{
RemoveAIUpdateEvent();
}
void AIUpdate()
{
uint32 val = RandomUInt(1000);
SpellCast(val);
}
void SpellCast(uint32 val)
{
if(_unit->GetCurrentSpell() == NULL && _unit->GetAIInterface()->GetNextTarget())//_unit->getAttackTarget())
{
if(m_strike)
{
_unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infostrike, false);
m_strike = false;
return;
}
if(m_armor)
{
_unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infoarmor, false);
m_armor = false;
return;
}
if(val >= 100 && val <= 400)
{
_unit->setAttackTimer(2000, false);
m_strike = true;
}
if(val >= 790 && val <= 900)
{
_unit->setAttackTimer(4000, false);
m_armor = true;
}
}
}
protected:
bool m_strike;
bool m_armor;
SpellEntry *infostrike, *infoarmor;
};
class MafiaSpellWeaverAI : CreatureAIScript
{
public:
ADD_CREATURE_FACTORY_FUNCTION(MafiaSpellWeaverAI);
MafiaSpellWeaverAI(Creature* pCreature) : CreatureAIScript(pCreature)
{
m_fire = m_frost = m_shadow = false;
m_cast = m_aoe = m_shield = m_summon = true;
ChooseSpec();
}
void ChooseSpec()
{
int RandType;
RandType=rand()%3;
switch (RandType)
{
case 0:
m_fire = true;
infocast = dbcSpell.LookupEntry(FIRECAST);
infoaoe = dbcSpell.LookupEntry(FIREAOE);
infoshield = dbcSpell.LookupEntry(FIRESHIELD);
infosummon = dbcSpell.LookupEntry(FIRESUMMON);
break;
case 1:
m_frost = true;
infocast = dbcSpell.LookupEntry(FROSTCAST);
infoaoe = dbcSpell.LookupEntry(FROSTAOE);
infoshield = dbcSpell.LookupEntry(FROSTSHIELD);
infosummon = dbcSpell.LookupEntry(FROSTSUMMON);
break;
case 2:
m_shadow = true;
infocast = dbcSpell.LookupEntry(SHADOWCAST);
infoaoe = dbcSpell.LookupEntry(SHADOWAOE);
infoshield = dbcSpell.LookupEntry(SHADOWSHIELD);
infosummon = dbcSpell.LookupEntry(SHADOWSUMMON);
break;
}
}
void OnCombatStart(Unit* mTarget)
{
RegisterAIUpdateEvent(_unit->GetUInt32Value(UNIT_FIELD_BASEATTACKTIME));
_unit->CastSpell(_unit, infoshield, false);
m_shield = false;
int RandType;
RandType=rand()%3;
switch (RandType)
{
case 0:
_unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "Stop them they threaten our plans!!");
break;
}
}
void OnCombatStop(Unit *mTarget)
{
_unit->GetAIInterface()->setCurrentAgent(AGENT_NULL);
_unit->GetAIInterface()->SetAIState(STATE_IDLE);
RemoveAIUpdateEvent();
}
void OnDied(Unit * mKiller)
{
RemoveAIUpdateEvent();
}
void AIUpdate()
{
uint32 val = RandomUInt(1000);
SpellCast(val);
}
void SpellCast(uint32 val)
{
if(_unit->GetCurrentSpell() == NULL && _unit->GetAIInterface()->GetNextTarget())//_unit->getAttackTarget())
{
if(m_cast)
{
_unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infocast, false);
m_cast = false;
return;
}
if(m_aoe)
{
_unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infoaoe, false);
m_aoe = false;
return;
}
if(m_summon)
{
_unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infosummon, false);
m_summon = false;
return;
}
if(val >= 1 && val <= 499)
{
_unit->setAttackTimer(2000, false);
m_cast = true;
}
if(val >= 500 && val <= 700)
{
_unit->setAttackTimer(3000, false);
m_summon = true;
}
if(val >= 701 && val <= 1000)
{
_unit->setAttackTimer(4000, false);
m_aoe = true;
}
}
}
protected:
bool m_cast;
bool m_aoe;
bool m_fire;
bool m_frost;
bool m_shadow;
bool m_summon;
bool m_shield;
SpellEntry *infocast, *infoaoe, *infoshield, *infosummon;
};
/***************************************************************************************************************************************
* The Mafia Instance - Bosses *
****************************************************************************************************************************************/
static Coords SLCoords[] =
{
{ },
{ -309.145782f, -505.383606f, 54.399933f, 5.765608f },
{ -304.910339f, -516.937378f, 53.106853f, 0.082467f },
{ -300.558716f, -514.512634f, 51.290432f, 1.335963f },
{ -297.943207f, -507.169464, 49.396046, 1.232290f }
};
static Coords DonCoords[] =
{
{ },
{-65.888, -786.026, 39.764, 6.117},
{-43.518, -796.026, 39.346, 5.468},
{-48.518, -796.026, 39.346, 5.467},
{-58.215, -815.607, 41.491, 4.164},
{-59.614, -817.901, 41.610, 4.164},
{-59.614, -817.901, 41.610, 4.164},
{-59.614, -817.901, 41.610, 4.164},
{-59.614, -817.901, 41.610, 4.164},
{-59.614, -817.901, 41.610, 4.164},
{-59.614, -817.901, 41.610, 4.164},
{-59.614, -817.901, 41.610, 4.164},
{-59.614, -817.901, 41.610, 4.164}
};
class JamesGutgoreAI : CreatureAIScript
{
public:
ADD_CREATURE_FACTORY_FUNCTION(JamesGutgoreAI);
JamesGutgoreAI(Creature* pCreature) : CreatureAIScript(pCreature)
{
_unit->GetAIInterface()->disable_combat = true;
m_rip = m_strike = m_shot = m_evis = true;
inforip = dbcSpell.LookupEntry(RIP);
infostrike = dbcSpell.LookupEntry(STRIKE);
infoshot = dbcSpell.LookupEntry(KIDNEY_SHOT);
infoevis = dbcSpell.LookupEntry(EVICERATE);
}
void OnCombatStart(Unit* mTarget)
{
RegisterAIUpdateEvent(_unit->GetUInt32Value(UNIT_FIELD_BASEATTACKTIME));
_unit->CastSpell(mTarget, infoshot, false);
m_shot = false;
}
void OnReachWP(uint32 iWaypointId, bool bForwards)
{
_unit->GetAIInterface()->setMoveType(MOVEMENTTYPE_WANTEDWP);
_unit->GetAIInterface()->setWaypointToMove(iWaypointId+1);
Unit* pCreature = _unit->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(_unit->GetPositionX(), _unit->GetPositionY(), _unit->GetPositionZ(), CN_THEDON);
if(_unit->GetAIInterface()->getCurrentWaypoint() == 5)
{
_unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "You!!");
_unit->Emote(EMOTE_STATE_POINT);
}
if(_unit->GetAIInterface()->getCurrentWaypoint() == 6)
{
_unit->Emote(EMOTE_STATE_NONE);
pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "I`ve been expecting you.");
}
if(_unit->GetAIInterface()->getCurrentWaypoint() == 7)
{
_unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "What? How?.....How did you know we would come?");
}
if(_unit->GetAIInterface()->getCurrentWaypoint() == 8)
{
pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "I could sense your disloyalty James");
}
if(_unit->GetAIInterface()->getCurrentWaypoint() == 9)
{
pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Why dont you just go ahead and get to what you were doing.");
}
if(_unit->GetAIInterface()->getCurrentWaypoint() == 10)
{
_unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "I feel The Don that you have just been using our alliance for your own personal gain");
}
if(_unit->GetAIInterface()->getCurrentWaypoint() == 11)
{
pCreature->SetStandState(STANDSTATE_STAND);
pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Your coming in here and telling me that i'm the one that thats disloyal.");
}
if(_unit->GetAIInterface()->getCurrentWaypoint() == 12)
{
_unit->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, 1770);
pCreature->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, 1771);
pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "I must put an end to your foolishness James");
pCreature->GetAIInterface()->disable_combat = false;
_unit->GetAIInterface()->disable_combat = false;
}
}
void OnCombatStop(Unit *mTarget)
{
_unit->GetAIInterface()->setCurrentAgent(AGENT_NULL);
_unit->GetAIInterface()->SetAIState(STATE_IDLE);
RemoveAIUpdateEvent();
}
void OnDied(Unit * mKiller)
{
RemoveAIUpdateEvent();
}
void AIUpdate()
{
uint32 val = RandomUInt(1000);
SpellCast(val);
}
void SpellCast(uint32 val)
{
if(_unit->GetCurrentSpell() == NULL && _unit->GetAIInterface()->GetNextTarget())
{
if(m_strike)
{
_unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infostrike, false);
m_strike = false;
return;
}
if(m_rip)
{
_unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), inforip, false);
m_rip = false;
_unit->GetAIInterface()->setCurrentAgent(AGENT_RANGED);
return;
}
if(m_shot)
{
_unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infoshot, false);
m_shot = false;
return;
}
if(m_evis)
{
_unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infoevis, false);
m_evis = false;
return;
}
if(val >= 1 && val <= 225)
{
_unit->setAttackTimer(2000, false);
m_strike = true;
}
if(val >= 225 && val <= 400)
{
_unit->setAttackTimer(2000, false);
m_evis = true;
}
if(val >= 790 && val <= 900)
{
_unit->setAttackTimer(4000, false);
m_rip = true;
}
if(val >= 500 && val <= 700)
{
_unit->setAttackTimer(3000, false);
m_shot = true;
}
}
}
protected:
bool m_rip;
bool m_evis;
bool m_strike;
bool m_shot;
SpellEntry *infostrike, *inforip, *infoshot, *infoevis;
};
class SCRIPT_DECL JamesGS : public GossipScript
{
public:
void GossipHello(Object * pObject, Player* Plr, bool AutoSend);
void GossipSelectOption(Object * pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code);
void GossipEnd(Object * pObject, Player* Plr);
void Destroy()
{
delete this;
}
};
void JamesGS::GossipHello(Object * pObject, Player* Plr, bool AutoSend)
{
GossipMenu *Menu;
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 50000, Plr);
Menu->AddItem(0, "Yes i will help you defeat the don", 1);;
if(AutoSend)
Menu->SendTo(Plr);
}
inline WayPoint* CreateWaypoint(int id, uint32 waittime, uint32 flags)
{
Player* Plr;
Creature* pCreature = Plr->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(Plr->GetPositionX(), Plr->GetPositionY(), Plr->GetPositionZ(), 800011);
WayPoint * wp = pCreature->CreateWaypointStruct();
wp->id = id;
wp->x = DonCoords[id].x;
wp->y = DonCoords[id].y;
wp->z = DonCoords[id].z;
wp->o = DonCoords[id].o;
wp->waittime = waittime;
wp->flags = flags;
wp->forwardemoteoneshot = 0;
wp->forwardemoteid = 0;
wp->backwardemoteoneshot = 0;
wp->backwardemoteid = 0;
wp->forwardskinid = 0;
wp->backwardskinid = 0;
return wp;
}
void JamesGS::GossipSelectOption(Object * pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code)
{
Creature * pCreature = (pObject->GetTypeId()==TYPEID_UNIT)?((Creature*)pObject):NULL;
if(pCreature==NULL)
return;
GossipMenu * Menu;
switch(IntId)
{
case 0:
GossipHello(pObject, Plr, true);
break;
case 1:
{
for (int i = 1; i < 5; i++)
{
pCreature->GetAIInterface()->addWayPoint(CreateWaypoint(i, 0, 256));
}
pCreature->GetAIInterface()->addWayPoint(CreateWaypoint(6, 2000, 0));
pCreature->GetAIInterface()->addWayPoint(CreateWaypoint(7, 3000, 0));
pCreature->GetAIInterface()->addWayPoint(CreateWaypoint(8, 2500, 0));
pCreature->GetAIInterface()->addWayPoint(CreateWaypoint(9, 4000, 0));
pCreature->GetAIInterface()->addWayPoint(CreateWaypoint(10, 3000, 0));
pCreature->GetAIInterface()->addWayPoint(CreateWaypoint(11, 3000, 0));
pCreature->GetAIInterface()->addWayPoint(CreateWaypoint(12, 4500, 0));
pCreature->MoveToWaypoint(1);
}
}
}
void JamesGS::GossipEnd(Object * pObject, Player* Plr)
{
GossipScript::GossipEnd(pObject, Plr);
}
class SlaveLeadAI : CreatureAIScript
{
public:
ADD_CREATURE_FACTORY_FUNCTION(SlaveLeadAI);
SlaveLeadAI(Creature* pCreature) : CreatureAIScript(pCreature)
{
_unit->GetAIInterface()->disable_combat = true;
m_rip = m_strike = m_shot = m_evis = true;
inforip = dbcSpell.LookupEntry(RIP);
infostrike = dbcSpell.LookupEntry(STRIKE);
infoshot = dbcSpell.LookupEntry(KIDNEY_SHOT);
infoevis = dbcSpell.LookupEntry(EVICERATE);
}
void OnCombatStart(Unit* mTarget)
{
RegisterAIUpdateEvent(_unit->GetUInt32Value(UNIT_FIELD_BASEATTACKTIME));
_unit->CastSpell(mTarget, infoshot, false);
m_shot = false;
}
void OnReachWP(uint32 iWaypointId, bool bForwards)
{
_unit->GetAIInterface()->setMoveType(MOVEMENTTYPE_WANTEDWP);
_unit->GetAIInterface()->setWaypointToMove(iWaypointId+1);
if(_unit->GetAIInterface()->getCurrentWaypoint() == 2)
{
_unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "I say a life for a life yours for my taskmaster's");
}
if(_unit->GetAIInterface()->getCurrentWaypoint() == 5)
{
_unit->GetAIInterface()->disable_combat = false;
_unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Prepare to Die.");
}
}
void OnCombatStop(Unit *mTarget)
{
_unit->GetAIInterface()->setCurrentAgent(AGENT_NULL);
_unit->GetAIInterface()->SetAIState(STATE_IDLE);
RemoveAIUpdateEvent();
}
void OnDied(Unit * mKiller)
{
RemoveAIUpdateEvent();
}
void AIUpdate()
{
uint32 val = RandomUInt(1000);
SpellCast(val);
}
void SpellCast(uint32 val)
{
if(_unit->GetCurrentSpell() == NULL && _unit->GetAIInterface()->GetNextTarget())//_unit->getAttackTarget())
{
if(m_strike)
{
_unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infostrike, false);
m_strike = false;
return;
}
if(m_rip)
{
_unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), inforip, false);
m_rip = false;
_unit->GetAIInterface()->setCurrentAgent(AGENT_RANGED);
return;
}
if(m_shot)
{
_unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infoshot, false);
m_shot = false;
return;
}
if(m_evis)
{
_unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infoevis, false);
m_evis = false;
return;
}
if(val >= 1 && val <= 225)
{
_unit->setAttackTimer(2000, false);
m_strike = true;
}
if(val >= 225 && val <= 400)
{
_unit->setAttackTimer(2000, false);
m_evis = true;
}
if(val >= 790 && val <= 900)
{
_unit->setAttackTimer(4000, false);
m_rip = true;
}
if(val >= 500 && val <= 700)
{
_unit->setAttackTimer(3000, false);
m_shot = true;
}
}
}
protected:
bool m_rip;
bool m_evis;
bool m_strike;
bool m_shot;
SpellEntry *infostrike, *inforip, *infoshot, *infoevis;
};
class TaskmasterAI : CreatureAIScript
{
public:
ADD_CREATURE_FACTORY_FUNCTION(TaskmasterAI);
TaskmasterAI(Creature* pCreature) : CreatureAIScript(pCreature)
{
m_net = m_hero = m_shot = m_blood = true;
infonet = dbcSpell.LookupEntry(NET);
infohero = dbcSpell.LookupEntry(HERO);
infoshot = dbcSpell.LookupEntry(AIMED_SHOT);
infoblood = dbcSpell.LookupEntry(BLOODTHIRST);
}
void OnCombatStart(Unit* mTarget)
{
RegisterAIUpdateEvent(_unit->GetUInt32Value(UNIT_FIELD_BASEATTACKTIME));
_unit->CastSpell(mTarget, infoshot, false);
_unit->SendChatMessageAlternateEntry(CN_SLAVELEAD, CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "No one shall help these slaves, Taskmaster...Don't Hold back i want them dead!!");
m_shot = false;
}
void OnCombatStop(Unit *mTarget)
{
_unit->GetAIInterface()->setCurrentAgent(AGENT_NULL);
_unit->GetAIInterface()->SetAIState(STATE_IDLE);
RemoveAIUpdateEvent();
}
inline WayPoint* CreateWaypoint(int id, uint32 waittime, uint32 flags)
{
WayPoint * wp = _unit->CreateWaypointStruct();
wp->id = id;
wp->x = SLCoords[id].x;
wp->y = SLCoords[id].y;
wp->z = SLCoords[id].z;
wp->o = SLCoords[id].o;
wp->waittime = waittime;
wp->flags = flags;
wp->forwardemoteoneshot = 0;
wp->forwardemoteid = 0;
wp->backwardemoteoneshot = 0;
wp->backwardemoteid = 0;
wp->forwardskinid = 0;
wp->backwardskinid = 0;
return wp;
}
void OnDied(Unit * mKiller)
{
Unit* pCreature = _unit->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(-309.345f, -508.485f, 57.3769f, CN_SLAVELEAD);
if(pCreature == NULL)
return;
for (int i = 1; i < 5; i++)
{
pCreature->GetAIInterface()->addWayPoint(CreateWaypoint(i, 0, 256));
}
pCreature->GetAIInterface()->setWaypointToMove(1);
RemoveAIUpdateEvent();
}
void AIUpdate()
{
uint32 val = RandomUInt(1000);
SpellCast(val);
}
void SpellCast(uint32 val)
{
if(_unit->GetCurrentSpell() == NULL && _unit->GetAIInterface()->GetNextTarget())//_unit->getAttackTarget())
{
if(m_hero)
{
_unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infohero, false);
m_hero = false;
return;
}
if(m_net)
{
_unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infonet, false);
m_net = false;
_unit->GetAIInterface()->setCurrentAgent(AGENT_RANGED);
return;
}
if(m_shot)
{
_unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infoshot, false);
m_shot = false;
return;
}
if(m_blood)
{
_unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infoblood, false);
m_blood = false;
return;
}
if(val >= 1 && val <= 225)
{
_unit->setAttackTimer(2000, false);
m_hero = true;
}
if(val >= 225 && val <= 400)
{
_unit->setAttackTimer(2000, false);
m_blood = true;
}
if(val >= 790 && val <= 900)
{
_unit->setAttackTimer(4000, false);
m_net = true;
}
if(val >= 500 && val <= 700)
{
_unit->setAttackTimer(3000, false);
m_shot = true;
}
}
}
protected:
bool m_net;
bool m_blood;
bool m_hero;
bool m_shot;
SpellEntry *infohero, *infonet, *infoshot, *infoblood;
};
class AssassinLeadAI : CreatureAIScript
{
public:
ADD_CREATURE_FACTORY_FUNCTION(AssassinLeadAI);
AssassinLeadAI(Creature* pCreature) : CreatureAIScript(pCreature)
{
_unit->SetStandState(STANDSTATE_KNEEL);
m_strike = m_hero = m_evis = m_crack = m_blood = true;
infostrike = dbcSpell.LookupEntry(STRIKE);
infohero = dbcSpell.LookupEntry(HERO);
infoblood = dbcSpell.LookupEntry(BLOODTHIRST);
infocrack = dbcSpell.LookupEntry(CRACK);
infoevis = dbcSpell.LookupEntry(EVICERATE);
}
void OnCombatStart(Unit* mTarget)
{
_unit->SetStandState(STANDSTATE_STAND);
RegisterAIUpdateEvent(_unit->GetUInt32Value(UNIT_FIELD_BASEATTACKTIME));
_unit->CastSpell(mTarget, infohero, false);
m_hero = false;
_unit->SendChatMessageAlternateEntry(100003, CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "Should we alert The Don Sir Osbourne");
_unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "No, I can handle these pity wimps myself");
}
void OnCombatStop(Unit *mTarget)
{
_unit->GetAIInterface()->setCurrentAgent(AGENT_NULL);
_unit->GetAIInterface()->SetAIState(STATE_IDLE);
RemoveAIUpdateEvent();
}
void OnDamageTaken(Unit* mAttacker, float fAmount)
{
if(fAmount < 5) return;
if(_unit->GetHealthPct() == 50) {
_unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "Your really Angering me!");
_unit->SetUInt32Value(UNIT_FIELD_MINDAMAGE, 1500);
_unit->SetUInt32Value(UNIT_FIELD_MAXDAMAGE, 3000);
_unit->SetUInt32Value(UNIT_FIELD_MINOFFHANDDAMAGE, 1500);
_unit->SetUInt32Value(UNIT_FIELD_MAXOFFHANDDAMAGE, 3000);
}
return;
}
void OnDied(Unit *mKiller)
{
RemoveAIUpdateEvent();
_unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "You were stronger than i though.......");
}
void AIUpdate()
{
uint32 val = RandomUInt(1000);
SpellCast(val);
}
void SpellCast(uint32 val)
{
if(_unit->GetCurrentSpell() == NULL && _unit->GetAIInterface()->GetNextTarget())//_unit->getAttackTarget())
{
if(m_hero)
{
_unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infohero, false);
m_hero = false;
return;
}
if(m_evis)
{
_unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infoevis, false);
m_evis = false;
return;
}
if(m_crack)
{
_unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infocrack, false);
m_crack = false;
return;
}
if(m_blood)
{
_unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infoblood, false);
m_blood = false;
return;
}
if(m_strike)
{
_unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infostrike, false);
m_strike = false;
return;
}
if(val >= 1 && val <= 200)
{
_unit->setAttackTimer(2000, false);
m_hero = true;
}
if(val >= 790 && val <= 900)
{
_unit->setAttackTimer(4000, false);
m_blood = true;
}
if(val >= 650 && val <= 790)
{
_unit->setAttackTimer(4000, false);
m_crack = true;
}
if(val >= 200 && val <= 400)
{
_unit->setAttackTimer(4000, false);
m_evis = true;
}
if(val >= 400 && val <= 650)
{
_unit->setAttackTimer(4000, false);
m_strike = true;
}
}
}
protected:
bool m_evis;
bool m_hero;
bool m_strike;
bool m_blood;
bool m_crack;
SpellEntry *infohero, *infoevis, *infostrike, *infoblood, *infocrack;
};
class OsbourneAI : CreatureAIScript
{
public:
ADD_CREATURE_FACTORY_FUNCTION(OsbourneAI);
OsbourneAI(Creature* pCreature) : CreatureAIScript(pCreature)
{
m_strike = m_hero = m_evis = m_crack = m_blood = true;
infostrike = dbcSpell.LookupEntry(STRIKE);
infohero = dbcSpell.LookupEntry(HERO);
infoblood = dbcSpell.LookupEntry(BLOODTHIRST);
infocrack = dbcSpell.LookupEntry(CRACK);
infoevis = dbcSpell.LookupEntry(EVICERATE);
}
void OnCombatStart(Unit* mTarget)
{
RegisterAIUpdateEvent(_unit->GetUInt32Value(UNIT_FIELD_BASEATTACKTIME));
_unit->CastSpell(mTarget, infohero, false);
m_hero = false;
_unit->SendChatMessageAlternateEntry(100003, CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "Should we alert The Don Sir Osbourne");
_unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "No, I can handle these pity wimps myself");
}
void OnCombatStop(Unit *mTarget)
{
_unit->GetAIInterface()->setCurrentAgent(AGENT_NULL);
_unit->GetAIInterface()->SetAIState(STATE_IDLE);
RemoveAIUpdateEvent();
}
void OnDamageTaken(Unit* mAttacker, float fAmount)
{
if(fAmount < 5) return;
if(_unit->GetHealthPct() == 50) {
_unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Gah, I need help");
_unit->GetAIInterface()->setCurrentAgent(AGENT_CALLFORHELP);
}
return;
}
void OnDied(Unit *mKiller)
{
RemoveAIUpdateEvent();
_unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "You were stronger than i though.......");
}
void AIUpdate()
{
uint32 val = RandomUInt(1000);
SpellCast(val);
}
void SpellCast(uint32 val)
{
if(_unit->GetCurrentSpell() == NULL && _unit->GetAIInterface()->GetNextTarget())//_unit->getAttackTarget())
{
if(m_hero)
{
_unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infohero, false);
m_hero = false;
return;
}
if(m_evis)
{
_unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infoevis, false);
m_evis = false;
return;
}
if(m_crack)
{
_unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infocrack, false);
m_crack = false;
return;
}
if(m_blood)
{
_unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infoblood, false);
m_blood = false;
return;
}
if(m_strike)
{
_unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infostrike, false);
m_strike = false;
return;
}
if(val >= 1 && val <= 200)
{
_unit->setAttackTimer(2000, false);
m_hero = true;
}
if(val >= 790 && val <= 900)
{
_unit->setAttackTimer(4000, false);
m_blood = true;
}
if(val >= 650 && val <= 790)
{
_unit->setAttackTimer(4000, false);
m_crack = true;
}
if(val >= 200 && val <= 400)
{
_unit->setAttackTimer(4000, false);
m_evis = true;
}
if(val >= 400 && val <= 650)
{
_unit->setAttackTimer(4000, false);
m_strike = true;
}
}
}
protected:
bool m_evis;
bool m_hero;
bool m_strike;
bool m_blood;
bool m_crack;
SpellEntry *infohero, *infoevis, *infostrike, *infoblood, *infocrack;
};
class TheDonAI : public CreatureAIScript
{
public:
ADD_CREATURE_FACTORY_FUNCTION(TheDonAI);
TheDonAI(Creature *pCreature) : CreatureAIScript(pCreature)
{
_unit->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, 1727);
_unit->GetAIInterface()->disable_combat = true;
_unit->SetStandState(STANDSTATE_SIT_LOW_CHAIR);
m_attack1 = m_attack2 = m_attack3 = m_attack4 = m_attack5 = true;
chat1 = chat2 = chat3 = chat4 = chat5 = chat6 = chat7 = true;
mPhase = 0;
infostrike = dbcSpell.LookupEntry(STRIKE);
infobloodthirst = dbcSpell.LookupEntry(BLOODTHIRST);
inforip = dbcSpell.LookupEntry(RIP);
infostun = dbcSpell.LookupEntry(STUN);
inforage = dbcSpell.LookupEntry(RAGE);
////
infominions = dbcSpell.LookupEntry(MINIONS);
infoheal = dbcSpell.LookupEntry(SHADOWMEND);
infonova = dbcSpell.LookupEntry(NOVA);
infobolt = dbcSpell.LookupEntry(SHADOWBOLT);
infoscreech = dbcSpell.LookupEntry(SCREECH);
}
void OnCombatStart(Unit* mTarget)
{
_unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "What fool dare challenges me??");
}
void OnTargetDied(Unit* mTarget)
{
char msg[200];
int randMsg;
randMsg=rand()%3;
switch (randMsg)
{
case 0:
if(mTarget->GetTypeId() == TYPEID_PLAYER)
sprintf(msg, "And stay down, %s.", static_cast<Player*>(mTarget)->GetName());
else if (mTarget->GetTypeFromGUID() == HIGHGUID_TYPE_PET)
sprintf(msg, "And stay down, %s.", static_cast<Pet*>(mTarget)->GetName().c_str());
break;
case 1:
sprintf(msg, "And the fool falls");
break;
case 2:
sprintf(msg, "Death has befallen you and soon your allies as well");
break;
}
_unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, msg);
}
void OnDamageTaken(Unit* mAttacker, float fAmount)
{
if(fAmount < 5)
return;
if(_unit->GetHealthPct() == 80 && chat1) {
_unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Well, your a tough one arn't ya");
chat1 = false;
}
if(_unit->GetHealthPct() == 60 && chat2) {
_unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Ha, you actually think you can beat me!");
chat2 = false;
}
if(_unit->GetHealthPct() == 50 && chat3) {
ChangeToPhase1();
chat3 = false;
}
if(_unit->GetHealthPct() == 51 && chat4) {
_unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "The mafia, this failure of a clan was just my cover ");
chat4 = false;
}
if(_unit->GetHealthPct() == 49 && chat5) {
_unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "Minions, ATTACK!!!!");
_unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infominions, false);
chat5 = false;
}
if(_unit->GetHealthPct() == 20 && chat6) {
_unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Gah, I.....will not lose.");
chat6 = false;
}
if(_unit->GetHealthPct() == 3 && chat7) { _unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "My Lord i fear i may have failed you but i will not go down so easily");
_unit->CastSpell(_unit->GetAIInterface()->GetMostHated(), 5, false);
chat7 = false;
}
}
void ChangeToPhase1()
{
mPhase = 1;
_unit->SetUInt32Value(UNIT_FIELD_DISPLAYID , PHASE3ID);
_unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Face my true Identity.....The Lord of the Undead");
}
void OnCombatStop(Unit *mTarget)
{
_unit->GetAIInterface()->setCurrentAgent(AGENT_NULL);
_unit->GetAIInterface()->SetAIState(STATE_IDLE);
RemoveAIUpdateEvent();
}
void OnDied(Unit * mKiller)
{
RemoveAIUpdateEvent();
}
void AIUpdate()
{
uint32 val = RandomUInt(1000);
SpellCast(val);
}
void SpellCast(uint32 val)
{
if(_unit->GetCurrentSpell() == NULL && _unit->GetAIInterface()->GetNextTarget())//_unit->getAttackTarget())
{
if(m_attack1)
{
if(_unit->GetHealthPct() >= 50)
{
_unit->CastSpell(_unit, inforage, false);
}
else
{
_unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infominions, false);
m_attack1 = false;
return;
}
if(m_attack2)
{
if(_unit->GetHealthPct() >= 50)
{
_unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infostun, false);
}
else
{
_unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infoscreech, false);
}
m_attack3 = false;
return;
}
if(m_attack3)
{
if(_unit->GetHealthPct() >= 50)
{
_unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), inforip, false);
}
else
{
_unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infobolt, false);
}
m_attack3 = false;
return;
}
if(m_attack4)
{
if(_unit->GetHealthPct() >= 50)
{
_unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infobloodthirst, false);
}
else
{
_unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infonova, false);
}
m_attack4 = false;
return;
}
if(m_attack5)
{
if(_unit->GetHealthPct() >= 50)
{
_unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infostrike, false);
}
else
{
_unit->CastSpell(_unit, infoheal, false);
}
m_attack5 = false;
return;
}
if(val >= 1 && val <= 300)
{
_unit->setAttackTimer(4000, false);
m_attack1 = true;
}
if(val >= 300 && val <= 400)
{
_unit->setAttackTimer(3000, false);
m_attack2 = true;
}
if(val >= 400 && val <= 600)
{
_unit->setAttackTimer(2000, false);
m_attack3 = true;
}
if(val >= 600 && val <= 800)
{
_unit->setAttackTimer(2500, false);
m_attack4 = true;
}
if(val >= 800 && val <= 1000)
{
_unit->setAttackTimer(2000, false);
m_attack5 = true;
}
}
}
}
protected:
uint32 mPhase; // NPC has 2
bool m_attack3;
bool m_attack1;
bool m_attack2;
bool m_attack4;
bool m_attack5;
bool chat1;
bool chat2;
bool chat3;
bool chat4;
bool chat5;
bool chat6;
bool chat7;
SpellEntry *infominions, *inforip, *infobloodthirst, *infostrike, *infoscreech, *infonova, *infobolt, *inforage, *infostun, *infoheal;
};
void SetupMafiaInstance(ScriptMgr * mgr)
{
//Mobs
mgr->register_creature_script(CN_MAFIAMINER, &MafiaMinerAI::Create);
mgr->register_creature_script(CN_MAFIASLAVE1, &MafiaMinerAI::Create);
mgr->register_creature_script(CN_MAFIASLAVE2, &MafiaMinerAI::Create);
mgr->register_creature_script(CN_SPELLWEAVER, &MafiaSpellWeaverAI::Create);
mgr->register_creature_script(CN_ASSASSIN, &MafiaAssassinAI::Create);
mgr->register_creature_script(CN_PROTECTOR, &MafiaProtectorAI::Create);
mgr->register_creature_script(CN_TASKMASTER, &MafiaTaskmasterAI::Create);
mgr->register_creature_script(CN_MELTER, &MafiaMelterAI::Create);
//Bosses
mgr->register_creature_script(CN_THEDON, &TheDonAI::Create);
mgr->register_creature_script(CN_ASSASSINLEAD, &AssassinLeadAI::Create);
mgr->register_creature_script(CN_SLAVETASK, &TaskmasterAI::Create);
mgr->register_creature_script(CN_SLAVELEAD, &SlaveLeadAI::Create);
mgr->register_creature_script(CN_OSBOURNE, &OsbourneAI::Create);
//Events
mgr->register_creature_script(CN_GUTGORE, &JamesGutgoreAI::Create);
GossipScript * gs = (GossipScript*) new JamesGS();
mgr->register_gossip_script(CN_GUTGORE, gs);
}