⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 atlasloot.lua

📁 时间太紧了
💻 LUA
📖 第 1 页 / 共 2 页
字号:
                    if(AtlasLootWBBossButtons[zoneID][i] ~= nil and AtlasLootWBBossButtons[zoneID][i] ~= "") then
                        getglobal("AtlasBossLine_"..i.."_Text"):SetText(getglobal("AtlasText_"..i):GetText());
                        getglobal("AtlasBossLine_"..i.."_Loot"):Show();
                        getglobal("AtlasBossLine_"..i.."_Selected"):Hide();
                        getglobal("AtlasText_"..i):Hide();
                        getglobal("AtlasBossLine_"..i):Show();
                    else
                        getglobal("AtlasText_"..i):Show();					    getglobal("AtlasBossLine_"..i):Hide();
                    end
                end
                getglobal("AtlasLootInfo"):Show();
            else
                for i = 1, 27, 1 do                    getglobal("AtlasText_"..i):Show();				    getglobal("AtlasBossLine_"..i):Hide();			    end			    getglobal("AtlasLootInfo"):Hide();
            end	    else		    for i = 1, 27, 1 do			    getglobal("AtlasText_"..i):Show();			    getglobal("AtlasBossLine_"..i):Hide();		    end		    getglobal("AtlasLootInfo"):Hide();	    end	    AtlasLootItemsFrame:Hide();    endend
---------------------------------------------------------------------------------- Click on boss line--------------------------------------------------------------------------------function AtlasLootBoss_OnClick(id)	AtlasLootItemsFrame:Hide();
	AtlasLootItemsFrame.externalBoss = nil;
	AtlasLoot_AnchorFrame = AtlasFrame;		-- Added
		if ( ( AtlasLootItemsFrame.activeBoss ) and ( AtlasLootItemsFrame.activeBoss == id ) ) then		AtlasLootItemsFrame.activeBoss = nil;
		getglobal("AtlasBossLine_"..id.."_Loot"):Show();
		getglobal("AtlasBossLine_"..id.."_Selected"):Hide();
	else		AtlasLootItemsFrame.activeBoss = id;

		for i = 1, 27, 1 do
			getglobal("AtlasBossLine_"..i.."_Loot"):Show();
			getglobal("AtlasBossLine_"..i.."_Selected"):Hide();
		end

		local _,_,boss = string.find(getglobal("AtlasBossLine_"..id.."_Text"):GetText(), "|c%x%x%x%x%x%x%x%x%s*[%dX]*[%) ]*(.*[^%,])[%,]?$");

		if ( AtlasOptions.AtlasType == 1 ) then			local zoneID = ATLAS_DROPDOWN_LIST[AtlasOptions.AtlasZone];			local dataID = AtlasLootBossButtons[zoneID][id];			AtlasLoot_ShowItemsFrame(dataID, AtlasLootItems, "|cffFFd200Boss: |cffFFFFFF"..boss);

		elseif( AtlasOptions.AtlasType == 2 ) then
			zoneID = ATLAS_DROPDOWN_LIST_BG[AtlasOptions.AtlasZone];			local dataID = AtlasLootBattlegrounds[zoneID][id];			AtlasLoot_ShowItemsFrame(dataID, AtlasLootBGItems, "|cffFFFFFF"..boss);
            
        elseif( AtlasOptions.AtlasType == 5 ) then
			zoneID = ATLAS_DROPDOWN_LIST_RE[AtlasOptions.AtlasZone];			local dataID = AtlasLootWBBossButtons[zoneID][id];			AtlasLoot_ShowItemsFrame(dataID, AtlasLootWBItems, "|cffFFd200Boss: |cffFFFFFF"..boss);
            
		end
		getglobal("AtlasBossLine_"..id.."_Loot"):Hide();
		getglobal("AtlasBossLine_"..id.."_Selected"):Show();
		AtlasLoot_SetItemInfoFrame();	endend

