@@ -57,6 +57,9 @@ eventMgr(NULL),
5757
5858ServerEventBindings(NULL ),
5959PlayerEventBindings(NULL ),
60+ #if defined ELUNA_PLAYERBOTS
61+ PlayerbotAIEventBindings (NULL ),
62+ #endif
6063GuildEventBindings (NULL ),
6164GroupEventBindings(NULL ),
6265VehicleEventBindings(NULL ),
@@ -181,6 +184,9 @@ void Eluna::CreateBindStores()
181184
182185 ServerEventBindings = new BindingMap< EventKey<Hooks::ServerEvents> >(L);
183186 PlayerEventBindings = new BindingMap< EventKey<Hooks::PlayerEvents> >(L);
187+ #if defined ELUNA_PLAYERBOTS
188+ PlayerbotAIEventBindings = new BindingMap< StringKey<Hooks::PlayerbotAIEvents> >(L);
189+ #endif
184190 GuildEventBindings = new BindingMap< EventKey<Hooks::GuildEvents> >(L);
185191 GroupEventBindings = new BindingMap< EventKey<Hooks::GroupEvents> >(L);
186192 VehicleEventBindings = new BindingMap< EventKey<Hooks::VehicleEvents> >(L);
@@ -205,6 +211,9 @@ void Eluna::DestroyBindStores()
205211{
206212 delete ServerEventBindings;
207213 delete PlayerEventBindings;
214+ #if defined ELUNA_PLAYERBOTS
215+ delete PlayerbotAIEventBindings;
216+ #endif
208217 delete GuildEventBindings;
209218 delete GroupEventBindings;
210219 delete VehicleEventBindings;
@@ -226,6 +235,9 @@ void Eluna::DestroyBindStores()
226235
227236 ServerEventBindings = NULL ;
228237 PlayerEventBindings = NULL ;
238+ #if defined ELUNA_PLAYERBOTS
239+ PlayerbotAIEventBindings = NULL ;
240+ #endif
229241 GuildEventBindings = NULL ;
230242 GroupEventBindings = NULL ;
231243 VehicleEventBindings = NULL ;
@@ -732,7 +744,11 @@ static void createCancelCallback(Eluna* e, uint64 bindingID, BindingMap<K>* bind
732744}
733745
734746// Saves the function reference ID given to the register type's store for given entry under the given event
735- int Eluna::Register (uint8 regtype, uint32 entry, ObjectGuid guid, uint32 instanceId, uint32 event_id, int functionRef, uint32 shots)
747+ int Eluna::Register (uint8 regtype, uint32 entry, ObjectGuid guid, uint32 instanceId, uint32 event_id, int functionRef, uint32 shots
748+ #if defined ELUNA_PLAYERBOTS
749+ , std::string qualifier
750+ #endif
751+ )
736752{
737753 uint64 bindingID;
738754
@@ -768,6 +784,18 @@ int Eluna::Register(uint8 regtype, uint32 entry, ObjectGuid guid, uint32 instanc
768784 }
769785 break ;
770786
787+ #if defined ELUNA_PLAYERBOTS
788+ case Hooks::REGTYPE_PLAYERBOTAI:
789+ if (event_id < Hooks::PLAYERBOTAI_EVENT_COUNT)
790+ {
791+ auto key = StringKey<Hooks::PlayerbotAIEvents>((Hooks::PlayerbotAIEvents)event_id, qualifier);
792+ bindingID = PlayerbotAIEventBindings->Insert (key, functionRef, shots);
793+ createCancelCallback (this , bindingID, PlayerbotAIEventBindings);
794+ return 1 ; // Stack: callback
795+ }
796+ break ;
797+ #endif
798+
771799 case Hooks::REGTYPE_GROUP:
772800 if (event_id < Hooks::GROUP_EVENT_COUNT)
773801 {
0 commit comments