Add files via upload

This commit is contained in:
Lexie
2022-06-06 19:30:54 +10:00
committed by GitHub
commit 7dcb9e7e68
95 changed files with 12125 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
<Bindings>
<!-- window commands -->
<Binding name="TOGGLEFISHINGBUDDY_TRK" header="FISHINGBUDDY_BINDINGS">
if ( keystate == "down" ) then
ToggleFishingBuddyFrame("FishingTrackingFrame");
end
</Binding>
</Bindings>
+12
View File
@@ -0,0 +1,12 @@
## Interface: 11200
## Title: Fishing Buddy - Tracking Frame
## Version: 0.8.9 Beta 10
## Author: Sutorix=AT=hotmail.com
## RequiredDeps: FishingBuddy
## SavedVariables: PBTF_Info
localization.lua
localization.de.lua
localization.es.lua
localization.fr.lua
GraphHandler.xml
FishingTrackingFrame.xml
+463
View File
@@ -0,0 +1,463 @@
-- Handle tracking cycle fish
FB_TFConstants = {};
-- set up
FishingBuddy.Setup.Translate("FB_OutfitDisplayFrame", FB_TFTranslations, FB_TFConstants);
local byweeks = {};
byweeks[FB_TFConstants.ABBREV_JANUARY] = 0;
byweeks[FB_TFConstants.ABBREV_APRIL] = 13;
byweeks[FB_TFConstants.ABBREV_JULY] = 26;
byweeks[FB_TFConstants.ABBREV_OCTOBER] = 39;
byweeks[FB_TFConstants.ABBREV_DECEMBER] = 52;
FB_TFConstants.BYWEEKS_TABLE = byweeks;
if ( FishingBuddy_Info and FishingBuddy_Info["FishTracking"] ) then
PBTF_Info = {};
for k,v in pairs(FishingBuddy_Info["FishTracking"]) do
PBTF_Info[k] = v;
end
FishingBuddy_Info["FishTracking"] = nil;
end
-- free up the space
FB_TFTranslations = nil;
--
FB_TrackingFrame = {};
local GRAPH_HEIGHT = 120;
local trackingWordMap = {
["WEEKLY"] = FBConstants.WEEKLY,
["HOURLY"] = FBConstants.HOURLY,
[FBConstants.WEEKLY] = "WEEKLY",
[FBConstants.HOURLY] = "HOURLY",
};
local byhours = {
[13759] = {
["enUS"] = "Raw Nightfin Snapper",
["deDE"] = "Roher Nachtflossenschnapper",
["frFR"] = "Lutjan nagenuit cru",
["c"] = { r = 0.5, g = 0.5, b = 1.0, a = 0.75 },
},
[13760] = {
["enUS"] = "Raw Sunscale Salmon",
["deDE"] = "Roher Sonnenschuppenlachs",
["frFR"] = "Saumon sol\195\169caille cru",
["c"] = { r = 0.8, g = 0.8, b = 0.1, a = 0.75 },
},
};
local byweeks = {
[13756] = {
["enUS"] = "Raw Summer Bass",
["deDE"] = "Roher Sommerbarsch",
["frFR"] = "Perche estivale crue",
["c"] = { r = 1.0, g = 1.0, b = 0.0, a = 0.75 },
},
[13755] = {
["enUS"] = "Winter Squid",
["deDE"] = "Winterkalmar",
["frFR"] = "Calmar hivernal",
["c"] = { r = 0.4, g = 0.1, b = 0.4, a = 0.75 },
},
};
local function UntrackThis(id, name)
if ( not byhours[id] and not byweeks[id] ) then
for how in pairs(PBTF_Info) do
if ( PBTF_Info[how][id] ) then
PBTF_Info[how][id] = nil;
FishingBuddy.Print(FB_TFConstants.NOTRACKMSG, name);
end
end
else
FishingBuddy.Message(FB_TFConstants.NOTRACKERRMSG);
end
end
local function TrackThis(how, id, color, name)
if ( not PBTF_Info[how] ) then
PBTF_Info[how] = {};
end
local limit = 23;
if ( how == "WEEKLY" ) then
limit = 52;
end
if ( not PBTF_Info[how][id] ) then
PBTF_Info[how][id] = {};
PBTF_Info[how][id].data = {};
for i=0,limit,1 do
PBTF_Info[how][id].data[i] = 0;
end
PBTF_Info[how][id].data.n = limit+1;
end
if ( name and not PBTF_Info[how][id].name ) then
PBTF_Info[how][id].name = name;
end
if ( color ) then
if ( type(color) == "string") then
local a = tonumber(string.sub(color,1,2),16);
local r = tonumber(string.sub(color,3,4),16);
local g = tonumber(string.sub(color,5,6),16);
local b = tonumber(string.sub(color,7,8),16);
color = { a = a, r = r, g = g, b = b };
end
PBTF_Info[how][id].color = color;
end
end
FishingBuddy.TrackThis = TrackThis;
FishingBuddy.Commands[FB_TFConstants.TRACK] = {};
FishingBuddy.Commands[FB_TFConstants.TRACK].args = {};
FishingBuddy.Commands[FB_TFConstants.TRACK].args[1] = "[%w]+";
FishingBuddy.Commands[FB_TFConstants.TRACK].args[2] = "|c%x+|Hitem:%d+:%d+:%d+:%d+|h%[.-%]|h|r";
FishingBuddy.Commands[FB_TFConstants.TRACK].help = FB_TFConstants.TRACKING_HELP;
FishingBuddy.Commands[FB_TFConstants.TRACK].func =
function(how, fishlink)
if ( how and (how == FBConstants.HOURLY or
how == FBConstants.WEEKLY)) then
local c, i, n = FishingBuddy.SplitFishLink(fishlink);
if ( i ) then
TrackThis(trackingWordMap[how], i, c, n);
FishingBuddy.Print(FB_TFConstants.TRACKINGMSG, n, how);
return true;
end
end
end;
FishingBuddy.Commands[FB_TFConstants.NOTRACK] = {};
FishingBuddy.Commands[FB_TFConstants.NOTRACK].args = {};
FishingBuddy.Commands[FB_TFConstants.NOTRACK].args[1] = "|c%x+|Hitem:%d+:%d+:%d+:%d+|h%[.-%]|h|r";
FishingBuddy.Commands[FB_TFConstants.NOTRACK].help = FB_TFConstants.TRACKING_HELP;
FishingBuddy.Commands[FB_TFConstants.NOTRACK].func =
function(fishlink)
local c, i, n = FishingBuddy.SplitFishLink(fishlink);
if ( i ) then
UntrackThis(i, n);
return true;
end
end;
FishingBuddy.Commands[FB_TFConstants.TRACKING] = {};
FishingBuddy.Commands[FB_TFConstants.TRACKING].help = FB_TFConstants.TRACKING_HELP;
FishingBuddy.Commands[FB_TFConstants.TRACKING].func =
function()
local pr = FishingBuddy.Print;
for jdx in pairs(PBTF_Info) do
local how = trackingWordMap[jdx];
pr("Tracking "..how);
local ft = PBTF_Info;
for id in pairs(ft[jdx]) do
local name;
if ( ft[jdx][id].name ) then
name = ft[jdx][id].name;
else
name = id;
end
local line = name.."; ";
for k,v in pairs(ft[jdx][id].data) do
line = line.." "..k..": "..v;
end
pr(line);
end
end
return true;
end;
local function InitTracking()
if ( not PBTF_Info ) then
PBTF_Info = { };
end
for k,v in pairs(byhours) do
TrackThis("HOURLY", k, v.c);
end
for k,v in pairs(byweeks) do
TrackThis("WEEKLY", k, v.c);
end
end
local function AddTracking(id, name)
local ft = PBTF_Info;
local index, how;
-- clean up fish removed from the tracking system
local hourly = ft["HOURLY"][id];
local weekly = ft["WEEKLY"][id];
if ( hourly and hourly.nevermore ) then
PBTF_Info["HOURLY"][id] = nil;
end
if ( weekly and weekly.nevermore ) then
PBTF_Info["WEEKLY"][id] = nil;
end
ft = PBTF_Info;
if ( ft["HOURLY"][id] ) then
how = "HOURLY";
index,_ = GetGameTime();
elseif ( ft["WEEKLY"][id] ) then
how = "WEEKLY";
index = date("%W");
else
return false;
end
if ( not PBTF_Info[how][id].name ) then
PBTF_Info[how][id].name = name;
end
index = tonumber(index);
local p = FishingBuddy.printable;
PBTF_Info[how][id].data[index] =
PBTF_Info[how][id].data[index] + 1;
return true;
end
FishingBuddy.AddTracking = AddTracking;
local function PlotData(graph, num, bw, bs, graphdata, plotthese, hlabels)
local maxval = 0;
local width = 0;
local line;
GraphHandler.ClearPlot(graph);
for _,info in pairs(graphdata) do
if ( info.maxval and info.maxval > maxval ) then
maxval = info.maxval;
end
local w = info.count * (bw+bs);
if ( w > width ) then
width = w;
end
end
local delta = math.mod(maxval, 5);
if ( delta > 0 ) then
maxval = maxval + (5 - delta);
end
graph.maxVal = maxval;
graph.barWidth = bw;
graph.barSpacing = bs;
local count = num;
for idx,fishid in pairs(plotthese) do
local info = graphdata[fishid];
local c = info.color;
GraphHandler.PlotLegend(graph, num-count+1,
info.name, info.item, info.texture,
c.r, c.g, c.b);
_ = GraphHandler.PlotData(graph, info.data, num-count, 1,
c.r, c.g, c.b);
if ( line ) then
line = line.." / "..info.name;
else
line = info.name;
end
count = count - 1;
end
local values = {};
local delta = maxval/5;
for v=0,5 do
values[string.format("%d", v*delta)] = v;
end
GraphHandler.PlotGrid(graph, line or "", values, width, hlabels);
end
local function UpdateGraphData(id, info)
local maxval = 0;
local n = table.getn(info.data);
info.count = n;
-- we're zero based
n = n - 1;
for idx=0,n do
if ( info.data[idx] > maxval ) then
maxval = info.data[idx];
end
end
info.maxval = maxval;
info.data = info.data;
if ( not info.color ) then
info.color = {};
else
if ( type(info.color) == "string") then
local a = tonumber(string.sub(color,1,2),16);
local r = tonumber(string.sub(color,3,4),16);
local g = tonumber(string.sub(color,5,6),16);
local b = tonumber(string.sub(color,7,8),16);
info.color = { a = a, r = r, g = g, b = b };
end
end
local name;
info.item, info.texture, _, _, _, name = FishingBuddy.GetFishie(id);
local loc = GetLocale();
if ( not info.name ) then
if ( byhours[id] and byhours[id][loc] ) then
info.name = byhours[id][loc];
elseif ( byweeks[id] and byweeks[id][loc] ) then
info.name = byweeks[id][loc];
elseif ( not name ) then
info.name = FBConstants.FISH.." ("..id..")";
else
info.name = name;
end
end
info.name = FishingBuddy.StripRaw(info.name);
end
local function DrawTrackingGraph(how, num, bw, bs)
local fi = PBTF_Info;
local graph;
local labels;
if ( how == "HOURLY" ) then
graph = getglobal("FishingTrackingFrameGraph1");
labels = {["00:00"] = 0, ["06:00"] = 6, ["12:00"] = 12, ["18:00"] = 18, ["23:59"] = 24};
if ( not num ) then
num = 2;
bw = 5;
bs = 5;
end
else
graph = getglobal("FishingTrackingFrameGraph2");
labels = FBConstants.BYWEEKS_TABLE;
if ( not num ) then
num = 2;
bw = 3;
bs = 2;
end
end
local plotthese = {};
local count = 0;
graph.tracking = how;
for id,info in pairs(fi[how]) do
UpdateGraphData(id, info);
if ( count < num and fi[how][id].plot == 1 ) then
count = count + 1;
tinsert(plotthese, id);
end
end
PlotData(graph, num, bw, bs, fi[how], plotthese, labels);
end
local function DrawTrackingGraphs()
DrawTrackingGraph("HOURLY");
DrawTrackingGraph("WEEKLY");
end
local function PlotFishToggle(fishid, how)
local tab = PBTF_Info[how];
if ( not tab[fishid].plot ) then
tab[fishid].plot = 1;
else
tab[fishid].plot = 1 - tab[fishid].plot;
end
DrawTrackingGraph(how);
end
local PlotToggleFunctions = {};
local function PlotMakeToggle(fishid, how)
if ( not PlotToggleFunctions[fishid] ) then
local id = fishid;
local h = how;
PlotToggleFunctions[fishid] = function() PlotFishToggle(id, h); end;
end
return PlotToggleFunctions[fishid];
end
local function PlotMenuInitialize()
local fi = PBTF_Info;
local ff = FishingBuddy_Info["Fishies"];
local how = this.tracking;
local locale = GetLocale();
for id,_ in pairs(fi[how]) do
if ( not fi[how][id].plot ) then
fi[how][id].plot = 1;
end
info = {};
if ( ff[id] and ff[id].name ) then
info.text = ff[id].name;
elseif ( byhours[id] ) then
info.text = byhours[id][locale];
elseif ( byweeks[id] ) then
info.text = byweeks[id][locale];
end
if ( info.text ) then
info.func = PlotMakeToggle(id, how);
info.checked = ( fi[how][id].plot == 1 );
UIDropDownMenu_AddButton(info);
end
end
end
FB_TrackingFrame.OnClick = function(button, graph)
if ( button == "RightButton" ) then
local menu = getglobal("FishingBuddyGraphMenu");
menu.tracking = this.tracking;
menu.point = "CENTER";
menu.relativePoint = "CENTER";
UIDropDownMenu_Initialize(menu, PlotMenuInitialize, "MENU");
FishingBuddy.ToggleDropDownMenu(1, nil, menu, this, 0, 0);
end
end
FB_TrackingFrame.OnShow = function()
DrawTrackingGraphs();
end
FB_TrackingFrame.OnEnter = function()
GameTooltip_AddNewbieTip(FB_TFConstants.TRACKINGFRAME, 1.0, 1.0, 1.0,
FB_TFConstants.TRACKINGFRAME_CLICKS, 1);
end
FB_TrackingFrame.OnLeave = function()
GameTooltip:Hide();
end
local TrackingEvents = {};
TrackingEvents[FBConstants.ADD_FISHIE_EVT] = function(id, name, zone, subzone)
AddTracking(id, name);
end
FB_TrackingFrame.OnLoad = function()
this:RegisterEvent("VARIABLES_LOADED");
InitTracking();
end
local function TrackFishToggle(fishid, how)
local tab = PBTF_Info[how];
if ( not tab[fishid] ) then
local ff = FishingBuddy_Info["Fishies"];
FishingBuddy.TrackThis(how, fishid, ff[fishid].color, ff[fishid].name);
else
if ( not tab[fishid].nevermore ) then
tab[fishid].nevermore = true;
else
tab[fishid].nevermore = nil;
end
end
end
local function MakeTrackFishToggle(fishid, how)
local id = fishid;
local h = how;
return function() TrackFishToggle(id, h); end;
end
local function TrackFishEntry(fishid, how)
local fi = PBTF_Info;
local info = {};
info.text = FB_TFConstants["TRACKFISH"..how];
info.func = MakeTrackFishToggle(fishid, how);
info.checked = ( fi[how][fishid] and not fi[how][fishid].nevermore );
return info;
end
local function TrackOptionsMenu(fishid)
UIDropDownMenu_AddButton(TrackFishEntry(fishid, "HOURLY"));
UIDropDownMenu_AddButton(TrackFishEntry(fishid, "WEEKLY"));
end
FB_TrackingFrame.OnEvent = function()
FishingBuddy.API.RegisterHandlers(TrackingEvents);
FishingBuddy.Locations.PerFishOptions(TrackOptionsMenu);
FishingBuddy.ManageFrame(FishingTrackingFrame,
FB_TFConstants.TRACKING_TAB,
FB_TFConstants.TRACKING_INFO,
"_TRK");
this:UnregisterEvent("VARIABLES_LOADED");
end
+162
View File
@@ -0,0 +1,162 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd">
<Script file="FishingTrackingFrame.lua"/>
<Frame name="FishingTrackingGrid" virtual="true">
<Frames>
<Frame name="$parentL00" inherits="GraphFrameLine"/>
<Frame name="$parentTL0" inherits="GraphFrameText"/>
<Frame name="$parentLH1" inherits="GraphFrameLine"/>
<Frame name="$parentLH2" inherits="GraphFrameLine"/>
<Frame name="$parentLH3" inherits="GraphFrameLine"/>
<Frame name="$parentLH4" inherits="GraphFrameLine"/>
<Frame name="$parentLH5" inherits="GraphFrameLine"/>
<Frame name="$parentTH0" inherits="GraphFrameText"/>
<Frame name="$parentTH1" inherits="GraphFrameText"/>
<Frame name="$parentTH2" inherits="GraphFrameText"/>
<Frame name="$parentTH3" inherits="GraphFrameText"/>
<Frame name="$parentTH4" inherits="GraphFrameText"/>
<Frame name="$parentTH5" inherits="GraphFrameText"/>
<Frame name="$parentLV1" inherits="GraphFrameLine"/>
<Frame name="$parentLV2" inherits="GraphFrameLine"/>
<Frame name="$parentLV3" inherits="GraphFrameLine"/>
<Frame name="$parentLV4" inherits="GraphFrameLine"/>
<Frame name="$parentLV5" inherits="GraphFrameLine"/>
<Frame name="$parentTV0" inherits="GraphFrameText"/>
<Frame name="$parentTV1" inherits="GraphFrameText"/>
<Frame name="$parentTV2" inherits="GraphFrameText"/>
<Frame name="$parentTV3" inherits="GraphFrameText"/>
<Frame name="$parentTV4" inherits="GraphFrameText"/>
<Frame name="$parentTV5" inherits="GraphFrameText"/>
</Frames>
</Frame>
<Frame name="FishingTracking24x2Frame" inherits="GraphFrame" virtual="true">
<Frames>
<Frame name="$parent_01" inherits="GraphPanel32"/>
<Frame name="$parent_02" inherits="GraphPanel16"/>
<Frame name="$parentP01" inherits="GraphFrameLegend"/>
<Frame name="$parentP02" inherits="GraphFrameLegend"/>
<Frame name="$parentG00" inherits="FishingTrackingGrid"/>
</Frames>
</Frame>
<Frame name="FishingTracking53x2Frame" inherits="GraphFrame" virtual="true">
<Frames>
<Frame name="$parent_01" inherits="GraphPanel32"/>
<Frame name="$parent_02" inherits="GraphPanel32"/>
<Frame name="$parent_03" inherits="GraphPanel32"/>
<Frame name="$parent_04" inherits="GraphPanel8"/>
<Frame name="$parent_05" inherits="GraphPanel2"/>
<Frame name="$parentP01" inherits="GraphFrameLegend"/>
<Frame name="$parentP02" inherits="GraphFrameLegend"/>
<Frame name="$parentG00" inherits="FishingTrackingGrid"/>
</Frames>
</Frame>
<Frame name="FishingTrackingFrame" setAllPoints="true"
enableMouse="true" parent="FishingBuddyFrame" hidden="true">
<HitRectInsets>
<AbsInset left="0" right="30" top="0" bottom="75"/>
</HitRectInsets>
<Layers>
<Layer level="ARTWORK">
<Texture file="Interface\Spellbook\UI-SpellbookPanel-TopLeft">
<Size>
<AbsDimension x="256" y="256"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT"/>
</Anchors>
</Texture>
<Texture file="Interface\Spellbook\UI-SpellbookPanel-TopRight">
<Size>
<AbsDimension x="128" y="256"/>
</Size>
<Anchors>
<Anchor point="TOPRIGHT"/>
</Anchors>
</Texture>
<Texture file="Interface\Spellbook\UI-SpellbookPanel-BotLeft">
<Size>
<AbsDimension x="256" y="256"/>
</Size>
<Anchors>
<Anchor point="BOTTOMLEFT"/>
</Anchors>
</Texture>
<Texture file="Interface\Spellbook\UI-SpellbookPanel-BotRight">
<Size>
<AbsDimension x="128" y="256"/>
</Size>
<Anchors>
<Anchor point="BOTTOMRIGHT"/>
</Anchors>
</Texture>
</Layer>
</Layers>
<Frames>
<Frame name="FishingBuddyGraphMenu" inherits="UIDropDownMenuTemplate">
<Scripts>
<OnLoad>
this:SetFrameLevel(0);
UIDropDownMenu_SetWidth(180);
</OnLoad>
</Scripts>
</Frame>
<Frame name="$parentGraph1" enableMouse="true" inherits="FishingTracking24x2Frame">
<Size>
<AbsDimension x="280" y="120"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="48" y="-100"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnMouseUp>
FB_TrackingFrame.OnClick(arg1);
</OnMouseUp>
<OnEnter>
FB_TrackingFrame.OnEnter();
</OnEnter>
<OnLeave>
FB_TrackingFrame.OnLeave();
</OnLeave>
</Scripts>
</Frame>
<Frame name="$parentGraph2" enableMouse="true" inherits="FishingTracking53x2Frame">
<Size>
<AbsDimension x="280" y="120"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentGraph1" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-40"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnMouseUp>
FB_TrackingFrame.OnClick(arg1);
</OnMouseUp>
<OnEnter>
FB_TrackingFrame.OnEnter();
</OnEnter>
<OnLeave>
FB_TrackingFrame.OnLeave();
</OnLeave>
</Scripts>
</Frame>
</Frames>
<Scripts>
<OnLoad>
FB_TrackingFrame.OnLoad();
</OnLoad>
<OnEvent>
FB_TrackingFrame.OnEvent();
</OnEvent>
<OnShow>
FB_TrackingFrame.OnShow();
</OnShow>
</Scripts>
</Frame>
</Ui>
+251
View File
@@ -0,0 +1,251 @@
-- Do graph stuff
-- This should be a separate addon someday
GraphHandler = {};
GraphHandler.Legend = {};
GraphHandler.Legend.OnEnter = function()
if( this.item or this.tooltop ) then
GameTooltip:SetOwner(this, "ANCHOR_RIGHT");
if (this.item and this.item ~= "") then
GameTooltip:SetHyperlink("item:"..this.item);
elseif (this.tooltip) then
GameTooltip:SetText(this.tooltip);
end
end
end
GraphHandler.Legend.OnLeave = function()
if( this.item or this.tooltop ) then
this.updateToolTip = nil;
GameTooltip:Hide();
end
end
GraphHandler.Legend.OnClick = function(button)
if ( button == "LeftButton" ) then
if( IsShiftKeyDown() and this.item ) then
GraphHandler.Legend.ChatLink(this.item, this.name, this.color);
end
end
end
GraphHandler.Legend.ChatLink = FishingBuddy.ChatLink;
GraphHandler.BAR = "BAR";
GraphHandler.LEGEND = "LEGEND";
GraphHandler.LINE = "LINE";
GraphHandler.LABEL = "LABEL";
GraphHandler.TEXT = "TEXT";
GraphHandler.InitElements = function()
if ( not this.elements ) then
this.elements = {};
this.elements[GraphHandler.BAR] = {};
this.elements[GraphHandler.LINE] = {};
this.elements[GraphHandler.LEGEND] = {};
this.elements[GraphHandler.LABEL] = {};
this.elements[GraphHandler.TEXT] = {};
end
end
local function SetColorBar(bar, base, x, y, width, height, r, g, b)
local name;
if ( type(bar) == "STRING" ) then
name = bar;
bar = getglobal(name);
elseif ( bar ) then
name = bar:GetName();
end
if ( bar ) then
if ( not r ) then
r = 1.0;
g = 1.0;
b = 1.0;
end
if ( base ) then
local tex = getglobal(name.."Texture");
if ( x and y ) then
bar:ClearAllPoints();
bar:SetPoint("BOTTOMLEFT", base, "BOTTOMLEFT", x, y);
end
if ( width ) then
bar:SetWidth(width);
end
if ( height ) then
bar:SetHeight(height);
end
tex:SetVertexColor(r, g, b);
bar:Show();
else
bar:Hide();
end
end
end
-- Registration functions
GraphHandler.Register = function(kind, what)
local frame = this;
local lastframe = nil;
for idx=1,5 do
frame = frame:GetParent();
if ( frame == lastframe ) then
break;
end
if ( frame and frame.elements ) then
if ( not frame.elements[kind] ) then
frame.elements[kind] = {};
end
tinsert(frame.elements[kind], what);
break;
end
lastframe = frame;
end
end
GraphHandler.ClearPlot = function(frame)
for _,elem in pairs({ GraphHandler.BAR, GraphHandler.LEGEND }) do
for idx,what in pairs(frame.elements[elem]) do
what:Hide();
end
end
end
GraphHandler.PlotData = function(frame, data, offset, skip, r, g, b)
local limit = table.getn(data);
local start = 1;
if ( data[0] ) then
start = 0;
limit = limit - 1;
end
local bdx=offset+1;
local bwid = frame.barWidth;
local bspc = frame.barSpacing;
local maxval = frame.maxVal;
local xoff = offset*bspc;
local yoff = 0;
local graphHeight = frame:GetHeight();
for idx=start,limit,1 do
local bar = frame.elements[GraphHandler.BAR][bdx];
bdx = bdx + skip + 1;
if ( bar ) then
if ( (maxval > 0) and (data[idx] > 0) ) then
local height = (data[idx]*graphHeight)/maxval;
SetColorBar(bar, frame, xoff, 0, bwid, height, r, g, b);
else
bar:Hide();
end
end
xoff = xoff + bwid + skip*bspc;
end
return xoff - skip*bspc;
end
GraphHandler.PlotLegend = function(frame, ldx, name, item, texture, r, g, b)
local legend = frame.elements[GraphHandler.LEGEND][ldx];
if ( legend ) then
local name = legend:GetName();
local icon = getglobal(name.."Icon");
local tex = getglobal(name.."IconTexture");
local color = getglobal(name.."Color");
-- SetColorBar(color, legend, nil, nil, nil, nil, r, g, b);
SetColorBar(color, legend, 0, 1, 10, 16, r, g, b);
color:Show();
icon:Show();
tex:SetTexture(texture);
tex:Show();
legend:SetPoint("TOPRIGHT", frame, "TOPRIGHT", 0, -(ldx-1)*21);
legend.item = item;
legend.name = name;
legend:Show();
end
end
GraphHandler.PlotGrid = function(frame, label, texth, width, textv, height)
local ldx=1;
local tdx=1;
if ( not width ) then
width = frame:GetWidth();
end
if ( not height ) then
height = frame:GetHeight();
end
if ( label ) then
local button = frame.elements[GraphHandler.TEXT][tdx];
if ( button ) then
local text = getglobal(button:GetName().."T");
text:SetText(label);
text:SetPoint("BOTTOM", frame, "BOTTOM", 0, -28);
text:SetVertexColor(1.0, 1.0, 1.0);
text:Show();
tdx = tdx + 1;
end
end
if ( texth ) then
local linesh = 0;
for _,_ in pairs(texth) do
linesh = linesh + 1;
end
local offset = height/(linesh-1);
for label,tick in pairs(texth) do
local line = frame.elements[GraphHandler.LINE][ldx];
if ( line ) then
ldx = ldx + 1;
line:SetHeight(1);
line:SetWidth(width);
line:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", 0, tick*offset);
line:SetAlpha(0.5);
line:Show();
local button = frame.elements[GraphHandler.TEXT][tdx];
if ( button ) then
local text = getglobal(button:GetName().."T");
if ( type(label) ~= "string" ) then
label = string.format("%3d", label);
end
text:SetText(label);
text:SetPoint("LEFT", line, "LEFT", -(text:GetWidth()+4), 0);
tdx = tdx + 1;
end
end
end
end
if ( textv ) then
local linesv = 0;
for _,_ in pairs(textv) do
linesv = linesv + 1;
end
local offset = frame.barSpacing + frame.barWidth;
for label,tick in pairs(textv) do
local line = frame.elements[GraphHandler.LINE][ldx];
if ( line ) then
local xpos = tick*offset;
ldx = ldx + 1;
line:SetHeight(height);
line:SetWidth(1);
line:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", xpos, 0);
line:SetAlpha(0.5);
line:Show();
local button = frame.elements[GraphHandler.TEXT][tdx];
if ( button ) then
local text = getglobal(button:GetName().."T");
if ( type(label) ~= "string" ) then
label = string.format("%3d", label);
end
text:SetText(label);
local wid = text:GetWidth();
if ( xpos < wid ) then
text:SetPoint("TOPLEFT", line, "BOTTOMLEFT", 0, -4);
elseif ( xpos > (width - wid) ) then
text:SetPoint("TOPRIGHT", line, "BOTTOMRIGHT", 0, -4);
else
text:SetPoint("TOP", line, "BOTTOM", 0, -4);
end
text:Show();
tdx = tdx + 1;
end
end
end
end
end
+211
View File
@@ -0,0 +1,211 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd">
<Script file="GraphHandler.lua"/>
<Frame name="GraphFrame" enableMouse="true" virtual="true">
<Scripts>
<OnLoad>
GraphHandler.InitElements();
</OnLoad>
</Scripts>
</Frame>
<Frame name="GraphPanel" enableMouse="true" virtual="true">
</Frame>
<Button name="GraphFrameColorBar" virtual="true">
<Layers>
<Layer level="OVERLAY">
<Texture name="$parentTexture" virtual="true">
<Color r="1.0" g="1.0" b="1.0" a="1.0"/>
</Texture>
</Layer>
</Layers>
<Scripts>
<Onload>
this:RegisterEvent("VARIABLES_LOADED");
</Onload>
<OnEvent>
GraphHandler.Register(GraphHandler.BAR, this);
</OnEvent>
</Scripts>
</Button>
<Button name="GraphFrameLine" virtual="true">
<Layers>
<Layer level="OVERLAY">
<Texture name="$parentTexture" virtual="true">
<Color r="1.0" g="1.0" b="1.0" a="1.0"/>
</Texture>
</Layer>
</Layers>
<Scripts>
<Onload>
this:RegisterEvent("VARIABLES_LOADED");
</Onload>
<OnEvent>
GraphHandler.Register(GraphHandler.LINE, this);
</OnEvent>
</Scripts>
</Button>
<Button name="GraphFrameText" virtual="true">
<Layers>
<Layer level="OVERLAY">
<FontString name="$parentT" inherits="GameFontNormalSmall"/>
</Layer>
</Layers>
<Scripts>
<Onload>
this:RegisterEvent("VARIABLES_LOADED");
</Onload>
<OnEvent>
GraphHandler.Register(GraphHandler.TEXT, this);
</OnEvent>
</Scripts>
</Button>
<Frame name="GraphFrameLegend" virtual="true">
<Size>
<AbsDimension x="30" y="18"/>
</Size>
<Frames>
<Button name="$parentColor" inherits="GraphFrameColorBar" hidden="true">
<Size>
<AbsDimension x="10" y="18"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="0" y="1"/>
</Offset>
</Anchor>
</Anchors>
</Button>
<Button name="$parentIcon" hidden="true">
<Size>
<AbsDimension x="16" y="16"/>
</Size>
<Anchors>
<Anchor point="LEFT" relativeTo="$parentColor" relativePoint="RIGHT">
<Offset>
<AbsDimension x="2" y="0"/>
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer level="BORDER">
<Texture name="$parentTexture"/>
</Layer>
</Layers>
<Scripts>
<Onload>
this:RegisterForClicks("LeftButtonUp");
</Onload>
<OnClick>
GraphHandler.Legend.OnClick(arg1);
</OnClick>
</Scripts>
</Button>
</Frames>
<Scripts>
<Onload>
this:SetFrameLevel(this:GetFrameLevel() + 1);
this:RegisterEvent("VARIABLES_LOADED");
</Onload>
<OnEvent>
GraphHandler.Register(GraphHandler.LEGEND, this);
</OnEvent>
<OnEnter>
GraphHandler.Legend.OnEnter();
</OnEnter>
<OnLeave>
GraphHandler.Legend.OnLeave();
</OnLeave>
</Scripts>
</Frame>
<Frame name="GraphPanel2" inherits="GraphPanel" virtual="true">
<Frames>
<Button name="$parent_00" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_01" inherits="GraphFrameColorBar" hidden="true"/>
</Frames>
</Frame>
<Frame name="GraphPanel4" inherits="GraphPanel" virtual="true">
<Frames>
<Button name="$parent_00" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_01" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_02" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_03" inherits="GraphFrameColorBar" hidden="true"/>
</Frames>
</Frame>
<Frame name="GraphPanel8" inherits="GraphPanel" virtual="true">
<Frames>
<Button name="$parent_00" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_01" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_02" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_03" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_04" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_05" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_06" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_07" inherits="GraphFrameColorBar" hidden="true"/>
</Frames>
</Frame>
<Frame name="GraphPanel16" inherits="GraphPanel" virtual="true">
<Frames>
<Button name="$parent_00" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_01" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_02" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_03" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_04" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_05" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_06" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_07" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_08" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_09" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_10" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_11" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_12" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_13" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_14" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_15" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_16" inherits="GraphFrameColorBar" hidden="true"/>
</Frames>
</Frame>
<Frame name="GraphPanel32" inherits="GraphPanel" virtual="true">
<Frames>
<Button name="$parent_00" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_01" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_02" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_03" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_04" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_05" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_06" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_07" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_08" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_09" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_10" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_11" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_12" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_13" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_14" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_15" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_16" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_17" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_18" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_19" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_20" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_21" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_22" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_23" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_24" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_25" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_26" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_27" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_28" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_29" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_30" inherits="GraphFrameColorBar" hidden="true"/>
<Button name="$parent_31" inherits="GraphFrameColorBar" hidden="true"/>
</Frames>
</Frame>
</Ui>
+35
View File
@@ -0,0 +1,35 @@
-- Deutsche
-- lower upper
-- a umlaut \195\164 \195\132
-- o umlaut \195\192 \195\150
-- u umlaut \195\188 \195\156
FB_TFTranslations["deDE"] = {
TRACKING_INFO = "Zeige graphische #NAME#-Anzeige der letzten F\195\164nge",
TRACKING_TAB = "Saisonfische",
TRACK = "Aufzeichnung",
NOTRACK = "Aufzeichnung-nicht",
TRACKING = "aufzeichnen",
TRACKINGMSG = "Aufzeichnung '%s' (%s).",
NOTRACKERRMSG = "Kann nicht R\195\188ckstellung saisonfisch entfernen.",
NOTRACKMSG = "Saisonfisch '%s' entfernt.",
TRACKINGFRAME = "Tracking-Fenster",
TRACKINGFRAME_RIGHTCLICK = "Right-click to draw graphs for fish",
TRACKINGFRAME_LEFTCLICK = "Left-click to choose fish to track",
BINDING_NAME_TOGGLEFISHINGBUDDY_TRK = "Tracking-Fenster anzeigen",
};
FB_TFTranslations["deDE"].TRACKING_HELP = {
"|c#GREEN#/fb #TRACK#|r [|c#GREEN##HOURLY#|r oder |c#GREEN##WEEKLY#|r] |c#PURPLE#<Fisch-Link>|r",
" zeichne die Angeldauer f\195\188r die angegebene",
" Fischart (ein Shift-Klick-Link) auf",
"|c#GREEN#/fb #NOTRACK#|r |c#PURPLE#<fish link>|r",
" entferne den angegebenen Fisch (ein Shift-Klick-Link) aus der \195\165bersicht",
"|c#GREEN#/fb #TRACKING#|r",
" eine einfache Anzeige, wann die gefangenen",
" Fische gefangen wurden",
};
+12
View File
@@ -0,0 +1,12 @@
FB_TFTranslations["esES"] = {
TRACKING_INFO = "Muestra #NAME# informaci\195\179on de pesca ciclica",
TRACKING_TAB = "Seguimiento",
TRACK = "sigue",
NOTRACK = "no siguas",
TRACKING = "siguiendo",
TRACKINGMSG = "Segumiento '%s' %s.",
NOTRACKERRMSG = "No puede borrar pesca ciclica.",
NOTRACKMSG = "Pesca ciclica borrada '%s'.",
};
+15
View File
@@ -0,0 +1,15 @@
FB_TFTranslations["frFR"] = {
TRACKING_INFO = "Affiche les donn\195\169es sur les poissons";
TRACKING = "Archives";
BINDING_NAME_TOGGLEFISHINGBUDDY_TRK = "Toggle: #NAME# (Panneau de donn\195\169es)";
};
FB_TFTranslations["frFR"].TRACKING_HELP = {
"|c#GREEN#/fb #TRACK#|r [|c#GREEN##HOURLY#|r or |c#GREEN##WEEKLY#|r] |c#PURPLE#<fish link>|r",
" Surveille le temps de prise pour ce poisson (Maj-Click)",
"|c#GREEN#/fb #NOTRACK#|r |c#PURPLE#<fish link>|r",
" Retire ce poisson (Maj-Click) du surveillant",
"|c#GREEN#/fb #TRACKING#|r",
" Un mauvais affichage du moment de prise d'un poisson surveill\195\169",
};
+47
View File
@@ -0,0 +1,47 @@
-- default to American English
FB_TFTranslations = {};
FB_TFTranslations["enUS"] = {
NAME = "Fishing Buddy - Tracking Frame",
DESCRIPTION = "Collect data about cycle fish.",
-- Tab labels and tooltips
TRACKING_INFO = "Show #NAME# cycle fish information",
TRACKING_TAB = "Tracking",
TRACK = "track",
NOTRACK = "notrack",
TRACKING = "tracking",
TRACKINGFRAME = "Tracking Frame",
TRACKINGFRAME_RIGHTCLICK = "Right-click to draw graphs for fish",
TRACKINGFRAME_LEFTCLICK = "Left-click to choose fish to track",
-- TRACKINGFRAME_CLICKS = "#TRACKINGFRAME_RIGHTCLICK#\r#TRACKINGFRAME_LEFTCLICK#",
TRACKINGFRAME_CLICKS = "#TRACKINGFRAME_RIGHTCLICK#",
TRACKFISHHOURLY = "Track this fish hourly",
TRACKFISHWEEKLY = "Track this fish weekly",
-- messages
TRACKINGMSG = "Tracking '%s' %s.",
NOTRACKERRMSG = "Can't remove default cycle fish.",
NOTRACKMSG = "Removed cycle fish '%s'.",
-- months for Tracking frame
ABBREV_JANUARY = "Jan",
ABBREV_APRIL = "Apr",
ABBREV_JULY = "Jul",
ABBREV_OCTOBER = "Oct",
ABBREV_DECEMBER = "Dec",
BINDING_NAME_TOGGLEFISHINGBUDDY_TRK = "Toggle #NAME# Tracking Pane",
};
FB_TFTranslations["enUS"].TRACKING_HELP = {
"|c#GREEN#/fb #TRACK#|r [|c#GREEN##HOURLY#|r or |c#GREEN##WEEKLY#|r] |c#PURPLE#<fish link>|r",
" track the catch times for the specified fish (a shift click link)",
"|c#GREEN#/fb #NOTRACK#|r |c#PURPLE#<fish link>|r",
" remove the specified fish (a shift click link) from the tracker",
"|c#GREEN#/fb #TRACKING#|r",
" a really bad display of when tracked fish were caught",
};