From 420fe046d45a1163b0253e0a304681d8375cc8c8 Mon Sep 17 00:00:00 2001 From: Wofsauge Date: Sat, 15 May 2021 16:34:03 +0200 Subject: [PATCH] Added support for golden Trinkets --- descriptions/rep/en_us.lua | 2 ++ eid_config.lua | 2 +- eid_data.lua | 22 ++++++++++++++++++++++ main.lua | 13 ++++++++++++- 4 files changed, 37 insertions(+), 2 deletions(-) diff --git a/descriptions/rep/en_us.lua b/descriptions/rep/en_us.lua index 34925a91..ca810ff0 100644 --- a/descriptions/rep/en_us.lua +++ b/descriptions/rep/en_us.lua @@ -407,6 +407,8 @@ local repTrinkets={ } EID:updateDescriptionsViaTable(repTrinkets, EID.descriptions["en_us"].trinkets) +EID.descriptions["en_us"].goldenTrinket = "GOLD: Doubled Effect!" + ---------- Cards ---------- local repCards={ [27] = {"27", "", "Turns all pickups, chests and non-boss enemies into bombs"}, diff --git a/eid_config.lua b/eid_config.lua index e85bfcf2..f9c1e82a 100644 --- a/eid_config.lua +++ b/eid_config.lua @@ -62,7 +62,7 @@ EID.DefaultConfig = { ["DisableOnCurse"] = true, -- Disable Item informations for the second Treasure room item on alt paths -- Default = true - ["DisableOnAltPath"] = true -- CURRENTLY NOT WORKING! + ["DisableOnAltPath"] = true, -- CURRENTLY NOT WORKING! ----------ITEM NAMES----------- -- Toggle Display of Collectible / Card and Pill names diff --git a/eid_data.lua b/eid_data.lua index 67820975..f5e67791 100644 --- a/eid_data.lua +++ b/eid_data.lua @@ -237,6 +237,28 @@ EID.InlineColors = { (animTime % (colorFractions + 1)) / colorFractions ) end, + -- Rainbow color effect + ["ColorGold"] = function(_) + local maxAnimTime = 80 + local animTime = Game():GetFrameCount() % maxAnimTime + local c = EID.InlineColors + local colors = {c["ColorYellow"], c["ColorOrange"]} + local colorFractions = (maxAnimTime - 1) / #colors + local subAnm = math.floor(animTime / (colorFractions + 1)) + 1 + local primaryColorIndex = subAnm % (#colors + 1) + if primaryColorIndex == 0 then + primaryColorIndex = 1 + end + local secondaryColorIndex = (subAnm + 1) % (#colors + 1) + if secondaryColorIndex == 0 then + secondaryColorIndex = 1 + end + return EID:interpolateColors( + colors[primaryColorIndex], + colors[secondaryColorIndex], + (animTime % (colorFractions + 1)) / colorFractions + ) + end, -- Text will blink frequently ["ColorBlink"] = function(color) local maxAnimTime = 40 diff --git a/main.lua b/main.lua index 306f7f5c..ad7282df 100644 --- a/main.lua +++ b/main.lua @@ -476,7 +476,18 @@ local function onRender(t) if closest.Variant == PickupVariant.PICKUP_TRINKET then --Handle Trinkets - EID:printDescription(EID:getDescriptionObj(closest.Type, closest.Variant, closest.SubType)) + local trinketID = closest.SubType + local isGoldenTrinket = false + if trinketID > 32768 then + trinketID = trinketID - 32768 + isGoldenTrinket = true + end + local descriptionObj = EID:getDescriptionObj(closest.Type, closest.Variant, trinketID) + if isGoldenTrinket then + local goldenDesc = EID.descriptions[EID.Config["Language"]].goldenTrinket or EID.descriptions["en_us"].goldenTrinket or "" + descriptionObj.Description = "{{ColorGold}}"..goldenDesc.."#"..descriptionObj.Description + end + EID:printDescription(descriptionObj) elseif closest.Variant == PickupVariant.PICKUP_COLLECTIBLE then --Handle Collectibles if EID:hasCurseBlind() and EID.Config["DisableOnCurse"] then