local IC = InvenCraftInfo2
-- 위치 조정
TradeSkillFrame:SetScript("OnUpdate", nil)
TradeSkillFrame:ClearAllPoints()
TradeSkillFrame:SetPoint(unpack(IC.db.pos))
TradeSkillFrame:SetScale(IC.db.scale)
TradeSkillFrame:SetWidth(668)
TradeSkillFrame:SetHeight(434)
TradeSkillFrame:SetHitRectInsets(0, 0, 0, 0)
-- 이동 가능하게 만들기
TradeSkillFrame:RegisterForDrag("LeftButton")
TradeSkillFrame:SetScript("OnDragStart", TradeSkillFrame.StartMoving)
TradeSkillFrame:SetScript("OnDragStop", function(self)
	self:StopMovingOrSizing()
	IC.db.pos[1], _, _, IC.db.pos[2], IC.db.pos[3] = self:GetPoint()
end)
-- 가로줄 숨기기
local region
for i = 1, TradeSkillFrame:GetNumRegions() do
	region = select(i, TradeSkillFrame:GetRegions())
	if region:GetObjectType() == "Texture" and region:GetTexture() == "Interface\\ClassTrainerFrame\\UI-ClassTrainer-HorizontalBar" then
		region:SetTexture("")
		region:SetAlpha(0)
	end
end
TradeSkillCollapseAllButton:SetScript("PreClick", function(self) IC.favoriteHeader = self.collapsed end)
-- 각 요소들 새로운 테두리에 맞게 이동
TradeSkillRankFrameSkillRank:ClearAllPoints()
TradeSkillRankFrameSkillRank:SetPoint("CENTER", 0, 1)
TradeSkillRankFrame:UnregisterAllEvents()
TradeSkillRankFrame:SetScript("OnEvent", nil)
TradeSkillRankFrame:ClearAllPoints()
TradeSkillRankFrame:SetPoint("TOPRIGHT", TradeSkillFrame, -80, -30)
TradeSkillRankFrame:SetWidth(166)
TradeSkillRankFrame:SetScale(1.1)
TradeSkillRankFrame:SetStatusBarColor(0, 0, 1, 0.5)
TradeSkillRankFrameBorder:ClearAllPoints()
TradeSkillRankFrameBorder:SetPoint("LEFT", -4, 0)
TradeSkillRankFrameBorder:SetWidth(174)
TradeSkillRankFrameBackground:SetVertexColor(0, 0, 0.75, 0.5)
TradeSkillFrameSearchBox:ClearAllPoints()
TradeSkillFrameSearchBox:SetPoint("TOPLEFT", TradeSkillRankFrame, "BOTTOMLEFT", 4, -5)
TradeSkillViewGuildCraftersButton:ClearAllPoints()
TradeSkillViewGuildCraftersButton:SetPoint("LEFT", TradeSkillCreateAllButton, "LEFT", 0, 0)
TradeSkillCreateAllButton:ClearAllPoints()
TradeSkillCreateAllButton:SetPoint("BOTTOMRIGHT", -254, 4)
local function doTradeSkill(num)
	TradeSkillInputBox:ClearFocus()
	TradeSkillInputBox:SetNumber(num)
	DoTradeSkill(TradeSkillFrame.selectedID, num)
end
TradeSkillCreateAllButton:SetScript("OnClick", function()
	doTradeSkill(TradeSkillFrame.numAvailable or 0)
end)
TradeSkillCreateButton:SetScript("OnClick", function()
	doTradeSkill(math.min(TradeSkillInputBox:GetNumber() or 0, TradeSkillFrame.numAvailable or 0))
end)
TradeSkillFrameTitleText:SetText("Inven Craft Info 2 v"..GetAddOnMetadata("InvenCraftInfo2", "Version"))
IC.tradeSkillTitle = TradeSkillFrame:CreateFontString(nil, "OVERLAY", "QuestFont_Shadow_Huge")
IC.tradeSkillTitle:SetPoint("TOP", TradeSkillFrame, "TOPLEFT", 175, -36)
IC.tradeSkillTitle:SetShadowColor(0, 0, 0)
IC.tradeSkillTitle:SetShadowOffset(2, -2)
IC.tradeSkillTitle:SetTextColor(NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b)
IC.tradeSkillTitle:SetText("UNKNOWN")
TradeSkillLinkFrame:ClearAllPoints()
TradeSkillLinkFrame:SetPoint("TOP", IC.tradeSkillTitle, "BOTTOM", 0, -2)
TradeSkillLinkFrame:SetWidth(32)
TradeSkillLinkFrame:SetHeight(16)
TradeSkillLinkButton:SetAllPoints()
TradeSkillLinkButton:SetPushedTexture(nil)
TradeSkillLinkButton:SetNormalTexture("Interface\\TradeSkillFrame\\UI-TradeSkill-LinkButton")
TradeSkillLinkButton:SetHighlightTexture("Interface\\TradeSkillFrame\\UI-TradeSkill-LinkButton", "ADD")
TradeSkillLinkButton:GetNormalTexture():SetTexCoord(0, 1, 0, 0.5)
TradeSkillLinkButton:GetHighlightTexture():SetTexCoord(0, 1, 0.5, 1)
TradeSkillLinkNameButton:ClearAllPoints()
TradeSkillLinkNameButton:SetPoint("TOP", IC.tradeSkillTitle, "BOTTOM", 0, -2)
-- 길드기술 버튼 추가하기
IC.guildListButton = CreateFrame("Button", "InvenCraftInfo2GuildListButton", TradeSkillFilterFrame, "UIMenuButtonStretchTemplate")
IC.guildListButton:SetText(GUILD)
IC.guildListButton:SetSize(70, 22)
IC.guildListButton:SetPoint("BOTTOM", TradeSkillFilterButton, "TOP", 0, 1)
IC.guildListButton.arrow = InvenCraftInfo2GuildListButtonRightArrow
IC.guildListButton.arrow:Show()
IC.guildListButton.update = function(self, event)
	if IsInGuild() then
		if event == "GUILD_TRADESKILL_UPDATE" then
			local skillID, iconTexture, numOnline
			for i = 1, GetNumGuildTradeSkill() do
				skillID, _, iconTexture, _, numOnline = GetGuildTradeSkillInfo(i)
				if iconTexture and numOnline > 0 and CanViewGuildRecipes(skillID) then
					self:EnableMouse(true)
					self:Enable()
					self.arrow:SetDesaturated(nil)
					return
				end
			end
		else
			QueryGuildRecipes()
		end
	end
	self:EnableMouse(nil)
	self:Disable()
	self.arrow:SetDesaturated(true)
	if UIDROPDOWNMENU_OPEN_MENU == InvenCraftInfo2GuildListDropDown then
		CloseDropDownMenus(1)
	end
