OpenFolder("Definitions")

--[[
Render your itens
--]]

local anyWingGhost = 0
local WingGhostStartImg = 50000

function StartLoadImages()
	--for i = 0, 11 do
	--	LoadImage(string.format("Item\\fire_sq_%05d.jpg", i), WingGhostStartImg + i)
	--end
	
	--LoadImage("Item\\season_wing_period_render.jpg", 50020)
end

local ITEM_TRANSPARENTE = {}
ITEM_TRANSPARENTE[GET_ITEM_MODEL(07, 500)] = {levelMin = 11, levelMax = 15} -- Helm 02
ITEM_TRANSPARENTE[GET_ITEM_MODEL(08, 500)] = {levelMin = 11, levelMax = 15} -- Armor 02
ITEM_TRANSPARENTE[GET_ITEM_MODEL(09, 500)] = {levelMin = 11, levelMax = 15} -- Pants 02
ITEM_TRANSPARENTE[GET_ITEM_MODEL(10, 500)] = {levelMin = 11, levelMax = 15} -- Gloves 02
ITEM_TRANSPARENTE[GET_ITEM_MODEL(11, 500)] = {levelMin = 11, levelMax = 15} -- Boots 02

ITEM_TRANSPARENTE[GET_ITEM_MODEL(0, 500)] = {levelMin = 11, levelMax = 15} -- Mace King
ITEM_TRANSPARENTE[GET_ITEM_MODEL(6, 500)] = {levelMin = 11, levelMax = 15} -- Shield CS


