Skip to content

Commit

Permalink
Merge pull request #30 from nicokimmel/1.18.2
Browse files Browse the repository at this point in the history
1.18.2
  • Loading branch information
JNSlevin authored May 15, 2024
2 parents 3f2a210 + 8e7a5f9 commit e3fcb82
Show file tree
Hide file tree
Showing 13 changed files with 208 additions and 72 deletions.
12 changes: 7 additions & 5 deletions src/WizardsWardrobe.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ WW.name = "WizardsWardrobe"
WW.simpleName = "Wizard's Wardrobe"
WW.displayName =
"|c18bed8W|c26c2d1i|c35c6c9z|c43cac2a|c52cebar|c60d1b3d|c6fd5ab'|c7dd9a4s|c8cdd9d |c9ae195W|ca8e58ea|cb7e986r|cc5ed7fd|cd4f077r|ce2f470o|cf1f868b|cfffc61e|r"
WW.version = "1.18.1"
WW.version = "1.18.2"
WW.zones = {}
WW.currentIndex = 0
WW.IsHeavyAttacking = false
Expand Down Expand Up @@ -202,6 +202,7 @@ function WW.LoadSkills( setup )
local movedCryptCanon = false
--skillTask:Cancel()
local skillTable = setup:GetSkills()
local gearTable = setup:GetGear()
skillTask:For( 0, 1 ):Do( function( hotbarCategory )
skillTask:For( 3, 8 ):Do( function( slotIndex )
local abilityId = skillTable[ hotbarCategory ][ slotIndex ]
Expand All @@ -222,7 +223,7 @@ function WW.LoadSkills( setup )
return WW.IsReadyToSwap()
end ):Then( function()
-- check if cryptcanon gets changed
if slotIndex == 8 and WW.HasCryptCanon() and not movedCryptCanon then
if slotIndex == 8 and WW.HasCryptCanon() and gearTable[ EQUIP_SLOT_CHEST ].id == 194509 and not movedCryptCanon then
logger:Debug( "Unequip cryptcanon" )
local equippedLink = GetItemLink( BAG_WORN, EQUIP_SLOT_CHEST, LINK_STYLE_DEFAULT )

Expand Down Expand Up @@ -365,8 +366,7 @@ end
local runningGearTasks = {}
local gearMoveTask = async:Create( WW.name .. "GearMoveTask" )

local function updateItemLocation( index, item )
local freeSlotMap = WW.GetFreeSlots( BAG_BACKPACK )
local function updateItemLocation( index, item, freeSlotMap )
if not item.destSlot then
item.destSlot = freeSlotMap[ index ]
end
Expand Down Expand Up @@ -417,9 +417,11 @@ function WW.MoveItems( itemTaskList, areAllItemsInInventory, isChangingWeapons )
local timeStamp = GetTimeStamp()
isMovingItems = true
local hasBeenWarnedAboutBlocking = false
local freeSlots = WW.GetFreeSlots( BAG_BACKPACK )
gearMoveTask:WaitUntil( function()
return WW.IsReadyToSwap()
end )

--[[ :WaitUntil( function()--!As soon as i figure out how to see if someone is heavy attacking this will be updated
logger:Warn( "channeling heavy = " .. tostring( WW.IsHeavyAttacking ) )
return not WW.IsHeavyAttacking
Expand Down Expand Up @@ -450,7 +452,7 @@ function WW.MoveItems( itemTaskList, areAllItemsInInventory, isChangingWeapons )
--! the above check is only performed if it bugs out and nothing happened after 5 seconds
return ArePlayerWeaponsSheathed() or not isChangingWeapons
end ):For( ipairs( itemTaskList ) ):Do( function( index, item )
updateItemLocation( index, item )
updateItemLocation( index, item, freeSlots )

if not item.sourceSlot or not item.destSlot then return end

Expand Down
4 changes: 2 additions & 2 deletions src/WizardsWardrobe.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Title: Wizard's Wardrobe
## Author: ownedbynico, |c268074JN_Slevin|r
## Version: 1.18.1
## AddOnVersion: 1181
## Version: 1.18.2
## AddOnVersion: 1182
## Description: Throw all your setups into the wardrobe and let the wizard equip them exactly when you need it.
## APIVersion: 101041 101042
## DependsOn: LibAddonMenu-2.0>=35 LibChatMessage>=105 LibDebugLogger>=105 LibAsync>=20304
Expand Down
35 changes: 29 additions & 6 deletions src/WizardsWardrobe.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
<GuiXml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sir.insidi.at/or/schema/esoui.xsd">
<Animations>
<AnimationTimeline name="WW_AlphaTimeline">
<Animations>
<AlphaAnimation duration="200" startAlpha="0" endAlpha="1">
<EasingFunction>
return ZO_LinearEase(progress)
</EasingFunction>
</AlphaAnimation>
</Animations>
</AnimationTimeline>
</Animations>
<Controls>
<TopLevelControl name="WizardsWardrobePanel" tier="LOW" layer="CONTROLS" mouseEnabled="true" movable="false" clampedToScreen="true" hidden="true">
<Dimensions x="245" y="70" />
Expand Down Expand Up @@ -30,6 +41,7 @@
<OnMoveStop>WizardsWardrobe.gui.OnWindowMove()</OnMoveStop>
<OnResizeStart>WizardsWardrobe.gui.OnWindowResize("start")</OnResizeStart>
<OnResizeStop>WizardsWardrobe.gui.OnWindowResize("stop")</OnResizeStop>
<OnHide>WizardsWardsWardrobe.gui.StartAlphaAnimation(WizardsWardrobeZone,50,0,1)</OnHide>
<!-- <OnMouseExit>WizardsWardrobeWindowZone:SetHidden( true )</OnMouseExit> -->

<Controls>
Expand Down Expand Up @@ -68,8 +80,13 @@
<Controls>
<Button name="$(parent)ZoneSelect" inherits="ZO_DefaultButton" text="ZONE NAME" hidden="false">
<OnClicked>WizardsWardrobeWindowZone:ToggleHidden()
<!-- self:SetState(BSTATE_CLICKED, true) -->

<!-- local alpha = WizardsWardrobeWindowZone:GetAlpha()
local duration = 50
if alpha == 1 then
WizardsWardrobe.gui.StartAlphaAnimation( WizardsWardrobeWindowZone, duration, 1, 0 )
else
WizardsWardrobe.gui.StartAlphaAnimation( WizardsWardrobeWindowZone, duration, 0, 1 )
end -->
</OnClicked>
<Dimensions x="200" y="30" />
<Anchor point="TOP" relativeTo="$(parent)" relativePoint="BOTTOM" offsetX="0" offsetY="0" />
Expand Down Expand Up @@ -244,7 +261,7 @@
</Texture>
<Button name="$(parent)Hide" inherits="ZO_ButtonBehaviorClickSound">
<Dimensions x="24" y="24" />
<OnClicked>WizardsWardrobeWindowZone:SetHidden( true )</OnClicked>
<OnClicked>WizardsWardrobe.gui.StartAlphaAnimation( WizardsWardrobeWindowZone, 50, 1, 0 )</OnClicked>
<Anchor point="TOPLEFT" relativeTo="$(parent)" relativePoint="TOPLEFT" offsetX="5" offsetY="5" />
<Textures normal="/esoui/art/buttons/decline_up.dds"
pressed="/esoui/art/buttons/decline_down.dds"
Expand Down Expand Up @@ -404,15 +421,21 @@
</Controls>
</TopLevelControl>
<!-- ZO_Tree templates -->
<!-- <Control name="WW_ZoneEntry" virtual="true" mouseEnabled="true" inherits="ZO_TreeLabelSubCategory">
<Control name="WW_ZoneEntry" virtual="true" mouseEnabled="true" inherits="ZO_TreeLabelSubCategory">
<Dimensions y="25" />
<Controls>
<Texture name="$(parent)Icon" textureFile="/esoui/art/collections/favorite_staronly.dds">
<Dimensions x="16" y="16" />
<Anchor point="LEFT" relativeTo="$(parent)" relativePoint="LEFT" offsetX="10" />
</Texture>
</Controls>
</Control>
<Control name="WW_ZoneCategory" virtual="true" mouseEnabled="true" inherits="ZO_StatusIconHeader">
<OnInitialized>WW_IconHeader_OnInitialized( self )</OnInitialized>
</Control>
<Control name="WW_ZoneGeneral" virtual="true" mouseEnabled="true" inherits="ZO_StatusIconHeader">
<Control name="WW_ZoneCategory_Childless" virtual="true" mouseEnabled="true" inherits="ZO_IconChildlessHeader">
<OnInitialized>WW_IconHeader_OnInitialized( self )</OnInitialized>
</Control> -->
</Control>

</Controls>
</GuiXml>
66 changes: 66 additions & 0 deletions src/WizardsWardrobeGui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ function WWG.SetSceneManagement()
if not savedScene.hidden then
WizardsWardrobeWindow:ClearAnchors()
WizardsWardrobeWindow:SetAnchor( TOPLEFT, GuiRoot, TOPLEFT, savedScene.left, savedScene.top )
--WWG.StartAlphaAnimation( WizardsWardrobeWindow, 50, 0, 1 )
WizardsWardrobeWindow:SetHidden( false )
end
end
Expand All @@ -135,6 +136,7 @@ function WWG.SetSceneManagement()
if newState == SCENE_HIDING then
local savedScene = WW.settings.window[ sceneName ]
if savedScene then
--WWG.StartAlphaAnimation( WizardsWardrobeWindow, 50, 1, 0 )
WizardsWardrobeWindow:SetHidden( true )
end
if sceneName == "hud" or sceneName == "hudui" then
Expand Down Expand Up @@ -183,18 +185,23 @@ function WWG.SetSceneManagement()
if panel:GetName() ~= "WizardsWardrobeMenu" then return end
WizardsWardrobeWindow:ClearAnchors()
WizardsWardrobeWindow:SetAnchor( CENTER, GuiRoot, RIGHT, -(WizardsWardrobeWindow:GetWidth() / 2 + 50), 0 )
--WWG.StartAlphaAnimation( WizardsWardrobeWindow, 50, 0, 1 )
WizardsWardrobeWindow:SetHidden( false )
PlaySound( SOUNDS.DEFAULT_WINDOW_OPEN )
end )
CALLBACK_MANAGER:RegisterCallback( "LAM-PanelClosed", function( panel )
if panel:GetName() ~= "WizardsWardrobeMenu" then return end
--WWG.StartAlphaAnimation( WizardsWardrobeWindow, 50, 1, 0 )
WizardsWardrobeWindow:SetHidden( true )
end )

SLASH_COMMANDS[ "/wizard" ] = function()
local scene = SCENE_MANAGER:GetCurrentScene()
local sceneName = scene:GetName()
if sceneName == "gameMenuInGame" then
local startAlpha = WizardsWardrobeWindow:IsHidden() and 0 or 1
local endAlpha = WizardsWardrobeWindow:IsHidden() and 1 or 0
--WWG.StartAlphaAnimation( WizardsWardrobeWindow, 50, startAlpha, endAlpha )
WizardsWardrobeWindow:SetHidden( not WizardsWardrobeWindow:IsHidden() )
return
end
Expand All @@ -207,12 +214,14 @@ function WWG.SetSceneManagement()
-- open
WizardsWardrobeWindow:ClearAnchors()
WizardsWardrobeWindow:SetAnchor( TOPLEFT, GuiRoot, TOPLEFT, savedScene.left, savedScene.top )
--WWG.StartAlphaAnimation( WizardsWardrobeWindow, 50, 0, 1 )
WizardsWardrobeWindow:SetHidden( false )
PlaySound( SOUNDS.DEFAULT_WINDOW_OPEN )
SCENE_MANAGER:SetInUIMode( true, false )
WW.settings.window[ sceneName ].hidden = false
else
-- close
--WWG.StartAlphaAnimation( WizardsWardrobeWindow, 50, 1, 0 )
WizardsWardrobeWindow:SetHidden( true )
PlaySound( SOUNDS.DEFAULT_WINDOW_CLOSE )
WW.settings.window[ sceneName ].hidden = true
Expand All @@ -221,6 +230,7 @@ function WWG.SetSceneManagement()
-- open but new
WizardsWardrobeWindow:ClearAnchors()
WizardsWardrobeWindow:SetAnchor( CENTER, GuiRoot, CENTER, 0, 0 )
--WWG.StartAlphaAnimation( WizardsWardrobeWindow, 50, 0, 1 )
WizardsWardrobeWindow:SetHidden( false )
PlaySound( SOUNDS.DEFAULT_WINDOW_OPEN )
SCENE_MANAGER:SetInUIMode( true, false )
Expand Down Expand Up @@ -1745,3 +1755,59 @@ function WWG.RearrangeSetups( sortTable, zone, pageId )
WWG.BuildPage( zone, pageId, true )
WizardsWardrobeArrange:SetHidden( true )
end

function WWG.AddZoneToFavorites( data )
local tree = WW.gui.tree.tree
local node = tree:GetTreeNodeByData( data )
if not WW.settings.zoneFavorites then
WW.settings.zoneFavorites = {}
end
table.insert( WW.settings.zoneFavorites, data.id )
WWG.tree:RefreshTree( tree, data )
end

function WWG.RemoveZoneFromFavorites( data )
if not WW.settings.zoneFavorites then return end
local tree = WW.gui.tree.tree
local node = tree:GetTreeNodeByData( data )
for i, id in ipairs( WW.settings.zoneFavorites ) do
if id == data.id then
table.remove( WW.settings.zoneFavorites, i )
break
end
end
WWG.tree:RefreshTree( tree, data )
end

function WWG.IsZoneFavorite( data )
if not WW.settings.zoneFavorites then return false end
for _, id in ipairs( WW.settings.zoneFavorites ) do
if id == data.id then
return true
end
end
return false
end

function WWG.StartAlphaAnimation( control, duration, startAlpha, endAlpha )
if not control.animation then
control.animation = {}
control.animation.timeline = ANIMATION_MANAGER:CreateTimelineFromVirtual( "WW_AlphaTimeline", control )
control.animation.animation = control.animation.timeline:GetFirstAnimationOfType( ANIMATION_ALPHA )
end
local timeline = control.animation.timeline
local animation = control.animation.animation
if timeline:IsPlaying() then
timeline:Stop()
end
animation:SetAlphaValues( startAlpha, endAlpha )
animation:SetDuration( duration )
timeline:SetPlaybackType( ANIMATION_PLAYBACK_ONE_SHOT )
local currentAlpha = control:GetAlpha()
if currentAlpha ~= endAlpha then
if currentAlpha == 0 then control:SetHidden( false ) end
if endAlpha == 0 then zo_callLater( function() control:SetHidden( true ) end, duration ) end
timeline:PlayFromStart()
end
return animation, timeline
end
10 changes: 5 additions & 5 deletions src/WizardsWardrobeMenu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,16 @@ local addonMenuChoices = {
GetString( WW_MENU_COMPARISON_DEPTH_EASY ),
GetString( WW_MENU_COMPARISON_DEPTH_DETAILED ),
GetString( WW_MENU_COMPARISON_DEPTH_THOROUGH ),
GetString( WW_MENU_COMPARISON_DEPTH_STRICT )
},
values = {
1,
2,
3,
4
3
},
tooltips = {
GetString( WW_MENU_COMPARISON_DEPTH_EASY_TT ),
GetString( WW_MENU_COMPARISON_DEPTH_DETAILED_TT ),
GetString( WW_MENU_COMPARISON_DEPTH_THOROUGH_TT ),
GetString( WW_MENU_COMPARISON_DEPTH_STRICT_TT )
}
}
function WWM.InitSV()
Expand Down Expand Up @@ -101,7 +98,10 @@ function WWM.InitSV()
elseif WW.settings.printMessages == false then
WW.settings.printMessages = "off"
end

-- migrate comparisonDepth settings
if WW.settings.comparisonDepth == 4 then
WW.settings.comparisonDepth = 1
end
-- dont look at this
WW.settings.autoEquipSetups = WW.storage.autoEquipSetups
end
Expand Down
34 changes: 18 additions & 16 deletions src/WizardsWardrobeSetupValidation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,19 @@ function WWV.CompareItemLinks( linkEquipped, linkSaved, uniqueIdEquipped, unique
logger:Verbose(
"traitEquipped: %d, traitSaved: %d, weaponTypeEquipped: %d, weaponTypeSaved: %d, setIdEquipped: %d, setIdSaved: %d",
traitEquipped, traitSaved, weaponTypeEquipped, weaponTypeSaved, setIdEquipped, setIdSaved )

--If unique Id matches all the other checks are redundant
if uniqueIdEquipped == uniqueIdSaved then
logger:Debug( "Default: UniqueId matched" )
return true
end
--! All of this should be redundant, uniqueId should always match and if it doesnt something failed already
--? Should we keep this for redundancy?
if WW.settings.comparisonDepth == 1 then -- easy
if (traitEquipped ~= traitSaved) or (weaponTypeEquipped ~= weaponTypeSaved) or (setIdEquipped ~= setIdSaved) then
logger:Warn( "Trait / Weapon Type and set Id did not match" )
if (weaponTypeEquipped ~= weaponTypeSaved) or (setIdEquipped ~= setIdSaved) then
logger:Warn( "Easy: Weapon Type or set Id did not match" )
return false
end
logger:Debug( "Trait / Weapon Type and set Id matched" )
logger:Debug( "Easy: Weapon Type or set Id matched" )
return true
end
local qualityEquipped = GetItemLinkDisplayQuality( linkEquipped )
Expand All @@ -59,37 +65,33 @@ function WWV.CompareItemLinks( linkEquipped, linkSaved, uniqueIdEquipped, unique
tostring( qualitySaved ), tostring( enchantEquipped ), tostring( enchantSaved ) )
if WW.settings.comparisonDepth == 2 then -- detailed
if (traitEquipped ~= traitSaved) or (weaponTypeEquipped ~= weaponTypeSaved) or (setIdEquipped ~= setIdSaved) or (qualityEquipped ~= qualitySaved) then
logger:Warn( "Trait / Weapon Type / Set Id / Quality did not match" )
logger:Warn( "Detailed: Trait / Weapon Type / Set Id / Quality did not match" )
return false
end
logger:Debug( "Trait / Weapon Type / Set Id / Quality matched" )
logger:Debug( "Detailed: Trait / Weapon Type / Set Id / Quality matched" )
return true
end


if WW.settings.comparisonDepth == 3 then -- thorough
if (traitEquipped ~= traitSaved) or (weaponTypeEquipped ~= weaponTypeSaved) or (setIdEquipped ~= setIdSaved) or (qualityEquipped ~= qualitySaved) or (enchantEquipped ~= enchantSaved) then
logger:Warn( "Trait / Weapon Type / Set Id / Quality / Enchant did not match" )
logger:Warn( "Thorough: Trait / Weapon Type / Set Id / Quality / Enchant did not match" )
return false
end
logger:Debug( "Trait / Weapon Type / Set Id / Quality / Enchant matched" )
logger:Debug( "Thorough: Trait / Weapon Type / Set Id / Quality / Enchant matched" )
return true
end

if WW.settings.comparisonDepth == 4 then -- strict
--! Redundant check, uniqueId is checked first
--[[ if WW.settings.comparisonDepth == 4 then -- Strict
if uniqueIdEquipped ~= uniqueIdSaved then
logger:Warn( "UniqueId did not match" )
return false
end
logger:Debug( "UniqueId matched" )
return true
end
end ]]
end

--[[ local WW = WizardsWardrobe
local WWV = WW.validation
WWV.DidSetupSwapCorrectly( 2 ) ]]

--TODO: untangle this mess. should prob make a metamethod to compare setups instead of this
function WWV.DidSetupSwapCorrectly( workAround )
logger:Info( "DidSetupSwapCorrectly has been called" )
Expand Down Expand Up @@ -148,7 +150,7 @@ function WWV.DidSetupSwapCorrectly( workAround )
end
elseif WW.settings.unequipEmpty and equippedLink == "" then
success = true
elseif not WW.settings.unequipEmpty then
elseif not WW.settings.unequipEmpty and savedLink == "" then
success = true
else
failedT[ # failedT + 1 ] = GetString( "SI_EQUIPSLOT", equipSlot )
Expand Down
6 changes: 2 additions & 4 deletions src/lang/de.lua
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,10 @@ local language = {
WW_MENU_COMPARISON_DEPTH_EASY = "Einfach",
WW_MENU_COMPARISON_DEPTH_DETAILED = "Detailliert",
WW_MENU_COMPARISON_DEPTH_THOROUGH = "Gründlich",
WW_MENU_COMPARISON_DEPTH_STRICT = "Streng",
WW_MENU_COMPARISON_DEPTH_EASY_TT = "Überprüft nur den Trait, den Waffentyp und das Set.",
WW_MENU_COMPARISON_DEPTH_EASY_TT = "Überprüft nur den Waffentyp und das Set.",
WW_MENU_COMPARISON_DEPTH_DETAILED_TT = "Überprüft den Trait, den Waffentyp das Set und Qualität.",
WW_MENU_COMPARISON_DEPTH_THOROUGH_TT = "Überprüft den Trait, den Waffentyp das Set, Qualität und Verzauberung.",
WW_MENU_COMPARISON_DEPTH_STRICT_TT =
"Überprüft, ob es genau das gleiche Ausrüstungsteil ist, das gespeichert wurde. Scheiterd, wenn irgendetwas verändert wurde",



-- USER INTERFACE
Expand Down
Loading

0 comments on commit e3fcb82

Please sign in to comment.