end
IC.guildListButton:SetScript("OnShow", IC.guildListButton.update)
IC.guildListButton:SetScript("OnEvent", IC.guildListButton.update)
IC.guildListButton:update()
IC.guildListButton:RegisterEvent("PLAYER_ENTERING_WORLD")
IC.guildListButton:RegisterEvent("GUILD_TRADESKILL_UPDATE")
IC.guildListButton:SetScript("OnClick", function(self)
	ToggleDropDownMenu(1, nil, InvenCraftInfo2GuildListDropDown, self, 74, 15)
end)
region = CreateFrame("Frame", "InvenCraftInfo2GuildListDropDown", TradeSkillFilterFrame, "UIDropDownMenuTemplate")
region.clickfunc = function(self, skillID)
	ViewGuildRecipes(skillID)
end
region.initialize = function(self)
	local info, skillID, iconTexture, headerName, numOnline = UIDropDownMenu_CreateInfo()
	info.func = self.clickfunc
	for i = 1, GetNumGuildTradeSkill() do
		skillID, _, iconTexture, headerName, numOnline = GetGuildTradeSkillInfo(i)
		if iconTexture and numOnline > 0 and CanViewGuildRecipes(skillID) then
			info.text = headerName
			info.icon = iconTexture
			info.arg1 = skillID
			info.checked = IsTradeSkillGuild() and GetTradeSkillLine() == headerName
			UIDropDownMenu_AddButton(info)
		end
	end
end
UIDropDownMenu_Initialize(region, region.initialize, "MENU")
InvenCraftInfo2GuildListDropDownText:SetJustifyH("CENTER")
InvenCraftInfo2GuildListDropDownButton:Show()
-- 리스트 스크롤 20개로 늘리기
IC.listButtons, IC.reagentButtons = {}, {}
TRADE_SKILLS_DISPLAYED = 20
local function listButtonOnEnter(self)
	self.enter = true
	self.count:SetVertexColor(1, 1, 1)
end
local function listButtonOnLeave(self)
	self.enter = nil
	if not self.highlight:IsShown() then
		self.count:SetVertexColor(self.cr, self.cg, self.cb)
	end
end
local function checkedOnHide(self)
	self.learn = nil
end
local function checkedOnClick(self, button)
	self:GetParent():Click(button)
end
local function checkedOnEnter(self)
	GameTooltip:SetOwner(self, "ANCHOR_TOPRIGHT")
	GameTooltip:AddLine(self.learn, 0.5, 0.5, 0.5)
	GameTooltip:Show()
end
local function sourceOnEnter(self)
	GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT")
	GameTooltip:AddLine(self.tooltipText)
	GameTooltip:Show()
end
local function sourceOnHide(self)
	self.tooltipText = nil
