Skip to content

Commit

Permalink
Add error messages to disabled methods instead of failing silently
Browse files Browse the repository at this point in the history
  • Loading branch information
Foereaper committed Jan 16, 2024
1 parent 4695875 commit ad837cf
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions TrinityCore/WorldObjectMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,10 @@ namespace LuaWorldObject
{
// Dirty fix to disable RegisterEvent in "world" state in multistate implementation
if (!E->GetCompatibilityMode() && E->GetBoundMapId() == -1)
{
luaL_error(E->L, "RegisterEvent is disabled in the World State in multistate mode. Please review your code!");
return 0;
}

luaL_checktype(E->L, 2, LUA_TFUNCTION);
uint32 min, max;
Expand Down Expand Up @@ -813,7 +816,10 @@ namespace LuaWorldObject
{
// Dirty fix to disable RegisterEvent in "world" state in multistate implementation
if (!E->GetCompatibilityMode() && E->GetBoundMapId() == -1)
{
luaL_error(E->L, "RemoveEventById is disabled in the World State in multistate mode. Please review your code!");
return 0;
}

int eventId = Eluna::CHECKVAL<int>(E->L, 2);
obj->elunaEvents->SetState(eventId, LUAEVENT_STATE_ABORT);
Expand All @@ -828,7 +834,10 @@ namespace LuaWorldObject
{
// Dirty fix to disable RegisterEvent in "world" state in multistate implementation
if (!E->GetCompatibilityMode() && E->GetBoundMapId() == -1)
{
luaL_error(E->L, "RemoveEvents is disabled in the World State in multistate mode. Please review your code!");
return 0;
}

obj->elunaEvents->SetStates(LUAEVENT_STATE_ABORT);
return 0;
Expand Down

0 comments on commit ad837cf

Please sign in to comment.