diff options
-rw-r--r-- | sql/updates/world/2013_04_11_03_world_misc.sql | 8 | ||||
-rw-r--r-- | src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp | 332 |
2 files changed, 166 insertions, 174 deletions
diff --git a/sql/updates/world/2013_04_11_03_world_misc.sql b/sql/updates/world/2013_04_11_03_world_misc.sql new file mode 100644 index 00000000000..5f1e89d631d --- /dev/null +++ b/sql/updates/world/2013_04_11_03_world_misc.sql @@ -0,0 +1,8 @@ +DELETE FROM `spell_target_position` WHERE `id`=52464; +INSERT INTO `spell_target_position` (`id`, `target_map`, `target_position_x`, `target_position_y`, `target_position_z`, `target_orientation`) VALUES +(52464, 609, 2384.13, -5900.07, 107.998, 0); + +UPDATE `gameobject_template` SET `ScriptName`='' WHERE `entry`=190767; + +DELETE FROM `creature` WHERE `guid`=129164; +DELETE FROM `creature_addon` WHERE `guid`=129164; diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp index abaf900508c..7f6a9c1d63b 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp @@ -861,59 +861,82 @@ public: ## npc_scarlet_miner_cart ####*/ -enum Spells_SM +enum ScarletMinerCart { - SPELL_CART_CHECK = 54173, - SPELL_CART_DRAG = 52465 + SPELL_CART_CHECK = 54173, + SPELL_SUMMON_CART = 52463, + SPELL_SUMMON_MINER = 52464, + SPELL_CART_DRAG = 52465, + + NPC_MINER = 28841 }; class npc_scarlet_miner_cart : public CreatureScript { -public: - npc_scarlet_miner_cart() : CreatureScript("npc_scarlet_miner_cart") { } + public: + npc_scarlet_miner_cart() : CreatureScript("npc_scarlet_miner_cart") { } - CreatureAI* GetAI(Creature* creature) const - { - return new npc_scarlet_miner_cartAI(creature); - } - - struct npc_scarlet_miner_cartAI : public PassiveAI - { - npc_scarlet_miner_cartAI(Creature* creature) : PassiveAI(creature), minerGUID(0) + struct npc_scarlet_miner_cartAI : public PassiveAI { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); - me->SetDisplayId(me->GetCreatureTemplate()->Modelid1); // Modelid2 is a horse. - } + npc_scarlet_miner_cartAI(Creature* creature) : PassiveAI(creature), _minerGUID(0), _playerGUID(0) + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetDisplayId(me->GetCreatureTemplate()->Modelid1); // Modelid2 is a horse. + } - uint64 minerGUID; + void JustSummoned(Creature* summon) + { + if (summon->GetEntry() == NPC_MINER) + { + _minerGUID = summon->GetGUID(); + summon->AI()->SetGUID(_playerGUID); + } + } - void SetGUID(uint64 guid, int32 /*id*/) - { - minerGUID = guid; - } + void SummonedCreatureDespawn(Creature* summon) + { + if (summon->GetEntry() == NPC_MINER) + _minerGUID = 0; + } - void DoAction(int32 /*param*/) - { - if (Creature* miner = Unit::GetCreature(*me, minerGUID)) + void DoAction(int32 /*param*/) { - me->SetWalk(false); + if (Creature* miner = ObjectAccessor::GetCreature(*me, _minerGUID)) + { + me->SetWalk(false); - //Not 100% correct, but movement is smooth. Sometimes miner walks faster - //than normal, this speed is fast enough to keep up at those times. - me->SetSpeed(MOVE_RUN, 1.25f); + // Not 100% correct, but movement is smooth. Sometimes miner walks faster + // than normal, this speed is fast enough to keep up at those times. + me->SetSpeed(MOVE_RUN, 1.25f); - me->GetMotionMaster()->MoveFollow(miner, 1.0f, 0); + me->GetMotionMaster()->MoveFollow(miner, 1.0f, 0); + } } - } - void PassengerBoarded(Unit* /*who*/, int8 /*seatId*/, bool apply) + void PassengerBoarded(Unit* who, int8 /*seatId*/, bool apply) + { + if (apply) + { + _playerGUID = who->GetGUID(); + me->CastSpell((Unit*)NULL, SPELL_SUMMON_MINER, true); + } + else + { + _playerGUID = 0; + if (Creature* miner = ObjectAccessor::GetCreature(*me, _minerGUID)) + miner->DespawnOrUnsummon(); + } + } + + private: + uint64 _minerGUID; + uint64 _playerGUID; + }; + + CreatureAI* GetAI(Creature* creature) const { - if (!apply) - if (Creature* miner = Unit::GetCreature(*me, minerGUID)) - miner->DisappearAndDie(); + return new npc_scarlet_miner_cartAI(creature); } - }; - }; /*#### @@ -928,166 +951,128 @@ enum Says_SM class npc_scarlet_miner : public CreatureScript { -public: - npc_scarlet_miner() : CreatureScript("npc_scarlet_miner") { } - - CreatureAI* GetAI(Creature* creature) const - { - return new npc_scarlet_minerAI(creature); - } + public: + npc_scarlet_miner() : CreatureScript("npc_scarlet_miner") { } - struct npc_scarlet_minerAI : public npc_escortAI - { - npc_scarlet_minerAI(Creature* creature) : npc_escortAI(creature) + struct npc_scarlet_minerAI : public npc_escortAI { - me->SetReactState(REACT_PASSIVE); - } + npc_scarlet_minerAI(Creature* creature) : npc_escortAI(creature) + { + me->SetReactState(REACT_PASSIVE); + } - uint32 IntroTimer; - uint32 IntroPhase; - uint64 carGUID; + uint32 IntroTimer; + uint32 IntroPhase; + uint64 carGUID; - void Reset() - { - carGUID = 0; - IntroTimer = 0; - IntroPhase = 0; - } + void Reset() + { + carGUID = 0; + IntroTimer = 0; + IntroPhase = 0; + } - void InitWaypoint() - { - AddWaypoint(1, 2389.03f, -5902.74f, 109.014f, 5000); - AddWaypoint(2, 2341.812012f, -5900.484863f, 102.619743f); - AddWaypoint(3, 2306.561279f, -5901.738281f, 91.792419f); - AddWaypoint(4, 2300.098389f, -5912.618652f, 86.014885f); - AddWaypoint(5, 2294.142090f, -5927.274414f, 75.316849f); - AddWaypoint(6, 2286.984375f, -5944.955566f, 63.714966f); - AddWaypoint(7, 2280.001709f, -5961.186035f, 54.228283f); - AddWaypoint(8, 2259.389648f, -5974.197754f, 42.359348f); - AddWaypoint(9, 2242.882812f, -5984.642578f, 32.827850f); - AddWaypoint(10, 2217.265625f, -6028.959473f, 7.675705f); - AddWaypoint(11, 2202.595947f, -6061.325684f, 5.882018f); - AddWaypoint(12, 2188.974609f, -6080.866699f, 3.370027f); - - if (urand(0, 1)) + void IsSummonedBy(Unit* summoner) { - AddWaypoint(13, 2176.483887f, -6110.407227f, 1.855181f); - AddWaypoint(14, 2172.516602f, -6146.752441f, 1.074235f); - AddWaypoint(15, 2138.918457f, -6158.920898f, 1.342926f); - AddWaypoint(16, 2129.866699f, -6174.107910f, 4.380779f); - AddWaypoint(17, 2117.709473f, -6193.830078f, 13.3542f, 10000); + carGUID = summoner->GetGUID(); } - else + + void InitWaypoint() { - AddWaypoint(13, 2184.190186f, -6166.447266f, 0.968877f); - AddWaypoint(14, 2234.265625f, -6163.741211f, 0.916021f); - AddWaypoint(15, 2268.071777f, -6158.750977f, 1.822252f); - AddWaypoint(16, 2270.028320f, -6176.505859f, 6.340538f); - AddWaypoint(17, 2271.739014f, -6195.401855f, 13.3542f, 10000); + AddWaypoint(1, 2389.03f, -5902.74f, 109.014f, 5000); + AddWaypoint(2, 2341.812012f, -5900.484863f, 102.619743f); + AddWaypoint(3, 2306.561279f, -5901.738281f, 91.792419f); + AddWaypoint(4, 2300.098389f, -5912.618652f, 86.014885f); + AddWaypoint(5, 2294.142090f, -5927.274414f, 75.316849f); + AddWaypoint(6, 2286.984375f, -5944.955566f, 63.714966f); + AddWaypoint(7, 2280.001709f, -5961.186035f, 54.228283f); + AddWaypoint(8, 2259.389648f, -5974.197754f, 42.359348f); + AddWaypoint(9, 2242.882812f, -5984.642578f, 32.827850f); + AddWaypoint(10, 2217.265625f, -6028.959473f, 7.675705f); + AddWaypoint(11, 2202.595947f, -6061.325684f, 5.882018f); + AddWaypoint(12, 2188.974609f, -6080.866699f, 3.370027f); + + if (urand(0, 1)) + { + AddWaypoint(13, 2176.483887f, -6110.407227f, 1.855181f); + AddWaypoint(14, 2172.516602f, -6146.752441f, 1.074235f); + AddWaypoint(15, 2138.918457f, -6158.920898f, 1.342926f); + AddWaypoint(16, 2129.866699f, -6174.107910f, 4.380779f); + AddWaypoint(17, 2117.709473f, -6193.830078f, 13.3542f, 10000); + } + else + { + AddWaypoint(13, 2184.190186f, -6166.447266f, 0.968877f); + AddWaypoint(14, 2234.265625f, -6163.741211f, 0.916021f); + AddWaypoint(15, 2268.071777f, -6158.750977f, 1.822252f); + AddWaypoint(16, 2270.028320f, -6176.505859f, 6.340538f); + AddWaypoint(17, 2271.739014f, -6195.401855f, 13.3542f, 10000); + } } - } - void InitCartQuest(Player* who) - { - carGUID = who->GetVehicleBase()->GetGUID(); - InitWaypoint(); - Start(false, false, who->GetGUID()); - SetDespawnAtFar(false); - } + void SetGUID(uint64 guid, int32 /*id = 0*/) + { + InitWaypoint(); + Start(false, false, guid); + SetDespawnAtFar(false); + } - void WaypointReached(uint32 waypointId) - { - switch (waypointId) + void WaypointReached(uint32 waypointId) { - case 1: - if (Unit* car = Unit::GetCreature(*me, carGUID)) - { - me->SetInFront(car); - me->SendMovementFlagUpdate(); - } - Talk(SAY_SCARLET_MINER_0); - SetRun(true); - IntroTimer = 4000; - IntroPhase = 1; - break; - case 17: - if (Unit* car = Unit::GetCreature(*me, carGUID)) - { - me->SetInFront(car); - me->SendMovementFlagUpdate(); - car->Relocate(car->GetPositionX(), car->GetPositionY(), me->GetPositionZ() + 1); - car->StopMoving(); - car->RemoveAura(SPELL_CART_DRAG); - } - Talk(SAY_SCARLET_MINER_1); - break; - default: - break; + switch (waypointId) + { + case 1: + if (Unit* car = ObjectAccessor::GetCreature(*me, carGUID)) + me->SetFacingToObject(car); + Talk(SAY_SCARLET_MINER_0); + SetRun(true); + IntroTimer = 4000; + IntroPhase = 1; + break; + case 17: + if (Unit* car = ObjectAccessor::GetCreature(*me, carGUID)) + { + me->SetFacingToObject(car); + car->RemoveAura(SPELL_CART_DRAG); + } + Talk(SAY_SCARLET_MINER_1); + break; + default: + break; + } } - } - void UpdateAI(uint32 diff) - { - if (IntroPhase) + void UpdateAI(uint32 diff) { - if (IntroTimer <= diff) + if (IntroPhase) { - if (IntroPhase == 1) + if (IntroTimer <= diff) { - if (Creature* car = Unit::GetCreature(*me, carGUID)) - DoCast(car, SPELL_CART_DRAG); - IntroTimer = 800; - IntroPhase = 2; + if (IntroPhase == 1) + { + if (Creature* car = Unit::GetCreature(*me, carGUID)) + DoCast(car, SPELL_CART_DRAG); + IntroTimer = 800; + IntroPhase = 2; + } + else + { + if (Creature* car = Unit::GetCreature(*me, carGUID)) + car->AI()->DoAction(0); + IntroPhase = 0; + } } else - { - if (Creature* car = Unit::GetCreature(*me, carGUID)) - car->AI()->DoAction(0); - IntroPhase = 0; - } - } else IntroTimer-=diff; + IntroTimer -= diff; + } + npc_escortAI::UpdateAI(diff); } - npc_escortAI::UpdateAI(diff); - } - }; - -}; - -/*###### -## go_inconspicuous_mine_car -######*/ + }; -enum Spells_Cart -{ - SPELL_CART_SUMM = 52463 -}; - -class go_inconspicuous_mine_car : public GameObjectScript -{ -public: - go_inconspicuous_mine_car() : GameObjectScript("go_inconspicuous_mine_car") { } - - bool OnGossipHello(Player* player, GameObject* /*go*/) - { - if (player->GetQuestStatus(12701) == QUEST_STATUS_INCOMPLETE) + CreatureAI* GetAI(Creature* creature) const { - // Hack Why Trinity Dont Support Custom Summon Location - if (Creature* miner = player->SummonCreature(28841, 2383.869629f, -5900.312500f, 107.996086f, player->GetOrientation(), TEMPSUMMON_DEAD_DESPAWN, 1)) - { - player->CastSpell(player, SPELL_CART_SUMM, true); - if (Creature* car = player->GetVehicleCreatureBase()) - { - if (car->GetEntry() == 28817) - { - car->AI()->SetGUID(miner->GetGUID()); - CAST_AI(npc_scarlet_miner::npc_scarlet_minerAI, miner->AI())->InitCartQuest(player); - } else sLog->outError(LOG_FILTER_TSCR, "OnGossipHello vehicle entry is not correct."); - } else sLog->outError(LOG_FILTER_TSCR, "OnGossipHello player is not on the vehicle."); - } else sLog->outError(LOG_FILTER_TSCR, "OnGossipHello Scarlet Miner cant be found by script."); + return new npc_scarlet_minerAI(creature); } - return true; - } - }; // npc 28912 quest 17217 boss 29001 mob 29007 go 191092 @@ -1105,5 +1090,4 @@ void AddSC_the_scarlet_enclave_c1() new npc_scarlet_ghoul(); new npc_scarlet_miner(); new npc_scarlet_miner_cart(); - new go_inconspicuous_mine_car(); } |