end
for i = 1, 20 do
	IC.listButtons[i] = _G["TradeSkillSkill"..i]
	if not IC.listButtons[i] then
		IC.listButtons[i] = CreateFrame("Button", "TradeSkillSkill"..i, TradeSkillFrame, "TradeSkillSkillButtonTemplate")
		IC.listButtons[i]:SetPoint("TOPLEFT", IC.listButtons[i - 1], "BOTTOMLEFT", 0, 0)
	end
	IC.listButtons[i].text = _G["TradeSkillSkill"..i.."Text"]
	IC.listButtons[i].count = _G["TradeSkillSkill"..i.."Count"]
	IC.listButtons[i].count:ClearAllPoints()
	IC.listButtons[i].count:SetPoint("LEFT", IC.listButtons[i].text, "RIGHT", 0, 0)
	_G["TradeSkillSkill"..i.."NumSkillUps"]:SetAlpha(0)
	_G["TradeSkillSkill"..i.."NumSkillUpsIcon"]:SetAlpha(0)
	IC.listButtons[i].source = {}
	for j = 1, 3 do
		IC.listButtons[i].source[j] = CreateFrame("Button", nil, IC.listButtons[i])
		IC.listButtons[i].source[j]:Hide()
		IC.listButtons[i].source[j]:SetWidth(12)
		IC.listButtons[i].source[j]:SetHeight(12)
		IC.listButtons[i].source[j]:SetScript("OnEnter", sourceOnEnter)
		IC.listButtons[i].source[j]:SetScript("OnLeave", GameTooltip_Hide)
		IC.listButtons[i].source[j]:SetScript("OnClick", checkedOnClick)
		IC.listButtons[i].source[j]:SetScript("OnHide", sourceOnHide)
	end
	IC.listButtons[i].source[1]:SetPoint("LEFT", IC.listButtons[i].count, "RIGHT", 2, -1)
	IC.listButtons[i].source[2]:SetPoint("LEFT", IC.listButtons[i].source[1], "RIGHT", -1, 0)
	IC.listButtons[i].highlight = IC.listButtons[i]:CreateTexture(nil, "BACKGROUND")
	IC.listButtons[i].highlight:SetTexture("Interface\\Buttons\\UI-Listbox-Highlight2")
	IC.listButtons[i].highlight:SetBlendMode("ADD")
	IC.listButtons[i].highlight:SetAllPoints()
	IC.listButtons[i].highlight:Hide()
	IC.listButtons[i].checked = CreateFrame("Button", nil, IC.listButtons[i])
	IC.listButtons[i].checked:Hide()
	IC.listButtons[i].checked:SetWidth(16)
	IC.listButtons[i].checked:SetHeight(16)
	IC.listButtons[i].checked:SetPoint("RIGHT", IC.listButtons[i].text, "LEFT", 0, 0)
	IC.listButtons[i].checked:SetScript("OnHide", checkedOnHide)
	IC.listButtons[i].checked:SetScript("OnClick", checkedOnClick)
	IC.listButtons[i].checked:SetScript("OnEnter", checkedOnEnter)
	IC.listButtons[i].checked:SetScript("OnLeave", GameTooltip_Hide)
	IC.listButtons[i]:SetScript("OnEnter", listButtonOnEnter)
	IC.listButtons[i]:SetScript("OnLeave", listButtonOnLeave)
