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

Public Member Functions

 go_bellsAI (GameObject *go)
 
void UpdateAI (uint32 const 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 *)
 

Private Attributes

EventMap _events
 
uint32 _soundId
 
bool once
 

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

go_bells::go_bellsAI::go_bellsAI ( GameObject go)
inline
1744 : GameObjectAI(go), _soundId(0), once(true)
1745 {
1746 uint32 zoneId = go->GetZoneId();
1747
1748 switch (go->GetEntry())
1749 {
1750 case GO_HORDE_BELL:
1751 {
1752 switch (zoneId)
1753 {
1754 case TIRISFAL_ZONE:
1755 case UNDERCITY_ZONE:
1757 case DUSKWOOD_ZONE:
1759 break;
1760 default:
1762 break;
1763 }
1764 break;
1765 }
1766 case GO_ALLIANCE_BELL:
1767 {
1768 switch (zoneId)
1769 {
1770 case IRONFORGE_ZONE:
1771 case DUN_MOROGH_ZONE:
1773 break;
1774 case DARNASSUS_ZONE:
1775 case TELDRASSIL_ZONE:
1776 case ASHENVALE_ZONE:
1777 case SHATTRATH_ZONE:
1779 break;
1780 case WESTFALL_ZONE:
1782 {
1784 }
1785 else
1786 {
1788 }
1789 break;
1791 if (go->GetAreaId() == AREA_ALCAZ_ISLAND)
1792 {
1794 }
1795 else
1796 {
1798 }
1799 break;
1800 default:
1802 break;
1803 }
1804 break;
1805 }
1806 case GO_KHARAZHAN_BELL:
1807 {
1809 break;
1810 }
1811 break;
1812 }
1813 }
std::uint32_t uint32
Definition: Define.h:108
@ GO_ALLIANCE_BELL
Definition: go_scripts.cpp:1726
@ GO_KHARAZHAN_BELL
Definition: go_scripts.cpp:1727
@ GO_HORDE_BELL
Definition: go_scripts.cpp:1725
@ DUSTWALLOW_MARSH_ZONE
Definition: go_scripts.cpp:1713
@ HILLSBRAD_FOOTHILLS_ZONE
Definition: go_scripts.cpp:1710
@ TIRISFAL_ZONE
Definition: go_scripts.cpp:1703
@ ASHENVALE_ZONE
Definition: go_scripts.cpp:1709
@ DUSKWOOD_ZONE
Definition: go_scripts.cpp:1711
@ TELDRASSIL_ZONE
Definition: go_scripts.cpp:1707
@ IRONFORGE_ZONE
Definition: go_scripts.cpp:1706
@ WESTFALL_ZONE
Definition: go_scripts.cpp:1712
@ DARNASSUS_ZONE
Definition: go_scripts.cpp:1708
@ SHATTRATH_ZONE
Definition: go_scripts.cpp:1714
@ DUN_MOROGH_ZONE
Definition: go_scripts.cpp:1705
@ UNDERCITY_ZONE
Definition: go_scripts.cpp:1704
@ LIGHTHOUSEFOGHORN
Definition: go_scripts.cpp:1698
@ BELLTOLLNIGHTELF
Definition: go_scripts.cpp:1695
@ BELLTOLLALLIANCE
Definition: go_scripts.cpp:1694
@ BELLTOLLKHARAZHAN
Definition: go_scripts.cpp:1697
@ BELLTOLLHORDE
Definition: go_scripts.cpp:1692
@ BELLTOLLTRIBAL
Definition: go_scripts.cpp:1693
@ BELLTOLLDWARFGNOME
Definition: go_scripts.cpp:1696
@ AREA_ALCAZ_ISLAND
Definition: go_scripts.cpp:1719
@ AREA_WESTFALL_LIGHTHOUSE
Definition: go_scripts.cpp:1720
Definition: GameObjectAI.h:34
uint32 GetEntry() const
Definition: Object.h:109
uint32 GetAreaId() const
Definition: Object.cpp:3108
uint32 GetZoneId() const
Definition: Object.cpp:3100
uint32 _soundId
Definition: go_scripts.cpp:1863
bool once
Definition: go_scripts.cpp:1864

