소스 검색

Added gossip attach frame

3.0
SabinDeus 8 년 전
부모
커밋
319ed0464b
3개의 변경된 파일154개의 추가작업 그리고 98개의 파일을 삭제
  1. 7
    7
      TurnIn.lua
  2. 79
    90
      TurnIn.xml
  3. 68
    1
      TurnInUI.lua

+ 7
- 7
TurnIn.lua 파일 보기

SlashCmdList["TI"]=TI_SlashCmdHandler; SlashCmdList["TI"]=TI_SlashCmdHandler;
SLASH_TI1="/turnin"; SLASH_TI1="/turnin";
SLASH_TI2="/ti"; SLASH_TI2="/ti";
tinsert(UISpecialFrames,"TI_OptionsFrame");
--tinsert(UISpecialFrames,"TI_OptionsFrame");
TI_slashtable = {}; TI_slashtable = {};
TI_gossipopts = {}; TI_gossipopts = {};
TI_gossipclosed = false; TI_gossipclosed = false;
function TI_EventHandlers:GOSSIP_SHOW () function TI_EventHandlers:GOSSIP_SHOW ()
TI_debug("Gossip Show"); TI_debug("Gossip Show");
if(GossipFrame:IsVisible()) then if(GossipFrame:IsVisible()) then
TI_AttachFrameToGossip(GossipFrame);
if(TI_gossipclosed) then if(TI_gossipclosed) then
TI_debug("resetting pointers"); TI_debug("resetting pointers");
TI_gossipclosed = false; TI_gossipclosed = false;
function TI_EventHandlers:GOSSIP_CLOSED () function TI_EventHandlers:GOSSIP_CLOSED ()
TI_debug("Gossip Closed"); TI_debug("Gossip Closed");
if(not GossipFrame:IsVisible()) then if(not GossipFrame:IsVisible()) then
TI_gossipclosed = true;
TI_DetachFrame();
TI_gossipclosed = true;
end; end;
end end