end
TradeSkillHighlightFrame:Hide()
TradeSkillHighlightFrame:SetAlpha(0)
-- 리스트 스크롤바 위치 이동
TradeSkillListScrollFrame:ClearAllPoints()
TradeSkillListScrollFrame:SetPoint("TOPLEFT", TradeSkillSkill1, 10, 0)
TradeSkillListScrollFrame:SetPoint("BOTTOMRIGHT", TradeSkillSkill20, "BOTTOMLEFT", 298, 0)
TradeSkillListScrollFrame:DisableDrawLayer("BACKGROUND")
region = TradeSkillListScrollFrameScrollBarScrollUpButton:CreateTexture(nil, "BACKGROUND")
region:SetTexture("Interface\\ClassTrainerFrame\\UI-ClassTrainer-ScrollBar")
region:SetTexCoord(0, 0.40625, 0, 0.25)
region:SetPoint("TOPRIGHT", 0, 5)
region:SetWidth(26)
region:SetHeight(32)
region = TradeSkillListScrollFrameScrollBarScrollDownButton:CreateTexture(nil, "BACKGROUND")
region:SetTexture("Interface\\ClassTrainerFrame\\UI-ClassTrainer-ScrollBar")
region:SetTexCoord(0.53125, 0.9375, 0.75, 1)
region:SetPoint("BOTTOMRIGHT", 0, -2)
region:SetWidth(26)
region:SetHeight(32)
region = TradeSkillListScrollFrameScrollBarScrollDownButton:CreateTexture(nil, "BACKGROUND")
region:SetTexture("Interface\\ClassTrainerFrame\\UI-ClassTrainer-ScrollBar")
region:SetTexCoord(0, 0.40625, 0.25, 0.9375)
region:SetPoint("TOPLEFT", TradeSkillListScrollFrameScrollBarScrollUpButton, "TOPRIGHT", -26, -27)
region:SetPoint("BOTTOMRIGHT", 0, 28)
region = TradeSkillFrame:CreateTexture(nil, "OVERLAY")
region:SetTexture("Interface\\AddOns\\InvenCraftInfo2_UI\\Texture\\VerticalLine")
region:SetPoint("TOPLEFT", TradeSkillListScrollFrame, "TOPRIGHT", 19, 6)
region:SetWidth(16)
region:SetHeight(75)
region:SetTexCoord(0, 0.25, 0, 0.29296875)
region = TradeSkillFrame:CreateTexture(nil, "OVERLAY")
region:SetTexture("Interface\\AddOns\\InvenCraftInfo2_UI\\Texture\\VerticalLine")
region:SetPoint("BOTTOMLEFT", TradeSkillListScrollFrame, "BOTTOMRIGHT", 19, -5)
region:SetWidth(16)
region:SetHeight(75)
region:SetTexCoord(0.25, 0.5, 0, 0.29296875)
region = TradeSkillFrame:CreateTexture(nil, "OVERLAY")
region:SetTexture("Interface\\AddOns\\InvenCraftInfo2_UI\\Texture\\VerticalLine")
region:SetPoint("TOPLEFT", TradeSkillListScrollFrame, "TOPRIGHT", 19, -69)
region:SetPoint("BOTTOMLEFT", TradeSkillListScrollFrame, "BOTTOMRIGHT", 19, 70)
region:SetWidth(16)
region:SetTexCoord(0, 0.25, 0.29296875, 1)
-- 디테일 스크롤바 위치 이동
TradeSkillDetailScrollFrame:ClearAllPoints()
TradeSkillDetailScrollFrame:SetPoint("TOPLEFT", TradeSkillListScrollFrame, "TOPRIGHT", 33, 0)
TradeSkillDetailScrollFrame:SetPoint("BOTTOMLEFT", TradeSkillListScrollFrame, "BOTTOMRIGHT", 33, 0)
TradeSkillDetailScrollFrame:DisableDrawLayer("BACKGROUND")
region = TradeSkillDetailScrollFrameScrollBarScrollUpButton:CreateTexture(nil, "BACKGROUND")
region:SetTexture("Interface\\ClassTrainerFrame\\UI-ClassTrainer-ScrollBar")
region:SetTexCoord(0, 0.40625, 0, 0.25)
region:SetPoint("TOPRIGHT", 0, 5)
region:SetWidth(26)
region:SetHeight(32)
region = TradeSkillDetailScrollFrameScrollBarScrollDownButton:CreateTexture(nil, "BACKGROUND")
region:SetTexture("Interface\\ClassTrainerFrame\\UI-ClassTrainer-ScrollBar")
region:SetTexCoord(0.53125, 0.9375, 0.75, 1)
region:SetPoint("BOTTOMRIGHT", 0, -2)
region:SetWidth(26)
region:SetHeight(32)
region = TradeSkillDetailScrollFrameScrollBarScrollDownButton:CreateTexture(nil, "BACKGROUND")
region:SetTexture("Interface\\ClassTrainerFrame\\UI-ClassTrainer-ScrollBar")
region:SetTexCoord(0, 0.40625, 0.25, 0.9375)
region:SetPoint("TOPLEFT", TradeSkillDetailScrollFrameScrollBarScrollUpButton, "TOPRIGHT", -26, -27)
region:SetPoint("BOTTOMRIGHT", 0, 28)
-- 길드 목록 스크롤 위치 변경
TradeSkillGuildFrame:Hide()
TradeSkillGuildFrame.Show = TradeSkillGuildFrame.Hide
TradeSkillGuildCraftersFrame:Hide()
TradeSkillGuildCraftersFrame.list, TradeSkillGuildCraftersFrame.list1, TradeSkillGuildCraftersFrame.list2 = {}, {}, {}
TradeSkillGuildCraftersFrame:SetParent(TradeSkillViewGuildCraftersButton)
TradeSkillGuildCraftersFrame:ClearAllPoints()
TradeSkillGuildCraftersFrame:SetPoint("TOPLEFT", TradeSkillListScrollFrame, "BOTTOMRIGHT", 33, 81)
TradeSkillGuildCraftersFrame:SetPoint("BOTTOMLEFT", TradeSkillListScrollFrame, "BOTTOMRIGHT", 33, 0)
TradeSkillGuildCraftersFrame:SetWidth(TradeSkillDetailScrollFrame:GetWidth())
TradeSkillGuildCraftersFrame:DisableDrawLayer("BACKGROUND")
TradeSkillGuildCraftersFrame:SetScript("OnShow", function(self)
	TradeSkillDetailScrollFrame:SetPoint("BOTTOMLEFT", TradeSkillGuildCraftersFrame, "TOPLEFT", 0, 10)
end)
TradeSkillGuildCraftersFrame:SetScript("OnHide", function(self)
	TradeSkillDetailScrollFrame:SetPoint("BOTTOMLEFT", TradeSkillListScrollFrame, "BOTTOMRIGHT", 33, 0)
	wipe(self.list)
end)
region = TradeSkillGuildCraftersFrameScrollBarScrollUpButton:CreateTexture(nil, "BACKGROUND")
region:SetTexture("Interface\\ClassTrainerFrame\\UI-ClassTrainer-ScrollBar")
region:SetTexCoord(0, 0.40625, 0, 0.25)
region:SetPoint("TOPRIGHT", 0, 5)
region:SetWidth(26)
region:SetHeight(32)
region = TradeSkillGuildCraftersFrameScrollBarScrollDownButton:CreateTexture(nil, "BACKGROUND")
region:SetTexture("Interface\\ClassTrainerFrame\\UI-ClassTrainer-ScrollBar")
region:SetTexCoord(0.53125, 0.9375, 0.75, 1)
region:SetPoint("BOTTOMRIGHT", 0, -2)
region:SetWidth(26)
region:SetHeight(32)
region = TradeSkillGuildCraftersFrameScrollBarScrollDownButton:CreateTexture(nil, "BACKGROUND")
region:SetTexture("Interface\\ClassTrainerFrame\\UI-ClassTrainer-ScrollBar")
region:SetTexCoord(0, 0.40625, 0.25, 0.9375)
region:SetPoint("TOPLEFT", TradeSkillGuildCraftersFrameScrollBarScrollUpButton, "TOPRIGHT", -26, -27)
region:SetPoint("BOTTOMRIGHT", 0, 28)
region = TradeSkillGuildCraftersFrame:CreateTexture(nil, "OVERLAY")
region:SetTexture("Interface\\ClassTrainerFrame\\UI-ClassTrainer-HorizontalBar")
region:SetPoint("BOTTOMLEFT", TradeSkillGuildCraftersFrame, "TOPLEFT", -8, -2)
region:SetWidth(75)
region:SetHeight(16)
region:SetTexCoord(0, 0.29296875, 0, 0.25)
region = TradeSkillGuildCraftersFrame:CreateTexture(nil, "OVERLAY")
region:SetTexture("Interface\\ClassTrainerFrame\\UI-ClassTrainer-HorizontalBar")
region:SetPoint("BOTTOMRIGHT", TradeSkillGuildCraftersFrame, "TOPRIGHT", 28, -2)
region:SetWidth(75)
region:SetHeight(16)
region:SetTexCoord(0, 0.29296875, 0.25, 0.5)
region = TradeSkillGuildCraftersFrame:CreateTexture(nil, "OVERLAY")
region:SetTexture("Interface\\ClassTrainerFrame\\UI-ClassTrainer-HorizontalBar")
region:SetPoint("BOTTOMLEFT", TradeSkillGuildCraftersFrame, "TOPLEFT", 67, -2)
region:SetPoint("BOTTOMRIGHT", TradeSkillGuildCraftersFrame, "TOPRIGHT", -47, -2)
region:SetHeight(16)
region:SetTexCoord(0.29296875, 1, 0, 0.25)
TradeSkillGuildCraftersFrame.buttonParent = CreateFrame("Frame", nil, TradeSkillGuildCraftersFrame)
IC.guildButtons = {}
for i = 1, TRADE_SKILL_GUILD_CRAFTERS_DISPLAYED do
	IC.guildButtons[i] = _G["TradeSkillGuildCrafter"..i] or CreateFrame("Button", "TradeSkillGuildCrafter"..i, TradeSkillGuildCraftersFrame, "TradeSkillGuildCrafterButtonTemplate")
	IC.guildButtons[i]:SetParent(TradeSkillGuildCraftersFrame.buttonParent)
	IC.guildButtons[i]:SetWidth(148)
	IC.guildButtons[i]:ClearAllPoints()
	if i == 1 then
		IC.guildButtons[i]:SetPoint("TOPLEFT", TradeSkillGuildCraftersFrame, "TOPLEFT", 0, 0)
	elseif i % 2 == 0 then
		IC.guildButtons[i]:SetPoint("LEFT", IC.guildButtons[i - 1], "RIGHT", 2, 0)
	else
		IC.guildButtons[i]:SetPoint("TOPLEFT", IC.guildButtons[i - 2], "BOTTOMLEFT", 0, 0)
	end