References _soundId, AREA_ALCAZ_ISLAND, AREA_WESTFALL_LIGHTHOUSE, ASHENVALE_ZONE, BELLTOLLALLIANCE, BELLTOLLDWARFGNOME, BELLTOLLHORDE, BELLTOLLKHARAZHAN, BELLTOLLNIGHTELF, BELLTOLLTRIBAL, DARNASSUS_ZONE, DUN_MOROGH_ZONE, DUSKWOOD_ZONE, DUSTWALLOW_MARSH_ZONE, WorldObject::GetAreaId(), Object::GetEntry(), WorldObject::GetZoneId(), GO_ALLIANCE_BELL, GO_HORDE_BELL, GO_KHARAZHAN_BELL, HILLSBRAD_FOOTHILLS_ZONE, IRONFORGE_ZONE, LIGHTHOUSEFOGHORN, SHATTRATH_ZONE, TELDRASSIL_ZONE, TIRISFAL_ZONE, UNDERCITY_ZONE, and WESTFALL_ZONE.

Member Function Documentation

◆ UpdateAI()

void go_bells::go_bellsAI::UpdateAI ( uint32 const  diff)
inlineoverridevirtual

Reimplemented from GameObjectAI.

1816 {
1817 _events.Update(diff);
1818
1819 if (sGameEventMgr->IsActiveEvent(GAME_EVENT_HOURLY_BELLS) && once)
1820 {
1821 // Reset
1822 once = false;
1824 }
1825
1826 while (uint32 eventId = _events.ExecuteEvent())
1827 {
1828 switch (eventId)
1829 {
1830 case EVENT_TIME:
1831 {
1832 tzset(); // set timezone for localtime_r() -> fix issues due to daylight time
1833 tm local_tm = Acore::Time::TimeBreakdown();
1834 uint8 _rings = (local_tm.tm_hour) % 12;
1835 _rings = (_rings == 0) ? 12 : _rings; // 00:00 and 12:00
1836
1837 // Dwarf hourly horn should only play a single time, each time the next hour begins.
1839 {
1840 _rings = 1;
1841 }
1842
1843 // Schedule ring event
1844 for (auto i = 0; i < _rings; ++i)
1845 {
1846 _events.ScheduleEvent(EVENT_RING_BELL, (i * 4 + 1) * 1000);
1847 }
1848 break;
1849 }
1850 case EVENT_RING_BELL:
1851 {
1853 break;
1854 }
1855 default:
1856 break;
1857 }
1858 }
1859 }
std::uint8_t uint8
Definition: Define.h:110
#define sGameEventMgr
Definition: GameEventMgr.h:186
@ EVENT_TIME
Definition: go_scripts.cpp:1734
@ GAME_EVENT_HOURLY_BELLS
Definition: go_scripts.cpp:1732
@ EVENT_RING_BELL
Definition: go_scripts.cpp:1733
AC_COMMON_API std::tm TimeBreakdown(time_t t=0)
Definition: Timer.cpp:233
uint32 ExecuteEvent()
Definition: EventMap.cpp:114
void Update(uint32 time)
Definition: EventMap.h:54
void ScheduleEvent(uint32 eventId, uint32 time, uint32 group=0, uint32 phase=0)
Definition: EventMap.cpp:56
GameObject *const me
Definition: GameObjectAI.h:36
void PlayDirectSound(uint32 sound_id, Player *target=nullptr)
Definition: Object.cpp:2878
EventMap _events
Definition: go_scripts.cpp:1862

References _events, _soundId, BELLTOLLDWARFGNOME, EVENT_RING_BELL, EVENT_TIME, EventMap::ExecuteEvent(), GAME_EVENT_HOURLY_BELLS, GameObjectAI::me, once, WorldObject::PlayDirectSound(), EventMap::ScheduleEvent(), sGameEventMgr, Acore::Time::TimeBreakdown(), and EventMap::Update().

Member Data Documentation

◆ _events

EventMap go_bells::go_bellsAI::_events
private

Referenced by UpdateAI().

◆ _soundId

uint32 go_bells::go_bellsAI::_soundId
private

Referenced by go_bellsAI(), and UpdateAI().

◆ once

bool go_bells::go_bellsAI::once
private

Referenced by UpdateAI().