Merge ilithyia-addons fork (v0.8.8e)
- Russian localization (by Maus) - FishingSchools: track fishing pools, Gatherer integration - FishingOutfitter: Outfitter addon integration - Interface 11200 (patch 1.12 support) - Improved options system with dependencies - Better watcher frame positioning - Various bugfixes Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
+113
-32
@@ -1,6 +1,8 @@
|
||||
-- Wrap OutfitDisplayFrame with our "improvements"
|
||||
FishingBuddy.OutfitFrame = {};
|
||||
|
||||
local DEFAULTUPDATE_WAIT = 0.1;
|
||||
|
||||
local function StylePoints(outfit)
|
||||
local isp = FishingBuddy.OutfitManager.ItemStylePoints;
|
||||
local points = 0;
|
||||
@@ -54,18 +56,45 @@ local function BonusPoints(outfit)
|
||||
end
|
||||
|
||||
local function UpdateSwitchButton(outfit)
|
||||
if ( outfit and not OutfitDisplayFrame_SwitchWillFail(FishingOutfitFrame, outfit) ) then
|
||||
local msg = OutfitDisplayFrame_SwitchWillFail(FishingOutfitFrame, outfit);
|
||||
if ( outfit and not msg ) then
|
||||
FishingOutfitSwitchButton:Enable();
|
||||
else
|
||||
FishingOutfitSwitchButton:Disable();
|
||||
end
|
||||
end
|
||||
|
||||
FishingBuddy.OutfitFrame.OutfitChanged = function(button)
|
||||
local outfit = OutfitDisplayFrame_GetOutfit(FishingOutfitFrame);
|
||||
if ( outfit ) then
|
||||
FishingBuddy.SetOutfit(outfit);
|
||||
-- outfit support functions
|
||||
local function GetWasWearing()
|
||||
if FishingBuddy_Player["WasWearing"] then
|
||||
return FishingBuddy_Player["WasWearing"];
|
||||
end
|
||||
end
|
||||
|
||||
local function SetWasWearing(outfit)
|
||||
FishingBuddy_Player["WasWearing"] = outfit;
|
||||
end
|
||||
|
||||
local function GetOutfit()
|
||||
return FishingBuddy_Player["Outfit"];
|
||||
end
|
||||
|
||||
local saved_outfit;
|
||||
local function SetOutfit(outfit)
|
||||
saved_outfit = outfit;
|
||||
FishingBuddy_Player["Outfit"] = outfit;
|
||||
end
|
||||
|
||||
local updateWait = DEFAULTUPDATE_WAIT;
|
||||
FishingBuddy.OutfitFrame.Update = function(elapsed)
|
||||
updateWait = updateWait - elapsed;
|
||||
if ( updateWait <= 0 ) then
|
||||
UpdateSwitchButton(saved_outfit);
|
||||
FishingOutfitUpdate:Hide();
|
||||
end
|
||||
end
|
||||
|
||||
local function UpdateStyleInfo()
|
||||
local points = BonusPoints(outfit);
|
||||
if ( points >= 0 ) then
|
||||
points = "+"..points;
|
||||
@@ -82,8 +111,28 @@ FishingBuddy.OutfitFrame.OutfitChanged = function(button)
|
||||
pstring = FishingBuddy.POINTS;
|
||||
end
|
||||
FishingOutfitStyle:SetText(FishingBuddy.CONFIG_STYLISH_TEXT..points.." "..pstring);
|
||||
UpdateSwitchButton(outfit);
|
||||
end
|
||||
|
||||
local function OutfitChanged(button)
|
||||
local outfit = OutfitDisplayFrame_GetOutfit(FishingOutfitFrame);
|
||||
if ( outfit ) then
|
||||
SetOutfit(outfit);
|
||||
end
|
||||
UpdateStyleInfo();
|
||||
FishingOutfitFrame.valid = true;
|
||||
updateWait = DEFAULTUPDATE_WAIT;
|
||||
FishingOutfitUpdate:Show();
|
||||
end
|
||||
|
||||
FishingBuddy.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
|
||||
|
||||
FishingBuddy.OutfitFrame.OnLoad = function()
|
||||
@@ -93,36 +142,38 @@ FishingBuddy.OutfitFrame.OnLoad = function()
|
||||
FishingOutfitSkill.tooltip = FishingBuddy.CONFIG_SKILL_INFO;
|
||||
FishingOutfitStyle.tooltip = FishingBuddy.CONFIG_STYLISH_INFO;
|
||||
FishingOutfitSwitchButton:SetText(FishingBuddy.SWITCHOUTFIT);
|
||||
FishingOutfitFrame.OutfitChanged = FishingBuddy.OutfitFrame.OutfitChanged;
|
||||
FishingOutfitFrame.OutfitChanged = OutfitChanged;
|
||||
else
|
||||
FishingBuddy.DisableSubFrame("FishingOutfitFrame");
|
||||
end
|
||||
end
|
||||
|
||||
FishingBuddy.OutfitFrame.OnShow = function()
|
||||
if ( not this.valid ) then
|
||||
local outfit = FishingBuddy.GetOutfit();
|
||||
OutfitDisplayFrame_SetOutfit(FishingOutfitFrame, outfit);
|
||||
FishingBuddy.OutfitFrame.OutfitChanged();
|
||||
FishingBuddy.OutfitFrame.OnHide = function()
|
||||
-- OutfitChanged();
|
||||
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 ( FishingOutfitFrame ) then
|
||||
if ( useme ) then
|
||||
FishingBuddy.EnableSubFrame("FishingOutfitFrame");
|
||||
else
|
||||
FishingBuddy.DisableSubFrame("FishingOutfitFrame");
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
FishingBuddy.OutfitFrame.OnHide = function()
|
||||
-- FishingOutfitFrame_OutfitChanged();
|
||||
end
|
||||
|
||||
FishingBuddy.OutfitFrame.Button_OnClick = function()
|
||||
-- make sure we have the current state
|
||||
FishingBuddy.SetOutfit(OutfitDisplayFrame_GetOutfit(FishingOutfitFrame));
|
||||
FishingBuddy.OutfitFrame.Switch();
|
||||
end
|
||||
FishingBuddy.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!
|
||||
FishingBuddy.OutfitFrame.Switch = function()
|
||||
local function ODF_Switch()
|
||||
if (CursorHasItem()) then
|
||||
FishingBuddy.UIError(FishingBuddy.CURSORBUSYMSG);
|
||||
return false;
|
||||
@@ -131,28 +182,28 @@ FishingBuddy.OutfitFrame.Switch = function()
|
||||
FishingBuddy.UIError(OUTFITDISPLAYFRAME_TOOFASTMSG);
|
||||
return false;
|
||||
end
|
||||
|
||||
local isfishing = FishingBuddy.IsFishingPole();
|
||||
local outfit = FishingBuddy.GetOutfit();
|
||||
local waswearing = FishingBuddy.GetWasWearing();
|
||||
|
||||
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 = FishingBuddy.CANTSWITCHBACK;
|
||||
FishingBuddy.SetWasWearing(nil);
|
||||
SetWasWearing(nil);
|
||||
StartedFishing = nil;
|
||||
end
|
||||
|
||||
|
||||
if ( msg ) then
|
||||
FishingBuddy.UIError(msg);
|
||||
return false;
|
||||
end
|
||||
local check = OutfitDisplayFrame_SwitchOutfit(waswearing);
|
||||
if ( check ) then
|
||||
FishingBuddy.SetWasWearing(nil);
|
||||
SetWasWearing(nil);
|
||||
FishingBuddy.OutfitManager.CheckSwitch(false);
|
||||
end
|
||||
elseif ( outfit ) then
|
||||
@@ -168,7 +219,7 @@ FishingBuddy.OutfitFrame.Switch = function()
|
||||
end
|
||||
local waswearing = OutfitDisplayFrame_SwitchOutfit(outfit);
|
||||
if ( waswearing ) then
|
||||
FishingBuddy.SetWasWearing(waswearing);
|
||||
SetWasWearing(waswearing);
|
||||
FishingBuddy.OutfitManager.CheckSwitch(true);
|
||||
end
|
||||
else
|
||||
@@ -176,3 +227,33 @@ FishingBuddy.OutfitFrame.Switch = function()
|
||||
end
|
||||
return true;
|
||||
end
|
||||
|
||||
FishingBuddy.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 == FishingBuddy.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;
|
||||
|
||||
if ( OutfitDisplayFrame_OnLoad ) then
|
||||
FishingBuddy.OutfitManager.RegisterManager("OutfitDisplayFrame",
|
||||
ODF_Initialize,
|
||||
ODF_Choose,
|
||||
ODF_Switch);
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user