end
-- 숨겨진것들 복구
TradeSkillFrameSearchBox:Show()
TradeSkillSkillName:Show()
TradeSkillSkillIcon:Show()
TradeSkillFramePortrait:Show()
TradeSkillFrameTabardBackground:Hide()
TradeSkillFrameTabardEmblem:Hide()
TradeSkillFrameTabardBorder:Hide()
-- 총 배운 갯수바 만들기
IC.statusbar = CreateFrame("StatusBar", nil, TradeSkillFrame)
IC.statusbar:SetStatusBarTexture("Interface\\TargetingFrame\\UI-TargetingFrame-BarFill", "BORDER")
IC.statusbar:SetWidth(326)
IC.statusbar:SetHeight(15)
IC.statusbar:SetPoint("BOTTOMLEFT", 5, 6)
IC.statusbar:SetStatusBarColor(0, 0, 1, 1)
IC.statusbar:SetMinMaxValues(0, 1)
IC.statusbar.left = IC.statusbar:CreateTexture(nil, "ARTWORK")
IC.statusbar.left:SetTexture("Interface\\PaperDollInfoFrame\\UI-Character-Skills-BarBorderHighlight")
IC.statusbar.left:SetTexCoord(0, 0.125, 0, 1)
IC.statusbar.left:SetWidth(32)
IC.statusbar.left:SetHeight(40)
IC.statusbar.left:SetPoint("LEFT", -5, 0)
IC.statusbar.right = IC.statusbar:CreateTexture(nil, "ARTWORK")
IC.statusbar.right:SetTexture("Interface\\PaperDollInfoFrame\\UI-Character-Skills-BarBorderHighlight")
IC.statusbar.right:SetTexCoord(0.875, 1, 0, 1)
IC.statusbar.right:SetWidth(32)
IC.statusbar.right:SetHeight(40)
IC.statusbar.right:SetPoint("RIGHT", 5, 0)
IC.statusbar.center = IC.statusbar:CreateTexture(nil, "ARTWORK")
IC.statusbar.center:SetTexture("Interface\\PaperDollInfoFrame\\UI-Character-Skills-BarBorderHighlight")
IC.statusbar.center:SetTexCoord(0.125, 0.875, 0, 1)
IC.statusbar.center:SetPoint("TOPLEFT", IC.statusbar.left, "TOPRIGHT", 0, 0)
IC.statusbar.center:SetPoint("BOTTOMRIGHT", IC.statusbar.right, "BOTTOMLEFT", 0, 0)
IC.statusbar.tex = IC.statusbar:CreateTexture(nil, "BACKGROUND")
IC.statusbar.tex:SetAllPoints()
IC.statusbar.tex:SetTexture(0, 0, 0, 0.5)
IC.statusbar.text = IC.statusbar:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
IC.statusbar.text:SetPoint("CENTER", 0, 1)
-- 세부 정보창 수정
TradeSkillDetailHeaderLeft:SetPoint("TOPLEFT", 0, 0)
TradeSkillDetailHeaderLeft:SetTexture(0, 0, 0, 0.5)
TradeSkillDetailHeaderLeft:SetWidth(297)
TradeSkillDetailHeaderLeft:SetHeight(50)
IC.addFavoriteButton = CreateFrame("Button", nil, TradeSkillDetailScrollChildFrame)
IC.addFavoriteButton:SetWidth(16)
IC.addFavoriteButton:SetHeight(16)
IC.addFavoriteButton:SetPoint("TOPRIGHT", TradeSkillDetailHeaderLeft, 0, 0)
IC.addFavoriteButton:SetNormalTexture("Interface\\Buttons\\UI-GuildButton-PublicNote-Up")
IC.addFavoriteButton.deleteIcon = IC.addFavoriteButton:CreateTexture(nil, "OVERLAY")
IC.addFavoriteButton.deleteIcon:SetAllPoints()
IC.addFavoriteButton.deleteIcon:SetTexture("Interface\\Common\\VoiceChat-Muted")
IC.addFavoriteButton.deleteIcon:SetAlpha(0.75)
IC.addFavoriteButton:SetScript("OnClick", function(self)
	if TradeSkillFrame.selectedID then
		TradeSkillFrame.selectedSkill = IC:GetTradeSkillRecipeID(TradeSkillFrame.selectedID)
		if TradeSkillFrame.selectedSkill then
			if IC.favoritedb[TradeSkillFrame.selectedSkill] then
				IC.favoritedb[TradeSkillFrame.selectedSkill] = nil
				self.deleteIcon:Hide()
			else
				IC.favoritedb[TradeSkillFrame.selectedSkill] = true
				self.deleteIcon:Show()
			end
			IC:UpdateFavoriteList()
			TradeSkillFrame_Update()
			self:GetScript("OnEnter")(self)
		end
	end
end)
IC.addFavoriteButton:SetScript("OnEnter", function(self)
	GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
	GameTooltip:AddLine(self.deleteIcon:IsShown() and "즐겨찾기에서 빼기" or "즐겨찾기에 추가하기")
	GameTooltip:Show()
end)
IC.addFavoriteButton:SetScript("OnLeave", GameTooltip_Hide)
for i = 1, TradeSkillDetailScrollChildFrame:GetNumRegions() do
	region = select(i, TradeSkillDetailScrollChildFrame:GetRegions())
	if region:GetObjectType() == "Texture" and region:GetTexture() == "Interface\\ClassTrainerFrame\\UI-ClassTrainer-DetailHeaderRight" then
		region:SetTexture("")
		break
	end
