Core/scripting: More updates for gong event. Almost complete.

This commit is contained in:
Malcrom
2013-01-06 22:39:41 -03:30
parent facefe0909
commit 832cd198ca
4 changed files with 226 additions and 78 deletions

View File

@@ -0,0 +1,34 @@
-- Spell condition for Cosmetic - Spear Throw
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=43647;
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
(13,1,43647,0,0,31,0,3,24375,0,0,0,0, '', 'Cosmetic - Spear Throw - Harrison Jones');
-- Text for Harrison Jones from sniff
DELETE FROM `creature_text` WHERE `entry` IN (24358,24375);
INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES
(24358,0,0, 'Suit yourself. At least five of you must assist me if we''re to get inside. Follow me....',14,0,100,1,0,0, 'Harrison Jones - Gong Event Say 0'),
(24358,1,0, 'According to my calculations, if enough of us bang the gong at once the seal on these doors will break and we can enter.',14,0,100,1,0,0, 'Harrison Jones - Gong Event Say 1'),
(24375,0,0, 'I''ve researched this site extensively and I won''t allow any dim-witted treasure hunters to swoop in and steal what belongs in a museum. I''ll lead this charge...',14,0,100,0,0,0, 'Harrison Jones - Gong Event Say 2'),
(24375,1,0, 'In fact, it would be best if you just stay here. You''d only get in my way....',14,0,100,0,0,0, 'Harrison Jones - Gong Event Say 3');
-- Add spell script for banging the gong
DELETE FROM `spell_script_names` WHERE `spell_id`=45226;
INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
(45226, 'spell_banging_the_gong');
-- Remove creature from db
DELETE FROM `creature` WHERE id=24358;
DELETE FROM `creature_addon` WHERE guid=86177;
UPDATE `creature_template` SET `equipment_id`=0 WHERE `entry`=24358;
-- Pathing for Harrison Jones Entry: 24358
SET @NPC := 86044;
SET @PATH := @NPC * 10;
DELETE FROM `waypoint_data` WHERE `id`IN (861770,861771,861772);
DELETE FROM `waypoint_data` WHERE `id`IN (@PATH,@PATH+1,@PATH+2);
INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES
(@PATH,1,131.8243,1642.853,42.0216,0,0,0,100,0),
(@PATH+1,1,121.897,1639.106,42.19081,0,0,0,100,0),
(@PATH+1,2,120.8522,1637.931,42.37172,0,0,0,100,0),
(@PATH+1,3,120.7898,1609.063,43.49005,0,0,0,100,0),
(@PATH+2,1,120.6967,1603.713,43.4503,0,0,0,100,0);

View File