local thisnpc = TI_NPCDB[npcname]; local thisnpc = TI_NPCDB[npcname];
if(thisnpc.state) then if(thisnpc.state) then
TI_debug("npc is active, using his options"); TI_debug("npc is active, using his options");
TI_PopulateGossipOptionFrame(thisnpc);
for i1,current in ipairs(thisnpc) do for i1,current in ipairs(thisnpc) do
if (current.state == true) then if (current.state == true) then
TI_debug("Current Quest: "..current.name); TI_debug("Current Quest: "..current.name);
end; end;
TI_debug("using default config"); TI_debug("using default config");
TI_PopulateGossipOptionFrame(TI_status.options);
for i,current in ipairs(TI_status.options) do for i,current in ipairs(TI_status.options) do
if(current.state) then if(current.state) then
if(current.type == "availquest" and #AvailableQuests > 0 and TI_availnumber <= #AvailableQuests) then if(current.type == "availquest" and #AvailableQuests > 0 and TI_availnumber <= #AvailableQuests) then




function toggle(arg) function toggle(arg)
if(arg) then
return false;
else
return true;
end
return not arg;
end end

+ 79
- 90
TurnIn.xml 파일 보기

</Scripts> </Scripts>
</Frame> </Frame>



<Button name="TI_GossipOptionFrame" virtual="true" hidden="false">
<Size>
<AbsDimension x="270" y="20" />
</Size>
<Layers>
<Layer level="ARTWORK">
<Texture name="$parent_Icon" file="Interface\QuestFrame\UI-Quest-BulletPoint">
<Size>
<AbsDimension x="16" y="16"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="0" y="-3"/>
</Offset>
</Anchor>
</Anchors>
</Texture>
<FontString name="$parent_Text" inherits="GameFontNormal" justifyV="top" justifyH="left" text="">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parent_Icon" relativePoint="TOPRIGHT">
<Offset>
<AbsDimension x="0" y="-1"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
<Layer level="BACKGROUND">
<Texture name="$parent_Background" setAllPoints="true">
<Color r="0.2" g="0.2" b="1" a="0.0" />
</Texture>
</Layer>
</Layers>
</Button>
<Button name="TI_PriorityList" virtual="true" hidden="false">
<Size>
<AbsDimension x="270" y="20" />
</Size>
<Scripts><!--
<OnEnter>
getglobal(self:GetName() .. "_Background"):SetVertexColor(1,1,1,0.4);
</OnEnter>
<OnLeave>
getglobal(self:GetName() .. "_Background"):SetVertexColor(0,0,0,0.4);
</OnLeave>
-->
<Button name="TI_PriorityList" inherits="TI_GossipOptionFrame" virtual="true" hidden="false">
<Scripts>
<OnLoad>
getglobal(self:GetName() .. "_Icon"):SetPoint("TOPLEFT", self, "TOPLEFT", 20, -3)
</OnLoad>
</Scripts> </Scripts>
<Frames> <Frames>
<CheckButton name="$parent_Check" hidden="false" inherits="OptionsCheckButtonTemplate"> <CheckButton name="$parent_Check" hidden="false" inherits="OptionsCheckButtonTemplate">
<HighlightTexture file="Interface\Buttons\UI-Common-MouseHilight" alphaMode="ADD"/> <HighlightTexture file="Interface\Buttons\UI-Common-MouseHilight" alphaMode="ADD"/>
</Button> </Button>
</Frames> </Frames>
<Layers>
<Layer level="ARTWORK">
<Texture name="$parent_Icon" file="Interface\QuestFrame\UI-Quest-BulletPoint">
<Size>
<AbsDimension x="16" y="16"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="20" y="-3"/>
</Offset>
</Anchor>
</Anchors>
</Texture>
<FontString name="$parent_Text" inherits="GameFontNormal" justifyV="top" justifyH="left">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parent_Icon" relativePoint="TOPRIGHT">
<Offset>
<AbsDimension x="0" y="-1"/>
</Offset>
</Anchor>
<Anchor point="TOPRIGHT" relativeTo="$parent_MoveUp" relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
<Layer level="BACKGROUND">
<Texture name="$parent_Background" setAllPoints="true">
<Color r="0.2" g="0.2" b="1" a="0.0" />
</Texture>
</Layer>
</Layers>
<!--<NormalText name="$parent_Text" justifyV="top" justifyH="left" inherits="GameFontNormal" nonspacewrap="true">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parent_Icon" relativePoint="TOPRIGHT">
<Offset>
<AbsDimension x="0" y="-1"/>
</Offset>
</Anchor>
<Anchor point="TOPRIGHT" relativeTo="$parent_MoveUp" relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
<Size>
<AbsDimension x="156" y="0" />
</Size>
</NormalText>-->
</Button> </Button>
<Button name="TI_NPCList" virtual="true" hidden="false"> <Button name="TI_NPCList" virtual="true" hidden="false">
</Frame> </Frame>
<Frame Name="TI_OptionsFrame"> <Frame Name="TI_OptionsFrame">
<!--
<TitleRegion>
<Size>
<AbsDimension x="128" y="64"/>
</Size>
<Anchors>
<Anchor point="TOP">
<Offset>
<AbsDimension x="0" y="12"/>
</Offset>
</Anchor>
</Anchors>
</TitleRegion>
<Backdrop bgFile="Interface\DialogFrame\UI-DialogBox-Background" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true">
<BackgroundInsets>
<AbsInset left="11" right="12" top="12" bottom="11"/>
</BackgroundInsets>
<TileSize>
<AbsValue val="32"/>
</TileSize>
<EdgeSize>
<AbsValue val="32"/>
</EdgeSize>
</Backdrop>
-->
<Scripts> <Scripts>
<OnLoad> <OnLoad>
</Frames> </Frames>
</Frame> </Frame>
<Frame Name="TI_GossipStatusFrame" parent="UIParent" frameStrata="MEDIUM" toplevel="true" enableMouse="true" hidden="true">
<Size>
<AbsDimension x="200" y="130" />
</Size>
<Layers>
<Layer level="ARTWORK">
<FontString inherits="GameFontHighlight" text="Turn In Status">
<Anchors>
<Anchor point="TOPLEFT" relativePoint="TOPLEFT">
<Offset><AbsDimension x="6" y="-7" /></Offset>
</Anchor>
<Anchor point="TOPRIGHT">
<Offset><AbsDimension x="-6" y="-7" /></Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Backdrop bgFile="Interface\DialogFrame\UI-DialogBox-Background" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true">
<EdgeSize>
<AbsValue val="16"/>
</EdgeSize>
<TileSize>
<AbsValue val="16"/>
</TileSize>
<BackgroundInsets>
<AbsInset left="5" right="5" top="5" bottom="5"/>
</BackgroundInsets>
</Backdrop>
<Scripts>
<OnLoad>
TI_CreateAttachOptionFrames(self);
</OnLoad>
</Scripts>
<Frames>
</Frames>
</Frame>
<Frame name="TurnIn" hidden="true" frameStrata="LOW" enableMouse="false"> <Frame name="TurnIn" hidden="true" frameStrata="LOW" enableMouse="false">
<Scripts> <Scripts>

+ 68
- 1
TurnInUI.lua 파일 보기

end end
getglobal(entry .. "_Icon"):SetTexture(iconpath); getglobal(entry .. "_Icon"):SetTexture(iconpath);
getglobal(entry .. "_Check"):SetChecked(v.state); getglobal(entry .. "_Check"):SetChecked(v.state);
entrytext:SetWidth(156); --make sure to change this if you change the anchors in the XML
entrytext:SetWidth(165); --make sure to change this if you change the anchors in the XML
entrybutton:SetHeight( entrytext:GetHeight() + 6); entrybutton:SetHeight( entrytext:GetHeight() + 6);
entrybutton:Show(); entrybutton:Show();
last = last+1; last = last+1;
end end
end end


function TI_AttachFrameToGossip (frame)
TI_GossipStatusFrame:SetPoint("TOPLEFT", frame, "TOPRIGHT", 5, 2);
TI_GossipStatusFrame:Show();
-- for i, v in ipairs(TI_GossipStatusFrameOptions) do
-- v:Show();
-- end
end

function TI_DetachFrame()
TI_GossipStatusFrame:Hide();
TI_GossipStatusFrame:ClearAllPoints();
end

TI_GossipStatusFrameOptions = {};

function TI_CreateAttachOptionFrames(parent)
local prevbutton = parent;
for i=1,16 do
local button = CreateFrame("Button", parent:GetName()..i, parent, "TI_GossipOptionFrame");
button:Hide();
button:SetPoint("TOPLEFT", prevbutton, "BOTTOMLEFT", 0, 0);
table.insert(TI_GossipStatusFrameOptions, button);
prevbutton = button;
end
TI_GossipStatusFrameOptions[1]:SetPoint("TOPLEFT", parent, "TOPLEFT", 5, -20);
end

function TI_PopulateGossipOptionFrame(CurrOpts)
local last = 1;
local basename = "TI_GossipStatusFrame";
for i,v in ipairs(CurrOpts) do
if(v.state) then
local entry = basename .. last;
TI_debug(entry);
local entrybutton = getglobal(entry);
local entrytext = getglobal(entry .. "_Text");
local iconpath;
if(v.name == nil) then TI_debug("oh noes") end;
entrytext:SetText(v.name);
if(v.type == "activequest") then
if(v.icon) then
iconpath = v.icon;
else
iconpath = "Interface\\GossipFrame\\ActiveQuestIcon";
end
elseif(v.type == "availquest") then
if(v.icon) then
iconpath = v.icon;
else
iconpath = "Interface\\GossipFrame\\AvailableQuestIcon";
end
else
iconpath = "Interface\\GossipFrame\\" .. v.type .. "GossipIcon";
end
getglobal(entry .. "_Icon"):SetTexture(iconpath);
entrytext:SetWidth(175); --make sure to change this if you change the anchors in the XML
entrybutton:SetHeight( entrytext:GetHeight() + 6);
entrybutton:Show();
last = last+1;
end
end
for j=last, 16, 1 do
getglobal(basename .. j):Hide();
end
end



Loading…
취소
저장