end
local updateTimer = 0
local function itemOnUpdate(self, timer)
	updateTimer = updateTimer + timer
	if updateTimer > 1 then
		updateTimer = 0
		if TradeSkillFrame.selectedID and GameTooltip:GetOwner() == self then
			if self == TradeSkillSkillIcon then
				GameTooltip:SetTradeSkillItem(TradeSkillFrame.selectedID)
			else
				GameTooltip:SetTradeSkillItem(TradeSkillFrame.selectedID, self:GetID())
			end
		else
			GameTooltip_HideResetCursor(self)
			self:SetScript("OnUpdate", nil)
			return
		end
	end
	CursorUpdate(self)
end
local function itemOnEnter(self)
	if self == TradeSkillSkillIcon then
		GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
	else
		GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT")
	end
	self:SetScript("OnUpdate", itemOnUpdate)
	itemOnUpdate(self, 2)
end
local function itemOnLeave(self)
	GameTooltip_HideResetCursor(self)
	self:SetScript("OnUpdate", nil)
end
local function itemOnClick(self, button)
	if button == "LeftButton" then
		local item
		if self == TradeSkillSkillIcon then
			item = GetTradeSkillItemLink(TradeSkillFrame.selectedID)
		else
			item = GetTradeSkillReagentItemLink(TradeSkillFrame.selectedID, self:GetID())
		end
		if item and item:find("|H") then
			if IsModifiedClick() then
				if not(BlueItemInfo3 and BlueItemInfo3:ModifiedItemClick(item)) then
					HandleModifiedItemClick(GetFixedLink(item))
				end
			else
				SetItemRef(item:match("|H(.+)|h%["), item, button)
			end
		end
	end
