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
1795 : GameObjectAI(go), _soundId(0), once(true)
1796 {
1797 uint32 zoneId = go->GetZoneId();
1798
1799 switch (go->GetEntry())
1800 {
1801 case GO_HORDE_BELL:
1802 {
1803 switch (zoneId)
1804 {
1805 case TIRISFAL_ZONE:
1806 case UNDERCITY_ZONE:
1808 case DUSKWOOD_ZONE:
1810 break;
1811 default:
1813 break;
1814 }
1815 break;
1816 }
1817 case GO_ALLIANCE_BELL:
1818 {
1819 switch (zoneId)
1820 {
1821 case IRONFORGE_ZONE:
1822 case DUN_MOROGH_ZONE:
1824 break;
1825 case DARNASSUS_ZONE:
1826 case TELDRASSIL_ZONE:
1827 case ASHENVALE_ZONE:
1828 case SHATTRATH_ZONE:
1830 break;
1831 case WESTFALL_ZONE:
1833 {
1835 }
1836 else
1837 {
1839 }
1840 break;
1842 if (go->GetAreaId() == AREA_ALCAZ_ISLAND)
1843 {
1845 }
1846 else
1847 {
1849 }
1850 break;
1851 default:
1853 break;
1854 }
1855 break;
1856 }
1857 case GO_KHARAZHAN_BELL:
1858 {
1860 break;
1861 }
1862 break;
1863 }
1864 }
std::uint32_t uint32
Definition: Define.h:107
@ GO_ALLIANCE_BELL
Definition: go_scripts.cpp:1777
@ GO_KHARAZHAN_BELL
Definition: go_scripts.cpp:1778
@ GO_HORDE_BELL
Definition: go_scripts.cpp:1776
@ DUSTWALLOW_MARSH_ZONE
Definition: go_scripts.cpp:1764
@ HILLSBRAD_FOOTHILLS_ZONE
Definition: go_scripts.cpp:1761
@ TIRISFAL_ZONE
Definition: go_scripts.cpp:1754
@ ASHENVALE_ZONE
Definition: go_scripts.cpp:1760
@ DUSKWOOD_ZONE
Definition: go_scripts.cpp:1762
@ TELDRASSIL_ZONE
Definition: go_scripts.cpp:1758
@ IRONFORGE_ZONE
Definition: go_scripts.cpp:1757
@ WESTFALL_ZONE
Definition: go_scripts.cpp:1763
@ DARNASSUS_ZONE
Definition: go_scripts.cpp:1759
@ SHATTRATH_ZONE
Definition: go_scripts.cpp:1765
@ DUN_MOROGH_ZONE
Definition: go_scripts.cpp:1756
@ UNDERCITY_ZONE
Definition: go_scripts.cpp:1755
@ LIGHTHOUSEFOGHORN
Definition: go_scripts.cpp:1749
@ BELLTOLLNIGHTELF
Definition: go_scripts.cpp:1746
@ BELLTOLLALLIANCE
Definition: go_scripts.cpp:1745
@ BELLTOLLKHARAZHAN
Definition: go_scripts.cpp:1748
@ BELLTOLLHORDE
Definition: go_scripts.cpp:1743
@ BELLTOLLTRIBAL
Definition: go_scripts.cpp:1744
@ BELLTOLLDWARFGNOME
Definition: go_scripts.cpp:1747
@ AREA_ALCAZ_ISLAND
Definition: go_scripts.cpp:1770
@ AREA_WESTFALL_LIGHTHOUSE
Definition: go_scripts.cpp:1771
Definition: GameObjectAI.h:33
uint32 GetEntry() const
Definition: Object.h:115
uint32 GetAreaId() const
Definition: Object.cpp:3165
uint32 GetZoneId() const
Definition: Object.cpp:3157
uint32 _soundId
Definition: go_scripts.cpp:1914
bool once
Definition: go_scripts.cpp:1915

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.

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

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