local _,ns = ...
ns.ADDUIEVENT("PLAYER_ENTERING_WORLD", function()
if C_AddOns.IsAddOnLoaded("Dominos") then return end
if C_AddOns.IsAddOnLoaded("Bartender4") then return end

if AddUIDB.mmb ==  false  then return end
ns.StyleButton()
C_Timer.After(5,function()
	ns.StyleButton()
end)
hooksecurefunc(EditModeSystemMixin, "OnEditModeExit", function()
	ns.StyleButton()
end)

--动作条@简繁NGA:zhangzhanxian3

if InCombatLockdown() then return end		--战斗中不执行

-- 动作条按键范围着色
hooksecurefunc("ActionButton_UpdateRangeIndicator", function(self, checksRange, inRange)
if self.action == nil then return end
local isUsable, notEnoughMana = IsUsableAction(self.action)
	if ( checksRange and not inRange ) then
		_G[self:GetName().."Icon"]:SetVertexColor(0.5, 0.1, 0.1)
	elseif isUsable ~= true or notEnoughMana == true then
		_G[self:GetName().."Icon"]:SetVertexColor(0.4, 0.4, 0.4)
	else
		_G[self:GetName().."Icon"]:SetVertexColor(1, 1, 1)
	end
end)

--宏颜色--
local r={"MultiBarBottomLeft", "MultiBarBottomRight", "Action", "MultiBarLeft", "MultiBarRight","MultiBar5","MultiBar6","MultiBar7"} 
for b=1,#r do for i=1,12 do _G[r[b].."Button"..i.."Name"]:SetVertexColor(0, 255, 255) end end

--经验条
StatusTrackingBarManager:SetScale(.73)

--队伍查找器
QueueStatusButton:ClearAllPoints()
QueueStatusButton:SetPoint("TOPRIGHT", Minimap,"BOTTOMLEFT", 7, 7)
QueueStatusButton:HookScript("OnUpdate",function()
	QueueStatusButton:ClearAllPoints()
	QueueStatusButton:SetPoint("TOPRIGHT", Minimap,"BOTTOMLEFT", 7, 7)
end)

if AddUIDB.minimb ==  false then return end

--迷你菜单位置

local function micropoint()
MicroMenuContainer:SetScale(.7)

local xx,yy = MicroMenuContainer.Selection:GetSize()
CharacterMicroButton:ClearAllPoints()
MainMenuMicroButton.MainMenuBarPerformanceBar:Hide()
--if not UnitHasVehicleUI("player") then

C_Timer.After(.2,function()
if not OverrideActionBar:IsShown() then
	CharacterMicroButton:SetScale(2.1)
	EJMicroButton:SetScale(2.1)
	MainMenuMicroButton:SetScale(2.1)
	--冒险指南
	EJMicroButton:ClearAllPoints()
	EJMicroButton:SetPoint("TOPLEFT",CharacterMicroButton,"TOPRIGHT",-6,0)
	--系统
	MainMenuMicroButton:ClearAllPoints()
	MainMenuMicroButton:SetPoint("TOPLEFT",EJMicroButton,"TOPRIGHT",-6,0)
	if yy > 50 then
		CharacterMicroButton:SetPoint("BOTTOMLEFT",MicroMenuContainer.Selection,"BOTTOMLEFT",-6,-3)
	else
		CharacterMicroButton:SetPoint("BOTTOMLEFT",MicroMenuContainer.Selection,"BOTTOMLEFT",-6,-3)
	end
	--天赋
	PlayerSpellsMicroButton:ClearAllPoints()
	PlayerSpellsMicroButton:SetPoint("TOPLEFT",MainMenuMicroButton,"TOPRIGHT",-9,-5)
else
MicroMenu:SetScale(0.7)
	CharacterMicroButton:SetScale(2)
	EJMicroButton:SetScale(1)
	MainMenuMicroButton:SetScale(1)
	--冒险指南
	EJMicroButton:ClearAllPoints()
	EJMicroButton:SetPoint("TOPLEFT",CharacterMicroButton,"TOPRIGHT",-9,-38)
	--系统
	MainMenuMicroButton:ClearAllPoints()
	MainMenuMicroButton:SetPoint("TOPLEFT",EJMicroButton,"TOPRIGHT",-33,35)
	if yy > 50 then
		CharacterMicroButton:SetPoint("LEFT",MicroMenuContainer.Selection,"LEFT",-100,10)
	elseif yy < 30 then
		CharacterMicroButton:SetPoint("LEFT",MicroMenuContainer.Selection,"LEFT",-100,15)
	else
		CharacterMicroButton:SetPoint("LEFT",MicroMenuContainer.Selection,"LEFT",-100,20)
	end
	--天赋法术书
	PlayerSpellsMicroButton:ClearAllPoints()
	PlayerSpellsMicroButton:SetPoint("TOPLEFT",MainMenuMicroButton,"TOPRIGHT",-6,0)
end
end)

--专业
ProfessionMicroButton:ClearAllPoints()
ProfessionMicroButton:SetPoint("TOPLEFT",PlayerSpellsMicroButton,"TOPRIGHT",-6,0)
--成就
AchievementMicroButton:ClearAllPoints()
AchievementMicroButton:SetPoint("TOPLEFT",ProfessionMicroButton,"TOPRIGHT",-6,0)
--任务
QuestLogMicroButton:ClearAllPoints()
QuestLogMicroButton:SetPoint("TOPLEFT",AchievementMicroButton,"TOPRIGHT",-6,0)
--公会
GuildMicroButton:ClearAllPoints()
GuildMicroButton:SetPoint("TOP",PlayerSpellsMicroButton,"BOTTOM",0,5)
--队伍查找器按钮
LFDMicroButton:ClearAllPoints()
LFDMicroButton:SetPoint("TOPLEFT",GuildMicroButton,"TOPRIGHT",-6,0)
--藏品
CollectionsMicroButton:ClearAllPoints()
CollectionsMicroButton:SetPoint("TOPLEFT",LFDMicroButton,"TOPRIGHT",-6,0)
--商城
StoreMicroButton:ClearAllPoints()
StoreMicroButton:SetPoint("TOPLEFT",CollectionsMicroButton,"TOPRIGHT",-6,0)
end

hooksecurefunc("UpdateMicroButtons",micropoint)
hooksecurefunc("PlayerFrame_ToVehicleArt",micropoint)

--背包位置
--MainMenuBarBackpackButton:SetScale(.9)
--MainMenuBarBackpackButton:ClearAllPoints()
--MainMenuBarBackpackButton:SetPoint("BOTTOMLEFT",UIParent,"BOTTOMRIGHT",-455,0)
--BagBarExpandToggle:ClearAllPoints()
--BagBarExpandToggle:SetPoint("BOTTOMRIGHT",MainMenuBarBackpackButton.AnimIcon,"BOTTOMLEFT",0,7)
--CharacterReagentBag0Slot:ClearAllPoints()	--10.05新材料包
--CharacterReagentBag0Slot:SetPoint("BOTTOMRIGHT",MainMenuBarBackpackButton,"BOTTOMLEFT",-5,-2)
--[屏蔽动作条转圈]
--hooksecurefunc('CooldownFrame_Set', function(self) if self.currentCooldownType == COOLDOWN_TYPE_LOSS_OF_CONTROL then self:SetCooldown(0,0) end end)

end)