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
1791 : GameObjectAI(go), _soundId(0), once(true)
1792 {
1793 uint32 zoneId = go->GetZoneId();
1794
1795 switch (go->GetEntry())
1796 {
1797 case GO_HORDE_BELL:
1798 {
1799 switch (zoneId)
1800 {
1801 case TIRISFAL_ZONE:
1802 case UNDERCITY_ZONE:
1804 case DUSKWOOD_ZONE:
1806 break;
1807 default:
1809 break;
1810 }
1811 break;
1812 }
1813 case GO_ALLIANCE_BELL:
1814 {
1815 switch (zoneId)
1816 {
1817 case IRONFORGE_ZONE:
1818 case DUN_MOROGH_ZONE:
1820 break;
1821 case DARNASSUS_ZONE:
1822 case TELDRASSIL_ZONE:
1823 case ASHENVALE_ZONE:
1824 case SHATTRATH_ZONE:
1826 break;
1827 case WESTFALL_ZONE:
1829 {
1831 }
1832 else
1833 {
1835 }
1836 break;
1838 if (go->GetAreaId() == AREA_ALCAZ_ISLAND)
1839 {
1841 }
1842 else
1843 {
1845 }
1846 break;
1847 default:
1849 break;
1850 }
1851 break;
1852 }
1853 case GO_KHARAZHAN_BELL:
1854 {
1856 break;
1857 }
1858 break;
1859 }
1860 }
std::uint32_t uint32
Definition: Define.h:108
@ GO_ALLIANCE_BELL
Definition: go_scripts.cpp:1773
@ GO_KHARAZHAN_BELL
Definition: go_scripts.cpp:1774
@ GO_HORDE_BELL
Definition: go_scripts.cpp:1772
@ DUSTWALLOW_MARSH_ZONE
Definition: go_scripts.cpp:1760
@ HILLSBRAD_FOOTHILLS_ZONE
Definition: go_scripts.cpp:1757
@ TIRISFAL_ZONE
Definition: go_scripts.cpp:1750
@ ASHENVALE_ZONE
Definition: go_scripts.cpp:1756
@ DUSKWOOD_ZONE
Definition: go_scripts.cpp:1758
@ TELDRASSIL_ZONE
Definition: go_scripts.cpp:1754
@ IRONFORGE_ZONE
Definition: go_scripts.cpp:1753
@ WESTFALL_ZONE
Definition: go_scripts.cpp:1759
@ DARNASSUS_ZONE
Definition: go_scripts.cpp:1755
@ SHATTRATH_ZONE
Definition: go_scripts.cpp:1761
@ DUN_MOROGH_ZONE
Definition: go_scripts.cpp:1752
@ UNDERCITY_ZONE
Definition: go_scripts.cpp:1751
@ LIGHTHOUSEFOGHORN
Definition: go_scripts.cpp:1745
@ BELLTOLLNIGHTELF
Definition: go_scripts.cpp:1742
@ BELLTOLLALLIANCE
Definition: go_scripts.cpp:1741
@ BELLTOLLKHARAZHAN
Definition: go_scripts.cpp:1744
@ BELLTOLLHORDE
Definition: go_scripts.cpp:1739
@ BELLTOLLTRIBAL
Definition: go_scripts.cpp:1740
@ BELLTOLLDWARFGNOME
Definition: go_scripts.cpp:1743
@ AREA_ALCAZ_ISLAND
Definition: go_scripts.cpp:1766
@ AREA_WESTFALL_LIGHTHOUSE
Definition: go_scripts.cpp:1767
Definition: GameObjectAI.h:34
uint32 GetEntry() const
Definition: Object.h:109
uint32 GetAreaId() const
Definition: Object.cpp:3083
uint32 GetZoneId() const
Definition: Object.cpp:3075
uint32 _soundId
Definition: go_scripts.cpp:1910
bool once
Definition: go_scripts.cpp:1911

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.

1863 {
1864 _events.Update(diff);
1865
1866 if (sGameEventMgr->IsActiveEvent(GAME_EVENT_HOURLY_BELLS) && once)
1867 {
1868 // Reset
1869 once = false;
1871 }
1872
1873 while (uint32 eventId = _events.ExecuteEvent())
1874 {
1875 switch (eventId)
1876 {
1877 case EVENT_TIME:
1878 {
1879 tzset(); // set timezone for localtime_r() -> fix issues due to daylight time
1880 tm local_tm = Acore::Time::TimeBreakdown();
1881 uint8 _rings = (local_tm.tm_hour) % 12;
1882 _rings = (_rings == 0) ? 12 : _rings; // 00:00 and 12:00
1883
1884 // Dwarf hourly horn should only play a single time, each time the next hour begins.
1886 {
1887 _rings = 1;
1888 }
1889
1890 // Schedule ring event
1891 for (auto i = 0; i < _rings; ++i)
1892 {
1893 _events.ScheduleEvent(EVENT_RING_BELL, (i * 4 + 1) * 1000);
1894 }
1895 break;
1896 }
1897 case EVENT_RING_BELL:
1898 {
1900 break;
1901 }
1902 default:
1903 break;
1904 }
1905 }
1906 }
std::uint8_t uint8
Definition: Define.h:110
#define sGameEventMgr
Definition: GameEventMgr.h:186
@ EVENT_TIME
Definition: go_scripts.cpp:1781
@ GAME_EVENT_HOURLY_BELLS
Definition: go_scripts.cpp:1779
@ EVENT_RING_BELL
Definition: go_scripts.cpp:1780
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:2853
EventMap _events
Definition: go_scripts.cpp:1909

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