end
TradeSkillSkillIcon:SetPoint("TOPLEFT", 4, -3)
TradeSkillSkillIcon:SetWidth(46)
TradeSkillSkillIcon:SetHeight(46)
TradeSkillSkillIcon:SetNormalTexture("")
TradeSkillSkillIcon:GetNormalTexture():SetDrawLayer("BORDER")
TradeSkillSkillIcon:SetScript("OnUpdate", nil)
TradeSkillSkillIcon:SetScript("OnEnter", itemOnEnter)
TradeSkillSkillIcon:SetScript("OnLeave", itemOnLeave)
TradeSkillSkillIcon:SetScript("OnClick", itemOnClick)
TradeSkillSkillIconCount:SetPoint("BOTTOMRIGHT", -2, 4)
IC.skillIconBorder = TradeSkillSkillIcon:CreateTexture(nil, "ARTWORK")
IC.skillIconBorder:SetTexture("Interface\\AddOns\\InvenCraftInfo2_UI\\Texture\\IconBorder")
IC.skillIconBorder:SetAllPoints()
IC.skillIconBorder:SetAlpha(0.5)
TradeSkillSkillName:SetPoint("TOPLEFT", 51, -2)
TradeSkillRequirementText:SetParent(UIParent)
TradeSkillRequirementText:SetWidth(0)
TradeSkillRequirementText:SetHeight(0)
TradeSkillRequirementText:SetText(nil)
TradeSkillRequirementText:ClearAllPoints()
TradeSkillRequirementText:SetAlpha(0)
TradeSkillRequirementText:Hide()
TradeSkillRequirementLabel:SetWidth(244)
TradeSkillRequirementLabel:Show()
TradeSkillRequirementLabel:SetJustifyH("LEFT")
IC.detailRequire = TradeSkillDetailScrollChildFrame:CreateFontString(nil, "BACKGROUND", "GameFontHighlightSmallLeft")
IC.detailRequire:SetPoint("TOPLEFT", TradeSkillRequirementLabel, "BOTTOMLEFT", 0, 0)
IC.detailRequire:SetWidth(244)
TradeSkillSkillCooldown:SetPoint("TOPLEFT", IC.detailRequire, "BOTTOMLEFT", 0, 0)
TradeSkillSkillCooldown:SetWidth(244)
TradeSkillSkillCooldown:SetJustifyH("LEFT")
TradeSkillDescription:SetPoint("TOPLEFT", 5, -56)
IC.detailTrainerLabel = TradeSkillDetailScrollChildFrame:CreateFontString(nil, "BACKGROUND", "GameFontNormalSmall")
IC.detailTrainerLabel:SetFormattedText("%s:", TRADESKILL_SERVICE_LEARN)
IC.detailDiscoveryLabel = TradeSkillDetailScrollChildFrame:CreateFontString(nil, "BACKGROUND", "GameFontNormalSmall")
IC.detailDiscoveryLabel:SetFormattedText("%s(%s):", TRADESKILL_SERVICE_LEARN, "발견")
IC.detailDropLabel = TradeSkillDetailScrollChildFrame:CreateFontString(nil, "BACKGROUND", "GameFontNormalSmall")
IC.detailDropLabel:SetFormattedText("%s(%s):", TRADESKILL_SERVICE_LEARN, LOOT)
IC.detailSellLabel = TradeSkillDetailScrollChildFrame:CreateFontString(nil, "BACKGROUND", "GameFontNormalSmall")
IC.detailSellLabel:SetFormattedText("%s(%s):", TRADESKILL_SERVICE_LEARN, TUTORIAL_TITLE20)
IC.detailQuestLabel = TradeSkillDetailScrollChildFrame:CreateFontString(nil, "BACKGROUND", "GameFontNormalSmall")
IC.detailQuestLabel:SetFormattedText("%s(%s):", TRADESKILL_SERVICE_LEARN, QUESTS_LABEL)
local function reagentOnEnter(self)
	if TradeSkillFrame.selectedID then
		GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT")
		GameTooltip:SetTradeSkillItem(TradeSkillFrame.selectedID, self:GetID())
		CursorUpdate(self)
	else
		GameTooltip_HideResetCursor(self)
	end
end
local function goChildOnClick(self)
	if IC.spellLocation[self.goto] then
		tinsert(IC.reagentQue, self.goto)
		TradeSkillFrame_SetSelection(IC.spellLocation[self.goto])
		TradeSkillFrame_Update()
	end
