mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 01:15:35 +01:00
Scripts/Razorfen Kraul add script for quest 1221
Credits to @XFurry , he is original author. Closes #8165 Closes #10152 Signed-off-by: Nay <dnpd.dd@gmail.com>
This commit is contained in:
26
sql/updates/world/2013_07_04_01_world_razorfen_kraul.sql
Normal file
26
sql/updates/world/2013_07_04_01_world_razorfen_kraul.sql
Normal file
@@ -0,0 +1,26 @@
|
||||
SET @GUID := 56185;
|
||||
|
||||
DELETE FROM `gameobject` WHERE `id`=20920 OR `id`=300011;
|
||||
INSERT INTO `gameobject` (`guid`, `id`, `map`, `spawnMask`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `rotation0`, `rotation1`, `rotation2`, `rotation3`, `spawntimesecs`, `animprogress`, `state`) VALUES
|
||||
(@GUID, 20920, 47, 1, 1, 2082.74, 1671.82, 61.2396, 3.66079, 0, 0, 0.966493, -0.256693, -43200, 100, 1),
|
||||
(@GUID+1, 20920, 47, 1, 1, 2159.43, 1687.49, 57.5433, 3.66079, 0, 0, 0.966493, -0.256693, -43200, 100, 1),
|
||||
(@GUID+2, 20920, 47, 1, 1, 2080.89, 1703.36, 56.6447, 0.553757, 0, 0, 0.273354, 0.961913, -43200, 100, 1),
|
||||
(@GUID+3, 20920, 47, 1, 1, 2055.28, 1767.7, 58.4559, 2.98378, 0, 0, 0.996889, 0.0788245, -43200, 100, 1),
|
||||
(@GUID+4, 20920, 47, 1, 1, 2196.64, 1827.96, 61.4706, 2.11277, 0, 0, 0.870583, 0.492022, -43200, 100, 1),
|
||||
(@GUID+5, 20920, 47, 1, 1, 2030.32, 1867.61, 56.2866, 5.6777, 0, 0, 0.298139, -0.954522, -43200, 100, 1),
|
||||
(@GUID+6, 20920, 47, 1, 1, 2091.33, 1861.73, 51.0341, 1.25355, 0, 0, 0.586536, 0.809923, -43200, 100, 1),
|
||||
(@GUID+7, 20920, 47, 1, 1, 2200.15, 1897.64, 71.3191, 2.6492, 0, 0, 0.969846, 0.243717, -43200, 100, 1),
|
||||
(@GUID+8, 20920, 47, 1, 1, 2075.75, 1742.04, 76.7184, 1.33994, 0, 0, 0.620962, 0.78384, -43200, 100, 1),
|
||||
(@GUID+9, 20920, 47, 1, 1, 2126, 1661.15, 82.4824, 0.0220437, 0, 0, 0.0110216, 0.999939, -43200, 100, 1),
|
||||
(@GUID+10, 20920, 47, 1, 1, 2207.92, 1596.91, 80.7375, 3.60582, 0, 0, 0.973182, -0.230035, -43200, 100, 1),
|
||||
(@GUID+11, 20920, 47, 1, 1, 2156.98, 1542.26, 72.849, 2.43086, 0, 0, 0.937519, 0.347934, -43200, 100, 1),
|
||||
(@GUID+12, 20920, 47, 1, 1, 2179.95, 1514.06, 69.0709, 0.778385, 0, 0, 0.379441, 0.925216, -43200, 100, 1),
|
||||
(@GUID+13, 20920, 47, 1, 1, 2000.85, 1533.93, 80.3971, 4.919, 0, 0, 0.630419, -0.776255, -43200, 100, 1),
|
||||
(@GUID+14, 20920, 47, 1, 1, 1991.49, 1608.53, 81.1601, 1.1004, 0, 0, 0.522858, 0.85242, -43200, 100, 1),
|
||||
(@GUID+15, 300011, 47, 1, 1, 2072.84, 1582.57, 82.14, 0, 0, 0, 0, 1, -43200, 0, 1);
|
||||
|
||||
UPDATE `creature_template` SET `ScriptName`='npc_snufflenose_gopher' WHERE `entry`=4781;
|
||||
|
||||
DELETE FROM `spell_script_names` WHERE `spell_id`=8283;
|
||||
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
|
||||
(8283, 'spell_snufflenose_command');
|
||||
@@ -74,6 +74,7 @@ public:
|
||||
switch (go->GetEntry())
|
||||
{
|
||||
case 21099: DoorWardGUID = go->GetGUID(); break;
|
||||
case 20920: go->SetUInt32Value(GAMEOBJECT_FACTION, 0); break; // big fat fugly hack
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/>
|
||||
* Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
|
||||
* Copyright (C) 2006-2013 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
@@ -16,22 +16,12 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* ScriptData
|
||||
SDName: Razorfen Kraul
|
||||
SD%Complete: 100
|
||||
SDComment: Quest support: 1144
|
||||
SDCategory: Razorfen Kraul
|
||||
EndScriptData */
|
||||
|
||||
/* ContentData
|
||||
npc_willix
|
||||
EndContentData */
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "ScriptedEscortAI.h"
|
||||
#include "razorfen_kraul.h"
|
||||
#include "Player.h"
|
||||
#include "PetAI.h"
|
||||
|
||||
enum Willix
|
||||
{
|
||||
@@ -148,7 +138,143 @@ public:
|
||||
|
||||
};
|
||||
|
||||
enum SnufflenoseGopher
|
||||
{
|
||||
NPC_SNUFFLENOSE_GOPHER = 4781,
|
||||
GO_BLUELEAF_TUBBER = 20920,
|
||||
ACTION_FIND_NEW_TUBBER = 0x4B726F66,
|
||||
POINT_TUBBER = 0x6E615748
|
||||
};
|
||||
|
||||
struct DistanceOrder : public std::binary_function<GameObject, GameObject, bool>
|
||||
{
|
||||
DistanceOrder(Creature* me) : me(me) {}
|
||||
|
||||
bool operator() (GameObject* first, GameObject* second)
|
||||
{
|
||||
return me->GetDistanceOrder(first, second);
|
||||
}
|
||||
|
||||
Creature* me;
|
||||
};
|
||||
|
||||
struct npc_snufflenose_gopher : public CreatureScript
|
||||
{
|
||||
public:
|
||||
npc_snufflenose_gopher() : CreatureScript("npc_snufflenose_gopher") { }
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const
|
||||
{
|
||||
return new npc_snufflenose_gopherAI(creature);
|
||||
}
|
||||
|
||||
struct npc_snufflenose_gopherAI : public PetAI
|
||||
{
|
||||
npc_snufflenose_gopherAI(Creature* creature) : PetAI(creature) { }
|
||||
|
||||
void Reset()
|
||||
{
|
||||
IsMovementActive = false;
|
||||
}
|
||||
|
||||
void MovementInform(uint32 type, uint32 id)
|
||||
{
|
||||
if (type == POINT_MOTION_TYPE && id == POINT_TUBBER)
|
||||
{
|
||||
if (GameObject* go = me->GetMap()->GetGameObject(TargetTubberGUID))
|
||||
{
|
||||
go->SetRespawnTime(5 * MINUTE);
|
||||
go->Refresh();
|
||||
go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_INTERACT_COND);
|
||||
}
|
||||
|
||||
IsMovementActive = false;
|
||||
}
|
||||
else
|
||||
PetAI::MovementInform(type, id);
|
||||
}
|
||||
|
||||
void DoFindNewTubber()
|
||||
{
|
||||
std::list<GameObject*> tubbersInRange;
|
||||
GetGameObjectListWithEntryInGrid(tubbersInRange, me, GO_BLUELEAF_TUBBER, 40.0f);
|
||||
|
||||
if (tubbersInRange.empty())
|
||||
return;
|
||||
|
||||
tubbersInRange.sort(DistanceOrder(me));
|
||||
GameObject* nearestTubber = NULL;
|
||||
|
||||
for (std::list<GameObject*>::const_iterator itr = tubbersInRange.begin(); itr != tubbersInRange.end(); ++itr)
|
||||
{
|
||||
if (!(*itr)->isSpawned() && (*itr)->HasFlag(GAMEOBJECT_FLAGS, GO_FLAG_INTERACT_COND))
|
||||
{
|
||||
nearestTubber = *itr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!nearestTubber)
|
||||
return;
|
||||
|
||||
TargetTubberGUID = nearestTubber->GetGUID();
|
||||
|
||||
// XFurry was wrong...
|
||||
me->GetMotionMaster()->MovePoint(POINT_TUBBER, nearestTubber->GetPositionX(),
|
||||
nearestTubber->GetPositionY(),
|
||||
nearestTubber->GetPositionZ());
|
||||
IsMovementActive = true;
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff)
|
||||
{
|
||||
if (!IsMovementActive)
|
||||
PetAI::UpdateAI(diff);
|
||||
}
|
||||
|
||||
void DoAction(int32 action)
|
||||
{
|
||||
if (action == ACTION_FIND_NEW_TUBBER)
|
||||
DoFindNewTubber();
|
||||
}
|
||||
|
||||
bool IsMovementActive;
|
||||
uint64 TargetTubberGUID;
|
||||
};
|
||||
};
|
||||
|
||||
class spell_snufflenose_command : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_snufflenose_command() : SpellScriptLoader("spell_snufflenose_command") { }
|
||||
|
||||
class spell_snufflenose_commandSpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_snufflenose_commandSpellScript);
|
||||
|
||||
void HandleAfterCast()
|
||||
{
|
||||
if (Unit* target = ((Player*)GetCaster())->GetSelectedUnit())
|
||||
if (target->GetEntry() == NPC_SNUFFLENOSE_GOPHER)
|
||||
if (Creature* ctarget = dynamic_cast<Creature*>(target))
|
||||
ctarget->AI()->DoAction(ACTION_FIND_NEW_TUBBER);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
AfterCast += SpellCastFn(spell_snufflenose_commandSpellScript::HandleAfterCast);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_snufflenose_commandSpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_razorfen_kraul()
|
||||
{
|
||||
new spell_snufflenose_command();
|
||||
new npc_willix();
|
||||
new npc_snufflenose_gopher();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user