@@ -1200,7 +1200,7 @@ namespace LuaGlobalFunctions
12001200 */
12011201 int RegisterUniqueCreatureEvent (Eluna* E)
12021202 {
1203- return RegisterUniqueHelper (E, Hooks::REGTYPE_CREATURE );
1203+ return RegisterUniqueHelper (E, Hooks::REGTYPE_CREATURE_UNIQUE );
12041204 }
12051205
12061206 /* *
@@ -2686,15 +2686,16 @@ namespace LuaGlobalFunctions
26862686 int ClearBattleGroundEvents (Eluna* E)
26872687 {
26882688 typedef EventKey<Hooks::BGEvents> Key;
2689+ auto binding = E->GetBinding <Key>(Hooks::REGTYPE_BG);
26892690
26902691 if (lua_isnoneornil (E->L , 1 ))
26912692 {
2692- E-> BGEventBindings ->Clear ();
2693+ binding ->Clear ();
26932694 }
26942695 else
26952696 {
26962697 uint32 event_type = E->CHECKVAL <uint32>(1 );
2697- E-> BGEventBindings ->Clear (Key ((Hooks::BGEvents)event_type));
2698+ binding ->Clear (Key ((Hooks::BGEvents)event_type));
26982699 }
26992700 return 0 ;
27002701 }
@@ -2717,19 +2718,20 @@ namespace LuaGlobalFunctions
27172718 int ClearCreatureEvents (Eluna* E)
27182719 {
27192720 typedef EntryKey<Hooks::CreatureEvents> Key;
2721+ auto binding = E->GetBinding <Key>(Hooks::REGTYPE_CREATURE);
27202722
27212723 if (lua_isnoneornil (E->L , 2 ))
27222724 {
27232725 uint32 entry = E->CHECKVAL <uint32>(1 );
27242726
27252727 for (uint32 i = 1 ; i < Hooks::CREATURE_EVENT_COUNT; ++i)
2726- E-> CreatureEventBindings ->Clear (Key ((Hooks::CreatureEvents)i, entry));
2728+ binding ->Clear (Key ((Hooks::CreatureEvents)i, entry));
27272729 }
27282730 else
27292731 {
27302732 uint32 entry = E->CHECKVAL <uint32>(1 );
27312733 uint32 event_type = E->CHECKVAL <uint32>(2 );
2732- E-> CreatureEventBindings ->Clear (Key ((Hooks::CreatureEvents)event_type, entry));
2734+ binding ->Clear (Key ((Hooks::CreatureEvents)event_type, entry));
27332735 }
27342736 return 0 ;
27352737 }
@@ -2753,21 +2755,22 @@ namespace LuaGlobalFunctions
27532755 int ClearUniqueCreatureEvents (Eluna* E)
27542756 {
27552757 typedef UniqueObjectKey<Hooks::CreatureEvents> Key;
2758+ auto binding = E->GetBinding <Key>(Hooks::REGTYPE_CREATURE_UNIQUE);
27562759
27572760 if (lua_isnoneornil (E->L , 3 ))
27582761 {
27592762 ObjectGuid guid = E->CHECKVAL <ObjectGuid>(1 );
27602763 uint32 instanceId = E->CHECKVAL <uint32>(2 );
27612764
27622765 for (uint32 i = 1 ; i < Hooks::CREATURE_EVENT_COUNT; ++i)
2763- E-> CreatureUniqueBindings ->Clear (Key ((Hooks::CreatureEvents)i, guid, instanceId));
2766+ binding ->Clear (Key ((Hooks::CreatureEvents)i, guid, instanceId));
27642767 }
27652768 else
27662769 {
27672770 ObjectGuid guid = E->CHECKVAL <ObjectGuid>(1 );
27682771 uint32 instanceId = E->CHECKVAL <uint32>(2 );
27692772 uint32 event_type = E->CHECKVAL <uint32>(3 );
2770- E-> CreatureUniqueBindings ->Clear (Key ((Hooks::CreatureEvents)event_type, guid, instanceId));
2773+ binding ->Clear (Key ((Hooks::CreatureEvents)event_type, guid, instanceId));
27712774 }
27722775 return 0 ;
27732776 }
@@ -2790,19 +2793,20 @@ namespace LuaGlobalFunctions
27902793 int ClearCreatureGossipEvents (Eluna* E)
27912794 {
27922795 typedef EntryKey<Hooks::GossipEvents> Key;
2796+ auto binding = E->GetBinding <Key>(Hooks::REGTYPE_CREATURE_GOSSIP);
27932797
27942798 if (lua_isnoneornil (E->L , 2 ))
27952799 {
27962800 uint32 entry = E->CHECKVAL <uint32>(1 );
27972801
27982802 for (uint32 i = 1 ; i < Hooks::GOSSIP_EVENT_COUNT; ++i)
2799- E-> CreatureGossipBindings ->Clear (Key ((Hooks::GossipEvents)i, entry));
2803+ binding ->Clear (Key ((Hooks::GossipEvents)i, entry));
28002804 }
28012805 else
28022806 {
28032807 uint32 entry = E->CHECKVAL <uint32>(1 );
28042808 uint32 event_type = E->CHECKVAL <uint32>(2 );
2805- E-> CreatureGossipBindings ->Clear (Key ((Hooks::GossipEvents)event_type, entry));
2809+ binding ->Clear (Key ((Hooks::GossipEvents)event_type, entry));
28062810 }
28072811 return 0 ;
28082812 }
@@ -2825,19 +2829,20 @@ namespace LuaGlobalFunctions
28252829 int ClearGameObjectEvents (Eluna* E)
28262830 {
28272831 typedef EntryKey<Hooks::GameObjectEvents> Key;
2832+ auto binding = E->GetBinding <Key>(Hooks::REGTYPE_GAMEOBJECT);
28282833
28292834 if (lua_isnoneornil (E->L , 2 ))
28302835 {
28312836 uint32 entry = E->CHECKVAL <uint32>(1 );
28322837
28332838 for (uint32 i = 1 ; i < Hooks::GAMEOBJECT_EVENT_COUNT; ++i)
2834- E-> GameObjectEventBindings ->Clear (Key ((Hooks::GameObjectEvents)i, entry));
2839+ binding ->Clear (Key ((Hooks::GameObjectEvents)i, entry));
28352840 }
28362841 else
28372842 {
28382843 uint32 entry = E->CHECKVAL <uint32>(1 );
28392844 uint32 event_type = E->CHECKVAL <uint32>(2 );
2840- E-> GameObjectEventBindings ->Clear (Key ((Hooks::GameObjectEvents)event_type, entry));
2845+ binding ->Clear (Key ((Hooks::GameObjectEvents)event_type, entry));
28412846 }
28422847 return 0 ;
28432848 }
@@ -2860,19 +2865,20 @@ namespace LuaGlobalFunctions
28602865 int ClearGameObjectGossipEvents (Eluna* E)
28612866 {
28622867 typedef EntryKey<Hooks::GossipEvents> Key;
2868+ auto binding = E->GetBinding <Key>(Hooks::REGTYPE_GAMEOBJECT_GOSSIP);
28632869
28642870 if (lua_isnoneornil (E->L , 2 ))
28652871 {
28662872 uint32 entry = E->CHECKVAL <uint32>(1 );
28672873
28682874 for (uint32 i = 1 ; i < Hooks::GOSSIP_EVENT_COUNT; ++i)
2869- E-> GameObjectGossipBindings ->Clear (Key ((Hooks::GossipEvents)i, entry));
2875+ binding ->Clear (Key ((Hooks::GossipEvents)i, entry));
28702876 }
28712877 else
28722878 {
28732879 uint32 entry = E->CHECKVAL <uint32>(1 );
28742880 uint32 event_type = E->CHECKVAL <uint32>(2 );
2875- E-> GameObjectGossipBindings ->Clear (Key ((Hooks::GossipEvents)event_type, entry));
2881+ binding ->Clear (Key ((Hooks::GossipEvents)event_type, entry));
28762882 }
28772883 return 0 ;
28782884 }
@@ -2891,15 +2897,16 @@ namespace LuaGlobalFunctions
28912897 int ClearGroupEvents (Eluna* E)
28922898 {
28932899 typedef EventKey<Hooks::GroupEvents> Key;
2900+ auto binding = E->GetBinding <Key>(Hooks::REGTYPE_GROUP);
28942901
28952902 if (lua_isnoneornil (E->L , 1 ))
28962903 {
2897- E-> GroupEventBindings ->Clear ();
2904+ binding ->Clear ();
28982905 }
28992906 else
29002907 {
29012908 uint32 event_type = E->CHECKVAL <uint32>(1 );
2902- E-> GroupEventBindings ->Clear (Key ((Hooks::GroupEvents)event_type));
2909+ binding ->Clear (Key ((Hooks::GroupEvents)event_type));
29032910 }
29042911 return 0 ;
29052912 }
@@ -2918,15 +2925,16 @@ namespace LuaGlobalFunctions
29182925 int ClearGuildEvents (Eluna* E)
29192926 {
29202927 typedef EventKey<Hooks::GuildEvents> Key;
2928+ auto binding = E->GetBinding <Key>(Hooks::REGTYPE_GUILD);
29212929
29222930 if (lua_isnoneornil (E->L , 1 ))
29232931 {
2924- E-> GuildEventBindings ->Clear ();
2932+ binding ->Clear ();
29252933 }
29262934 else
29272935 {
29282936 uint32 event_type = E->CHECKVAL <uint32>(1 );
2929- E-> GuildEventBindings ->Clear (Key ((Hooks::GuildEvents)event_type));
2937+ binding ->Clear (Key ((Hooks::GuildEvents)event_type));
29302938 }
29312939 return 0 ;
29322940 }
@@ -2949,19 +2957,20 @@ namespace LuaGlobalFunctions
29492957 int ClearItemEvents (Eluna* E)
29502958 {
29512959 typedef EntryKey<Hooks::ItemEvents> Key;
2960+ auto binding = E->GetBinding <Key>(Hooks::REGTYPE_ITEM);
29522961
29532962 if (lua_isnoneornil (E->L , 2 ))
29542963 {
29552964 uint32 entry = E->CHECKVAL <uint32>(1 );
29562965
29572966 for (uint32 i = 1 ; i < Hooks::ITEM_EVENT_COUNT; ++i)
2958- E-> ItemEventBindings ->Clear (Key ((Hooks::ItemEvents)i, entry));
2967+ binding ->Clear (Key ((Hooks::ItemEvents)i, entry));
29592968 }
29602969 else
29612970 {
29622971 uint32 entry = E->CHECKVAL <uint32>(1 );
29632972 uint32 event_type = E->CHECKVAL <uint32>(2 );
2964- E-> ItemEventBindings ->Clear (Key ((Hooks::ItemEvents)event_type, entry));
2973+ binding ->Clear (Key ((Hooks::ItemEvents)event_type, entry));
29652974 }
29662975 return 0 ;
29672976 }
@@ -2984,19 +2993,20 @@ namespace LuaGlobalFunctions
29842993 int ClearItemGossipEvents (Eluna* E)
29852994 {
29862995 typedef EntryKey<Hooks::GossipEvents> Key;
2996+ auto binding = E->GetBinding <Key>(Hooks::REGTYPE_ITEM_GOSSIP);
29872997
29882998 if (lua_isnoneornil (E->L , 2 ))
29892999 {
29903000 uint32 entry = E->CHECKVAL <uint32>(1 );
29913001
29923002 for (uint32 i = 1 ; i < Hooks::GOSSIP_EVENT_COUNT; ++i)
2993- E-> ItemGossipBindings ->Clear (Key ((Hooks::GossipEvents)i, entry));
3003+ binding ->Clear (Key ((Hooks::GossipEvents)i, entry));
29943004 }
29953005 else
29963006 {
29973007 uint32 entry = E->CHECKVAL <uint32>(1 );
29983008 uint32 event_type = E->CHECKVAL <uint32>(2 );
2999- E-> ItemGossipBindings ->Clear (Key ((Hooks::GossipEvents)event_type, entry));
3009+ binding ->Clear (Key ((Hooks::GossipEvents)event_type, entry));
30003010 }
30013011 return 0 ;
30023012 }
@@ -3016,19 +3026,20 @@ namespace LuaGlobalFunctions
30163026 int ClearPacketEvents (Eluna* E)
30173027 {
30183028 typedef EntryKey<Hooks::PacketEvents> Key;
3029+ auto binding = E->GetBinding <Key>(Hooks::REGTYPE_PACKET);
30193030
30203031 if (lua_isnoneornil (E->L , 2 ))
30213032 {
30223033 uint32 entry = E->CHECKVAL <uint32>(1 );
30233034
30243035 for (uint32 i = 1 ; i < Hooks::PACKET_EVENT_COUNT; ++i)
3025- E-> PacketEventBindings ->Clear (Key ((Hooks::PacketEvents)i, entry));
3036+ binding ->Clear (Key ((Hooks::PacketEvents)i, entry));
30263037 }
30273038 else
30283039 {
30293040 uint32 entry = E->CHECKVAL <uint32>(1 );
30303041 uint32 event_type = E->CHECKVAL <uint32>(2 );
3031- E-> PacketEventBindings ->Clear (Key ((Hooks::PacketEvents)event_type, entry));
3042+ binding ->Clear (Key ((Hooks::PacketEvents)event_type, entry));
30323043 }
30333044 return 0 ;
30343045 }
@@ -3047,15 +3058,16 @@ namespace LuaGlobalFunctions
30473058 int ClearPlayerEvents (Eluna* E)
30483059 {
30493060 typedef EventKey<Hooks::PlayerEvents> Key;
3061+ auto binding = E->GetBinding <Key>(Hooks::REGTYPE_PLAYER);
30503062
30513063 if (lua_isnoneornil (E->L , 1 ))
30523064 {
3053- E-> PlayerEventBindings ->Clear ();
3065+ binding ->Clear ();
30543066 }
30553067 else
30563068 {
30573069 uint32 event_type = E->CHECKVAL <uint32>(1 );
3058- E-> PlayerEventBindings ->Clear (Key ((Hooks::PlayerEvents)event_type));
3070+ binding ->Clear (Key ((Hooks::PlayerEvents)event_type));
30593071 }
30603072 return 0 ;
30613073 }
@@ -3075,19 +3087,20 @@ namespace LuaGlobalFunctions
30753087 int ClearPlayerGossipEvents (Eluna* E)
30763088 {
30773089 typedef EntryKey<Hooks::GossipEvents> Key;
3090+ auto binding = E->GetBinding <Key>(Hooks::REGTYPE_PLAYER_GOSSIP);
30783091
30793092 if (lua_isnoneornil (E->L , 2 ))
30803093 {
30813094 uint32 entry = E->CHECKVAL <uint32>(1 );
30823095
30833096 for (uint32 i = 1 ; i < Hooks::GOSSIP_EVENT_COUNT; ++i)
3084- E-> PlayerGossipBindings ->Clear (Key ((Hooks::GossipEvents)i, entry));
3097+ binding ->Clear (Key ((Hooks::GossipEvents)i, entry));
30853098 }
30863099 else
30873100 {
30883101 uint32 entry = E->CHECKVAL <uint32>(1 );
30893102 uint32 event_type = E->CHECKVAL <uint32>(2 );
3090- E-> PlayerGossipBindings ->Clear (Key ((Hooks::GossipEvents)event_type, entry));
3103+ binding ->Clear (Key ((Hooks::GossipEvents)event_type, entry));
30913104 }
30923105 return 0 ;
30933106 }
@@ -3106,15 +3119,16 @@ namespace LuaGlobalFunctions
31063119 int ClearServerEvents (Eluna* E)
31073120 {
31083121 typedef EventKey<Hooks::ServerEvents> Key;
3122+ auto binding = E->GetBinding <Key>(Hooks::REGTYPE_SERVER);
31093123
31103124 if (lua_isnoneornil (E->L , 1 ))
31113125 {
3112- E-> ServerEventBindings ->Clear ();
3126+ binding ->Clear ();
31133127 }
31143128 else
31153129 {
31163130 uint32 event_type = E->CHECKVAL <uint32>(1 );
3117- E-> ServerEventBindings ->Clear (Key ((Hooks::ServerEvents)event_type));
3131+ binding ->Clear (Key ((Hooks::ServerEvents)event_type));
31183132 }
31193133 return 0 ;
31203134 }
@@ -3134,19 +3148,20 @@ namespace LuaGlobalFunctions
31343148 int ClearMapEvents (Eluna* E)
31353149 {
31363150 typedef EntryKey<Hooks::InstanceEvents> Key;
3151+ auto binding = E->GetBinding <Key>(Hooks::REGTYPE_MAP);
31373152
31383153 if (lua_isnoneornil (E->L , 2 ))
31393154 {
31403155 uint32 entry = E->CHECKVAL <uint32>(1 );
31413156
31423157 for (uint32 i = 1 ; i < Hooks::INSTANCE_EVENT_COUNT; ++i)
3143- E-> MapEventBindings ->Clear (Key ((Hooks::InstanceEvents)i, entry));
3158+ binding ->Clear (Key ((Hooks::InstanceEvents)i, entry));
31443159 }
31453160 else
31463161 {
31473162 uint32 entry = E->CHECKVAL <uint32>(1 );
31483163 uint32 event_type = E->CHECKVAL <uint32>(2 );
3149- E-> MapEventBindings ->Clear (Key ((Hooks::InstanceEvents)event_type, entry));
3164+ binding ->Clear (Key ((Hooks::InstanceEvents)event_type, entry));
31503165 }
31513166
31523167 return 0 ;
@@ -3167,19 +3182,20 @@ namespace LuaGlobalFunctions
31673182 int ClearInstanceEvents (Eluna* E)
31683183 {
31693184 typedef EntryKey<Hooks::InstanceEvents> Key;
3185+ auto binding = E->GetBinding <Key>(Hooks::REGTYPE_INSTANCE);
31703186
31713187 if (lua_isnoneornil (E->L , 2 ))
31723188 {
31733189 uint32 entry = E->CHECKVAL <uint32>(1 );
31743190
31753191 for (uint32 i = 1 ; i < Hooks::INSTANCE_EVENT_COUNT; ++i)
3176- E-> InstanceEventBindings ->Clear (Key ((Hooks::InstanceEvents)i, entry));
3192+ binding ->Clear (Key ((Hooks::InstanceEvents)i, entry));
31773193 }
31783194 else
31793195 {
31803196 uint32 entry = E->CHECKVAL <uint32>(1 );
31813197 uint32 event_type = E->CHECKVAL <uint32>(2 );
3182- E-> InstanceEventBindings ->Clear (Key ((Hooks::InstanceEvents)event_type, entry));
3198+ binding ->Clear (Key ((Hooks::InstanceEvents)event_type, entry));
31833199 }
31843200
31853201 return 0 ;
0 commit comments