Improved performance of getCurseOfBlind function and unified positioning of itemnames

This commit is contained in:
wofsauge committed 2020-09-26 18:15:12 +02:00
1 parent df80fba59e
commit b0b52a3858
2 files changed
+22 -22

No files matched your search

+14 -1
View File
@@ -66,6 +66,14 @@ EID.TRANSFORMATION = {
["SUPERBUM"] = 11 ["SUPERBUM"] = 11
} }
-- List of item Types
EID.ItemTypeAnm2Names = {
"null", -- 1
"passive", -- 2
"active", -- 3
"familiar", -- 4
"trinket" -- 5
}
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
-------------------------Handle API Functions ----------------------------- -------------------------Handle API Functions -----------------------------
@@ -74,6 +82,11 @@ function EID:isDisplayingText()
return isDisplayingText return isDisplayingText
end end
-- Returns true, if curse of blind is active
function EID:hasCurseBlind()
return Game():GetLevel():GetCurses() & LevelCurse.CURSE_OF_BLIND > 0
end
-- returns the current text position -- returns the current text position
function EID:getTextPosition() function EID:getTextPosition()
return Vector(EIDConfig["XPosition"], EIDConfig["YPosition"]) return Vector(EIDConfig["XPosition"], EIDConfig["YPosition"])
@@ -158,7 +171,7 @@ function EID:filterMarkup(text, textPosX, textPosY)
EID.InlineIconSprite:SetFrame(lookup[1], lookup[2]) EID.InlineIconSprite:SetFrame(lookup[1], lookup[2])
EID.InlineIconSprite.Scale = Vector(EIDConfig["Scale"], EIDConfig["Scale"]) EID.InlineIconSprite.Scale = Vector(EIDConfig["Scale"], EIDConfig["Scale"])
EID.InlineIconSprite:Render( EID.InlineIconSprite:Render(
Vector((textPosX + prefixTextWidth + Xoffset) * EIDConfig["Scale"], textPosY), Vector((textPosX + prefixTextWidth + Xoffset -2) * EIDConfig["Scale"], textPosY),
Vector(0, 0), Vector(0, 0),
Vector(0, 0) Vector(0, 0)
) )
+8 -21
View File
@@ -67,7 +67,6 @@ end
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
---------------------------Printing Functions------------------------------ ---------------------------Printing Functions------------------------------
local itemTypes = {"null", "passive", "active", "familiar", "trinket"}
local modifiedPosY = false -- When the player has the schoolbag it changes local modifiedPosY = false -- When the player has the schoolbag it changes
local function posY() local function posY()
return modifiedPosY ~= false and modifiedPosY or EIDConfig["YPosition"] return modifiedPosY ~= false and modifiedPosY or EIDConfig["YPosition"]
@@ -84,11 +83,11 @@ function printDescription(desc)
if EIDConfig["Scale"] < 1 then if EIDConfig["Scale"] < 1 then
offsetY = -1 offsetY = -1
end end
IconSprite:Play(itemTypes[itemType]) IconSprite:Play(EID.ItemTypeAnm2Names[itemType])
IconSprite.Scale = Vector(EIDConfig["Scale"], EIDConfig["Scale"]) IconSprite.Scale = Vector(EIDConfig["Scale"], EIDConfig["Scale"])
IconSprite:Update() IconSprite:Update()
IconSprite:Render( IconSprite:Render(
Vector(EIDConfig["XPosition"] - 3 * EIDConfig["Scale"], padding + offsetY), Vector(EIDConfig["XPosition"], padding + offsetY),
Vector(0, 0), Vector(0, 0),
Vector(0, 0) Vector(0, 0)
) )
@@ -96,7 +95,7 @@ function printDescription(desc)
IconSprite:Play(itemConfig:GetCollectible(desc[1]).MaxCharges) IconSprite:Play(itemConfig:GetCollectible(desc[1]).MaxCharges)
IconSprite:Update() IconSprite:Update()
IconSprite:Render( IconSprite:Render(
Vector(EIDConfig["XPosition"] - 3 * EIDConfig["Scale"], padding + offsetY), Vector(EIDConfig["XPosition"], padding + offsetY),
Vector(0, 0), Vector(0, 0),
Vector(0, 0) Vector(0, 0)
) )
@@ -109,9 +108,9 @@ function printDescription(desc)
if EIDConfig["ShowItemName"] then if EIDConfig["ShowItemName"] then
local offset = 0 local offset = 0
if EIDConfig["ShowItemType"] then if EIDConfig["ShowItemType"] then
if itemType == 3 then if itemType == 3 then -- active item
offset = 9 offset = 11
else elseif itemType == 4 then -- familiar
offset = 6 offset = 6
end end
end end
@@ -184,7 +183,7 @@ function printTrinketDescription(desc, typ)
end end
EID:renderString( EID:renderString(
name, name,
Vector(EIDConfig["XPosition"], padding), Vector(EIDConfig["XPosition"], padding - 4),
Vector(EIDConfig["Scale"], EIDConfig["Scale"]), Vector(EIDConfig["Scale"], EIDConfig["Scale"]),
EID:getNameColor(), EID:getNameColor(),
false false
@@ -225,7 +224,6 @@ function printBulletPoints(description, padding)
local bpIcon = EID:handleBulletpointIcon(lineToPrint) local bpIcon = EID:handleBulletpointIcon(lineToPrint)
if EID:getIcon(bpIcon) ~= nil then if EID:getIcon(bpIcon) ~= nil then
lineToPrint = string.gsub(lineToPrint, bpIcon .. " ", "") lineToPrint = string.gsub(lineToPrint, bpIcon .. " ", "")
posX = posX - 2
end end
EID:renderString(bpIcon, Vector(posX, padding), Vector(EIDConfig["Scale"], EIDConfig["Scale"]), textColor, false) EID:renderString(bpIcon, Vector(posX, padding), Vector(EIDConfig["Scale"], EIDConfig["Scale"]), textColor, false)
@@ -244,17 +242,6 @@ end
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
---------------------------Handle Rendering-------------------------------- ---------------------------Handle Rendering--------------------------------
function HasCurseBlind()
local num = Game():GetLevel():GetCurses()
local t = {}
while num > 0 do
rest = num % 2
t[#t + 1] = rest
num = (num - rest) / 2
end
return #t > 6 and t[7] == 1
end
function renderQuestionMark() function renderQuestionMark()
IconSprite:Play("CurseOfBlind") IconSprite:Play("CurseOfBlind")
@@ -391,7 +378,7 @@ local function onRender(t)
end end
elseif closest.Variant == PickupVariant.PICKUP_COLLECTIBLE then elseif closest.Variant == PickupVariant.PICKUP_COLLECTIBLE then
--Handle Cards & Runes --Handle Cards & Runes
if HasCurseBlind() and EIDConfig["DisableOnCurse"] then if EID:hasCurseBlind() and EIDConfig["DisableOnCurse"] then
renderQuestionMark() renderQuestionMark()
return return
end end