@@ -538,42 +538,46 @@ class npc_icefang : public CreatureScript
538538 }
539539};
540540
541- enum HyldsmeetProtoDrake
542- {
543- NPC_HYLDSMEET_DRAKERIDER = 29694
544- };
545-
546541struct npc_hyldsmeet_protodrake : public CreatureAI
547542{
548- explicit npc_hyldsmeet_protodrake (Creature* creature) : CreatureAI(creature), _accessoryRespawnTimer(0 ) { }
543+ explicit npc_hyldsmeet_protodrake (Creature* creature) : CreatureAI(creature), _accessoryInstalled(false ), _accessoryRespawnTimer(0 )
544+ {
545+ me->SetUnitFlag2 (UNIT_FLAG2_PREVENT_SPELL_CLICK);
546+ }
549547
550548 void PassengerBoarded (Unit* who, int8 /* seat*/ , bool apply) override
551549 {
552- if (apply )
550+ if (who-> IsPlayer () )
553551 return ;
554552
555- if (who->GetEntry () == NPC_HYLDSMEET_DRAKERIDER)
553+ if (apply)
554+ _accessoryInstalled = true ;
555+ else
556+ {
557+ _accessoryInstalled = false ;
556558 _accessoryRespawnTimer = 5 * MINUTE * IN_MILLISECONDS;
559+ }
557560 }
558561
559562 void UpdateAI (uint32 diff) override
560563 {
561- // ! We need to manually reinstall accessories because the vehicle itself is friendly to players,
562- // ! so EnterEvadeMode is never triggered. The accessory on the other hand is hostile and killable.
564+ // We need to manually reinstall accessories because the vehicle itself is friendly to players,
565+ // so EnterEvadeMode is never triggered. The accessory on the other hand is hostile and killable.
566+ if (_accessoryInstalled)
567+ return ;
568+
563569 Vehicle* vehicleKit = me->GetVehicleKit ();
564- if (!vehicleKit || !_accessoryRespawnTimer )
570+ if (!vehicleKit)
565571 return ;
566572
567573 if (_accessoryRespawnTimer <= diff)
568- {
569574 vehicleKit->InstallAllAccessories (true );
570- _accessoryRespawnTimer = 0 ;
571- }
572575 else
573576 _accessoryRespawnTimer -= diff;
574577 }
575578
576579private:
580+ bool _accessoryInstalled;
577581 uint32 _accessoryRespawnTimer;
578582};
579583
0 commit comments