Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix LootChoiceExt to be compatible with Hephaistos #51

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions Examples/Hades/LootChoiceExt/LootChoiceExt.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ ModUtil.Path.Override("CalcNumLootChoices", function( )
return numChoices
end, LootChoiceExt)

ModUtil.Path.Context.Wrap("CreateBoonLootButtons", function( )
ModUtil.Path.Context.Env("CreateBoonLootButtons", function( )
local data = { }
local active = false
ModUtil.Path.Wrap( "CreateScreenComponent", function( base, args )
Expand All @@ -39,7 +39,6 @@ ModUtil.Path.Context.Wrap("CreateBoonLootButtons", function( )
local excess = math.max( 3,#locals.upgradeOptions )-3
locals.itemLocationY = locals.itemLocationY-12.5*excess
data.squashY = 3/(3+excess)
data.iconScaling = (excess == 0) and 0.85 or 1
elseif active and args.Group == "Combat_Menu" then
local locals = ModUtil.Locals.Stacked( )
if args.Name == "TraitBacking" then
Expand All @@ -52,24 +51,22 @@ ModUtil.Path.Context.Wrap("CreateBoonLootButtons", function( )
end
end
local component = base( args )
SetScaleY({Id = component.Id, Fraction = 1})
SetScaleY({Id = component.Id, Fraction = data.squashY})
return component
end, LootChoiceExt )
ModUtil.Path.Wrap( "CreateTextBox", function( base, args )
if active then
if args.OffsetY then args.OffsetY = args.OffsetY*data.squashY end
if args.FontSize then args.FontSize = args.FontSize*math.pow(data.squashY,1/3) end
if args.FontSize then args.FontSize = args.FontSize*data.squashY end
if data.upgrade and args.Text == data.upgrade.CustomRarityName then
ModUtil.Locals.Stacked( ).lineSpacing = 8*data.squashY
end
end
return base( args )
end, LootChoiceExt )
end, LootChoiceExt)
ModUtil.Path.Wrap( "SetScale", function( base, args )
if active then
args.Fraction = data.iconScaling
SetScaleY(args)
args.Fraction = data.iconScaling*data.squashY
args.Fraction = data.squashY
return SetScaleX(args)
end
return base( args )
Expand All @@ -82,7 +79,7 @@ ModUtil.Path.Context.Wrap("CreateBoonLootButtons", function( )
if active and arg == "RerollPanelMetaUpgrade" then active = false end
return base( arg )
end, LootChoiceExt )
end, LootChoiceExt)
end)

ModUtil.Path.Override("DestroyBoonLootButtons", function( lootData )
local components = ScreenAnchors.ChoiceScreen.Components
Expand Down