AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
go_brewfest_music::go_brewfest_musicAI Struct Reference
Inheritance diagram for go_brewfest_music::go_brewfest_musicAI:
GameObjectAI

Public Member Functions

 go_brewfest_musicAI (GameObject *go)
 
void UpdateAI (uint32 diff) override
 
- Public Member Functions inherited from GameObjectAI
 GameObjectAI (GameObject *go)
 
virtual ~GameObjectAI ()
 
virtual void UpdateAI (uint32)
 
virtual void InitializeAI ()
 
virtual void Reset ()
 
virtual void DoAction (int32)
 
virtual void SetGUID (ObjectGuid, int32)
 
virtual ObjectGuid GetGUID (int32) const
 
virtual bool GossipHello (Player *, bool)
 
virtual bool GossipSelect (Player *, uint32, uint32)
 
virtual bool GossipSelectCode (Player *, uint32, uint32, char const *)
 
virtual bool QuestAccept (Player *, Quest const *)
 
virtual bool QuestReward (Player *, Quest const *, uint32)
 
virtual uint32 GetDialogStatus (Player *)
 
virtual void Destroyed (Player *, uint32)
 
virtual uint32 GetData (uint32) const
 
virtual void SetData (uint32, uint32)
 
virtual void OnGameEvent (bool, uint16)
 
virtual void OnStateChanged (uint32, Unit *)
 
virtual void EventInform (uint32)
 
virtual void SpellHit (Unit *, SpellInfo const *)
 
virtual bool CanBeSeen (Player const *)
 
virtual void JustSummoned (Creature *)
 
virtual void SummonedCreatureDespawn (Creature *)
 
virtual void SummonedCreatureDies (Creature *, Unit *)
 
virtual void SummonedCreatureEvade (Creature *)
 

Private Attributes

EventMap _events
 
uint32 _currentMusicEvent
 

Additional Inherited Members

- Static Public Member Functions inherited from GameObjectAI
static int32 Permissible (GameObject const *go)
 
- Protected Attributes inherited from GameObjectAI
GameObject *const me
 

Detailed Description

Constructor & Destructor Documentation

◆ go_brewfest_musicAI()

go_brewfest_music::go_brewfest_musicAI::go_brewfest_musicAI ( GameObject go)
inline
575 : GameObjectAI(go)
576 {
580 }
@ EVENT_BM_SELECT_MUSIC
Definition: go_scripts.cpp:564
@ EVENT_BM_START_MUSIC
Definition: go_scripts.cpp:565
@ EVENT_BREWFESTGOBLIN01
Definition: go_scripts.cpp:531
void ScheduleEvent(uint32 eventId, uint32 time, uint32 group=0, uint32 phase=0)
Definition: EventMap.cpp:56
Definition: GameObjectAI.h:33
uint32 _currentMusicEvent
Definition: go_scripts.cpp:692
EventMap _events
Definition: go_scripts.cpp:691

References _currentMusicEvent, _events, EVENT_BM_SELECT_MUSIC, EVENT_BM_START_MUSIC, EVENT_BREWFESTGOBLIN01, and EventMap::ScheduleEvent().

Member Function Documentation

◆ UpdateAI()

void go_brewfest_music::go_brewfest_musicAI::UpdateAI ( uint32  diff)
inlineoverridevirtual

Reimplemented from GameObjectAI.

