// GOAL: Manipulate the enviroment table throguh autorun giving us a perfectly spoofed SMITE clientside.

local function Copy( t, lookup_table )
	if ( t == nil ) then return nil end

	local copy = {}
	setmetatable( copy, debug.getmetatable( t ) )
	for i, v in pairs( t ) do
		if ( !istable( v ) ) then
			copy[ i ] = v
		else
			lookup_table = lookup_table or {}
			lookup_table[ t ] = copy
			if ( lookup_table[ v ] ) then
				copy[ i ] = lookup_table[ v ] -- we already copied this table. reuse the copy.
			else
				copy[ i ] = Copy( v, lookup_table ) -- not yet copied. copy it.
			end
		end
	end
	return copy
end

local G = Copy( _G )
local SMITE = { }

_G.setfenv = function( func, env )
    if env.smite then 
        SMITE = env.smite
    end

    return G.setfenv( func, env )
end

timer.Simple(10, function( )
    -- Actually bypass.

    // Detected.
    -- if SMITE.Ban then 
    --     SMITE.Ban = function( ... )
    --         -- Do nothing.
    --     end

    --     MsgN( string.format( 'SMITE-BYPASS | Bypassed ban function. (%s, %s)', SMITE.Ban, SMITE ) )
    -- end

    // Also detected.
    -- if SMITE.Query then 
    --     local Virutal = SMITE.Query

    --     SMITE.Query = function( ID, Data )
    --         if ID == 'Request Ban' then return end 

    --         return Virutal( ID, Data )
    --     end

    --     MsgN( string.format( 'SMITE-BYPASS | Bypassed query function. (%s, %s)', SMITE.Query, SMITE ) )
    -- end

    // Testing
    -- if SMITE.GMList then 
    --     SMITE.GMList = function( ... )
    --         -- Do nothing.
    --     end

    --     MsgN( string.format( 'SMITE-BYPASS | Bypassed GMList function. (%s, %s)', SMITE.GMList, SMITE ) )
    -- end
end)