end
for i = 1, MAX_TRADE_SKILL_REAGENTS do
	IC.reagentButtons[i] = _G["TradeSkillReagent"..i]
	IC.reagentButtons[i]:Show()
	IC.reagentButtons[i].icon = _G["TradeSkillReagent"..i.."IconTexture"]
	IC.reagentButtons[i].count = _G["TradeSkillReagent"..i.."Count"]
	IC.reagentButtons[i].count:SetFont(STANDARD_TEXT_FONT, 12, "OUTLINE")
	IC.reagentButtons[i].count:SetPoint("BOTTOMRIGHT", IC.reagentButtons[i].icon, -1, 4)
	IC.reagentButtons[i].name = _G["TradeSkillReagent"..i.."Name"]
	IC.reagentButtons[i].name:ClearAllPoints()
	IC.reagentButtons[i].name:SetPoint("TOPLEFT", "TradeSkillReagent"..i.."NameFrame", 14, -10)
	IC.reagentButtons[i].name:SetPoint("BOTTOMRIGHT", "TradeSkillReagent"..i.."NameFrame", -17, 12)
	IC.reagentButtons[i].border = IC.reagentButtons[i]:CreateTexture(nil, "ARTWORK")
	IC.reagentButtons[i].border:SetTexture("Interface\\AddOns\\InvenCraftInfo2_UI\\Texture\\IconBorder")
	IC.reagentButtons[i].border:SetAllPoints(IC.reagentButtons[i].icon)
	IC.reagentButtons[i].border:SetAlpha(0.5)
	IC.reagentButtons[i].goChild = CreateFrame("Button", nil, IC.reagentButtons[i])
	IC.reagentButtons[i].goChild:SetSize(18, 18)
	IC.reagentButtons[i].goChild:SetNormalTexture("Interface\\ChatFrame\\UI-ChatIcon-ScrollDown-Up")
	IC.reagentButtons[i].goChild:SetPushedTexture("Interface\\ChatFrame\\UI-ChatIcon-ScrollDown-Down")
	IC.reagentButtons[i].goChild:SetHighlightTexture("Interface\\Buttons\\UI-AttributeButton-Encourage-Hilight")
	IC.reagentButtons[i].goChild:SetPoint("TOPRIGHT", 0, 2)
	IC.reagentButtons[i].goChild:SetScript("OnClick", goChildOnClick)
	IC.reagentButtons[i].goChild:SetScript("OnHide", sourceOnHide)
	IC.reagentButtons[i].goChild:SetScript("OnEnter", sourceOnEnter)
	IC.reagentButtons[i].goChild:SetScript("OnLeave", GameTooltip_Hide)
	IC.reagentButtons[i]:Hide()
	IC.reagentButtons[i]:SetScript("OnUpdate", nil)
	IC.reagentButtons[i]:SetScript("OnEnter", itemOnEnter)
	IC.reagentButtons[i]:SetScript("OnLeave", itemOnLeave)
	IC.reagentButtons[i]:SetScript("OnClick", itemOnClick)
end
IC.backParent = CreateFrame("Button", nil, TradeSkillDetailScrollChildFrame)
IC.backParent:SetSize(18, 18)
IC.backParent:SetNormalTexture("Interface\\ChatFrame\\UI-ChatIcon-ScrollUp-Up")
IC.backParent:SetPushedTexture("Interface\\ChatFrame\\UI-ChatIcon-ScrollUp-Down")
IC.backParent:SetHighlightTexture("Interface\\Buttons\\UI-AttributeButton-Encourage-Hilight")
IC.backParent:SetPoint("RIGHT", IC.addFavoriteButton, "LEFT", 0, 0)
IC.backParent:SetScript("OnClick", goChildOnClick)
IC.backParent:SetScript("OnHide", sourceOnHide)
IC.backParent:SetScript("OnEnter", sourceOnEnter)
IC.backParent:SetScript("OnLeave", GameTooltip_Hide)
-- 로딩 아이콘 만들기
IC.loading = CreateFrame("Frame", nil, TradeSkillFrame)
IC.loading:Hide()
IC.loading:SetPoint("CENTER", 0, 0)
IC.loading:SetSize(64, 64)
IC.loading:SetPoint("TOPRIGHT", TradeSkillRankFrame, "TOPLEFT", 0, 10)
region = IC.loading:CreateTexture(nil, "BACKGROUND", 1)
region:SetTexture("Interface\\COMMON\\StreamBackground")
region:SetVertexColor(0.65, 0.65, 1)
region:SetAllPoints()
region = IC.loading:CreateTexture(nil, "ARTWORK")
region:SetTexture("Interface\\COMMON\\StreamFrame")
region:SetAllPoints()
IC.loading.spin = CreateFrame("Frame", nil, IC.loading)
IC.loading.spin:SetAllPoints()
IC.loading.spin:SetAlpha(0.5)
region = IC.loading.spin:CreateTexture(nil, "BACKGROUND", 2)
region:SetTexture("Interface\\COMMON\\StreamCircle")
region:SetVertexColor(0.65, 0.65, 1)
region:SetAllPoints()
region = IC.loading.spin:CreateTexture(nil, "OVERLAY", 1)
region:SetTexture("Interface\\COMMON\\StreamSpark")
region:SetAllPoints()
IC.loading.loop = IC.loading.spin:CreateAnimationGroup()
IC.loading.loop:SetLooping("REPEAT")
region = IC.loading.loop:CreateAnimation("Rotation")
region:SetDuration(4)
region:SetDegrees(-360)
IC.loading:SetScript("OnShow", function(self)
	self.loop:Play()
end)
IC.loading:SetScript("OnHide", function(self)
	self.loop:Stop()
end)
IC.loading:SetScript("OnEnter", function(self)
	GameTooltip:SetOwner(self, "ANCHOR_TOP", 0, -10)
	GameTooltip:SetText("전문기술 정보를 서버로부터 가져오는 중입니다.", nil, nil, nil, nil, 1)
end)
IC.loading:SetScript("OnLeave", GameTooltip_Hide)