Scripts/Wormhole: Add rare 6th option to "Underground". Fixed some teleport positions (from sniffs)

And made some random cleanup for npc_shadowfiend and npc_lightwell
This commit is contained in:
kaelima
2012-05-09 01:48:18 +02:00
parent 5fc2c8cda3
commit 1af30a9ea2
2 changed files with 109 additions and 101 deletions

View File

@@ -0,0 +1,7 @@
DELETE FROM `spell_target_position` WHERE `id` IN (67834, 68081);
INSERT INTO `spell_target_position` (`id`,`target_map`,`target_position_x`,`target_position_y`,`target_position_z`,`target_orientation`) VALUES
(67834, 571, 3167.01, 5586.04, 880.067, 0),
(68081, 571, 5857.252, 516.8015, 599.82, 2.987);
UPDATE `spell_target_position` SET `target_position_x`=6136.89,`target_position_y`=4785.55,`target_position_z`=100.673 WHERE `id`=67835;
UPDATE `spell_target_position` SET `target_position_x`=8301.39,`target_position_y`=1501.34,`target_position_z`=870.555 WHERE `id`=67836;

View File

@@ -1975,33 +1975,31 @@ public:
class npc_lightwell : public CreatureScript
{
public:
npc_lightwell() : CreatureScript("npc_lightwell") { }
public:
npc_lightwell() : CreatureScript("npc_lightwell") { }
struct npc_lightwellAI : public PassiveAI
{
npc_lightwellAI(Creature* creature) : PassiveAI(creature) {}
void Reset()
struct npc_lightwellAI : public PassiveAI
{
DoCast(me, 59907, false); // Spell for Lightwell Charges
}
npc_lightwellAI(Creature* creature) : PassiveAI(creature)
{
DoCast(me, 59907, false);
}
void EnterEvadeMode()
void EnterEvadeMode()
{
if (!me->isAlive())
return;
me->DeleteThreatList();
me->CombatStop(true);
me->ResetPlayerDamageReq();
}
};
CreatureAI* GetAI(Creature* creature) const
{
if (!me->isAlive())
return;
me->DeleteThreatList();
me->CombatStop(true);
me->ResetPlayerDamageReq();
return new npc_lightwellAI(creature);
}
};
CreatureAI* GetAI(Creature* creature) const
{
return new npc_lightwellAI(creature);
}
};
enum eTrainingDummy
@@ -2099,34 +2097,26 @@ public:
class npc_shadowfiend : public CreatureScript
{
public:
npc_shadowfiend() : CreatureScript("npc_shadowfiend") { }
public:
npc_shadowfiend() : CreatureScript("npc_shadowfiend") { }
struct npc_shadowfiendAI : public ScriptedAI
{
npc_shadowfiendAI(Creature* creature) : ScriptedAI(creature) {}
void DamageTaken(Unit* /*killer*/, uint32& damage)
struct npc_shadowfiendAI : public ScriptedAI
{
if (me->isSummon())
if (Unit* owner = me->ToTempSummon()->GetSummoner())
if (owner->HasAura(GLYPH_OF_SHADOWFIEND) && damage >= me->GetHealth())
owner->CastSpell(owner, GLYPH_OF_SHADOWFIEND_MANA, true);
}
npc_shadowfiendAI(Creature* creature) : ScriptedAI(creature) {}
void UpdateAI(uint32 const /*diff*/)
void DamageTaken(Unit* /*killer*/, uint32& damage)
{
if (me->isSummon())
if (Unit* owner = me->ToTempSummon()->GetSummoner())
if (owner->HasAura(GLYPH_OF_SHADOWFIEND) && damage >= me->GetHealth())
owner->CastSpell(owner, GLYPH_OF_SHADOWFIEND_MANA, true);
}
};
CreatureAI* GetAI(Creature* creature) const
{
if (!UpdateVictim())
return;
DoMeleeAttackIfReady();
return new npc_shadowfiendAI(creature);
}
};
CreatureAI* GetAI(Creature* creature) const
{
return new npc_shadowfiendAI(creature);
}
};
/*######
@@ -2193,7 +2183,7 @@ public:
}
};
CreatureAI *GetAI(Creature* creature) const
CreatureAI* GetAI(Creature* creature) const
{
return new npc_fire_elementalAI(creature);
}
@@ -2238,7 +2228,7 @@ public:
}
};
CreatureAI *GetAI(Creature* creature) const
CreatureAI* GetAI(Creature* creature) const
{
return new npc_earth_elementalAI(creature);
}
@@ -2248,78 +2238,89 @@ public:
# npc_wormhole
######*/
#define GOSSIP_ENGINEERING1 "Borean Tundra."
#define GOSSIP_ENGINEERING2 "Howling Fjord."
#define GOSSIP_ENGINEERING3 "Sholazar Basin."
#define GOSSIP_ENGINEERING4 "Icecrown."
#define GOSSIP_ENGINEERING5 "Storm Peaks."
#define GOSSIP_ENGINEERING1 "Borean Tundra"
#define GOSSIP_ENGINEERING2 "Howling Fjord"
#define GOSSIP_ENGINEERING3 "Sholazar Basin"
#define GOSSIP_ENGINEERING4 "Icecrown"
#define GOSSIP_ENGINEERING5 "Storm Peaks"
#define GOSSIP_ENGINEERING6 "Underground..."
enum eWormhole
enum WormholeSpells
{
SPELL_HOWLING_FJORD = 67838,
SPELL_BOREAN_TUNDRA = 67834,
SPELL_SHOLAZAR_BASIN = 67835,
SPELL_ICECROWN = 67836,
SPELL_STORM_PEAKS = 67837,
SPELL_HOWLING_FJORD = 67838,
SPELL_UNDERGROUND = 68081,
TEXT_WORMHOLE = 907
};
class npc_wormhole : public CreatureScript
{
public:
npc_wormhole() : CreatureScript("npc_wormhole") { }
bool OnGossipHello(Player* player, Creature* creature)
{
if (creature->isSummon())
public:
npc_wormhole() : CreatureScript("npc_wormhole")
{
if (player == creature->ToTempSummon()->GetSummoner())
showUnderground = urand(0, 100) == 0; // Guessed value, it is really rare though
}
bool OnGossipHello(Player* player, Creature* creature)
{
if (creature->isSummon())
{
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5);
if (player == creature->ToTempSummon()->GetSummoner())
{
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5);
player->PlayerTalkClass->SendGossipMenu(TEXT_WORMHOLE, creature->GetGUID());
if (showUnderground)
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6);
player->PlayerTalkClass->SendGossipMenu(TEXT_WORMHOLE, creature->GetGUID());
}
}
return true;
}
return true;
}
bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*sender*/, uint32 action)
{
player->PlayerTalkClass->ClearMenus();
bool roll = urand(0, 1);
switch (action)
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
{
case GOSSIP_ACTION_INFO_DEF + 1: //Borean Tundra
player->CLOSE_GOSSIP_MENU();
if (roll) //At the moment we don't have chance on spell_target_position table so we hack this
player->TeleportTo(571, 4305.505859f, 5450.839844f, 63.005806f, 0.627286f);
else
player->TeleportTo(571, 3201.936279f, 5630.123535f, 133.658798f, 3.855272f);
break;
case GOSSIP_ACTION_INFO_DEF + 2: //Howling Fjord
player->CLOSE_GOSSIP_MENU();
player->CastSpell(player, SPELL_HOWLING_FJORD, true);
break;
case GOSSIP_ACTION_INFO_DEF + 3: //Sholazar Basin
player->CLOSE_GOSSIP_MENU();
player->CastSpell(player, SPELL_SHOLAZAR_BASIN, true);
break;
case GOSSIP_ACTION_INFO_DEF + 4: //Icecrown
player->CLOSE_GOSSIP_MENU();
player->CastSpell(player, SPELL_ICECROWN, true);
break;
case GOSSIP_ACTION_INFO_DEF + 5: //Storm peaks
player->CLOSE_GOSSIP_MENU();
player->CastSpell(player, SPELL_STORM_PEAKS, true);
break;
player->PlayerTalkClass->ClearMenus();
switch (action)
{
case GOSSIP_ACTION_INFO_DEF + 1: // Borean Tundra
player->CLOSE_GOSSIP_MENU();
creature->CastSpell(player, SPELL_BOREAN_TUNDRA, false);
break;
case GOSSIP_ACTION_INFO_DEF + 2: // Howling Fjord
player->CLOSE_GOSSIP_MENU();
creature->CastSpell(player, SPELL_HOWLING_FJORD, false);
break;
case GOSSIP_ACTION_INFO_DEF + 3: // Sholazar Basin
player->CLOSE_GOSSIP_MENU();
creature->CastSpell(player, SPELL_SHOLAZAR_BASIN, false);
break;
case GOSSIP_ACTION_INFO_DEF + 4: // Icecrown
player->CLOSE_GOSSIP_MENU();
creature->CastSpell(player, SPELL_ICECROWN, false);
break;
case GOSSIP_ACTION_INFO_DEF + 5: // Storm peaks
player->CLOSE_GOSSIP_MENU();
creature->CastSpell(player, SPELL_STORM_PEAKS, false);
break;
case GOSSIP_ACTION_INFO_DEF + 6: // Underground
player->CLOSE_GOSSIP_MENU();
creature->CastSpell(player, SPELL_UNDERGROUND, false);
break;
}
return true;
}
return true;
}
private:
bool underGround;
};
/*######
@@ -2865,7 +2866,7 @@ public:
}
};
CreatureAI *GetAI(Creature* creature) const
CreatureAI* GetAI(Creature* creature) const
{
return new npc_fireworkAI(creature);
}