@@ -35,7 +35,6 @@ enum Misc
RAND_VENDOR = 2,
WORLDSTATE_SHOW_TIMER = 3104,
WORLDSTATE_TIME_TO_SACRIFICE = 3106
};
// Chests spawn at bear/eagle/dragonhawk/lynx bosses
@@ -55,6 +54,8 @@ static SHostageInfo HostageInfo[] =
{24024, 186667, 413, 1117, 6.32f, 3.1f} // lynx
};
Position const HarrisonJonesLoc = {120.687f, 1674.0f, 42.0217f, 1.59044f};
class instance_zulaman : public InstanceMapScript
{
public:
@@ -105,12 +106,15 @@ class instance_zulaman : public InstanceMapScript
ZulJinDoorGUID = 0;
QuestTimer = 0;
QuestMinute = 21;
QuestMinute = 0;
BossKilled = 0;
ChestLooted = 0;
for (uint8 i = 0; i < RAND_VENDOR; ++i)
RandVendor[i] = NOT_STARTED;
m_auiEncounter[DATA_GONGEVENT] = NOT_STARTED;
instance->SummonCreature(NPC_HARRISON_JONES, HarrisonJonesLoc);
}
bool IsEncounterInProgress() const
@@ -126,9 +130,6 @@ class instance_zulaman : public InstanceMapScript
{
switch (creature->GetEntry())
{
case NPC_HARRISON_JONES:
if (m_auiEncounter[DATA_GONGEVENT] == DONE)
creature->RemoveFromWorld();
case NPC_JANALAI:
case NPC_ZULJIN:
case NPC_HEXLORD:
@@ -181,6 +182,9 @@ class instance_zulaman : public InstanceMapScript
void CheckInstanceStatus()
{
if (m_auiEncounter[DATA_GONGEVENT] == DONE)
HandleGameObject(MassiveGateGUID, true);
if (BossKilled >= DATA_HALAZZIEVENT)
HandleGameObject(HexLordGateGUID, true);
@@ -224,7 +228,10 @@ class instance_zulaman : public InstanceMapScript
{
case DATA_GONGEVENT:
m_auiEncounter[DATA_GONGEVENT] = data;
HandleGameObject(MassiveGateGUID, data == DONE);
if (data == SPECIAL)
SaveToDB();
if (data == DONE)
QuestMinute = 21;
break;
case DATA_NALORAKKEVENT:
m_auiEncounter[DATA_NALORAKKEVENT] = data;
@@ -301,13 +308,13 @@ class instance_zulaman : public InstanceMapScript
{
switch (type)
{
case DATA_GONGEVENT: return m_auiEncounter[0];
case DATA_NALORAKKEVENT: return m_auiEncounter[1];
case DATA_AKILZONEVENT: return m_auiEncounter[2];
case DATA_JANALAIEVENT: return m_auiEncounter[3];
case DATA_HALAZZIEVENT: return m_auiEncounter[4];
case DATA_HEXLORDEVENT: return m_auiEncounter[5];
case DATA_ZULJINEVENT: return m_auiEncounter[6];
case DATA_GONGEVENT: return m_auiEncounter[DATA_GONGEVENT];
case DATA_NALORAKKEVENT: return m_auiEncounter[DATA_NALORAKKEVENT];
case DATA_AKILZONEVENT: return m_auiEncounter[DATA_AKILZONEVENT];
case DATA_JANALAIEVENT: return m_auiEncounter[DATA_JANALAIEVENT];
case DATA_HALAZZIEVENT: return m_auiEncounter[DATA_HALAZZIEVENT];
case DATA_HEXLORDEVENT: return m_auiEncounter[DATA_HEXLORDEVENT];
case DATA_ZULJINEVENT: return m_auiEncounter[DATA_ZULJINEVENT];
case DATA_CHESTLOOTED: return ChestLooted;
case TYPE_RAND_VENDOR_1: return RandVendor[0];
case TYPE_RAND_VENDOR_2: return RandVendor[1];

View File

@@ -207,14 +207,15 @@ enum Says
{
SAY_HARRISON_0 = 0,
SAY_HARRISON_1 = 1,
SAY_HARRISON_2 = 2,
SAY_HARRISON_3 = 3
SAY_HARRISON_2 = 0,
SAY_HARRISON_3 = 1
};
enum Spells
{
SPELL_BANGING_THE_GONG = 45225,
SPELL_STEALTH = 34189
SPELL_STEALTH = 34189,
SPELL_COSMETIC_SPEAR_THROW = 43647
};
enum Events
@@ -228,21 +229,40 @@ enum Events
GONG_EVENT_7 = 7,
GONG_EVENT_8 = 8,
GONG_EVENT_9 = 9,
GONG_EVENT_10 = 10
};
enum Entrys
{
NPC_HARRISON_JONES_2 = 24375
GONG_EVENT_10 = 10,
GONG_EVENT_11 = 11,
GONG_EVENT_12 = 12
};
enum Waypoints
{
HARRISON_MOVE_1 = 861770,
HARRISON_MOVE_2 = 861771,
HARRISON_MOVE_3 = 861772
HARRISON_MOVE_1 = 860440,
HARRISON_MOVE_2 = 860441,
HARRISON_MOVE_3 = 860442
};
enum DisplayIds
{
MODEL_HARRISON_JONES_0 = 22340,
MODEL_HARRISON_JONES_1 = 22354,
MODEL_HARRISON_JONES_2 = 22347
};
enum EntryIds
{
NPC_HARRISON_JONES_1 = 24375,
NPC_HARRISON_JONES_2 = 24365,
NPC_AMANISHI_GUARDIAN = 23597,
};
enum Weapons
{
WEAPON_MACE = 5301,
WEAPON_SPEAR = 13631
};
Position const AmanishiGuardianLoc = {120.687f, 1674.0f, 42.0217f, 1.59044f};
class npc_harrison_jones : public CreatureScript
{
public:
@@ -263,11 +283,13 @@ class npc_harrison_jones : public CreatureScript
uint8 _gongEvent;
uint32 _gongTimer;
uint64 uiTargetGUID;
void Reset()
{
_gongEvent = 0;
_gongTimer = 0;
uiTargetGUID = 0;
}
void EnterCombat(Unit* /*who*/) {}
@@ -279,12 +301,29 @@ class npc_harrison_jones : public CreatureScript
player->CLOSE_GOSSIP_MENU();
me->SetInFront(player);
me->SendMovementFlagUpdate(true);
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
Talk(SAY_HARRISON_0);
instance->SetData(DATA_GONGEVENT, IN_PROGRESS);
_gongEvent = GONG_EVENT_1;
_gongTimer = 1;
_gongTimer = 4000;
}
}
void SpellHit(Unit*, const SpellInfo* spell)
{
if (spell->Id == SPELL_COSMETIC_SPEAR_THROW)
{
me->RemoveAllAuras();
me->SetEntry(NPC_HARRISON_JONES_2);
me->SetDisplayId(MODEL_HARRISON_JONES_2);
me->SetTarget(0);
me->SetByteValue(UNIT_FIELD_BYTES_1,0,UNIT_STAND_STATE_DEAD);
me->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD);
if (instance)
instance->SetData(DATA_GONGEVENT, DONE);
}
}
void UpdateAI(uint32 const diff)
{
if (_gongEvent)
@@ -294,80 +333,120 @@ class npc_harrison_jones : public CreatureScript
switch (_gongEvent)
{
case GONG_EVENT_1:
Talk(SAY_HARRISON_0);
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
_gongTimer = 4000;
me->GetMotionMaster()->MovePath(HARRISON_MOVE_1,false);
_gongTimer = 12000;
_gongEvent = GONG_EVENT_2;
break;
case GONG_EVENT_2:
me->GetMotionMaster()->MovePath(HARRISON_MOVE_1,false);
_gongTimer = 12000;
_gongEvent = GONG_EVENT_3;
break;
case GONG_EVENT_3:
me->SetFacingTo(6.235659f);
Talk(SAY_HARRISON_1);
DoCast(me, SPELL_BANGING_THE_GONG);
me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(WEAPON_MACE));
me->SetSheath(SHEATH_STATE_MELEE);
_gongTimer = 4000;
_gongEvent = GONG_EVENT_3;
break;
case GONG_EVENT_3:
if (GameObject* gong = me->GetMap()->GetGameObject(instance->GetData64(GO_STRANGE_GONG)))
gong->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_NOT_SELECTABLE);
_gongTimer = 105000;
_gongEvent = GONG_EVENT_4;
break;
case GONG_EVENT_4:
if (GameObject* gong = me->GetMap()->GetGameObject(instance->GetData64(GO_STRANGE_GONG)))
gong->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_NOT_SELECTABLE);
_gongTimer = 120000;
_gongEvent = GONG_EVENT_5;
break;
case GONG_EVENT_5:
me->RemoveAura(SPELL_BANGING_THE_GONG);
if (GameObject* gong = me->GetMap()->GetGameObject(instance->GetData64(GO_STRANGE_GONG)))
gong->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_NOT_SELECTABLE);
if (instance)
instance->SetData(DATA_GONGEVENT, DONE); // This is temp
if (instance->GetData(DATA_GONGEVENT) == DONE)
// trigger or gong will need to be scripted to set SPECIAL if enough players click gong.
// This is temp workaround.
if (instance)
instance->SetData(DATA_GONGEVENT, SPECIAL); // to be removed.
if (instance->GetData(DATA_GONGEVENT) == SPECIAL)
{
// Save all players to instance
// Players are Now Saved to instance at SPECIAL (Player should be notified?)
me->GetMotionMaster()->MovePath(HARRISON_MOVE_2,false);
_gongTimer = 5000;
_gongEvent = 6;
_gongEvent = 5;
}
else
{
_gongTimer = 0; // Add reset at end
_gongEvent = 0; // Add reset at end
}
break;
case GONG_EVENT_6:
me->SetEntry(NPC_HARRISON_JONES_2);
Talk(SAY_HARRISON_2);
_gongTimer = 14000;
_gongEvent = 7;
break;
case GONG_EVENT_7:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_USE_STANDING);
Talk(SAY_HARRISON_2);
_gongTimer = 7000;
_gongEvent = 8;
break;
case GONG_EVENT_8:
// entry 23597 guid 86194 UNIT_VIRTUAL_ITEM_SLOT_ID: 13631
if (GameObject* gate = me->GetMap()->GetGameObject(instance->GetData64(GO_MASSIVE_GATE)))
gate->SetGoState(GO_STATE_ACTIVE);
_gongTimer = 1000;
_gongEvent = 9;
case GONG_EVENT_9:
DoCast(me, SPELL_STEALTH);
me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(0));
me->GetMotionMaster()->MovePath(HARRISON_MOVE_3,false);
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE);
_gongTimer = 1000;
_gongEvent = 10;
}
break;
case GONG_EVENT_5:
me->SetEntry(NPC_HARRISON_JONES_1);
me->SetDisplayId(MODEL_HARRISON_JONES_1);
Talk(SAY_HARRISON_2);
_gongTimer = 14000;
_gongEvent = 6;
break;
case GONG_EVENT_6:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_USE_STANDING);
Talk(SAY_HARRISON_3);
_gongTimer = 7000;
_gongEvent = 7;
break;
case GONG_EVENT_7:
if (!uiTargetGUID)
{
std::list<Creature*> targetList;
GetCreatureListWithEntryInGrid(targetList, me, NPC_AMANISHI_GUARDIAN, 26.0f);
if (!targetList.empty())
{
for (std::list<Creature*>::const_iterator itr = targetList.begin(); itr != targetList.end(); ++itr)
{
if (Creature* ptarget = *itr)
{
if (ptarget->GetPositionX() > 120)
{
ptarget->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(WEAPON_SPEAR));
//ptarget-> setdata for sai (I don't know how to do yet and answers are hard to get)
}
}
}
}
}
if (GameObject* gate = me->GetMap()->GetGameObject(instance->GetData64(GO_MASSIVE_GATE)))
gate->SetGoState(GO_STATE_ACTIVE);
_gongTimer = 1000;
_gongEvent = 8;
case GONG_EVENT_8:
DoCast(me, SPELL_STEALTH);
me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(0));
me->GetMotionMaster()->MovePath(HARRISON_MOVE_3,false);
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE);
_gongTimer = 100;
_gongEvent = 9;
case GONG_EVENT_9:
// If player in 10.0f range
// Send setdata to SAI for previous target
// SAI BELOW
// move 23597, guid 86194 to be deleted
// path 138.2242 Y: 1586.994 Z: 43.5488
// path 131.8407 Y: 1590.247 Z: 43.61384
// Reach end of path turnto 2.024582 cast Spell ID: 43647 on self hits 24365 update UNIT_VIRTUAL_ITEM_SLOT_ID: 33979
// wait 2 sec say text 0
// Set below after complete above
_gongTimer = 0;
_gongEvent = 0;
break;
case GONG_EVENT_10:
// move 23597 guid 86194
// path 138.2242 Y: 1586.994 Z: 43.5488
// path 131.8407 Y: 1590.247 Z: 43.61384
// Reach end of path turnto 2.024582 cast Spell ID: 43647 on self hits 24358 UNIT_VIRTUAL_ITEM_SLOT_ID: 33979
// wait 2 sec say text 0
me->GetMotionMaster()->MovePoint(0, 120.687f, 1674.0f, 42.0217f);
_gongTimer = 12000;
_gongEvent = 11;
break;
case GONG_EVENT_11:
me->SetFacingTo(1.59044f);
_gongTimer = 6000;
_gongEvent = 12;
break;
case GONG_EVENT_12:
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
if (instance)
instance->SetData(DATA_GONGEVENT, NOT_STARTED);
_gongTimer = 0;
_gongEvent = 0;
break;
@@ -385,10 +464,39 @@ class npc_harrison_jones : public CreatureScript
}
};
class spell_banging_the_gong : public SpellScriptLoader
{
public:
spell_banging_the_gong() : SpellScriptLoader("spell_banging_the_gong") { }
class spell_banging_the_gong_SpellScript : public SpellScript
{
PrepareSpellScript(spell_banging_the_gong_SpellScript);
void Activate(SpellEffIndex index)
{
PreventHitDefaultEffect(index);
GetHitGObj()->SendCustomAnim(0);
}
void Register()
{
OnEffectHitTarget += SpellEffectFn(spell_banging_the_gong_SpellScript::Activate, EFFECT_1, SPELL_EFFECT_ACTIVATE_OBJECT);
}
};
SpellScript* GetSpellScript() const
{
return new spell_banging_the_gong_SpellScript();
}
};
void AddSC_zulaman()
{
new npc_forest_frog();
new npc_zulaman_hostage();
new npc_harrison_jones();
new spell_banging_the_gong();
}

View File

@@ -51,7 +51,6 @@ enum GameobjectIds
GO_MASSIVE_GATE = 186728,
GO_DOOR_AKILZON = 186858,
GO_DOOR_ZULJIN = 186859,
GO_HARKORS_SATCHEL = 187021,
GO_TANZARS_TRUNK = 186648,
GO_ASHLIS_BAG = 186672,