-------------------------------------------------------------------------------------------------------------------
-- Code below placed in own function to allow calls from external sources as well as from AtlasLootBoss_OnClick(id)
-- The function now accepts :
--    1.) the internal lootid that is basically the key for a 'Boss'
--    2.) the AtlasLoot data array that should be examined for information on the 'Boss'
--    3.) the name of the 'Boss' to be displayed at the top of the AtlasLootItemsFrame
--    4.) a data structure detailing the frame to which the AtlasLootItemsFrame should be attached, and how it should
--          be anchored.  This argument can be ommitted, and the default AtlasFrame will be used.
-- This approach is currently dependant on the data structures being identical for BattleGrounds and Instances, and whatever
-- new data stores are added in the future.  If new or different data structures are added in any new categories
-- such as Exteranl Raid Bosses, then the code below should be changed to make sure it can handle that data also.
-------------------------------------------------------------------------------------------------------------------
function AtlasLoot_ShowItemsFrame(dataID, dataSource, boss, pFrame)
	local itemName, itemLink, itemQuality, itemLevel, itemType, itemSubType, itemCount, itemEquipLoc, itemTexture, itemColor;	local iconFrame, nameFrame, extraFrame;	local text, extra;
    
    getglobal("AtlasLoot_Tier0Button"):Hide();
    getglobal("AtlasLoot_Tier1Button"):Hide();
    getglobal("AtlasLoot_Tier2Button"):Hide();
    getglobal("AtlasLoot_Tier3Button"):Hide();
    getglobal("AtlasLoot_ZGButton"):Hide();
    getglobal("AtlasLoot_AQ20Button"):Hide();
    getglobal("AtlasLoot_AQ40Button"):Hide();
    getglobal("AtlasLoot_PVPButton"):Hide();

    if(dataID=="AQ40SET") then
        AtlasLoot_Set("AQ40SET");
    elseif(dataID=="AQ20SET") then
        AtlasLoot_Set("AQ20SET");
    elseif(dataID=="ZGSET") then
        AtlasLoot_Set("ZGSET");
    elseif(dataID=="T3SET") then
        AtlasLoot_Set("T3SET");
    elseif(dataID=="T2SET") then
        AtlasLoot_Set("T2SET");
    elseif(dataID=="T1SET") then
        AtlasLoot_Set("T1SET");
    elseif(dataID=="T0SET") then
        AtlasLoot_Set("T0SET");
    elseif(dataID=="PVPSET") then
        AtlasLoot_Set("PVPSET");    else
	    for i = 1, 30, 1 do		    if(dataSource[dataID][i] ~= nil and dataSource[dataID][i][3] ~= "") then			    itemName, itemLink, itemQuality, itemLevel, itemType, itemSubType, itemCount, itemEquipLoc, itemTexture = GetItemInfo(dataSource[dataID][i][1]);			    if(GetItemInfo(dataSource[dataID][i][1])) then				    _, _, _, itemColor = GetItemQualityColor(itemQuality);				    text = itemColor..itemName;			    else				    text = dataSource[dataID][i][3];
                    -- test KKram
                    -- look if lootlink Database known this ItemID. In this case, get ItemName from database.
                    if( AtlasLootOptions.LootlinkTT ) then
                        local itemID = dataSource[dataID][i][1];
                        if itemID ~= 0 then
                            for index, value in ItemLinks do
                                if string.find( value.i, itemID..":%d+:%d+:%d+") then
                                    text = gsub( text, "(=.+=).+", "%1" );
                                    text = text..index;
                                    break;
                                end
                            end
                        end
                    end
                    --end                     text = AtlasLoot_FixText(text);                end
			    extra = dataSource[dataID][i][4];                extra = AtlasLoot_FixText(extra);                if((not GetItemInfo(dataSource[dataID][i][1])) and (dataSource[dataID][i][1] ~= 0)) then                    extra = extra..ATLASLOOT_NO_ITEMINFO;                end					    iconFrame  = getglobal("AtlasLootItem_"..i.."_Icon");			    nameFrame  = getglobal("AtlasLootItem_"..i.."_Name");			    extraFrame = getglobal("AtlasLootItem_"..i.."_Extra");						    iconFrame:SetTexture("Interface\\Icons\\"..dataSource[dataID][i][2]);			    nameFrame:SetText(text);			    extraFrame:SetText(extra);				    getglobal("AtlasLootItem_"..i).itemID = dataSource[dataID][i][1];
			    getglobal("AtlasLootItem_"..i).storeID = dataSource[dataID][i][1];
			    getglobal("AtlasLootItem_"..i).droprate = dataSource[dataID][i][5];			    getglobal("AtlasLootItem_"..i).i = 1;
			    getglobal("AtlasLootItem_"..i):Show();		    else			    getglobal("AtlasLootItem_"..i):Hide();		    end	    end
        getglobal("AtlasLootItemsFrame_Druid"):Hide();
        getglobal("AtlasLootItemsFrame_Hunter"):Hide();
        getglobal("AtlasLootItemsFrame_Mage"):Hide();
        getglobal("AtlasLootItemsFrame_Paladin"):Hide();
        getglobal("AtlasLootItemsFrame_Priest"):Hide();
        getglobal("AtlasLootItemsFrame_Rogue"):Hide();
        getglobal("AtlasLootItemsFrame_Shaman"):Hide();
        getglobal("AtlasLootItemsFrame_Warlock"):Hide();
        getglobal("AtlasLootItemsFrame_Warrior"):Hide();
        getglobal("AtlasLootItemsFrame_Weapons"):Hide();
        getglobal("AtlasLootItemsFrame_BACK"):Hide();
        getglobal("AtlasLootItemsFrame_NEXT"):Hide();
        getglobal("AtlasLootItemsFrame_PREV"):Hide();	AtlasLoot_BossName:SetText(boss);
    end
	AtlasLoot_SetItemInfoFrame(pFrame);	-- New function to Show the frame, dependant on which frame you want to attach it to
	    -- pFrame can be a 'nil' value, and the AtlasFrame will be used by default
