There is a bug in the unhook function which prevents unhooking of previously hooked functions. Basically the code in unhook which was copied from hook will exit if it finds that the passed new function is already hooked. This is good for the hook function, but the opposite of what needs to happen for the unhook function. I modified the code to fix this so that it will only try to unhook if the function was already hooked (as opposed to the opposite). Here's the complete fixed unhook function.

  Sea.util.unhook = function ( orig, new, hooktype, scriptElementName )
     if(not hooktype) then
        hooktype = "before";
     local compoundOrig = orig;
     if (scriptElementName) then
        compoundOrig = orig.."."..scriptElementName;
     end and (SEA_HOOKS_DEBUG_VERBOSE==compoundOrig)), nil, NORMAL_FONT_COLOR, "SeaHooks Progress: Unhooking ", orig, " to ", new, ", hooktype ", hooktype, ", scriptElementName ", scriptElementName);
     local newFunc = new;
     if ( type(new) ~= "function" ) then
        newFunc = Sea.util.getValue(new);
     local hookObj = Sea.util.Hooks[compoundOrig];
     if(not hookObj) then
        hookObj = SeaHooks_hookInit(orig, compoundOrig, scriptElementName); and (SEA_HOOKS_DEBUG_VERBOSE==compoundOrig)), nil, NORMAL_FONT_COLOR, "SeaHooks Progress: '", compoundOrig, "' not hooked with '", new, "' skipping.");
        local foundIt = false;
        for key,value in hookObj[hooktype] do
           -- NOTE THIS SHOULD BE VALUE! VALUE! *NOT* KEY! (checking if the functions are the same, even if the names are different)
           -- If the function is found it will be unhooked
           if(value == newFunc) then
              foundIt = true;
              --exit loop since found hook
        if (foundIt == false) then
  and (SEA_HOOKS_DEBUG_VERBOSE==compoundOrig)), nil, NORMAL_FONT_COLOR, "SeaHooks Progress: '", compoundOrig, "' not hooked with '", new, "' skipping.");
           --hooked function not found so nothing to do
     local info = hookObj[hooktype]; --Sea.util.Hooks[compoundOrig][hooktype]
     for key,value in info do
        if (type(value) == "function") and (value == newFunc) then
           info[key] = nil;
           local embeddedTable = info[key.."Info"];
           if (type(embeddedTable) == "table") then
              embeddedTable.parent = nil;
     = nil;
           info[key.."Info"] = embeddedTable;
           hookObj[hooktype] = info;
           hookObj.count = hookObj.count - 1;   --decrement hook counter
           Sea.util.Hooks[compoundOrig] = hookObj   --repackage all hook types
  and (SEA_HOOKS_DEBUG_VERBOSE==compoundOrig)), nil, NORMAL_FONT_COLOR, "SeaHooks Progress: Found and unhooked '", new, "' from '", compoundOrig, "'.");
     -- No Complete Unhooking - Incompatible with Frame Script Element Hooks - Also liable to erase function hooks loaded after the first hook.
     Sea.util.Hooks[compoundOrig] = hookObj   --repackage all hook types

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.