Added gossip attach frame
This commit is contained in:
parent
659f15f051
commit
319ed0464b
12
TurnIn.lua
12
TurnIn.lua
@ -66,7 +66,7 @@ function TI_OnLoad()
|
||||
SlashCmdList["TI"]=TI_SlashCmdHandler;
|
||||
SLASH_TI1="/turnin";
|
||||
SLASH_TI2="/ti";
|
||||
tinsert(UISpecialFrames,"TI_OptionsFrame");
|
||||
--tinsert(UISpecialFrames,"TI_OptionsFrame");
|
||||
TI_slashtable = {};
|
||||
TI_gossipopts = {};
|
||||
TI_gossipclosed = false;
|
||||
@ -128,6 +128,7 @@ end
|
||||
function TI_EventHandlers:GOSSIP_SHOW ()
|
||||
TI_debug("Gossip Show");
|
||||
if(GossipFrame:IsVisible()) then
|
||||
TI_AttachFrameToGossip(GossipFrame);
|
||||
if(TI_gossipclosed) then
|
||||
TI_debug("resetting pointers");
|
||||
TI_gossipclosed = false;
|
||||
@ -140,6 +141,7 @@ end
|
||||
function TI_EventHandlers:GOSSIP_CLOSED ()
|
||||
TI_debug("Gossip Closed");
|
||||
if(not GossipFrame:IsVisible()) then
|
||||
TI_DetachFrame();
|
||||
TI_gossipclosed = true;
|
||||
end;
|
||||
end
|
||||
@ -516,6 +518,7 @@ function TI_HandleGossipWindow(gorq)
|
||||
local thisnpc = TI_NPCDB[npcname];
|
||||
if(thisnpc.state) then
|
||||
TI_debug("npc is active, using his options");
|
||||
TI_PopulateGossipOptionFrame(thisnpc);
|
||||
for i1,current in ipairs(thisnpc) do
|
||||
if (current.state == true) then
|
||||
TI_debug("Current Quest: "..current.name);
|
||||
@ -562,6 +565,7 @@ function TI_HandleGossipWindow(gorq)
|
||||
end;
|
||||
|
||||
TI_debug("using default config");
|
||||
TI_PopulateGossipOptionFrame(TI_status.options);
|
||||
for i,current in ipairs(TI_status.options) do
|
||||
if(current.state) then
|
||||
if(current.type == "availquest" and #AvailableQuests > 0 and TI_availnumber <= #AvailableQuests) then
|
||||
@ -731,9 +735,5 @@ end
|
||||
|
||||
|
||||
function toggle(arg)
|
||||
if(arg) then
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
end
|
||||
return not arg;
|
||||
end
|
||||
163
TurnIn.xml
163
TurnIn.xml
@ -37,18 +37,47 @@
|
||||
</Frame>
|
||||
|
||||
|
||||
<Button name="TI_PriorityList" virtual="true" hidden="false">
|
||||
<Button name="TI_GossipOptionFrame" 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>
|
||||
-->
|
||||
<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" inherits="TI_GossipOptionFrame" virtual="true" hidden="false">
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
getglobal(self:GetName() .. "_Icon"):SetPoint("TOPLEFT", self, "TOPLEFT", 20, -3)
|
||||
</OnLoad>
|
||||
</Scripts>
|
||||
<Frames>
|
||||
<CheckButton name="$parent_Check" hidden="false" inherits="OptionsCheckButtonTemplate">
|
||||
@ -128,58 +157,6 @@
|
||||
<HighlightTexture file="Interface\Buttons\UI-Common-MouseHilight" alphaMode="ADD"/>
|
||||
</Button>
|
||||
</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 name="TI_NPCList" virtual="true" hidden="false">
|
||||
@ -437,32 +414,6 @@
|
||||
</Frame>
|
||||
|
||||
<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>
|
||||
<OnLoad>
|
||||
@ -905,6 +856,44 @@
|
||||
</Frames>
|
||||
</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">
|
||||
<Scripts>
|
||||
|
||||
69
TurnInUI.lua
69
TurnInUI.lua
@ -58,7 +58,7 @@ function TI_PopulateOptions(arg)
|
||||
end
|
||||
getglobal(entry .. "_Icon"):SetTexture(iconpath);
|
||||
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:Show();
|
||||
last = last+1;
|
||||
@ -317,4 +317,71 @@ function TI_SettingCheckboxUpdate()
|
||||
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…
Reference in New Issue
Block a user