@@ -766,36 +766,37 @@ int Eluna::Register(uint8 regtype, uint32 entry, ObjectGuid guid, uint32 instanc
766766 case Hooks::REGTYPE_CREATURE:
767767 if (event_id < Hooks::CREATURE_EVENT_COUNT)
768768 {
769- if (entry != 0 )
769+ if (!eObjectMgr-> GetCreatureTemplate (entry) )
770770 {
771- if (!eObjectMgr->GetCreatureTemplate (entry))
772- {
773- luaL_unref (L, LUA_REGISTRYINDEX, functionRef);
774- luaL_error (L, " Couldn't find a creature with (ID: %d)!" , entry);
775- return 0 ; // Stack: (empty)
776- }
777-
778- typedef EntryKey<Hooks::CreatureEvents> Key;
779- auto binding = GetBinding<Key>(regtype);
780- auto key = Key ((Hooks::CreatureEvents)event_id, entry);
781- bindingID = binding->Insert (key, functionRef, shots);
782- createCancelCallback (this , bindingID, binding);
771+ luaL_unref (L, LUA_REGISTRYINDEX, functionRef);
772+ luaL_error (L, " Couldn't find a creature with (ID: %d)!" , entry);
773+ return 0 ; // Stack: (empty)
783774 }
784- else
775+
776+ typedef EntryKey<Hooks::CreatureEvents> Key;
777+ auto binding = GetBinding<Key>(regtype);
778+ auto key = Key ((Hooks::CreatureEvents)event_id, entry);
779+ bindingID = binding->Insert (key, functionRef, shots);
780+ createCancelCallback (this , bindingID, binding);
781+ return 1 ; // Stack: callback
782+ }
783+ break ;
784+
785+ case Hooks::REGTYPE_CREATURE_UNIQUE:
786+ if (event_id < Hooks::CREATURE_EVENT_COUNT)
787+ {
788+ if (guid.IsEmpty ())
785789 {
786- if (guid.IsEmpty ())
787- {
788- luaL_unref (L, LUA_REGISTRYINDEX, functionRef);
789- luaL_error (L, " guid was 0!" );
790- return 0 ; // Stack: (empty)
791- }
792-
793- typedef UniqueObjectKey<Hooks::CreatureEvents> Key;
794- auto binding = GetBinding<Key>(regtype);
795- auto key = Key ((Hooks::CreatureEvents)event_id, guid, instanceId);
796- bindingID = binding->Insert (key, functionRef, shots);
797- createCancelCallback (this , bindingID, binding);
790+ luaL_unref (L, LUA_REGISTRYINDEX, functionRef);
791+ luaL_error (L, " guid was 0!" );
792+ return 0 ; // Stack: (empty)
798793 }
794+
795+ typedef UniqueObjectKey<Hooks::CreatureEvents> Key;
796+ auto binding = GetBinding<Key>(regtype);
797+ auto key = Key ((Hooks::CreatureEvents)event_id, guid, instanceId);
798+ bindingID = binding->Insert (key, functionRef, shots);
799+ createCancelCallback (this , bindingID, binding);
799800 return 1 ; // Stack: callback
800801 }
801802 break ;
0 commit comments