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
576 : GameObjectAI(go)
577 {
581 }
@ EVENT_BM_SELECT_MUSIC
Definition: go_scripts.cpp:565
@ EVENT_BM_START_MUSIC
Definition: go_scripts.cpp:566
@ EVENT_BREWFESTGOBLIN01
Definition: go_scripts.cpp:532
void ScheduleEvent(uint32 eventId, uint32 time, uint32 group=0, uint32 phase=0)
Definition: EventMap.cpp:56
Definition: GameObjectAI.h:34
uint32 _currentMusicEvent
Definition: go_scripts.cpp:693
EventMap _events
Definition: go_scripts.cpp:692

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.

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

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().