Skip to content

Commit

Permalink
0.5.3
Browse files Browse the repository at this point in the history
- fix for #2
- added ':r' shortcaut for filter
- scroll folow selected skill
  • Loading branch information
laytya committed Feb 21, 2017
1 parent b434af8 commit 00a3e22
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 4 deletions.
40 changes: 38 additions & 2 deletions AdvancedTradeSkillWindow/atsw.lua
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ function ATSW_ShowWindow()
ATSWFrame_Update();
ATSWInputBox:SetText("1");
atsw_updatedelay=0.5;
ATSWQueueStartStopButton:Enable();
ATSWQueueStartStopButton:SetText(ATSW_STARTQUEUE);
ATSWQueueDeleteButton:Enable();
end

function ATSW_HideWindow()
Expand Down Expand Up @@ -425,6 +428,12 @@ function ATSWFrame_OnEvent()
elseif(event=="PLAYER_LOGOUT") then
ATSW_SaveQueue(false);
elseif(event=="UI_ERROR_MESSAGE") then
if atsw_working and arg1 == "Interraupted" then
ATSW_SpellcastStop();
ATSW_SpellcastInterrupted();
end

-- Sea.io.printTable({arg1 or "nil",event})
if(ATSWFrame:IsVisible()) then
if(arg1==INVENTORY_FULL) then
ATSW_SpellcastStop();
Expand Down Expand Up @@ -810,6 +819,33 @@ function ATSWFrame_SetSelection(id,wasClicked)
ATSWFrame_Update();
return;
end

local skillOffset = FauxScrollFrame_GetOffset(ATSWListScrollFrame);

local numTradeSkills = ATSW_GetNumTradeSkills()

if (numTradeSkills > ATSW_TRADE_SKILLS_DISPLAYED) then

--Sea.io.printTable({id,skillOffset,numTradeSkills,ATSW_TRADE_SKILLS_DISPLAYED})
-- if (id - skillOffset > ATSW_TRADE_SKILLS_DISPLAYED) or (id - skillOffset < 0) then
-- skillOffset = math.floor( id / ATSW_TRADE_SKILLS_DISPLAYED) * ATSW_TRADE_SKILLS_DISPLAYED


-- FauxScrollFrame_SetOffset(ATSWListScrollFrame, skillOffset);
-- ATSWListScrollFrameScrollBar:SetValue(skillOffset * ATSW_TRADE_SKILL_HEIGHT);
-- end
if (id - skillOffset > ATSW_TRADE_SKILLS_DISPLAYED) or (id - skillOffset < 0) then
if (id < numTradeSkills - ATSW_TRADE_SKILLS_DISPLAYED) then
FauxScrollFrame_SetOffset(ATSWListScrollFrame, id - 1);
ATSWListScrollFrameScrollBar:SetValue((id - 1) * ATSW_TRADE_SKILL_HEIGHT);
else
FauxScrollFrame_SetOffset(ATSWListScrollFrame, numTradeSkills - ATSW_TRADE_SKILLS_DISPLAYED);
ATSWListScrollFrameScrollBar:SetValue((numTradeSkills - ATSW_TRADE_SKILLS_DISPLAYED) * ATSW_TRADE_SKILL_HEIGHT);
end
end
end


ATSWFrame.selectedSkillName=skillName;
ATSWFrame.selectedSkill = id;
ATSW_SelectTradeSkill(id);
Expand Down Expand Up @@ -960,7 +996,7 @@ function ATSW_ItemOnDoubleClick()
-- Sea.io.print(reagent .. " -> ".. (ATSW_GetItemID(skillLink) or "nil"))
if skillLink and reagent == ATSW_GetItemID(skillLink) then
table.insert(previousRecipies,ATSWFrame.selectedSkill)
Sea.io.print(ATSWFrame.selectedSkill)
-- Sea.io.print(ATSWFrame.selectedSkill)
ATSWFrame_SetSelection(i,false)
ATSWFrame_Update();
end
Expand Down Expand Up @@ -2056,7 +2092,7 @@ function ATSW_Filter(skillname)
return false;
end
end
if(parameters[i].name=="reagent") then
if(parameters[i].name=="reagent" or parameters[i].name=="r") then
local index=ATSW_GetTradeSkillListPosByName(skillname);
if(index~=-1) then
local found=false;
Expand Down
26 changes: 24 additions & 2 deletions AdvancedTradeSkillWindow/atsw.xml
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="86" y="-98"/>
<AbsDimension x="68" y="-98"/>
</Offset>
</Anchor>
</Anchors>
Expand Down Expand Up @@ -1863,7 +1863,7 @@
<Anchors>
<Anchor point="TOPLEFT" relativeTo="ATSWFrame" relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="126" y="-94"/>
<AbsDimension x="108" y="-94"/>
</Offset>
</Anchor>
</Anchors>
Expand Down Expand Up @@ -1928,6 +1928,28 @@
</EditBox>


<Button name="ATSWFilterBoxClear" inherits="UIPanelButtonTemplate">
<Size>
<AbsDimension x="16" y="16"/>
</Size>
<Anchors>
<Anchor point="LEFT" relativeTo="ATSWFilterBox" relativePoint="RIGHT">
<Offset>
<AbsDimension x="1" y="0"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
this:SetText("X");
</OnLoad>
<OnClick>
ATSWFilterBox:SetText("")
</OnClick>
</Scripts>
</Button>


</Frames>
<Scripts>
<OnLoad>
Expand Down

0 comments on commit 00a3e22

Please sign in to comment.