function RenderModelBody(BMDStruct, ObjectStruct, ItemIndex)

    local itemTransparente = ITEM_TRANSPARENTE[ItemIndex]
	
        if itemTransparente ~= nil
        then
            local Bmd = BMD.new(BMDStruct)
    
                Bmd:glColor3fv()
                Bmd:SetLight(1.0, 1.0, 1.0)
                Bmd = nil
    
                return 1
        end
	
	if (ItemIndex == GET_ITEM_MODEL(7, 100)) --Helm 02x
	then
		local Bmd = BMD.new(BMDStruct)
		local Obj = Object.new(ObjectStruct)
		
		if Bmd:GetLight(0) ~= 1.0 or Bmd:GetLight(1) ~= 1.0 or Bmd:GetLight(2) ~= 1.0
		then
		    Bmd:glColor3fv()
		    Bmd:SetLight(1.0, 1.0, 1.0)
		    Bmd:RenderMesh(0, 2, Obj:Alpha(), Obj:Mesh(), Obj:Light(), Obj:TexCoordU(), Obj:TexCoordV(), -1)
		    
		    local Vertex = GetDoubleRender(-2.0, 0.0) + 0.00
		    if Vertex > 100.0
		    then
		    	Vertex = 100.0
		    end
			
		    Bmd:SetLight(Vertex, Vertex, Vertex)
			Bmd:glColor3fv()
		    Bmd:RenderMesh(1, 66, Obj:Alpha(), Obj:Mesh(), Obj:Light(), Obj:TexCoordU(), Obj:TexCoordV(), -1) 
		
	    else
		
	        Bmd:glColor3fv()
		    Bmd:SetLight(1.0, 1.0, 1.0)
		    Bmd:RenderMesh(0, 2, Obj:Alpha(), Obj:Mesh(), Obj:Light(), Obj:TexCoordU(), Obj:TexCoordV(), -1)
		    
		    local Vertex = GetDoubleRender(-2.0, 0.0) + 0.00
		    if Vertex > 100.0
		    then
		    	Vertex = 100.0
		    end
			
		    Bmd:SetLight(Vertex, Vertex, Vertex)
			Bmd:glColor3fv()
		    Bmd:RenderMesh(1, 66, Obj:Alpha(), Obj:Mesh(), Obj:Light(), Obj:TexCoordU(), Obj:TexCoordV(), -1) 
			
	    end
		
		Bmd = nil
	    Obj = nil
			
		return 1
	end
	
	if (ItemIndex == GET_ITEM_MODEL(8, 100)) --Armor 02x
	then
		local Bmd = BMD.new(BMDStruct)
		local Obj = Object.new(ObjectStruct)
		
		if Bmd:GetLight(0) ~= 1.0 or Bmd:GetLight(1) ~= 1.0 or Bmd:GetLight(2) ~= 1.0
		then
			Bmd:SetLight(1.0, 1.0, 1.0)
			Bmd:glColor3fv()
			Bmd:RenderMesh(0, 2, Obj:Alpha(), Obj:Mesh(), Obj:Light(), Obj:TexCoordU(), Obj:TexCoordV(), -1)
			Bmd:RenderMesh(1, 2, Obj:Alpha(), Obj:Mesh(), Obj:Light(), Obj:TexCoordU(), Obj:TexCoordV(), -1)

			local Vertex = GetDoubleRender(-2.0, 0.0) + 0.00
			if Vertex > 100.0
			then
				Vertex = 100.0
			end
			
			Bmd:SetLight(Vertex, Vertex, Vertex)
			Bmd:glColor3fv()
			Bmd:RenderMesh(2, 66, Obj:Alpha(), Obj:Mesh(), Obj:Light(), Obj:TexCoordU(), Obj:TexCoordV(), -1) 
			Bmd:RenderMesh(3, 66, Obj:Alpha(), Obj:Mesh(), Obj:Light(), Obj:TexCoordU(), Obj:TexCoordV(), -1) 
		else
			Bmd:SetLight(1.0, 1.0, 1.0)
			Bmd:glColor3fv()
			Bmd:RenderMesh(0, 2, Obj:Alpha(), Obj:Mesh(), Obj:Light(), Obj:TexCoordU(), Obj:TexCoordV(), -1)
			Bmd:RenderMesh(1, 2, Obj:Alpha(), Obj:Mesh(), Obj:Light(), Obj:TexCoordU(), Obj:TexCoordV(), -1)

			local Vertex = GetDoubleRender(-2.0, 0.0) + 0.00
			if Vertex > 100.0
			then
				Vertex = 100.0
			end
			
			Bmd:SetLight(Vertex, Vertex, Vertex)
			Bmd:glColor3fv()
			Bmd:RenderMesh(2, 66, Obj:Alpha(), Obj:Mesh(), Obj:Light(), Obj:TexCoordU(), Obj:TexCoordV(), -1) 
			Bmd:RenderMesh(3, 66, Obj:Alpha(), Obj:Mesh(), Obj:Light(), Obj:TexCoordU(), Obj:TexCoordV(), -1) 
		end

	
		Bmd = nil
		Obj = nil

		return 1
	end

	if (ItemIndex == GET_ITEM_MODEL(10, 100)) --02x
	then
		local Bmd = BMD.new(BMDStruct)
		local Obj = Object.new(ObjectStruct)
		
		if Bmd:GetLight(0) ~= 1.0 or Bmd:GetLight(1) ~= 1.0 or Bmd:GetLight(2) ~= 1.0
		then
			Bmd:SetLight(1.0, 1.0, 1.0)
			Bmd:glColor3fv()
			Bmd:RenderMesh(0, 2, Obj:Alpha(), Obj:Mesh(), Obj:Light(), Obj:TexCoordU(), Obj:TexCoordV(), -1)

			local Vertex = GetDoubleRender(-2.0, 0.0) + 0.00
			if Vertex > 100.0
			then
				Vertex = 100.0
			end
			
			Bmd:SetLight(Vertex, Vertex, Vertex)
			Bmd:glColor3fv()
			Bmd:RenderMesh(1, 66, Obj:Alpha(), Obj:Mesh(), Obj:Light(), Obj:TexCoordU(), Obj:TexCoordV(), -1) 
		else
			Bmd:SetLight(1.0, 1.0, 1.0)
			Bmd:glColor3fv()
			Bmd:RenderMesh(0, 2, Obj:Alpha(), Obj:Mesh(), Obj:Light(), Obj:TexCoordU(), Obj:TexCoordV(), -1)

			local Vertex = GetDoubleRender(-2.0, 0.0) + 0.00
			if Vertex > 100.0
			then
				Vertex = 100.0
			end
			
			Bmd:SetLight(Vertex, Vertex, Vertex)
			Bmd:glColor3fv()
			Bmd:RenderMesh(1, 66, Obj:Alpha(), Obj:Mesh(), Obj:Light(), Obj:TexCoordU(), Obj:TexCoordV(), -1) 
		end

	
		Bmd = nil
		Obj = nil

		return 1
	end

	if (ItemIndex == GET_ITEM_MODEL(11, 100)) --02x
	then
		local Bmd = BMD.new(BMDStruct)
		local Obj = Object.new(ObjectStruct)
		
		if Bmd:GetLight(0) ~= 1.0 or Bmd:GetLight(1) ~= 1.0 or Bmd:GetLight(2) ~= 1.0
		then
			Bmd:SetLight(1.0, 1.0, 1.0)
			Bmd:glColor3fv()
			Bmd:RenderMesh(0, 2, Obj:Alpha(), Obj:Mesh(), Obj:Light(), Obj:TexCoordU(), Obj:TexCoordV(), -1)

			local Vertex = GetDoubleRender(-2.0, 0.0) + 0.00
			if Vertex > 100.0
			then
				Vertex = 100.0
			end
			
			Bmd:SetLight(Vertex, Vertex, Vertex)
			Bmd:glColor3fv()
			Bmd:RenderMesh(1, 66, Obj:Alpha(), Obj:Mesh(), Obj:Light(), Obj:TexCoordU(), Obj:TexCoordV(), -1) 
		else
			Bmd:SetLight(1.0, 1.0, 1.0)
			Bmd:glColor3fv()
			Bmd:RenderMesh(0, 2, Obj:Alpha(), Obj:Mesh(), Obj:Light(), Obj:TexCoordU(), Obj:TexCoordV(), -1)

			local Vertex = GetDoubleRender(-2.0, 0.0) + 0.00
			if Vertex > 100.0
			then
				Vertex = 100.0
			end
			
			Bmd:SetLight(Vertex, Vertex, Vertex)
			Bmd:glColor3fv()
			Bmd:RenderMesh(1, 66, Obj:Alpha(), Obj:Mesh(), Obj:Light(), Obj:TexCoordU(), Obj:TexCoordV(), -1) 
		end

	
		Bmd = nil
		Obj = nil

		return 1
	end	
	
	if (ItemIndex == GET_ITEM_MODEL(0, 201)) --02x
	then
		local Bmd = BMD.new(BMDStruct)
		local Obj = Object.new(ObjectStruct)
		
		if Bmd:GetLight(0) ~= 1.0 or Bmd:GetLight(1) ~= 1.0 or Bmd:GetLight(2) ~= 1.0
		then
			Bmd:SetLight(1.0, 1.0, 1.0)
			Bmd:glColor3fv()
			Bmd:RenderMesh(0, 2, Obj:Alpha(), Obj:Mesh(), Obj:Light(), Obj:TexCoordU(), Obj:TexCoordV(), -1)

			local Vertex = GetDoubleRender(-2.0, 0.0) + 0.00
			if Vertex > 100.0
			then
				Vertex = 100.0
			end
			
			Bmd:SetLight(Vertex, Vertex, Vertex)
			Bmd:glColor3fv()
			Bmd:RenderMesh(1, 66, Obj:Alpha(), Obj:Mesh(), Obj:Light(), Obj:TexCoordU(), Obj:TexCoordV(), -1) 
		else
			Bmd:SetLight(1.0, 1.0, 1.0)
			Bmd:glColor3fv()
			Bmd:RenderMesh(0, 2, Obj:Alpha(), Obj:Mesh(), Obj:Light(), Obj:TexCoordU(), Obj:TexCoordV(), -1)

			local Vertex = GetDoubleRender(-2.0, 0.0) + 0.00
			if Vertex > 100.0
			then
				Vertex = 100.0
			end
			
			Bmd:SetLight(Vertex, Vertex, Vertex)
			Bmd:glColor3fv()
			Bmd:RenderMesh(1, 66, Obj:Alpha(), Obj:Mesh(), Obj:Light(), Obj:TexCoordU(), Obj:TexCoordV(), -1) 
		end

	
		Bmd = nil
		Obj = nil

		return 1
	end
	
	if (ItemIndex == GET_ITEM_MODEL(6, 100)) --Helm 02x
	then
		local Bmd = BMD.new(BMDStruct)
		local Obj = Object.new(ObjectStruct)
		
		if Bmd:GetLight(0) ~= 1.0 or Bmd:GetLight(1) ~= 1.0 or Bmd:GetLight(2) ~= 1.0
		then
		    Bmd:glColor3fv()
		    Bmd:SetLight(1.0, 1.0, 1.0)
		    Bmd:RenderMesh(0, 2, Obj:Alpha(), Obj:Mesh(), Obj:Light(), Obj:TexCoordU(), Obj:TexCoordV(), -1)
		    
		    local Vertex = GetDoubleRender(-2.0, 0.0) + 0.00
		    if Vertex > 100.0
		    then
		    	Vertex = 100.0
		    end
			
		    Bmd:SetLight(Vertex, Vertex, Vertex)
			Bmd:glColor3fv()
		    Bmd:RenderMesh(1, 66, Obj:Alpha(), Obj:Mesh(), Obj:Light(), Obj:TexCoordU(), Obj:TexCoordV(), -1) 
		
	    else
		
	        Bmd:glColor3fv()
		    Bmd:SetLight(1.0, 1.0, 1.0)
		    Bmd:RenderMesh(0, 2, Obj:Alpha(), Obj:Mesh(), Obj:Light(), Obj:TexCoordU(), Obj:TexCoordV(), -1)
		    
		    local Vertex = GetDoubleRender(-2.0, 0.0) + 0.00
		    if Vertex > 100.0
		    then
		    	Vertex = 100.0
		    end
			
		    Bmd:SetLight(Vertex, Vertex, Vertex)
			Bmd:glColor3fv()
		    Bmd:RenderMesh(1, 66, Obj:Alpha(), Obj:Mesh(), Obj:Light(), Obj:TexCoordU(), Obj:TexCoordV(), -1) 
			
	    end
		
		Bmd = nil
	    Obj = nil
			
		return 1
	end
	
	
	return 0
end

local ITEM_REMOVEGLOW = {}

ITEM_REMOVEGLOW[GET_ITEM_MODEL(7, 500)] = {removeglow = true} -- Helm 
ITEM_REMOVEGLOW[GET_ITEM_MODEL(8, 500)] = {removeglow = true} -- Armor
ITEM_REMOVEGLOW[GET_ITEM_MODEL(9, 500)] = {removeglow = true} -- Pants
ITEM_REMOVEGLOW[GET_ITEM_MODEL(10, 500)] = {removeglow = true} -- Gloves
ITEM_REMOVEGLOW[GET_ITEM_MODEL(11, 500)] = {removeglow = true} -- Boots

--ITEM_REMOVEGLOW[GET_ITEM_MODEL(7, 201)] = {removeglow = true} -- Helm 
--ITEM_REMOVEGLOW[GET_ITEM_MODEL(8, 201)] = {removeglow = true} -- Armor
--ITEM_REMOVEGLOW[GET_ITEM_MODEL(9, 201)] = {removeglow = true} -- Pants
--ITEM_REMOVEGLOW[GET_ITEM_MODEL(10, 201)] = {removeglow = true} -- Gloves
--ITEM_REMOVEGLOW[GET_ITEM_MODEL(11, 201)] = {removeglow = true} -- Boots
--
--ITEM_REMOVEGLOW[GET_ITEM_MODEL(0, 201)] = {removeglow = true} -- Sword
--ITEM_REMOVEGLOW[GET_ITEM_MODEL(6, 201)] = {removeglow = true} -- Shield


function RenderModelBodyColor(BMDStruct, ObjectStruct, ItemIndex)
	if (ItemIndex == GET_ITEM_MODEL(12, 500))
	then
		return 1
	end
	
	return 0
end

function RenderModelBodyColor2(BMDStruct, ObjectStruct, ItemIndex)
	
	local removeglow = ITEM_REMOVEGLOW[ItemIndex]
	
	if removeglow ~= nil
	then
	    return 1
	end
	
    local itemTransparente = ITEM_TRANSPARENTE[ItemIndex]
	
    if itemTransparente ~= nil
    then
        return 1
    end
	
	return 0
end