Improved performance of getCurseOfBlind function and unified positioning of itemnames
This commit is contained in:
1 parent
df80fba59e
commit
b0b52a3858
2 files changed
+22
-22
No files matched your search
+14
-1
@@ -66,6 +66,14 @@ EID.TRANSFORMATION = {
|
||||
["SUPERBUM"] = 11
|
||||
}
|
||||
|
||||
-- List of item Types
|
||||
EID.ItemTypeAnm2Names = {
|
||||
"null", -- 1
|
||||
"passive", -- 2
|
||||
"active", -- 3
|
||||
"familiar", -- 4
|
||||
"trinket" -- 5
|
||||
}
|
||||
---------------------------------------------------------------------------
|
||||
-------------------------Handle API Functions -----------------------------
|
||||
|
||||
@@ -74,6 +82,11 @@ function EID:isDisplayingText()
|
||||
return isDisplayingText
|
||||
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
|
||||
function EID:getTextPosition()
|
||||
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.Scale = Vector(EIDConfig["Scale"], EIDConfig["Scale"])
|
||||
EID.InlineIconSprite:Render(
|
||||
Vector((textPosX + prefixTextWidth + Xoffset) * EIDConfig["Scale"], textPosY),
|
||||
Vector((textPosX + prefixTextWidth + Xoffset -2) * EIDConfig["Scale"], textPosY),
|
||||
Vector(0, 0),
|
||||
Vector(0, 0)
|
||||
)
|
||||
|
||||
@@ -67,7 +67,6 @@ end
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
---------------------------Printing Functions------------------------------
|
||||
local itemTypes = {"null", "passive", "active", "familiar", "trinket"}
|
||||
local modifiedPosY = false -- When the player has the schoolbag it changes
|
||||
local function posY()
|
||||
return modifiedPosY ~= false and modifiedPosY or EIDConfig["YPosition"]
|
||||
@@ -84,11 +83,11 @@ function printDescription(desc)
|
||||
if EIDConfig["Scale"] < 1 then
|
||||
offsetY = -1
|
||||
end
|
||||
IconSprite:Play(itemTypes[itemType])
|
||||
IconSprite:Play(EID.ItemTypeAnm2Names[itemType])
|
||||
IconSprite.Scale = Vector(EIDConfig["Scale"], EIDConfig["Scale"])
|
||||
IconSprite:Update()
|
||||
IconSprite:Render(
|
||||
Vector(EIDConfig["XPosition"] - 3 * EIDConfig["Scale"], padding + offsetY),
|
||||
Vector(EIDConfig["XPosition"], padding + offsetY),
|
||||
Vector(0, 0),
|
||||
Vector(0, 0)
|
||||
)
|
||||
@@ -96,7 +95,7 @@ function printDescription(desc)
|
||||
IconSprite:Play(itemConfig:GetCollectible(desc[1]).MaxCharges)
|
||||
IconSprite:Update()
|
||||
IconSprite:Render(
|
||||
Vector(EIDConfig["XPosition"] - 3 * EIDConfig["Scale"], padding + offsetY),
|
||||
Vector(EIDConfig["XPosition"], padding + offsetY),
|
||||
Vector(0, 0),
|
||||
Vector(0, 0)
|
||||
)
|
||||
@@ -109,9 +108,9 @@ function printDescription(desc)
|
||||
if EIDConfig["ShowItemName"] then
|
||||
local offset = 0
|
||||
if EIDConfig["ShowItemType"] then
|
||||
if itemType == 3 then
|
||||
offset = 9
|
||||
else
|
||||
if itemType == 3 then -- active item
|
||||
offset = 11
|
||||
elseif itemType == 4 then -- familiar
|
||||
offset = 6
|
||||
end
|
||||
end
|
||||
@@ -184,7 +183,7 @@ function printTrinketDescription(desc, typ)
|
||||
end
|
||||
EID:renderString(
|
||||
name,
|
||||
Vector(EIDConfig["XPosition"], padding),
|
||||
Vector(EIDConfig["XPosition"], padding - 4),
|
||||
Vector(EIDConfig["Scale"], EIDConfig["Scale"]),
|
||||
EID:getNameColor(),
|
||||
false
|
||||
@@ -225,7 +224,6 @@ function printBulletPoints(description, padding)
|
||||
local bpIcon = EID:handleBulletpointIcon(lineToPrint)
|
||||
if EID:getIcon(bpIcon) ~= nil then
|
||||
lineToPrint = string.gsub(lineToPrint, bpIcon .. " ", "")
|
||||
posX = posX - 2
|
||||
end
|
||||
|
||||
EID:renderString(bpIcon, Vector(posX, padding), Vector(EIDConfig["Scale"], EIDConfig["Scale"]), textColor, false)
|
||||
@@ -244,17 +242,6 @@ end
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
---------------------------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()
|
||||
IconSprite:Play("CurseOfBlind")
|
||||
@@ -391,7 +378,7 @@ local function onRender(t)
|
||||
end
|
||||
elseif closest.Variant == PickupVariant.PICKUP_COLLECTIBLE then
|
||||
--Handle Cards & Runes
|
||||
if HasCurseBlind() and EIDConfig["DisableOnCurse"] then
|
||||
if EID:hasCurseBlind() and EIDConfig["DisableOnCurse"] then
|
||||
renderQuestionMark()
|
||||
return
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user