583 {
584 _events.Update(diff);
585 while (uint32 eventId = _events.ExecuteEvent())
586 {
587 switch (eventId)
588 {
590 {
591 if (!IsHolidayActive(HOLIDAY_BREWFEST)) // Check if Brewfest is active
592 break;
593 // Select random music sample
594 uint32 rnd = urand(0, 2);
595 uint32 musicTime = 1000;
596 //Restart the current selected music
598 //Check zone to play correct music
600 {
601 switch (rnd)
602 {
603 case 0:
605 musicTime = EVENT_BREWFESTGOBLIN01_TIME;
606 break;
607 case 1:
609 musicTime = EVENT_BREWFESTGOBLIN02_TIME;
610 break;
611 case 2:
613 musicTime = EVENT_BREWFESTGOBLIN03_TIME;
614 break;
615 default:
616 break;
617 }
618 }
619 else if (me->GetAreaId() == IRONFORGE_1 || me->GetAreaId() == IRONFORGE_2 || me->GetAreaId() == STORMWIND || me->GetAreaId() == EXODAR || me->GetAreaId() == DARNASSUS)
620 {
621 switch (rnd)
622 {
623 case 0:
625 musicTime = EVENT_BREWFESTDWARF01_TIME;
626 break;
627 case 1:
629 musicTime = EVENT_BREWFESTDWARF02_TIME;
630 break;
631 case 2:
633 musicTime = EVENT_BREWFESTDWARF03_TIME;
634 break;
635 default:
636 break;
637 }
638 }
639 else if (me->GetAreaId() == SHATTRATH)
640 {
641 rnd = urand(0, 5);
642 switch (rnd)
643 {
644 case 0:
646 musicTime = EVENT_BREWFESTGOBLIN01_TIME;
647 break;
648 case 1:
650 musicTime = EVENT_BREWFESTGOBLIN02_TIME;
651 break;
652 case 2:
654 musicTime = EVENT_BREWFESTGOBLIN03_TIME;
655 break;
656 case 3:
658 musicTime = EVENT_BREWFESTDWARF01_TIME;
659 break;
660 case 4:
662 musicTime = EVENT_BREWFESTDWARF02_TIME;
663 break;
664 case 5:
666 musicTime = EVENT_BREWFESTDWARF03_TIME;
667 break;
668 default:
669 break;
670 }
671 }
672 _events.ScheduleEvent(EVENT_BM_SELECT_MUSIC, musicTime); // Select new song music after play time is over
673 break;
674 }
676 if (!IsHolidayActive(HOLIDAY_BREWFEST)) // Check if Brewfest is active
677 break;
678 // Play selected music
679 if (_currentMusicEvent != 0)
680 {
682 }
683 _events.ScheduleEvent(EVENT_BM_START_MUSIC, 5000); // Every 5 second's SMSG_PLAY_MUSIC packet (PlayDirectMusic) is pushed to the client
684 break;
685 default:
686 break;
687 }
688 }
689 }
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:44
std::uint32_t uint32
Definition: Define.h:107
@ EVENT_BREWFESTGOBLIN03_TIME
Definition: go_scripts.cpp:544
@ EVENT_BREWFESTGOBLIN02_TIME
Definition: go_scripts.cpp:543
@ EVENT_BREWFESTGOBLIN01_TIME
Definition: go_scripts.cpp:542
@ EVENT_BREWFESTDWARF03_TIME
Definition: go_scripts.cpp:541
@ EVENT_BREWFESTDWARF01_TIME
Definition: go_scripts.cpp:539
@ EVENT_BREWFESTDWARF02_TIME
Definition: go_scripts.cpp:540
@ EVENT_BREWFESTGOBLIN03
Definition: go_scripts.cpp:533
@ EVENT_BREWFESTDWARF02
Definition: go_scripts.cpp:529
@ EVENT_BREWFESTDWARF01
Definition: go_scripts.cpp:528
@ EVENT_BREWFESTDWARF03
Definition: go_scripts.cpp:530
@ EVENT_BREWFESTGOBLIN02
Definition: go_scripts.cpp:532
@ UNDERCITY
Definition: go_scripts.cpp:550
@ IRONFORGE_1
Definition: go_scripts.cpp:554
@ ORGRIMMAR_2
Definition: go_scripts.cpp:552
@ SHATTRATH
Definition: go_scripts.cpp:559
@ IRONFORGE_2
Definition: go_scripts.cpp:555
@ THUNDERBLUFF
Definition: go_scripts.cpp:553
@ DARNASSUS
Definition: go_scripts.cpp:558
@ SILVERMOON
Definition: go_scripts.cpp:549
@ STORMWIND
Definition: go_scripts.cpp:556
@ EXODAR
Definition: go_scripts.cpp:557
@ ORGRIMMAR_1
Definition: go_scripts.cpp:551
@ HOLIDAY_BREWFEST
Definition: SharedDefines.h:2758
bool IsHolidayActive(HolidayIds id)
Definition: GameEventMgr.cpp:1909
uint32 ExecuteEvent()
Definition: EventMap.cpp:114
void Update(uint32 time)
Definition: EventMap.h:54
GameObject *const me
Definition: GameObjectAI.h:35
void PlayDirectMusic(uint32 music_id, Player *target=nullptr)
Definition: Object.cpp:2927
uint32 GetAreaId() const
Definition: Object.cpp:3165

References _currentMusicEvent, _events, DARNASSUS, EVENT_BM_SELECT_MUSIC, EVENT_BM_START_MUSIC, EVENT_BREWFESTDWARF01, EVENT_BREWFESTDWARF01_TIME, EVENT_BREWFESTDWARF02, EVENT_BREWFESTDWARF02_TIME, EVENT_BREWFESTDWARF03, EVENT_BREWFESTDWARF03_TIME, EVENT_BREWFESTGOBLIN01, EVENT_BREWFESTGOBLIN01_TIME, EVENT_BREWFESTGOBLIN02, EVENT_BREWFESTGOBLIN02_TIME, EVENT_BREWFESTGOBLIN03, EVENT_BREWFESTGOBLIN03_TIME, EventMap::ExecuteEvent(), EXODAR, WorldObject::GetAreaId(), HOLIDAY_BREWFEST, IRONFORGE_1, IRONFORGE_2, IsHolidayActive(), GameObjectAI::me, ORGRIMMAR_1, ORGRIMMAR_2, WorldObject::PlayDirectMusic(), EventMap::ScheduleEvent(), SHATTRATH, SILVERMOON, STORMWIND, THUNDERBLUFF, UNDERCITY, EventMap::Update(), and urand().

Member Data Documentation

◆ _currentMusicEvent

uint32 go_brewfest_music::go_brewfest_musicAI::_currentMusicEvent
private

Referenced by go_brewfest_musicAI(), and UpdateAI().

◆ _events

EventMap go_brewfest_music::go_brewfest_musicAI::_events
private

Referenced by go_brewfest_musicAI(), and UpdateAI().