aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkarn <phillip.wow@gmx.de>2014-07-19 22:49:50 +0100
committerDDuarte <dnpd.dd@gmail.com>2014-07-19 22:50:32 +0100
commit26aaf2384ca48db1c199a263ae50d3ab1da59891 (patch)
tree9a06f50533aff60a190bbab7b7fe0a1782f0b6e1
parent40b4bd2eda333e90dd0ee1a1b6a6e939c10a6985 (diff)
Core/Creature: Minigob Manabonk
Closes #11097 Signed-off-by: DDuarte <dnpd.dd@gmail.com>
-rw-r--r--sql/updates/world/2014_07_19_09_world_misc.sql24
-rw-r--r--src/server/game/Spells/SpellInfo.cpp2
-rw-r--r--src/server/scripts/Northrend/zone_dalaran.cpp110
3 files changed, 136 insertions, 0 deletions
diff --git a/sql/updates/world/2014_07_19_09_world_misc.sql b/sql/updates/world/2014_07_19_09_world_misc.sql
new file mode 100644
index 00000000000..5cef0a600bd
--- /dev/null
+++ b/sql/updates/world/2014_07_19_09_world_misc.sql
@@ -0,0 +1,24 @@
+SET @ENTRY_MINIGOB = 32838;
+SET @GUID_MINIGOB = 44457;
+SET @EVENT_ID = 33;
+
+-- mail loot
+DELETE FROM `mail_loot_template` WHERE `entry`=264;
+INSERT INTO `mail_loot_template` (`entry`, `item`) VALUES
+(264, 44817);
+
+-- creature script
+UPDATE `creature_template` SET `ScriptName`='npc_minigob_manabonk' WHERE `entry`=@ENTRY_MINIGOB;
+-- creature spawn
+DELETE FROM `creature` WHERE `guid`=@GUID_MINIGOB;
+INSERT INTO `creature` (`guid`, `id`, `map`, `spawnMask`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `MovementType`) VALUES
+(@GUID_MINIGOB, @ENTRY_MINIGOB, 571, 1, 1, 0, 1, 5877.88, 662.895, 644.53, 1.66366, 300, 0, 0, 3367, 8139, 0, 0, 0, 0);
+
+
+-- game event to spawn the npc
+DELETE FROM `game_event` WHERE `eventEntry`=@EVENT_ID;
+INSERT INTO `game_event` (`eventEntry`, `start_time`, `end_time`, `occurence`, `length`, `description`) VALUES
+(@EVENT_ID, '2011-03-22 00:10:00', '2020-03-22 00:00:00', 30, 5, 'Dalaran: Minigob');
+DELETE FROM `game_event_creature` WHERE `guid`=@GUID_MINIGOB;
+INSERT INTO `game_event_creature` (`eventEntry`, `guid`) VALUES
+(@EVENT_ID, @GUID_MINIGOB);
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp
index 8d3b37cc1d5..99c3d234ef8 100644
--- a/src/server/game/Spells/SpellInfo.cpp
+++ b/src/server/game/Spells/SpellInfo.cpp
@@ -2373,6 +2373,8 @@ bool SpellInfo::_IsPositiveEffect(uint8 effIndex, bool deep) const
case 61716: // Rabbit Costume
case 61734: // Noblegarden Bunny
case 62344: // Fists of Stone
+ case 61819: // Manabonked! (item)
+ case 61834: // Manabonked! (minigob)
return true;
default:
break;
diff --git a/src/server/scripts/Northrend/zone_dalaran.cpp b/src/server/scripts/Northrend/zone_dalaran.cpp
index 1e8da70bbbf..0acb89d7d6f 100644
--- a/src/server/scripts/Northrend/zone_dalaran.cpp
+++ b/src/server/scripts/Northrend/zone_dalaran.cpp
@@ -172,8 +172,118 @@ public:
}
};
+enum MinigobData
+{
+ ZONE_DALARAN = 4395,
+
+ SPELL_MANABONKED = 61834,
+ SPELL_TELEPORT_VISUAL = 51347,
+ SPELL_IMPROVED_BLINK = 61995,
+
+ EVENT_SELECT_TARGET = 1,
+ EVENT_BLINK = 2,
+ EVENT_DESPAWN_VISUAL = 3,
+ EVENT_DESPAWN = 4,
+
+ MAIL_MINIGOB_ENTRY = 264,
+ MAIL_DELIVER_DELAY_MIN = 5*MINUTE,
+ MAIL_DELIVER_DELAY_MAX = 15*MINUTE
+};
+
+class npc_minigob_manabonk : public CreatureScript
+{
+ public:
+ npc_minigob_manabonk() : CreatureScript("npc_minigob_manabonk") {}
+
+ struct npc_minigob_manabonkAI : public ScriptedAI
+ {
+ npc_minigob_manabonkAI(Creature* creature) : ScriptedAI(creature)
+ {
+ me->setActive(true);
+ }
+
+ void Reset()
+ {
+ me->SetVisible(false);
+ events.ScheduleEvent(EVENT_SELECT_TARGET, IN_MILLISECONDS);
+ }
+
+ Player* SelectTargetInDalaran()
+ {
+ std::list<Player*> PlayerInDalaranList;
+ PlayerInDalaranList.clear();
+
+ Map::PlayerList const &players = me->GetMap()->GetPlayers();
+ for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
+ if (Player* player = itr->GetSource()->ToPlayer())
+ if (player->GetZoneId() == ZONE_DALARAN && !player->IsFlying() && !player->IsMounted() && !player->IsGameMaster())
+ PlayerInDalaranList.push_back(player);
+
+ if (PlayerInDalaranList.empty())
+ return NULL;
+ return Trinity::Containers::SelectRandomContainerElement(PlayerInDalaranList);
+ }
+
+ void SendMailToPlayer(Player* player)
+ {
+ SQLTransaction trans = CharacterDatabase.BeginTransaction();
+ int16 deliverDelay = irand(MAIL_DELIVER_DELAY_MIN, MAIL_DELIVER_DELAY_MAX);
+ MailDraft(MAIL_MINIGOB_ENTRY, true).SendMailTo(trans, MailReceiver(player), MailSender(MAIL_CREATURE, me->GetEntry()), MAIL_CHECK_MASK_NONE, deliverDelay);
+ CharacterDatabase.CommitTransaction(trans);
+ }
+
+ void UpdateAI(uint32 diff)
+ {
+ events.Update(diff);
+
+ while (uint32 eventId = events.ExecuteEvent())
+ {
+ switch (eventId)
+ {
+ case EVENT_SELECT_TARGET:
+ me->SetVisible(true);
+ DoCast(me, SPELL_TELEPORT_VISUAL);
+ if (Player* player = SelectTargetInDalaran())
+ {
+ me->NearTeleportTo(player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), 0.0f);
+ DoCast(player, SPELL_MANABONKED);
+ SendMailToPlayer(player);
+ }
+ events.ScheduleEvent(EVENT_BLINK, 3*IN_MILLISECONDS);
+ break;
+ case EVENT_BLINK:
+ DoCast(me, SPELL_IMPROVED_BLINK);
+ Position pos;
+ me->GetRandomNearPosition(pos, (urand(15, 40)));
+ me->GetMotionMaster()->MovePoint(0, pos.m_positionX, pos.m_positionY, pos.m_positionZ);
+ events.ScheduleEvent(EVENT_DESPAWN, 3*IN_MILLISECONDS);
+ events.ScheduleEvent(EVENT_DESPAWN_VISUAL, 2.5*IN_MILLISECONDS);
+ break;
+ case EVENT_DESPAWN_VISUAL:
+ DoCast(me, SPELL_TELEPORT_VISUAL);
+ break;
+ case EVENT_DESPAWN:
+ me->DespawnOrUnsummon();
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ private:
+ EventMap events;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new npc_minigob_manabonkAI(creature);
+ }
+};
+
void AddSC_dalaran()
{
new npc_mageguard_dalaran;
new npc_hira_snowdawn;
+ new npc_minigob_manabonk();
}