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 *)
 
virtual void SummonedCreatureEvade (Creature *)
 

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
1796 : GameObjectAI(go), _soundId(0), once(true)
1797 {
1798 uint32 zoneId = go->GetZoneId();
1799
1800 switch (go->GetEntry())
1801 {
1802 case GO_HORDE_BELL:
1803 {
1804 switch (zoneId)
1805 {
1806 case TIRISFAL_ZONE:
1807 case UNDERCITY_ZONE:
1809 case DUSKWOOD_ZONE:
1811 break;
1812 default:
1814 break;
1815 }
1816 break;
1817 }
1818 case GO_ALLIANCE_BELL:
1819 {
1820 switch (zoneId)
1821 {
1822 case IRONFORGE_ZONE:
1823 case DUN_MOROGH_ZONE:
1825 break;
1826 case DARNASSUS_ZONE:
1827 case TELDRASSIL_ZONE:
1828 case ASHENVALE_ZONE:
1829 case SHATTRATH_ZONE:
1831 break;
1832 case WESTFALL_ZONE:
1834 {
1836 }
1837 else
1838 {
1840 }
1841 break;
1843 if (go->GetAreaId() == AREA_ALCAZ_ISLAND)
1844 {
1846 }
1847 else
1848 {
1850 }
1851 break;
1852 default:
1854 break;
1855 }
1856 break;
1857 }
1858 case GO_KHARAZHAN_BELL:
1859 {
1861 break;
1862 }
1863 break;
1864 }
1865 }
std::uint32_t uint32
Definition: Define.h:107
@ GO_ALLIANCE_BELL
Definition: go_scripts.cpp:1778
@ GO_KHARAZHAN_BELL
Definition: go_scripts.cpp:1779
@ GO_HORDE_BELL
Definition: go_scripts.cpp:1777
@ DUSTWALLOW_MARSH_ZONE
Definition: go_scripts.cpp:1765
@ HILLSBRAD_FOOTHILLS_ZONE
Definition: go_scripts.cpp:1762
@ TIRISFAL_ZONE
Definition: go_scripts.cpp:1755
@ ASHENVALE_ZONE
Definition: go_scripts.cpp:1761
@ DUSKWOOD_ZONE
Definition: go_scripts.cpp:1763
@ TELDRASSIL_ZONE
Definition: go_scripts.cpp:1759
@ IRONFORGE_ZONE
Definition: go_scripts.cpp:1758
@ WESTFALL_ZONE
Definition: go_scripts.cpp:1764
@ DARNASSUS_ZONE
Definition: go_scripts.cpp:1760
@ SHATTRATH_ZONE
Definition: go_scripts.cpp:1766
@ DUN_MOROGH_ZONE
Definition: go_scripts.cpp:1757
@ UNDERCITY_ZONE
Definition: go_scripts.cpp:1756
@ LIGHTHOUSEFOGHORN
Definition: go_scripts.cpp:1750
@ BELLTOLLNIGHTELF
Definition: go_scripts.cpp:1747
@ BELLTOLLALLIANCE
Definition: go_scripts.cpp:1746
@ BELLTOLLKHARAZHAN
Definition: go_scripts.cpp:1749
@ BELLTOLLHORDE
Definition: go_scripts.cpp:1744
@ BELLTOLLTRIBAL
Definition: go_scripts.cpp:1745
@ BELLTOLLDWARFGNOME
Definition: go_scripts.cpp:1748
@ AREA_ALCAZ_ISLAND
Definition: go_scripts.cpp:1771
@ AREA_WESTFALL_LIGHTHOUSE
Definition: go_scripts.cpp:1772
Definition: GameObjectAI.h:34
uint32 GetEntry() const
Definition: Object.h:112
uint32 GetAreaId() const
Definition: Object.cpp:3152
uint32 GetZoneId() const
Definition: Object.cpp:3144
uint32 _soundId
Definition: go_scripts.cpp:1915
bool once
Definition: go_scripts.cpp:1916

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.

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

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