end

---------------------------------------------------------------------------------- Code to deal with External Requests to display the Loot Info frame--------------------------------------------------------------------------------

function AtlasLoot_ShowBossLoot(dataID, boss, pFrame)
	AtlasLootItemsFrame:Hide();	if ( AtlasLootItemsFrame.activeBoss ) then
		getglobal("AtlasBossLine_"..AtlasLootItemsFrame.activeBoss.."_Loot"):Show();
		getglobal("AtlasBossLine_"..AtlasLootItemsFrame.activeBoss.."_Selected"):Hide();
		AtlasLootItemsFrame.activeBoss = nil;
	end

	if ( dataID == AtlasLootItemsFrame.externalBoss ) then
		AtlasLootItemsFrame.externalBoss = nil;

	else

		-- The approach below is dependant on 'boss' IDs being Globally Unique
		-- i.e. the same 'boss' ID can not be used in both the Instance data and the BG data
		--      if it is, then this code will only ever fetch the BG data
			local dataSource = AtlasLootItems;	-- Instance data used as default

		if ( AtlasLootBGItems[dataID] ) then	-- but replace with BG data if 'boss' found there
			dataSource = AtlasLootBGItems;
        elseif ( AtlasLootWBItems[dataID] ) then    -- NEW 'ELSEIF'
            dataSource = AtlasLootWBItems;
        elseif ( AtlasLootSetItems[dataID] ) then    -- NEW 'ELSEIF'
            dataSource = AtlasLootSetItems;

-- ------------ elseif ( item exists in any new arrays added in the future such as External Raid Bosses ) then ......

		end

		AtlasLoot_AnchorFrame = pFrame;		-- Added
		AtlasLootItemsFrame.externalBoss = dataID;
		AtlasLoot_ShowItemsFrame(dataID, dataSource, boss, pFrame);
	end

end

--------------------------------------------------------------------------------
-- Setup Atlas Dependant XML Components
--------------------------------------------------------------------------------

function AtlasLoot_SetupForAtlas()

	AtlasLootBossLinesFrame:ClearAllPoints();
	AtlasLootBossLinesFrame:SetParent(AtlasFrame);
	AtlasLootBossLinesFrame:SetPoint("TOPLEFT", "AtlasText_ZoneName", "TOPLEFT", 0, -80);

	for i=1, ATLAS_LOOT_BOSS_LINES, 1 do
		getglobal("AtlasBossLine_"..i):ClearAllPoints();
		local anchorTo = "AtlasText_"..i;
		getglobal("AtlasBossLine_"..i):SetPoint("TOPLEFT", anchorTo, "TOPLEFT", 0, 0);
	end

	AtlasLootInfo:ClearAllPoints();
	AtlasLootInfo:SetParent(AtlasFrame);
	AtlasLootInfo:SetPoint("TOPLEFT", "AtlasFrame", "TOPLEFT", 546, -50);
    
    AtlasLootPanel:ClearAllPoints();
    AtlasLootPanel:SetParent(AtlasFrame);
    AtlasLootPanel:SetPoint("TOP", "AtlasFrame", "BOTTOM", 0, 9);

	AtlasLoot_SetItemInfoFrame();
	AtlasLootItemsFrame:Hide();

end

function AtlasLoot_SetItemInfoFrame(pFrame)
	if ( pFrame ) then
        if(pFrame==AtlasFrame and AtlasFrame) then
            AtlasLootItemsFrame:ClearAllPoints();
		    AtlasLootItemsFrame:SetParent(AtlasFrame);
		    AtlasLootItemsFrame:SetPoint("TOPLEFT", "AtlasFrame", "TOPLEFT", 18, -84);
        else
		    AtlasLootItemsFrame:ClearAllPoints();
		    AtlasLootItemsFrame:SetParent(pFrame[2]);
		    AtlasLootItemsFrame:ClearAllPoints();
		    AtlasLootItemsFrame:SetPoint(pFrame[1], pFrame[2], pFrame[3], pFrame[4], pFrame[5]);
        end
	elseif ( AtlasFrame ) then
		AtlasLootItemsFrame:ClearAllPoints();
		AtlasLootItemsFrame:SetParent(AtlasFrame);
		AtlasLootItemsFrame:SetPoint("TOPLEFT", "AtlasFrame", "TOPLEFT", 18, -84);
	else
		AtlasLootItemsFrame:ClearAllPoints();
		AtlasLootItemsFrame:SetParent(UIParent);
		AtlasLootItemsFrame:SetPoint("CENTER", "UIParent", "CENTER", 0, 0);
	end
	AtlasLootItemsFrame:Show();
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -