local portraits = true

if portraits == false then return end

local _G = _G -- import globals for faster usage

local LootTargetPortrait = CreateFrame("PlayerModel", nil, _G["LootFrame"])
LootTargetPortrait:SetPoint("BOTTOMLEFT", _G["LootFrame"], "TOPLEFT", 24, -72)
LootTargetPortrait:SetSize(26*6, 17*2)
LootTargetPortrait:SetBackdropColor(0, 0, 0, 0.75)
CreateBorderLight(LootTargetPortrait, 7, .35, .35, .35, 2)

LootPortraitFrame = CreateFrame("Frame")
LootPortraitFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
LootPortraitFrame:RegisterEvent("LOOT_OPENED")
LootPortraitFrame:SetScript("OnEvent", function(self, event, id)
    if event == "LOOT_OPENED" then
        if UnitExists("target") then
            LootTargetPortrait:SetUnit("target")
            LootTargetPortrait:SetCamera(0)
        else
            LootTargetPortrait:ClearModel()
            LootTargetPortrait:SetModel("PARTICLES\\Lootfx.m2")
        end
	end
end)