Convert outdoors northrend scripts to the new format.
--HG-- branch : trunk
This commit is contained in:
1 parent
c787f11de1
commit
9e1695a9c5
10 files changed
+4424
-4317
No files matched your search
@@ -41,69 +41,75 @@ enum NPCs // All outdoor guards are within 35.0f of these NPCs
|
||||
NPC_SWEETBERRY_H = 29715,
|
||||
};
|
||||
|
||||
struct npc_mageguard_dalaranAI : public Scripted_NoMovementAI
|
||||
class npc_mageguard_dalaran : public CreatureScript
|
||||
{
|
||||
npc_mageguard_dalaranAI(Creature* pCreature) : Scripted_NoMovementAI(pCreature)
|
||||
public:
|
||||
npc_mageguard_dalaran() : CreatureScript("npc_mageguard_dalaran") { }
|
||||
|
||||
struct npc_mageguard_dalaranAI : public Scripted_NoMovementAI
|
||||
{
|
||||
pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||
pCreature->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_NORMAL, true);
|
||||
pCreature->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_MAGIC, true);
|
||||
}
|
||||
|
||||
void Reset(){}
|
||||
|
||||
void EnterCombat(Unit* /*pWho*/){}
|
||||
|
||||
void AttackStart(Unit* /*pWho*/){}
|
||||
|
||||
void MoveInLineOfSight(Unit *pWho)
|
||||
{
|
||||
if (!pWho || !pWho->IsInWorld() || pWho->GetZoneId() != 4395)
|
||||
return;
|
||||
|
||||
if (!me->IsWithinDist(pWho, 65.0f, false))
|
||||
return;
|
||||
|
||||
Player *pPlayer = pWho->GetCharmerOrOwnerPlayerOrPlayerItself();
|
||||
|
||||
if (!pPlayer || pPlayer->isGameMaster() || pPlayer->IsBeingTeleported())
|
||||
return;
|
||||
|
||||
switch (me->GetEntry())
|
||||
npc_mageguard_dalaranAI(Creature* pCreature) : Scripted_NoMovementAI(pCreature)
|
||||
{
|
||||
case 29254:
|
||||
if (pPlayer->GetTeam() == HORDE) // Horde unit found in Alliance area
|
||||
if (GetClosestCreatureWithEntry(me, NPC_APPLEBOUGH_A, 32.0f))
|
||||
{
|
||||
if (me->isInBackInMap(pWho, 12.0f)) // In my line of sight, "outdoors", and behind me
|
||||
DoCast(pWho, SPELL_TRESPASSER_A); // Teleport the Horde unit out
|
||||
}
|
||||
else // In my line of sight, and "indoors"
|
||||
DoCast(pWho, SPELL_TRESPASSER_A); // Teleport the Horde unit out
|
||||
break;
|
||||
case 29255:
|
||||
if (pPlayer->GetTeam() == ALLIANCE) // Alliance unit found in Horde area
|
||||
if (GetClosestCreatureWithEntry(me, NPC_SWEETBERRY_H, 32.0f))
|
||||
{
|
||||
if (me->isInBackInMap(pWho, 12.0f)) // In my line of sight, "outdoors", and behind me
|
||||
DoCast(pWho, SPELL_TRESPASSER_H); // Teleport the Alliance unit out
|
||||
}
|
||||
else // In my line of sight, and "indoors"
|
||||
DoCast(pWho, SPELL_TRESPASSER_H); // Teleport the Alliance unit out
|
||||
break;
|
||||
pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||
pCreature->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_NORMAL, true);
|
||||
pCreature->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_MAGIC, true);
|
||||
}
|
||||
me->SetOrientation(me->GetHomePosition().GetOrientation());
|
||||
return;
|
||||
|
||||
void Reset(){}
|
||||
|
||||
void EnterCombat(Unit* /*pWho*/){}
|
||||
|
||||
void AttackStart(Unit* /*pWho*/){}
|
||||
|
||||
void MoveInLineOfSight(Unit *pWho)
|
||||
{
|
||||
if (!pWho || !pWho->IsInWorld() || pWho->GetZoneId() != 4395)
|
||||
return;
|
||||
|
||||
if (!me->IsWithinDist(pWho, 65.0f, false))
|
||||
return;
|
||||
|
||||
Player *pPlayer = pWho->GetCharmerOrOwnerPlayerOrPlayerItself();
|
||||
|
||||
if (!pPlayer || pPlayer->isGameMaster() || pPlayer->IsBeingTeleported())
|
||||
return;
|
||||
|
||||
switch (me->GetEntry())
|
||||
{
|
||||
case 29254:
|
||||
if (pPlayer->GetTeam() == HORDE) // Horde unit found in Alliance area
|
||||
if (GetClosestCreatureWithEntry(me, NPC_APPLEBOUGH_A, 32.0f))
|
||||
{
|
||||
if (me->isInBackInMap(pWho, 12.0f)) // In my line of sight, "outdoors", and behind me
|
||||
DoCast(pWho, SPELL_TRESPASSER_A); // Teleport the Horde unit out
|
||||
}
|
||||
else // In my line of sight, and "indoors"
|
||||
DoCast(pWho, SPELL_TRESPASSER_A); // Teleport the Horde unit out
|
||||
break;
|
||||
case 29255:
|
||||
if (pPlayer->GetTeam() == ALLIANCE) // Alliance unit found in Horde area
|
||||
if (GetClosestCreatureWithEntry(me, NPC_SWEETBERRY_H, 32.0f))
|
||||
{
|
||||
if (me->isInBackInMap(pWho, 12.0f)) // In my line of sight, "outdoors", and behind me
|
||||
DoCast(pWho, SPELL_TRESPASSER_H); // Teleport the Alliance unit out
|
||||
}
|
||||
else // In my line of sight, and "indoors"
|
||||
DoCast(pWho, SPELL_TRESPASSER_H); // Teleport the Alliance unit out
|
||||
break;
|
||||
}
|
||||
me->SetOrientation(me->GetHomePosition().GetOrientation());
|
||||
return;
|
||||
}
|
||||
|
||||
void UpdateAI(const uint32 /*diff*/){}
|
||||
};
|
||||
|
||||
CreatureAI *GetAI(Creature *creature) const
|
||||
{
|
||||
return new npc_mageguard_dalaranAI(creature);
|
||||
}
|
||||
|
||||
void UpdateAI(const uint32 /*diff*/){}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI_npc_mageguard_dalaran(Creature* pCreature)
|
||||
{
|
||||
return new npc_mageguard_dalaranAI(pCreature);
|
||||
}
|
||||
|
||||
/*######
|
||||
## npc_hira_snowdawn
|
||||
######*/
|
||||
@@ -115,44 +121,40 @@ enum eHiraSnowdawn
|
||||
|
||||
#define GOSSIP_TEXT_TRAIN_HIRA "I seek training to ride a steed."
|
||||
|
||||
bool GossipHello_npc_hira_snowdawn(Player* pPlayer, Creature* pCreature)
|
||||
class npc_hira_snowdawn : public CreatureScript
|
||||
{
|
||||
if (!pCreature->isVendor() || !pCreature->isTrainer())
|
||||
return false;
|
||||
public:
|
||||
npc_hira_snowdawn() : CreatureScript("npc_hira_snowdawn") { }
|
||||
|
||||
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_TRAIN_HIRA, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN);
|
||||
bool OnGossipHello(Player* pPlayer, Creature* pCreature)
|
||||
{
|
||||
if (!pCreature->isVendor() || !pCreature->isTrainer())
|
||||
return false;
|
||||
|
||||
if (pPlayer->getLevel() >= 80 && pPlayer->HasSpell(SPELL_COLD_WEATHER_FLYING))
|
||||
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE);
|
||||
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_TRAIN_HIRA, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN);
|
||||
|
||||
pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID());
|
||||
if (pPlayer->getLevel() >= 80 && pPlayer->HasSpell(SPELL_COLD_WEATHER_FLYING))
|
||||
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE);
|
||||
|
||||
return true;
|
||||
}
|
||||
pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID());
|
||||
|
||||
bool GossipSelect_npc_hira_snowdawn(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction)
|
||||
{
|
||||
if (uiAction == GOSSIP_ACTION_TRAIN)
|
||||
pPlayer->SEND_TRAINERLIST(pCreature->GetGUID());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (uiAction == GOSSIP_ACTION_TRADE)
|
||||
pPlayer->SEND_VENDORLIST(pCreature->GetGUID());
|
||||
bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction)
|
||||
{
|
||||
if (uiAction == GOSSIP_ACTION_TRAIN)
|
||||
pPlayer->SEND_TRAINERLIST(pCreature->GetGUID());
|
||||
|
||||
return true;
|
||||
}
|
||||
if (uiAction == GOSSIP_ACTION_TRADE)
|
||||
pPlayer->SEND_VENDORLIST(pCreature->GetGUID());
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_dalaran()
|
||||
{
|
||||
Script *newscript;
|
||||
|
||||
newscript = new Script;
|
||||
newscript->Name = "npc_mageguard_dalaran";
|
||||
newscript->GetAI = &GetAI_npc_mageguard_dalaran;
|
||||
newscript->RegisterSelf();
|
||||
|
||||
newscript = new Script;
|
||||
newscript->Name = "npc_hira_snowdawn";
|
||||
newscript->pGossipHello = &GossipHello_npc_hira_snowdawn;
|
||||
newscript->pGossipSelect = &GossipSelect_npc_hira_snowdawn;
|
||||
newscript->RegisterSelf();
|
||||
new npc_mageguard_dalaran;
|
||||
new npc_hira_snowdawn;
|
||||
}
|
||||
Reference in new issue
Block a user