commit 7dcb9e7e68651c5b1f4219d91ba7f8aafd75deb8
Author: Lexie <6937574+Lexiebean@users.noreply.github.com>
Date: Mon Jun 6 19:30:54 2022 +1000
Add files via upload
diff --git a/FB_OutfitDisplayFrame/Bindings.xml b/FB_OutfitDisplayFrame/Bindings.xml
new file mode 100644
index 0000000..2f542bb
--- /dev/null
+++ b/FB_OutfitDisplayFrame/Bindings.xml
@@ -0,0 +1,8 @@
+
+
+
+ if ( keystate == "down" ) then
+ ToggleFishingBuddyFrame("FishingOutfitFrame");
+ end
+
+
\ No newline at end of file
diff --git a/FB_OutfitDisplayFrame/FB_OutfitDisplayFrame.toc b/FB_OutfitDisplayFrame/FB_OutfitDisplayFrame.toc
new file mode 100644
index 0000000..4c62757
--- /dev/null
+++ b/FB_OutfitDisplayFrame/FB_OutfitDisplayFrame.toc
@@ -0,0 +1,11 @@
+## Interface: 11200
+## Title: Fishing Buddy - Outfit Frame
+## Version: 0.8.9 Beta 10
+## Author: Sutorix=AT=hotmail.com
+## RequiredDeps: OutfitDisplayFrame, FishingBuddy
+## SavedVariablesPerCharacter: FBODF_PlayerInfo
+localization.lua
+localization.de.lua
+localization.es.lua
+localization.fr.lua
+FishingOutfitFrame.xml
diff --git a/FB_OutfitDisplayFrame/FishingOutfitFrame.lua b/FB_OutfitDisplayFrame/FishingOutfitFrame.lua
new file mode 100644
index 0000000..78b1ceb
--- /dev/null
+++ b/FB_OutfitDisplayFrame/FishingOutfitFrame.lua
@@ -0,0 +1,294 @@
+-- Wrap OutfitDisplayFrame with our "improvements"
+FB_OutfitFrame = {};
+FB_ODFConstants = {};
+
+local DEFAULTUPDATE_WAIT = 0.1;
+
+local function StylePoints(outfit)
+ local isp = FishingBuddy.OutfitManager.ItemStylePoints;
+ local points = 0;
+ if ( outfit )then
+ for slot in pairs(outfit) do
+ if ( outfit[slot].item ) then
+ local _,_,check, enchant = string.find(outfit[slot].item,
+ "^(%d+):(%d+)");
+ points = points + isp(check, enchant);
+ end
+ end
+ end
+ return points;
+end
+
+local match;
+local function ItemBonusPoints(item)
+ local points = 0;
+ if ( item and item ~= "" ) then
+ if ( not match ) then
+ match = FishingBuddy.GetFishingSkillName().." %+(%d+)";
+ end
+ FishingOutfitTooltip:SetHyperlink("item:"..item);
+ local bodyslot = FishingOutfitTooltipTextLeft2:GetText();
+ local textline = 2;
+ while (bodyslot) do
+ local _,_,bonus = string.find(bodyslot, match);
+ if bonus then
+ points = points + bonus;
+ end
+ textline = textline + 1;
+ bodyslot = getglobal("FishingOutfitTooltipTextLeft"..textline):GetText();
+ end
+ -- See if the Eternium Fishing Line has been applied
+ local _,_,check, enchant = string.find(item, "^(%d+):(%d+)");
+ if ( enchant == "2603" ) then
+ points = points + 5;
+ end
+ end
+ return points;
+end
+
+local function BonusPoints(outfit)
+ local points = 0;
+ if ( outfit )then
+ for slot in pairs(outfit) do
+ points = points + ItemBonusPoints(outfit[slot].item);
+ end
+ end
+ return points;
+end
+
+local function UpdateSwitchButton(outfit)
+ local msg = OutfitDisplayFrame_SwitchWillFail(FishingOutfitFrame, outfit);
+ if ( outfit and not msg ) then
+ FishingOutfitSwitchButton:Enable();
+ else
+ FishingOutfitSwitchButton:Disable();
+ end
+end
+
+-- outfit support functions
+local function GetWasWearing()
+ if FBODF_PlayerInfo["WasWearing"] then
+ return FBODF_PlayerInfo["WasWearing"];
+ end
+end
+
+local function SetWasWearing(outfit)
+ FBODF_PlayerInfo["WasWearing"] = outfit;
+end
+
+local function GetOutfit()
+ return FBODF_PlayerInfo["Outfit"];
+end
+
+local saved_outfit;
+local function SetOutfit(outfit)
+ saved_outfit = outfit;
+ FBODF_PlayerInfo["Outfit"] = outfit;
+end
+
+local function StyleString(long, points)
+ if ( points == 1 ) then
+ pstring = FBConstants.POINT;
+ else
+ pstring = FBConstants.POINTS;
+ end
+ if ( long ) then
+ return FB_ODFConstants.STYLEPOINTS..points.." "..pstring;
+ else
+ return FB_ODFConstants.CONFIG_STYLISH_TEXT..points.." "..pstring;
+ end
+end
+
+local function UpdateStyleInfo(outfit)
+ local points = BonusPoints(outfit);
+ if ( points >= 0 ) then
+ points = "+"..points;
+ else
+ points = 0 - points;
+ points = "-"..points;
+ end
+ FishingOutfitSkill:SetText(FB_ODFConstants.CONFIG_SKILL_TEXT..points);
+ points = StylePoints(outfit);
+ FishingOutfitStyle:SetText(StyleString(false, points));
+end
+
+local function ODF_Initialize()
+ OutfitDisplayFrame_SetOutfit(FishingOutfitFrame, saved_outfit);
+end
+
+-- the user has chosen us, make sure everything is set up the way we need
+local function ODF_Choose(useme)
+ if ( useme ) then
+ FishingBuddy.EnableSubFrame("FishingOutfitFrame");
+ else
+ FishingBuddy.DisableSubFrame("FishingOutfitFrame");
+ end
+end
+FB_OutfitFrame.Choose = ODF_Choose;
+
+-- only have one outfit at the moment
+-- don't switch if
+-- we can't find everything in the outfit
+-- we have saved stuff but we're not wearing everything in the outfit
+-- We don't have the outfit display frame!
+local function ODF_Switch()
+ if (CursorHasItem()) then
+ FishingBuddy.UIError(FB_ODFConstants.CURSORBUSYMSG);
+ return false;
+ end
+ if ( OutfitDisplayFrame_IsSwapping() ) then
+ FishingBuddy.UIError(OUTFITDISPLAYFRAME_TOOFASTMSG);
+ return false;
+ end
+
+ local isfishing = FishingBuddy.API.IsFishingPole();
+ local outfit = GetOutfit();
+ local waswearing = GetWasWearing();
+ if ( waswearing ) then
+ local msg;
+
+ if ( isfishing ) then
+ msg = OutfitDisplayFrame_SwitchWillFail(FishingOutfitFrame, waswearing);
+ else
+ msg = FB_ODFConstants.CANTSWITCHBACK;
+ SetWasWearing(nil);
+ end
+
+ if ( msg ) then
+ FishingBuddy.UIError(msg);
+ return false;
+ end
+ local check = OutfitDisplayFrame_SwitchOutfit(waswearing);
+ if ( check ) then
+ SetWasWearing(nil);
+ end
+ return true; -- look for pole
+ elseif ( outfit ) then
+ local msg;
+ if ( not isfishing ) then
+ msg = OutfitDisplayFrame_SwitchWillFail(FishingOutfitFrame, outfit);
+ else
+ msg = FB_ODFConstants.POLEALREADYEQUIPPED;
+ end
+ if ( msg ) then
+ FishingBuddy.UIError(msg);
+ return false;
+ end
+ local waswearing = OutfitDisplayFrame_SwitchOutfit(outfit);
+ if ( waswearing ) then
+ SetWasWearing(waswearing);
+ end
+ return false; -- look for no pole
+ else
+ FishingBuddy.UIError(FB_ODFConstants.NOOUTFITDEFINED);
+ end
+end
+
+local updateWait = DEFAULTUPDATE_WAIT;
+FB_OutfitFrame.Update = function(elapsed)
+ updateWait = updateWait - elapsed;
+ if ( updateWait <= 0 ) then
+ UpdateSwitchButton(saved_outfit);
+ UpdateStyleInfo(saved_outfit);
+ FishingOutfitUpdate:Hide();
+ end
+end
+
+local function CustomTooltip(button)
+ if ( button and button.item ) then
+ local _,_,check, enchant = string.find(button.item, "^(%d+):(%d+)");
+ local points = FishingBuddy.OutfitManager.ItemStylePoints(check, enchant);
+ if ( points > 0 ) then
+ GameTooltip:AddLine(StyleString(true, points));
+ end
+ end
+end
+
+local function OutfitChanged(button)
+ local outfit = OutfitDisplayFrame_GetOutfit(FishingOutfitFrame);
+ if ( outfit ) then
+ SetOutfit(outfit);
+ end
+ updateWait = DEFAULTUPDATE_WAIT;
+ FishingOutfitUpdate:Show();
+ FishingOutfitFrame.valid = true;
+end
+
+FB_OutfitFrame.OnShow = function()
+ if ( not this.valid ) then
+ saved_outfit = GetOutfit();
+ end
+ OutfitDisplayFrame_SetOutfit(FishingOutfitFrame, saved_outfit);
+ UpdateSwitchButton(saved_outfit);
+ if ( not this.valid ) then
+ OutfitChanged();
+ end
+end
+
+FB_OutfitFrame.OnLoad = function()
+ -- Handle the override
+ OutfitDisplayFrame_OnLoad();
+ FishingOutfitSkill.tooltip = FB_ODFConstants.CONFIG_SKILL_INFO;
+ FishingOutfitStyle.tooltip = FB_ODFConstants.CONFIG_STYLISH_INFO;
+ FishingOutfitSwitchButton:SetText(FB_ODFConstants.SWITCHOUTFIT);
+ FishingOutfitSwitchButton.tooltip = FB_ODFConstants.SWITCHOUTFIT_INFO;
+ FishingOutfitFrame.OutfitChanged = OutfitChanged;
+ FishingOutfitFrame.CustomTooltip = CustomTooltip;
+ FishingBuddy.OutfitManager.RegisterManager("OutfitDisplayFrame",
+ ODF_Initialize,
+ ODF_Choose,
+ ODF_Switch);
+ this:RegisterEvent("VARIABLES_LOADED");
+end
+
+FB_OutfitFrame.OnEvent = function()
+ if ( event == "VARIABLES_LOADED" ) then
+ FishingBuddy.ManageFrame(this,
+ FB_ODFConstants.OUTFITS_TAB,
+ FB_ODFConstants.OUTFITS_INFO,
+ "_OUT");
+ this:UnregisterEvent("VARIABLES_LOADED");
+ end
+end
+
+FB_OutfitFrame.OnHide = function()
+ -- OutfitChanged();
+end
+
+FB_OutfitFrame.Button_OnClick = function()
+ -- make sure we have the current state
+ SetOutfit(OutfitDisplayFrame_GetOutfit(FishingOutfitFrame));
+ ODF_Switch();
+end
+
+-- outfit debugging functions
+FishingBuddy.Commands["outfit"] = {};
+FishingBuddy.Commands["outfit"].func =
+ function(what)
+ if ( what and OutfitDisplayFrame_OnLoad ) then
+ if ( what == FBConstants.RESET ) then
+ SetWasWearing(nil);
+ elseif ( what == "dump" ) then
+ FishingBuddy.Debug("Outfit");
+ FishingBuddy.Dump(GetOutfit());
+ FishingBuddy.Debug("Was Wearing");
+ FishingBuddy.Dump(GetWasWearing());
+ end
+ end
+ return true;
+ end;
+
+-- set up
+FishingBuddy.Setup.Translate("FB_OutfitDisplayFrame", FB_ODFTranslations, FB_ODFConstants);
+if ( not FBODF_PlayerInfo ) then
+ FBODF_PlayerInfo = {};
+ FBODF_PlayerInfo["Outfit"] = {};
+end
+if ( FishingBuddy_Player and FishingBuddy_Player["Outfit"] ) then
+ for k,v in pairs(FishingBuddy_Player["Outfit"]) do
+ FBODF_PlayerInfo["Outfit"][k] = v;
+ end
+ FishingBuddy_Player["Outfit"] = nil;
+end
+-- free up the space
+FB_ODFTranslations = nil;
diff --git a/FB_OutfitDisplayFrame/FishingOutfitFrame.xml b/FB_OutfitDisplayFrame/FishingOutfitFrame.xml
new file mode 100644
index 0000000..3efbd9b
--- /dev/null
+++ b/FB_OutfitDisplayFrame/FishingOutfitFrame.xml
@@ -0,0 +1,123 @@
+
+
+
+
+
+ this:SetOwner(WorldFrame, "ANCHOR_NONE");
+
+
+
+
+
+
+
+
+
+
+
+
+
+ FB_OutfitFrame.Update(arg1);
+
+
+
+
+
+
+ FB_OutfitFrame.OnLoad();
+
+
+ FB_OutfitFrame.OnEvent();
+
+
+ FB_OutfitFrame.OnShow();
+
+
+ FB_OutfitFrame.OnHide();
+
+
+ return;
+
+
+
+
diff --git a/FB_OutfitDisplayFrame/localization.de.lua b/FB_OutfitDisplayFrame/localization.de.lua
new file mode 100644
index 0000000..da382fc
--- /dev/null
+++ b/FB_OutfitDisplayFrame/localization.de.lua
@@ -0,0 +1,30 @@
+-- Deutsche
+-- lower upper
+-- a umlaut \195\164 \195\132
+-- o umlaut \195\192 \195\150
+-- u umlaut \195\188 \195\156
+
+FB_ODFTranslations["deDE"] = {
+ DESCRIPTION = "Handhabung deiner Fischereiausr\195\188stung.",
+
+ -- Tab labels and tooltips
+ OUTFITS_INFO = "W\195\164hlen aus, was du beim Fischen tragen willst",
+ OUTFITS_TAB = "Ausr\195\188stung",
+
+ SWITCHOUTFIT = "Ausr\195\188stung wechseln",
+ SWITCHOUTFIT_INFO = "Schalter zwischen der Fischereiausstattung und was Sie vorher trugen.",
+
+ -- Option names and tooltips
+ CONFIG_SKILL_INFO = "Gesamtausstattungs-Bonus.",
+ CONFIG_SKILL_TEXT = "Angeln ",
+ CONFIG_STYLISH_INFO = "Styling-Punkte, inspiriert durch die Draznars Fishing-FAQ auf den (englischen) WoW-Foren.",
+ CONFIG_STYLISH_TEXT = "Styling: ",
+
+ -- messages
+ CURSORBUSY = "Konnte Ausr\195\188stung nicht wechseln, da Computer mit anderen Aktivit\195\164ten besch\195\164ftigt!",
+ NOOUTFITDEFINED = "Sie haben keine Ausr\195\188stungsteile in Ihrer Fischenausstattung angegeben.",
+ POLEALREADYEQUIPPED = "Ihr seid bereits f\195\188rs Angeln ausger\195\188stet.",
+ CANTSWITCHBACK = "Ihr habt bereits Eure Angelausr\195\188stung entfernt.",
+
+ BINDING_NAME_TOGGLEFISHINGBUDDY_OUT = "Outfit-Fenster anzeigen",
+};
diff --git a/FB_OutfitDisplayFrame/localization.es.lua b/FB_OutfitDisplayFrame/localization.es.lua
new file mode 100644
index 0000000..782d905
--- /dev/null
+++ b/FB_OutfitDisplayFrame/localization.es.lua
@@ -0,0 +1,23 @@
+FB_ODFTranslations["esES"] = {
+ DESCRIPTION = "Maneja tu ca\195\177a de pescar.",
+
+ -- Tab labels and tooltips
+ OUTFITS_INFO = "Desviste los que llevas cuando pescas",
+ OUTFITS_TAB = "Equipos",
+
+ SWITCHOUTFIT = "Cambia",
+ SWITCHOUTFIT_INFO = "Cambia entre el equipo de pesca y lo que llevabas puesto.",
+
+ -- Option names and tooltips
+ CONFIG_SKILL_INFO = "Bonus de equipo total.",
+ CONFIG_SKILL_TEXT = "Pescando ",
+ CONFIG_STYLISH_TEXT = "Estilo: ",
+
+ -- messages
+ CURSORBUSYMSG = "no pudo cambiar por estar el cursor ocupado!",
+ NOOUTFITDEFINED = "No tienes objetos en tu equipo de pesca.",
+ POLEALREADYEQUIPPED = "Ya estas equipado para pescar.",
+ CANTSWITCHBACK = "Ya te has quitado el equipamiento de pesca.",
+};
+
+
diff --git a/FB_OutfitDisplayFrame/localization.fr.lua b/FB_OutfitDisplayFrame/localization.fr.lua
new file mode 100644
index 0000000..c67126d
--- /dev/null
+++ b/FB_OutfitDisplayFrame/localization.fr.lua
@@ -0,0 +1,15 @@
+FB_ODFTranslations["frFR"] = {
+ DESCRIPTION = "Organise votre \195\169quipement.";
+
+ -- Tab labels and tooltips
+ OUTFITS_INFO = "Pr\195\169pare votre equipement de p\195\170che";
+ OUTFITS = "Equipement";
+ SHOWLOCATIONS_INFO = "Affiche vos prises class\195\169es par r\195\169gions.";
+
+ SWITCHOUTFIT = "Equipement";
+ SWITCHOUTFIT_INFO = "Vous habille avec votre \195\169quipement de p\195\170che, ou vous r\195\169habille comme avant.";
+
+ CONFIG_SKILL_TEXT = "P\195\170che ";
+
+ BINDING_NAME_TOGGLEFISHINGBUDDY_OUT = "Toggle: #NAME# (Panneau d'\195\169quipement)";
+};
diff --git a/FB_OutfitDisplayFrame/localization.lua b/FB_OutfitDisplayFrame/localization.lua
new file mode 100644
index 0000000..e4070c8
--- /dev/null
+++ b/FB_OutfitDisplayFrame/localization.lua
@@ -0,0 +1,30 @@
+-- default to American English
+
+FB_ODFTranslations = {};
+FB_ODFTranslations["enUS"] = {
+ NAME = "Fishing Buddy - Outfit Frame",
+ DESCRIPTION = "Manage your fishing outfit.",
+
+ -- Tab labels and tooltips
+ OUTFITS_INFO = "Pick out what to wear when fishing",
+ OUTFITS_TAB = "Outfits",
+
+ SWITCHOUTFIT = "Switch",
+ SWITCHOUTFIT_INFO = "Switch between the fishing outfit and what you were wearing before.",
+
+ -- Option names and tooltips
+ CONFIG_SKILL_INFO = "Total outfit skill bonus.",
+ CONFIG_SKILL_TEXT = "Fishing ",
+ CONFIG_STYLISH_INFO = "Style points loosely inspired by Draznar's Fishing FAQ in the WoW forums.",
+ CONFIG_STYLISH_TEXT = "Style: ",
+
+
+ -- messages
+ CURSORBUSYMSG = "Couldn't switch because the cursor is busy!",
+ NOOUTFITDEFINED = "You don't have any items in your fishing outfit.",
+ POLEALREADYEQUIPPED = "You're already equipped for fishing.",
+ CANTSWITCHBACK = "You've already removed your fishing equipment.",
+ STYLEPOINTS = "Draznar's style score: ",
+
+ BINDING_NAME_TOGGLEFISHINGBUDDY_OUT = "Toggle #NAME# Outfit Pane",
+};
diff --git a/FB_Titan/FB_Titan.toc b/FB_Titan/FB_Titan.toc
new file mode 100644
index 0000000..80f21cb
--- /dev/null
+++ b/FB_Titan/FB_Titan.toc
@@ -0,0 +1,6 @@
+## Interface: 11200
+## Title: Titan Panel [Fishing Buddy]
+## Version: 0.8.9 Beta 10
+## Author: Sutorix=AT=hotmail.com
+## RequiredDeps: Titan, FishingBuddy
+FishingBuddyTitan.xml
diff --git a/FB_Titan/FishingBuddyTitan.lua b/FB_Titan/FishingBuddyTitan.lua
new file mode 100644
index 0000000..2d3a81b
--- /dev/null
+++ b/FB_Titan/FishingBuddyTitan.lua
@@ -0,0 +1,58 @@
+-- Titan Panel support
+
+FB_Titan = {};
+
+FB_Titan.OnLoad = function()
+ if not TitanPanelButton_UpdateButton then
+ return;
+ end
+
+ this.registry = {
+ id = FBConstants.ID,
+ menuText = FBConstants.NAME,
+ version = FBConstants.VERSION,
+ category = "Profession",
+ icon = "Interface\\AddOns\\FishingBuddy\\Icons\\Fishing-Icon",
+ iconWidth = 16,
+ tooltipTitle = FBConstants.NAME,
+ tooltipTextFunction = "TitanPanelFishingBuddyButton_GetTooltipText",
+ savedVariables = {
+ ShowIcon = 1,
+ }
+ };
+
+ this:RegisterEvent("PLAYER_ENTERING_WORLD");
+end
+
+FB_Titan.OnClick = function(button)
+ if ( button == "LeftButton" ) then
+ if ( FishingBuddy.IsSwitchClick() ) then
+ FishingBuddy.Command(FBConstants.SWITCH);
+ else
+ FishingBuddy.Command("");
+ end
+ end
+end
+
+FB_Titan.OnEvent = function()
+ if TitanPanelButton_UpdateButton then
+ TitanPanelButton_UpdateButton(FBConstants.ID);
+ TitanPanelButton_UpdateTooltip();
+ end
+end
+
+function TitanPanelFishingBuddyButton_GetTooltipText()
+ return FishingBuddy.TooltipBody("ClickToSwitch");
+end
+
+function TitanPanelRightClickMenu_PrepareFishingBuddyMenu()
+ TitanPanelRightClickMenu_AddTitle(TitanPlugins[FBConstants.ID].menuText);
+
+ FishingBuddy.MakeDropDown(FBConstants.CLICKTOSWITCH_ONOFF, "ClickToSwitch");
+
+ TitanPanelRightClickMenu_AddSpacer();
+ TitanPanelRightClickMenu_AddCommand(TITAN_PANEL_MENU_HIDE,
+ FBConstants.ID,
+ TITAN_PANEL_MENU_FUNC_HIDE);
+end
+
diff --git a/FB_Titan/FishingBuddyTitan.xml b/FB_Titan/FishingBuddyTitan.xml
new file mode 100644
index 0000000..dd40669
--- /dev/null
+++ b/FB_Titan/FishingBuddyTitan.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/FB_TrackingFrame/Bindings.xml b/FB_TrackingFrame/Bindings.xml
new file mode 100644
index 0000000..a72979a
--- /dev/null
+++ b/FB_TrackingFrame/Bindings.xml
@@ -0,0 +1,8 @@
+
+
+
+ if ( keystate == "down" ) then
+ ToggleFishingBuddyFrame("FishingTrackingFrame");
+ end
+
+
\ No newline at end of file
diff --git a/FB_TrackingFrame/FB_TrackingFrame.toc b/FB_TrackingFrame/FB_TrackingFrame.toc
new file mode 100644
index 0000000..701eb8f
--- /dev/null
+++ b/FB_TrackingFrame/FB_TrackingFrame.toc
@@ -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
diff --git a/FB_TrackingFrame/FishingTrackingFrame.lua b/FB_TrackingFrame/FishingTrackingFrame.lua
new file mode 100644
index 0000000..53b9ca5
--- /dev/null
+++ b/FB_TrackingFrame/FishingTrackingFrame.lua
@@ -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
diff --git a/FB_TrackingFrame/FishingTrackingFrame.xml b/FB_TrackingFrame/FishingTrackingFrame.xml
new file mode 100644
index 0000000..2b9199d
--- /dev/null
+++ b/FB_TrackingFrame/FishingTrackingFrame.xml
@@ -0,0 +1,162 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ this:SetFrameLevel(0);
+ UIDropDownMenu_SetWidth(180);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ FB_TrackingFrame.OnClick(arg1);
+
+
+ FB_TrackingFrame.OnEnter();
+
+
+ FB_TrackingFrame.OnLeave();
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ FB_TrackingFrame.OnClick(arg1);
+
+
+ FB_TrackingFrame.OnEnter();
+
+
+ FB_TrackingFrame.OnLeave();
+
+
+
+
+
+
+ FB_TrackingFrame.OnLoad();
+
+
+ FB_TrackingFrame.OnEvent();
+
+
+ FB_TrackingFrame.OnShow();
+
+
+
+
diff --git a/FB_TrackingFrame/GraphHandler.lua b/FB_TrackingFrame/GraphHandler.lua
new file mode 100644
index 0000000..8fbc4be
--- /dev/null
+++ b/FB_TrackingFrame/GraphHandler.lua
@@ -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
diff --git a/FB_TrackingFrame/GraphHandler.xml b/FB_TrackingFrame/GraphHandler.xml
new file mode 100644
index 0000000..b252be4
--- /dev/null
+++ b/FB_TrackingFrame/GraphHandler.xml
@@ -0,0 +1,211 @@
+
+
+
+
+
+ GraphHandler.InitElements();
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ this:SetFrameLevel(this:GetFrameLevel() + 1);
+ this:RegisterEvent("VARIABLES_LOADED");
+
+
+ GraphHandler.Register(GraphHandler.LEGEND, this);
+
+
+ GraphHandler.Legend.OnEnter();
+
+
+ GraphHandler.Legend.OnLeave();
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FB_TrackingFrame/localization.de.lua b/FB_TrackingFrame/localization.de.lua
new file mode 100644
index 0000000..74130b4
--- /dev/null
+++ b/FB_TrackingFrame/localization.de.lua
@@ -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#|r",
+ " zeichne die Angeldauer f\195\188r die angegebene",
+ " Fischart (ein Shift-Klick-Link) auf",
+ "|c#GREEN#/fb #NOTRACK#|r |c#PURPLE#|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",
+};
diff --git a/FB_TrackingFrame/localization.es.lua b/FB_TrackingFrame/localization.es.lua
new file mode 100644
index 0000000..a4b0821
--- /dev/null
+++ b/FB_TrackingFrame/localization.es.lua
@@ -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'.",
+};
diff --git a/FB_TrackingFrame/localization.fr.lua b/FB_TrackingFrame/localization.fr.lua
new file mode 100644
index 0000000..6c59807
--- /dev/null
+++ b/FB_TrackingFrame/localization.fr.lua
@@ -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#|r",
+ " Surveille le temps de prise pour ce poisson (Maj-Click)",
+ "|c#GREEN#/fb #NOTRACK#|r |c#PURPLE#|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",
+};
diff --git a/FB_TrackingFrame/localization.lua b/FB_TrackingFrame/localization.lua
new file mode 100644
index 0000000..e522d34
--- /dev/null
+++ b/FB_TrackingFrame/localization.lua
@@ -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#|r",
+ " track the catch times for the specified fish (a shift click link)",
+ "|c#GREEN#/fb #NOTRACK#|r |c#PURPLE#|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",
+};
diff --git a/FishingBuddy/Bindings.xml b/FishingBuddy/Bindings.xml
new file mode 100644
index 0000000..5fa35da
--- /dev/null
+++ b/FishingBuddy/Bindings.xml
@@ -0,0 +1,37 @@
+
+
+
+ if ( keystate == "down" ) then
+ FishingBuddy.Command("");
+ end
+
+
+ if ( keystate == "down" ) then
+ ToggleFishingBuddyFrame("FishingLocationsFrame");
+ end
+
+
+ if ( keystate == "down" ) then
+ ToggleFishingBuddyFrame("FishingOptionsFrame");
+ end
+
+
+
+ if ( keystate == "down" ) then
+ FishingBuddy.Command(FishingBuddy.SWITCH);
+ end
+
+
+ if ( keystate == "down" ) then
+ FishingBuddy.SuitUpAndGoFishing();
+ end
+
+
+
+ if ( keystate == "up" ) then
+ FishingBuddy.PerformCast();
+ else
+ FishingBuddy.UpdateBindings(false);
+ end
+
+
\ No newline at end of file
diff --git a/FishingBuddy/FishingBuddy.lua b/FishingBuddy/FishingBuddy.lua
new file mode 100644
index 0000000..8b0e139
--- /dev/null
+++ b/FishingBuddy/FishingBuddy.lua
@@ -0,0 +1,1792 @@
+-- FishingBuddy
+--
+-- Everything you wanted support for in your fishing endeavors
+
+-- Information for the stylin' fisherman
+local POLES = {
+ ["Fishing Pole"] = "6256:0:0:0",
+ ["Strong Fishing Pole"] = "6365:0:0:0",
+ ["Darkwood Fishing Pole"] = "6366:0:0:0",
+ ["Big Iron Fishing Pole"] = "6367:0:0:0",
+ ["Blump Family Fishing Pole"] = "12225:0:0:0",
+ ["Nat Pagle's Extreme Angler FC-5000"] = "19022:0:0:0",
+ ["Arcanite Fishing Pole"] = "19970:0:0:0",
+ -- yeah, so you can't really use these (for now :-)
+ ["Dwarven Fishing Pole"] = "3567:0:0:0",
+ ["Goblin Fishing Pole"] = "4598:0:0:0",
+}
+
+local FISHINGLURES = {
+ [6533] = "Aquadynamic Fish Attractor", -- 100 for 5 mins
+ [7307] = "Flesh Eating Worm", -- 75 for 10 mins
+ [6532] = "Bright Baubles", -- 75 for 10 mins
+ [6811] = "Aquadynamic Fish Lens", -- 50 for 10 mins
+ [6530] = "Nightcrawlers", -- 50 for 10 mins
+ [6529] = "Shiny Bauble", -- 25 for 10 mins
+}
+
+FishingBuddy.OPTIONS = {
+ ["ShowNewFishies"] = {
+ ["text"] = FBConstants.CONFIG_SHOWNEWFISHIES_ONOFF,
+ ["tooltip"] = FBConstants.CONFIG_SHOWNEWFISHIES_INFO,
+ ["v"] = 1,
+ ["m"] = 1,
+ ["default"] = 1 },
+ ["WatchFishies"] = {
+ ["text"] = FBConstants.CONFIG_FISHWATCH_ONOFF,
+ ["tooltip"] = FBConstants.CONFIG_FISHWATCH_INFO,
+ ["v"] = 1,
+ ["m"] = 1,
+ ["default"] = 1 },
+ ["WatchCurrentSkill"] = {
+ ["text"] = FBConstants.CONFIG_FISHWATCHSKILL_ONOFF,
+ ["tooltip"] = FBConstants.CONFIG_FISHWATCHSKILL_INFO,
+ ["v"] = 1,
+ ["m"] = 1,
+ ["default"] = 1,
+ ["deps"] = { ["WatchFishies"] = "d" } },
+ ["WatchCurrentZone"] = {
+ ["text"] = FBConstants.CONFIG_FISHWATCHZONE_ONOFF,
+ ["tooltip"] = FBConstants.CONFIG_FISHWATCHZONE_INFO,
+ ["v"] = 1,
+ ["m"] = 1,
+ ["default"] = 0,
+ ["deps"] = { ["WatchFishies"] = "d" } },
+ ["WatchOnlyWhenFishing"] = {
+ ["text"] = FBConstants.CONFIG_FISHWATCHONLY_ONOFF,
+ ["tooltip"] = FBConstants.CONFIG_FISHWATCHONLY_INFO,
+ ["v"] = 1,
+ ["m"] = 1,
+ ["default"] = 1,
+ ["deps"] = { ["WatchFishies"] = "d" } },
+ ["WatchFishPercent"] = {
+ ["text"] = FBConstants.CONFIG_FISHWATCHPERCENT_ONOFF,
+ ["tooltip"] = FBConstants.CONFIG_FISHWATCHPERCENT_INFO,
+ ["v"] = 1,
+ ["m"] = 1,
+ ["default"] = 1,
+ ["deps"] = { ["WatchFishies"] = "d" } },
+ ["SortByPercent"] = {
+ ["text"] = FBConstants.CONFIG_SORTBYPERCENT_ONOFF,
+ ["tooltip"] = FBConstants.CONFIG_SORTBYPERCENT_INFO,
+ ["v"] = 1,
+ ["m"] = 1,
+ ["default"] = 1 },
+ ["SuitUpFirst"] = {
+ ["text"] = FBConstants.CONFIG_SUITUPFIRST_ONOFF,
+ ["tooltip"] = FBConstants.CONFIG_SUITUPFIRST_INFO,
+ ["v"] = 1,
+ ["m"] = 1,
+ ["default"] = 0 },
+ ["EasyCast"] = {
+ ["text"] = FBConstants.CONFIG_EASYCAST_ONOFF,
+ ["tooltip"] = FBConstants.CONFIG_EASYCAST_INFO,
+ ["v"] = 1,
+ ["m"] = 1,
+ ["default"] = 1 },
+ ["EasyLures"] = {
+ ["text"] = FBConstants.CONFIG_EASYLURES_ONOFF,
+ ["tooltip"] = FBConstants.CONFIG_EASYLURES_INFO,
+ ["v"] = 1,
+ ["m"] = 1,
+ ["default"] = 0 },
+ ["STVTimer"] = {
+ ["text"] = FBConstants.CONFIG_STVTIMER_ONOFF,
+ ["tooltip"] = FBConstants.CONFIG_STVTIMER_INFO,
+ ["v"] = 1,
+ ["m"] = 1,
+ ["default"] = 0 },
+ ["STVPoolsOnly"] = {
+ ["text"] = FBConstants.CONFIG_STVPOOLSONLY_ONOFF,
+ ["tooltip"] = FBConstants.CONFIG_STVPOOLSONLY_INFO,
+ ["v"] = 1,
+ ["m"] = 1,
+ ["default"] = 0,
+ ["deps"] = { ["STVTimer"] = "d", ["EasyCast"] = "d" } },
+ ["UseButtonHole"] = {
+ ["text"] = FBConstants.CONFIG_USEBUTTONHOLE_ONOFF,
+ ["tooltip"] = FBConstants.CONFIG_USEBUTTONHOLE_INFO,
+ ["v"] = 1,
+ ["default"] = 0,
+ ["check"] = function () return ButtonHole ~= nil; end,
+ ["checkfail"] = 0 },
+ ["UseGatherer"] = {
+ ["text"] = FBConstants.CONFIG_USEGATHERER_ONOFF,
+ ["tooltip"] = FBConstants.CONFIG_USEGATHERER_INFO,
+ ["v"] = 1,
+ ["default"] = 0,
+ ["check"] = function () return Gatherer_OnLoad ~= nil; end,
+ ["checkfail"] = 0 },
+ ["MinimapButtonVisible"] = {
+ ["tooltip"] = FBConstants.CONFIG_MINIMAPBUTTON_INFO,
+ ["v"] = 1,
+ ["default"] = 1,
+ ["check"] = function () return not FishingBuddy.UseButtonHole(); end,
+ ["checkfail"] = 0,
+ ["update"] = function(checked)
+ local b = FishingBuddyOption_MinimapButtonVisible;
+ if ( b:GetChecked() ) then
+ b.text = "";
+ else
+ b.text = FBConstants.CONFIG_MINIMAPBUTTON_ONOFF;
+ end
+ FishingBuddyOption_MinimapButtonVisibleText:SetText(b.text);
+ end,
+ },
+ ["EnhanceFishingSounds"] = {
+ ["text"] = FBConstants.CONFIG_ENHANCESOUNDS_ONOFF,
+ ["tooltip"] = FBConstants.CONFIG_ENHANCESOUNDS_INFO,
+ ["v"] = 1,
+ ["m"] = 1,
+ ["default"] = 0 },
+ -- options not in a menu
+ ["ShowLocationZones"] = {
+ ["default"] = 1,
+ },
+ ["GroupByLocation"] = {
+ ["default"] = 1,
+ },
+ -- bar switching
+ ["ClickToSwitch"] = {
+ ["default"] = 1,
+ },
+ ["MinimapClickToSwitch"] = {
+ ["default"] = 0,
+ },
+ ["BroadcastFishies"] = {
+ ["default"] = FBConstants.BROADCAST_RECV,
+ },
+ ["EasyCastKeys"] = {
+ ["default"] = FBConstants.KEYS_NONE,
+ ["deps"] = { ["EasyCast"] = "h" },
+ },
+ ["SuitUpKeys"] = {
+ ["default"] = FBConstants.KEYS_NONE,
+ },
+ ["EnhanceSoundSoundVolume"] = {
+ ["default"] = 1.0,
+ },
+ ["EnhanceSoundMusicVolume"] = {
+ ["default"] = 0.0,
+ },
+ ["EnhanceSoundAmbienceVolume"] = {
+ ["default"] = 0.0,
+ },
+ ["MinimapButtonPosition"] = {
+ ["default"] = FBConstants.DEFAULT_MINIMAP_POSITION,
+ },
+ ["MinimapPosSlider"] = {
+ ["deps"] = { ["MinimapButtonVisible"] = "h", },
+ },
+ ["ClockOffset"] = {
+ ["default"] = 0,
+ ["deps"] = { ["STVTimer"] = "h" },
+ ["visible"] = function()
+ if ( FBConstants.ClockOffsets ) then
+ return 1;
+ else
+ return 0;
+ end;
+ end,
+ },
+ ["OutfitManager"] = {
+ ["default"] = "OutfitDisplayFrame",
+ },
+}
+
+FishingBuddy.ByFishie = nil;
+FishingBuddy.SortedFishies = nil;
+
+local ActionStartTime = 0;
+local ActionDoubleTime = 0;
+local ACTIONDOWNWAIT = 0.2;
+local ACTIONDOUBLEWAIT = 0.4;
+local SavedAddMessage = nil;
+
+FishingBuddy.SavedToggleMinimap = nil;
+
+FishingBuddy.StartedFishing = nil;
+
+local TestingLures = false;
+local CastingNow = false;
+local AddingLure = false;
+local IsLooting = false;
+
+local FishingSpellID = nil;
+local FishingSkillName = nil;
+
+local gotSetupDone = false;
+local playerName = nil;
+local realmName = nil;
+local schooltipText = nil;
+
+FishingBuddy.currentFishies = {};
+
+local DEFAULT_MINIMAP_POSITION = 256;
+
+local function GetDefault(setting)
+ local opt = FishingBuddy.OPTIONS[setting];
+ if ( opt ) then
+ if ( opt.check and opt.checkfail ) then
+ if ( not opt.check() ) then
+ return opt.checkfail;
+ end
+ end
+ return opt.default;
+ end
+end
+FishingBuddy.GetDefault = GetDefault;
+
+local function GetSetting(setting)
+ if ( not FishingBuddy_Player or
+ not FishingBuddy_Player["Settings"] ) then
+ return;
+ end
+ local val = FishingBuddy_Player["Settings"][setting];
+ if ( val == nil ) then
+ val = GetDefault(setting);
+ end
+ return val;
+end
+FishingBuddy.GetSetting = GetSetting;
+
+local function SetSetting(setting, value)
+ if ( FishingBuddy_Player and setting ) then
+ local val = GetDefault(setting);
+ if ( val == value ) then
+ FishingBuddy_Player["Settings"][setting] = nil;
+ else
+ FishingBuddy_Player["Settings"][setting] = value;
+ end
+ end
+end
+FishingBuddy.SetSetting = SetSetting;
+
+local function SetClockOffset(offset)
+ if ( not FishingBuddy_Info["ClockOffsets"] ) then
+ FishingBuddy_Info["ClockOffsets"] = {};
+ end
+ if ( offset == 0 ) then
+ FishingBuddy_Info["ClockOffsets"][realmName] = nil;
+ else
+ FishingBuddy_Info["ClockOffsets"][realmName] = offset;
+ end
+end
+FishingBuddy.SetClockOffset = SetClockOffset;
+
+local function GetClockOffset()
+ if ( not FishingBuddy_Info["ClockOffsets"] or
+ not FishingBuddy_Info["ClockOffsets"][realmName] ) then
+ return 0;
+ end
+ return FishingBuddy_Info["ClockOffsets"][realmName];
+end
+FishingBuddy.GetClockOffset = GetClockOffset;
+
+-- We have to do this at PLAYER_ENTERING_WORLD or PLAYER_LOGIN
+-- GetGameTime isn't correct at VARIABLES_LOADED
+local function CheckClockOffset()
+ local hour,minute = GetGameTime();
+ local lhour = date("%H");
+ local lminute = date("%M");
+ local houroff;
+ houroff = hour - lhour;
+ if ( houroff ~= 0 ) then
+ local houroff24;
+ if ( houroff < 0 ) then
+ houroff24 = 24 + houroff;
+ else
+ houroff24 = houroff - 24;
+ end
+ local offsets = { houroff, houroff24 };
+ FBConstants.ClockOffsets = offsets;
+ local current = GetClockOffset();
+ -- don't change it if we've already got a good value
+ if ( current ~= houroff and current ~= houroff24 ) then
+ SetClockOffset(houroff);
+ end
+ else
+ FBConstants.ClockOffsets = nil;
+ SetClockOffset(0);
+ end
+ -- Set up the menu and such
+ FishingBuddy.OptionsFrame.SetClockValues(GetClockOffset());
+end
+
+-- Something else that should be in a library
+local function SplitLink(link)
+ if ( link ) then
+ local _,_, color, item, name = string.find(link, "|c(%x+)|Hitem:(%d+:%d+:%d+:%d+)|h%[(.-)%]|h|r");
+ return color, item, name;
+ end
+end
+FishingBuddy.SplitLink = SplitLink;
+
+local function SplitFishLink(link)
+ if ( link ) then
+ local _,_, color, id, name = string.find(link, "|c(%x+)|Hitem:(%d+):%d+:%d+:%d+|h%[(.-)%]|h|r");
+ return color, tonumber(id), name;
+ end
+end
+FishingBuddy.SplitFishLink = SplitFishLink;
+
+local function _GetItemInfo(link)
+ local maj,min,dot = FishingBuddy.WOWVersion();
+-- name, link, rarity, itemlevel, minlevel, itemtype
+-- subtype, stackcount, equiploc, texture
+ local nm,li,ra,il,ml,it,st,sc,el,tx;
+ if ( maj > 1 ) then
+ nm,li,ra,il,ml,it,st,sc,el,tx = GetItemInfo(link);
+ else
+ nm,li,ra,ml,it,st,sc,el,tx = GetItemInfo(link);
+ end
+ return nm,li,ra,ml,it,st,sc,el,tx,il;
+end
+
+local function IsLinkableItem(item)
+ local link = "item:"..item;
+ local n,l,_,_,_,_,_,_ = _GetItemInfo(link);
+ return ( n and l );
+end
+FishingBuddy.IsLinkableItem = IsLinkableItem;
+
+-- event handling
+local reg_events = {};
+local event_handlers = {};
+local function RegisterHandlers(handlers)
+ for evt,info in pairs(handlers) do
+ local func, fake;
+ if ( not event_handlers[evt] ) then
+ event_handlers[evt] = {};
+ end
+ if ( type(info) == "function" ) then
+ func = info;
+ fake = false;
+ else
+ func = info.func;
+ fake = info.fake;
+ end
+ if ( FBConstants.FBEvents[evt] ) then
+ fake = true;
+ end
+ tinsert(event_handlers[evt], func);
+ if ( not fake ) then
+ -- register the event, if we haven't already
+ if ( FishingBuddy.StartedFishing and not reg_events[evt] ) then
+ FishingBuddyFrame:RegisterEvent(evt);
+ end
+ reg_events[evt] = 1;
+ end
+ end
+end
+FishingBuddy.API.RegisterHandlers = RegisterHandlers;
+
+local function RunHandlers(what, ...)
+ if ( event_handlers[what] ) then
+ for idx,func in pairs(event_handlers[what]) do
+ func(unpack(arg));
+ end
+ end
+end
+FishingBuddy.RunHandlers = RunHandlers;
+
+-- look at tooltips
+local function GetTooltipText()
+ local text = "";
+ if ( GameTooltip:IsVisible() ) then
+ text = getglobal("GameTooltipTextLeft1");
+ if ( text ) then
+ return text:GetText();
+ end
+ end
+ return nil;
+end
+FishingBuddy.GetTooltipText = GetTooltipText;
+
+local function LastTooltipText()
+ return schooltipText;
+end
+FishingBuddy.LastTooltipText = LastTooltipText;
+
+local function ClearTooltipText()
+ schooltipText = nil;
+end
+FishingBuddy.ClearTooltipText = ClearTooltipText;
+
+local function OnFishingBobber()
+ local text = GetTooltipText();
+ if ( text ) then
+ -- let a partial match work (for translations)
+ return ( text and string.find(text, FBConstants.BOBBER_NAME ) );
+ end
+ return false;
+end
+
+-- support finding the fishing skill
+local function FindSpellID(thisone)
+ local id = 1;
+ local spellTexture = GetSpellTexture(id, BOOKTYPE_SPELL);
+ while (spellTexture) do
+ if (spellTexture and spellTexture == thisone) then
+ return id;
+ end
+ id = id + 1;
+ spellTexture = GetSpellTexture(id, BOOKTYPE_SPELL);
+ end
+ return nil;
+end
+
+local function GetFishingSpellID()
+ if ( not FishingSpellID or not FishingSkillName) then
+ FishingSpellID = FindSpellID(FBConstants.FISHINGTEXTURE);
+ end
+ if ( FishingSpellID and not FishingSkillName ) then
+ FishingSkillName = GetSpellName(FishingSpellID, BOOKTYPE_SPELL);
+ end
+end
+
+local function GetFishingSkillName()
+ GetFishingSpellID();
+ if ( not FishingSkillName ) then
+ return FBConstants.FISHINGSKILL;
+ else
+ return FishingSkillName;
+ end
+end
+FishingBuddy.GetFishingSkillName = GetFishingSkillName;
+
+-- handle option keys for enabling casting
+local key_actions = {
+ [FBConstants.KEYS_NONE] = function() return true; end,
+ [FBConstants.KEYS_SHIFT] = function() return IsShiftKeyDown(); end,
+ [FBConstants.KEYS_CTRL] = function() return IsControlKeyDown(); end,
+ [FBConstants.KEYS_ALT] = function() return IsAltKeyDown(); end,
+}
+local function CastingKeys()
+ local setting = GetSetting("EasyCastKeys");
+ if ( setting and key_actions[setting] ) then
+ return key_actions[setting]();
+ else
+ return true;
+ end
+end
+
+-- get our current fishing skill level
+local lastSkillIndex = nil;
+local function GetCurrentSkill()
+ if ( lastSkillIndex ) then
+ local name, _, _, rank, _, modifier = GetSkillLineInfo(lastSkillIndex);
+ if ( name == GetFishingSkillName() )then
+ return rank, modifier;
+ end
+ end
+ local n = GetNumSkillLines();
+ for i=1,n do
+ local name, _, _, rank, _, modifier = GetSkillLineInfo(i);
+ if ( name == GetFishingSkillName() ) then
+ lastSkillIndex = i;
+ return rank, modifier;
+ end
+ end
+ return 0, 0;
+end
+FishingBuddy.GetCurrentSkill = GetCurrentSkill;
+
+-- handle dynamic event registration
+local function EventRegistration(frame, events, reg)
+ for evt,t in pairs(reg_events) do
+ if ( reg ) then
+ frame:RegisterEvent(evt);
+ else
+ frame:UnregisterEvent(evt);
+ end
+ end
+end
+
+
+-- handle the vagaries of zones and subzones
+local function GetZoneInfo()
+ local zone = GetRealZoneText();
+ local subzone = GetSubZoneText();
+ if ( not zone or zone == "" ) then
+ zone = FBConstants.UNKNOWN;
+ end
+ if ( not subzone or subzone == "" ) then
+ subzone = zone;
+ end
+ return zone, subzone;
+end
+FishingBuddy.GetZoneInfo = GetZoneInfo;
+
+local zonemapping;
+local subzonemapping;
+
+local function DumpMappings()
+ FishingBuddy.Debug("Zone mapping");
+ FishingBuddy.Dump(zonemapping);
+ FishingBuddy.Debug("SubZone mapping");
+ FishingBuddy.Dump(subzonemapping);
+end
+FishingBuddy.DumpMappings = DumpMappings;
+
+local function GetZoneIndex(zone, subzone)
+ if ( not zone ) then
+ zone, subzone = GetZoneInfo();
+ end
+ if ( not zonemapping ) then
+ zonemapping = {};
+ for idx,z in pairs(FishingBuddy_Info["ZoneIndex"]) do
+ zonemapping[z] = idx;
+ end
+ end
+ local zidx = zonemapping[zone];
+ if ( not subzonemapping ) then
+ subzonemapping = {};
+ for idx,_ in pairs(FishingBuddy_Info["ZoneIndex"]) do
+ subzonemapping[idx] = {};
+ if ( FishingBuddy_Info["SubZones"][idx] ) then
+ for jdx,sz in pairs(FishingBuddy_Info["SubZones"][idx]) do
+ subzonemapping[idx][sz] = jdx;
+ end
+ end
+ end
+ end
+ if ( not zidx ) then
+ return;
+ end
+ if ( not subzonemapping[zidx] ) then
+ subzonemapping[zidx] = {};
+ end
+ if ( not subzone or not subzonemapping[zidx][subzone] ) then
+ return zidx;
+ end
+ return zidx, subzonemapping[zidx][subzone];
+end
+FishingBuddy.GetZoneIndex = GetZoneIndex;
+
+local function AddZoneIndex(zone, subzone)
+ if ( not zone ) then
+ zone, subzone = GetZoneInfo();
+ end
+ if ( type(zone) ~= "string" ) then
+ FishingBuddy.Debug("AddZoneIndex "..zone);
+ end
+ local zidx, sidx = GetZoneIndex(zone, subzone);
+ if ( not zidx ) then
+ tinsert(FishingBuddy_Info["ZoneIndex"], zone);
+ zidx = table.getn(FishingBuddy_Info["ZoneIndex"]);
+ zonemapping[zone] = zidx;
+ -- keep sort helpers up to date
+ if ( FishingBuddy.SortedZones ) then
+ tinsert(FishingBuddy.SortedZones, zone);
+ table.sort(FishingBuddy.SortedZones);
+ end
+ end
+ if ( not subzone ) then
+ return zidx;
+ end
+ if ( not subzonemapping[zidx] ) then
+ subzonemapping[zidx] = {};
+ end
+ if ( not subzonemapping[zidx][subzone] ) then
+ if ( not FishingBuddy_Info["SubZones"][zidx] ) then
+ FishingBuddy_Info["SubZones"][zidx] = {};
+ end
+ tinsert(FishingBuddy_Info["SubZones"][zidx], subzone);
+ subzonemapping[zidx][subzone] = table.getn(FishingBuddy_Info["SubZones"][zidx]);
+ -- keep sort helpers up to date
+ if ( FishingBuddy.SortedByZone ) then
+ FishingBuddy.SortedByZone[zone] = {};
+ tinsert(FishingBuddy.SortedByZone[zone], subzone);
+ table.sort(FishingBuddy.SortedByZone[zone]);
+ tinsert(FishingBuddy.SortedSubZones, subzone);
+ table.sort(FishingBuddy.SortedSubZones);
+ end
+ end
+ return zidx, subzonemapping[zidx][subzone];
+end
+FishingBuddy.AddZoneIndex = AddZoneIndex;
+
+local function SetZoneLevel(zone, subzone, fishid)
+ local skill, mods = GetCurrentSkill();
+ local zidx, sidx = GetZoneIndex(zone, subzone);
+ local fs = FishingBuddy_Info["FishingSkill"];
+ if ( not fs[zidx] ) then
+ fs[zidx] = {};
+ end
+ local skillcheck = skill + mods;
+ if ( skillcheck > 0 ) then
+ if ( not fs[zidx][sidx] or skillcheck < fs[zidx][sidx] ) then
+ fs[zidx][sidx] = skillcheck;
+ end
+ if ( fishid ) then
+ if ( not FishingBuddy_Info["Fishies"][fishid].level or
+ skillcheck < FishingBuddy_Info["Fishies"][fishid].level ) then
+ FishingBuddy_Info["Fishies"][fishid].level = skillcheck;
+ FishingBuddy_Info["Fishies"][fishid].skill = skill;
+ FishingBuddy_Info["Fishies"][fishid].mods = mods;
+ end
+ end
+ end
+ return skill + mods;
+end
+FishingBuddy.SetZoneLevel = SetZoneLevel;
+
+local function AddFishie(color, id, name, zone, subzone, texture, quantity, quality, level)
+ if ( not FishingBuddy_Info["Fishies"][id] ) then
+ if ( not color ) then
+ local _,_,_,hex = GetItemQualityColor(quality);
+ _,_,color = string.find(hex, "|c(%a+)");
+ end
+ FishingBuddy_Info["Fishies"][id] = { };
+ FishingBuddy_Info["Fishies"][id].name = name;
+ FishingBuddy_Info["Fishies"][id].texture = texture;
+ FishingBuddy_Info["Fishies"][id].quality = quality;
+ if ( color ~= "ffffffff" ) then
+ FishingBuddy_Info["Fishies"][id].color = color;
+ end
+ if ( FishingBuddy.SortedFishies ) then
+ tinsert(FishingBuddy.SortedFishies, { text = name, id = id });
+ FishingBuddy.FishSort(FishingBuddy.SortedFishies, true);
+ end
+ end
+ if ( name and not FishingBuddy_Info["Fishies"][id].name ) then
+ FishingBuddy_Info["Fishies"][id].name = name;
+ end
+
+ if ( not zone ) then
+ zone = FBConstants.UNKNOWN;
+ end
+ if ( not subzone ) then
+ subzone = zone;
+ end
+ local zidx, sidx = AddZoneIndex(zone, subzone);
+
+ if ( not FishingBuddy.currentFishies[sidx] ) then
+ FishingBuddy.currentFishies[sidx] = {};
+ end
+ if ( not FishingBuddy.currentFishies[sidx][id] ) then
+ FishingBuddy.currentFishies[sidx][id] = quantity;
+ else
+ FishingBuddy.currentFishies[sidx][id] = FishingBuddy.currentFishies[sidx][id] + quantity;
+ end
+
+ if( not FishingBuddy_Info["FishingHoles"][zidx] ) then
+ FishingBuddy_Info["FishingHoles"][zidx] = { };
+ end
+ if( not FishingBuddy_Info["FishingHoles"][zidx][sidx] ) then
+ FishingBuddy_Info["FishingHoles"][zidx][sidx] = { };
+ end
+ local fh = FishingBuddy_Info["FishingHoles"][zidx];
+ if ( not fh[sidx][id] ) then
+ fh[sidx][id] = quantity;
+ if ( GetSetting("ShowNewFishies") == 1 ) then
+ FishingBuddy.Print(FBConstants.ADDFISHIEMSG, name, subzone);
+ end
+ else
+ fh[sidx][id] = fh[sidx][id] + quantity;
+ end
+
+ if ( FishingBuddy.ByFishie ) then
+ if ( not FishingBuddy.ByFishie[id] ) then
+ FishingBuddy.ByFishie[id] = {};
+ end
+ if ( not FishingBuddy.ByFishie[id][subzone] ) then
+ FishingBuddy.ByFishie[id][sidx] = quantity;
+ else
+ FishingBuddy.ByFishie[id][sidx] = FishingBuddy.ByFishie[id][sidx] + quantity;
+ end
+ end
+
+ if ( level ) then
+ if ( not FishingBuddy_Info["Fishies"][id].level or
+ level < FishingBuddy_Info["Fishies"][id].level ) then
+ FishingBuddy_Info["Fishies"][id].level = level;
+ end
+ end
+ RunHandlers(FBConstants.ADD_FISHIE_EVT, id, name, zone, subzone);
+end
+FishingBuddy.AddFishie = AddFishie;
+
+local function AddFishieMessage(msg, group, who)
+ local getbroadcast = GetSetting("BroadcastFishies");
+ if ( getbroadcast ) then
+ local _,_,v,loc,id,quantity,zone,subzone,level = string.find(msg, "(%a+)_(%a+)_(%a+)_(%a+)_(%a+)_(%a+)");
+ -- First useful version is 8800
+ FishingBuddy.Debug("ADDON "..msg);
+ if ( loc == GetLocale() and v <= FBConstants.CURRENTVERSION ) then
+ local link = "item:"..id..":0:0:0";
+ FishingOutfitTooltip:SetHyperlink(link);
+ local n,s,q,l,t,s,c,e,x = _GetItemInfo(link);
+ FishingBuddy.AddFishie(nil, id, n, zone, subzone, x, quantity, q, level);
+ end
+ end
+end
+FishingBuddy.AddFishieMessage = AddFishieMessage;
+
+local MsgCheck = {
+ ["GUILD"] = function() return IsInGuild(); end,
+ ["RAID"] = function() return (GetNumPartyMembers() > 0 or GetNumRaidMembers() > 0); end,
+};
+
+local CaptureEvents = {};
+CaptureEvents["LOOT_OPENED"] = function()
+ IsLooting = true;
+ if ( IsFishingLoot()) then
+ local zone, subzone = GetZoneInfo();
+ for index = 1, GetNumLootItems(), 1 do
+ if (LootSlotIsItem(index)) then
+ local texture, fishie, quantity, quality = GetLootSlotInfo(index);
+ local link = GetLootSlotLink(index);
+ local color, id, name = SplitFishLink(link);
+ AddFishie(color, id, name, zone, subzone, texture, quantity, quality);
+ local level = SetZoneLevel(zone, subzone, id);
+ -- Tell everybody we got one
+ local loc = GetLocale();
+ local msg = FBConstants.CURRENTVERSION.."_"..loc.."_"..id.."_"..quantity.."_"..zone.."_"..subzone.."_"..level;
+ for target,check in pairs(MsgCheck) do
+ if ( check() ) then
+ SendAddonMessage(FBConstants.MSGID, msg, target);
+ end
+ end
+ end
+ end
+ ClearTooltipText();
+ end
+end
+
+CaptureEvents["LOOT_CLOSED"] = function()
+ IsLooting = false;
+end
+
+CaptureEvents["CHAT_MSG_ADDON"] = function()
+ if ( arg1 == FBConstants.MSGID and arg4 ~= UnitName("player") ) then
+ AddFishieMessage(arg2, arg3, arg4);
+ end
+end
+
+StatusEvents = {};
+StatusEvents["SPELLS_CHANGED"] = function()
+ -- Fishing might have moved, go look again
+ FishingSpellID = nil;
+end
+
+StatusEvents["ITEM_LOCK_CHANGED"] = FishingMode;
+
+StatusEvents["SPELLCAST_CHANNEL_START"] = function()
+ -- Mugendai is one sharp cookie (shamelessly stealing from TackleBox)
+ -- Keep up with whether or not we are casting
+ CastingNow = true;
+end
+
+StatusEvents["SPELLCAST_CHANNEL_STOP"] = function()
+ CastingNow = false;
+end
+
+StatusEvents["SPELLCAST_START"] = function()
+ -- AddingLure = true;
+end
+
+StatusEvents["SPELLCAST_STOP"] = function()
+ AddingLure = false;
+end
+
+StatusEvents["SPELLCAST_INTERRUPTED"] = function()
+ AddingLure = false;
+end
+
+StatusEvents["SPELLCAST_FAILED"] = function()
+ AddingLure = false;
+end
+
+local OldBindingKey;
+local function UpdateBindings(onoff)
+ if ( onoff ) then
+ if ( not OldKeyBinding ) then
+ OldKeyBinding = GetBindingKey("TURNORACTION");
+ if ( OldKeyBinding ) then
+ SetBinding(OldKeyBinding, "FISHINGBUDDY_PERFORMCAST");
+ else
+ FishingBuddy.UIError(FBConstants.TOOMANYFISHERMEN);
+ end
+ end
+ else
+ if ( OldKeyBinding ) then
+ SetBinding(OldKeyBinding, "TURNORACTION");
+ OldKeyBinding = nil;
+ end
+ end
+end
+FishingBuddy.UpdateBindings = UpdateBindings;
+
+-- Shamelessly stolen from TackleBox
+local function IsFishingPole()
+ -- Get the main hand item texture
+ local slot = GetInventorySlotInfo("MainHandSlot");
+ local itemTexture = GetInventoryItemTexture("player", slot);
+ -- If there is infact an item in the main hand, and it's texture
+ -- that matches the fishing pole texture, then we have a fishing pole
+ if ( itemTexture and string.find(itemTexture, "INV_Fishingpole") ) then
+ local link = GetInventoryItemLink("player", slot);
+ local _, id, _ = SplitLink(link);
+ -- Make sure it's not "Nat Pagle's Fish Terminator"
+ if ( not string.find(id, "^19944") ) then
+ return true;
+ end
+ end
+ return false;
+end
+FishingBuddy.API.IsFishingPole = IsFishingPole;
+
+-- override the error message method (need an object as the first arg)
+local function UIError_AddMessage( o, msg, a, r, g, b, hold )
+ -- If we should be hiding the can't use item error, then do so
+ if ( TestingLures and msg == ERR_CANT_USE_ITEM ) then
+ -- We have the can't use item error, so abort
+ return;
+ end
+ -- is anyone else looking for messages?
+ RunHandlers(FishingBuddy.UIERROR_EVT, msg, a, r, g, b, hold);
+ --Call the original
+ local obj = SavedAddMessage.obj;
+ local method = SavedAddMessage.method;
+ return method( obj, msg, a, r, g, b, hold );
+end
+FishingBuddy.AddMessage = UIError_AddMessage;
+
+local function NormalHijackCheck()
+ if ( GetSetting("EasyCast") == 1 and
+ CastingKeys() and IsFishingPole() ) then
+ return true;
+ end
+end
+FishingBuddy.NormalHijackCheck = NormalHijackCheck;
+
+local HijackCheck = NormalHijackCheck;
+local function SetHijackCheck(func)
+ if ( not func ) then
+ func = NormalHijackCheck;
+ end
+ HijackCheck = func;
+end
+FishingBuddy.SetHijackCheck = SetHijackCheck;
+
+local SavedWFOnMouseUp;
+local SavedWFOnMouseDown;
+-- handle mouse up and mouse down in the WorldFrame so that we can steal
+-- the hardware events to implement 'Easy Cast'
+-- Thanks to the Cosmos team for figuring this one out -- I didn't realize
+-- that the mouse handler in the WorldFrame got everything first!
+local function WF_OnMouseDown()
+ -- Only steal 'right clicks'
+ if ( arg1 == "RightButton" and HijackCheck() ) then
+ FishingBuddy.ActionStartCheck();
+ end
+ if ( SavedWFOnMouseDown ) then
+ SavedWFOnMouseDown();
+ end
+end
+
+-- disable click to move if we're fishing
+local resetClickToMove = false;
+local function WF_OnMouseUp()
+ local retval;
+ if ( SavedWFOnMouseUp ) then
+ retval = SavedWFOnMouseUp();
+ end
+ -- Only steal 'right clicks'
+ if ( arg1 == "RightButton" ) then
+ -- we fail if there are multiple modifier keys
+ if ( IsAltKeyDown() and ( IsShiftKeyDown() or IsControlKeyDown() ) ) then
+ return retval;
+ end
+ if ( IsShiftKeyDown() and IsControlKeyDown() ) then
+ return retval;
+ end
+ if ( HijackCheck() ) then
+ FishingBuddy.StopCastingCheck();
+ elseif ( resetClickToMove ) then
+ -- Re-enable Click-to-Move if we changed it
+ SetCVar("autointeract", "1");
+ resetClickToMove = nil;
+ end
+ end
+ return retval;
+end
+
+-- Find things in our inventory
+local function FindItemByID(id)
+ if ( id ) then
+ local numSlots = 0;
+ -- check each of the bags on the player
+ for bag=0, NUM_BAG_FRAMES do
+ -- get the number of slots in the bag (0 if no bag)
+ numSlots = GetContainerNumSlots(bag);
+ if (numSlots > 0) then
+ -- check each slot in the bag
+ for slot=1, numSlots do
+ local link = GetContainerItemLink (bag,slot);
+ if (link) then
+ local c, check, n = SplitFishLink(link);
+ if ( check == id ) then
+ return bag, slot;
+ end
+ end
+ end
+ end
+ end
+ end
+ return nil, nil;
+end
+
+local function SafeHookMethod(object, method, newmethod)
+ local oldValue = object[method];
+ if ( oldValue ~= getglobal(newmethod) ) then
+ object[method] = newmethod;
+ return true;
+ end
+ return false;
+end
+
+local function SafeHookScript(frame, handlername, newscript)
+ local oldValue = frame:GetScript(handlername);
+ frame:SetScript(handlername, newscript);
+ return oldValue;
+end
+
+FishingBuddy.GetFishie = function(fishid)
+ if( FishingBuddy_Info["Fishies"][fishid] ) then
+ return string.format("%d:0:0:0", fishid),
+ FishingBuddy_Info["Fishies"][fishid].texture,
+ FishingBuddy_Info["Fishies"][fishid].color,
+ FishingBuddy_Info["Fishies"][fishid].quantity,
+ FishingBuddy_Info["Fishies"][fishid].quality,
+ FishingBuddy_Info["Fishies"][fishid].name;
+ end
+end
+
+local function ImportFish()
+-- local oldShowNewFishies = GetSetting("ShowNewFishies");
+-- SetSetting("ShowNewFishies");
+-- if ( FishInfo2DataSub and FishingBuddy_Info["FishInfo2"] == 0 ) then
+-- for toon in pairs(FishInfo2DataSub) do
+-- if ( not string.find(toon, "|User$") ) then
+-- for fishie in pairs(FishInfo2DataSub[toon]) do
+-- local texture = FishInfo2DataSub[toon][fishie]["texture"];
+-- local quality = FishInfo2DataSub[toon][fishie]["rarity"];
+-- local fz = FishInfo2DataSub[toon][fishie]["zones"];
+-- local link = FishInfo2DataSub[toon][fishie]["link"];
+-- if ( link ) then
+-- local _,_,id = string.find(link, "^(%d+):");
+-- for zone in pairs(fz) do
+-- for subzone in pairs(fz[zone]) do
+-- local quantity = fz[zone][subzone];
+-- AddFishie(nil, id, fishie, zone, subzone, texture, quantity, quality)
+-- end
+-- end
+-- end
+-- end
+-- end
+-- end
+-- FishingBuddy_Info["FishInfo2"] = 1;
+-- FishingBuddy.Print(FBConstants.IMPORTMSG, "FishInfo2");
+-- elseif ( imppfishinfoDB and FishingBuddy_Info["ImppDBLoaded"] == 0 ) then
+-- for subzone in imppfishinfoDB do
+-- for item in imppfishinfoDB[subzone]["itemnames"] do
+-- local quantity = imppfishinfoDB[subzone]["itemnames"][item].number;
+-- local texture = imppfishinfoDB[subzone]["itemnames"][item].texture;
+-- local quality = imppfishinfoDB[subzone]["itemnames"][item].quality;
+-- AddFishie(nil, id, name, subzone, texture, item, quantity, quality)
+-- end
+-- end
+-- FishingBuddy_Info["ImppDBLoaded"] = 1;
+-- FishingBuddy.Print(FBConstants.IMPORTMSG, "Impp's fishinfo");
+-- elseif ( DataFishDB and FishingBuddy_Info["DataFish"] == 0 ) then
+-- for fishie in DataFishDB["catches"] do
+-- for zone in DataFishDB["catches"][fishie]["locnames"] do
+-- for subzone in DataFishDB["catches"][fishie]["locnames"][zone] do
+-- local dfl = DataFishDB["locations"][subzone]["itemnames"][fishie];
+-- local quantity = dfl["number"];
+-- local texture = dfl["texture"];
+-- local quality = dfl["quality"];
+-- AddFishie(nil, id, name, zone, subzone, texture, quantity, quality)
+-- end
+-- end
+-- end
+-- FishingBuddy_Info["DataFish"] = 1;
+-- FishingBuddy.Print(FBConstants.IMPORTMSG, "DataFish");
+-- else
+-- FishingBuddy.Message(FBConstants.NOIMPORTMSG);
+-- end
+-- SetSetting("ShowNewFishies", oldShowNewFishies);
+end
+
+local function InvokeFishing()
+ GetFishingSpellID();
+ if ( FishingSpellID ) then
+ CastSpell(FishingSpellID, BOOKTYPE_SPELL);
+ end
+end
+
+-- do everything we think is necessary when we start fishing
+-- even if we didn't do the switch to a fishing pole
+local function StartFishingMode()
+ if ( not FishingBuddy.StartedFishing ) then
+ FishingBuddy.StartedFishing = GetTime();
+ FishingBuddy.EnhanceFishingSounds(true);
+ FishingBuddy.WatchUpdate();
+ EventRegistration(FishingBuddyRoot, ModeEventTable, true);
+ end
+end
+
+local function StopFishingMode()
+ if ( FishingBuddy.StartedFishing ) then
+ FishingBuddy.EnhanceFishingSounds(false);
+ FishingBuddy.WatchUpdate();
+ FishingBuddy.StartedFishing = nil;
+ EventRegistration(FishingBuddyRoot, ModeEventTable, false);
+ end
+ if ( resetClickToMove ) then
+ -- Re-enable Click-to-Move if we changed it
+ SetCVar("autointeract", "1");
+ resetClickToMove = nil;
+ end
+end
+
+local function FishingMode()
+ if ( IsFishingPole() ) then
+ StartFishingMode();
+ else
+ StopFishingMode();
+ end
+end
+FishingBuddy.API.FishingMode = FishingMode;
+
+-- Easy lures (borrowed from Mugendai's excellent code)
+local function UpdateLure()
+ -- if the pole has an enchantment, we can assume it's got a lure on it (so far, anyway)
+ if ( ( GetSetting("EasyLures") == 1 ) and not GetWeaponEnchantInfo() ) then
+ -- trap message handler if we haven't already
+ if ( not SavedAddMessage ) then
+ FishingBuddy.TrapUIErrors();
+ end
+
+ --Check for a lure in the bags, starting with the highest power one
+ local bag, slot;
+ for lure in pairs(FISHINGLURES) do
+ --If we find this lure in the bag, then use it
+ bag, slot = FindItemByID(lure);
+ if (bag and slot) then
+ --We need to temporarily disable the cant use item error, incase this item is too high of a level to use
+ TestingLures = true;
+ --Temporarily disable error message sounds, incase this item is too high of a level to use
+ local soundState = GetCVar("EnableErrorSpeech");
+ if ( soundState == "1" ) then
+ SetCVar("EnableErrorSpeech", 0);
+ end
+ --Try to use the item
+ UseContainerItem(bag, slot);
+ -- re-enable the can't use item error message
+ TestingLures = false;
+ -- re-enable error message sounds
+ if ( soundState == "1" ) then
+ SetCVar("EnableErrorSpeech", 1);
+ end
+ -- if we have a targeting cursor, then we succesfully used the lure
+ if ( SpellIsTargeting() ) then
+ -- apply the lure to the fishing pole
+ local mainhandslot = GetInventorySlotInfo("MainHandSlot");
+ PickupInventoryItem(mainhandslot);
+ AddingLure = true;
+ return true;
+ end
+ end
+ end
+ end
+ return false;
+end
+
+FishingBuddy.ActionStartCheck = function()
+ -- Disable Click-to-Move if we're fishing
+ if ( GetCVar("autointeract") == "1" ) then
+ resetClickToMove = true;
+ SetCVar("autointeract", "0");
+ end
+ -- Don't interrupt putting on a lure, or if we're not fastcasting
+ if ( AddingLure ) then
+ ActionStartTime = 0;
+ else
+ ActionStartTime = GetTime();
+ end
+end
+
+-- add the double click checking in based on the code is Cosmos
+FishingBuddy.StopCastingCheck = function()
+ if ( not ActionStartTime ) then
+ ActionStartTime = 0;
+ end
+ if ( not ActionDoubleTime ) then
+ ActionDoubleTime = 0;
+ end
+ local time = GetTime();
+ local pressTime = time - ActionStartTime;
+ local doubleTime = time - ActionDoubleTime;
+ -- if we're not putting on a lure
+ if ( not SpellIsTargeting() ) then
+ -- if the click was "short" enough that we're going to treat it
+ -- as a cast
+ if ( ActionStartTime > 0 and ACTIONDOWNWAIT >= pressTime) then
+ -- if we're already casting, enforce double click timing
+ if ( CastingNow and
+ ( ActionDoubleTime == 0 or ACTIONDOUBLEWAIT < doubleTime ) ) then
+ ActionDoubleTime = GetTime();
+ else
+ ActionDoubleTime = 0;
+ -- rebind the mouse event
+ UpdateBindings(true);
+ end
+ end
+ end
+end
+
+FishingBuddy.PerformCast = function()
+ -- We're stealing the mouse-up hardware event, make sure we exit MouseLook
+ if ( IsMouselooking() ) then
+ MouselookStop();
+ end
+ -- reset the TURNORACTION binding so that everything else works 'right'
+ UpdateBindings(false);
+
+ if ( not schooltipText or not OnFishingBobber() ) then
+ -- watch for fishing holes
+ schooltipText = GetTooltipText();
+ end
+
+ -- put on a lure if we need to
+ if ( not UpdateLure() ) then
+ InvokeFishing();
+ end
+end
+
+FishingBuddy.SuitUpAndGoFishing = function()
+ if ( IsFishingPole() ) then
+ -- put on a lure if we need to
+ if ( not UpdateLure() ) then
+ InvokeFishing();
+ end
+ elseif ( GetSetting("SuitUpFirst") == 1 ) then
+ FishingBuddy.OutfitManager.Switch();
+ end
+end
+
+FishingBuddy.IsSwitchClick = function(setting)
+ if ( not setting ) then
+ setting = "ClickToSwitch";
+ end
+ local a = IsShiftKeyDown();
+ local b = (FishingBuddy.GetSetting(setting) == 1);
+ return ( (a and (not b)) or ((not a) and b) );
+end
+
+FishingBuddy.TrapUIErrors = function()
+ local temp = {};
+ temp.obj= UIErrorsFrame;
+ temp.method = UIErrorsFrame["AddMessage"];
+ if ( SafeHookMethod(UIErrorsFrame, "AddMessage", FishingBuddy.AddMessage) ) then
+ SavedAddMessage = temp;
+ end
+end
+
+FishingBuddy.TrapWorldMouse = function()
+ SavedWFOnMouseUp = SafeHookScript(WorldFrame, "OnMouseUp", WF_OnMouseUp);
+ SavedWFOnMouseDown = SafeHookScript(WorldFrame, "OnMouseDown", WF_OnMouseDown);
+end
+
+-- we should collect these, but then they would be in the cache
+local QuestItems = {};
+QuestItems[6717] = 1; -- Gaffer Jack
+QuestItems[6718] = 1; -- Electropeller
+QuestItems[16970] = 1; -- Misty Reed Mahi Mahi
+QuestItems[16968] = 1; -- Sar'theris Striker
+QuestItems[16969] = 1; -- Savage Coast Blue
+QuestItems[16967] = 1; -- Feralas Ahi
+
+-- User interface handling
+local function IsRareFish(id, forced)
+ -- always skip extravaganza fish
+ if ( FishingBuddy.Extravaganza.Fish[id] ) then
+ return true;
+ end
+ return ( not forced and QuestItems[id] );
+end
+
+FishingBuddy.Commands[FBConstants.UPDATEDB] = {};
+FishingBuddy.Commands[FBConstants.UPDATEDB].help = FBConstants.UPDATEDB_HELP;
+FishingBuddy.Commands[FBConstants.UPDATEDB].func =
+ function(what)
+ local ff = FishingBuddy_Info["Fishies"];
+ local forced;
+ if ( what and what == FBConstants.FORCE ) then
+ forced = true;
+ end
+ FishingOutfitTooltip:SetOwner(FishingBuddyFrame, "ANCHOR_RIGHT");
+ FishingOutfitTooltip:Show();
+ local count = 0;
+ for id,info in pairs(ff) do
+ local item = id..":0:0:0";
+ if ( not IsLinkableItem(item) or not info.name ) then
+ if ( not IsRareFish(id, forced) ) then
+ local link = "item:"..item;
+ -- fetch the data (may disconnect)
+ FishingBuddy.Debug(link);
+ FishingOutfitTooltip:SetHyperlink(link);
+ -- now that we have it in our cache, get the name
+ local n,_,_,_,_,_,_,_ = _GetItemInfo(link);
+ if ( n ) then
+ count = count + 1;
+ FishingBuddy_Info["Fishies"][id].name = n;
+ end
+ end
+ end
+ end
+ FishingBuddy.Print(FBConstants.UPDATEDB_MSG, count);
+ return true;
+ end;
+
+FishingBuddy.Commands[FBConstants.CURRENT] = {};
+FishingBuddy.Commands[FBConstants.CURRENT].help = FBConstants.CURRENT_HELP;
+FishingBuddy.Commands[FBConstants.CURRENT].func =
+ function(what)
+ if ( what and what == FBConstants.RESET) then
+ FishingBuddy.currentFishies = {};
+ FishingMode();
+ return true;
+ end
+ end;
+FishingBuddy.Commands[FBConstants.IMPORT] = {};
+FishingBuddy.Commands[FBConstants.IMPORT].help = FBConstants.IMPORT_HELP;
+FishingBuddy.Commands[FBConstants.IMPORT].func =
+ function()
+ ImportFish();
+ return true;
+ end;
+FishingBuddy.Commands[FBConstants.CLEANUP] = {};
+FishingBuddy.Commands[FBConstants.CLEANUP].help = FBConstants.CLEANUP_HELP;
+FishingBuddy.Commands[FBConstants.CLEANUP].func =
+ function(what)
+ local tabs = { "Settings", "Outfit", "WasWearing" };
+ local rnames = {};
+ local onames = {};
+ if ( not what or what == FBConstants.CHECK ) then
+ if ( FishingBuddy_Info["Settings"] ) then
+ for name in pairs(FishingBuddy_Info["Settings"]) do
+ tinsert(onames, name);
+ end
+ end
+ if ( FishingBuddy_Info[realmName] ) then
+ local fs = FishingBuddy_Info[realmName]["Settings"];
+ if ( fs ) then
+ for name,info in pairs(fs) do
+ tinsert(rnames, name);
+ end
+ end
+ end
+ if ( next(rnames) or next(onames) ) then
+ if ( next(rnames) ) then
+ FishingBuddy.Print(FBConstants.CLEANUP_WILLMSG, realmName,
+ FishingBuddy.EnglishList(rnames));
+ end
+ if ( next(onames) ) then
+ FishingBuddy.Print(FBConstants.CLEANUP_WILLMSG,
+ FBConstants.NOREALM,
+ FishingBuddy.EnglishList(onames));
+ end
+ else
+ FishingBuddy.Message(FBConstants.CLEANUP_NONEMSG);
+ end
+ return true;
+ else
+ if ( what == FBConstants.NOW ) then
+ if ( FishingBuddy_Info["Settings"] ) then
+ for name in pairs(FishingBuddy_Info["Settings"]) do
+ tinsert(onames, name);
+ end
+ end
+ if ( FishingBuddy_Info[realmName] ) then
+ local fs = FishingBuddy_Info[realmName]["Settings"];
+ if ( fs ) then
+ for name,info in pairs(fs) do
+ tinsert(rnames, name);
+ end
+ end
+ end
+ else
+ if ( FishingBuddy_Info["Settings"] and FishingBuddy_Info["Settings"][what] ) then
+ tinsert(onames, what);
+ elseif ( FishingBuddy_Info[realmName] and
+ FishingBuddy_Info[realmName]["Settings"] and
+ FishingBuddy_Info[realmName]["Settings"][what] ) then
+ tinsert(rnames, what);
+ else
+ FishingBuddy.Print(FBConstants.CLEANUP_NOOLDMSG, what);
+ return true;
+ end
+ end
+ if ( next(rnames) or next(onames) ) then
+ if ( next(rnames) ) then
+ for _,name in pairs(rnames) do
+ for _,tab in pairs(tabs) do
+ if ( FishingBuddy_Info[realmName] and FishingBuddy_Info[realmName][tab] ) then
+ FishingBuddy_Info[realmName][tab][name] = nil;
+ if ( next(FishingBuddy_Info[realmName][tab]) == nil ) then
+ FishingBuddy_Info[realmName][tab] = nil;
+ end
+ end
+ end
+ end
+ if ( FishingBuddy_Info[realmName] and next(FishingBuddy_Info[realmName]) == nil ) then
+ FishingBuddy_Info[realmName] = nil;
+ end
+ FishingBuddy.Print(FBConstants.CLEANUP_DONEMSG, realmName,
+ FishingBuddy.EnglishList(rnames));
+ end
+ if ( next(onames) ) then
+ for _,name in pairs(onames) do
+ for _,tab in pairs(tabs) do
+ if ( FishingBuddy_Info[tab] ) then
+ FishingBuddy_Info[tab][name] = nil;
+ if ( next(FishingBuddy_Info[tab]) ) then
+ FishingBuddy_Info[tab] = nil;
+ end
+ end
+ end
+ end
+ FishingBuddy.Print(FBConstants.CLEANUP_DONEMSG,
+ FBConstants.NOREALM,
+ FishingBuddy.EnglishList(onames));
+ end
+ else
+ FishingBuddy.Message(FBConstants.CLEANUP_NONEMSG);
+ end
+ return true;
+ end
+ end;
+
+local function nextarg(msg, pattern)
+ if ( not msg or not pattern ) then
+ return nil, nil;
+ end
+ local s,e = string.find(msg, pattern);
+ if ( s ) then
+ local word = strsub(msg, s, e);
+ msg = strsub(msg, e+1);
+ return word, msg;
+ end
+ return nil, msg;
+end
+
+FishingBuddy.Command = function(msg)
+ if ( not msg ) then
+ return;
+ end
+ if ( FishingBuddy.IsLoaded() ) then
+ -- collect arguments (whee, lua string manipulation)
+ local cmd;
+ cmd, msg = nextarg(msg, "[%w]+");
+
+ -- the empty string gives us no args at all
+ if ( not cmd ) then
+ -- toggle window
+ if ( FishingBuddyFrame:IsVisible() ) then
+ HideUIPanel(FishingBuddyFrame);
+ else
+ ShowUIPanel(FishingBuddyFrame);
+ end
+ elseif ( cmd == FBConstants.HELP or cmd == "help" ) then
+ FishingBuddy.Output(FBConstants.WINDOW_TITLE);
+ FishingBuddy.PrintHelp(FBConstants.HELPMSG);
+ else
+ local command = FishingBuddy.Commands[cmd];
+ if ( command ) then
+ local args = {};
+ local goodargs = true;
+ if ( command.args ) then
+ for _,pat in pairs(command.args) do
+ local w, msg = nextarg(msg, pat);
+ if ( not w ) then
+ goodargs = false;
+ break;
+ end
+ tinsert(args, w);
+ end
+ else
+ local a;
+ while ( msg ) do
+ a, msg = nextarg(msg, "[%w]+");
+ if ( not a ) then
+ break;
+ end
+ tinsert(args, a);
+ end
+ end
+ if ( not goodargs or not command.func(unpack(args)) ) then
+ if ( command.help ) then
+ FishingBuddy.PrintHelp(command.help);
+ else
+ FishingBuddy.Debug("command failed");
+ end
+ end
+ else
+ FishingBuddy.Command("help");
+ end
+ end
+ else
+ FishingBuddy.Error(FBConstants.FAILEDINIT);
+ end
+end
+
+FishingBuddy.Color = function (color, text)
+ local c = FBConstants.Colors[color];
+ if ( c ) then
+ return "|c"..c..text.."|r";
+ else
+ return text;
+ end
+end
+
+FishingBuddy.TooltipBody = function(hintcheck)
+ local text = FBConstants.DESCRIPTION1.."\n"..FBConstants.DESCRIPTION2;
+ if ( hintcheck ) then
+ local hint = FBConstants.TOOLTIP_HINT.." ";
+ if (FishingBuddy.GetSetting(hintcheck) == 1) then
+ hint = hint..FBConstants.TOOLTIP_HINTSWITCH;
+ else
+ hint = hint..FBConstants.TOOLTIP_HINTTOGGLE;
+ end
+ text = text.."\n"..FishingBuddy.Color("GREEN", hint);
+ end
+ return text;
+end
+
+local IWEventTable = {
+ "ITEM_LOCK_CHANGED",
+};
+
+FishingBuddy.OnLoad = function()
+ this:RegisterEvent("PLAYER_ENTERING_WORLD");
+ this:RegisterEvent("PLAYER_LEAVING_WORLD");
+
+ this:RegisterEvent("PLAYER_LOGIN");
+ this:RegisterEvent("PLAYER_LOGOUT");
+ this:RegisterEvent("VARIABLES_LOADED");
+
+ RegisterHandlers(CaptureEvents);
+ RegisterHandlers(StatusEvents);
+
+ -- Set up command
+ SlashCmdList["fishingbuddy"] = FishingBuddy.Command;
+ SLASH_fishingbuddy1 = "/fishingbuddy";
+ SLASH_fishingbuddy2 = "/fb";
+
+ FishingBuddy.Output(FBConstants.WINDOW_TITLE.." loaded");
+end
+
+local IsZoning;
+local ZoneEvents;
+local function TrackZoneEvents(evt)
+ if ( IsZoning ) then
+ if ( not ZoneEvents ) then
+ ZoneEvents = {};
+ end
+ if ( ZoneEvents[evt] ) then
+ ZoneEvents[evt] = ZoneEvents[evt] + 1;
+ else
+ ZoneEvents[evt] = 1;
+ end
+ end
+end
+
+local function DumpZoneEvents()
+ FishingBuddy.Dump(ZoneEvents);
+ ZoneEvents = nil;
+end
+
+FishingBuddy.OnEvent = function()
+ RunHandlers(event);
+ RunHandlers("*");
+
+-- TrackZoneEvents(event);
+ if ( event == "PLAYER_LOGIN" ) then
+ -- set up outfit stuff
+ playerName = UnitName("player");
+ realmName = GetRealmName();
+ CheckClockOffset();
+ FishingBuddy.OutfitManager.Initialize();
+ FishingMode();
+ elseif ( event == "PLAYER_LOGOUT" ) then
+ -- reset the fishing sounds, if we need to
+ StopFishingMode();
+ FishingBuddy.SavePlayerInfo();
+ elseif ( event == "VARIABLES_LOADED" ) then
+ FishingBuddy.Initialize();
+ this:UnregisterEvent("VARIABLES_LOADED");
+ elseif ( event == "PLAYER_ENTERING_WORLD" ) then
+ IsZoning = nil;
+-- DumpZoneEvents();
+ EventRegistration(this, IWEventTable, true);
+ elseif ( event == "PLAYER_LEAVING_WORLD") then
+ IsZoning = 1;
+ EventRegistration(this, IWEventTable, false);
+ end
+ FishingBuddy.Extravaganza.IsTime(true);
+end
+
+FishingBuddy.PrintHelp = function(tab)
+ if ( tab ) then
+ if ( type(tab) == "table" ) then
+ for _,line in pairs(tab) do
+ FishingBuddy.PrintHelp(line);
+ end
+ else
+ -- check for a reference to another help item
+ local _,_,w = string.find(tab, "^@([A-Z0-9_]+)$");
+ if ( w ) then
+ FishingBuddy.PrintHelp(FBConstants[w]);
+ else
+ FishingBuddy.Output(tab);
+ end
+ end
+ end
+end
+
+FishingBuddy["EFSV"] = {};
+FishingBuddy["EFSV"]["MusicVolume"] = tonumber(GetCVar("MusicVolume"));
+FishingBuddy["EFSV"]["AmbienceVolume"] = tonumber(GetCVar("AmbienceVolume"));
+FishingBuddy["EFSV"]["SoundVolume"] =tonumber(GetCVar("SoundVolume"));
+local SoundWasEnhanced;
+FishingBuddy.EnhanceFishingSounds = function(turniton)
+ if ( GetSetting("EnhanceFishingSounds") == 1 ) then
+ if ( turniton ) then
+ -- collect the current value
+ FishingBuddy["EFSV"]["MusicVolume"] = tonumber(GetCVar("MusicVolume"));
+ FishingBuddy["EFSV"]["AmbienceVolume"] = tonumber(GetCVar("AmbienceVolume"));
+ FishingBuddy["EFSV"]["SoundVolume"] =tonumber(GetCVar("SoundVolume"));
+ -- turn 'em off!
+ for setting in pairs(FishingBuddy["EFSV"]) do
+ local value = GetSetting("EnhanceSound"..setting);
+ FishingBuddy.Debug("Enhance "..setting.." "..value);
+ SetCVar(setting, value);
+ end
+ SoundWasEnhanced = true;
+ else
+ if ( SoundWasEnhanced ) then
+ for setting, value in pairs(FishingBuddy["EFSV"]) do
+ SetCVar(setting, value);
+ end
+ SoundWasEnhanced = false;
+ end
+ end
+ end
+end
+
+-- Drop-down menu support
+local function ToggleSetting(setting)
+ local value = GetSetting(setting);
+ if ( not value ) then
+ value = 0;
+ end
+ SetSetting(setting, 1 - value);
+ FishingBuddy.WatchUpdate();
+ FishingBuddy.UpdateMinimap();
+end
+FishingBuddy.ToggleSetting = ToggleSetting;
+
+-- save some memory by keeping one copy of each one
+local ToggleFunctions = {};
+-- let's use closures
+local function MakeToggle(name)
+ if ( not ToggleFunctions[name] ) then
+ local n = name;
+ ToggleFunctions[name] = function() ToggleSetting(n) end;
+ end
+ return ToggleFunctions[name];
+end
+FishingBuddy.MakeToggle = MakeToggle;
+
+FishingBuddy.MakeDropDown = function(switchItem, switchSetting)
+ local info;
+ -- If no outfit frame, we can't switch outfits...
+ if ( FishingBuddy.OutfitManager.HasManager() ) then
+ info = {};
+ info.text = switchItem;
+ info.func = MakeToggle(switchSetting);
+ info.checked = (GetSetting(switchSetting) == 1);
+ info.keepShownOnClick = 1;
+ UIDropDownMenu_AddButton(info);
+ info = {};
+ info.disabled = 1;
+ UIDropDownMenu_AddButton(info);
+ end
+
+ for name,option in pairs(FishingBuddy.OPTIONS) do
+ if ( option.m ) then
+ local addthis = true;
+ if ( option.check ) then
+ addthis = option.check();
+ end
+ if ( addthis ) then
+ info = {};
+ info.text = option.text;
+ info.func = MakeToggle(name);
+ info.checked = (GetSetting(name) == 1);
+ info.keepShownOnClick = 1;
+ UIDropDownMenu_AddButton(info);
+ end
+ end
+ end
+end
+
+-- utility functions
+FishingBuddy.AddTooltip = function(text, r, g, b)
+ if ( text ) then
+ if ( type(text) == "table" ) then
+ for _,l in pairs(text) do
+ FishingBuddy.AddTooltip(l.text, l.r, l.g, l.b);
+ end
+ else
+ GameTooltip:AddLine(text, r, g, b);
+ end
+ end
+end
+
+FishingBuddy.ChatLink = function(item, name, color)
+ if( item and name and ChatFrameEditBox:IsVisible() ) then
+ if not color then
+ color = FBConstants.Colors.WHITE;
+ end
+ local link = "|c"..color.."|Hitem:"..item.."|h["..name.."]|h|r";
+ ChatFrameEditBox:Insert(link);
+ end
+end
+
+FishingBuddy.FishSort = function(tab, forcename)
+ if ( forcename or GetSetting("SortByPercent") == 0 ) then
+ table.sort(tab, function(a,b) return (a.index and b.index and a.index 1 ) then
+ fishie = string.sub(fishie, 1, s-1)..string.sub(fishie, e+1);
+ else
+ fishie = string.sub(fishie, e+1);
+ end
+ else
+ s,e = string.find(fishie, " "..FBConstants.RAW);
+ if ( s ) then
+ fishie = string.sub(fishie, 1, s-1)..string.sub(fishie, e+1);
+ end
+ end
+ return fishie;
+ end
+ -- this means an import failed somewhere
+ return FBConstants.UNKNOWN;
+end
+
+FishingBuddy.ToggleDropDownMenu = function(level, value, menu, anchor, xOffset, yOffset)
+ ToggleDropDownMenu(level, value, menu, anchor, xOffset, yOffset);
+ if (not level) then
+ level = 1;
+ end
+ local anchorName;
+ if ( type(anchor) == "string" ) then
+ anchorName = anchor;
+ else
+ anchorName = anchor:GetName();
+ end
+ local frame = getglobal("DropDownList"..level);
+ local uiScale = UIParent:GetScale()
+ if ( frame:GetRight() > ( GetScreenWidth()*uiScale ) ) then
+ if ( anchorName == "cursor" ) then
+ if ( not xOffset ) then
+ xOffset = 0;
+ end
+ if ( not yOffset ) then
+ yOffset = 0;
+ end
+ local cursorX, cursorY = GetCursorPosition();
+ xOffset = -cursorX + xOffset;
+ yOffset = cursorY + yOffset;
+ else
+ if ( not xOffset or not yOffset ) then
+ xOffset = 8;
+ yOffset = 22;
+ end
+ end
+ frame:ClearAllPoints();
+ frame:SetPoint("TOPRIGHT", anchorName, "BOTTOMLEFT", -xOffset, yOffset);
+ end
+ if ( frame:GetBottom() < 0 ) then
+ frame:ClearAllPoints();
+ frame:SetPoint("BOTTOMRIGHT", anchorName, "BOTTOMLEFT", -xOffset, yOffset);
+ end
+end
+
+FishingBuddy.EnglishList = function(list, conjunction)
+ if ( list ) then
+ local n = table.getn(list);
+ local str = "";
+ for idx=1,n do
+ local name = list[idx];
+ if ( idx == 1 ) then
+ str = name;
+ elseif ( idx == n ) then
+ str = str .. ", ";
+ if ( conjunction ) then
+ str = str .. conjunction;
+ else
+ str = str .. "and";
+ end
+ str = str .. " " .. name;
+ else
+ str = str .. ", " .. name;
+ end
+ end
+ return str;
+ end
+end
+
+FishingBuddy.Message = function(msg, r, g, b)
+ FishingBuddy.Output(FBConstants.NAME..": "..msg, r, g, b);
+end
+
+FishingBuddy.Print = function(...)
+ local msg = string.format(unpack(arg));
+ FishingBuddy.Message(msg);
+end
+
+FishingBuddy.Error = function(msg)
+ FishingBuddy.Output(FBConstants.NAME..": "..msg, 1.0, 0, 0);
+end
+
+FishingBuddy.UIError = function(msg)
+ -- Okay, this check is probably not necessary...
+ if ( UIErrorsFrame ) then
+ UIErrorsFrame:AddMessage(msg, 1.0, 0.1, 0.1, 1.0, UIERRORS_HOLD_TIME);
+ else
+ FishingBuddy.Error(msg);
+ end
+end
+
+FishingBuddy.Testing = function(line)
+ if ( not FishingBuddy_Info["Testing"] ) then
+ FishingBuddy_Info["Testing"] = {};
+ end
+ tinsert(FishingBuddy_Info["Testing"], line);
+end
diff --git a/FishingBuddy/FishingBuddy.toc b/FishingBuddy/FishingBuddy.toc
new file mode 100644
index 0000000..068129c
--- /dev/null
+++ b/FishingBuddy/FishingBuddy.toc
@@ -0,0 +1,27 @@
+## Interface: 11200
+## Title: Fishing Buddy
+## Version: 0.8.9 Beta 11
+## Notes: Help with fishing related tasks -- clothing, fish information, etc.
+## Notes-deDE: Erleichtert das Angeln - Ausr\195\188stung und Fish-Infos
+## Notes-frFR: Vous facilite la vie de pecheur. Informations sur les poissons, changement d'habits, etc.
+## Notes-esES: Ayude con las tareas relacionadas pesca -- ropa, informaci\195\179n de los pescados
+## Author: Sutorix=AT=hotmail.com
+## OptionalDeps: FBEnEspagnol, OutfitDisplayFrame, Outfitter, myAddOns, Titan, InfoBar, Gatherer, ButtonHole
+## SavedVariables: FishingBuddy_Info
+## SavedVariablesPerCharacter: FishingBuddy_Player
+localization.lua
+localization.de.lua
+localization.es.lua
+localization.fr.lua
+FishingDebugging.lua
+FishingSetup.lua
+FishingBuddy.xml
+FishingBuddyFrame.xml
+FishingOptionsFrame.xml
+FishingLocationsFrame.xml
+FishingOutfitManager.xml
+FishingOutfitter.lua
+FishingBuddyMinimap.xml
+FishingExtravaganza.xml
+FishingWatcher.xml
+FishingSchools.lua
diff --git a/FishingBuddy/FishingBuddy.xml b/FishingBuddy/FishingBuddy.xml
new file mode 100644
index 0000000..4c98562
--- /dev/null
+++ b/FishingBuddy/FishingBuddy.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+ FishingBuddy.OnLoad();
+
+
+ FishingBuddy.OnEvent();
+
+
+
+
+
+
+
+ -- FishingBuddy_RecastOnUpdate(arg1);
+
+
+
+
diff --git a/FishingBuddy/FishingBuddyFrame.lua b/FishingBuddy/FishingBuddyFrame.lua
new file mode 100644
index 0000000..f66e8e3
--- /dev/null
+++ b/FishingBuddy/FishingBuddyFrame.lua
@@ -0,0 +1,205 @@
+local FBFRAMES = {
+ [1] = {
+ ["frame"] = "FishingLocationsFrame",
+ ["name"] = FBConstants.LOCATIONS_TAB,
+ ["tooltip"] = FBConstants.LOCATIONS_INFO,
+ ["toggle"] = "_LOC",
+ },
+ [2] = {
+ ["frame"] = "FishingOptionsFrame",
+ ["name"] = FBConstants.OPTIONS_TAB,
+ ["tooltip"] = FBConstants.OPTIONS_INFO,
+ ["toggle"] = "_OPT",
+ }
+};
+
+local function GetFrameInfo(f)
+ local n;
+ if ( type(f) == "string" ) then
+ n = f;
+ f = getglobal(f);
+ else
+ n = f:GetName();
+ end
+ return f, n;
+end
+
+local TabFrames = {};
+local next_frameid = 1;
+local function CreateTabFrame(target, tabname)
+ local id = next_frameid;
+ local framename = string.format("FishingBuddyFrameTab%d", id);
+ local frame = CreateFrame("Button", framename,
+ UIParent, "FishingBuddyTabButtonTemplate");
+ TabFrames[id] = frame;
+
+ frame:SetID(id);
+ frame:SetText(tabname);
+ frame:SetParent(FishingBuddyFrame);
+ frame:SetFrameLevel(target:GetFrameLevel()+1);
+ frame.enabled = true;
+
+ next_frameid = next_frameid + 1;
+
+ return frame;
+end
+
+local function ResetTabFrames()
+ local lastFrame = nil;
+
+ -- Tab Handling code
+ PanelTemplates_SetNumTabs(FishingBuddyFrame, next_frameid-1);
+
+ if ( not currentTab ) then
+ currentTab = TabFrames[1].frame;
+ end
+ for id=1,next_frameid-1 do
+ local tab = TabFrames[id];
+ if ( tab.enabled ) then
+ tab:Show();
+ if ( lastFrame ) then
+ tab:SetPoint("LEFT", lastFrame, "RIGHT", -18, 0);
+ else
+ tab:SetPoint("CENTER", FishingBuddyFrame, "BOTTOMLEFT", 55, 60);
+ end
+ lastFrame = tab;
+ else
+ if ( tab == currentTab ) then
+ currentTab = lastFrame;
+ end
+ tab:Hide();
+ end
+ if ( tab.managedFrame ) then
+ tab.managedFrame:Hide();
+ end
+ end
+ -- FishingOptionsFrame:SetPoint("LEFT", lastFrame, "RIGHT", -18, 0);
+ PanelTemplates_SetTab(FishingBuddyFrame, currentTab:GetID());
+ currentTab:Show();
+ if ( currentTab.managedFrame ) then
+ currentTab.managedFrame:Show();
+ end
+end
+
+local ManagedFrames = {};
+local function DisableSubFrame(target)
+ local frame, frameName = GetFrameInfo(target);
+ local tab = ManagedFrames[frameName];
+ if ( tab ) then
+ tab.enabled = false;
+ ResetTabFrames();
+ end
+end
+FishingBuddy.DisableSubFrame = DisableSubFrame;
+
+local function EnableSubFrame(target)
+ local frame, frameName = GetFrameInfo(target);
+ local info = ManagedFrames[frameName];
+ if ( tab ) then
+ tab.enabled = true;
+ ResetTabFrames();
+ end
+end
+FishingBuddy.EnableSubFrame = EnableSubFrame;
+
+local function ShowSubFrame(target)
+ local frame, frameName = GetFrameInfo(target);
+ local ctab;
+ for id=1,next_frameid-1 do
+ local tab = TabFrames[id];
+ if ( tab.enabled and tab.managedFrame ) then
+ if ( tab.managedFrame == frame ) then
+ ctab = tab;
+ end
+ end
+ end
+ if ( not ctab ) then
+ ctab = TabFrames[1];
+ end
+ currentTab = ctab;
+ ResetTabFrames();
+end
+
+local function MakeFrameTab(target, tabname, tooltip, toggle)
+ local frame,_ = GetFrameInfo(target);
+ local tab = CreateTabFrame(frame, tabname);
+ if ( tooltip ) then
+ tab.tooltip = tooltip;
+ end
+ if ( toggle ) then
+ tab.toggle = "TOGGLEFISHINGBUDDY"..toggle;
+ end
+ tab.managedFrame = frame;
+ return tab;
+end
+
+local function FindTab(frame)
+ for id=1,next_frameid-1 do
+ tab = TabFrames[id];
+ if ( tab.managedFrame == frame ) then
+ return tab;
+ end
+ end
+-- return nil;
+end
+
+local function ManageFrame(target, tabname, tooltip, toggle)
+ local frame, frameName = GetFrameInfo(target);
+ if ( not ManagedFrames[frameName] ) then
+ ManagedFrames[frameName] = MakeFrameTab(frame, tabname, tooltip, toggle);
+ EnableSubFrame(frameName);
+ end
+end
+FishingBuddy.ManageFrame = ManageFrame;
+
+function ToggleFishingBuddyFrame(target)
+ local frame, frameName = GetFrameInfo(target);
+ local tab = FindTab(frame);
+ if ( tab ) then
+ currentTab = tab;
+ if ( FishingBuddyFrame:IsVisible() ) then
+ if ( frame:IsVisible() ) then
+ HideUIPanel(FishingBuddyFrame);
+ end
+ else
+ ShowUIPanel(FishingBuddyFrame);
+ end
+ ResetTabFrames();
+ end
+end
+
+function FishingBuddyFrameTab_OnClick()
+ currentTab = this;
+ ResetTabFrames();
+ PlaySound("igCharacterInfoTab");
+end
+
+function FishingBuddyFrame_OnLoad()
+ -- Act like Blizzard windows
+ UIPanelWindows["FishingBuddyFrame"] = { area = "left", pushable = 999 };
+ -- Close with escape key
+ tinsert(UISpecialFrames, "FishingBuddyFrame");
+
+ this:RegisterEvent("VARIABLES_LOADED");
+end
+
+function FishingBuddyFrame_OnEvent(event)
+ if ( event == "VARIABLES_LOADED" ) then
+ -- set up mappings
+ for idx,info in pairs(FBFRAMES) do
+ MakeFrameTab(info.frame, info.name, info.tooltip, info.toggle);
+ end
+ ShowSubFrame("FishingLocationsFrame");
+ end
+end
+
+function FishingBuddyFrame_OnShow()
+ FishingBuddyFramePortrait:SetTexture("Interface\\LootFrame\\FishingLoot-Icon");
+ FishingBuddyNameText:SetText(FBConstants.WINDOW_TITLE);
+ UpdateMicroButtons();
+ ResetTabFrames();
+end
+
+function FishingBuddyFrame_OnHide()
+ UpdateMicroButtons();
+end
diff --git a/FishingBuddy/FishingBuddyFrame.xml b/FishingBuddy/FishingBuddyFrame.xml
new file mode 100644
index 0000000..af072ef
--- /dev/null
+++ b/FishingBuddy/FishingBuddyFrame.xml
@@ -0,0 +1,280 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ this:SetFrameLevel(this:GetFrameLevel() + 1);
+
+
+
+
+
+
+
+ FishingBuddyFrame_OnLoad();
+
+
+ FishingBuddyFrame_OnEvent(event);
+
+
+ FishingBuddyFrame_OnShow();
+
+
+ FishingBuddyFrame_OnHide();
+
+
+
+
diff --git a/FishingBuddy/FishingBuddyMinimap.lua b/FishingBuddy/FishingBuddyMinimap.lua
new file mode 100644
index 0000000..82fbe90
--- /dev/null
+++ b/FishingBuddy/FishingBuddyMinimap.lua
@@ -0,0 +1,141 @@
+-- Minimap Button Handling
+
+FishingBuddy.UseButtonHole = function()
+ if ( ButtonHole and FishingBuddy.GetSetting("UseButtonHole") == 1 ) then
+ return true;
+ else
+ return false;
+ end
+end
+
+FishingBuddy.Minimap = {};
+
+FishingBuddy.Minimap.OnLoad = function()
+ this:RegisterEvent("VARIABLES_LOADED");
+end
+
+FishingBuddy.Minimap.OnEvent = function()
+ if ( FishingBuddy.UseButtonHole() ) then
+ local info = {};
+ info.id=FBConstants.ID;
+ info.name=FBConstants.NAME;
+ info.tooltip=FBConstants.DESCRIPTION;
+ info.buttonFrame="FishingBuddyMinimapFrame";
+ info.updateFunction="FishingBuddyMinimapButton_MoveButton";
+ ButtonHole.application.RegisterMod(info);
+ elseif ( ButtonHole ) then
+ -- hack, hack, hack
+ local playerName = UnitName("player");
+ if ( ButtonHoleConfig[playerName] and
+ ButtonHoleConfig[playerName].visibleMod == FBConstants.ID ) then
+ ButtonHoleConfig[playerName].visibleMod = nil;
+ end
+ end
+end
+
+FishingBuddy.Minimap.Button_OnLoad = function()
+ this:SetFrameLevel(this:GetFrameLevel()+1)
+ this:RegisterForDrag("LeftButton");
+ this:RegisterForClicks("LeftButtonUp", "RightButtonUp");
+ this:RegisterEvent("VARIABLES_LOADED");
+end
+
+FishingBuddy.Minimap.Button_OnClick = function(button)
+ if ( button == "RightButton" ) then
+ if ( IsAltKeyDown() ) then
+ ToggleFishingBuddyFrame("FishingOptionsFrame");
+ else
+ -- Toggle menu
+ local menu = getglobal("FishingBuddyMinimapMenu");
+ menu.point = "TOPRIGHT";
+ menu.relativePoint = "CENTER";
+ ToggleDropDownMenu(1, nil, menu, "FishingBuddyMinimapButton", 0, 0);
+ end
+ elseif ( FishingBuddy.IsSwitchClick("MinimapClickToSwitch") ) then
+ FishingBuddy.Command(FBConstants.SWITCH);
+ else
+ FishingBuddy.Command("");
+ end
+end
+
+local function BeingDragged()
+ -- Thanks to Gello for this code
+ local xpos,ypos = GetCursorPosition();
+ local xmin,ymin = Minimap:GetLeft(), Minimap:GetBottom();
+
+ xpos = xmin-xpos/UIParent:GetScale()+80;
+ ypos = ypos/UIParent:GetScale()-ymin-80;
+
+ local ang = math.deg(math.atan2(ypos,xpos));
+ if ( ang < 0 ) then
+ ang = ang + 360;
+ end
+ FishingBuddy.SetSetting("MinimapButtonPosition", ang);
+ FishingBuddyMinimapButton_MoveButton();
+end
+
+FishingBuddy.Minimap.Button_OnDragStart = function(button)
+ this:SetScript("OnUpdate", BeingDragged);
+end
+
+FishingBuddy.Minimap.Button_OnDragStop = function(button)
+ this:SetScript("OnUpdate", nil);
+end
+
+FishingBuddyMinimapButton_MoveButton = function()
+ if ( FishingBuddy.IsLoaded() ) then
+ local where = FishingBuddy.GetSetting("MinimapButtonPosition");
+ FishingBuddyMinimapFrame:ClearAllPoints();
+ FishingBuddyMinimapFrame:SetPoint("TOPLEFT", "Minimap", "TOPLEFT",
+ 52 - (80 * cos(where)),
+ (80 * sin(where)) - 52);
+ end
+end
+
+FishingBuddy.UpdateMinimap = function()
+ FishingBuddyMinimapButton_MoveButton();
+ if ( FishingBuddy.GetSetting("MinimapButtonVisible") == 1 and
+ Minimap:IsVisible() ) then
+ FishingBuddyMinimapButton:EnableMouse(true);
+ FishingBuddyMinimapButton:Show();
+ FishingBuddyMinimapFrame:Show();
+ else
+ FishingBuddyMinimapButton:EnableMouse(false);
+ FishingBuddyMinimapButton:Hide();
+ FishingBuddyMinimapFrame:Hide();
+ end
+end
+
+FishingBuddy.Minimap.Button_OnEvent = function()
+ FishingBuddy.UpdateMinimap();
+end
+
+FishingBuddy.Minimap.Button_OnEnter = function()
+ if ( GameTooltip.fbmmbfinished ) then
+ return;
+ end
+ if ( FishingBuddy.GetSetting("UseButtonHole") == 0 ) then
+ GameTooltip.fbmmbfinished = 1;
+ GameTooltip:SetOwner(FishingBuddyMinimapFrame, "ANCHOR_LEFT");
+ GameTooltip:AddLine(FBConstants.NAME);
+ local text = FishingBuddy.TooltipBody("MinimapClickToSwitch");
+ GameTooltip:AddLine(text,.8,.8,.8,1);
+ GameTooltip:Show();
+ end
+end
+
+FishingBuddy.Minimap.Button_OnLeave = function()
+ GameTooltip:Hide();
+ GameTooltip.fbmmbfinished = nil;
+end
+
+function FishingBuddy_ToggleMinimap()
+ FishingBuddy.SavedToggleMinimap();
+ FishingBuddy.UpdateMinimap();
+end
+
+FishingBuddy.Minimap.Menu_Initialize = function()
+ FishingBuddy.MakeDropDown(FBConstants.CLICKTOSWITCH_ONOFF,
+ "MinimapClickToSwitch");
+end
+
diff --git a/FishingBuddy/FishingBuddyMinimap.xml b/FishingBuddy/FishingBuddyMinimap.xml
new file mode 100644
index 0000000..78b39c2
--- /dev/null
+++ b/FishingBuddy/FishingBuddyMinimap.xml
@@ -0,0 +1,92 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ this:SetFrameLevel(0);
+ UIDropDownMenu_SetWidth(180);
+
+
+ UIDropDownMenu_Initialize(this, FishingBuddy.Minimap.Menu_Initialize, "MENU");
+
+
+
+
+
+
+
+ FishingBuddy.Minimap.OnLoad();
+
+
+ FishingBuddy.Minimap.OnEvent();
+
+
+
+
+
diff --git a/FishingBuddy/FishingDebugging.lua b/FishingBuddy/FishingDebugging.lua
new file mode 100644
index 0000000..17f343a
--- /dev/null
+++ b/FishingBuddy/FishingDebugging.lua
@@ -0,0 +1,95 @@
+-- debugging
+
+FishingBuddy = {};
+FishingBuddy.API = {};
+FishingBuddy.Commands = {};
+
+FishingBuddy.Debugging = true;
+
+local function printable(foo)
+ if ( foo ) then
+ if ( type(foo) == "table" ) then
+ return "table";
+ elseif ( type(foo) == "boolean" ) then
+ if ( foo ) then
+ return "true";
+ else
+ return "false";
+ end
+ else
+ return foo;
+ end
+ else
+ return "nil";
+ end
+end
+FishingBuddy.printable = printable;
+
+FishingBuddy.Output = function(msg, r, g, b)
+ if ( DEFAULT_CHAT_FRAME ) then
+ if ( not r ) then
+ DEFAULT_CHAT_FRAME:AddMessage(msg);
+ else
+ DEFAULT_CHAT_FRAME:AddMessage(msg, r, g, b);
+ end
+ end
+end
+
+FishingBuddy.Debug = function(msg, fixlinks)
+ if ( FishingBuddy.Debugging ) then
+ if ( fixlinks ) then
+ msg = string.gsub(msg, "|", ";");
+ end
+ local name = FBConstants.Name or "Fishing Buddy";
+ FishingBuddy.Output("|c"..FBConstants.Colors.RED..name.."|r "..msg);
+ end
+end
+
+FishingBuddy.DebugVars = function()
+ FishingBuddy.Debugging = true;
+end
+
+FishingBuddy.Dump = function(thing)
+ if ( FishingBuddy.Debugging ) then
+ if ( DevTools_Dump ) then
+ DevTools_Dump(thing);
+ else
+ FishingBuddy.Debug("Tried to dump a '"..FishingBuddy.printable(thing).."'.");
+ end
+ end
+end
+
+-- random debugging code, likely out of date
+FishingBuddy.Commands["debug"] = {};
+FishingBuddy.Commands["debug"].func =
+ function(what)
+ if ( what ) then
+ if ( what == "on" ) then
+ FishingBuddy.Debugging = true;
+ FishingBuddy.SetSetting("FishDebug", true);
+ FishingBuddy.Debug("Debugging turned on");
+ elseif ( what == "off" ) then
+ FishingBuddy.Debug("Debugging turned off");
+ FishingBuddy.Debugging = nil;
+ FishingBuddy.SetSetting("FishDebug", nil);
+ elseif ( what == "reset" ) then
+ FishingBuddy_Info["Testing"] = nil;
+ elseif ( what == "test" ) then
+ local STVInfo = { scale = 0.18128603034401, xoffset = 0.39145470225916, yoffset = 0.79412224886668 };
+ local xscale = 10448.3;
+ local yscale = 7072.7;
+ local playerX, playerY = GetPlayerMapPosition("player");
+ local x = playerX * STVInfo.scale + STVInfo.xoffset;
+ local y = playerY * STVInfo.scale + STVInfo.yoffset;
+ FishingBuddy.Print("PlayerMap: %f, %f", x, y);
+ for idx=1,10 do
+ playerY = playerY + 0.01;
+ local dx = playerX * STVInfo.scale + STVInfo.xoffset;
+ local dy = playerY * STVInfo.scale + STVInfo.yoffset;
+ local dist = math.sqrt((dx*xscale*dx*xscale)+(dy*yscale*dy*yscale));
+ FishingBuddy.Print("PlayerMap: %f, %f - %f", dx, dy, dist);
+ end
+ end
+ end
+ return true;
+ end;
diff --git a/FishingBuddy/FishingExtravaganza.lua b/FishingBuddy/FishingExtravaganza.lua
new file mode 100644
index 0000000..fd835db
--- /dev/null
+++ b/FishingBuddy/FishingExtravaganza.lua
@@ -0,0 +1,530 @@
+-- Support for the Extravaganza
+--
+-- Map support liberally borrowed from GuildMap, by Bru on Blackhand
+
+FishingBuddy.Extravaganza = {};
+
+local NUMMINIPOIS = 10;
+local ICONPATH = "Interface\\AddOns\\FishingBuddy\\Icons\\";
+
+-- the actual names don't matter, except to help make sure I've got 'em all
+local ExtravaganzaFish = {};
+ExtravaganzaFish[19807] = "Speckled Tastyfish";
+ExtravaganzaFish[19806] = "Dezian Queenfish";
+ExtravaganzaFish[19805] = "Keefer's Angelfish";
+-- makes you wonder what item 19804 is, doesn't it...
+ExtravaganzaFish[19803] = "Brownell's Blue Striped Racer";
+
+FishingBuddy.Extravaganza.Fish = ExtravaganzaFish;
+
+local UPDATETIME_POI = 0.2;
+local UPDATETIME_SCHOOLS = 0.1;
+local UPDATETIME_COUNTER = 20.0;
+local STVUpdateTimer = 0;
+local numCaught = 0;
+local tastyfish_id = 19807;
+local tastyfish;
+local ExtravaganzaIsOver;
+local CountTastyFishNow;
+
+-- convert zone coords into minimap coords
+local STVInfo = { scale = 0.18128603034401,
+ xoffset = 0.39145470225916, yoffset = 0.79412224886668 };
+
+local ZoomScale = {};
+ZoomScale[0] = { xscale = 10448.3, yscale = 7072.7 };
+ZoomScale[1] = { xscale = 12160.5, yscale = 8197.8 };
+ZoomScale[2] = { xscale = 14703.1, yscale = 9825.0 };
+ZoomScale[3] = { xscale = 18568.7, yscale = 12472.2 };
+ZoomScale[4] = { xscale = 24390.3, yscale = 15628.5 };
+ZoomScale[5] = { xscale = 37012.2, yscale = 25130.6 };
+
+local function GetSTVPosition(x, y)
+ if ( not x or not y ) then
+ x, y = GetPlayerMapPosition("player");
+ end
+ x = (x * STVInfo.scale) + STVInfo.xoffset;
+ y = (y * STVInfo.scale) + STVInfo.yoffset;
+ return x, y;
+end
+
+local function SetTextureCoords(texture, A, B, C, D, E, F)
+ local det = A*E - B*D;
+ local ULx, ULy, LLx, LLy, URx, URy, LRx, LRy;
+
+ ULx, ULy = ( B*F - C*E ) / det, ( -(A*F) + C*D ) / det;
+ LLx, LLy = ( -B + B*F - C*E ) / det, ( A - A*F + C*D ) / det;
+ URx, URy = ( E + B*F - C*E ) / det, ( -D - A*F + C*D ) / det;
+ LRx, LRy = ( E - B + B*F - C*E ) / det, ( -D + A -(A*F) + C*D ) / det;
+
+ texture:SetTexCoord(ULx, ULy, LLx, LLy, URx, URy, LRx, LRy);
+end
+
+local function SetTextureAngle(texture, angrads)
+ local c = math.cos(angrads);
+ local s = math.sin(angrads);
+ SetTextureCoords(texture, c, s, 0, -s, c, 0);
+end
+
+local function GetAngleIcon(x, y)
+ local angle = asin(x / 57);
+ if (x <= 0 and y <= 0) then
+ angle = 180 - angle;
+ elseif (x <= 0 and y > 0) then
+ angle = 360 + angle;
+ elseif (x > 0 and y >= 0) then
+ angle = angle;
+ else
+ angle = 180 - angle;
+ end
+ local fileNumber = math.floor((angle / 10) + 0.5) * 10;
+ if (fileNumber == 360) then
+ fileNumber = 0;
+ end
+ return ICONPATH.."MiniMapArrow"..fileNumber;
+end
+
+local function PlotPOI(index, x, y, rot, scale)
+ local poi = getglobal("FishingExtravaganzaMini"..index);
+ if ( poi ) then
+ if ( x and y ) then
+ local tex = getglobal("FishingExtravaganzaMini"..index.."Texture");
+ local zoom = ZoomScale[Minimap:GetZoom()];
+ x = x * zoom.xscale;
+ y = y * zoom.yscale;
+ local dist = math.sqrt(x*x + y*y);
+ if ( dist > 56.5 ) then
+ x = x * 57 / dist;
+ y = y * 57 / dist;
+ if ( rot) then
+ tex:SetTexture(ICONPATH.."MiniMapArrow");
+ SetTextureAngle(tex, math.asin(x / 57));
+ else
+ tex:SetTexture(GetAngleIcon(x, y));
+ tex:SetTexCoord(0.0, 1.0, 0.0, 1.0);
+ end
+ else
+ tex:SetTexture("Interface\\Minimap\\ObjectIcons");
+ tex:SetTexCoord(0.0, 0.25, 0.25, 0.5);
+ end
+ poi:SetPoint("CENTER", "MinimapCluster", "TOPLEFT", 107 + x, y - 92);
+ if ( scale ) then
+ poi:SetWidth(scale);
+ poi:SetHeight(scale);
+ end
+ poi:Show();
+ return true;
+ else
+ poi:Hide();
+ end
+ end
+ return false;
+end
+
+local function CloseEnough(x1, y1, x2, y2)
+ local zoom = Minimap:GetZoom();
+ local x = (x1 - x2) * ZoomScale[zoom].xscale;
+ local y = (y1 - y2) * ZoomScale[zoom].yscale;
+ if (sqrt( (x * x) + (y * y) ) > 56.5) then
+ return; -- false
+ end
+ return true;
+end
+
+local function GetDistance(x1, y1, x2, y2)
+ local dx = (x1 - x2);
+ local dy = (y1 - y2);
+ return math.sqrt(dx*dx + dy*dy);
+end
+
+local function GetMinimapDistance(x1, y1, x2, y2)
+ local zoom = ZoomScale[Minimap:GetZoom()];
+ local dx = (x1 - x2) * zoom.xscale;
+ local dy = (y1 - y2) * zoom.yscale;
+ return math.sqrt(dx*dx+dy*dy);
+end
+
+local lx, ly;
+local lastten;
+local function GetNearestTen(x, y)
+ local schools = FishingBuddy.Schools.GetSchools(FBConstants.STVZONENAME);
+ if ( not x or not y ) then
+ x, y = GetSTVPosition();
+ end
+ -- if we've moved less than half the distance to the closest hole
+ -- don't recalculate
+ if ( lastten ) then
+ if ( lx == x and ly == y ) then
+ return lastten;
+ end
+ if ( table.getn(lastten) > 0 ) then
+ local d = GetDistance(x, y, lx, ly);
+ if ( d < (lastten[1].dist/2) ) then
+ return lastten;
+ end
+ end
+ end
+
+ local bydist = {};
+ for idx=1,table.getn(schools) do
+ local t = schools[idx];
+ if ( t.kind == FBConstants.SCHOOL_TASTY ) then
+ local sx, sy = GetSTVPosition(t.x, t.y);
+ local d = GetDistance(sx, sy, x, y);
+ local info = {};
+ info.x = sx;
+ info.y = sy;
+ info.dist = d;
+ tinsert(bydist, info);
+ end
+ end
+ table.sort(bydist, function(a, b) return a.dist < b.dist; end);
+ local idx = 1;
+ lastten = {};
+ for _,info in bydist do
+ if ( idx < 10 ) then
+ tinsert(lastten, { dist = info.dist, x = info.x, y = info.y });
+ idx = idx + 1;
+ end
+ end
+ lx = x;
+ ly = y;
+ return lastten;
+end
+
+local function UpdatePOI()
+ local x, y = GetSTVPosition();
+ local loc1 = GetNearestTen(x, y);
+ for idx=1,NUMMINIPOIS do
+ local t = loc1[idx];
+ if ( t ) then
+ PlotPOI(idx, t.x - x, y - t.y);
+ else
+ PlotPOI(idx);
+ end
+ end
+end
+
+local function HidePOI()
+ local poi = getglobal("FishingExtravaganzaMini1");
+ if ( poi:IsVisible() ) then
+ for idx=1,NUMMINIPOIS do
+ PlotPOI(idx);
+ end
+ end
+end
+
+local POIUpdateTimer = UPDATETIME_POI;
+FishingBuddy.Extravaganza.POI_OnUpdate = function(elapsed)
+ POIUpdateTimer = POIUpdateTimer - elapsed;
+ if ( POIUpdateTimer < 0 ) then
+ UpdatePOI();
+ POIUpdateTimer = UPDATETIME_POI;
+ end
+end
+
+local function DoUpdatePOI()
+ if ( not POIUpdateTimer or POIUpdateTimer <= 0 ) then
+ POIUpdateTimer = UPDATETIME_POI;
+ end
+ FishingExtravaganzaPOIUpdate:Show();
+end
+
+-- let an external entity forcibly mark a school
+FishingBuddy.Extravaganza.MarkSchool = function()
+ local zone, subzone = FishingBuddy.GetZoneInfo();
+ if ( zone == FBConstants.STVZONENAME ) then
+ FishingBuddy.Schools.AddFishingSchool(FBConstants.SCHOOL_TASTY, tastyfish_id, zone);
+ end
+end
+
+local function ExtravaganzaHijackCheck()
+ if ( FishingBuddy.NormalHijackCheck() ) then
+ -- also check to make sure we're over a pool
+ return FishingBuddy.Schools.IsFishingHole(FishingBuddy.GetTooltipText());
+ end
+end
+
+-- Sunday, 2pm
+local STVDay = "0";
+local STVStartHour = 14;
+
+-- Should we display the extravaganza message?
+local function IsTime(activate)
+ local showit = false;
+ if ( FishingBuddy.IsLoaded() ) then
+ if ( FishingBuddy.GetSetting("STVTimer") == 1 ) then
+ local mhour = date("%H");
+ local hour,minute = GetGameTime();
+ local day = date("%w");
+ local off = FishingBuddy.GetClockOffset();
+ if ( off ~= 0 ) then
+ local lhour = date("%H");
+ lhour = lhour + off;
+ if ( lhour >= 24 ) then
+ day = day + 1;
+ elseif( lhour < 0 ) then
+ day = day - 1;
+ end
+ end
+ -- Is it Sunday?
+ if ( day == STVDay and
+ (hour >= (STVStartHour-2) and hour <(STVStartHour+2))) then
+ showit = true;
+ end
+ end
+ end
+ if ( showit ) then
+ if ( activate ) then
+ FishingExtravaganzaFrame:Show();
+ end
+ if ( FishingBuddy.GetSetting("STVPoolsOnly") == 1 ) then
+ local zone,_ = FishingBuddy.GetZoneInfo();
+ if ( zone == FBConstants.STVZONENAME ) then
+ FishingBuddy.SetHijackCheck(ExtravaganzaHijackCheck);
+ else
+ FishingBuddy.SetHijackCheck();
+ end
+ end
+ else
+ if ( FishingExtravaganzaFrame:IsVisible() or
+ FishingExtravaganzaMini1:IsVisible() ) then
+ FishingExtravaganzaFrame:Hide();
+ HidePOI();
+ end
+ FishingBuddy.SetHijackCheck();
+ end
+ return showit;
+end
+FishingBuddy.Extravaganza.IsTime = IsTime;
+
+-- Check for mouse down event for dragging frame.
+FishingBuddy.Extravaganza.OnDragStart = function(arg1)
+ if (arg1 == "LeftButton") then
+ FishingExtravaganzaFrame:StartMoving();
+ FishingExtravaganzaFrame.isMoving = true;
+ end
+end
+
+-- Check for drag stop event to stop dragging.
+FishingBuddy.Extravaganza.OnDragStop = function(arg1)
+ if (arg1 == "LeftButton") then
+ FishingExtravaganzaFrame:StopMovingOrSizing();
+ FishingExtravaganzaFrame.isMoving = false;
+ end
+end
+
+-- Handle watching the loot
+FishingBuddy.Extravaganza.OnLoad = function()
+ this:RegisterEvent("PLAYER_LOGIN");
+ this:RegisterEvent("ZONE_CHANGED_NEW_AREA");
+ this:RegisterEvent("VARIABLES_LOADED");
+
+ this:RegisterForDrag("LeftButton");
+ this:Hide();
+end
+
+local function CountTastyFish()
+ local count = 0;
+ for bag=0, NUM_BAG_FRAMES do
+ -- get the number of slots in the bag (0 if no bag)
+ numSlots = GetContainerNumSlots(bag);
+ if (numSlots > 0) then
+ -- check each slot in the bag
+ for slot=1, numSlots do
+ local link = GetContainerItemLink (bag, slot);
+ if (link) then
+ local _,id,_ = FishingBuddy.SplitFishLink(link);
+ if ( id and id == tastyfish_id ) then
+ local _,c,_,_,_ = GetContainerItemInfo(bag, slot);
+ count = count + c;
+ end
+ end
+ end
+ end
+ end
+ return count;
+end
+
+FishingBuddy.Extravaganza.OnShow = function()
+ -- check each of the bags on the player
+ numCaught = CountTastyFish();
+end
+
+FishingBuddy.Extravaganza.OnHide = function()
+ if ( FishingExtravaganzaPOIUpdate and
+ FishingExtravaganzaPOIUpdate:IsVisible() ) then
+ FishingExtravaganzaPOIUpdate:Hide();
+ end
+end
+
+FishingBuddy.Extravaganza.OnEvent = function()
+ local zone, subzone = FishingBuddy.GetZoneInfo();
+ if ( event == "LOOT_OPENED" ) then
+ if ( IsFishingLoot()) then
+ for index = 1, GetNumLootItems(), 1 do
+ if (LootSlotIsItem(index)) then
+ local fishlink = GetLootSlotLink(index);
+ local _, id, name = FishingBuddy.SplitFishLink(fishlink);
+ if ( ExtravaganzaFish[id] ) then
+ FishingBuddy.Schools.AddFishingSchool(FBConstants.SCHOOL_TASTY, id, zone);
+ STVUpdateTimer = 0;
+ if ( id == tastyfish_id ) then
+ CountTastyFishNow = true;
+ -- make sure we've got the name of the fish for display
+ tastyfish = name;
+ end
+ end
+ end
+ end
+ end
+ elseif ( event == "CHAT_MSG_YELL" ) then
+ -- Riggle Bassbait yells: We have a winner! (.*) is the Master Angler!
+ local e,s,n = string.find(arg1, FBConstants.RIGGLE_BASSBAIT);
+ if ( e ) then
+ ExtravaganzaIsOver = true;
+ end
+ elseif ( event == "MINIMAP_UPDATE_ZOOM" ) then
+ if ( zone == FBConstants.STVZONENAME ) then
+ if ( FishingBuddy.GetSetting("STVTimer") == 1 ) then
+ DoUpdatePOI();
+ end
+ end
+ elseif ( event == "ZONE_CHANGED_NEW_AREA" or event == "PLAYER_LOGIN" ) then
+ if ( zone == FBConstants.STVZONENAME and IsTime() ) then
+ this:RegisterEvent("CHAT_MSG_YELL");
+ this:RegisterEvent("LOOT_OPENED");
+ this:RegisterEvent("MINIMAP_UPDATE_ZOOM");
+ else
+ this:UnregisterEvent("CHAT_MSG_YELL");
+ this:UnregisterEvent("LOOT_OPENED");
+ this:UnregisterEvent("MINIMAP_UPDATE_ZOOM");
+ end
+ elseif ( event == "VARIABLES_LOADED" ) then
+ local _,_,_,_,_,n = FishingBuddy.GetFishie(tastyfish_id);
+ if ( n ) then
+ tastyfish = n;
+ else
+ tastyfish = FBConstants.FISH;
+ end
+ IsTime(true);
+ this:UnregisterEvent("VARIABLES_LOADED");
+ end
+end
+
+FishingBuddy.Extravaganza.OnUpdate = function(elapsed)
+ if ( IsTime() ) then
+ if ( not FishingExtravaganzaFrame:IsVisible() ) then
+ FishingExtravaganzaFrame:Show();
+ end
+ STVUpdateTimer = STVUpdateTimer - elapsed;
+ if ( CountTastyFishNow ) then
+ numCaught = CountTastyFish();
+ CountTastyFishNow = false;
+ STVUpdateTimer = 0;
+ end
+ if ( STVUpdateTimer < 0 ) then
+ local hour,minute = GetGameTime();
+ local minleft;
+ local checkhour = STVStartHour;
+ local line;
+ local contestNow = false;
+ if ( hour >= STVStartHour ) then
+ if ( ExtravaganzaIsOver ) then
+ line = FBConstants.FATLADYSINGS;
+ else
+ line = FBConstants.TIMELEFT;
+ end
+ line = line..FBConstants.DASH.." |c";
+ if ( numCaught < 20 ) then
+ line = line..FBConstants.Colors.RED;
+ elseif ( numCaught < 39 ) then
+ line = line..FBConstants.Colors.YELLOW;
+ else
+ line = line..FBConstants.Colors.GREEN;
+ end
+ line = line..FBConstants.FISHCAUGHT.."|r";
+ checkhour = checkhour + 2;
+ contestNow = true;
+ else
+ line = FBConstants.TIMETOGO;
+ end
+ minleft = (checkhour - hour)*60 - minute;
+ if ( minleft > 0 ) then
+ FishingExtravaganzaFrameButtonText:SetTextColor(0.1, 1.0, 0.1);
+ if ( minleft < 10 ) then
+ FishingExtravaganzaFrameButtonText:SetTextColor(1.0, 0.1, 0.1);
+ end
+ line = string.format(line, minleft/60, math.mod(minleft, 60),
+ numCaught, tastyfish);
+ FishingExtravaganzaFrameButtonText:SetText(line);
+ local width = FishingExtravaganzaFrameButtonText:GetWidth();
+ FishingExtravaganzaFrame:SetWidth(width + 16);
+ local zone,_ = FishingBuddy.GetZoneInfo();
+ if ( zone == FBConstants.STVZONENAME ) then
+ DoUpdatePOI();
+ STVUpdateTimer = UPDATETIME_SCHOOLS;
+ else
+ STVUpdateTimer = UPDATETIME_COUNTER;
+ end
+ end
+ end
+ else
+ FishingExtravaganzaFrame:Hide();
+ HidePOI();
+ end
+end
+
+local function GetObjectCoords(poi, index, numcolumns, texturewidth)
+ local width = poi:GetWidth();
+ local xCoord1, xCoord2, yCoord1, yCoord2;
+ local coordIncrement = width / texturewidth;
+ xCoord1 = mod(index , numcolumns) * coordIncrement;
+ xCoord2 = xCoord1 + coordIncrement;
+ yCoord1 = floor(index / numcolumns) * coordIncrement;
+ yCoord2 = yCoord1 + coordIncrement;
+ return xCoord1, xCoord2, yCoord1, yCoord2;
+end
+
+local start = 0;
+-- debugging routines
+FishingBuddy.Extravaganza.Debug = function(day, hour, zone)
+ STVDay = day;
+ STVStartHour = hour;
+ if ( zone ) then
+ FBConstants.STVZONENAME = zone;
+ end
+ IsTime(true);
+end
+
+-- eventually, display what fish you caught here
+FishingBuddy.Extravaganza.MiniMap_OnEnter = function()
+end
+
+-- test the extravaganze school marking functions
+-- need to expand this for 1.9 if we can tell automatically
+FishingBuddy.Commands["mark"] = {};
+FishingBuddy.Commands["mark"].func =
+ function(what)
+ if ( what == "reset" ) then
+ FishingBuddy_Info["FishSchools"] = nil;
+ elseif ( what == "debug" ) then
+ local hour,_ = GetGameTime();
+ local day = date("%w");
+ FishingBuddy.Extravaganza.Debug(day, hour);
+ elseif ( what == "test" ) then
+ FishingBuddy.Debug("mark test");
+ local coord = 0.005;
+ local rot = 1;
+ PlotPOI(1, 0, coord, rot, 16);
+ PlotPOI(2, coord, coord, rot, 16);
+ PlotPOI(3, coord, 0, rot, 16);
+ PlotPOI(4, -coord, 0, rot, 16);
+ PlotPOI(5, -coord, -coord, rot, 16);
+ PlotPOI(6, 0, -coord, rot, 16);
+ else
+ FishingBuddy.Extravaganza.MarkSchool();
+ end
+ return true;
+ end;
+
diff --git a/FishingBuddy/FishingExtravaganza.xml b/FishingBuddy/FishingExtravaganza.xml
new file mode 100644
index 0000000..d17cbc6
--- /dev/null
+++ b/FishingBuddy/FishingExtravaganza.xml
@@ -0,0 +1,119 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ FishingBuddy.Extravaganza.OnLoad();
+
+
+ FishingBuddy.Extravaganza.OnShow();
+
+
+ FishingBuddy.Extravaganza.OnHide();
+
+
+ FishingBuddy.Extravaganza.OnEvent();
+
+
+ FishingBuddy.Extravaganza.OnUpdate(arg1);
+
+
+
+
+
+
+
+ FishingBuddy.Extravaganza.POI_OnUpdate(arg1);
+
+
+
+
diff --git a/FishingBuddy/FishingInit.lua b/FishingBuddy/FishingInit.lua
new file mode 100644
index 0000000..b969c87
--- /dev/null
+++ b/FishingBuddy/FishingInit.lua
@@ -0,0 +1,755 @@
+-- FishingBuddy
+--
+-- Everything you wanted support for in your fishing endeavors
+
+local gotSetupDone = false;
+local lastVersion;
+local playerName;
+local realmName;
+
+local DEFAULT_MINIMAP_POSITION = 256;
+
+local function tablecount(tab)
+ local n = 0;
+ for k,v in pairs(tab) do
+ n = n + 1;
+ end
+ return n;
+end
+FishingBuddy.tablecount = tablecount;
+
+FishingBuddy.IsLoaded = function()
+ return gotSetupDone;
+end
+
+-- if the old information is still there, then we might not have per
+-- character saved info, so let's save it away just in case. It'll go
+-- away the second time we load the add-on
+FishingBuddy.SavePlayerInfo = function()
+ if ( FishingBuddy_Info[realmName] and
+ FishingBuddy_Info[realmName]["Settings"] and
+ FishingBuddy_Info[realmName]["Settings"][playerName] ) then
+ local tabs = { "Settings", "Outfit", "WasWearing" };
+ for _,tab in pairs(tabs) do
+ for k,v in pairs(FishingBuddy_Player[tab]) do
+ FishingBuddy_Info[realmName][tab][playerName][k] = v;
+ end
+ end
+ end
+end
+
+local FishingInit = {};
+
+-- Fill in the player name and realm
+FishingInit.SetupNameInfo = function()
+ playerName = UnitName("player");
+ realmName = GetRealmName();
+ return playerName, realmName;
+end
+
+FishingInit.CheckPlayerInfo = function()
+ local tabs = { "Settings", "Outfit", "WasWearing" };
+ if ( not FishingBuddy_Player ) then
+ FishingBuddy_Player = {};
+ for _,tab in pairs(tabs) do
+ FishingBuddy_Player[tab] = { };
+ end
+ if ( FishingBuddy_Info[realmName] and
+ FishingBuddy_Info[realmName]["Settings"] and
+ FishingBuddy_Info[realmName]["Settings"][playerName] ) then
+ for _,tab in pairs(tabs) do
+ if ( FishingBuddy_Info[realmName][tab] and
+ FishingBuddy_Info[realmName][tab][playerName] ) then
+ for k,v in pairs(FishingBuddy_Info[realmName][tab][playerName]) do
+ FishingBuddy_Player[tab][k] = v;
+ end
+ end
+ end
+ end
+ elseif ( FishingBuddy_Info[realmName] and
+ FishingBuddy_Info[realmName]["Settings"] ) then
+ -- the saved information is there, kill the old stuff
+ for _,tab in pairs(tabs) do
+ if ( FishingBuddy_Info[realmName][tab] ) then
+ FishingBuddy_Info[realmName][tab][playerName] = nil;
+ -- Duh, table.getn doesn't work because there
+ -- aren't any integer keys in this table
+ if ( next(FishingBuddy_Info[realmName][tab]) == nil ) then
+ FishingBuddy_Info[realmName][tab] = nil;
+ end
+ end
+ end
+ if ( next(FishingBuddy_Info[realmName]) == nil ) then
+ FishingBuddy_Info[realmName] = nil;
+ end
+ end
+end
+
+FishingInit.CheckPlayerSetting = function(setting, defaultvalue)
+ if ( not FishingBuddy_Player["Settings"] ) then
+ FishingBuddy_Player["Settings"] = { };
+ end
+ if ( not FishingBuddy_Player["Settings"][setting] ) then
+ FishingBuddy_Player["Settings"][setting] = defaultvalue;
+ end
+end
+
+FishingInit.CheckGlobalSetting = function(setting, defaultvalue)
+ if ( not FishingBuddy_Info[setting] ) then
+ if ( not defaultvalue ) then
+ FishingBuddy_Info[setting] = {};
+ else
+ FishingBuddy_Info[setting] = defaultvalue;
+ end
+ end
+end
+
+FishingInit.CheckRealm = function()
+ local tabs = { "Settings", "Outfit", "WasWearing" };
+ for _,tab in pairs(tabs) do
+ if ( FishingBuddy_Info[tab] ) then
+ local old = FishingBuddy_Info[tab][playerName];
+ if ( old ) then
+ if ( not FishingBuddy_Info[realmName] ) then
+ FishingBuddy_Info[realmName] = { };
+ for _,tab in pairs(tabs) do
+ FishingBuddy_Info[realmName][tab] = { };
+ end
+ end
+
+ FishingBuddy_Info[realmName][tab][playerName] = { };
+ for k, v in pairs(old) do
+ FishingBuddy_Info[realmName][tab][playerName][k] = v;
+ end
+ FishingBuddy_Info[tab][playerName] = nil;
+ end
+
+ -- clean out cruft, if we have some
+ FishingBuddy_Info[tab][UNKNOWNOBJECT] = nil;
+ FishingBuddy_Info[tab][UKNOWNBEING] = nil;
+
+ -- Duh, table.getn doesn't work because there
+ -- aren't any integer keys in this table
+ if ( next(FishingBuddy_Info[tab]) == nil ) then
+ FishingBuddy_Info[tab] = nil;
+ end
+ end
+ end
+end
+
+FishingInit.SetupZoneMapping = function()
+ local continentNames = { GetMapContinents() };
+ if ( not FishingBuddy_Info["ZoneIndex"] ) then
+ FishingBuddy_Info["ZoneIndex"] = {};
+ for idx,name in pairs(continentNames) do
+ local zones = { GetMapZones(idx) };
+ for jdx,zone in pairs(zones) do
+ tinsert(FishingBuddy_Info["ZoneIndex"], zone);
+ end
+ end
+ end
+ if ( not FishingBuddy_Info["SubZones"] ) then
+ FishingBuddy_Info["SubZones"] = {};
+ end
+end
+
+FishingInit.UpdateFishingDB1 = function()
+ local version = FishingBuddy_Info["Version"];
+ if ( not version ) then
+ version = 7700; -- be really old
+ end
+
+ if ( FishingBuddy_Info["FishingHoles"] ) then
+ if ( version < 8300 ) then
+ -- handle a beta bug where we missed that GetSubZoneText() returns "" and not nil
+ for zone in pairs(FishingBuddy_Info["FishingHoles"]) do
+ if ( FishingBuddy_Info["FishingHoles"][zone][""] ) then
+ if ( not FishingBuddy_Info["FishingHoles"][zone][zone] ) then
+ FishingBuddy_Info["FishingHoles"][zone][zone] = { };
+ end
+ for k,v in pairs(FishingBuddy_Info["FishingHoles"][zone][""]) do
+ FishingBuddy_Info["FishingHoles"][zone][zone][k] = v;
+ end
+ FishingBuddy_Info["FishingHoles"][zone][""] = nil;
+ end
+ end
+ end
+
+ if ( version < 8503 ) then
+ local fh = FishingBuddy_Info["FishingHoles"];
+ local ff = FishingBuddy_Info["Fishies"];
+ for zone in pairs(fh) do
+ for subzone in pairs(fh[zone]) do
+ local crap = {};
+ for fishie in pairs(fh[zone][subzone]) do
+ if ( type(fishie) == "string" ) then
+ tinsert(crap, fishie);
+ end
+ end
+ for _,fishie in pairs(crap) do
+ if ( ff[fishie] ) then
+ local item = ff[fishie].item;
+ if ( item ) then
+ local _,_,id = string.find(item, "^(%d+):");
+ id = id + 0;
+ fh[zone][subzone][id] = fh[zone][subzone][fishie];
+ fh[zone][subzone][fishie] = nil;
+ end
+ end
+ end
+ end
+ end
+ local fishes = {};
+ for fishie in pairs(ff) do
+ if ( type(fishie) == "string" ) then
+ tinsert(fishes, fishie);
+ end
+ end
+ for _,fishie in pairs(fishes) do
+ local item = ff[fishie].item;
+ if ( item ) then
+ local _,_,id = string.find(item, "^(%d+):");
+ id = id + 0;
+ ff[id] = {};
+ ff[id].name = fishie;
+ for k,v in pairs(ff[fishie]) do
+ if ( k ~= "item" ) then
+ ff[id][k] = v;
+ end
+ end
+ ff[fishie] = nil;
+ end
+ end
+ -- tracking information
+ if ( FishingBuddy_Info and FishingBuddy_Info["FishTracking"] ) then
+ local ft = FishingBuddy_Info["FishTracking"];
+ for how in pairs(ft) do
+ local fishes = {};
+ for item in pairs(ft[how]) do
+ if ( type(item) == "string" ) then
+ tinsert(fishes, item);
+ end
+ end
+ for _,item in pairs(fishes) do
+ local _,_,id = string.find(item, "^(%d+):");
+ id = tonumber(id);
+ ft[how][id] = {};
+ for k,v in pairs(ft[how][item]) do
+ ft[how][id][k] = v;
+ end
+ if ( ft[how][id].count ) then
+ ft[how][id].data = {};
+ for k,v in pairs(ft[how][id].count) do
+ ft[how][id].data[k] = v;
+ end
+ ft[how][id].count = nil;
+ end
+ end
+ for _,item in pairs(fishes) do
+ ft[how][item] = nil;
+ end
+ end
+ end
+ end
+ end
+
+ if ( version < 8504 ) then
+ -- Let's not store default colors for things
+ local ff = FishingBuddy_Info["Fishies"];
+ if ( ff ) then
+ for id in pairs(ff) do
+ if ( ff[id].color and ff[id].color == "ffffffff" ) then
+ ff[id].color = nil;
+ end
+ end
+ end
+ end
+
+ if ( version < 8509 and FishingBuddy_Info["FishTracking"] ) then
+ local ft = FishingBuddy_Info["FishTracking"]["WEEKLY"];
+ for id,what in pairs(ft) do
+ if ( not ft[id].data[52] ) then
+ ft[id].data[52] = 0;
+ table.setn(ft[id].data, 53);
+ end
+ end
+ end
+
+ if ( not FishingBuddy_Info["Locations"] ) then
+ return;
+ end
+
+ -- Duh, table.getn doesn't work because there aren't any integer
+ -- keys in this table
+ if ( next(FishingBuddy_Info["Locations"]) == nil ) then
+ FishingBuddy_Info["Locations"] = nil;
+ return;
+ end
+
+ FishingBuddy_Info["FishingHoles"] = { };
+ FishingBuddy_Info["FishingHoles"][FBConstants.UNKNOWN] = { };
+ for zone in pairs(FishingBuddy_Info["Locations"]) do
+ FishingBuddy_Info["FishingHoles"][FBConstants.UNKNOWN][zone] = { };
+ local tab = FishingBuddy_Info["FishingHoles"][FBConstants.UNKNOWN][zone];
+ for k,v in pairs(FishingBuddy_Info["Locations"][zone]) do
+ tab[k] = v;
+ end
+ end
+ FishingBuddy_Info["Locations"] = nil;
+end
+
+FishingInit.FixupNumericZones = function()
+ -- fix bad zones from FishSchools update bug
+ local badones;
+ local biggest = 0;
+ local hardfix = false;
+ for zidx,zone in pairs(FishingBuddy_Info["ZoneIndex"]) do
+ if ( type(zone) ~= "string" ) then
+ if ( not badones ) then
+ badones = {};
+ end
+ badones[zidx] = zone;
+ if ( biggest < zidx ) then
+ biggest = zidx;
+ end
+ elseif ( biggest > 0 ) then
+ -- found a string after we started seeing numbers
+ hardfix = true;
+ end
+ end
+ if ( badones ) then
+ local fs = FishingBuddy_Info["FishingSkill"];
+ local fh = FishingBuddy_Info["FishingHoles"];
+ for bidx,gidx in pairs(badones) do
+ if ( fs[bidx] ) then
+ for sidx,skill in pairs(fs[bidx]) do
+ local z = FishingBuddy_Info["ZoneIndex"][gidx];
+ local sz = FishingBuddy_Info["SubZones"][gidx][sidx];
+ FishingBuddy.SetZoneLevel(z, sz, fs[bidx][gidx]);
+ end
+ end
+ if ( fh[bidx] ) then
+ if ( not fh[gidx] ) then
+ fh[gidx] = {};
+ end
+ for sidx,fishies in pairs(fh[bidx]) do
+ for id,cnt in pairs(fishies) do
+ if ( fh[gidx] and
+ fh[gidx][sidx] and
+ fh[gidx][sidx][id] ) then
+ fh[gidx][sidx][id] = fh[gidx][sidx][id] + cnt;
+ else
+ if ( not fh[gidx] ) then
+ fh[gidx] = {};
+ end
+ if ( not fh[gidx][sidx] ) then
+ fh[gidx][sidx] = {};
+ end
+ fh[gidx][sidx][id] = cnt;
+ end
+ end
+ end
+ end
+ end
+ if ( not hardfix ) then
+ -- these are already in numerical order
+ local count = table.getn(FishingBuddy_Info["ZoneIndex"]);
+ for idx=count,1,-1 do
+ if ( badones[idx] ) then
+ table.remove(FishingBuddy_Info["ZoneIndex"], idx);
+ FishingBuddy_Info["FishingSkill"][idx] = nil;
+ FishingBuddy_Info["FishingHoles"][idx] = nil;
+ FishingBuddy_Info["SubZones"][idx] = nil;
+ end
+ end
+ else
+ local fixers = { "FishingSkill", "FishingHoles", "SubZones" };
+ -- okay, this gonna be tough
+ -- strip out the numbers after the string
+ while ( badones ) do
+ local count = table.getn(FishingBuddy_Info["ZoneIndex"]);
+ local gotstring = false;
+ local sidx;
+ for idx=count,1,-1 do
+ if ( not gotstring ) then
+ if (type(fh[idx]) ~= "string" ) then
+ table.remove(FishingBuddy_Info["ZoneIndex"], idx);
+ for _,k in pairs(fixers) do
+ FishingBuddy_Info[k][idx] = nil;
+ end
+ badones[idx] = nil;
+ else
+ gotstring = true;
+ sidx = idx;
+ end
+ end
+ end
+ if ( next(badones) == nil) then
+ badones = nil;
+ end
+ if ( sidx and sidx ~= count ) then
+ count = table.getn(FishingBuddy_Info["ZoneIndex"]);
+ local fidx = 1;
+ while ( fidx < count and type(FishingBuddy_Info["ZoneIndex"][fidx] == "string" ) ) do
+ fidx = fidx + 1;
+ end
+ for k,v in FishingBuddy_Info["ZoneIndex"][sidx] do
+ FishingBuddy_Info["ZoneIndex"][fidx][k] = v;
+ end
+ FishingBuddy_Info["ZoneIndex"][sidx] = nil;
+ for _,f in fixers do
+ for k,v in FishingBuddy_Info[f][sidx] do
+ FishingBuddy_Info[f][fidx][k] = v;
+ end
+ FishingBuddy_Info[f][sidx] = nil;
+ end
+ else
+ -- if it's not already nil, we're in trouble
+ badones = nil;
+ end
+ end
+ end
+ end
+end
+
+FishingInit.UpdateFishingDB2 = function()
+ local version = FishingBuddy_Info["Version"];
+ if ( not version ) then
+ version = 7700; -- be really old
+ end
+
+ -- track the weekly fish that got missed at the end of the year
+ if ( version < 8509 and FishingBuddy.ByFishie and FishingBuddy_Info["FishTracking"]) then
+ local ft = FishingBuddy_Info["FishTracking"]["WEEKLY"];
+ for id,what in ft do
+ if ( FishingBuddy.ByFishie[id] ) then
+ local total = 0;
+ for _,count in FishingBuddy.ByFishie[id] do
+ total = total + count;
+ end
+ local tracked = 0;
+ local limit = table.getn(what.data)-1;
+ for i=0,limit do
+ tracked = tracked + what.data[i];
+ end
+ local diff = total - tracked;
+ if ( diff > 0 ) then
+ ft[id].data[52] = ft[id].data[52] + diff;
+ end
+ end
+ end
+ end
+
+ -- version < 8700
+ local needCollapse = true;
+ if ( FishingBuddy_Info["Schools"] ) then
+ -- convert zone coords into minimap coords
+ local STVInfo = { scale = 0.18128603034401,
+ xoffset = 0.39145470225916, yoffset = 0.79412224886668 };
+ local tastyfish_id = 19807;
+
+ local addschool = FishingBuddy.Schools.AddFishingSchool;
+ local zone = FBConstants.STVZONENAME;
+ for _,pools in FishingBuddy_Info["Schools"] do
+ for idx,entry in pools do
+ local t;
+ local x = (entry.x - STVInfo.xoffset) / STVInfo.scale;
+ local y = (entry.y - STVInfo.yoffset) / STVInfo.scale;
+ addschool(FBConstants.SCHOOL_TASTY, 19807, zone, x, y);
+ end
+ end
+ FishingBuddy_Info["Schools"] = nil;
+ needCollapse = nil;
+ end
+
+ if ( version < 8701 ) then
+ FishingBuddy.SetSetting("FastCast", nil);
+ end
+
+ if ( version < 8703 ) then
+ local azi = FishingBuddy.AddZoneIndex;
+ if ( FishingBuddy_Info["FishingSkill"] ) then
+ didsomething = false;
+ local fixit = false;
+ for zone,info in FishingBuddy_Info["FishingSkill"] do
+ if ( type(zone) == "string" ) then
+ fixit = true;
+ break;
+ end
+ end
+ if ( fixit ) then
+ local newskills = {};
+ for zone,info in FishingBuddy_Info["FishingSkill"] do
+ local zidx = azi(zone);
+ newskills[zidx] = {};
+ for subzone,count in info do
+ local _,sidx = azi(zone,subzone);
+ newskills[zidx][sidx] = count;
+ end
+ FishingBuddy_Info["FishingSkill"][zone] = nil;
+ end
+ FishingBuddy_Info["FishingSkill"] = newskills;
+ end
+ end
+
+ if ( FishingBuddy_Info["FishingHoles"] ) then
+ local fixit = false;
+ for zone,info in FishingBuddy_Info["FishingHoles"] do
+ if ( type(zone) == "string" ) then
+ fixit = true;
+ break;
+ end
+ end
+ if ( fixit ) then
+ local newholes = {};
+ for zone,info in FishingBuddy_Info["FishingHoles"] do
+ local zidx = azi(zone);
+ newholes[zidx] = {};
+ for subzone,stuff in info do
+ local _,sidx = azi(zone,subzone);
+ newholes[zidx][sidx] = stuff;
+ end
+ FishingBuddy_Info["FishingHoles"][zone] = nil;
+ end
+ FishingBuddy_Info["FishingHoles"] = newholes;
+ end
+ end
+ end
+
+ if ( version < 8704 and needCollapse ) then
+ if ( FishingBuddy_Info["FishSchools"] ) then
+ local azi = FishingBuddy.AddZoneIndex;
+ local fixit = false;
+ for zone,info in FishingBuddy_Info["FishSchools"] do
+ if ( type(zone) == "string" ) then
+ fixit = true;
+ break;
+ end
+ end
+ if ( fixit ) then
+ local newschools = {};
+ for zone,info in FishingBuddy_Info["FishSchools"] do
+ local zidx = azi(zone);
+ newschools[zidx] = {};
+ for idx,entry in info do
+ tinsert(newschools[zidx], entry);
+ end
+ FishingBuddy_Info["FishSchools"][zone] = nil;
+ end
+ FishingBuddy_Info["FishSchools"] = newschools;
+ end
+ end
+ FishingBuddy.Schools.CollapseHoles();
+ end
+
+ if ( version < 8707 ) then
+ FishingInit.FixupNumericZones();
+ end
+
+ if ( version < 8712 and FishingBuddy_Info and FishingBuddy_Info["FishTracking"] ) then
+ local ft = FishingBuddy_Info["FishTracking"];
+ for how,info in ft do
+ for id,what in ft[how] do
+ what.plot = 1;
+ end
+ end
+ end
+
+ if ( version < 8900 and FishingBuddy_Info["FishTracking"] ) then
+ for idx,how in { "HOURLY", "WEEKLY" } do
+ for id,info in FishingBuddy_Info["FishTracking"][how] do
+ if ( info.name == FBConstants.FISH.." ("..id..")" ) then
+ info.name = nil;
+ end
+ end
+ end
+ end
+
+ if ( version < 8901 ) then
+ local clickToSwitch;
+ for idx,click in { "Titan", "Fubar", "InfoBar" } do
+ local setting = click.."ClickToSwitch";
+ local s = FishingBuddy_Player["Settings"][setting];
+ if ( s ~= nil ) then
+ clickToSwitch = s;
+ end
+ FishingBuddy_Player["Settings"][setting] = nil;
+ end
+ FishingBuddy_Player["Settings"]["ClickToSwitch"] = clickToSwitch;
+ end
+
+ -- save this for other pieces that might need to update
+ lastVersion = version;
+
+ FishingBuddy_Info["Version"] = FBConstants.CURRENTVERSION;
+end
+
+FishingBuddy.GetLastVersion = function()
+ return lastVersion;
+end
+
+-- Based on code in QuickMountEquip
+FishingInit.HookFunction = function(func, newfunc)
+ local oldValue = getglobal(func);
+ if ( oldValue ~= getglobal(newfunc) ) then
+ setglobal(func, getglobal(newfunc));
+ return true;
+ end
+ return false;
+end
+
+-- set up alternate view of fish data. do this as startup to
+-- lower overall dynamic hit when loading the window
+FishingInit.SetupByFishie = function()
+ if ( not FishingBuddy.ByFishie ) then
+ local fh = FishingBuddy_Info["FishingHoles"];
+ local ff = FishingBuddy_Info["Fishies"];
+ FishingBuddy.ByFishie = { };
+ FishingBuddy.SortedFishies = { };
+ for zidx in fh do
+ local zone = FishingBuddy_Info["ZoneIndex"][zidx];
+ for sidx in fh[zidx] do
+ local subzone = FishingBuddy_Info["SubZones"][zidx][sidx];
+ local indexer = zidx.."."..sidx;
+ for id in fh[zidx][sidx] do
+ local quantity = fh[zidx][sidx][id];
+ if ( not FishingBuddy.ByFishie[id] ) then
+ FishingBuddy.ByFishie[id] = { };
+ tinsert(FishingBuddy.SortedFishies,
+ { text = ff[id].name, id = id });
+ end
+
+ if ( not FishingBuddy.ByFishie[id][indexer] ) then
+ FishingBuddy.ByFishie[id][indexer] = quantity;
+ else
+ FishingBuddy.ByFishie[id][indexer] = FishingBuddy.ByFishie[id][indexer] + quantity;
+ end
+ end
+ end
+ end
+ FishingBuddy.FishSort(FishingBuddy.SortedFishies, true);
+ end
+end
+
+FishingInit.InitSortHelpers = function()
+ local fh = FishingBuddy_Info["FishingHoles"];
+ FishingBuddy.SortedZones = {};
+ FishingBuddy.SortedByZone = {};
+ FishingBuddy.SortedSubZones = {};
+ for zidx,zone in FishingBuddy_Info["ZoneIndex"] do
+ tinsert(FishingBuddy.SortedZones, zone);
+ FishingBuddy.SortedByZone[zone] = {};
+ if ( fh[zidx] ) then
+ for sidx in fh[zidx] do
+ local subzone = FishingBuddy_Info["SubZones"][zidx][sidx];
+ tinsert(FishingBuddy.SortedByZone[zone], subzone);
+ tinsert(FishingBuddy.SortedSubZones, subzone);
+ end
+ table.sort(FishingBuddy.SortedByZone[zone]);
+ end
+ end
+ table.sort(FishingBuddy.SortedZones);
+ table.sort(FishingBuddy.SortedSubZones);
+end
+
+FishingInit.InitSettings = function()
+ if( not FishingBuddy_Info ) then
+ FishingBuddy_Info = { };
+ end
+ -- global stuff
+ FishingInit.SetupZoneMapping();
+ FishingInit.UpdateFishingDB1();
+ FishingInit.CheckRealm();
+
+ FishingInit.CheckGlobalSetting("ImppDBLoaded", 0);
+ FishingInit.CheckGlobalSetting("FishInfo2", 0);
+ FishingInit.CheckGlobalSetting("DataFish", 0);
+ FishingInit.CheckGlobalSetting("FishingHoles");
+ FishingInit.CheckGlobalSetting("FishingSkill");
+ FishingInit.CheckGlobalSetting("Fishies");
+ FishingInit.CheckGlobalSetting("HiddenFishies");
+
+ FishingInit.CheckPlayerInfo();
+
+ -- per user stuff
+ if ( not FishingBuddy_Player["Settings"] ) then
+ FishingBuddy_Player["Settings"] = { };
+ end
+ FishingInit.UpdateFishingDB2();
+ FishingInit.SetupByFishie();
+ FishingInit.InitSortHelpers();
+end
+
+FishingInit.RegisterMyAddOn = function()
+ -- Register the addon in myAddOns
+ if (myAddOnsFrame_Register) then
+ local details = {
+ name = FBConstants.ID,
+ description = FBConstants.DESCRIPTION,
+ version = FBConstants.VERSION,
+ releaseDate = 'July 21, 2005',
+ author = 'Sutorix',
+ email = 'Windrunner',
+ category = MYADDONS_CATEGORY_PROFESSIONS,
+ frame = "FishingBuddy",
+ optionsframe = "FishingBuddyFrame",
+ };
+ local help = "";
+ for _,line in FBConstants.HELPMSG do
+ if ( type(line) == "table" ) then
+ for _,l in line do
+ help = help.."\n"..l;
+ end
+ else
+ help = help.."\n"..line;
+ end
+ end
+ myAddOnsFrame_Register(details, { help });
+ end
+end
+
+FishingInit.RegisterHandlers = function()
+ temp = ToggleMinimap;
+ if ( FishingInit.HookFunction("ToggleMinimap", "FishingBuddy_ToggleMinimap") ) then
+ FishingBuddy.SavedToggleMinimap = temp;
+ end
+ FishingBuddy.TrapWorldMouse()
+end
+
+local WOW = {};
+FishingBuddy.WOWVersion = function()
+ return WOW.major, WOW.minor, WOW.dot;
+end
+
+FishingBuddy.Initialize = function()
+ -- Set everything up, then dump the code we don't need anymore
+ playerName, realmName = FishingInit.SetupNameInfo();
+ if ( FishingInit ) then
+ if ( GetBuildInfo ) then
+ local v, b, d = GetBuildInfo();
+ WOW.build = b;
+ WOW.date = d;
+ local s,e,maj,min,dot = string.find(v, "(%d+).(%d+).(%d+)");
+ WOW.major = tonumber(maj);
+ WOW.minor = tonumber(min);
+ WOW.dot = tonumber(dot);
+ else
+ FBConstants.Is10900 = true;
+ end
+ FishingInit.RegisterHandlers();
+ FishingInit.InitSettings();
+ -- register with myAddOn
+ FishingInit.RegisterMyAddOn();
+ -- clean out some beta trash
+ FishingBuddy.SetSetting("ClockOffset", nil);
+
+ FishingBuddy.Schools.Init();
+
+ gotSetupDone = true;
+ FishingBuddy.WatchUpdate();
+ -- debugging state
+ FishingBuddy.Debugging = FishingBuddy.GetSetting("FishDebug");
+ -- we don't need these functions anymore, gc 'em
+ FishingInit = nil;
+ end
+end
diff --git a/FishingBuddy/FishingLocationsFrame.lua b/FishingBuddy/FishingLocationsFrame.lua
new file mode 100644
index 0000000..ad2c8ff
--- /dev/null
+++ b/FishingBuddy/FishingLocationsFrame.lua
@@ -0,0 +1,655 @@
+-- Handle displaying all the fish in their habitats
+
+FishingBuddy.Locations = {};
+
+local NUM_THINGIES_DISPLAYED = 20;
+FishingBuddy.Locations.FRAME_THINGIEHEIGHT = 16;
+
+local Collapsed = false;
+local LocationLineSelected = 0;
+local LocationLines = {};
+local LocationLastLine = 1;
+
+local function MakeInfo(line, level, collapsible, expanded, hasicon, text, tipinfo, index, id)
+ if ( not LocationLines[line] ) then
+ LocationLines[line] = {};
+ end
+ LocationLines[line].level = level;
+ LocationLines[line].collapsible = collapsible;
+ LocationLines[line].expanded = expanded;
+ LocationLines[line].hasicon = hasicon;
+ LocationLines[line].text = text;
+ LocationLines[line].tipinfo = tipinfo;
+ if ( index ) then
+ LocationLines[line].index = index;
+ else
+ LocationLines[line].index = text;
+ end
+ LocationLines[line].id = id;
+ LocationLines[line].valid = true;
+end
+
+local function CountLocationLines()
+ local linecount = 0;
+ local j = 1;
+ local limit = LocationLastLine;
+ while ( j <= limit ) do
+ local info = LocationLines[j];
+ j = j + 1;
+ if ( info and info.valid ) then
+ linecount = linecount + 1;
+ if ( info.collapsible and not info.expanded ) then
+ local i2 = LocationLines[j];
+ while ( i2 and i2.valid and (i2.level > info.level) ) do
+ j = j + 1;
+ i2 = LocationLines[j];
+ end
+ end
+ end
+ end
+ if ( linecount > 0 ) then
+ -- I have no idea why this works this way at all
+ if ( linecount > NUM_THINGIES_DISPLAYED and linecount < limit ) then
+ return linecount+1;
+ else
+ return linecount;
+ end
+ else
+ return 0;
+ end
+end
+
+local function FishCount(zone, subzone)
+ local zidx, sidx = FishingBuddy.GetZoneIndex(zone, subzone);
+ local count = 0;
+ local total = 0;
+ local fh = FishingBuddy_Info["FishingHoles"];
+ if( fh[zidx] and fh[zidx][sidx] ) then
+ for fishie in fh[zidx][sidx] do
+ count = count + 1;
+ total = total + fh[zidx][sidx][fishie];
+ end
+ end
+ return count, total;
+end
+FishingBuddy.FishCount = FishCount;
+
+local function FishiesChanged()
+ local fh = FishingBuddy_Info["FishingHoles"];
+ local ff = FishingBuddy_Info["Fishies"];
+ local line = 1
+ local fishcount = table.getn(FishingBuddy.SortedFishies);
+ local zonetotals = {};
+
+ for i=1,fishcount,1 do
+ local fishid = FishingBuddy.SortedFishies[i].id;
+ local fishname = FishingBuddy.StripRaw(ff[fishid].name);
+ local locsort = {};
+ local total = 0;
+ for indexer,count in FishingBuddy.ByFishie[fishid] do
+ local _,_,zidx,sidx = string.find(indexer, "(%d+).(%d+)");
+ zidx = tonumber(zidx);
+ sidx = tonumber(sidx);
+ if ( not zonetotals[zidx] ) then
+ if ( fh[zidx] and fh[zidx][sidx] ) then
+ local tot = 0;
+ local fi = fh[zidx][sidx];
+ for f in fi do
+ tot = tot + fi[f];
+ end
+ zonetotals[zidx] = tot;
+ end
+ end
+ local info = {};
+ if ( FishingBuddy_Info["SubZones"][zidx] ) then
+ if ( not FishingBuddy_Info["SubZones"][zidx][sidx] ) then
+ info.text = FishingBuddy_Info["ZoneIndex"][zidx];
+ else
+ info.text = FishingBuddy_Info["SubZones"][zidx][sidx];
+ end
+ else
+ info.text = FBConstants.UNKNOWN;
+ end
+ info.count = count;
+ info.total = zonetotals[zidx];
+ if ( not info.total or info.total == 0) then
+ info.total = 1;
+ end
+ tinsert(locsort, info);
+ total = total + count;
+ end
+ local tipinfo = {};
+ tipinfo.total = total;
+ if ( ff[fishid].level ) then
+ tipinfo.level = ff[fishid].level;
+ end
+ MakeInfo(line, 0, true, true, true, fishname, extra, nil, fishid);
+ line = line + 1;
+ FishingBuddy.FishSort(locsort);
+ for j=1,table.getn(locsort),1 do
+ local zone = locsort[j].text;
+ local amount = locsort[j].count;
+ local total = locsort[j].total;
+ local percent = format(" (%.1f%%)", ( amount / total ) * 100);
+ MakeInfo(line, 1, false, false, false, zone..percent, { amount = amount, total = total, title = zone });
+ line = line + 1;
+ end
+ end
+ LocationLastLine = line;
+end
+
+local function BothLocationsChanged()
+ local fh = FishingBuddy_Info["FishingHoles"];
+ local ff = FishingBuddy_Info["Fishies"];
+ local sorted = FishingBuddy.SortedZones;
+ local line = 1;
+ local zonecount = table.getn(sorted);
+ for i=1,zonecount,1 do
+ local zone = sorted[i];
+ local zidx = FishingBuddy.GetZoneIndex(zone);
+ if ( fh[zidx] ) then
+ local where = zone;
+ MakeInfo(line, 0, true, true, false, zone, nil, where);
+ line = line + 1;
+ local subsorted = FishingBuddy.SortedByZone[zone];
+ local subcount = table.getn(subsorted);
+ for s=1,subcount,1 do
+ local subzone = subsorted[s];
+ local count, total = FishCount(zone, subzone);
+ if ( total > 0 ) then
+ local zidx, sidx = FishingBuddy.GetZoneIndex(zone, subzone);
+ where = zone.."."..subzone;
+ local tipinfo = {};
+ tipinfo.types = count;
+ tipinfo.total = total;
+ if ( FishingBuddy_Info["FishingSkill"][zidx] and FishingBuddy_Info["FishingSkill"][zidx][sidx] ) then
+ tipinfo.skill = FishingBuddy_Info["FishingSkill"][zidx][sidx];
+ end
+ if ( fh[zidx][sidx] ) then
+ MakeInfo(line, 1, true, true, false, subzone, tipinfo, where);
+ line = line + 1;
+ local fishsort = {};
+ for fishid in fh[zidx][sidx] do
+ local info = {};
+ info.id = fishid;
+ info.text = FishingBuddy.StripRaw(ff[fishid].name);
+ info.count = fh[zidx][sidx][fishid];
+ tinsert(fishsort, info);
+ end
+ FishingBuddy.FishSort(fishsort);
+ for j=1,table.getn(fishsort),1 do
+ local fishie = fishsort[j].text;
+ local id = fishsort[j].id;
+ local amount = fishsort[j].count;
+ local percent = format(" (%.1f%%)", ( amount / total ) * 100);
+ MakeInfo(line, 2, false, false, true, fishie..percent, { amount = amount, total = total, title = fishie }, nil, id);
+ line = line + 1;
+ end
+ end
+ end
+ end
+ end
+ end
+ LocationLastLine = line;
+end
+
+local function SubZonesChanged()
+ local fh = FishingBuddy_Info["FishingHoles"];
+ local ff = FishingBuddy_Info["Fishies"];
+ local mapping = {};
+ for zone in fh do
+ for subzone in fh[zone] do
+ mapping[subzone] = zone;
+ end
+ end
+ local line = 1;
+ local zonecount = table.getn(FishingBuddy.SortedSubZones);
+ for i=1,zonecount,1 do
+ local subzone = FishingBuddy.SortedSubZones[i];
+ local zone = mapping[subzone];
+ local count, total = FishCount(zone, subzone);
+ if ( total > 0 ) then
+ local zidx, sidx = FishingBuddy.GetZoneIndex(zone, subzone);
+ local tipinfo = nil;
+ if ( FishingBuddy_Info["FishingSkill"][zidx] and FishingBuddy_Info["FishingSkill"][zidx][sidx] ) then
+ tipinfo = { skill = FishingBuddy_Info["FishingSkill"][zidx][sidx] };
+ end
+ MakeInfo(line, 0, true, true, false, subzone, tipinfo);
+ line = line + 1;
+ local fishsort = {};
+ for fishid in fh[zidx][sidx] do
+ local info = {};
+ info.id = fishid;
+ info.text = FishingBuddy.StripRaw(ff[fishid].name);
+ info.count = fh[zidx][sidx][fishid];
+ tinsert(fishsort, info);
+ end
+ FishingBuddy.FishSort(fishsort);
+ for j=1,table.getn(fishsort),1 do
+ local id = fishsort[j].id;
+ local fishie = fishsort[j].text;
+ local amount = fishsort[j].count;
+ local percent = format(" (%.1f%%)", ( amount / total ) * 100);
+ MakeInfo(line, 1, false, false, true, fishie..percent, { amount = amount, total = total, title = fishie} , nil, id);
+ line = line + 1;
+ end
+ end
+ end
+ LocationLastLine = line;
+end
+
+local function LinesChanged()
+ if ( FishingBuddy.GetSetting("GroupByLocation") == 1 ) then
+ if ( FishingBuddy.GetSetting("ShowLocationZones") == 1 ) then
+ BothLocationsChanged();
+ else
+ SubZonesChanged();
+ end
+ else
+ FishiesChanged();
+ end
+ for i=LocationLastLine,table.getn(LocationLines) do
+ local info = LocationLines[i];
+ if ( info ) then
+ info.valid = false;
+ end
+ end
+ FishingLocationsFrame.valid = true;
+end
+
+-- local MOUSEWHEEL_DELAY = 0.1;
+-- local lastScrollTime = nil;
+-- function FishingLocationsFrame_OnMouseWheel(value)
+-- local now = GetTime();
+-- if ( not lastScrollTime ) then
+-- lastScrollTime = now - 0.2;
+-- end
+-- if ( (now - lastScrollTime) > MOUSEWHEEL_DELAY ) then
+-- -- call the old mouse wheel function somehow?
+-- end
+-- end
+
+function FishingLocationsFrame_SetSelection(id, line)
+ local info = LocationLines[line];
+ FishingLocationHighlightFrame:Hide();
+ if info then
+ if ( info.collapsible ) then
+ info.expanded = not info.expanded;
+ else
+ LocationLineSelected = line;
+ FishingLocationHighlightFrame:SetPoint ( "TOPLEFT" , getglobal("FishingLocations"..id):GetName() , "TOPLEFT" , 5 , 0 )
+ FishingLocationHighlightFrame:Show()
+ end
+ end
+end
+
+function FishingLocationsFrame_MoveButtonText(i, what)
+ local relativeTo = "FishingLocations"..i..what;
+ local textfield = getglobal("FishingLocations"..i.."Text");
+ textfield:SetPoint("LEFT", relativeTo, "RIGHT", 2, 0);
+end
+
+FishingBuddy.Locations.Update = function(forced)
+ if ( not FishingLocationsFrame:IsVisible() ) then
+ return;
+ end
+
+ if ( forced or not FishingLocationsFrame.valid ) then
+ LinesChanged();
+ end
+
+ local offset = FauxScrollFrame_GetOffset(FishingLocsScrollFrame);
+ FauxScrollFrame_Update( FishingLocsScrollFrame, CountLocationLines(),
+ NUM_THINGIES_DISPLAYED,
+ FishingBuddy.Locations.FRAME_THINGIEHEIGHT,
+ nil, nil, nil,
+ FishingLocationHighlightFrame,
+ 230, 230
+ );
+
+ local lastlevel = 0;
+ FishingLocationHighlightFrame:Hide();
+ local j = 1;
+ local o = 1;
+ while ( o < offset ) do
+ local info = LocationLines[j];
+ if ( info ) then
+ j = j + 1;
+ o = o + 1;
+ if ( info.collapsible and not info.expanded ) then
+ local i2 = LocationLines[j];
+ while ( i2 and i2.level > info.level ) do
+ j = j + 1;
+ i2 = LocationLines[j];
+ end
+ end
+ end
+ end
+ for i = 1,NUM_THINGIES_DISPLAYED,1 do
+ local locButton = getglobal ( "FishingLocations"..i );
+ local info = LocationLines[j];
+ if ( info and info.valid ) then
+ local icon = getglobal("FishingLocations"..i.."Icon");
+ local icontex = getglobal("FishingLocations"..i.."IconTexture");
+ locButton.id = i;
+ locButton.line = j;
+
+ local leveloffset = (info.level - lastlevel)*16;
+ if ( i == 1 ) then
+ locButton:SetPoint("TOPLEFT", leveloffset+25, -100);
+ else
+ local t = i - 1;
+ locButton:SetPoint("TOPLEFT", "FishingLocations"..t, "BOTTOMLEFT", leveloffset, 0);
+ end
+ lastlevel = info.level;
+
+ local text = info.text;
+ if text and info.extra then
+ text = text .. info.extra;
+ end
+ locButton.tipinfo = info.tipinfo;
+
+ icon:ClearAllPoints();
+ if ( info.collapsible ) then
+ icon:SetPoint("LEFT", "FishingLocations"..i, "LEFT", 21, 0);
+ locButton:SetTextColor( 1, 0.82, 0 );
+ if ( info.expanded ) then
+ locButton:SetNormalTexture("Interface\\Buttons\\UI-MinusButton-Up");
+ else
+ locButton:SetNormalTexture("Interface\\Buttons\\UI-PlusButton-Up");
+ end
+ getglobal("FishingLocations"..i.."Highlight"):SetTexture("Interface\\Buttons\\UI-PlusButton-Hilight");
+ getglobal("FishingLocations"..i):UnlockHighlight();
+ else
+ icon:SetPoint("LEFT", "FishingLocations"..i, "LEFT", 3, 0);
+ locButton:SetTextColor( .5, .5, .5 );
+ locButton:SetNormalTexture("");
+ getglobal("FishingLocations"..i.."Highlight"):SetTexture("");
+ -- Place the highlight and lock the highlight state
+ if ( LocationLineSelected == j ) then
+ FishingLocationHighlightFrame:SetPoint("TOPLEFT", "FishingLocations"..i, "TOPLEFT", 21, 0);
+ FishingLocationHighlightFrame:Show();
+ locButton:LockHighlight();
+ else
+ locButton:UnlockHighlight();
+ end
+ end
+
+ locButton.tooltip = nil;
+ if ( info.hasicon ) then
+ local item, texture, _, _, _ = FishingBuddy.GetFishie(info.id);
+ locButton.item = item;
+ locButton.fishid = info.id;
+ locButton.name = info.text;
+ if( texture ) then
+ icontex:SetTexture(texture);
+ icon:Show();
+ icontex:Show();
+ end
+ FishingLocationsFrame_MoveButtonText(i, "Icon");
+ else
+ locButton.item = nil;
+ locButton.fishid = nil;
+ locButton.name = nil;
+ icontex:SetTexture("");
+ icontex:Hide();
+ icon:Hide();
+ FishingLocationsFrame_MoveButtonText(i, "Highlight");
+ end
+
+ if ( info.tipinfo ) then
+ local color = FBConstants.Colors.GREEN;
+ if ( locButton.item and
+ not FishingBuddy.IsLinkableItem(locButton.item) ) then
+ color = FBConstants.Colors.RED;
+ end
+ text = text.."|c"..color.."*|r";
+ end
+ locButton:SetText( text );
+ locButton:Show();
+ j = j + 1;
+ if ( info.collapsible and not info.expanded ) then
+ local i2 = LocationLines[j];
+ while ( i2 and (i2.level > info.level) ) do
+ j = j + 1;
+ i2 = LocationLines[j];
+ end
+ end
+ else
+ locButton:Hide();
+ locButton.id = nil;
+ locButton.line = nil;
+ end
+ end
+
+ if ( LocationLines ) then
+ -- Set the expand/collapse all button texture
+ local numHeaders = 0;
+ local notExpanded = 0;
+ for i=1,table.getn(LocationLines),1 do
+ local j = i + offset;
+ local info = LocationLines[j];
+ if ( info and info.collapsible ) then
+ numHeaders = numHeaders + 1;
+ if ( not info.expanded ) then
+ notExpanded = notExpanded + 1;
+ end
+ end
+ end
+ FishingLocationsCollapseAllButton:Show();
+ -- If all headers are not expanded then show collapse button, otherwise show the expand button
+ if ( notExpanded ~= numHeaders ) then
+ Collapsed = false;
+ FishingLocationsCollapseAllButton:SetNormalTexture("Interface\\Buttons\\UI-MinusButton-Up");
+ else
+ Collapsed = true;
+ FishingLocationsCollapseAllButton:SetNormalTexture("Interface\\Buttons\\UI-PlusButton-Up");
+ end
+ else
+ FishingLocationsCollapseAllButton:Hide();
+ end
+end
+
+local OptionHandlers = {};
+local function FishOptionsInitialize()
+ local menu = getglobal("FishingBuddyLocationsMenu");
+ if ( menu.fishid ) then
+ local fishid = menu.fishid;
+ local ff = FishingBuddy_Info["Fishies"];
+
+ local info = {};
+ info.text = FBConstants.HIDEINWATCHER;
+ info.func = FishingBuddy.WatchFrame.MakeToggle(fishid);
+ info.checked = ( not FishingBuddy_Info["HiddenFishies"][fishid] );
+ UIDropDownMenu_AddButton(info);
+
+ for idx,handler in pairs(OptionHandlers) do
+ handler(fishid);
+ end
+ end
+end
+
+FishingBuddy.Locations.Button_OnClick = function(button)
+ if ( button == "LeftButton" ) then
+ if( IsShiftKeyDown() and this.item ) then
+ FishingBuddy.ChatLink(this.item, this.name, this.color);
+ elseif ( this.id and this.line ) then
+ FishingLocationsFrame_SetSelection(this.id, this.line);
+ FishingBuddy.Locations.Update();
+ end
+ elseif ( this.fishid and button == "RightButton" ) then
+ local menu = getglobal("FishingBuddyLocationsMenu");
+
+ menu.fishid = this.fishid;
+ UIDropDownMenu_Initialize(menu, FishOptionsInitialize, "MENU");
+ FishingBuddy.ToggleDropDownMenu(1, nil, menu, this, 0, 0);
+ end
+end
+
+function FishingLocationsCollapseAllButton_OnClick()
+ if not Collapsed then
+ FishingLocsScrollFrameScrollBar:SetValue(0);
+ LocationLineSelected = 1;
+ end
+ for _,info in LocationLines do
+ info.expanded = Collapsed;
+ end
+ Collapsed = not Collapsed;
+ FishingBuddy.Locations.Update();
+end
+
+FishingBuddy.Locations.Button_OnEnter = function()
+ if( GameTooltip.locbutfini ) then
+ return;
+ end
+ if ( this.item or this.tooltip or this.tipinfo ) then
+ GameTooltip:SetOwner(this, "ANCHOR_RIGHT");
+ end
+
+ local gottitle;
+ if( this.item or this.tooltip ) then
+ gottitle = true;
+ if ( this.item and this.item ~= "" ) then
+ if ( FishingBuddy.IsLinkableItem(this.item) ) then
+ GameTooltip:SetHyperlink("item:"..this.item);
+ else
+ this.tooltip = {}
+ this.tooltip[1] = { ["text"] = this.name };
+ this.tooltip[2] = { ["text"] = FBConstants.NOTLINKABLE, ["r"] = 1.0, ["g"] = 0, ["b"] = 0 };
+ FishingBuddy.AddTooltip(this.tooltip);
+ this.item = nil;
+ end
+ elseif ( this.tooltip ) then
+ FishingBuddy.AddTooltip(this.tooltip, 1, 1, 1);
+ end
+ end
+ if ( this.tipinfo ) then
+ local ti = this.tipinfo;
+ local line;
+ if ( ti.title ) then
+ GameTooltip:AddLine(ti.title);
+ elseif ( not gottitle ) then
+ GameTooltip:AddLine(this:GetText());
+ end
+ if ( ti.types ) then
+ GameTooltip:AddLine(string.format(FBConstants.FISHTYPES, ti.types));
+ end
+ if ( ti.amount ) then
+ line = string.format(FBConstants.CAUGHTTHISMANY, ti.amount);
+ end
+ if ( ti.total ) then
+ if ( not line ) then
+ line = "";
+ else
+ line = line.."/";
+ end
+ line = line..string.format(FBConstants.CAUGHTTHISTOTAL, ti.total);
+ end
+ if ( ti.percent ) then
+ if ( not line ) then
+ line = "";
+ else
+ line = line.." ";
+ end
+ line = line.."("..ti.percent.."%)";
+ end
+ if ( line ) then
+ GameTooltip:AddLine(line, 1, 1, 1);
+ end
+ if ( ti.skill ) then
+ line = string.format(FBConstants.MINIMUMSKILL, ti.skill);
+ GameTooltip:AddLine(line, 0, 1, 0);
+ end
+ end
+ GameTooltip.locbutfini = 1;
+ GameTooltip:Show();
+end
+
+FishingBuddy.Locations.Button_OnLeave = function()
+ if( this.item or this.tooltip or this.tipinfo ) then
+ GameTooltip:Hide();
+ end
+ GameTooltip.locbutfini = nil;
+end
+
+FishingBuddy.Locations.DisplayChanged = function()
+ FishingLocsScrollFrameScrollBar:SetValue(0);
+ LocationLineSelected = 1;
+ FishingBuddy.Locations.Update(true);
+end
+
+local function UpdateButtonDisplay()
+ if ( FishingBuddy.GetSetting("GroupByLocation") == 1 ) then
+ FishingLocationsSwitchButton:SetText(FBConstants.SHOWFISHIES);
+ FishingBuddyOptionSLZ:Show();
+ else
+ FishingLocationsSwitchButton:SetText(FBConstants.SHOWLOCATIONS);
+ FishingBuddyOptionSLZ:Hide();
+ end
+end
+
+FishingBuddy.Locations.SwitchDisplay = function()
+ -- backwards logic check, we're about to change...
+ local setting = FishingBuddy.GetSetting("GroupByLocation");
+ setting = 1 - setting;
+ FishingBuddy.SetSetting("GroupByLocation", setting);
+ UpdateButtonDisplay();
+ FishingBuddy.Locations.DisplayChanged();
+end
+
+FishingBuddy.Locations.SwitchButton_OnEnter = function()
+ if ( FishingBuddy.GetSetting("GroupByLocation") == 1 ) then
+ GameTooltip:SetText(FBConstants.SHOWFISHIES_INFO);
+ else
+ GameTooltip:SetText(FBConstants.SHOWLOCATIONS_INFO);
+ end
+ GameTooltip:Show();
+end
+
+local LocationEvents = {};
+LocationEvents[FBConstants.ADD_FISHIE_EVT] = function()
+ FishingLocationsFrame.valid = false;
+end
+
+FishingBuddy.Locations.OnLoad = function()
+ this:RegisterEvent("VARIABLES_LOADED");
+ FishingLocationsSwitchButton:SetText(FBConstants.SHOWFISHIES);
+ -- Set up checkbox
+ FishingBuddyOptionSLZ.name = "ShowLocationZones";
+ FishingBuddyOptionSLZ.text = FBConstants.CONFIG_SHOWLOCATIONZONES_ONOFF;
+ FishingBuddyOptionSLZ.tooltip = FBConstants.CONFIG_SHOWLOCATIONZONES_INFO;
+
+ FishingBuddy.API.RegisterHandlers(LocationEvents);
+end
+
+FishingBuddy.Locations.OnShow = function()
+ if ( FishingBuddy.IsLoaded() ) then
+ UpdateButtonDisplay();
+ FishingBuddy.Locations.Update();
+ end
+end
+
+FishingBuddy.Locations.OnEvent = function()
+ -- this crashes the client when enabled
+ -- this:EnableMouseWheel(0);
+end
+
+FishingBuddy.Locations.DataChanged = function(zone, subzone, fishie)
+ FishingLocationsFrame.valid = false;
+end
+
+FishingBuddy.ShowLocLine = function(j)
+ FishingBuddy.Dump(LocationLines[j]);
+end
+
+FishingBuddy.Locations.PerFishOptions = function(handler)
+ local found = false;
+ for idx,h in pairs(OptionHandlers) do
+ if ( h == handler ) then
+ found = true;
+ end
+ end
+ if ( not found ) then
+ table.insert(OptionHandlers, handler);
+ end
+end
diff --git a/FishingBuddy/FishingLocationsFrame.xml b/FishingBuddy/FishingLocationsFrame.xml
new file mode 100644
index 0000000..ec6d3a9
--- /dev/null
+++ b/FishingBuddy/FishingLocationsFrame.xml
@@ -0,0 +1,590 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ this:SetFrameLevel(0);
+ UIDropDownMenu_SetWidth(180);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ FishingBuddy.Locations.SwitchDisplay();
+
+
+ FishingBuddy.Locations.SwitchButton_OnEnter();
+
+
+ GameTooltip:Hide();
+
+
+
+
+
+
+
+
+
+
+
+
+
+ FishingBuddy.CheckButton_OnClick();
+ FishingBuddy.Locations.DisplayChanged();
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ this:SetFrameLevel(this:GetFrameLevel() + 1);
+ getglobal(this:GetName()):SetText(ALL);
+
+
+ FishingLocationsCollapseAllButton_OnClick();
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ GameTooltip:Hide();
+ FauxScrollFrame_OnVerticalScroll(FishingBuddy.Locations.FRAME_THINGIEHEIGHT, FishingBuddy.Locations.Update);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ FishingBuddy.Locations.OnLoad();
+
+
+ FishingBuddy.Locations.OnEvent();
+
+
+ FishingBuddy.Locations.OnShow();
+
+
+ -- FishingLocationsFrame_OnMouseWheel(arg1);
+ return;
+
+
+
+
diff --git a/FishingBuddy/FishingOptionsFrame.lua b/FishingBuddy/FishingOptionsFrame.lua
new file mode 100644
index 0000000..b0c6b60
--- /dev/null
+++ b/FishingBuddy/FishingOptionsFrame.lua
@@ -0,0 +1,254 @@
+-- Handle all the option settings
+
+FishingBuddy.OptionsFrame = {};
+
+local function BroadcastSetting(value)
+ local show = FBConstants.Broadcast[value];
+ FishingBuddy.SetSetting("BroadcastFishies", value);
+ local menu = getglobal("FishingBuddyOption_BroadcastFishies");
+ if ( menu ) then
+ local label = getglobal("FishingBuddyOption_BroadcastFishiesLabel");
+ UIDropDownMenu_SetWidth(90, menu);
+ UIDropDownMenu_SetSelectedValue(menu, show);
+ UIDropDownMenu_SetText(show, menu);
+ label:SetText(FBConstants.BROADCAST_LABEL_TEXT);
+ end
+end
+
+local function SetKeyValue(what, value)
+ local show = FBConstants.Keys[value];
+ FishingBuddy.SetSetting(what, value);
+ local menu = getglobal("FishingBuddyOption_"..what);
+ if ( menu ) then
+ local label = getglobal("FishingBuddyOption_"..what.."Label");
+ UIDropDownMenu_SetWidth(90, menu);
+ UIDropDownMenu_SetSelectedValue(menu, show);
+ UIDropDownMenu_SetText(show, menu);
+ label:SetText(FBConstants.KEYS_LABEL_TEXT);
+ end
+end
+FishingBuddy.OptionsFrame.SetKeyValue = SetKeyValue;
+
+FishingBuddy.CheckButton_OnShow = function()
+ this:SetChecked(FishingBuddy.GetSetting(this.name));
+ getglobal(this:GetName().."Text"):SetText(this.text);
+end
+
+local function CheckBox_Able(value, button)
+ local color;
+ if ( value == 1 ) then
+ button:Enable();
+ color = NORMAL_FONT_COLOR;
+ else
+ button:Disable();
+ color = GRAY_FONT_COLOR;
+ end
+ getglobal(button:GetName().."Text"):SetTextColor(color.r, color.g, color.b);
+end
+
+local function CheckButton_OnClick(checkbox, quiet)
+ local value = 0;
+ if ( not checkbox ) then
+ checkbox = this;
+ end
+ if ( checkbox:GetChecked() ) then
+ if ( not quiet ) then
+ PlaySound("igMainMenuOptionCheckBoxOn");
+ end
+ value = 1;
+ else
+ if ( not quiet ) then
+ PlaySound("igMainMenuOptionCheckBoxOff");
+ end
+ end
+ FishingBuddy.SetSetting(checkbox.name, value);
+ if ( checkbox.update ) then
+ checkbox.update();
+ end
+ if ( checkbox.deps ) then
+ for button,what in pairs(checkbox.deps) do
+ if ( what == "d" ) then
+ CheckBox_Able(value, button);
+ elseif ( what == "h" ) then
+ button:Hide();
+ if ( value == 1 ) then
+ if ( not button.visible or button.visible() == 1 ) then
+ button:Show();
+ end
+ end
+ end
+ end
+ end
+end
+FishingBuddy.CheckButton_OnClick = CheckButton_OnClick;
+
+FishingBuddy.CheckButton_OnEnter = function()
+ local tooltip = this.tooltip;
+ if ( tooltip ) then
+ GameTooltip:SetOwner(this, "ANCHOR_RIGHT");
+ GameTooltip:SetText(tooltip, nil, nil, nil, nil, 1);
+ GameTooltip:Show();
+ end
+end
+
+FishingBuddy.CheckButton_OnLeave = function()
+ GameTooltip:Hide();
+end
+
+FishingBuddy.OptionsFrame.Setup = function()
+ for name,option in pairs(FishingBuddy.OPTIONS) do
+ local button = getglobal("FishingBuddyOption_"..name);
+ if ( button ) then
+ if ( option.v ) then
+ local enable = true;
+ if ( option.check ) then
+ enable = option.check();
+ end
+ button.name = name;
+ button.update = option.update;
+ if ( option.text ) then
+ button.text = option.text;
+ else
+ button.text = "";
+ end
+ button.tooltip = option.tooltip;
+ if ( enable ) then
+ button:SetChecked(FishingBuddy.GetSetting(name));
+ CheckBox_Able(1, button);
+ else
+ CheckBox_Able(0, button);
+ end
+ end
+ local showit = 1;
+ if ( option.visible ) then
+ button.visible = option.visible;
+ showit = button.visible();
+ end
+ if ( showit ) then
+ button:Show();
+ else
+ button:Hide();
+ end
+ if ( option.deps ) then
+ for n,what in pairs(option.deps) do
+ local b = getglobal("FishingBuddyOption_"..n);
+ if ( b ) then
+ if ( not b.deps ) then
+ b.deps = {};
+ end
+ b.deps[button] = what;
+ end
+ end
+ end
+ end
+ end
+
+ -- now that we've collected all of the dependencies, handle them
+ for name,option in pairs(FishingBuddy.OPTIONS) do
+ if ( option.v ) then
+ local button = getglobal("FishingBuddyOption_"..name);
+ if ( button ) then
+ CheckButton_OnClick(button, true);
+ end
+ end
+ end
+
+ if ( FishingBuddy.UseButtonHole() ) then
+ FishingBuddyOption_MinimapPosSlider:Hide();
+ end
+ local gs = FishingBuddy.GetSetting;
+ SetKeyValue("EasyCastKeys", gs("EasyCastKeys"));
+ BroadcastSetting(gs("BroadcastFishies"));
+end
+
+FishingBuddy.OptionsFrame.SetClockValues = function(value)
+ FishingBuddy.SetClockOffset(value);
+ if ( FBConstants.ClockOffsets ) then
+ local menu = getglobal("FishingBuddyOption_ClockOffset");
+ local label = getglobal("FishingBuddyOption_ClockOffsetLabel");
+ UIDropDownMenu_SetWidth(60, menu);
+ local sel = 1;
+ if ( value == FBConstants.ClockOffsets[2] ) then
+ sel = 2;
+ end
+ UIDropDownMenu_SetSelectedValue(menu, sel);
+ UIDropDownMenu_SetText(value, menu);
+ label:SetText(FBConstants.OFFSET_LABEL_TEXT);
+ end
+ if ( FBConstants.ClockOffsets and
+ FishingBuddy.GetSetting("STVTimer") == 1 ) then
+ FishingBuddyOption_ClockOffset:Show();
+ else
+ FishingBuddyOption_ClockOffset:Hide();
+ end
+end
+
+local function ClockOffsetMenuSetup()
+ if ( FBConstants.ClockOffsets ) then
+ local clockoff = FishingBuddy.GetClockOffset();
+ for _,offset in pairs(FBConstants.ClockOffsets) do
+ local off = offset;
+ local info = {};
+ info.text = string.format("%4d", offset);
+ info.func = function()
+ FishingBuddy.OptionsFrame.SetClockValues(off);
+ end;
+ info.checked = ( offset == clockoff )
+ UIDropDownMenu_AddButton(info);
+ end
+ end
+end
+
+FishingBuddy.OptionsFrame.OffsetMenuSetup = function()
+ UIDropDownMenu_Initialize(this, ClockOffsetMenuSetup);
+end
+
+FishingBuddy.OptionsFrame.LoadKeyMenu = function(what)
+ local info = {};
+ local setting = FishingBuddy.GetSetting(what);
+ for value,label in pairs(FBConstants.Keys) do
+ local v = value;
+ local w = what;
+ info.text = label;
+ info.func = function() SetKeyValue(w, v); end;
+ if ( setting == value ) then
+ info.checked = true;
+ else
+ info.checked = false;
+ end
+ UIDropDownMenu_AddButton(info);
+ end
+end
+
+FishingBuddy.OptionsFrame.KeyMenuSetup = function(what)
+ UIDropDownMenu_Initialize(this,
+ function()
+ local w = what;
+ FishingBuddy.OptionsFrame.LoadKeyMenu(what);
+ end);
+end
+
+local function MakeSetter(value)
+ local v = value;
+ return function() BroadcastSetting(v) end;
+end
+FishingBuddy.MakeSetter = MakeSetter;
+
+local function LoadBroadcastMenu()
+ local info = {};
+ local setting = FishingBuddy.GetSetting("BroadcastFishies");
+ for value,label in pairs(FBConstants.Broadcast) do
+ info.text = label;
+ info.func = MakeSetter(value);
+ if ( setting == value ) then
+ info.checked = true;
+ else
+ info.checked = false;
+ end
+ UIDropDownMenu_AddButton(info);
+ end
+end
+
+FishingBuddy.OptionsFrame.BroadcastMenuSetup = function()
+ UIDropDownMenu_Initialize(this, LoadBroadcastMenu);
+end
diff --git a/FishingBuddy/FishingOptionsFrame.xml b/FishingBuddy/FishingOptionsFrame.xml
new file mode 100644
index 0000000..8fe3bbd
--- /dev/null
+++ b/FishingBuddy/FishingOptionsFrame.xml
@@ -0,0 +1,368 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ FishingBuddy.CheckButton_OnShow();
+
+
+ FishingBuddy.CheckButton_OnClick();
+
+
+ FishingBuddy.CheckButton_OnEnter();
+
+
+ FishingBuddy.CheckButton_OnLeave();
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ FishingBuddy.OptionsFrame.BroadcastMenuSetup();
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ FishingBuddy.OptionsFrame.KeyMenuSetup("EasyCastKeys");
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ FishingBuddy.OptionsFrame.OffsetMenuSetup();
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ getglobal(this:GetName().."Text"):SetText(FBConstants.MINIMAPBUTTONPLACEMENT);
+ getglobal(this:GetName().."High"):SetText();
+ getglobal(this:GetName().."Low"):SetText();
+ this:SetMinMaxValues(0, 360);
+ this:SetValueStep(1);
+ this.tooltipText = FBConstants.MINIMAPBUTTONPLACEMENTTOOLTIP;
+
+
+ local where = FishingBuddy.GetSetting("MinimapButtonPosition");
+ if (where) then
+ this:SetValue(where);
+ end
+
+
+ where = this:GetValue();
+ getglobal(this:GetName().."Text"):SetText(FBConstants.MINIMAPBUTTONPLACEMENT .. " - "..this:GetValue().."\194\176");
+ FishingBuddy.SetSetting("MinimapButtonPosition", where);
+ FishingBuddyMinimapButton_MoveButton();
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ this:RegisterEvent("VARIABLES_LOADED");
+
+
+ FishingBuddy.OptionsFrame.Setup();
+
+
+ FishingBuddy.WatchUpdate();
+ FishingBuddy.UpdateMinimap();
+
+
+ return;
+
+
+
+
diff --git a/FishingBuddy/FishingOutfitManager.lua b/FishingBuddy/FishingOutfitManager.lua
new file mode 100644
index 0000000..86a301e
--- /dev/null
+++ b/FishingBuddy/FishingOutfitManager.lua
@@ -0,0 +1,203 @@
+-- Manage outfits, whether they're from OutfitDisplayFrame or something else
+FishingBuddy.OutfitManager = {};
+
+-- Inferred from Draznar's Fishing FAQ
+local Accessories = {
+ [6256] = { ["n"] = "Fishing Pole", ["score"] = 0, },
+ [12225] = { ["n"] = "Blump Family Fishing Pole", ["score"] = 3, },
+ [6365] = { ["n"] = "Stong Fishing Pole", ["score"] = 5, },
+ [6366] = { ["n"] = "Darkwood Fishing Pole", ["score"] = 40, },
+ [6367] = { ["n"] = "Big Iron Fishing Pole", ["score"] = 20, },
+ [19022] = { ["n"] = "Nat Pagle's Extreme Angler FC-5000", ["score"] = 25, },
+ [19970] = { ["n"] = "Arcanite Fishing Pole", ["score"] = 35, },
+ [19944] = { ["n"] = "Nat Pagle's Fish Terminator", ["score"] = 45, },
+ [19971] = { ["n"] = "High Test Eternium Fishing Line", ["score"] = 5, },
+ [11152] = { ["n"] = "Formula: Enchant Gloves - Fishing", ["score"] = 2, },
+ [19979] = { ["n"] = "Hook of the Master Angler", ["score"] = 5, },
+ [19947] = { ["n"] = "Nat Pagle's Broken Reel", ["score"] = 4, },
+ [19972] = { ["n"] = "Lucky Fishing Hat", ["score"] = 5, },
+ [7996] = { ["n"] = "Lucky Fishing Hat", ["score"] = 10, },
+ [8749] = { ["n"] = "Crochet Hat", ["score"] = 3, },
+ [19039] = { ["n"] = "Zorbin's Water Resistant Hat", ["score"] = 3, },
+ [3889] = { ["n"] = "Russet Hat", ["score"] = 3, },
+ [14584] = { ["n"] = "Dokebi Hat", ["score"] = 2, },
+ [4048] = { ["n"] = "Emblazoned Hat", ["score"] = 1, },
+ [10250] = { ["n"] = "Masters Hat of the Whale", ["score"] = 1, },
+ [6263] = { ["n"] = "Blue Overalls", ["score"] = 4, },
+ [9508] = { ["n"] = "Mechbuilder's Overalls", ["score"] = 3, },
+ [3342] = { ["n"] = "Captain Sander's Shirt", ["score"] = 4, },
+ [5107] = { ["n"] = "Deckhand's Shirt", ["score"] = 2, },
+ [6795] = { ["n"] = "White Swashbuckler's Shirt", ["score"] = 1, },
+ [2576] = { ["n"] = "White Linen Shirt", ["score"] = 1, },
+ [15405] = { ["n"] = "Shucking Gloves", ["score"] = 5, },
+ [6202] = { ["n"] = "Fingerless Gloves", ["score"] = 3, },
+ [19969] = { ["n"] = "Nat Pagle's Extreme Anglin' Boots", ["score"] = 5, },
+ [792] = { ["n"] = "Knitted Sandals", ["score"] = 4, },
+ [1560] = { ["n"] = "Bluegill Sandals", ["score"] = 4, },
+ [15406] = { ["n"] = "Crustacean Boots", ["score"] = 3, },
+ [13402] = { ["n"] = "Timmy's Galoshes", ["score"] = 2, },
+ [10658] = { ["n"] = "Quagmire Galoshes", ["score"] = 2, },
+ [1678] = { ["n"] = "Black Ogre Kickers", ["score"] = 1, },
+ [5310] = { ["n"] = "Sea Dog Britches", ["score"] = 4, },
+ [3287] = { ["n"] = "Tribal Pants", ["score"] = 2, },
+ [6179] = { ["n"] = "Privateer's Cape", ["score"] = 1, },
+};
+
+FishingBuddy.Commands[FBConstants.SWITCH] = {};
+FishingBuddy.Commands[FBConstants.SWITCH].func = function()
+ FishingBuddy.OutfitManager.Switch();
+ return true;
+ end;
+
+local OutfitManagers = {};
+local OutfitManagerCount = 0;
+FishingBuddy.OutfitManager.RegisterManager = function(name, init, choose, switch)
+ if ( not OutfitManagers[name] ) then
+ OutfitManagers[name] = {};
+ OutfitManagerCount = OutfitManagerCount + 1;
+ end
+ OutfitManagers[name].Initialize = init;
+ OutfitManagers[name].Choose = choose;
+ OutfitManagers[name].Switch = switch;
+end
+
+FishingBuddy.OutfitManager.ItemStylePoints = function(itemno, enchant)
+ local points = 0;
+ if ( itemno ) then
+ itemno = tonumber(itemno);
+ enchant = tonumber(enchant);
+ if (Accessories[itemno]) then
+ points = points + Accessories[itemno].score;
+ end
+ if ( enchant == 846 ) then
+ -- bonus for being enchanted with Fishing +2
+ points = points + 2;
+ end
+ end
+ return points;
+end
+
+local PoleCheck = nil;
+
+-- update the watcher when we're done switching outfits
+FishingBuddy.OutfitManager.WaitForUpdate =
+ function(arg1)
+ local hasPole = FishingBuddy.API.IsFishingPole();
+ if ( hasPole == PoleCheck ) then
+ FishingOutfitUpdateFrame:Hide();
+ FishingBuddy.API.FishingMode();
+ end
+ end
+
+local function CheckSwitch(topole)
+ PoleCheck = topole;
+ FishingOutfitUpdateFrame:Show();
+end
+FishingBuddy.OutfitManager.CheckSwitch = CheckSwitch;
+
+local function HasManager()
+ return (OutfitManagerCount > 0);
+end
+FishingBuddy.OutfitManager.HasManager = HasManager;
+
+FishingBuddy.OutfitManager.Switch = function(outfitname)
+ if ( HasManager() ) then
+ local outfitter = FishingBuddy.GetSetting("OutfitManager");
+ if ( outfitter and OutfitManagers[outfitter] ) then
+ local willBePole = OutfitManagers[outfitter].Switch(outfitname);
+ if ( willBePole ~= nil ) then
+ -- if we're now sporting a fishing pole, let's go fishing
+ CheckSwitch(willBePole);
+ end
+ end
+ else
+ FishingBuddy.UIError(FBConstants.COMPATIBLE_SWITCHER);
+ end
+end
+
+local current_manager;
+
+local function OutfitManagerMenuSetup()
+ for manager,_ in pairs(OutfitManagers) do
+ local mgr = manager;
+ local info = {};
+ info.text = manager;
+ info.func = function() FishingBuddy.OutfitManager.ChooseManager(mgr); end;
+ info.checked = ( current_manager == manager )
+ UIDropDownMenu_AddButton(info);
+ end
+end
+
+local function SetOutfitManagerDisplay()
+ if ( OutfitManagerCount == 0 ) then
+ FishingBuddyOption_OutfitMenu:Hide();
+ FishingBuddyOption_OutfitText:SetText(FBConstants.OUTFITS..": |c"..FBConstants.Colors.RED..FBConstants.NONEAVAILABLE_MSG.."|r");
+ elseif ( OutfitManagerCount == 1 ) then
+ FishingBuddyOption_OutfitMenu:Hide();
+ FishingBuddyOption_OutfitText:SetText(FBConstants.OUTFITS..": |c"..FBConstants.Colors.GREEN..current_manager.."|r");
+ else
+ FishingBuddyOption_OutfitText:Hide();
+ UIDropDownMenu_Initialize(FishingBuddyOption_OutfitMenu,
+ OutfitManagerMenuSetup);
+ local show = 1;
+ for name,_ in pairs(OutfitManagers) do
+ if ( name == current_manager ) then
+ break;
+ end
+ show = show + 1;
+ end
+ local label = getglobal("FishingBuddyOption_OutfitMenuLabel");
+ label:SetText(FBConstants.OUTFITS..": ");
+ local menu = FishingBuddyOption_OutfitMenu;
+ UIDropDownMenu_SetWidth(210, menu);
+ UIDropDownMenu_SetSelectedValue(menu, show);
+ UIDropDownMenu_SetText(current_manager, menu);
+ end
+end
+
+local function ChooseManager(manager)
+ if ( manager and OutfitManagers[manager] ) then
+ current_manager = manager;
+ if ( not OutfitManagers[manager].initialized ) then
+
+ FishingBuddy.Debug("ChooseManager "..manager);
+
+ OutfitManagers[manager].Initialize();
+ OutfitManagers[manager].initialized = 1;
+ end
+ for om,info in pairs(OutfitManagers) do
+ info.Choose(om == manager);
+ end
+ SetOutfitManagerDisplay();
+ FishingBuddy.SetSetting("OutfitManager", current_manager);
+ return true;
+ end
+end
+FishingBuddy.OutfitManager.ChooseManager = ChooseManager;
+
+FishingBuddy.OutfitManager.Initialize = function()
+ -- no outfit managers, no outfit switching
+ if ( not HasManager() ) then
+ FishingBuddy.SetSetting("InfoBarClickToSwitch", 0);
+ FishingBuddy.SetSetting("TitanClickToSwitch", 0);
+ FishingBuddy.SetSetting("MinimapClickToSwitch", 0);
+ else
+ if ( OutfitManagerCount == 1 ) then
+ -- we pretty much have to use this one
+ current_manager = next(OutfitManagers);
+ else
+ current_manager = FishingBuddy.GetSetting("OutfitManager");
+ if ( not current_manager or not OutfitManagers[current_manager] ) then
+ -- no valid ones, use the first one
+ current_manager = next(OutfitManagers);
+ end
+ end
+ ChooseManager(current_manager);
+ -- in case we changed things (do we want/need to do this?)
+ -- FishingBuddy.SetSetting("OutfitManager", current_manager);
+ end
+ SetOutfitManagerDisplay();
+end
+
+-- debugging
+FishingBuddy.OutfitManagers = OutfitManagers;
diff --git a/FishingBuddy/FishingOutfitManager.xml b/FishingBuddy/FishingOutfitManager.xml
new file mode 100644
index 0000000..a9cc48b
--- /dev/null
+++ b/FishingBuddy/FishingOutfitManager.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+ FishingBuddy.OutfitManager.WaitForUpdate(arg1);
+
+
+
+
diff --git a/FishingBuddy/FishingOutfitter.lua b/FishingBuddy/FishingOutfitter.lua
new file mode 100644
index 0000000..948d2b7
--- /dev/null
+++ b/FishingBuddy/FishingOutfitter.lua
@@ -0,0 +1,141 @@
+-- Interface with the Outfitter addon by mundocani
+
+local function OutfitterSwitch(outfitName)
+ -- this uses a static string of "Fishing" *not* the translation
+ local vOut, vCat, vInd = Outfitter_FindOutfitByStatID("Fishing");
+ if ( vOut ) then
+ local wasPole = FishingBuddy.API.IsFishingPole();
+ if ( wasPole ) then
+ Outfitter_RemoveOutfit(vOut);
+ else
+ vOut.Disabled = nil;
+ Outfitter_WearOutfit(vOut, vCat);
+ end
+ Outfitter_Update(true);
+ -- return true if we're expecting to have a pole equipped
+ return (not wasPole);
+ end
+end
+
+local function CleanOutDuplicates(vName)
+ local count = 0;
+ for vCategoryID, vOutfits in gOutfitter_Settings.Outfits do
+ for vOutfitIndex, vOutfit in vOutfits do
+ if ( vOutfit.Name == vName ) then
+ count = count + 1;
+ end
+ end
+ end
+ if ( count > 0 ) then
+ -- nuke all of the outfits named 'Fishing Buddy' since they're
+ -- likely wrong, so that we can create a new 'good' one
+ local vOut,_,_ = Outfitter_FindOutfitByName(vName);
+ while ( vOut ) do
+ Outfitter_DeleteOutfit(vOut);
+ vOut,_,_ = Outfitter_FindOutfitByName(vName);
+ end
+ end
+end
+
+local function OutfitterInitialize()
+ if ( gOutfitter_Settings ) then
+ local vName = "Fishing Buddy";
+ CleanOutDuplicates(vName);
+ -- create the default fishing outfit, if it doesn't exist
+ local vOut,_,_ = Outfitter_FindOutfitByStatID("Fishing");
+ if ( not vOut ) then
+ vOut = Outfitter_GenerateSmartOutfit(vName, "Fishing", OutfitterItemList_GetEquippableItems(true));
+ if ( vOut ) then
+ local vCategoryID = Outfitter_AddOutfit(vOut);
+ -- we're done
+ end
+ end
+ end
+end
+
+-- calculate scores based on Outfitter
+local function StylePoints(outfit)
+ local isp = FishingBuddy.OutfitManager.ItemStylePoints;
+ local points = 0;
+ if ( outfit )then
+ for slot in outfit.Items do
+ points = points + isp(outfit.Items[slot].Code,
+ outfit.Items[slot].EnchantCode);
+ end
+ end
+ return points;
+end
+
+local function BonusPoints(outfit, vStatID)
+ local points = 0;
+ if ( outfit )then
+ for slot in outfit.Items do
+ if ( outfit.Items[slot][vStatID] ) then
+ points = points + outfit.Items[slot][vStatID];
+ end
+ -- Enternium Fishing Line
+ if ( outfit.Items[slot].EnchantCode == 2603 ) then
+ points = points + 5;
+ end
+ end
+ end
+ return points;
+end
+
+-- Outfitter patches ( not needed in 1.2)
+if ( not Outfitter_FindOutfitByStatID ) then
+ Outfitter_FindOutfitByStatID = function(pStatID)
+ if not pStatID or pStatID == "" then
+ return nil;
+ end
+
+ for vCategoryID, vOutfits in gOutfitter_Settings.Outfits do
+ for vOutfitIndex, vOutfit in vOutfits do
+ if vOutfit.StatID and vOutfit.StatID == pStatID then
+ return vOutfit, vCategoryID, vOutfitIndex;
+ end
+ end
+ end
+
+ -- return nil, nil, nil;
+ end
+end
+
+local Saved_OutfitterItem_OnEnter = OutfitterItem_OnEnter;
+local function Patch_OutfitterItem_OnEnter(pItem)
+ Saved_OutfitterItem_OnEnter(pItem);
+ if ( not pItem.isCategoryItem ) then
+ local vOutfit = Outfitter_GetOutfitFromListItem(pItem);
+ if ( vOutfit and vOutfit.StatID == "Fishing" ) then
+ local vDescription;
+ local bp = BonusPoints(vOutfit, "Fishing");
+ if ( bp >= 0 ) then
+ bp = "+"..bp;
+ else
+ bp = 0 - bp;
+ bp = "-"..bp;
+ end
+ bp = Outfitter_cFishingStatName.." "..bp;
+ local sp = StylePoints(vOutfit);
+ local pstring;
+ if ( points == 1 ) then
+ pstring = FBConstants.POINT;
+ else
+ pstring = FBConstants.POINTS;
+ end
+ vDescription = string.format(FBConstants.CONFIG_OUTFITTER_TEXT,
+ bp, sp)..pstring;
+ GameTooltip_AddNewbieTip(vOutfit.Name, 1.0, 1.0, 1.0, vDescription, 1);
+ end
+ end
+end
+-- point to our new function so we get our own tooltip
+OutfitterItem_OnEnter = Patch_OutfitterItem_OnEnter;
+
+if ( Outfitter_OnLoad ) then
+ FishingBuddy.OutfitManager.RegisterManager("Outfitter",
+ OutfitterInitialize,
+ function(useme) end,
+ OutfitterSwitch);
+end
+
diff --git a/FishingBuddy/FishingSchools.lua b/FishingBuddy/FishingSchools.lua
new file mode 100644
index 0000000..d82f2e0
--- /dev/null
+++ b/FishingBuddy/FishingSchools.lua
@@ -0,0 +1,170 @@
+-- Support for schools
+
+FishingBuddy.Schools = {};
+
+local SCHOOLS = {};
+local CLOSEENOUGH = 0.000001;
+
+local function distance(x1, y1, x2, y2)
+ local x = (x1 - x2);
+ local y = (y1 - y2);
+ return sqrt( (x * x) + (y * y) );
+end
+
+-- Let's store fishing holes like this
+-- FishingBuddy_Info["Schools"][ZONE]
+-- Store everything to two digits?
+
+local function AddFishingSchool(kind, fishid, zidx, x, y)
+ local entry = {};
+ if ( not zidx ) then
+ zidx, _ = FishingBuddy.GetZoneIndex();
+ elseif ( type(zidx) == "string" ) then
+ zidx = FishingBuddy.GetZoneIndex(zidx);
+ end
+ if ( not x or not y ) then
+ x, y = GetPlayerMapPosition("player");
+ end
+ if ( not FishingBuddy_Info["FishSchools"] ) then
+ FishingBuddy_Info["FishSchools"] = {};
+ end
+ if ( not FishingBuddy_Info["FishSchools"][zidx] ) then
+ FishingBuddy_Info["FishSchools"][zidx] = {};
+ else
+ -- how do we find the same pool?
+ for _,hole in pairs(FishingBuddy_Info["FishSchools"][zidx]) do
+ local d = distance(hole.x, hole.y, x, y);
+ if ( d < CLOSEENOUGH ) then
+ if ( fishid ) then
+ if ( hole.fish ) then
+ for f,count in pairs(hole.fish) do
+ if ( f == fishid ) then
+ hole.fish[f] = count + 1;
+ return;
+ end
+ end
+ else
+ hole.fish = {};
+ end
+ hole.fish[fishid] = 1;
+ end
+ if ( hole.count ) then
+ hole.count = hole.count + 1;
+ else
+ hole.count = 1;
+ end
+ return;
+ end
+ end
+ end
+ entry.kind = kind;
+ entry.x = x;
+ entry.y = y;
+ entry.count = 1;
+ if ( fishid ) then
+ entry.fish = {};
+ entry.fish[fishid] = 1;
+ end
+ tinsert(FishingBuddy_Info["FishSchools"][zidx], entry);
+ return true;
+end
+FishingBuddy.Schools.AddFishingSchool = AddFishingSchool;
+
+local function IsFishingHole(text)
+ if ( text ) then
+ for match, info in pairs(SCHOOLS) do
+ if ( string.find(text, match) ) then
+ return info;
+ end
+ end
+ end
+end
+FishingBuddy.Schools.IsFishingHole = IsFishingHole;
+
+local function CheckFishingHole(text, fishid)
+ local info = IsFishingHole(text);
+ if ( info ) then
+ if ( Gatherer_AddGatherHere and
+ FishingBuddy.GetSetting("UseGatherer") == 1 ) then
+ Gatherer_AddGatherHere(info.gather, 0, info.gather, 2);
+ end
+ if ( AddFishingSchool(info.kind, fishid) and
+ FishingBuddy.GetSetting("ShowNewFishies") == 1 ) then
+ local zone,_ = FishingBuddy.GetZoneInfo();
+ FishingBuddy.Print(FBConstants.ADDSCHOOLMSG, text, zone);
+ end
+ end
+end
+FishingBuddy.Schools.CheckFishingHole = CheckFishingHole;
+
+local function GetSchools(zidx)
+ if ( type(zidx) == "string" ) then
+ zidx = FishingBuddy.GetZoneIndex(zidx);
+ end
+ if ( FishingBuddy_Info["FishSchools"] and FishingBuddy_Info["FishSchools"][zidx] ) then
+ return FishingBuddy_Info["FishSchools"][zidx];
+ else
+ return {};
+ end
+end
+FishingBuddy.Schools.GetSchools = GetSchools;
+
+FishingBuddy.Schools.Init = function()
+ -- hook into Gatherer
+ SCHOOLS[FBConstants.SCHOOL] = {
+ ["gather"] = TREASURE_FISHNODE,
+ ["kind"] = FBConstants.SCHOOL_FISH,
+ };
+ SCHOOLS[FBConstants.FLOATING_WRECKAGE] = {
+ ["gather"] = TREASURE_FISHWRECK,
+ ["kind"] = FBConstants.SCHOOL_WRECKAGE,
+ };
+ SCHOOLS[FBConstants.FLOATING_DEBRIS] = {
+ ["gather"] = TREASURE_FISHWRECK,
+ ["kind"] = FBConstants.SCHOOL_DEBRIS,
+ };
+ SCHOOLS[FBConstants.ELEM_WATER] = {
+ ["gather"] = TREASURE_FISHELEM,
+ ["kind"] = FBConstants.SCHOOL_WATER,
+ };
+ SCHOOLS[FBConstants.OIL_SPILL] = {
+ ["gather"] = TREASURE_FISHWRECK,
+ ["kind"] = FBConstants.SCHOOL_OIL,
+ };
+end
+
+local function CollapseHoles()
+ if ( FishingBuddy_Info["FishSchools"] ) then
+ local zonecopy = {};
+ for zidx,holes in pairs(FishingBuddy_Info["FishSchools"]) do
+ local copy = {};
+ for _,hole in pairs(holes) do
+ tinsert(copy, hole);
+ end
+ zonecopy[zidx] = copy;
+ end
+ for zidx,holes in pairs(zonecopy) do
+ FishingBuddy_Info["FishSchools"][zidx] = nil;
+ for _,hole in pairs(holes) do
+ if ( hole.fish ) then
+ for f,c in pairs(hole.fish) do
+ for i in pairs(1,c) do
+ AddFishingSchool(hole.kind, f, zidx, hole.x, hole.y);
+ end
+ end
+ else
+ AddFishingSchool(hole.kind, nil, zidx, hole.x, hole.y);
+ end
+ end
+ end
+ end
+end
+FishingBuddy.Schools.CollapseHoles = CollapseHoles;
+
+local SchoolEvents = {};
+SchoolEvents[FBConstants.ADD_FISHIE_EVT] = function(id, zone, subzone)
+ local text = FishingBuddy.LastTooltipText();
+ CheckFishingHole(text, id);
+end
+
+FishingBuddy.API.RegisterHandlers(SchoolEvents);
diff --git a/FishingBuddy/FishingSetup.lua b/FishingBuddy/FishingSetup.lua
new file mode 100644
index 0000000..2050fd3
--- /dev/null
+++ b/FishingBuddy/FishingSetup.lua
@@ -0,0 +1,136 @@
+-- FishingSetup
+--
+-- Load out translation strings and such
+
+FBConstants = {};
+
+FBConstants.CURRENTVERSION = 8901;
+
+FBConstants.Colors = {};
+FBConstants.Colors.RED = "ffff0000";
+FBConstants.Colors.GREEN = "ff00ff00";
+FBConstants.Colors.BLUE = "ff0000ff";
+FBConstants.Colors.YELLOW = "ff00ffff";
+FBConstants.Colors.PURPLE = "ffff00ff";
+FBConstants.Colors.WHITE = "ffffffff";
+
+FBConstants.DEFAULT_MINIMAP_POSITION = 256;
+
+local Setup = {};
+Setup.FixupThis = function(target, tag, what)
+ if ( type(what) == "table" ) then
+ for idx,str in what do
+ what[idx] = Setup.FixupThis(source, target, tag, str);
+ end
+ return what;
+ elseif ( type(what) == "string" ) then
+ local pattern = "#([A-Z0-9_]+)#";
+ local s,e,w = string.find(what, pattern);
+ while ( w ) do
+ if ( type(target[w]) == "string" ) then
+ local s1 = strsub(what, 1, s-1);
+ local s2 = strsub(what, e+1);
+ what = s1..target[w]..s2;
+ s,e,w = string.find(what, pattern);
+ elseif ( FBConstants.Colors and FBConstants.Colors[w] ) then
+ local s1 = strsub(what, 1, s-1);
+ local s2 = strsub(what, e+1);
+ what = s1..FBConstants.Colors[w]..s2;
+ s,e,w = string.find(what, pattern);
+ else
+ -- stop if we can't find something to replace it with
+ w = nil;
+ end
+ end
+ return what;
+ else
+ FishingBuddy.Debug("tag "..tag.." type "..type(what));
+ FishingBuddy.Dump(what);
+ end
+end
+
+Setup.FixupStrings = function(source, locale, target)
+ local translation = source["enUS"];
+ for tag,_ in translation do
+ target[tag] = Setup.FixupThis(target, tag, target[tag]);
+ end
+end
+
+Setup.FixupBindings = function(source, target)
+ local translation = source["enUS"];
+ for tag,str in translation do
+ if ( string.find(tag, "^BINDING") ) then
+ setglobal(tag, target[tag]);
+ target[tag] = nil;
+ end
+ end
+end
+
+local missing = {};
+Setup.LoadTranslation = function(source, lang, target, record)
+ local translation = source[lang];
+ for tag,value in translation do
+ if ( not target[tag] ) then
+ target[tag] = value;
+ if ( record ) then
+ missing[tag] = 1;
+ end
+ end
+ end
+end
+
+Setup.Translate = function(addon, source, target)
+ local locale = GetLocale();
+ if ( FBEnEspagnolFlag ) then
+ locale = "esES";
+ end
+ --locale = "deDE";
+ target.VERSION = GetAddOnMetadata(addon, "Version");
+ Setup.LoadTranslation(source, locale, target);
+ if ( locale ~= "enUS" ) then
+ Setup.LoadTranslation(source, "enUS", target);
+ end
+ Setup.FixupStrings(source, locale, target);
+ Setup.FixupBindings(source, target);
+end
+
+Setup.Translate("FishingBuddy", FishingTranslations, FBConstants);
+
+-- Let the plugins use this
+FishingBuddy.Setup = Setup;
+
+-- dump the memory we've allocated for all the translations
+FishingTranslations = nil;
+
+FBConstants.KEYS_NONE = 0;
+FBConstants.KEYS_SHIFT = 1;
+FBConstants.KEYS_CTRL = 2;
+FBConstants.KEYS_ALT = 3;
+FBConstants.Keys = {};
+FBConstants.Keys[FBConstants.KEYS_NONE] = FBConstants.KEYS_NONE_TEXT;
+FBConstants.Keys[FBConstants.KEYS_SHIFT] = FBConstants.KEYS_SHIFT_TEXT;
+FBConstants.Keys[FBConstants.KEYS_CTRL] = FBConstants.KEYS_CTRL_TEXT;
+FBConstants.Keys[FBConstants.KEYS_ALT] = FBConstants.KEYS_ALT_TEXT;
+
+FBConstants.BROADCAST_DUMP = 0;
+FBConstants.BROADCAST_RECV = 1;
+FBConstants.Broadcast = {};
+FBConstants.Broadcast[FBConstants.BROADCAST_DUMP] = FBConstants.BROADCAST_DUMP_TEXT;
+FBConstants.Broadcast[FBConstants.BROADCAST_RECV] = FBConstants.BROADCAST_RECV_TEXT;
+
+FBConstants.SCHOOL_FISH = 0;
+FBConstants.SCHOOL_WRECKAGE = 1;
+FBConstants.SCHOOL_DEBRIS = 2;
+FBConstants.SCHOOL_WATER = 3;
+FBConstants.SCHOOL_TASTY = 4;
+FBConstants.SCHOOL_OIL = 5;
+
+FBConstants.WILDCARD_EVT = "*";
+FBConstants.ADD_FISHIE_EVT = "ADD_FISHIE";
+FBConstants.UIERROR_EVT = "UI_ERROR";
+
+FBConstants.FBEvents = {};
+FBConstants.FBEvents[FBConstants.WILDCARD_EVT] = 1;
+FBConstants.FBEvents[FBConstants.ADD_FISHIE_EVT] = 1;
+FBConstants.FBEvents[FBConstants.UIERROR_EVT] = 1;
+
diff --git a/FishingBuddy/FishingWatcher.lua b/FishingBuddy/FishingWatcher.lua
new file mode 100644
index 0000000..fba6671
--- /dev/null
+++ b/FishingBuddy/FishingWatcher.lua
@@ -0,0 +1,406 @@
+-- Display the fish you're catching and/or have caught in a live display
+
+FishingBuddy.WatchFrame = {};
+
+local MAX_FISHINGWATCH_LINES = 20;
+local WATCHDRAGGER_SHOW_DELAY = 0.2;
+
+local WATCHDRAGGER_FADE_TIME = 0.15;
+
+local function PlaceDraggerFrame()
+ local where = FishingBuddy.GetSetting("WatcherLocation");
+ if ( not where ) then
+ where = {};
+ where.x = 0;
+ where.y = -384;
+ end
+ FishingWatchDrag:ClearAllPoints();
+ FishingWatchDrag:SetPoint("TOPLEFT", "UIParent", "TOPLEFT",
+ where.x, where.y);
+end
+
+local function ShowDraggerFrame()
+ if ( not FishingWatchDrag:IsVisible() ) then
+ FishingWatchFrame:Show();
+ local width = FishingWatchFrame:GetWidth();
+ local height = FishingWatchFrame:GetHeight();
+ FishingWatchDrag:SetHeight(height);
+ FishingWatchDrag:SetWidth(width);
+ FishingWatchTab:SetText(FBConstants.NAME);
+ PanelTemplates_TabResize(10, FishingWatchTab);
+ FishingWatchDrag:Show();
+ FishingWatchTab:Show();
+ UIFrameFadeIn(FishingWatchDrag, WATCHDRAGGER_FADE_TIME, 0, 0.15);
+ UIFrameFadeIn(FishingWatchTab, WATCHDRAGGER_FADE_TIME, 0, 1.0);
+ GameTooltip_AddNewbieTip(FBConstants.NAME, 1.0, 1.0, 1.0,
+ FBConstants.WATCHERCLICKHELP, 1);
+ end
+end
+
+local function HideDraggerFrame(save)
+ if ( FishingWatchDrag:IsVisible() ) then
+ if ( save ) then
+ FishingWatchFrame:Show();
+ local qx = UIParent:GetLeft()
+ local qy = UIParent:GetTop();
+ local wx = FishingWatchDrag:GetLeft()
+ local wy = FishingWatchDrag:GetTop();
+ local where;
+ if ( wx and wy ) then
+ where = {};
+ where.x = wx - qx;
+ where.y = wy - qy;
+ end
+ FishingBuddy.SetSetting("WatcherLocation", where);
+ end
+ UIFrameFadeOut(FishingWatchDrag, WATCHDRAGGER_FADE_TIME, 0.15, 0);
+ UIFrameFadeOut(FishingWatchTab, WATCHDRAGGER_FADE_TIME, 1.0, 0);
+ FishingWatchDrag:Hide();
+ FishingWatchTab:Hide();
+ GameTooltip:Hide();
+ end
+end
+
+local function ResetWatcherFrame(update)
+ FishingWatchTab:Show();
+ FishingWatchDrag:Show();
+ FishingWatchDrag:ClearAllPoints();
+ FishingWatchDrag:SetPoint("CENTER", "UIParent", "CENTER", 0, 0);
+ HideDraggerFrame(true);
+ if ( update ) then
+ FishingBuddy.WatchUpdate();
+ end
+end
+
+FishingBuddy.ShowDraggerFrame = ShowDraggerFrame;
+FishingBuddy.HideDraggerFrame = HideDraggerFrame;
+FishingBuddy.PlaceDraggerFrame = PlaceDraggerFrame;
+FishingBuddy.ResetWatcherFrame = ResetWatcherFrame;
+
+FishingBuddy.Commands[FBConstants.WATCHER] = {};
+FishingBuddy.Commands[FBConstants.WATCHER].help = FBConstants.WATCHER_HELP;
+FishingBuddy.Commands[FBConstants.WATCHER].func =
+ function(what)
+ if ( what and ( what == FBConstants.RESET ) ) then
+ ResetWatcherFrame(true);
+ return true;
+ end
+ end;
+
+-- fix old data
+local function UpdateUnknownZone(zone, subzone, zidx, sidx)
+ local uzidx = FishingBuddy.GetZoneIndex(FBConstants.UNKNOWN);
+ if ( uzidx ) then
+ local fh = FishingBuddy_Info["FishingHoles"];
+ for usidx in pairs(fh[uzidx]) do
+ local uszone = FishingBuddy_Info["SubZones"][uzidx][usidx];
+ if ( uszone == subzone ) then
+ for k,v in pairs(fh[uzidx][usidx]) do
+ if ( fh[zidx][sidx][k] ) then
+ fh[zidx][sidx][k] = fh[zidx][sidx][k] + v;
+ else
+ fh[zidx][sidx][k] = v;
+ end
+ end
+ for k,_ in pairs(fh[uzidx][usidx]) do
+ fh[uzidx][usidx][k] = nil;
+ end
+ end
+ end
+ end
+end
+
+-- Fish watcher functions
+local function WatchUpdate()
+ if ( FishingWatchFrame:IsVisible() ) then
+ HideDraggerFrame();
+ FishingWatchFrame:Hide();
+ for i=1, MAX_FISHINGWATCH_LINES, 1 do
+ local line = getglobal("FishingWatchLine"..i);
+ line:Hide();
+ end
+ end
+
+ local reset = FishingBuddy.GetSetting("ResetWatcher");
+ if ( not reset or reset < 1 ) then
+ ResetWatcherFrame(false);
+ FishingBuddy.SetSetting("ResetWatcher", 1);
+ end
+
+ local zone, subzone = FishingBuddy.GetZoneInfo();
+ local zidx, sidx = FishingBuddy.GetZoneIndex(zone, subzone);
+
+ UpdateUnknownZone();
+
+ if ( FishingBuddy.GetSetting("WatchFishies") == 0 ) then
+ return;
+ end
+
+ if ( FishingBuddy.GetSetting("WatchOnlyWhenFishing") == 1 and
+ not FishingBuddy.API.IsFishingPole() ) then
+ return;
+ end
+
+ local fz = FishingBuddy_Info["FishingHoles"][zidx];
+ local current = FishingBuddy.currentFishies;
+ local ff = FishingBuddy_Info["Fishies"];
+ local fishsort = {};
+ local totalCount = 0;
+ local totalCurrent = 0;
+ local gotDiffs = false;
+
+ if ( fz and fz[sidx] ) then
+ for fishid in fz[sidx] do
+ local info = {};
+ if ( not FishingBuddy_Info["HiddenFishies"][fishid] ) then
+ info.text = ff[fishid].name;
+ end
+ info.count = fz[sidx][fishid];
+ totalCount = totalCount + info.count;
+ if ( current[sidx] ) then
+ info.current = current[sidx][fishid] or 0;
+ else
+ info.current = 0;
+ end
+ if ( info.current > 0 and info.current ~= info.count ) then
+ gotDiffs = true;
+ end
+ totalCurrent = totalCurrent + info.current;
+ tinsert(fishsort, info);
+ end
+
+-- if ( totalCount == 0 and totalCurrent == 0 ) then
+-- return;
+-- end
+
+ FishingBuddy.FishSort(fishsort);
+ end
+
+ local fishingWatchMaxWidth = 0;
+ local tempWidth;
+ local index = 1;
+ local start = 1;
+ local dopercent = FishingBuddy.GetSetting("WatchFishPercent");
+
+ if ( FishingBuddy.GetSetting("WatchCurrentZone") == 1 ) then
+ local entry = getglobal("FishingWatchLine"..index);
+ local line = zone.." : "..subzone;
+ entry:SetText(line);
+ local tempWidth = entry:GetWidth();
+ if ( tempWidth > fishingWatchMaxWidth ) then
+ fishingWatchMaxWidth = tempWidth;
+ end
+ entry:Show();
+ index = index + 1;
+ end
+ if ( FishingBuddy.GetSetting("WatchCurrentSkill") == 1 ) then
+ local entry = getglobal("FishingWatchLine"..index);
+ local skill, mods = FishingBuddy.GetCurrentSkill();
+ local line = "Skill: |cff00ff00"..skill.."+"..mods.."|r";
+ local StartedFishing = FishingBuddy.StartedFishing;
+ if ( StartedFishing ) then
+ local elapsed = GetTime() - StartedFishing;
+ local t = math.floor(elapsed);
+ local seconds = math.mod(t, 60);
+ t = math.floor(t / 60);
+ local minutes = math.mod(t, 60);
+ local hours = math.floor(t / 60);
+ line = line.." Elapsed: ";
+ if ( hours < 10 ) then
+ line = line.."0";
+ end
+ line = line..hours..":";
+ if ( minutes < 10 ) then
+ line = line.."0";
+ end
+ line = line..minutes..":";
+ if ( seconds < 10 ) then
+ line = line.."0";
+ end
+ line = line..seconds;
+ end
+
+ entry:SetText(line);
+ local tempWidth = entry:GetWidth();
+ if ( tempWidth > fishingWatchMaxWidth ) then
+ fishingWatchMaxWidth = tempWidth;
+ end
+ entry:Show();
+ index = index + 1;
+ end
+
+ for j=1,table.getn(fishsort),1 do
+ local info = fishsort[j];
+ if( index <= MAX_FISHINGWATCH_LINES ) then
+ local entry = getglobal("FishingWatchLine"..index);
+ local fishie = info.text;
+ if ( fishie ) then
+ fishie = FishingBuddy.StripRaw(fishie);
+ local amount = info.count;
+ local fishietext = fishie.." ("..amount;
+ if ( dopercent == 1 ) then
+ local percent = format("%.1f", ( amount / totalCount ) * 100);
+ fishietext = fishietext.." : "..percent.."%";
+ end
+ if ( gotDiffs ) then
+ amount = info.current;
+ local color;
+ fishietext = fishietext..", |c"..FBConstants.Colors.GREEN..amount;
+ if ( dopercent == 1 ) then
+ local percent = format("%.1f", ( amount / totalCurrent ) * 100);
+ fishietext = fishietext.." : "..percent.."%";
+ end
+ fishietext = fishietext.."|r";
+ end
+ fishietext = fishietext..")";
+ entry:SetText(fishietext);
+ tempWidth = entry:GetWidth();
+ entry:Show();
+ if ( tempWidth > fishingWatchMaxWidth ) then
+ fishingWatchMaxWidth = tempWidth;
+ end
+ index = index + 1;
+ end
+ end
+ end
+
+ FishingWatchFrame:SetHeight((index - 1) * 13);
+ FishingWatchFrame:SetWidth(fishingWatchMaxWidth + 10);
+ ShowDraggerFrame();
+ PlaceDraggerFrame();
+ FishingWatchFrame:Show();
+end
+FishingBuddy.WatchUpdate = WatchUpdate;
+
+local WatchEvents = {};
+WatchEvents["MINIMAP_ZONE_CHANGED"] = function()
+ if ( not FishingBuddy.IsLoaded() ) then
+ return;
+ end
+ FishingBuddy.currentFishies = {};
+ WatchUpdate();
+end
+
+WatchEvents["SKILL_LINES_CHANGED"] = function()
+ if ( FishingBuddy.GetSetting("WatchCurrentSkill") == 1 ) then
+ WatchUpdate();
+ end
+end
+
+WatchEvents["SPELLCAST_STOP"] = function()
+ if ( FishingWatchFrame:IsVisible() ) then
+ -- update the skill line if we have one
+ if ( FishingBuddy.GetSetting("WatchCurrentSkill") == 1 ) then
+ WatchUpdate();
+ end
+ end
+end
+
+WatchEvents[FBConstants.ADD_FISHIE_EVT] = function()
+ if ( FishingWatchFrame:IsVisible() ) then
+ WatchUpdate();
+ end
+end
+
+FishingBuddy.WatchFrame.OnLoad = function()
+ this:ClearAllPoints();
+ this:SetPoint("TOPLEFT", "FishingWatchDrag", "TOPLEFT", 0, 0);
+
+ -- Make everything draw at least once
+ FishingWatchDrag:Show();
+ FishingWatchTab:Show();
+ FishingWatchDrag:Hide();
+ FishingWatchTab:Hide();
+
+ FishingBuddy.API.RegisterHandlers(WatchEvents);
+end
+
+local hover;
+FishingBuddy.WatchFrame.OnUpdate = function(elapsed)
+ if ( FishingWatchFrame:IsVisible() ) then
+ if ( MouseIsOver(FishingWatchFrame) or
+ ( FishingWatchTab:IsVisible() and MouseIsOver(FishingWatchTab) ) ) then
+ local xPos, yPos = GetCursorPosition();
+ if ( hover ) then
+ if ( hover.xPos == xPos and hover.yPos == yPos ) then
+ hover.hoverTime = hover.hoverTime + elapsed;
+ else
+ hover.hoverTime = 0;
+ hover.xPos = xPos;
+ hover.yPos = yPos;
+ end
+ else
+ hover = {};
+ hover.hoverTime = 0;
+ hover.xPos = xPos;
+ hover.yPos = yPos;
+ end
+ if ( hover.hoverTime > WATCHDRAGGER_SHOW_DELAY ) then
+ ShowDraggerFrame();
+ end
+ else
+ HideDraggerFrame(true);
+ hover = nil;
+ end
+ elseif ( hover ) then
+ HideDraggerFrame(true);
+ hover = nil;
+ end
+end
+
+FishingBuddy.WatchFrame.OnMouseDown = function()
+ if ( arg1 == "LeftButton" ) then
+ FishingWatchDrag:StartMoving();
+ end
+end
+
+FishingBuddy.WatchFrame.OnMouseUp = function()
+ if ( arg1 == "LeftButton" ) then
+ FishingWatchDrag:StopMovingOrSizing();
+ end
+end
+
+local function HiddenFishToggle(id)
+ if ( FishingBuddy_Info["HiddenFishies"][id] ) then
+ FishingBuddy_Info["HiddenFishies"][id] = nil;
+ else
+ FishingBuddy_Info["HiddenFishies"][id] = true;
+ end;
+ FishingBuddy.WatchUpdate();
+end
+
+-- save some memory by keeping one copy of each one
+local WatcherToggleFunctions = {};
+-- let's use closures
+local function WatcherMakeToggle(fishid)
+ if ( not WatcherToggleFunctions[fishid] ) then
+ local id = fishid;
+ WatcherToggleFunctions[fishid] = function() HiddenFishToggle(id); end;
+ end
+ return WatcherToggleFunctions[fishid];
+end
+FishingBuddy.WatchFrame.MakeToggle = WatcherMakeToggle;
+
+local function WatchMenu_Initialize()
+ local zidx, sidx = FishingBuddy.GetZoneIndex();
+ local fz = FishingBuddy_Info["FishingHoles"][zidx];
+ if ( fz and fz[sidx] ) then
+ local ff = FishingBuddy_Info["Fishies"];
+ for fishid in fz[sidx] do
+ info = {};
+ info.text = ff[fishid].name;
+ info.func = WatcherMakeToggle(fishid);
+ info.checked = ( not FishingBuddy_Info["HiddenFishies"][fishid] );
+ info.keepShownOnClick = 1;
+ UIDropDownMenu_AddButton(info);
+ end
+ end
+end
+
+FishingBuddy.WatchFrame.OnClick = function()
+ if ( arg1 == "RightButton" ) then
+ local menu = getglobal("FishingBuddyWatcherMenu");
+ UIDropDownMenu_Initialize(menu, WatchMenu_Initialize, "MENU");
+ ToggleDropDownMenu(1, nil, menu, "FishingWatchDrag", 0, 0);
+ end
+end
diff --git a/FishingBuddy/FishingWatcher.xml b/FishingBuddy/FishingWatcher.xml
new file mode 100644
index 0000000..a7ecdfe
--- /dev/null
+++ b/FishingBuddy/FishingWatcher.xml
@@ -0,0 +1,258 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ this:RegisterForClicks("RightButtonUp");
+
+
+ FishingBuddy.WatchFrame.OnClick();
+
+
+ FishingBuddy.WatchFrame.OnMouseDown();
+
+
+ FishingBuddy.WatchFrame.OnMouseUp();
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ this:RegisterForClicks("RightButtonUp");
+
+
+ FishingBuddy.WatchFrame.OnClick();
+
+
+ FishingBuddy.WatchFrame.OnMouseDown();
+
+
+ FishingBuddy.WatchFrame.OnMouseUp();
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ this:SetFrameLevel(0);
+ UIDropDownMenu_SetWidth(180);
+
+
+
+
+
+
+ FishingBuddy.WatchFrame.OnLoad();
+
+
+ FishingBuddy.WatchFrame.OnUpdate(arg1);
+
+
+
+
diff --git a/FishingBuddy/Icons/Fishing-Icon.tga b/FishingBuddy/Icons/Fishing-Icon.tga
new file mode 100644
index 0000000..0e86986
Binary files /dev/null and b/FishingBuddy/Icons/Fishing-Icon.tga differ
diff --git a/FishingBuddy/Icons/MiniMapArrow.blp b/FishingBuddy/Icons/MiniMapArrow.blp
new file mode 100644
index 0000000..f7f42d9
Binary files /dev/null and b/FishingBuddy/Icons/MiniMapArrow.blp differ
diff --git a/FishingBuddy/Icons/MiniMapArrow0.tga b/FishingBuddy/Icons/MiniMapArrow0.tga
new file mode 100644
index 0000000..9046d30
Binary files /dev/null and b/FishingBuddy/Icons/MiniMapArrow0.tga differ
diff --git a/FishingBuddy/Icons/MiniMapArrow10.tga b/FishingBuddy/Icons/MiniMapArrow10.tga
new file mode 100644
index 0000000..9f580d3
Binary files /dev/null and b/FishingBuddy/Icons/MiniMapArrow10.tga differ
diff --git a/FishingBuddy/Icons/MiniMapArrow100.tga b/FishingBuddy/Icons/MiniMapArrow100.tga
new file mode 100644
index 0000000..f55eb64
Binary files /dev/null and b/FishingBuddy/Icons/MiniMapArrow100.tga differ
diff --git a/FishingBuddy/Icons/MiniMapArrow110.tga b/FishingBuddy/Icons/MiniMapArrow110.tga
new file mode 100644
index 0000000..156d447
Binary files /dev/null and b/FishingBuddy/Icons/MiniMapArrow110.tga differ
diff --git a/FishingBuddy/Icons/MiniMapArrow120.tga b/FishingBuddy/Icons/MiniMapArrow120.tga
new file mode 100644
index 0000000..11f277d
Binary files /dev/null and b/FishingBuddy/Icons/MiniMapArrow120.tga differ
diff --git a/FishingBuddy/Icons/MiniMapArrow130.tga b/FishingBuddy/Icons/MiniMapArrow130.tga
new file mode 100644
index 0000000..6cb802b
Binary files /dev/null and b/FishingBuddy/Icons/MiniMapArrow130.tga differ
diff --git a/FishingBuddy/Icons/MiniMapArrow140.tga b/FishingBuddy/Icons/MiniMapArrow140.tga
new file mode 100644
index 0000000..077af19
Binary files /dev/null and b/FishingBuddy/Icons/MiniMapArrow140.tga differ
diff --git a/FishingBuddy/Icons/MiniMapArrow150.tga b/FishingBuddy/Icons/MiniMapArrow150.tga
new file mode 100644
index 0000000..83cff32
Binary files /dev/null and b/FishingBuddy/Icons/MiniMapArrow150.tga differ
diff --git a/FishingBuddy/Icons/MiniMapArrow160.tga b/FishingBuddy/Icons/MiniMapArrow160.tga
new file mode 100644
index 0000000..ed709e5
Binary files /dev/null and b/FishingBuddy/Icons/MiniMapArrow160.tga differ
diff --git a/FishingBuddy/Icons/MiniMapArrow170.tga b/FishingBuddy/Icons/MiniMapArrow170.tga
new file mode 100644
index 0000000..11ddd43
Binary files /dev/null and b/FishingBuddy/Icons/MiniMapArrow170.tga differ
diff --git a/FishingBuddy/Icons/MiniMapArrow180.tga b/FishingBuddy/Icons/MiniMapArrow180.tga
new file mode 100644
index 0000000..abc2f1c
Binary files /dev/null and b/FishingBuddy/Icons/MiniMapArrow180.tga differ
diff --git a/FishingBuddy/Icons/MiniMapArrow190.tga b/FishingBuddy/Icons/MiniMapArrow190.tga
new file mode 100644
index 0000000..9493656
Binary files /dev/null and b/FishingBuddy/Icons/MiniMapArrow190.tga differ
diff --git a/FishingBuddy/Icons/MiniMapArrow20.tga b/FishingBuddy/Icons/MiniMapArrow20.tga
new file mode 100644
index 0000000..311fcb8
Binary files /dev/null and b/FishingBuddy/Icons/MiniMapArrow20.tga differ
diff --git a/FishingBuddy/Icons/MiniMapArrow200.tga b/FishingBuddy/Icons/MiniMapArrow200.tga
new file mode 100644
index 0000000..0906eff
Binary files /dev/null and b/FishingBuddy/Icons/MiniMapArrow200.tga differ
diff --git a/FishingBuddy/Icons/MiniMapArrow210.tga b/FishingBuddy/Icons/MiniMapArrow210.tga
new file mode 100644
index 0000000..3fc2b8f
Binary files /dev/null and b/FishingBuddy/Icons/MiniMapArrow210.tga differ
diff --git a/FishingBuddy/Icons/MiniMapArrow220.tga b/FishingBuddy/Icons/MiniMapArrow220.tga
new file mode 100644
index 0000000..462226e
Binary files /dev/null and b/FishingBuddy/Icons/MiniMapArrow220.tga differ
diff --git a/FishingBuddy/Icons/MiniMapArrow230.tga b/FishingBuddy/Icons/MiniMapArrow230.tga
new file mode 100644
index 0000000..ee166ff
Binary files /dev/null and b/FishingBuddy/Icons/MiniMapArrow230.tga differ
diff --git a/FishingBuddy/Icons/MiniMapArrow240.tga b/FishingBuddy/Icons/MiniMapArrow240.tga
new file mode 100644
index 0000000..eac0c3d
Binary files /dev/null and b/FishingBuddy/Icons/MiniMapArrow240.tga differ
diff --git a/FishingBuddy/Icons/MiniMapArrow250.tga b/FishingBuddy/Icons/MiniMapArrow250.tga
new file mode 100644
index 0000000..75b96cc
Binary files /dev/null and b/FishingBuddy/Icons/MiniMapArrow250.tga differ
diff --git a/FishingBuddy/Icons/MiniMapArrow260.tga b/FishingBuddy/Icons/MiniMapArrow260.tga
new file mode 100644
index 0000000..561c932
Binary files /dev/null and b/FishingBuddy/Icons/MiniMapArrow260.tga differ
diff --git a/FishingBuddy/Icons/MiniMapArrow270.tga b/FishingBuddy/Icons/MiniMapArrow270.tga
new file mode 100644
index 0000000..3eb4c43
Binary files /dev/null and b/FishingBuddy/Icons/MiniMapArrow270.tga differ
diff --git a/FishingBuddy/Icons/MiniMapArrow280.tga b/FishingBuddy/Icons/MiniMapArrow280.tga
new file mode 100644
index 0000000..53df2b0
Binary files /dev/null and b/FishingBuddy/Icons/MiniMapArrow280.tga differ
diff --git a/FishingBuddy/Icons/MiniMapArrow290.tga b/FishingBuddy/Icons/MiniMapArrow290.tga
new file mode 100644
index 0000000..58b08fe
Binary files /dev/null and b/FishingBuddy/Icons/MiniMapArrow290.tga differ
diff --git a/FishingBuddy/Icons/MiniMapArrow30.tga b/FishingBuddy/Icons/MiniMapArrow30.tga
new file mode 100644
index 0000000..0892650
Binary files /dev/null and b/FishingBuddy/Icons/MiniMapArrow30.tga differ
diff --git a/FishingBuddy/Icons/MiniMapArrow300.tga b/FishingBuddy/Icons/MiniMapArrow300.tga
new file mode 100644
index 0000000..a876d68
Binary files /dev/null and b/FishingBuddy/Icons/MiniMapArrow300.tga differ
diff --git a/FishingBuddy/Icons/MiniMapArrow310.tga b/FishingBuddy/Icons/MiniMapArrow310.tga
new file mode 100644
index 0000000..5a99a45
Binary files /dev/null and b/FishingBuddy/Icons/MiniMapArrow310.tga differ
diff --git a/FishingBuddy/Icons/MiniMapArrow320.tga b/FishingBuddy/Icons/MiniMapArrow320.tga
new file mode 100644
index 0000000..05bb867
Binary files /dev/null and b/FishingBuddy/Icons/MiniMapArrow320.tga differ
diff --git a/FishingBuddy/Icons/MiniMapArrow330.tga b/FishingBuddy/Icons/MiniMapArrow330.tga
new file mode 100644
index 0000000..74d8087
Binary files /dev/null and b/FishingBuddy/Icons/MiniMapArrow330.tga differ
diff --git a/FishingBuddy/Icons/MiniMapArrow340.tga b/FishingBuddy/Icons/MiniMapArrow340.tga
new file mode 100644
index 0000000..142b779
Binary files /dev/null and b/FishingBuddy/Icons/MiniMapArrow340.tga differ
diff --git a/FishingBuddy/Icons/MiniMapArrow350.tga b/FishingBuddy/Icons/MiniMapArrow350.tga
new file mode 100644
index 0000000..e05593b
Binary files /dev/null and b/FishingBuddy/Icons/MiniMapArrow350.tga differ
diff --git a/FishingBuddy/Icons/MiniMapArrow40.tga b/FishingBuddy/Icons/MiniMapArrow40.tga
new file mode 100644
index 0000000..c2bbf91
Binary files /dev/null and b/FishingBuddy/Icons/MiniMapArrow40.tga differ
diff --git a/FishingBuddy/Icons/MiniMapArrow50.tga b/FishingBuddy/Icons/MiniMapArrow50.tga
new file mode 100644
index 0000000..e161fd4
Binary files /dev/null and b/FishingBuddy/Icons/MiniMapArrow50.tga differ
diff --git a/FishingBuddy/Icons/MiniMapArrow60.tga b/FishingBuddy/Icons/MiniMapArrow60.tga
new file mode 100644
index 0000000..a5398f2
Binary files /dev/null and b/FishingBuddy/Icons/MiniMapArrow60.tga differ
diff --git a/FishingBuddy/Icons/MiniMapArrow70.tga b/FishingBuddy/Icons/MiniMapArrow70.tga
new file mode 100644
index 0000000..3c6c756
Binary files /dev/null and b/FishingBuddy/Icons/MiniMapArrow70.tga differ
diff --git a/FishingBuddy/Icons/MiniMapArrow80.tga b/FishingBuddy/Icons/MiniMapArrow80.tga
new file mode 100644
index 0000000..fcc499a
Binary files /dev/null and b/FishingBuddy/Icons/MiniMapArrow80.tga differ
diff --git a/FishingBuddy/Icons/MiniMapArrow90.tga b/FishingBuddy/Icons/MiniMapArrow90.tga
new file mode 100644
index 0000000..145dc6e
Binary files /dev/null and b/FishingBuddy/Icons/MiniMapArrow90.tga differ
diff --git a/FishingBuddy/changes.txt b/FishingBuddy/changes.txt
new file mode 100644
index 0000000..4c2434d
--- /dev/null
+++ b/FishingBuddy/changes.txt
@@ -0,0 +1,267 @@
+Version 0.8.9
+- Send a fish caught message using the new SendAddonMessage API
+- Fix a bug where saving the outfit manager wasn't working (Thanks dwex!)
+- Style points are back (and in OutfitDisplayFrame tooltips -- thanks Shadrin!)
+- Update 'for' loops to be compatible with Lua 5.1
+- Updated German translation (thanks Chinkuwaila!)
+
+Version 0.8.8d
+- Update toc for patch 1.12
+- Small cleanup changes
+
+Version 0.8.8c
+- Handle "Oil Spills" as fishing pools
+- Fix an intermittent text alignment bug in the locations window
+- Make FishingBuddyFu for Fubar 2.0 work nicely (mostly expose some functions)
+
+Version 0.8.8b
+- Add tracking selection menu to locations window
+
+Version 0.8.8a
+- Fix a nil error in the tracking popup if you haven't caught one of the
+ default fish
+- '/fb updatedb' print out a message
+- Grab the names of fish we catch if we don't know it already (old data updating)
+
+Version 0.8.8
+- Improved cycle fish tracking -- right-click to choose fish to graph
+- Update the TastyFish count every time the window is shown during the
+ Exravaganza so that our count is always 'right'
+- Fix window always showing bug
+
+Version 0.8.7g
+- Fix a typo introduced in version f
+- Really, really check for Pat Nagle's Fish Terminator correctly (thanks Saur!)
+
+Version 0.8.7f
+- Put changes from d and e into the same release
+
+Version 0.8.7g
+- Fix a typo introduced in version f
+- Really, really check for Pat Nagle's Fish Terminator correctly
+
+Version 0.8.7f
+- Put changes from d and e into the same release
+
+Version 0.8.7e
+- Fix missing color 'YELLOW'
+- Fix translation errors that were causing string.format errors in German and Spanish
+- Fix problems with the Terminator
+
+Version 0.8.7d
+- Fix broken minimap enable logic for menus
+- Fix nil error in startup conversion of old versions
+
+Version 0.8.7c
+- Fix incompatibility with version 1.11 and highlight text
+
+Version 0.8.7b
+- Clean up event handling some more (only listen when we're fishing)
+- Fix 'doubled' fishing location display for new fishing areas
+
+Version 0.8.7a
+- Hopefully fix an intermittent bug that crashes the client during
+ the Extravaganza when leaving Booty Bay
+- Stop losing the OutfitDisplayFrame outfit when logging out
+- Should correctly reset the Watcher Window for all toons
+- Add in 'FBEnEspagnol' for Spanish-speaking fisherbuddies
+- Use the now-builtin Outfitter 'find by stat' function
+
+Version 0.8.7
+- Integration with Gatherer (depends on the tooltip when you cast)
+- Add a 'hide these icky fish' menu to the watcher window
+- Put the keybinding for 'Suit Up and Go Fishing!' back in
+- Add an option to only fish from pools during the Extravaganza
+- Better (and more) French translation support from krogh
+- Rework debugging output so that people don't get surprised by it anymore
+- Rework zone and subzone storage to reduce space
+- Don't save default values (smaller saved vars, faster loading)
+- Tune event handling for faster world transitions
+- Move a lot of information into tooltips in the display window
+- Removed 'Fast Cast' again since patch 1.10.1 breaks it
+- Fix translation loader to actually work (even in English!)
+- Rewrite Extravaganza code and hopefully fix the crashes
+- Add an offset menu to handle differences between game and machine time
+- Fix the display bug when switching between locations and fishes
+- If more than one outfit switcher is available, allow a choice
+- Don't allow a recast if the fishing loot window is up
+- Add 'updatedb' command to link info for fish with missing data (can disconnect!)
+
+Version 0.8.6h
+- Fast Cast is back!
+
+Version 0.8.6g
+- Fixed a nil reference bug in binding the keys that happens to some people (but
+ this makes easy cast not work, I still need to figure out what's happening)
+- Made the Fish Watcher window relative to UIParent and implement 'hover' dragging
+- Fixed the right-click menu in InfoBar support
+- Made click-to-move support a little more predictable. If you don't have a casting
+ modifer set, then click-to-move is turned off while you're fishing.
+
+Version 0.8.6f
+- Remove some debugging that broke when DevTools wasn't installed
+
+Version 0.8.6e
+- Easy Cast is back (Fast Cast is no more). Thanks to the Cosmos team who
+ figured out the appropriate place for hooking in the handling code -- it
+ was a snap to add in!
+- Removed the "Suit up and go fishing" stuff since we don't need it any more
+
+Version 0.8.6d
+- Fix a bunch of small errors that never showed up before
+- Add 'mouse fishing' option that binds the middle button (BUTTON3) to
+ 'cast now' (may not be necessary since 'Suit up and go fishing' works...)
+
+Version 0.8.6c
+- Mark OutfitDisplayFrame as version 1.10 compatible
+
+Version 0.8.6b
+- Update for patch 1.10 (11000)
+- Partial Spanish translation, thanks to fili
+- Some fixes that now don't make much difference because of 1.10
+
+Version 0.8.6a
+- Fixes for handling Eternium enchant correctly
+- Fix bug in 'Suit up and go fishing' handler
+
+Version 0.8.6
+- Rework easy cast to work with 1.10 -- no dice yet though :-(
+- Add "Suit up and go fishing" binding for an alternate 1.10 when "Easy Cast" no longer works
+- Outfitter support
+- Translation handling completely rewritten to eliminate missing strings
+ in translations
+- Fix for Eternium Line enchant (the tooltip string changed)
+
+Version 0.8.5g
+- Include OutfitDisplayFrame fix for nil error when fewer than five bags
+
+Version 0.8.5f
+- Auto-set sound volumes to make the bobber noise stand out (Good suggestion SBaL!)
+
+Version 0.8.5e
+- Don't count "Nat Pagle's Fish Terminator" as a fishing pole, even if it looks like one
+
+Version 0.8.5d
+- Fix a nil error in comparison after we've shrunk a table
+
+Version 0.8.5c
+- Fix nil error in cleanup command
+- Missing string in French translation for checking not to lure while clicking on the
+ bobber (it's still not the right translation though, hint hint!)
+
+Version 0.8.5b
+- Handle defaulting to 'English' correctly if we don't have a valid translation
+
+Version 0.8.5a
+- Fix French localization file
+
+Version 0.8.5
+- Add partial French translation, thanks to Corwin Whitehorn
+- Support for Titan v2.08
+- Support for InfoBar
+- Rewritten to drastically reduce global namespace pollution
+- Rewrote database displays to reduce memory usage
+- Use item ids instead of names in fish database to make things smaller
+- Rewritten graphing subsystem for future improvements
+- Use per-character variable saving to simplify data access and structures
+- Added 'cleanup' command to remove stale settings
+- Add modifier key support for easy cast
+- Show number of Tastyfish caught so far
+- Add partial French translation, thanks to Corwin Whitehorn
+- Try supporting ModWatcher
+- Fix for menu popup outside of minimap button
+- Don't do 'easy lures' if we're about to click on the bobber
+
+Version 0.8.4f
+- Change line endings to DOS again, seems to fix some LUA loading errors
+- Fix location scrollbar position for 1.9
+- Update to new numbering scheme for version
+- Fix a bug catching tracking fish in the last week of the year
+- Fix some small bugs that affect brand-new toons
+- Notice if we can't display fish tooltips instead of disconnecting
+- Fix bug where bringing up the outfit window would lose
+ what you were wearing before
+- Fishing Extravaganza countdown timer
+- Keep track of Tastyfish "schooling" locations
+
+Version 0.8.3
+- Update style and skill messages in outfit display to handle new 'dressing room' feature
+- Make sure that errors in switching outfits don't erase what we changed out of
+- Handle elapsed time even if OutfitDisplayFrame is disabled
+- Make sure we're not already switching outfits before we try again
+- Improved ButtonHole support
+
+Version 0.8.2
+- 'Cycle fish' graphs for the main cycle fish (additional fish coming soon)
+- New minimap button support
+- Display current zone in the fish watcher
+- Show elapsed time in the fish watcher (not perfect yet)
+- Fish watcher frame is moveable
+- Support for 'auto fishing lures'
+- Style points added for some of the Extravaganza rewards
+- Improved support for languages (removed static strings)
+- Support for 'ButtonHole' -- if that addon gets finished it'll be way cool
+- OutfitDisplayFrame support improved
+
+Version 0.8.1d
+- Better German help. Thanks blackrat!
+- '/fb import' import information from Impp's fishinfo, DataFish, or Fishinfo2 databases
+- '/fb current reset' to restart the current session fish counts
+- Some small internal code cleanup
+
+Version 0.8.1
+- Fixed an error in the German help system (I hope!)
+- '/fb watcher unlock/lock/reset' to move the fish watcher
+- Display percentage per zone when viewing 'by fish' so you can find those hot spots
+
+Version 0.8
+- Display your current skill in the watch frame
+- Track fish by zone and subzone (converts old data as you visit your old fishing haunts)
+- Track minimum skill for locations and for fish types
+- Full Titan panel support
+- Basic myAddOns support
+- Keeping up with the Jones' and added 'Easy Lure' just like Mugendai has :-)
+- A much better German translation (outfit switching should work now too) -- thanks blackrat!
+- Sort by number of fish caught
+- Should work with 'click to move' turned on
+- Track 'cycle fish' information (very preliminary)
+- OutfitDisplayFrame is now optional if you have an equipment manager you prefer
+
+Version 0.7.9c
+- Fix the I can't believe it worked! bug when looking for the Fishing skill
+
+Version 0.7.9b
+- It works even if you've never used Fishing Buddy before!
+
+Version 0.7.9
+- Really fix the per-server settings
+
+I aplogize for those people whose options got lost -- this time I got it right! I have
+no idea why the zip file didn't get uploaded last night, but the new one is good. Thank
+you for your patience!
+
+Version 0.7.8
+- a very preliminary German translation
+- myAddOns support
+- prefs are now stored by server for each toon
+
+The Titan panel support is still preliminary -- I want to make it default to 'on' and have a better icon. There are still things I'd like to have options for (like sorting the watch panel various ways and making it movable), but I'm going to concentrate on the outfit pieces so that they work for more situations.
+
+Thanks for all of your support!
+
+Version 0.7.7
+- Fix ugly display when switching between fish and locations
+- Added Titan panel support (ugly icon, need to polish up my image skills and make a nice gold one)
+- Sort the 'Fish Watcher' by name (for now)
+- Added key bindings for window toggle and outfit switching
+- Internal cleanups, prep for storing toon prefs by server
+
+Auto-loot (shift right click) works for me 'as is' -- I'll have to play with key mappings to see if there's one that stops this from working...
+
+Version 0.7.6
+- Add an option to leave off those pesky percentages
+- Add an option to only watch the fish while you're actually fishing
+- Update the version of OutfitDisplayFrame
+
+Version 0.7.5
+- fix a bad memory leak on the outfit display page
diff --git a/FishingBuddy/future.txt b/FishingBuddy/future.txt
new file mode 100644
index 0000000..1b60060
--- /dev/null
+++ b/FishingBuddy/future.txt
@@ -0,0 +1,41 @@
+Future features
+
+- Count tastyfish in your bag instead of as you catch them (lrdx)
+- Built-in notepad (Kiiingy)
+- "fish trash" feature (Jaim Sandar)
+* only fish in schools during Extravaganza (Lrdx)
+- multi-machine database merge (Alcasius)
+* mute everything but bobber sounds (SBaL)
+- current inventory fish count (islandercaleb)
+- more summary information while fishing (time now/session fish now/session) (Xantandor)
+- Grand totals in fish window
+- select specific frame to show when icons are clicked (Talyn)
+- remove quest items from the list of things caught (zino)
+- separate out pool fish from everything else for counting and percentages
+* save the show fish/locations choice (Dark Imakuni)
+* display both lifetime and current fish info in the watcher (LBlaze)
+* Save helm/cloak settings per outfit in ODF (Valzic)
+* remember tastyfish pool locations (KayJayDK)
+*/- Track cycle fish (Bruntlief)
+* Show current zone in watcher (Buio)
+* Force item slot empty in ODF (Dark Imakuni)
+* Minimap icon (Tarklash)
+- Skinning buddy (Devonkross)
+* elapsed fishing time (Anakar)
+* show current skill level in watcher (Valzic)
+* Titan Panel support (Dark Imakuni)
+* Only show counts -- no percentages (Dark Imakuni)
+* Gatherer integration (Vreejack)
+- Recipe list for fish (Paul2200)
+- display total fish caught all time and this session (truefreak)
+- fish caught database per toon (Filius)
+* Outfitter support (lots)
+* Fishing watcher movable (lots)
+* Save fishing level information (Yeoman, RamahP)
+- Lost fish count (RamahP)
+- HUD for fishing (lures, target fish?, counts, etc.)
+- Graphical fish watcher window, i.e. icons with counts
+- Font/size selection for watcher window (Fritos)
+- Auto-open support for fished items (chests, bloated fish, clams)
+- Expand fish pool tracking (i.e. display them like tastyfish schools)
+- Make the transparency of the watcher window settable (Tehryn)
\ No newline at end of file
diff --git a/FishingBuddy/localization.de.lua b/FishingBuddy/localization.de.lua
new file mode 100644
index 0000000..ef6c699
--- /dev/null
+++ b/FishingBuddy/localization.de.lua
@@ -0,0 +1,198 @@
+-- Deutsche
+-- lower upper
+-- a umlaut \195\164 \195\132
+-- o umlaut \195\192 \195\150
+-- u umlaut \195\188 \195\156
+
+FishingTranslations["deDE"] = {
+ NAME = "Fishing Buddy",
+ DESCRIPTION1 = "\195\156bersicht, wo welche Fische gefangen wurden",
+ DESCRIPTION2 = "und Handhabung deiner Fischereiausr\195\188stung.",
+
+ -- Tab labels and tooltips
+ LOCATIONS_INFO = "Anzeige von Fischen nach Fanggebieten",
+ LOCATIONS_TAB = "Fische",
+ OPTIONS_INFO = "Fishing Buddy-Einstellungen",
+ OPTIONS_TAB = "Einstellungen",
+
+ POINT = "Punkt",
+ POINTS = "Punkte",
+
+ RAW = "Roher",
+ FISH = "Fische",
+
+ BOBBER_NAME = "Blinker",
+ FISHINGSKILL = "Angeln",
+ HELP = "Hilfe",
+ SWITCH = "wechseln",
+ IMPORT = "importiere",
+
+ -- Thanks Maischter!
+ SCHOOL = "schwarm", -- e.g. '\195\150lige Schwarzmaul Schwarm'
+ FLOATING_WRECKAGE = "Schwimmende Wrackteile",
+ FLOATING_DEBRIS = "Schwimmende Tr\195\188mmer",
+ ELEM_WATER = "Elementarwasser",
+
+ ADD = "hinzuf\195\188gen",
+ REPLACE = "ersetze",
+ UPDATE = "update",
+ CURRENT = "Session",
+ RESET = "reset",
+ CLEANUP = "cleanup",
+ CHECK = "check",
+ NOW = "now",
+
+ NOREALM = "unbekannter Realm",
+
+ WATCHER = "Watcher",
+ WATCHER_LOCK = "fixieren",
+ WATCHER_UNLOCK = "freigeben",
+
+ UNKNOWN = "unbekannt",
+ WEEKLY = "w\195\182chentlich",
+ HOURLY = "st\195\188ndlich",
+
+ OFFSET_LABEL_TEXT = "Versatz:";
+
+ KEYS_LABEL_TEXT = "Umschalter:",
+ KEYS_NONE_TEXT = "Keiner",
+ KEYS_SHIFT_TEXT = "Shift",
+ KEYS_CTRL_TEXT = "Strg",
+ KEYS_ALT_TEXT = "Alt",
+
+ SHOWFISHIES = "Nach Fischnamen",
+ SHOWFISHIES_INFO = "Fisch-Log nach Fischart gruppiert anzeigen.",
+ SHOWLOCATIONS = "Nach Fanggebieten",
+ SHOWLOCATIONS_INFO = "Fisch-Log nach Fanggebiet gruppiert anzeigen.",
+ SWITCHOUTFIT = "Ausr\195\188stung wechseln",
+ SWITCHOUTFIT_INFO = "Zwischen der Angelausr\195\188stung und der vorherigen umschalten.",
+
+ -- Option names and tooltips
+ CONFIG_SHOWNEWFISHIES_ONOFF = "Zeige neue Fische",
+ CONFIG_SHOWNEWFISHIES_INFO = "Zeigt im Chat-Log an, wenn ein neuer Fisch an der gegenw\195\164rtigen Position gefangen wird.",
+ CONFIG_FISHWATCH_ONOFF = "Fisch-W\195\164chter",
+ CONFIG_FISHWATCH_INFO = "Zeigt in einer eigenen Chat-Anzeige die Fische an, die an der gegenw\195\164rtigen Position gefangen wurden.",
+ CONFIG_FISHWATCHSKILL_ONOFF = "Zeige Angelskill an",
+ CONFIG_FISHWATCHSKILL_INFO = "Zeigt deinen gegenw\195\164rtigen Angelskill in der \195\156bersicht an.",
+ CONFIG_FISHWATCHZONE_ONOFF = "Zone des Fanggebietes",
+ CONFIG_FISHWATCHZONE_INFO = "Zeigt die gegenw\195\164rtige Zone in der \195\156bersicht an.",
+ CONFIG_FISHWATCHONLY_ONOFF = "Nur beim Fischen",
+ CONFIG_FISHWATCHONLY_INFO = "Anzeige nur beim Fischen",
+ CONFIG_FISHWATCHPERCENT_ONOFF = "Prozent je Fischart",
+ CONFIG_FISHWATCHPERCENT_INFO = "Zeigt den Prozentsatz der gefangenen Fische je Fischart in der Anzeige.",
+ CONFIG_SUITUPFIRST_ONOFF = "Dress for success",
+ CONFIG_SUITUPFIRST_INFO = "Angelausrstung anlegen, wenn Du sie nicht tr\195\164gst, sobald die festgelegte Taste gedr\195\188ckt wird.",
+ CONFIG_EASYCAST_ONOFF = "\"Einfaches Werfen\"",
+ CONFIG_EASYCAST_INFO = "Wenn aktiviert, und eine Angel angelegt ist, wird bei einem Rechtsklick die Leine ausgeworfen.",
+ CONFIG_ONLYMINE_ONOFF = "Nur die Angel anlegen",
+ CONFIG_ONLYMINE_INFO = "Wenn aktiviert, wird \"Einfaches Werfen\" nur die Angel der aktuellen Fischereiausr\195\188stung checken (d.h. es sucht nicht nach weiteren/besseren Angeln).",
+ CONFIG_EASYLURES_ONOFF = "Automatischer K\195\182der",
+ CONFIG_EASYLURES_INFO = "Wenn aktiviert, wird (falls erforderlich) ein K\195\182der an der Angel angebracht, bevor man mit dem Angeln beginnt.",
+ CONFIG_MOUSEFISHING_ONOFF = "Maus-Angeln",
+ CONFIG_MOUSEFISHING_INFO = "Wenn aktiviert, wirft ein Linksklick die Leine aus und mit Rechtsklick wird der Fang eingeholt.",
+ CONFIG_SHOWLOCATIONZONES_ONOFF = "Zeige Zonen",
+ CONFIG_SHOWLOCATIONZONES_INFO = "Zeigt Zonen und Sub-Zonen an.",
+ CONFIG_SORTBYPERCENT_ONOFF = "Sortiere nach Anzahl gefangener Fische",
+ CONFIG_SORTBYPERCENT_INFO = "Anzeige sortiert nach Zahl der gefangenen Fische, anstelle von Fischnamen.",
+ CONFIG_STVTIMER_ONOFF = "Angelwettbewerb-Timer.",
+ CONFIG_STVTIMER_INFO = "Wenn aktiviert, wird je ein Countdown f\195\188r den Anfang und das Ende des Angelwettbewerbs angezeigt.",
+ CONFIG_STVPOOLSONLY_ONOFF = "Nur in Schw\195\164rme auswerfen",
+ CONFIG_STVPOOLSONLY_INFO = "Wenn aktiviert, wird \"Einfaches Werfen\" nur dann verwendet, wenn der Mauszeiger auf einen Schwarm zeigt.",
+ CONFIG_USEBUTTONHOLE_ONOFF = "ButtonHole verwenden",
+ CONFIG_USEBUTTONHOLE_INFO = "Wenn es erm\195\182glicht wird, steuert das ButtonHole-addon die minimaptaste. Nehmen bewirkt auf dem folgenden LOGON.",
+ CONFIG_USEGATHERER_ONOFF = "Gatherer verwenden",
+ CONFIG_USEGATHERER_INFO = "Wenn aktiviert, werden Schw\195\164rme von #NAME# im Gatherer eingetragen.",
+ CONFIG_SKILL_INFO = "Gesamtbonus durch Ausr\195\188stung.",
+ CONFIG_SKILL_TEXT = "Angeln ",
+ CONFIG_STYLISH_INFO = "Styling-Punkte, inspiriert durch die Draznars Fishing-FAQ in den (englischen) WoW-Foren.",
+ CONFIG_STYLISH_TEXT = "Styling: ",
+
+ TITAN_CLICKTOSWITCH_ONOFF = "Zum Wechseln der Ausr\195\188stung klicken.",
+ TITAN_CLICKTOSWITCH_INFO = "Wenn aktiviert, wechselt ein Linksklick die Ausr\195\188stung, ansonsten \195\182ffnet sich das #NAME#-Fenster.",
+
+ LEFTCLICKTODRAG = "Linksklick zum Ziehen",
+ RIGHTCLICKFORMENU = "Rechtsklick \195\182ffnet das Men\195\188.",
+ WATCHERCLICKHELP = "#LEFTCLICKTODRAG#\n#RIGHTCLICKFORMENU#",
+
+ MINIMAPBUTTONPLACEMENT = "Plazierung des Icons",
+ MINIMAPBUTTONPLACEMENTTOOLTIP = "Erlaubt Dir, das #NAME#-Icon um die Minimap zu verschieben.",
+ CONFIG_MINIMAPBUTTON_ONOFF = "Anzeigen des Minimap-Icons",
+ CONFIG_MINIMAPBUTTON_INFO = "Zeige das #NAME#-Icon an der Minimap an.",
+
+ CONFIG_ENHANCESOUNDS_ONOFF = "Angel-Ger\195\164usche verst\195\164rken",
+ CONFIG_ENHANCESOUNDS_INFO = "Maximiere Gesamtlautst\195\164rke und reduziere die Umgebungslautst\195\164rke, um das Pl\195\164tschern des K\195\182ders besser wahrnehmen zu k\195\182nnen.",
+
+ -- messages
+ COMPATIBLE_SWITCHER = "Kein kompatibles Ausr\195\188stungs-Wechsel-Addon gefunden.",
+ FAILEDINIT = "Nicht richtig initialisiert.",
+ IMPORTMSG = "'%s'-Datenbank importiert.",
+ NOIMPORTMSG = "Datenbanken Impp, DataFish oder FishInfo2 nicht gefunden.",
+ ADDFISHIEMSG = "F\195\188ge %s an Position %s hinzu.",
+ ADDSCHOOLMSG = "F\195\188ge '%s' an Position %s hinzu.",
+ NODATAMSG = "Keine Fischdaten vorhanden.",
+ TOOFASTMSG = "Kann Ausr\195\188stung nicht schnell wechseln.",
+ CLEANUP_NONEMSG = "Keine alten Einstellungen zur\195\188ckbehalten.",
+ CLEANUP_WILLMSG = "Alte Einstellungen verblieben f\195\188r |c#GREEN#%s|r: %s.",
+ CLEANUP_DONEMSG = "Alte Einstellungen entfernt f\195\188r |c#GREEN#%s|r: %s.",
+ CLEANUP_NOOLDMSG = "Es gibt keine alten Einstellungen f\195\188r Spieler |c#GREEN#%s|r.",
+ NONEAVAILABLE_MSG = "Keine verf\195\188gbar",
+ UPDATEDB_MSG = "%d Fischnamen aktualisiert.",
+
+ NOTLINKABLE = "",
+
+ TIMETOGO = "Angelwettbewerb beginnt in %d:%02d",
+ TIMELEFT = "Angelwettbewerb endet in %d:%02d",
+
+ STVZONENAME = "Schlingendorntal",
+
+ TOOLTIP_HINT = "Hinweis:";
+ TOOLTIP_HINTSWITCH = "wechselt ein Linksklick die Ausr\195\188stung",
+ TOOLTIP_HINTTOGGLE = "Linksklick \195\182ffnet das #NAME#-Fenster.",
+
+ -- Key binding support
+ BINDING_HEADER_FISHINGBUDDY_BINDINGS = "#NAME#",
+ BINDING_NAME_FISHINGBUDDY_TOGGLE = "#NAME# anzeigen",
+ BINDING_NAME_FISHINGBUDDY_SWITCH = "Ausr\195\188stung wechseln",
+
+ BINDING_NAME_TOGGLEFISHINGBUDDY_LOC = "Zonen-Fenster anzeigen",
+ BINDING_NAME_TOGGLEFISHINGBUDDY_OUT = "Outfit-Fenster anzeigen",
+ BINDING_NAME_TOGGLEFISHINGBUDDY_OPT = "Optionen-Fenster anzeigen",
+};
+
+FishingTranslations["deDE"].IMPORT_HELP = {
+ "|c#GREEN#/fb #IMPORT#|r",
+ " Importiere Impps Fishinfo- oder FishInfo2-Daten.",
+};
+
+FishingTranslations["deDE"].SWITCH_HELP = {
+ "|c#GREEN#/fb #SWITCH#|r",
+ " wechsle deine Angelausr\195\188stung und -kleidung.",
+};
+
+FishingTranslations["deDE"].WATCHER_HELP = {
+ "|c#GREEN#/fb #WATCHER#|r [|c#GREEN##WATCHER_LOCK#|r oder |c#GREEN##WATCHER_UNLOCK#|r oder |c#GREEN##RESET#|r]",
+ " fixieren .. Fixieren der \195\156bersicht,",
+ " freigeben .. Entriegeln zum Verschieben,",
+ " reset .. Zur\195\188cksetzen",
+};
+
+FishingTranslations["deDE"].CURRENT_HELP = {
+ "|c#GREEN#/fb #CURRENT# #RESET#|r",
+ " Zur\195\188cksetzen der w\195\164hrend der gegenw\195\164rtigen Session gefangenen Fische.",
+ };
+FishingTranslations["deDE"].CLEANUP_HELP = {
+ "|c#GREEN#/fb #CLEANUP#|r [|c#GREEN##CHECK#|r or |c#GREEN##NOW#|r]",
+ " Alte Einstellungen aufr\195\164umen. |c#GREEN##CHECK#|r verzeichnet",
+ " die alten Einstellungen, die von |c#GREEN##NOW#|r entfernt werden.",
+};
+
+FishingTranslations["deDE"].PRE_HELP = {
+ "Du kannst |c#GREEN#/fishingbuddy|r oder |c#GREEN#/fb|r f\195\188r alle Befehle benutzen",
+ "|c#GREEN#/fb|r: schaltet das Fenster ein/aus.",
+ "|c#GREEN#/fb #HELP#|r: zeigt diesen Hilfetext",
+};
+FishingTranslations["deDE"].POST_HELP = {
+ "Du kannst die Fensteraktivierung und den",
+ "Befehl zum Wechseln deiner Ausstattung in den",
+ "\"Tastaturbelegungen\" festlegen.",
+};
diff --git a/FishingBuddy/localization.es.lua b/FishingBuddy/localization.es.lua
new file mode 100644
index 0000000..e9e969e
--- /dev/null
+++ b/FishingBuddy/localization.es.lua
@@ -0,0 +1,121 @@
+FishingTranslations["esES"] = {
+ NAME = "Fishing Buddy",
+ DESCRIPTION1 = "Seguimiento de las capturas que has hecho",
+ DESCRIPTION2 = "y maneja tu ca\195\177a de pescar.",
+
+ -- Tab labels and tooltips
+ LOCATIONS_INFO = "Muestra info de zona de pesca",
+ LOCATIONS_TAB = "Zona",
+ OPTIONS_INFO = "Establece #NAME# opciones",
+ OPTIONS_TAB = "Opciones",
+
+ POINT = "punto",
+ POINTS = "puntos",
+
+ RAW = "Crudo",
+ FISH = "Pesca",
+
+ BOBBER_NAME = "Anzuelo",
+ FISHINGSKILL = "Pesca",
+ HELP = "ayuda",
+ SWITCH = "cambia",
+ IMPORT = "importa",
+
+ OIL_SPILL = "Perdita de Petro'leo",
+
+ ADD = "a\195\177de",
+ REPLACE = "reemplaza",
+ UPDATE = "actualiza",
+ CURRENT = "actual",
+ RESET = "resetea",
+ CLEANUP = "limpia",
+ CHECK = "chequea",
+ NOW = "ahora",
+
+ NOREALM = "reino desconocido",
+
+ WATCHER = "observador",
+ WATCHER_LOCK = "bloquea",
+ WATCHER_UNLOCK = "desbloquea",
+
+ UNKNOWN = "Desconocido",
+ WEEKLY = "Semanal",
+ HOURLY = "Por hora",
+
+ KEYS_LABEL_TEXT = "Modificadores:",
+ KEYS_NONE_TEXT = "Ninguno",
+ KEYS_SHIFT_TEXT = "Shift",
+ KEYS_CTRL_TEXT = "Control",
+ KEYS_ALT_TEXT = "Alt",
+
+ SHOWFISHIES = "Muestra Pez",
+ SHOWFISHIES_INFO = "Muestra historial de pesca por tipo de pez.",
+
+ SHOWLOCATIONS = "Ubicaciones",
+ SHOWLOCATIONS_INFO = "Muestra hostorial de pesca por zona de pesca.",
+
+ -- Option names and tooltips
+ CONFIG_SHOWNEWFISHIES_ONOFF = "Muestra nuevos peces",
+ CONFIG_SHOWNEWFISHIES_INFO = "Muestra un mensaje en el chat cuando la captura es nueva en el \195\161rea actual.",
+ CONFIG_FISHWATCH_ONOFF = "Observador",
+ CONFIG_FISHWATCH_INFO = "Muestra un texto con la captura en el \195\161rea actual.",
+ CONFIG_FISHWATCHSKILL_ONOFF = "Muestra habilidad actual",
+ CONFIG_FISHWATCHSKILL_INFO = "Muestra habilidad y mods en el \195\161rea de observaci\195\179n.",
+ CONFIG_FISHWATCHZONE_ONOFF = "Muestra zona actual",
+ CONFIG_FISHWATCHZONE_INFO = "Muestra zona actual en el \195\161rea de observaci\195\179n.",
+ CONFIG_FISHWATCHONLY_ONOFF = "Solo cuando pescas",
+ CONFIG_FISHWATCHONLY_INFO = "Solo muestra capturas en el observador si estas pescando actualmente",
+ CONFIG_FISHWATCHPERCENT_ONOFF = "Muestra porcentaje capturado",
+ CONFIG_FISHWATCHPERCENT_INFO = "Muestra el porcentaje de cada tipo de pez en el observador",
+ CONFIG_EASYLURES_ONOFF = "Se\195\177uelo facil",
+ CONFIG_EASYLURES_INFO = "Si activado, se aplicar\195\161 un se\195\177uelo a tu ca\195\177a antes de empezar a pescar siempre que lo necesites.",
+ CONFIG_ONLYMINE_ONOFF = "Equipa solo ca\195\177a",
+ CONFIG_ONLYMINE_INFO = "Si activado, captura facil solo cequear\195\161 si llevas la ca\195\177a (p.ej. no buscar\195\161 todas las posibilidades).",
+ CONFIG_SHOWLOCATIONZONES_ONOFF = "Muestra zonas",
+ CONFIG_SHOWLOCATIONZONES_INFO = "Muestra zonas y subzonas.",
+ CONFIG_SORTBYPERCENT_ONOFF = "Por n\195\186mero de capturas",
+ CONFIG_SORTBYPERCENT_INFO = "Ordena la pantalla con el n\195\186mero de peces capturadas y no por el nombre.",
+ CONFIG_STVTIMER_ONOFF = "Marcador de Fishing Extravaganza",
+ CONFIG_STVTIMER_INFO = "Si activado, muestra la cuenta atras para el comienzo de Fishing Extravaganza y muestra el tiempo restante.",
+ CONFIG_USEBUTTONHOLE_ONOFF = "Usa ButtonHole",
+ CONFIG_USEBUTTONHOLE_INFO = "Si activo, al addon ButtonHole controlar\195\161 el bot\195\179n del minimapa. Hace efecto al siguiente login.",
+
+ CONFIG_OUTFITTER_TEXT = "Bonus equipo habilidad: %s\r\nPuntuacion estilo Draznar's: %d ";
+
+ CLICKTOSWITCH_ONOFF = "Click para cambiar",
+ CLICKTOSWITCH_INFO = "Si activado, click-izq. Cambia equipos, sino saltar\195\161la ventana Fishing Buddy.",
+
+ LEFTCLICKTODRAG = "Click-izq para mover",
+
+ MINIMAPBUTTONPLACEMENT = "Posici\195\179n Bot\195\179n",
+ MINIMAPBUTTONPLACEMENTTOOLTIP = "Permite mover el #NAME# icono alrdedor del minimapa",
+ CONFIG_MINIMAPBUTTON_ONOFF = "Muestra icono minimapa",
+ CONFIG_MINIMAPBUTTON_INFO = "Muestra un #NAME# icono en el minimapa.",
+
+ CONFIG_ENHANCESOUNDS_ONOFF = "Activa sonidos de pesca",
+ CONFIG_ENHANCESOUNDS_INFO = "Maximiza el vol\195\186men y minimiza el vol\195\186men del ambiente para que se aprecie mejor el sonido cuando se pesca.",
+
+ -- messages
+ FAILEDINIT = "No inicializ\195\179 correctamente.",
+ IMPORTMSG = "BaseDatos '%s' importada.",
+ NOIMPORTMSG = "No Impp, DataFish, o FishInfo2 BasesDatos encontradas.",
+ ADDFISHIEMSG = "A\195\177diendo %s a zona %s.",
+ NODATAMSG = "No datos pesca disponibles.",
+ CLEANUP_NONEMSG = "No quedan antig\195\186os ajustes.",
+ CLEANUP_WILLMSG = "Ajustes antig\195\186os quedan para |c#GREEN#%s|r: %s.",
+ CLEANUP_DONEMSG = "Borrados ajustes antig\195\186os para |c#GREEN#%s|r: %s.",
+ CLEANUP_NOOLDMSG = "No hay ajustes antig\195\186os para jugador |c#GREEN#%s|r.",
+
+ NOTLINKABLE = "",
+
+ TIMETOGO = "Extravaganza comienza en %d:%02d",
+ TIMELEFT = "Extravaganza acaba en %d:%02d",
+
+ STVZONENAME = "Stranglethorn Vale",
+
+ TOOLTIP_HINT = "Consejo:",
+ TOOLTIP_HINTSWITCH = "click para cambiar equipos",
+ TOOLTIP_HINTTOGGLE = "click para mostar #NAME# ventana.",
+};
+
+
diff --git a/FishingBuddy/localization.fr.lua b/FishingBuddy/localization.fr.lua
new file mode 100644
index 0000000..c691adf
--- /dev/null
+++ b/FishingBuddy/localization.fr.lua
@@ -0,0 +1,128 @@
+FishingTranslations["frFR"] = {
+ NAME = "Fishing Buddy";
+ DESCRIPTION1 = "Se souvient des poissons pris et";
+ DESCRIPTION2 = "organise votre \195\169quipement.";
+
+ -- Tab labels and tooltips
+ LOCATIONS_INFO = "Affiche les informations de p\195\170che locales";
+ LOCATIONS = "Localisations";
+ OPTIONS_INFO = "R\195\168gle les options";
+ OPTIONS = "Options";
+
+ POINT = "point";
+ POINTS = "points";
+
+ RAW = "Raw";
+
+ BOBBER_NAME = "Fishing Bobber";
+ FISHINGSKILL = "P\195\170che";
+ HELP = "Aide";
+ SWITCH = "switch";
+ IMPORT = "import";
+
+ ADD = "add";
+ REPLACE = "replace";
+ UPDATE = "update";
+ CURRENT = "current";
+ RESET = "reset";
+ CLEANUP = "cleanup";
+ CHECK = "check";
+ NOW = "NOW";
+
+ WATCHER = "watcher";
+ WATCHER_LOCK = "lock";
+ WATCHER_UNLOCK = "unlock";
+
+ UNKNOWN = "Inconnu";
+ WEEKLY = "Hebdomadaire";
+ HOURLY = "toutes les heures";
+
+ KEYS_LABEL_TEXT = "Touches:",
+ KEYS_NONE_TEXT = "Aucune",
+ KEYS_SHIFT_TEXT = "Shift",
+ KEYS_CTRL_TEXT = "CTRL",
+ KEYS_ALT_TEXT = "Alt",
+
+ SHOWFISHIES = "Poissons";
+ SHOWFISHIES_INFO = "Affiche vos prises class\195\169es par type de poisson.";
+
+ SHOWLOCATIONS = "Montrer les zones";
+ SHOWLOCATIONS_INFO = "Affiche vos prises class\195\169es par r\195\169gions.";
+
+ -- Option names and tooltips
+ CONFIG_SHOWNEWFISHIES_ONOFF = "Montrer les nouveaux poissons",
+ CONFIG_SHOWNEWFISHIES_INFO = "Affiche un message dans la zone de texte quand un nouveau poisson est p\195\169ch\195\169.",
+ CONFIG_FISHWATCH_ONOFF = "Archives des poissons",
+ CONFIG_FISHWATCH_INFO = "Affiche une zone de texte avec les poissons d\195\169j\195\160 p\195\169ch\195\169s dans la zone courante.",
+ CONFIG_FISHWATCHONLY_ONOFF = "Seulement en p\195\169chant",
+ CONFIG_FISHWATCHONLY_INFO = "Montrer seulement les poissons lorsque vous \195\170tes en train de p\195\169cher.",
+ CONFIG_FISHWATCHSKILL_ONOFF = "Niveau actuel",
+ CONFIG_FISHWATCHSKILL_INFO = "Affiche votre niveau courant en p\195\170che ainsi que les am\195\169liorations dans la zone de texte.",
+ CONFIG_FISHWATCHZONE_ONOFF = "Zone courante",
+ CONFIG_FISHWATCHZONE_INFO = "Affiche la zone courante dans la zone de texte.",
+ CONFIG_FISHWATCHPERCENT_ONOFF = "Montrer les pourcentages",
+ CONFIG_FISHWATCHPERCENT_INFO = "Affiche les pourcentages pour chaque type de poissons dans la zone de texte.",
+ CONFIG_EASYCAST_ONOFF = "Lancer la ligne facilement",
+ CONFIG_EASYCAST_INFO = "Si activ\195\169, lorsque votre canne \195\160 p\195\170che est \195\169quip\195\169e, un clic droit lance la ligne.",
+ CONFIG_SORTBYPERCENT_ONOFF = "Trier par quantit\195\169 de poissons",
+ CONFIG_SORTBYPERCENT_INFO = "Trie l'affichage par quantit\195\169 de poissons p\195\169ch\195\169s au lieu du nom.",
+ CONFIG_STVTIMER_ONOFF = "Timer du concours de p\195\170che",
+ CONFIG_STVTIMER_INFO = "Si activ\195\169, un compteur sera affich\195\169 indiquant le temps restant avant le debut et la fin du concours.",
+ CONFIG_USEGATHERER_ONOFF = "Utiliser Gatherer",
+ CONFIG_USEGATHERER_INFO = "Si activ\195\169, un compteur sera affich\195\169 indiquant le temps restant avant le debut et la fin du concours.",
+
+ CLICKTOSWITCH_ONOFF = "Clique pour changer";
+ CLICKTOSWITCH_INFO = "Si activ\195\169, un clic gauche change l'\195\169quipement, si d\195\169sactiv\195\169, affiche la fen\195\170tre.";
+
+ LEFTCLICKTODRAG = "Clique gauche pour bouger";
+
+ MINIMAPBUTTONPLACEMENT = "Position du bouton";
+ MINIMAPBUTTONPLACEMENTTOOLTIP = "Permet de bouger le bouton de #NAME# autour de la minimap";
+ CONFIG_MINIMAPBUTTON_ONOFF = "Affiche le bouton de la minimap.";
+ CONFIG_MINIMAPBUTTON_INFO = "Affiche le bouton de #NAME# pr\195\168s de la minimap.";
+
+ CONFIG_ENHANCESOUNDS_ONOFF = "Augmentez les bruits de p\195\170che";
+ CONFIG_ENHANCESOUNDS_INFO = "Maximisez le volume sain et r\195\169duisez au minimum le volume ambiant pour faire le bobber \195\169bruiter plus apparent tout en p\195\170chant.";
+
+ TIMETOGO = "Le concours de p\195\170che commence dans %d:%02d";
+ TIMELEFT = "Le concours de p\195\170che se termine dans %d:%02d";
+
+ STVZONENAME = "Vall\195\169e de Strangleronce";
+
+ BINDING_HEADER_FISHINGBUDDY_BINDINGS = "#NAME#";
+ BINDING_NAME_FISHINGBUDDY_TOGGLE = "Toggle:#NAME#(Fen\195\170tre)";
+ BINDING_NAME_FISHINGBUDDY_SWITCH = "Changer l'\195\169quipement";
+
+ BINDING_NAME_TOGGLEFISHINGBUDDY_LOC = "Toggle: #NAME# (Panneau de r\195\169gion)";
+ BINDING_NAME_TOGGLEFISHINGBUDDY_OPT = "Toggle: #NAME# (Panneau d'options)";
+
+ ABBREV_APRIL = "Avr",
+};
+
+FishingTranslations["frFR"].IMPORT_HELP = {
+ "|c#GREEN#/fb #IMPORT#|r",
+ " Importe les donn\195\169es d'Impp's fishinfo ou de FishInfo2.",
+};
+FishingTranslations["frFR"].SWITCH_HELP = {
+ "|c#GREEN#/fb #SWITCH#|r",
+ " Change l'\195\169quipement (si OutfitDisplayFrame ou Outfitter est charg\195\169)",
+};
+FishingTranslations["frFR"].WATCHER_HELP = {
+ "|c#GREEN#/fb #WATCHER#|r [|c#GREEN##WATCHER_LOCK#|r or |c#GREEN##WATCHER_UNLOCK#|r or |c#GREEN##RESET#|r]",
+ " D\195\169v\195\169rouille pour bouger la fen\195\170tre,",
+ " lock pour arr\195\170ter, reset pour mettre a z\195\169ro",
+};
+FishingTranslations["frFR"].CURRENT_HELP = {
+ "|c#GREEN#/fb #CURRENT# #RESET#|r",
+ " Met a z\195\169ro des poissons pris durant cette session.",
+};
+
+FishingTranslations["frFR"].PRE_HELP = {
+ "Vous pouvez utiliser |c#GREEN#/fishingbuddy|r ou |c#GREEN#/fb|r pour toutes les commandes",
+ "|c#GREEN#/fb|r: seul, affiche/cache la fen\195\170tre de FishingBuddy",
+ "|c#GREEN#/fb #HELP#|r: affiche ce message",
+};
+FishingTranslations["frFR"].POST_HELP = {
+ "Vous pouvez assigner une touche pour afficher/cacher la fen\195\170tre et/ou",
+ "changer d'\195\169quipement dans la fen\195\170tre \"Raccourcis\".",
+};
diff --git a/FishingBuddy/localization.lua b/FishingBuddy/localization.lua
new file mode 100644
index 0000000..3276c19
--- /dev/null
+++ b/FishingBuddy/localization.lua
@@ -0,0 +1,232 @@
+-- default to American English
+
+FishingTranslations = {};
+FishingTranslations["enUS"] = {
+ NAME = "Fishing Buddy",
+ DESCRIPTION1 = "Keep track of the fish you've caught",
+ DESCRIPTION2 = "and manage your fishing gear.",
+ DESCRIPTION = "#DESCRIPTION1# #DESCRIPTION2#",
+
+ ID = "FishingBuddy",
+ MSGID = "FBAM", -- Fishing Buddy Addon Message
+
+ WINDOW_TITLE = "#NAME# v#VERSION#",
+ FISHINGTEXTURE = "Interface\\Icons\\Trade_Fishing",
+
+ -- Tab labels and tooltips
+ LOCATIONS_INFO = "Show fishing location information",
+ LOCATIONS_TAB = "Locations",
+ OPTIONS_INFO = "Set #NAME# options",
+ OPTIONS_TAB = "Options",
+
+ POINT = "point",
+ POINTS = "points",
+
+ RAW = "Raw",
+ FISH = "Fish",
+
+ BOBBER_NAME = "Fishing Bobber",
+ FISHINGSKILL = "Fishing",
+ HELP = "help",
+ SWITCH = "switch",
+ IMPORT = "import",
+ UPDATEDB = "updatedb",
+ FORCE = "force",
+
+ OUTFITS = "Outfits",
+
+ SCHOOL = "School", -- e.g. 'Oily Blackmouth School'
+ FLOATING_WRECKAGE = "Floating Wreckage",
+ FLOATING_DEBRIS = "Floating Debris",
+ ELEM_WATER = "Elemental Water",
+ OIL_SPILL = "Oil Spill",
+
+ ADD = "add",
+ REPLACE = "replace",
+ UPDATE = "update",
+ CURRENT = "current",
+ RESET = "reset",
+ CLEANUP = "cleanup",
+ CHECK = "check",
+ NOW = "now",
+
+ NOREALM = "unknown realm",
+
+ WATCHER = "watcher",
+ WATCHER_LOCK = "lock",
+ WATCHER_UNLOCK = "unlock",
+
+ UNKNOWN = "Unknown",
+ WEEKLY = "weekly",
+ HOURLY = "hourly",
+
+ BROADCAST_LABEL_TEXT = "Broadcast:";
+ BROADCAST_DUMP_TEXT = "Blocked";
+ BROADCAST_RECV_TEXT = "Accept";
+
+ OFFSET_LABEL_TEXT = "Offset:";
+
+ KEYS_LABEL_TEXT = "Modifiers:",
+ KEYS_NONE_TEXT = "None",
+ KEYS_SHIFT_TEXT = "Shift",
+ KEYS_CTRL_TEXT = "Control",
+ KEYS_ALT_TEXT = "Alt",
+
+ SHOWFISHIES = "Show fish",
+ SHOWFISHIES_INFO = "Display fishing history grouped by fish type.",
+
+ SHOWLOCATIONS = "Locations",
+ SHOWLOCATIONS_INFO = "Display fishing history grouped by where caught.",
+
+ -- Option names and tooltips
+ CONFIG_SHOWNEWFISHIES_ONOFF = "Show new fish",
+ CONFIG_SHOWNEWFISHIES_INFO = "Display a message in the chat area when a new fish for the current location is caught.",
+ CONFIG_FISHWATCH_ONOFF = "Fish watcher",
+ CONFIG_FISHWATCH_INFO = "Display a text overlay with the fish caught in the current location.",
+ CONFIG_FISHWATCHONLY_ONOFF = "Only while fishing",
+ CONFIG_FISHWATCHONLY_INFO = "Only watch the fish caught when we're actually fishing",
+ CONFIG_FISHWATCHSKILL_ONOFF = "Current skill",
+ CONFIG_FISHWATCHSKILL_INFO = "Display your current fishing skill and mods in the fish watch area.",
+ CONFIG_FISHWATCHZONE_ONOFF = "Current zone",
+ CONFIG_FISHWATCHZONE_INFO = "Display the current zone in the fish watch area.",
+ CONFIG_FISHWATCHPERCENT_ONOFF = "Show percentages",
+ CONFIG_FISHWATCHPERCENT_INFO = "Display the percentage of each kind of fish on the watch display",
+ CONFIG_SUITUPFIRST_ONOFF = "Dress for success",
+ CONFIG_SUITUPFIRST_INFO = "Put on your fishing outfit if you're not wearing it when the binding key is pressed",
+ CONFIG_EASYCAST_ONOFF = "Easy Cast",
+ CONFIG_EASYCAST_INFO = "If enabled, then when a fishing pole is equipped and you right click, you will cast the line.",
+ CONFIG_EASYLURES_ONOFF = "Easy Lures",
+ CONFIG_EASYLURES_INFO = "If enabled, a lure will applied to your fishing pole before you start fishing, whenever you need one.",
+ CONFIG_ONLYMINE_ONOFF = "Outfit Pole Only",
+ CONFIG_ONLYMINE_INFO = "If enabled, easy cast will only check for your outfit's fishing pole (i.e. it won't search all possible poles for a match).",
+ CONFIG_MOUSEFISHING_ONOFF = "Mouse fishing",
+ CONFIG_MOUSEFISHING_INFO = "If enabled, left-click throws your line and right-click loots the bobber",
+ CONFIG_SHOWLOCATIONZONES_ONOFF = "Show Zones",
+ CONFIG_SHOWLOCATIONZONES_INFO = "Display both zones and subzones.",
+ CONFIG_SORTBYPERCENT_ONOFF = "Sort by number caught",
+ CONFIG_SORTBYPERCENT_INFO = "Order displays by the number of fish caught instead of by name.",
+ CONFIG_STVTIMER_ONOFF = "Fishing Extravaganza timer",
+ CONFIG_STVTIMER_INFO = "If enabled, display a countdown timer for the start of the Fishing Extravaganza and a countdown of the timer left.",
+ CONFIG_STVPOOLSONLY_ONOFF = "Only cast in pools",
+ CONFIG_STVPOOLSONLY_INFO = "If enabled, easy cast will only be enabled if the cursor is over a fishing hole.",
+ CONFIG_USEBUTTONHOLE_ONOFF = "Use ButtonHole",
+ CONFIG_USEBUTTONHOLE_INFO = "If enabled, the ButtonHole addon will control the minimap button. Takes effect on the next login.",
+ CONFIG_USEGATHERER_ONOFF = "Use Gatherer",
+ CONFIG_USEGATHERER_INFO = "If enabled, #NAME# will inform Gatherer about fishing holes.",
+
+ CONFIG_OUTFITTER_TEXT = "Outfit skill bonus: %s\r\nDraznar's style score: %d ",
+
+ CLICKTOSWITCH_ONOFF = "Click to switch",
+ CLICKTOSWITCH_INFO = "If enabled, a left click switches outfits, otherwise it brings up the Fishing Buddy window.",
+
+ LEFTCLICKTODRAG = "Left-click to drag",
+ RIGHTCLICKFORMENU = "Right-click for menu",
+ WATCHERCLICKHELP = "#LEFTCLICKTODRAG#\n#RIGHTCLICKFORMENU#",
+
+ MINIMAPBUTTONPLACEMENT = "Button Placement",
+ MINIMAPBUTTONPLACEMENTTOOLTIP = "Allows you to move the #NAME# icon around the minimap",
+ CONFIG_MINIMAPBUTTON_ONOFF = "Display minimap icon",
+ CONFIG_MINIMAPBUTTON_INFO = "Display a #NAME# icon on the minimap.",
+
+ CONFIG_ENHANCESOUNDS_ONOFF = "Enhance fishing sounds",
+ CONFIG_ENHANCESOUNDS_INFO = "Maximize sound volume and minimize ambient volume to make the bobber noise more noticeable while fishing.",
+
+ HIDEINWATCHER = "Display this fish in the watcher",
+
+ -- messages
+ COMPATIBLE_SWITCHER = "No compatible outfit switcher found.",
+ TOOMANYFISHERMEN = "You have more than one easy cast mod installed.",
+ FAILEDINIT = "Did not initialize correctly.",
+ IMPORTMSG = "Imported '%s' database.",
+ NOIMPORTMSG = "No Impp, DataFish, or FishInfo2 databases found.",
+ ADDFISHIEMSG = "Adding %s to location %s.",
+ ADDSCHOOLMSG = "Adding '%s' to location %s.",
+ NODATAMSG = "No fishing data available.",
+ CLEANUP_NONEMSG = "No old settings remain.",
+ CLEANUP_WILLMSG = "Old settings remaining for |c#RED#%s|r: %s.",
+ CLEANUP_DONEMSG = "Old settings removed for |c#RED#%s|r: %s.",
+ CLEANUP_NOOLDMSG = "There are no old settings for player |c#GREEN#%s|r.",
+ NONEAVAILABLE_MSG = "None available",
+ UPDATEDB_MSG = "Updated %d fish names.",
+
+ MINIMUMSKILL = "Minimum skill: %d",
+ NOTLINKABLE = "",
+ CAUGHTTHISMANY = "Caught %d",
+ CAUGHTTHISTOTAL = "Total %d",
+ FISHTYPES = "Fish types: %d",
+
+ DASH = " -- ",
+ FISHCAUGHT = "%d %s",
+ TIMETOGO = "Extravaganza starts in %d:%02d",
+ TIMELEFT = "Extravaganza ends in %d:%02d",
+ FATLADYSINGS = "|c#RED#Extravaganza is over|r (%d:%02d left)",
+ RIGGLE_BASSBAIT = "^Riggle Bassbait .*: .*! (.*) .*!$",
+
+ STVZONENAME = "Stranglethorn Vale",
+
+ TOOLTIP_HINT = "Hint:",
+ TOOLTIP_HINTSWITCH = "click to switch outfits",
+ TOOLTIP_HINTTOGGLE = "click to show the #NAME# window.",
+
+ -- Key binding support
+ BINDING_HEADER_FISHINGBUDDY_BINDINGS = "#NAME#",
+ BINDING_NAME_FISHINGBUDDY_TOGGLE = "Toggle #NAME# Window",
+ BINDING_NAME_FISHINGBUDDY_SWITCH = "Switch Fishing Outfit",
+ BINDING_NAME_FISHINGBUDDY_GOFISHING = "Suit up and go fishing",
+
+ BINDING_NAME_TOGGLEFISHINGBUDDY_LOC = "Toggle #NAME# Locations Pane",
+ BINDING_NAME_TOGGLEFISHINGBUDDY_OPT = "Toggle #NAME# Options Pane",
+};
+
+FishingTranslations["enUS"].IMPORT_HELP = {
+ "|c#GREEN#/fb #IMPORT#|r",
+ " Import Impp's fishinfo or FishInfo2 data.",
+};
+FishingTranslations["enUS"].SWITCH_HELP = {
+ "|c#GREEN#/fb #SWITCH#|r",
+ " swap outfits (if OutfitDisplayFrame or Outfitter is available)",
+};
+FishingTranslations["enUS"].WATCHER_HELP = {
+ "|c#GREEN#/fb #WATCHER#|r [|c#GREEN##WATCHER_LOCK#|r or |c#GREEN##WATCHER_UNLOCK#|r or |c#GREEN##RESET#|r]",
+ " Unlock the watcher to move the window,",
+ " lock to stop, reset to reset",
+};
+FishingTranslations["enUS"].CURRENT_HELP = {
+ "|c#GREEN#/fb #CURRENT# #RESET#|r",
+ " Reset the fish caught during the current session.",
+};
+FishingTranslations["enUS"].UPDATEDB_HELP = {
+ "|c#GREEN#/fb #UPDATEDB# [#FORCE#]|r",
+ " Try and find the names of all the fish we don't know already.",
+ " An attempt is made to skip 'rare' fish that may disconnect you",
+ " from the server -- use the '#FORCE#' option to override the check.",
+};
+FishingTranslations["enUS"].CLEANUP_HELP = {
+ "|c#GREEN#/fb #CLEANUP#|r [|c#GREEN#f#CHECK#|r or |c#GREEN##NOW#|r]",
+ " Clean up old settings. |c#GREEN##CHECK#|r lists which",
+ " settings will be removed by |c#GREEN##NOW#|r.",
+};
+
+FishingTranslations["enUS"].PRE_HELP = {
+ "You can use |c#GREEN#/fishingbuddy|r or |c#GREEN#/fb|r for all commands",
+ "|c#GREEN#/fb|r: by itself, toggle the Fishing Buddy window",
+ "|c#GREEN#/fb #HELP#|r: display this message",
+};
+FishingTranslations["enUS"].POST_HELP = {
+ "You can bind both the window toggle and the outfit",
+ " switch command to keys in the \"Key Bindings\" window.",
+};
+
+FishingTranslations["enUS"].HELPMSG = {
+ "@PRE_HELP",
+ "@SWITCH_HELP",
+ "@WATCHER_HELP",
+ "@CURRENT_HELP",
+ "@CLEANUP_HELP",
+ "@IMPORT_HELP",
+ "@TRACKING_HELP",
+ "@UPDATEDB_HELP",
+ " ",
+ "@POST_HELP",
+};
+
diff --git a/FishingBuddy/readme.txt b/FishingBuddy/readme.txt
new file mode 100644
index 0000000..8158a4e
--- /dev/null
+++ b/FishingBuddy/readme.txt
@@ -0,0 +1,64 @@
+Fishing Buddy
+-------------
+
+ Yet another fishing support add-on. It's a combination of TackleBox,
+ Impp's Fishing Info and a fishing outfit manager all rolled into one. I
+ wrote it both to provide some functionality that was missing from all
+ of the other fishing add-ons I was using and to learn to do add-ons.
+
+ Features:
+ - 'Easy Cast' lets you right-click to cast your line. Use the same mouse
+ button for looting and casting. A double-click will force another cast early
+ - 'Fish Watcher' lets you see the fish you've caught here before (or
+ the fish that you've caught in the current session)
+ - Display your current skill level and the time since you started fishing
+ - Choose your fishing outfit and change into it easily
+ - Support for automatically adding a lure to your fishing pole
+ - Full Titan Panel support
+ - myAddOns support
+ - Preliminary support for tracking 'cycle fish' such as the Nightfin
+ Snapper so you know when to go looking for them
+
+ Example commands:
+ /fishingbuddy or /fb
+ toggle the display of the Fishing Buddy window
+ /fb help
+ print the list of Fishing Buddy commands
+ /fb switch
+ wear your chosen fishing outfit, or change back
+
+ There are two actual add-ons -- the second one, OutfitDisplayFrame,
+ handles the pretty pane to set up your fishing outfit (it's next on
+ the list to be made into something more general that anyone can use).
+ The OutfitDisplayFrame addon can be safely left out if you have a
+ preferred equipment manager.
+
+ alt-clicking on an item in your outfit display will clear it
+
+ Silly stuff:
+ In addition to displaying the fishing bonus for your fishing outfit,
+ it also displays your 'style points' as inferred from Draznar's
+ Fishing FAQ (http://wow.toshimo.com/viewtopic.php?t=272).
+
+ Thanks to the authors of:
+
+ TackleBox -- still adding cool features to keep up with!
+ Impp's Fishing DB
+ QuickWeaponSwap
+ GuildMap
+
+ and many, many others!
+
+ Feel free to send comments to Sutorix=AT=hotmail.com.
+
+Installation
+------------
+
+1. Unzip the 'FishingBuddyVERSION.zip' file
+2. If your unzip program allows you to specify a location, then
+ unzip it into the "Interface/AddOns" folder contained in your
+ WoW folder (the location that WoW was installed)
+3. If your unzip program doesn't let you specify the destination,
+ then find your WoW folder (where it was installed) and drag
+ the 'FishingBuddy' and 'OutfitDisplayFrame' folder into the
+ 'Interface/AddOns' folder.
diff --git a/OutfitDisplayFrame/OutfitDisplayFrame.lua b/OutfitDisplayFrame/OutfitDisplayFrame.lua
new file mode 100644
index 0000000..d2c5441
--- /dev/null
+++ b/OutfitDisplayFrame/OutfitDisplayFrame.lua
@@ -0,0 +1,1286 @@
+OUTFITDISPLAYFRAME_VERSION = GetAddOnMetadata("OutfitDisplayFrame", "Version");
+
+OUTFITDISPLAYFRAME_NAME = "Outfit Display Frame";
+OUTFITDISPLAYFRAME_TITLE = OUTFITDISPLAYFRAME_NAME.." v"..OUTFITDISPLAYFRAME_VERSION;
+OUTFITDISPLAYFRAME_BANKDELAY = 0.5;
+
+local PlayerSlotNames = {
+ [1] = { name = "HeadSlot", tooltip = HEADSLOT };
+ [2] = { name = "NeckSlot", tooltip = NECKSLOT },
+ [3] = { name = "ShoulderSlot", tooltip = SHOULDERSLOT },
+ [4] = { name = "BackSlot", tooltip = BACKSLOT },
+ [5] = { name = "ChestSlot", tooltip = CHESTSLOT },
+ [6] = { name = "ShirtSlot", tooltip = SHIRTSLOT },
+ [7] = { name = "TabardSlot", tooltip = TABARDSLOT },
+ [8] = { name = "WristSlot", tooltip = WRISTSLOT },
+ [9] = { name = "HandsSlot", tooltip = HANDSSLOT },
+ [10] = { name = "WaistSlot", tooltip = WAISTSLOT },
+ [11] = { name = "LegsSlot", tooltip = LEGSSLOT },
+ [12] = { name = "FeetSlot", tooltip = FEETSLOT },
+ [13] = { name = "Finger0Slot", tooltip = FINGER0SLOT },
+ [14] = { name = "Finger1Slot", tooltip = FINGER1SLOT },
+ [15] = { name = "Trinket0Slot", tooltip = TRINKET0SLOT },
+ [16] = { name = "Trinket1Slot", tooltip = TRINKET1SLOT },
+ [17] = { name = "MainHandSlot", tooltip = MAINHANDSLOT },
+ [18] = { name = "SecondaryHandSlot", tooltip = SECONDARYHANDSLOT },
+ [19] = { name = "RangedSlot", tooltip = RANGEDSLOT },
+}
+
+local SavedPickupContainerItem = nil;
+local SavedPickupInventoryItem = nil;
+
+local LastOffSource = nil;
+local PerformSlowerSwap = false;
+local BankIsOpen = false;
+
+local function tonil(val)
+ if ( not val ) then
+ return "nil";
+ else
+ return val;
+ end
+end
+
+local function Print(msg, r, g, b)
+ if ( DEFAULT_CHAT_FRAME ) then
+ if ( not r ) then
+ DEFAULT_CHAT_FRAME:AddMessage(msg);
+ else
+ DEFAULT_CHAT_FRAME:AddMessage(msg, r, g, b);
+ end
+ end
+end
+
+-- Based on code in QuickMountEquip
+local function SafeHookFunction(func, newfunc)
+ local oldValue = getglobal(func);
+ if ( oldValue ~= getglobal(newfunc) ) then
+ setglobal(func, getglobal(newfunc));
+ return true;
+ end
+ return false;
+end
+
+-- this really ought to be in a library somewhere
+local function SplitLink(link)
+ local _,_, color, item, name = string.find(link, "|c(%x+)|Hitem:(%d+:%d+:%d+:%d+)|h%[(.-)%]|h|r");
+ return color, item, name;
+end
+
+function OutfitDisplayFrame_OnLoad()
+ local temp = PickupContainerItem;
+ if ( SafeHookFunction("PickupContainerItem", "OutfitDisplayFrame_PickupContainerItem") ) then
+ SavedPickupContainerItem = temp;
+ end
+
+ temp = PickupInventoryItem;
+ if ( SafeHookFunction("PickupInventoryItem", "OutfitDisplayFrame_PickupInventoryItem") ) then
+ SavedPickupInventoryItem = temp;
+ end
+
+ local parent = this:GetName();
+ for i=1,19,1 do
+ local slotName = PlayerSlotNames[i].name;
+ local button = getglobal(parent..slotName);
+ button.tooltip = PlayerSlotNames[i].tooltip;
+ OutfitDisplayItemButton_Draw(button);
+ PlayerSlotNames[i].id = GetInventorySlotInfo(slotName);
+ end
+
+ -- ITEM_LOCK_CHANGED gets invoked a lot -- let's optimize it
+ this:RegisterEvent("PLAYER_ENTERING_WORLD");
+ this:RegisterEvent("PLAYER_LEAVING_WORLD");
+
+ -- ideas borrowed from "WeaponQuickSwap - by CapnBry"
+ this:RegisterEvent("BANKFRAME_OPENED");
+ this:RegisterEvent("BANKFRAME_CLOSED");
+
+ Print(OUTFITDISPLAYFRAME_TITLE.." loaded.");
+end
+
+local function DressUpItem(model, thing)
+ if ( not model or not thing or thing == "" ) then
+ return;
+ end
+ local item = gsub(thing, "(%d+).*", "%1", 1);
+ model:TryOn(item);
+end
+
+local BankFrameClosedTime = 0;
+
+function OutfitDisplayFrame_OnEvent(...)
+ if (arg[1] == "ITEM_LOCK_CHANGED") and not arg[2] then
+ OutfitDisplayFrame_ExecuteSwapIteration();
+ elseif ( arg[1] == "BANKFRAME_OPENED" or arg[1] == "BANKFRAME_CLOSED" ) then
+ BankFrameIsOpen = ( arg[1] == "BANKFRAME_OPENED" );
+ local frame = getglobal(this:GetName().."MessageUpdateFrame");
+ if ( frame ) then
+ BankFrameClosedTime = OUTFITDISPLAYFRAME_BANKDELAY;
+ frame:Show();
+ end
+ elseif ( arg[1] == "PLAYER_ENTERING_WORLD" ) then
+ this:RegisterEvent("ITEM_LOCK_CHANGED");
+ elseif ( arg[1] == "PLAYER_LEAVING_WORLD" ) then
+ this:UnregisterEvent("ITEM_LOCK_CHANGED");
+ end
+end
+
+function OutfitDisplayFrame_MessageUpdate(elapsed)
+ BankFrameClosedTime = BankFrameClosedTime - elapsed;
+ if ( BankFrameClosedTime <= 0 ) then
+ this:Hide();
+ OutfitDisplayFrame_UpdateMessage(this:GetParent());
+ BankFrameClosedTime = 0;
+ end
+end
+
+local function GetSlotButton(button, slotName)
+ local parent = button:GetParent():GetName();
+ return getglobal(parent..slotName);
+end
+
+local WOW = nil;
+local function _GetItemInfo(link)
+ if ( not WOW ) then
+ WOW = {};
+ local v, b, d = GetBuildInfo();
+ WOW.build = b;
+ WOW.date = d;
+ local s,e,maj,min,dot = string.find(v, "(%d+).(%d+).(%d+)");
+ FishingBuddy.Debug("Version "..v);
+ WOW.major = tonumber(maj);
+ WOW.minor = tonumber(min);
+ WOW.dot = tonumber(dot);
+ end
+-- name, link, rarity, itemlevel, minlevel, itemtype
+-- subtype, stackcount, equiploc, texture
+ local nm,li,ra,il,ml,it,st,sc,el,tx;
+ if ( WOW.major > 1 ) then
+ nm,li,ra,il,ml,it,st,sc,el,tx = GetItemInfo(link);
+ else
+ nm,li,ra,ml,it,st,sc,el,tx = GetItemInfo(link);
+ end
+ return nm,li,ra,ml,it,st,sc,el,tx,il;
+end
+
+local function IsItemOneHanded(item)
+ if ( item ) then
+ local _,_,_,_,_,_,_,bodyslot = _GetItemInfo("item:"..item);
+ if ( bodyslot == "INVTYPE_2HWEAPON" or bodyslot == INVTYPE_2HWEAPON ) then
+ return false;
+ end
+ end
+ return true;
+end
+
+function OutfitDisplayFrame_CursorCanGoInSlot(button)
+ if ( button.forced ) then
+ return false;
+ end
+ local secondary = GetSlotButton(button, "SecondaryHandSlot");
+ local mainbutton = GetSlotButton(button, "MainHandSlot");
+ if ( button == secondary and mainbutton and mainbutton.item ) then
+ return IsItemOneHanded(mainbutton.item);
+ end
+ return CursorCanGoInSlot(button:GetID())
+end
+
+-- much hackery to know what actually is in the cursor when somebody drops it on us
+local OD_Track_Bag = nil;
+local OD_Track_Slot = nil;
+
+-- whatever we think the user picked up, apply it to our stuff
+local function AcceptCursorItem(button)
+ local parent = button:GetParent();
+ local pname = parent:GetName();
+ if ( not OutfitDisplayFrame_CursorCanGoInSlot(button) ) then
+ button = nil;
+ for i=1,19,1 do
+ local temp = getglobal(pname..PlayerSlotNames[i].name);
+ if ( temp and OutfitDisplayFrame_CursorCanGoInSlot(temp) ) then
+ button = temp;
+ end
+ end
+ end
+
+ if ( button ) then
+ local link, texture;
+ if ( OD_Track_Bag ) then
+ link = GetContainerItemLink(OD_Track_Bag, OD_Track_Slot);
+ texture = GetContainerItemInfo(OD_Track_Bag, OD_Track_Slot);
+ else
+ link = GetInventoryItemLink("player", OD_Track_Slot);
+ texture = GetInventoryItemTexture("player", OD_Track_Slot);
+ end
+ button.color, button.item, button.name = SplitLink(link);
+ button.texture = texture;
+ button.used = true;
+ button.empty = nil;
+ button.missing = false;
+ if ( OD_Track_Bag and (OD_Track_Bag == BANK_CONTAINER or
+ OD_Track_Bag > NUM_BAG_SLOTS) ) then
+ button.banked = true;
+ end
+ OutfitDisplayItemButton_Change(button);
+ end
+
+ -- clear the cursor item
+ if ( OD_Track_Bag ) then
+ SavedPickupContainerItem(OD_Track_Bag, OD_Track_Slot);
+ elseif ( OD_Track_Slot ) then
+ SavedPickupInventoryItem(OD_Track_Slot);
+ end
+ OD_Track_Bag = nil;
+ OD_Track_Slot = nil;
+end
+
+-- figure out what the user picked up, so that if they drop it on us we can deal with it
+function OutfitDisplayFrame_TrackItemPickup(bag, slot)
+ OD_Track_Bag = bag;
+ OD_Track_Slot = slot;
+end
+
+function OutfitDisplayFrame_PickupContainerItem(bag, slot)
+ if ( SavedPickupContainerItem ) then
+ SavedPickupContainerItem(bag, slot);
+ end
+ OutfitDisplayFrame_TrackItemPickup(bag, slot);
+end
+
+function OutfitDisplayFrame_PickupInventoryItem(slot)
+ if ( SavedPickupInventoryItem ) then
+ SavedPickupInventoryItem(slot);
+ end
+ OutfitDisplayFrame_TrackItemPickup(nil, slot);
+end
+
+-- handle making the items in the outfit pane do nice things
+function OutfitDisplayItemButton_OnEnter()
+ if ( GameTooltip.finished ) then
+ return;
+ end
+ GameTooltip.finished = 1;
+ GameTooltip:SetOwner(this, "ANCHOR_RIGHT");
+ if (this.item) then
+ local link = "item:"..this.item;
+ if ( GetItemInfo(link) ) then
+ GameTooltip:SetHyperlink(link);
+ elseif ( this.name ) then
+ GameTooltip:SetText(this.name);
+ elseif ( this.tooltip ) then
+ GameTooltip:SetText(this.tooltip);
+ else
+ GameTooltip:SetText("", 1, 0, 0);
+ end
+ elseif ( this.tooltip ) then
+ GameTooltip:AddLine(this.tooltip);
+ else
+ local parentlen = string.len(this:GetParent():GetName())+1;
+ local slotName = strsub(this:GetName(), parentlen);
+ slotName = strsub(slotName, 1, string.len(slotName) - 4);
+ this.tooltip = slotName;
+ GameTooltip:AddLine(this.tooltip);
+ end
+ local parent = this:GetParent();
+ if ( parent.CustomTooltip ) then
+ parent.CustomTooltip(this);
+ end
+ GameTooltip:AddLine(OUTFITDISPLAYFRAME_ALTCLICK,.8,.8,.8,1);
+ GameTooltip:Show();
+end
+
+function OutfitDisplayItemButton_OnEvent(event)
+ if ( event == "CURSOR_UPDATE" ) then
+ if ( not this.forced ) then
+ if ((this.CursorCanGoInSlot and this.CursorCanGoInSlot(this)) or
+ OutfitDisplayFrame_CursorCanGoInSlot(this)) then
+ this:LockHighlight();
+ else
+ this:UnlockHighlight();
+ end
+ end
+ end
+end
+
+function OutfitDisplayItemButton_OnClick(clicked, ignoreModifiers)
+ if ( clicked == "LeftButton" ) then
+ if( not ignoreModifiers or ignoreModifiers == 0 ) then
+ if ( IsShiftKeyDown() ) then
+ if ( this.item and ChatFrameEditBox:IsVisible() ) then
+ local color = this.color;
+ if ( not color ) then
+ color = "ffffffff";
+ end
+ local link = "|c"..color.."|Hitem"..this.item.."|h["..this.name.."]|h|r";
+ ChatFrameEditBox:Insert(link);
+ return;
+ end
+ elseif ( IsAltKeyDown() ) then
+ OutfitDisplayItemButton_Clear(this, false, false);
+ OutfitDisplayItemButton_Change(this);
+ return;
+ end
+ end
+ -- fall through for drags and non-modified clicks
+ if ( CursorHasItem() ) then
+ AcceptCursorItem(this);
+ end
+ end
+end
+
+function OutfitDisplayItemButton_OnLoad()
+ local parentlen = string.len(this:GetParent():GetName())+1;
+ local slotName = strsub(this:GetName(), parentlen);
+ local id;
+ local textureName;
+ id, textureName = GetInventorySlotInfo(slotName);
+ this:SetID(id);
+ this.backgroundTextureName = textureName;
+ SetItemButtonTexture(this, this.backgroundTextureName);
+ this:RegisterForDrag("LeftButton");
+ this:RegisterForClicks("LeftButtonUp", "RightButtonUp");
+ this:RegisterEvent("CURSOR_UPDATE");
+end
+
+function OutfitDisplayItemButton_Draw(button)
+ if ( button.texture ) then
+ SetItemButtonTexture(button, button.texture);
+ else
+ SetItemButtonTexture(button, button.backgroundTextureName);
+ end
+ if ( button.missing ) then
+ SetItemButtonTextureVertexColor(button, 1.0, 0.1, 0.1);
+ elseif ( button.banked ) then
+ SetItemButtonTextureVertexColor(button, 0.1, 0.1, 1.0);
+ else
+ SetItemButtonTextureVertexColor(button, 1.0, 1.0, 1.0);
+ end
+ local checkbox = getglobal(button:GetName().."CheckBox");
+ if (checkbox) then
+ local pname = button:GetParent():GetName();
+ local showhelm = getglobal(pname.."ShowHelm");
+ local showcloak = getglobal(pname.."ShowCloak");
+ if ( button.forced ) then
+ checkbox:SetChecked(true);
+ checkbox:Disable();
+ checkbox:Show();
+ elseif ( button.empty or not button.used ) then
+ if ( checkbox.slotName == "HeadSlot" ) then
+ showhelm:Hide();
+ showhelm:SetChecked(false);
+ elseif ( checkbox.slotName == "BackSlot" ) then
+ showcloak:Hide();
+ showcloak:SetChecked(false);
+ end
+ checkbox:Enable();
+ checkbox:SetChecked(button.empty);
+ checkbox:Show();
+ elseif ( button.used ) then
+ checkbox:Hide();
+ if ( checkbox.slotName == "HeadSlot" ) then
+ showhelm:Show();
+ elseif ( checkbox.slotName == "BackSlot" ) then
+ showcloak:Show();
+ end
+ end
+ end
+end
+
+function OutfitDisplayItemButton_Change(button)
+ OutfitDisplayItemButton_Draw(button);
+ -- handle two handed weapons
+ local parent = button:GetParent();
+ local pname = parent:GetName();
+ local parentlen = string.len(pname)+1;
+ local slotName = strsub(button:GetName(), parentlen);
+ if ( slotName == "MainHandSlot" ) then
+ local secondary = getglobal(pname.."SecondaryHandSlot");
+ if ( not button.used and secondary.forced ) then
+ OutfitDisplayItemButton_Clear(secondary, false, false);
+ elseif ( button.used and not IsItemOneHanded(button.item) ) then
+ OutfitDisplayItemButton_Clear(secondary, true);
+ secondary.forced = true;
+ end
+ OutfitDisplayItemButton_Draw(secondary);
+ end
+ OutfitDisplayFrame_UpdateMessage(parent);
+ OutfitDisplayFrame_UpdateModel(parent, button);
+ if( parent.OutfitChanged ) then
+ parent.OutfitChanged( button );
+ end
+end
+
+function OutfitDisplayItemButton_Clear(button, empty, used)
+ button.name = nil;
+ button.item = nil;
+ button.texture = nil;
+ button.color = nil;
+ button.missing = nil;
+ button.banked = nil;
+ button.forced = nil;
+ button.empty = empty;
+ button.used = used or empty;
+end
+
+-- override ShowHelm and ShowCloak
+function OutfitDisplayOverrideBox_OnLoad()
+ local parentlen = string.len(this:GetParent():GetName())+1;
+ this.slotName = strsub(this:GetName(), parentlen);
+end
+
+function OutfitDisplayOverrideBox_OnEnter()
+ GameTooltip:SetOwner(this, "ANCHOR_RIGHT");
+ local text;
+ if ( this.slotName == "ShowHelm" ) then
+ text = OUTFITDISPLAYFRAME_OVERRIDEHELM;
+ else
+ text = OUTFITDISPLAYFRAME_OVERRIDECLOAK;
+ end
+ GameTooltip:SetText(text, nil, nil, nil, nil, 1);
+ GameTooltip:Show();
+end
+
+-- check box handling
+function OutfitDisplayCheckBox_OnEnter()
+ GameTooltip:SetOwner(this, "ANCHOR_RIGHT");
+ GameTooltip:SetText(OUTFITDISPLAYFRAME_USECHECKBOX, nil, nil, nil, nil, 1);
+ GameTooltip:Show();
+end
+
+function OutfitDisplayCheckBox_OnLoad()
+ local parentlen = string.len(this:GetParent():GetName())+1;
+ local name = strsub(this:GetName(), parentlen);
+ this.slotName = strsub(name, 1, -9);
+end
+
+function OutfitDisplayCheckBox_OnClick()
+ local pname = this:GetParent():GetName();
+ local button = getglobal(pname..this.slotName);
+ OutfitDisplayItemButton_Clear(button, this:GetChecked());
+ OutfitDisplayItemButton_Change(button);
+end
+
+local function UpdateModel_ThisSlot(pname, model, idx)
+ local slotName = PlayerSlotNames[idx].name;
+ local what = getglobal(pname..slotName);
+ local item = nil;
+ if ( what and what.used ) then
+ if ( not what.empty ) then
+ item = what.item;
+ end
+ else
+ local slot = PlayerSlotNames[idx].id;
+ local link = GetInventoryItemLink("player", slot);
+ if ( link ) then
+ _, item, _ = SplitLink(link);
+ end
+ end
+ if ( item ) then
+ DressUpItem(model, item);
+ end
+end
+
+function OutfitDisplayFrame_UpdateModel(frame, button)
+ local pname = frame:GetName();
+ local model = getglobal(pname.."Model");
+ local empty = false;
+ if ( not model ) then
+ return;
+ end
+ if ( button and button.used ) then
+ if ( button.empty and not button.forced ) then
+ empty = true;
+ end
+ else
+ for i=1,19,1 do
+ local what = getglobal(pname..PlayerSlotNames[i].name);
+ if ( what and what.empty ) then
+ empty = true;
+ end
+ end
+ end
+ if ( empty ) then
+ model:Undress();
+ end
+ for i=19,1,-1 do
+ UpdateModel_ThisSlot(pname, model, i);
+ end
+end
+
+function OutfitDisplayFrame_SetOutfit(frame, outfit)
+ if not outfit then
+ return;
+ end
+ local pname = frame:GetName();
+ for i=1,19,1 do
+ local slotName = PlayerSlotNames[i].name;
+ local button = getglobal(pname..slotName);
+ if ( button and outfit[slotName] and outfit[slotName].used ) then
+ OutfitDisplayItemButton_Clear(button);
+ if ( outfit[slotName].used ) then
+ button.name = outfit[slotName].name;
+ button.item = outfit[slotName].item;
+ button.texture = outfit[slotName].texture;
+ button.color = outfit[slotName].color;
+ button.missing = outfit[slotName].missing;
+ button.banked = outfit[slotName].banked;
+ button.forced = outfit[slotName].forced;
+ button.empty = outfit[slotName].empty;
+ button.used = true;
+ else
+ OutfitDisplayItemButton_Clear(button, true, true);
+ end
+ OutfitDisplayItemButton_Draw(button);
+ end
+ end
+ if ( outfit["Options"] ) then
+ local showhelm = getglobal(pname.."ShowHelm");
+ local showcloak = getglobal(pname.."ShowCloak");
+ showhelm:SetChecked(outfit["Options"].helm);
+ showcloak:SetChecked(outfit["Options"].cloak);
+ end
+ OutfitDisplayFrame_UpdateModel(frame);
+ OutfitDisplayFrame_UpdateMessage(frame, outfit);
+end
+
+function OutfitDisplayFrame_GetOutfit(frame, puthere)
+ local pname = frame:GetName();
+ local outfit = puthere or nil;
+ local showhelm = getglobal(pname.."ShowHelm");
+ local showcloak = getglobal(pname.."ShowCloak");
+ local setOptions = false;
+ if not outfit then
+ outfit = {};
+ end
+ outfit["Options"] = {};
+ for i=1,19,1 do
+ local slotName = PlayerSlotNames[i].name;
+ local button = getglobal(pname..slotName);
+
+ if ( button and button.used ) then
+ outfit[slotName] = {};
+ if ( not button.empty ) then
+ outfit[slotName].name = button.name;
+ outfit[slotName].item = button.item;
+ outfit[slotName].texture = button.texture;
+ outfit[slotName].color = button.color;
+ outfit[slotName].missing = button.missing;
+ outfit[slotName].banked = button.banked;
+ outfit[slotName].forced = button.forced;
+ end
+ outfit[slotName].empty = button.empty;
+ outfit[slotName].used = true;
+ if ( not button.empty ) then
+ if ( slotName == "HeadSlot" ) then
+ if ( showhelm ) then
+ if ( showhelm:GetChecked() ) then
+ outfit["Options"].helm = 1;
+ end
+ setOptions = true;
+ end
+ elseif ( slotName == "BackSlot" ) then
+ if ( showcloak ) then
+ if ( showcloak:GetChecked() ) then
+ outfit["Options"].cloak = 1;
+ end
+ setOptions = true;
+ end
+ end
+ end
+ elseif ( outfit and outfit.used ) then
+ outfit[slotName] = nil;
+ end
+ end
+ if ( not setOptions ) then
+ outfit["Options"] = nil;
+ end
+ if ( outfit ) then
+ -- check for two-handed weapon
+ local mainhand = outfit["MainHandSlot"];
+ if ( mainhand and not IsItemOneHanded(mainhand.item) ) then
+ outfit["SecondaryHandSlot"] = {};
+ outfit["SecondaryHandSlot"].forced = true;
+ outfit["SecondaryHandSlot"].empty = true;
+ outfit["SecondaryHandSlot"].used = true;
+ end
+ end
+ return outfit;
+end
+
+function OutfitDisplayFrame_GetItemInfo(bag, slot)
+ local link;
+ local c, i, n;
+ if ( bag ) then
+ link = GetContainerItemLink (bag,slot);
+ else
+ link = GetInventoryItemLink("player", slot);
+ end
+ if (link) then
+ c, i, n = SplitLink(link);
+ end
+ return c, i, n;
+end
+
+-- get a snapshot of the current state of the player
+function OutfitDisplayFrame_GetBagInfo()
+ local contents = {};
+ local empties = {};
+
+ local numSlots = 0;
+ -- check each of the bags on the player
+ for bag=0, NUM_BAG_FRAMES do
+ -- get the number of slots in the bag (0 if no bag)
+ numSlots = GetContainerNumSlots(bag);
+ if (numSlots > 0) then
+ -- check each slot in the bag
+ for slot=1, numSlots do
+ local c, i, n = OutfitDisplayFrame_GetItemInfo(bag, slot);
+ if ( i ) then
+ contents[i] = {};
+ contents[i].bag = bag;
+ contents[i].slot = slot;
+ contents[i].color = c;
+ contents[i].name = n;
+ else
+ local what = {};
+ what.bag = bag;
+ what.slot = slot;
+ tinsert(empties, what);
+ end
+ end
+ end
+ end
+
+ for idx=1,19,1 do
+ local slot = PlayerSlotNames[idx].id;
+ local c, i, n = OutfitDisplayFrame_GetItemInfo(nil, slot);
+ if ( i ) then
+ contents[i] = {};
+ contents[i].slot = slot;
+ contents[i].color = c;
+ contents[i].name = n;
+ end
+ end
+
+ return contents, empties;
+end
+
+-- look in a particular bag
+local function CheckThisBag(bag, id, skipcount)
+ -- get the number of slots in the bag (0 if no bag)
+ local numSlots = GetContainerNumSlots(bag);
+ if (numSlots > 0) then
+ -- check each slot in the bag
+ for slot=1, numSlots do
+ local c, i, n = OutfitDisplayFrame_GetItemInfo(bag, slot);
+ if ( i and id == i ) then
+ if ( skipcount == 0 ) then
+ return slot, skipcount;
+ end
+ skipcount = skipcount - 1;
+ end
+ end
+ end
+ return nil, skipcount;
+end
+
+-- look for the outfit anywhere we can find it
+local function FindThisItem(id, skipcount)
+ if ( not id ) then
+ return nil,nil,nil;
+ end
+ local skipcount = skipcount or 0;
+ -- check each of the bags on the player
+ for bag=0, NUM_BAG_FRAMES do
+ local slot;
+ slot, skipcount = CheckThisBag(bag, id, skipcount);
+ if ( slot ) then
+ return bag, slot, false;
+ end
+ end
+
+ for idx=1,19,1 do
+ local slot = PlayerSlotNames[idx].id;
+ local c, i, n = OutfitDisplayFrame_GetItemInfo(nil, slot);
+ if ( (id and i and id == i) or (name and n and name == n) ) then
+ if ( skipcount == 0 ) then
+ return nil, slot, false;
+ end
+ skipcount = skipcount - 1;
+ end
+ end
+
+ -- look in the bank
+ -- Geez, this is ugly
+ local bankbags = { BANK_CONTAINER, 5, 6, 7, 8, 9, 10 };
+ for b=1,7 do
+ local slot;
+ slot, skipcount = CheckThisBag(bankbags[b], id, skipcount);
+ if ( slot ) then
+ return bankbags[b], slot, true;
+ end
+ end
+ -- return nil, nil, nil;
+end
+
+-- look for the outfit anywhere we can find it
+-- we should look in the bank someday
+function OutfitDisplayFrame_FindOutfit(outfit)
+ -- look for every item, if we find everything return a table of locations
+ -- otherwise don't return anything
+ if ( not outfit ) then
+ return nil;
+ end
+ local spots = { };
+ for slotName in pairs(outfit) do
+ if ( outfit[slotName].use and not outfit[slotName].empty ) then
+ local bag, slot = FindThisItem( outfit[slotName].item );
+ if ( not bag and not slot ) then
+ spots = nil;
+ return nil;
+ else
+ spots[slotName] = { };
+ spots[slotName].bag = bag;
+ spots[slotName].slot = slot;
+ end
+ end
+ end
+ return spots;
+end
+
+function OutfitDisplayFrame_CanFindOutfit(outfit)
+ if ( not outfit ) then
+ return false;
+ end
+ for slotName in pairs(outfit) do
+ if ( outfit[slotName].used and not outfit[slotName].empty ) then
+ local bag, slot = FindThisItem( outfit[slotName].item );
+ if ( not bag and not slot ) then
+ return false;
+ end
+ end
+ end
+ return true;
+end
+
+local function CheckSwitchWillFail(frame, outfit)
+ local contents, empties = OutfitDisplayFrame_GetBagInfo();
+ local numfree = table.getn(empties);
+ local needfree = 0;
+ local missing = false;
+ local banked = false;
+ for i=1,19,1 do
+ local slotName = PlayerSlotNames[i].name;
+ local check;
+ if ( outfit ) then
+ check = outfit[slotName];
+ else
+ check = getglobal(frame:GetName()..slotName);
+ end
+ if ( check and check.used ) then
+ if ( not check.empty ) then
+ local bag, slot, inbank = FindThisItem( check.item );
+ if ( not bag and not slot ) then
+ -- pretend it's still in the bank and we just can't get it
+ if ( check.banked ) then
+ check.banked = true;
+ banked = true;
+ else
+ missing = true;
+ end
+ check.missing = not check.banked;
+ else
+ check.missing = nil;
+ check.banked = inbank;
+ end
+ else
+ local slot = PlayerSlotNames[i].id;
+ if ( OutfitDisplayFrame_GetItemInfo(nil, slot) ) then
+ needfree = needfree + 1;
+ end
+ end
+ end
+ end
+ if ( missing ) then
+ return OUTFITDISPLAYFRAME_ITEMSNOTFOUND;
+ end
+ if ( banked and not BankIsOpen ) then
+ return OUTFITDISPLAYFRAME_ITEMSINBANK;
+ end
+ if ( needfree > numfree ) then
+ return OUTFITDISPLAYFRAME_NOTENOUGHFREESPACE;
+ end
+ return nil;
+end
+
+function OutfitDisplayFrame_SwitchWillFail(frame, outfit)
+ if ( not outfit ) then
+ return OUTFITDISPLAYFRAME_INVALIDOUTFIT;
+ end
+ if ( not next(outfit) ) then
+ return OUTFITDISPLAYFRAME_EMPTYOUTFIT;
+ end
+ -- if we're swapping, fail early
+ if ( OutfitDisplayFrame_IsSwapping() ) then
+ return OUTFITDISPLAYFRAME_TOOFASTMSG;
+ end
+ return CheckSwitchWillFail(frame, outfit);
+end
+
+function OutfitDisplayFrame_IsWearing(outfit)
+ if ( not outfit ) then
+ return false;
+ end
+ for slotName in pairs(outfit) do
+ if ( outfit[slotName].used and not outfit[slotName].empty ) then
+ local slot = GetInventorySlotInfo(slotName);
+ local link = GetInventoryItemLink("player", slot);
+ local foundit = false;
+ if ( link ) then
+ local color, item, name = SplitLink(link);
+ if ( item == outfit[slotName].item ) then
+ foundit = true;
+ end
+ end
+ if ( not foundit ) then
+ return false;
+ end
+ end
+ end
+ return true;
+end
+
+function OutfitDisplayFrame_UpdateMessage(frame, outfit)
+ if ( frame ) then
+ local msg;
+ if ( outfit ) then
+ msg = CheckSwitchWillFail(frame, outfit);
+ end
+ local messages = getglobal(frame:GetName().."Message");
+ if ( msg ) then
+ messages:SetText(msg);
+ messages:SetTextColor(1, 1, 1);
+ messages:Show();
+ else
+ messages:SetText("");
+ messages:Hide();
+ end
+ end
+end
+
+function OutfitDisplayFrame_GetSlotContents(slotName, returnEmpty)
+ if ( slotName ~= "Options" ) then
+ local slot = GetInventorySlotInfo(slotName);
+ local link = GetInventoryItemLink("player", slot);
+ if ( link ) then
+ local contents = {};
+ local color, item, name = SplitLink(link);
+ contents.item = item;
+ contents.name = name;
+ contents.color = color;
+ contents.texture = texture;
+ contents.used = true;
+ local bag, slot = FindThisItem( item );
+ contents.bag = bag;
+ contents.slot = slot;
+ return contents;
+ end
+ end
+ -- return nil;
+end
+
+function OutfitDisplayFrame_GetWearing(check)
+ local wearing = {};
+ if ( check ) then
+ for slotName in pairs(check) do
+ wearing[slotName] = OutfitDisplayFrame_GetSlotContents(slotName);
+ end
+ -- make sure we pick up the off hand if we're going to put something
+ -- two-handed in the main hand slot
+ local mainhand = check["MainHandSlot"];
+ local offhand = wearing["SecondaryHandSlot"];
+ if ( not offhand and mainhand and not IsItemOneHanded(mainhand.item) ) then
+ wearing["SecondaryHandSlot"] = OutfitDisplayFrame_GetSlotContents("SecondaryHandSlot");
+ end
+ else
+ for i=1,19,1 do
+ local slotName = PlayerSlotNames[i].name;
+ wearing[slotName] = OutfitDisplayFrame_GetSlotContents(slotName);
+ end
+ end
+ wearing["Options"] = {}
+ if ( ShowingCloak() ) then
+ wearing["Options"].cloak = 1;
+ else
+ wearing["Options"].cloak = 0;
+ end
+ if ( ShowingHelm() ) then
+ wearing["Options"].helm = 1;
+ else
+ wearing["Options"].helm = 0;
+ end
+ return wearing;
+end
+
+function OutfitDisplayFrame_FindLastEmptyBagSlot(skipcount, bag_affinity, slot_affinity)
+ skipcount = skipcount or 0;
+
+ -- try to put the item in the requested affinity, if possible
+ if bag_affinity and slot_affinity and
+ not GetContainerItemInfo(bag_affinity, slot_affinity) then
+ return bag_affinity, slot_affinity;
+ end
+
+ -- if we couldn't get the bag and slot we wanted, just try the same bag
+ if bag_affinity then
+ for j=GetContainerNumSlots(bag_affinity),1,-1 do
+ if not GetContainerItemInfo(bag_affinity,j) then
+ if skipcount == 0 then return bag_affinity,j; end
+ skipcount = skipcount - 1;
+ end
+ end
+ end
+
+ -- no affinity, check all bags
+ for i=NUM_BAG_FRAMES,0,-1 do
+ -- but skip any bag we already have affinity for (because it might have
+ -- already modified skipcount)
+ if bag_affinity ~= i then
+ -- Make sure this isn't a quiver, those won't hold shit
+ local bagName = GetBagName(i);
+ if ( bagName ) then
+ local texture = GetInventoryItemTexture("player",
+ ContainerIDToInventoryID(i));
+
+ if ( string.find(texture, "INV_Misc_Bag_%d") and not string.find(bagName, AMMOSLOT) ) then
+ for j=GetContainerNumSlots(i),1,-1 do
+ if not GetContainerItemInfo(i,j) then
+ if skipcount == 0 then return i,j; end
+ skipcount = skipcount - 1;
+ end -- if empty
+ end -- for slots
+ end -- if normal bag
+ end -- if there is a bag
+ end -- if not affinity bag
+ end -- for bags
+
+ -- not found return nil,nil implicitly
+end
+
+-- okay, let's switch to the specified outfit
+-- code liberally borrowed from "WeaponQuickSwap - by CapnBry"
+
+-- list functions
+local function swapentry_print(entry)
+ if ( DEFAULT_CHAT_FRAME ) then
+ local msg = "Entry "..tonil(entry.sb)..","..tonil(entry.si)..","..tonil(entry.db)..","..tonil(entry.di);
+ DEFAULT_CHAT_FRAME:AddMessage(msg, 1.0,0,0);
+ end
+end
+
+local function swaplist_print(list)
+ while ( list ) do
+ swapentry_print(list);
+ list = list.next;
+ end
+end
+
+local function swaplist_push(list, sb, si, db, di, helm, cloak)
+ list = { next = list, sb = sb, si = si, db = db, di = di,
+ helm = helm, cloak = cloak };
+ return list;
+end
+
+local function swaplist_popfirst(list)
+ if not list then return; end
+ list = list.next;
+ return list;
+end
+
+-- Unit variable to hold the stack of swaps
+local outfitswap = nil;
+
+function OutfitDisplayFrame_IsSwapping()
+ if ( outfitswap or OutfitDisplayFrame_AnyItemLocked() ) then
+ return true;
+ else
+ return false;
+ end
+end
+
+-- First we do everything except the main hand and secondary hand
+-- Then we do the hard stuff
+
+function OutfitDisplayFrame_ItemIsLocked(bag, slot)
+ if not bag and not slot then
+ return false;
+ end
+
+ if not bag then
+ return IsInventoryItemLocked(slot);
+ else
+ local _,_,locked = GetContainerItemInfo(bag,slot);
+ return locked;
+ end
+end
+
+function OutfitDisplayFrame_AnyItemLocked()
+-- Checks all the bags and the equipped slots to see if any are still locked
+ for i=0,NUM_BAG_FRAMES do
+ for j=1,GetContainerNumSlots(i) do
+ local _,_,locked = GetContainerItemInfo(i,j);
+ if ( locked ) then
+ return true;
+ end
+ end
+ end
+ for i=1,19,1 do
+ if ( IsInventoryItemLocked(PlayerSlotNames[i].id) ) then
+ return true;
+ end
+ end
+ return false;
+end
+
+local function ShowCheck(dohelm, flag)
+ if ( flag ) then
+ if ( dohelm ) then
+ ShowHelm(flag);
+ else
+ ShowCloak(flag);
+ end
+ end
+end
+
+function OutfitDisplayFrame_ExecuteSwapIteration()
+ if not outfitswap then
+ PerformSlowerSwap = false;
+ return;
+ end
+
+ if OutfitDisplayFrame_ItemIsLocked(outfitswap.sb, outfitswap.si) or
+ OutfitDisplayFrame_ItemIsLocked(outfitswap.db, outfitswap.di) then
+ return;
+ end
+
+ local beslow = PerformSlowerSwap;
+
+ if ( outfitswap.helm ~= nil or outfitswap.cloak ~= nil ) then
+
+ ShowCheck ( true, outfitswap.helm);
+ ShowCheck ( false, outfitswap.cloak);
+
+ beslow = false;
+
+ else
+
+ if not outfitswap.sb then
+ SavedPickupInventoryItem(outfitswap.si);
+ else
+ SavedPickupContainerItem(outfitswap.sb, outfitswap.si);
+ end
+
+ if not outfitswap.db then
+ if not outfitswap.di then
+ PutItemInBackpack();
+ else
+ SavedPickupInventoryItem(outfitswap.di);
+ end
+ else
+ SavedPickupContainerItem(outfitswap.db, outfitswap.di);
+ end
+
+ end
+
+ outfitswap = swaplist_popfirst(outfitswap);
+ if ( outfitswap and not beslow ) then
+ return OutfitDisplayFrame_ExecuteSwapIteration();
+ end
+end
+
+function OutfitDisplayFrame_SwitchOne(outfit, index, skipcount)
+ local slotName = PlayerSlotNames[index].name;
+ if ( outfit and outfit[slotName] ) then
+ local invslot = GetInventorySlotInfo(slotName);
+ if ( outfit[slotName].empty ) then
+ local bag, slot = OutfitDisplayFrame_FindLastEmptyBagSlot(skipcount);
+ outfitswap = swaplist_push(outfitswap, nil, invslot, bag, slot);
+ skipcount = skipcount + 1;
+ else
+ local bag, slot = FindThisItem( outfit[slotName].item );
+ -- either we couldn't find it, or it's where it should be
+ if ( bag ~= nil or slot ~= invslot ) then
+ outfitswap = swaplist_push(outfitswap, bag, slot, nil, invslot);
+ end
+ end
+ end
+ return skipcount;
+end
+
+local function OnSwapError(error)
+ outfitswap = nil;
+ if ( UIErrorsFrame ) then
+ UIErrorsFrame:AddMessage(error, 1.0, 0.1, 0.1, 1.0, UIERRORS_HOLD_TIME);
+ end
+ return;
+end
+
+function OutfitDisplayFrame_SwitchOutfit(outfit)
+ if ( CursorHasItem() or OutfitDisplayFrame_IsSwapping() ) then
+ return OnSwapError(OUTFITDISPLAYFRAME_TOOFASTMSG);
+ end
+ if ( not outfit ) then
+ return OnSwapError(OUTFITDISPLAYFRAME_INVALIDOUTFIT);
+ end
+
+ -- might not need to swap slowly
+ PerformSlowerSwap = false;
+
+ -- need to check to see that we have enough room
+ local old = OutfitDisplayFrame_GetWearing(outfit);
+
+ if ( outfit["Options"] ) then
+ -- do cloak and helm setting last
+ outfitswap = swaplist_push(outfitswap, nil, nil, nil, nil,
+ outfit["Options"].helm,
+ outfit["Options"].cloak);
+ end
+
+ -- do everything except weapon slots
+ local skipcount = 0;
+ for i=1,16,1 do
+ skipcount = OutfitDisplayFrame_SwitchOne(outfit, i, skipcount);
+ end
+ OutfitDisplayFrame_SwitchOne(outfit, 19, skipcount);
+
+ if ( not outfit["MainHandSlot"] and not outfit["SecondaryHandSlot"] ) then
+ OutfitDisplayFrame_ExecuteSwapIteration();
+ return old;
+ end
+
+ local mainhandslot = GetInventorySlotInfo("MainHandSlot");
+ local secondaryslot = GetInventorySlotInfo("SecondaryHandSlot");
+ local mainhand = outfit["MainHandSlot"];
+ local offhand = outfit["SecondaryHandSlot"];
+ -- now do hands
+ local m_sb;
+ local m_si;
+ local o_sb;
+ local o_si;
+ local m_ok = not mainhand or not mainhand.item;
+ local o_ok = not offhand or not offhand.item;
+
+ if ( mainhand and mainhand.item ) then
+ m_sb, m_si = FindThisItem(mainhand.item);
+ m_ok = ( not m_sb and m_si == mainhandslot );
+ end
+ if ( offhand and offhand.item ) then
+ local multiples = 0;
+ if ( mainhand and mainhand.item == offhand.item ) then
+ multiples = 1;
+ end
+ o_sb, o_si = FindThisItem( offhand.item, multiples);
+ o_ok = ( not o_sb and o_si == secondaryslot );
+ end
+
+ if ( not m_ok ) then
+ -- do we need two of these?
+ if ( o_ok and not m_sb and m_si == secondaryslot ) then
+ m_sb, m_si = FindThisItem( mainhand.item, 1);
+ end
+ end
+
+ -- moving from bags
+ if ( m_sb and o_sb ) then
+ -- insert them backwards, since they get popped off
+ -- main hand has to get done first in case it's currently
+ -- a two hander
+ outfitswap = swaplist_push(outfitswap, o_sb, o_si, nil, secondaryslot);
+ outfitswap = swaplist_push(outfitswap, m_sb, m_si, nil, mainhandslot);
+ elseif ( not m_sb and m_si == secondaryslot and not o_sb and o_si == mainhandslot ) then
+ outfitswap = swaplist_push(outfitswap, nil, mainhandslot, nil, secondaryslot);
+ else
+ -- Install main hand
+ if not m_ok then
+ -- if nothing going to the main hand
+ if ( not m_sb and not m_si ) then
+ -- and the main is not going to the off: put it in a bag
+ if not ( not o_sb and o_si == mainhandslot) then
+ local bb, bi = OutfitDisplayFrame_FindLastEmptyBagSlot(skipcount);
+ if not (bb and bi) then
+ return OnSwapError(OUTFITDISPLAYFRAME_NOTENOUGHFREESPACE);
+ end
+ skipcount = skipcount + 1;
+ outfitswap = swaplist_push(outfitswap, nil, mainhandslot, bb, bi);
+ -- when moving A,"" -> "",B where A is a 2h, the offhand
+ -- doesn't lock properly, so work around it by swapping
+ -- slowly (only one swap per lock notify)
+ PerformSlowerSwap = not IsItemOneHanded(mainhand.item);
+ end
+ else
+ outfitswap = swaplist_push(outfitswap, m_sb, m_si, nil, mainhandslot);
+ end
+ end
+
+ -- Load offhand if not already there
+ if not o_ok then
+ if ( not o_sb and not o_si ) then
+ if not (not m_sb and m_si == secondaryslot) then
+ local bb, bi;
+ if LastOffSource then
+ bb, bi = OutfitDisplayFrame_FindLastEmptyBagSlot(skipcount,
+ LastOffSource.bag, LastOffSource.slot);
+ else
+ bb, bi = OutfitDisplayFrame_FindLastEmptyBagSlot(skipcount);
+ end
+
+ if not (bb and bi) then
+ return OnSwapError(OUTFITDISPLAYFRAME_NOTENOUGHFREESPACE);
+ end
+ skipcount = skipcount + 1;
+ outfitswap = swaplist_push(outfitswap, nil, secondaryslot, bb, bi);
+ end
+ else
+ -- if the main hand weapon is coming from the offhand slot
+ -- we need to fix up its source to be where the offhand is
+ -- GOING to be after the bag->off swap
+ if outfitswap and ( not m_sb and m_si == secondaryslot) then
+ outfitswap.sb = o_sb;
+ outfitswap.si = o_si;
+ -- don't set o_sb, o_si they're tested later
+ end
+
+ outfitswap = swaplist_push(outfitswap, o_sb, o_si, nil, secondaryslot);
+ end
+ end
+
+-- Special Case: Moving off to main, and not main to off
+-- This is because maybe the main hand weapon is main only
+ if (not m_sb and m_si == secondaryslot) and not ( not o_sb and o_si == mainhandslot) then
+ local bb, bi = OutfitDisplayFrame_FindLastEmptyBagSlot(skipcount);
+ if not (bb and bi) then
+ return OnSwapError(OUTFITDISPLAYFRAME_NOTENOUGHFREESPACE);
+ end
+ skipcount = skipcount + 1;
+ outfitswap = swaplist_push(outfitswap, nil, mainhandslot, bb, bi);
+ end
+
+ -- Same thing for off hand
+ if (not o_sb and o_si == mainhandslot) and not (not m_sb and m_si == secondaryslot) then
+ local bb, bi = OutfitDisplayFrame_FindLastEmptyBagSlot(skipcount);
+ if not (bb and bi) then
+ return OnSwapError(OUTFITDISPLAYFRAME_NOTENOUGHFREESPACE);
+ end
+ skipcount = skipcount + 1;
+ outfitswap = swaplist_push(outfitswap, nil, mainhandslot, bb, bi);
+ end
+
+ if o_sb then
+ LastOffSource = { bag = o_sb, slot = o_si };
+ end
+ end
+
+ -- Start moving
+ OutfitDisplayFrame_ExecuteSwapIteration();
+ return old;
+end
diff --git a/OutfitDisplayFrame/OutfitDisplayFrame.toc b/OutfitDisplayFrame/OutfitDisplayFrame.toc
new file mode 100644
index 0000000..1b7f438
--- /dev/null
+++ b/OutfitDisplayFrame/OutfitDisplayFrame.toc
@@ -0,0 +1,8 @@
+## Interface: 11200
+## Title: OutfitDisplayFrame
+## Version: 0.5.9
+## Notes: A utility frame to display a set of equipable items.
+## Notes-deDE: Ein Fenster, dass die Ausr\195\188stung anzeigt
+## Notes-frFR: Un cadre d'utilit\195\169 pour afficher une s\195\169rie d'articles de equipable
+## Author: Sutorix=AT=hotmail.com
+OutfitDisplayFrame.xml
diff --git a/OutfitDisplayFrame/OutfitDisplayFrame.xml b/OutfitDisplayFrame/OutfitDisplayFrame.xml
new file mode 100644
index 0000000..a07bfe1
--- /dev/null
+++ b/OutfitDisplayFrame/OutfitDisplayFrame.xml
@@ -0,0 +1,541 @@
+
+
+
+
+
+
+ OutfitDisplayItemButton_OnLoad();
+
+
+ OutfitDisplayItemButton_Draw(this);
+
+
+ OutfitDisplayItemButton_OnClick(arg1);
+
+
+ OutfitDisplayItemButton_OnEvent(event);
+
+
+ OutfitDisplayItemButton_OnEnter();
+
+
+ GameTooltip.finished = nil;
+ GameTooltip:Hide();
+
+
+ OutfitDisplayItemButton_OnClick("LeftButton", 1);
+
+
+
+
+
+
+
+
+
+
+
+
+
+ OutfitDisplayCheckBox_OnLoad();
+
+
+ OutfitDisplayCheckBox_OnClick();
+
+
+ OutfitDisplayCheckBox_OnEnter();
+
+
+ GameTooltip.finished = nil;
+ GameTooltip:Hide();
+
+
+
+
+
+
+
+
+
+
+
+
+
+ OutfitDisplayOverrideBox_OnLoad();
+
+
+ OutfitDisplayOverrideBox_OnEnter();
+
+
+ GameTooltip.finished = nil;
+ GameTooltip:Hide();
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Model_OnLoad();
+ this:RegisterEvent("DISPLAY_SIZE_CHANGED");
+ this:RegisterEvent("UNIT_MODEL_CHANGED");
+ this:RegisterEvent("PLAYER_ENTERING_WORLD");
+
+
+ if ( event == "PLAYER_ENTERING_WORLD" ) then
+ this:SetUnit("player");
+ return;
+ end
+ if ( this:IsVisible() ) then
+ OutfitDisplayFrame_UpdateModel(this);
+ end
+
+
+ OutfitDisplayFrame_UpdateModel(this);
+
+
+ Model_OnUpdate(arg1, this);
+
+
+
+
+
+
+
+
+
+ this:RegisterForClicks("LeftButtonDown", "LeftButtonUp");
+ local parent = this:GetParent():GetParent():GetName();
+ this:ClearAllPoints();
+ this:SetPoint("TOPLEFT", parent.."HeadSlotCheckBox", "TOPRIGHT", 12, 0);
+
+
+ Model_RotateLeft(this:GetParent());
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ this:RegisterForClicks("LeftButtonDown", "LeftButtonUp");
+
+
+ Model_RotateRight(this:GetParent());
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ this:SetFrameLevel(this:GetFrameLevel()+1);
+
+
+
+
+
+
+ OutfitDisplayFrame_MessageUpdate(arg1);
+
+
+
+
+
+
+ OutfitDisplayFrame_OnLoad();
+
+
+ OutfitDisplayFrame_OnEvent(event, arg1);
+
+
+ return;
+
+
+
+
+
diff --git a/OutfitDisplayFrame/changes.txt b/OutfitDisplayFrame/changes.txt
new file mode 100644
index 0000000..f96fa69
--- /dev/null
+++ b/OutfitDisplayFrame/changes.txt
@@ -0,0 +1,55 @@
+Version 0.5.9
+- Add a way for clients to add their own tooltip information
+- Update 'for' loops to be compatible with Lua 5.1
+
+Version 0.5.8
+- Update toc for patch 1.12
+
+Version 0.5.7
+- Optimize event handling (lots if ITEM_LOCK_CHANGED events during
+ world transitions)
+- Empty outfits have a message
+
+Version 0.5.6
+- Fix nil error when you have fewer than five bags
+
+Version 0.5.5
+- Fix "no space" error when swapping empty space for empty space
+
+Version 0.5.4
+- Attempt to fix soul bag issues (as well as ammo pouches and quivers)
+
+Version 0.5.3
+- Better French translation, thanks to Corwin Whitehorn
+
+Version 0.5.2
+- Add the information about alt-clicking to clear the outfit item
+ to all tooltips
+
+Version 0.5.1
+- Fix a bug where dual-wield of the same item would fail to switch
+ correctly
+
+Version 0.5
+- Add an option to override the values of "Show Helm" and "Show Cloak"
+ when switching outfits
+- Make forced entries disabled
+
+Version 0.4
+- Add outfit preview using the new 'dressing room' stuff
+- Fix two hand weapon to only off hand bug (missed from WeaponQuickSwap)
+- Count locked items as still swapping outfits
+- Use GetItemInfo to find Two-hand items, instead of parsing tooltips.
+ This should mean that OutfitDisplayFrame will now switch for all
+ languages, even those without explicit translations.
+
+Version 0.3.1
+- Fix a typo in the item clearing code
+
+Version 0.3
+- Handle outfits with banked items
+- Code cleanup
+
+Version 0.2
+- Allow 'empty' items in outfits
+- More robust switching code
diff --git a/OutfitDisplayFrame/localization.lua b/OutfitDisplayFrame/localization.lua
new file mode 100644
index 0000000..d773b8d
--- /dev/null
+++ b/OutfitDisplayFrame/localization.lua
@@ -0,0 +1,40 @@
+-- Magic strings
+
+-- English
+OUTFITDISPLAYFRAME_NOTENOUGHFREESPACE = "Not enough free space in bags.";
+OUTFITDISPLAYFRAME_ITEMSNOTFOUND = "Outfit contains missing items.";
+OUTFITDISPLAYFRAME_INVALIDOUTFIT = "Invalid outfit format.";
+OUTFITDISPLAYFRAME_EMPTYOUTFIT = "Empty outfit.";
+OUTFITDISPLAYFRAME_ITEMSINBANK = "Outfit contains banked items.";
+OUTFITDISPLAYFRAME_TOOFASTMSG = "Can't switch outfits that quickly.";
+OUTFITDISPLAYFRAME_ALTCLICK = "Alt-click will reset to an empty slot.";
+
+OUTFITDISPLAYFRAME_USECHECKBOX = "When checked, this slot is forced empty on switch.";
+OUTFITDISPLAYFRAME_OVERRIDEHELM = "When checked, override the value of \"Show Helm\" when this outfit is worn.";
+OUTFITDISPLAYFRAME_OVERRIDECLOAK = "When checked, override the value of \"Show Cloak\" when this outfit is worn.";
+
+-- German
+if ( GetLocale() == "deDE" ) then
+ OUTFITDISPLAYFRAME_NOTENOUGHFREESPACE = "Nicht genug Platz in den Taschen";
+ OUTFITDISPLAYFRAME_ITEMSNOTFOUND = "Ausr\195\188stung enth\195\164lt fehlende Gegenst\195\164nde";
+ OUTFITDISPLAYFRAME_INVALIDOUTFIT = "Ung\195\188ltiges Ausr\195\188stungsformat";
+ OUTFITDISPLAYFRAME_ITEMSINBANK = "Ausstattung enth\195\164lt Gegenst\195\164nde, die auf der Bank sind.";
+ OUTFITDISPLAYFRAME_TOOFASTMSG = "Sie k\195\182nnen nicht Ausstattungen schalten, die schnell.";
+
+ OUTFITDISPLAYFRAME_USECHECKBOX = "Wenn H\195\164ckchen gesetzt, wird der Taschenplatz wird bim Ausr\195\188stungswechsel geleert.";
+end
+
+if ( GetLocale() == "frFR" ) then
+ -- OUTFITDISPLAYFRAME_TWOHANDED = "Deux-mains";
+ OUTFITDISPLAYFRAME_NOTENOUGHFREESPACE = "Pas assez d'espace libre dans les sacs";
+ OUTFITDISPLAYFRAME_ITEMSNOTFOUND = "Articles manquants pour l'\195\169quipement choisi.";
+ OUTFITDISPLAYFRAME_INVALIDOUTFIT = "Format d'\195\169quipement incorrect.";
+ OUTFITDISPLAYFRAME_ITEMSINBANK = "L'\195\169quipement contient les articles en banque.";
+ OUTFITDISPLAYFRAME_TOOFASTMSG = "On ne peut pas commuter les \195\169quipements aussi rapidement.";
+
+ OUTFITDISPLAYFRAME_ALTCLICK = "Alt-click annulera l'equipement";
+
+ OUTFITDISPLAYFRAME_USECHECKBOX = "Si coch\195\169, ce slot est vid\195\169 lors de la commutation.";
+ OUTFITDISPLAYFRAME_OVERRIDEHELM = "Si coch\195\169, force le \"Afficher le casque\" quand cette tenue est port\195\169e.";
+ OUTFITDISPLAYFRAME_OVERRIDECLOAK = "Si coch\195\169, force le \"Afficher la cape\" quand cette tenue est port\195\169e.";
+end
diff --git a/OutfitDisplayFrame/readme.txt b/OutfitDisplayFrame/readme.txt
new file mode 100644
index 0000000..44e2610
--- /dev/null
+++ b/OutfitDisplayFrame/readme.txt
@@ -0,0 +1,14 @@
+OutfitDisplayFrame
+------------------
+
+This is a utility frame for handling 'outfits' -- collections of wearable
+items that you can swap with what you are currently wearing.
+
+It's in its early stages, so don't expect perfection -- but it does a pretty
+good job of hanlding the basics. Plus, it handles having part of your outfits
+in the bank!
+
+This would not have been possible without the incredible example of
+WeaponQuickSwap by CapnBry.
+
+Feel free to send comments to Sutorix on the Windrunner server.
\ No newline at end of file