Formatted files very nicely

This commit is contained in:
wofsauge committed 2020-08-31 22:29:29 +02:00
1 parent 8c6564e69f
commit fedec6ac37
5 files changed
+503 -312

No files matched your search

+65 -25
View File
@@ -23,28 +23,26 @@ end
__eidItemDescriptions[item] = "Most Fitting Description"; __eidItemDescriptions[item] = "Most Fitting Description";
--]] --]]
-- Init variables for other mods to hand over Descriptions if they were not yet inited by another mod. -- Init variables for other mods to hand over Descriptions if they were not yet inited by another mod.
if not __eidItemDescriptions then if not __eidItemDescriptions then
__eidItemDescriptions = {}; __eidItemDescriptions = {}
end end
if not __eidTrinketDescriptions then if not __eidTrinketDescriptions then
__eidTrinketDescriptions = {}; __eidTrinketDescriptions = {}
end end
if not __eidCardDescriptions then if not __eidCardDescriptions then
__eidCardDescriptions = {}; __eidCardDescriptions = {}
end end
if not __eidPillDescriptions then if not __eidPillDescriptions then
__eidPillDescriptions = {}; __eidPillDescriptions = {}
end end
if not __eidItemTransformations then if not __eidItemTransformations then
__eidItemTransformations = {}; __eidItemTransformations = {}
end end
if not __eidEntityDescriptions then if not __eidEntityDescriptions then
__eidEntityDescriptions = {}; __eidEntityDescriptions = {}
end end
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
-------------------------Handle Custom Enum ----------------------------- -------------------------Handle Custom Enum -----------------------------
@@ -65,7 +63,7 @@ EID.TRANSFORMATION = {
["BOOKWORM"] = 12, ["BOOKWORM"] = 12,
["ADULT"] = 14, ["ADULT"] = 14,
["SPIDERBABY"] = 13, ["SPIDERBABY"] = 13,
["SUPERBUM"] = 11, ["SUPERBUM"] = 11
} }
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
@@ -78,7 +76,7 @@ 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"])
end end
-- returns the entity that is currently described. returns last described entity if currently not displaying text -- returns the entity that is currently described. returns last described entity if currently not displaying text
@@ -92,9 +90,9 @@ end
--Get the name of the given transformation by its ID --Get the name of the given transformation by its ID
function EID:getTransformation(id) function EID:getTransformation(id)
local str="Custom"; local str = "Custom"
if (tonumber(id) <= #transformations-1) then if (tonumber(id) <= #transformations - 1) then
return transformations[tonumber(id)+1] return transformations[tonumber(id) + 1]
end end
return str return str
end end
@@ -103,13 +101,15 @@ end
function EID:hasDescription(entity) function EID:hasDescription(entity)
local isAllowed = false local isAllowed = false
if EIDConfig["EnableEntityDescriptions"] then if EIDConfig["EnableEntityDescriptions"] then
isAllowed = isAllowed or (__eidEntityDescriptions[entity.Type.."."..entity.Variant.."."..entity.SubType]~=nil --[[or type(entity:GetData()["EID_Description"]) ~= type(nil)]]) isAllowed =
isAllowed or
(__eidEntityDescriptions[entity.Type .. "." .. entity.Variant .. "." .. entity.SubType] ~= nil) --[[or type(entity:GetData()["EID_Description"]) ~= type(nil)]]
end end
isAllowed = isAllowed or (entity.Variant == PickupVariant.PICKUP_COLLECTIBLE and EIDConfig["DisplayItemInfo"]) isAllowed = isAllowed or (entity.Variant == PickupVariant.PICKUP_COLLECTIBLE and EIDConfig["DisplayItemInfo"])
isAllowed = isAllowed or (entity.Variant == PickupVariant.PICKUP_TRINKET and EIDConfig["DisplayTrinketInfo"]) isAllowed = isAllowed or (entity.Variant == PickupVariant.PICKUP_TRINKET and EIDConfig["DisplayTrinketInfo"])
isAllowed = isAllowed or (entity.Variant == PickupVariant.PICKUP_TAROTCARD and EIDConfig["DisplayCardInfo"]) isAllowed = isAllowed or (entity.Variant == PickupVariant.PICKUP_TAROTCARD and EIDConfig["DisplayCardInfo"])
isAllowed = isAllowed or (entity.Variant == PickupVariant.PICKUP_PILL and EIDConfig["DisplayPillInfo"]) isAllowed = isAllowed or (entity.Variant == PickupVariant.PICKUP_PILL and EIDConfig["DisplayPillInfo"])
return entity.Type == EntityType.ENTITY_PICKUP and isAllowed and entity.SubType>0 return entity.Type == EntityType.ENTITY_PICKUP and isAllowed and entity.SubType > 0
end end
-- Replaces shorthand-representations of a character with the internal reference -- Replaces shorthand-representations of a character with the internal reference
@@ -126,40 +126,80 @@ function EID:replaceMarkupStrings(text)
end end
-- Returns the icon used for the bulletpoint. It will look at the first character in the given string. -- Returns the icon used for the bulletpoint. It will look at the first character in the given string.
EID.bulletIcons={"↑","↓","!","ǃ"} EID.bulletIcons = {"↑", "↓", "!", "ǃ"}
function EID:getBulletpointIcon(text) function EID:getBulletpointIcon(text)
for i,v in ipairs(EID.bulletIcons) do for i, v in ipairs(EID.bulletIcons) do
local iconPos = string.find(text,v) local iconPos = string.find(text, v)
if iconPos == 1 or iconPos == 2 then if iconPos == 1 or iconPos == 2 then
return v return v
end end
end end
return '\007' return "\007"
end end
--needs to be called in a render Callback --needs to be called in a render Callback
-- args: string, Vector(int, int), Vector(float,float), KColor obj, bool -- args: string, Vector(int, int), Vector(float,float), KColor obj, bool
function EID:renderString(str, position, scale, kcolor, centered) function EID:renderString(str, position, scale, kcolor, centered)
EID.font:DrawStringScaledUTF8(str, position.X, position.Y, scale.X ,scale.Y ,kcolor ,EID.font:GetStringWidthUTF8(str), centered) EID.font:DrawStringScaledUTF8(
str,
position.X,
position.Y,
scale.X,
scale.Y,
kcolor,
EID.font:GetStringWidthUTF8(str),
centered
)
end end
-- Get KColor object of "Entity Name" texts -- Get KColor object of "Entity Name" texts
function EID:getNameColor() function EID:getNameColor()
return KColor(EIDConfig["ItemNameColor"][1] , EIDConfig["ItemNameColor"][2], EIDConfig["ItemNameColor"][3],EIDConfig["Transparency"],0,0,0) return KColor(
EIDConfig["ItemNameColor"][1],
EIDConfig["ItemNameColor"][2],
EIDConfig["ItemNameColor"][3],
EIDConfig["Transparency"],
0,
0,
0
)
end end
-- Get KColor object of "Description" texts -- Get KColor object of "Description" texts
function EID:getTextColor() function EID:getTextColor()
return KColor(EIDConfig["TextColor"][1] , EIDConfig["TextColor"][2], EIDConfig["TextColor"][3],EIDConfig["Transparency"],0,0,0) return KColor(
EIDConfig["TextColor"][1],
EIDConfig["TextColor"][2],
EIDConfig["TextColor"][3],
EIDConfig["Transparency"],
0,
0,
0
)
end end
-- Get KColor object of "Transformation" texts -- Get KColor object of "Transformation" texts
function EID:getTransformationColor() function EID:getTransformationColor()
return KColor(EIDConfig["TransformationColor"][1] , EIDConfig["TransformationColor"][2], EIDConfig["TransformationColor"][3],EIDConfig["Transparency"],0,0,0) return KColor(
EIDConfig["TransformationColor"][1],
EIDConfig["TransformationColor"][2],
EIDConfig["TransformationColor"][3],
EIDConfig["Transparency"],
0,
0,
0
)
end end
-- Get KColor object of "Error" texts -- Get KColor object of "Error" texts
function EID:getErrorColor() function EID:getErrorColor()
return KColor(EIDConfig["ErrorColor"][1] , EIDConfig["ErrorColor"][2], EIDConfig["ErrorColor"][3],EIDConfig["Transparency"],0,0,0) return KColor(
EIDConfig["ErrorColor"][1],
EIDConfig["ErrorColor"][2],
EIDConfig["ErrorColor"][3],
EIDConfig["Transparency"],
0,
0,
0
)
end end
+6 -21
View File
@@ -1,5 +1,4 @@
EIDConfig={ EIDConfig = {
-------GENERAL--------- -------GENERAL---------
-- Change language of the mod. -- Change language of the mod.
@@ -13,7 +12,6 @@ EIDConfig={
-- Russian (https://steamcommunity.com/sharedfiles/filedetails/?id=1552851879) -- Russian (https://steamcommunity.com/sharedfiles/filedetails/?id=1552851879)
-- If you want to make a translation, please contact me :) -- If you want to make a translation, please contact me :)
["Language"] = "en_us", ["Language"] = "en_us",
-- Change Width of the info boxes. (In characters) -- Change Width of the info boxes. (In characters)
-- Default = 25 -- Default = 25
["TextboxWidth"] = 25, ["TextboxWidth"] = 25,
@@ -37,18 +35,15 @@ EIDConfig={
-- Arrow = moving arrow pointing at the item | Blink = the whole sprite blinks white | Border = Blinking white border around the sprite | Highlight = White border around the sprite | None = Disable funtion -- Arrow = moving arrow pointing at the item | Blink = the whole sprite blinks white | Border = Blinking white border around the sprite | Highlight = White border around the sprite | None = Disable funtion
-- Default = "none" -- Default = "none"
["Indicator"] = "none", ["Indicator"] = "none",
-- Set the keybinding to toggle the descriptions -- Set the keybinding to toggle the descriptions
-- look into the AB+ documentation for the key names -- look into the AB+ documentation for the key names
-- Default = Keyboard.KEY_F2 -- Default = Keyboard.KEY_F2
["HideKey"] = Keyboard.KEY_F2 , ["HideKey"] = Keyboard.KEY_F2,
-------------CURSE------------- -------------CURSE-------------
-- Display informations when the floor has curse of the blind ( ? - Items) -- Display informations when the floor has curse of the blind ( ? - Items)
-- Default = true -- Default = true
["DisableOnCurse"] = true, ["DisableOnCurse"] = true,
----------ITEM NAMES----------- ----------ITEM NAMES-----------
-- Toggle Display of Collectible / Card and Pill names -- Toggle Display of Collectible / Card and Pill names
@@ -66,7 +61,6 @@ EIDConfig={
-- Set the RGB color of the Itemname text -- Set the RGB color of the Itemname text
-- Default = {0.8, 0.3, 0.8} -- Default = {0.8, 0.3, 0.8}
["ItemNameColor"] = {0.8, 0.3, 0.8}, ["ItemNameColor"] = {0.8, 0.3, 0.8},
-------TRANSFORMATIONS--------- -------TRANSFORMATIONS---------
-- Toggle Display of Transformation text -- Toggle Display of Transformation text
@@ -77,8 +71,7 @@ EIDConfig={
["TransformationIcons"] = true, ["TransformationIcons"] = true,
-- Set the RGB color of the Transformation text -- Set the RGB color of the Transformation text
-- Default = { 0.5, 0.5, 1} -- Default = { 0.5, 0.5, 1}
["TransformationColor"] = { 0.5, 0.5, 1}, ["TransformationColor"] = {0.5, 0.5, 1},
------------CARDS-------------- ------------CARDS--------------
-- Toggle Display of Card / Rune descriptions -- Toggle Display of Card / Rune descriptions
@@ -87,7 +80,6 @@ EIDConfig={
-- Toggle Display of Card / Rune descriptions when its a shop item -- Toggle Display of Card / Rune descriptions when its a shop item
-- Default = false -- Default = false
["DisplayCardInfoShop"] = false, ["DisplayCardInfoShop"] = false,
------------PILLS-------------- ------------PILLS--------------
-- Toggle Display of Pill descriptions -- Toggle Display of Pill descriptions
@@ -99,22 +91,16 @@ EIDConfig={
-- Toggle Display of Pill descriptions that arent known to you yet -- Toggle Display of Pill descriptions that arent known to you yet
-- Default = false -- Default = false
["ShowUnidentifiedPillDescriptions"] = false, ["ShowUnidentifiedPillDescriptions"] = false,
--------Sacrifice Room--------- --------Sacrifice Room---------
-- Toggle Display of next Sacrifice room Payout descriptions -- Toggle Display of next Sacrifice room Payout descriptions
-- Default = true -- Default = true
["DisplaySacrificeInfo"] = true, ["DisplaySacrificeInfo"] = true,
--------Dice Room--------- --------Dice Room---------
-- Toggle Display of Diceroom descriptions -- Toggle Display of Diceroom descriptions
-- Default = true -- Default = true
["DisplayDiceInfo"] = true, ["DisplayDiceInfo"] = true,
-------------MISC--------------- -------------MISC---------------
-- Error message displayed when an error occurs -- Error message displayed when an error occurs
@@ -122,15 +108,14 @@ EIDConfig={
["ErrorMessage"] = "[Effect not defined]", ["ErrorMessage"] = "[Effect not defined]",
-- Set the RGB color of the default description text -- Set the RGB color of the default description text
-- Default = { 1, 1, 1} -- Default = { 1, 1, 1}
["TextColor"] = {1,1,1}, ["TextColor"] = {1, 1, 1},
-- Set the RGB color of the Error text -- Set the RGB color of the Error text
-- Default = { 1, 0, 0} -- Default = { 1, 0, 0}
["ErrorColor"] = {1,0.4,0.4}, ["ErrorColor"] = {1, 0.4, 0.4},
-- Enables or disables custom Descriptions for entities -- Enables or disables custom Descriptions for entities
-- Default = true -- Default = true
["EnableEntityDescriptions"] = true ["EnableEntityDescriptions"] = true
}
}
--END CONFIG-- --END CONFIG--
----------- -----------
+16 -14
View File
@@ -1,21 +1,23 @@
local charsToDebug = { local charsToDebug = {
EID:replaceMarkupStrings("!!! EID DEBUG MODE ACTIVATED !!!"), -- Header EID:replaceMarkupStrings("!!! EID DEBUG MODE ACTIVATED !!!"), -- Header
"ABCDEFGHIJKLMNOPQRSTUVWXYZ", -- Caps letters "ABCDEFGHIJKLMNOPQRSTUVWXYZ", -- Caps letters
"abcdefghijklmnopqrstuvwxyz1234567890", -- small letters + numbers "abcdefghijklmnopqrstuvwxyz1234567890", -- small letters + numbers
"western: Áá Àà Ââ Āā Ää Ãã Åå Ææ Éé Èè Êê Ēē Ëë Íí Ìì Îî Īī Ïï ", -- "western: Áá Àà Ââ Āā Ää Ãã Åå Ææ Éé Èè Êê Ēē Ëë Íí Ìì Îî Īī Ïï ", --
"western 2: Óó Òò Ôô Ōō Öö Õõ Øø Œœ Úú Ùù Ûû Ūū Üü Ŵŵ Ýý Ÿÿ Ŷ", -- "western 2: Óó Òò Ôô Ōō Öö Õõ Øø Œœ Úú Ùù Ûû Ūū Üü Ŵŵ Ýý Ÿÿ Ŷ", --
"western 3: Þþ Çç Ðð Ññ ß ¿¡", -- "western 3: Þþ Çç Ðð Ññ ß ¿¡", --
"cyrillic 1: Аа Бб Вв Гг Дд Ее Ёё Жж Зз Ии Йй Кк Лл Мм Нн Оо", "cyrillic 1: Аа Бб Вв Гг Дд Ее Ёё Жж Зз Ии Йй Кк Лл Мм Нн Оо",
"cyrillic 2: Пп Рр Сс Тт Уу Фф Хх Цц Чч Шш Щщ Ъъ Ыы Ьь Ээ Юю Яя", "cyrillic 2: Пп Рр Сс Тт Уу Фф Хх Цц Чч Шш Щщ Ъъ Ыы Ьь Ээ Юю Яя",
"polish: Ąą Ćć Ęę Łł Ńń Óó Śś Źź Żż", "polish: Ąą Ćć Ęę Łł Ńń Óó Śś Źź Żż",
"custom icons: ↑Positive ↓Negative \007bulletpoint !Exclamation ǃWarning !!!shortcut", "custom icons: ↑Positive ↓Negative \007bulletpoint !Exclamation ǃWarning !!!shortcut",
EID:replaceMarkupStrings("legacy icon Markup: \\1:\1Positive \\2:\2Negative \\3:\3Warning ! \\6:\6 heart \\5:\5 Key \\015:\015 Coin \\8\\189:\8\189 Bomb"), EID:replaceMarkupStrings(
"emotes: ☆★〠♠♣♥♦♤♧♡♢☀☂♨♪♭♯♂♀", "legacy icon Markup: \\1:\1Positive \\2:\2Negative \\3:\3Warning ! \\6:\6 heart \\5:\5 Key \\015:\015 Coin \\8\\189:\8\189 Bomb"
),
"emotes: ☆★〠♠♣♥♦♤♧♡♢☀☂♨♪♭♯♂♀"
} }
local function onDebugRender(t) local function onDebugRender(t)
for i,v in ipairs(charsToDebug) do for i, v in ipairs(charsToDebug) do
EID.font:DrawStringUTF8(v,45,20+((i-1)*15),KColor(1,1,1,1,0,0,0),0,true) EID.font:DrawStringUTF8(v, 45, 20 + ((i - 1) * 15), KColor(1, 1, 1, 1, 0, 0, 0), 0, true)
end end
end end
EID:AddCallback(ModCallbacks.MC_POST_RENDER, onDebugRender) EID:AddCallback(ModCallbacks.MC_POST_RENDER, onDebugRender)
+272 -174
View File
@@ -1,25 +1,25 @@
EID = RegisterMod( "External Item Descriptions" ,1 ); EID = RegisterMod("External Item Descriptions", 1)
local itemConfig = Isaac.GetItemConfig() local itemConfig = Isaac.GetItemConfig()
local lineHeight = 11 local lineHeight = 11
local isDisplayingText= false local isDisplayingText = false
local lastDescriptionEntity= nil local lastDescriptionEntity = nil
local hideDescToggle= false local hideDescToggle = false
EID.sacrificeCounter= 1 EID.sacrificeCounter = 1
local IconSprite = Sprite() local IconSprite = Sprite()
IconSprite:Load("gfx/icons.anm2", true) IconSprite:Load("gfx/icons.anm2", true)
local ArrowSprite = Sprite() local ArrowSprite = Sprite()
ArrowSprite:Load("gfx/icons.anm2", true) ArrowSprite:Load("gfx/icons.anm2", true)
ArrowSprite:Play("Arrow",false) ArrowSprite:Play("Arrow", false)
local CardSprite = Sprite() local CardSprite = Sprite()
CardSprite:Load("gfx/cardfronts.anm2", true) CardSprite:Load("gfx/cardfronts.anm2", true)
require("eid_config") require("eid_config")
require("mod_config_menu") require("mod_config_menu")
require("descriptions.ab+."..EIDConfig["Language"]) require("descriptions.ab+." .. EIDConfig["Language"])
require("eid_api") require("eid_api")
--use some very hacky trickery to get the path to this mod --use some very hacky trickery to get the path to this mod
@@ -27,47 +27,43 @@ local _, err = pcall(require, "")
local _, basePathStart = string.find(err, "no file '", 1) local _, basePathStart = string.find(err, "no file '", 1)
local _, modPathStart = string.find(err, "no file '", basePathStart) local _, modPathStart = string.find(err, "no file '", basePathStart)
local modPathEnd, _ = string.find(err, ".lua'", modPathStart) local modPathEnd, _ = string.find(err, ".lua'", modPathStart)
local modPath = string.sub(err, modPathStart+1, modPathEnd-1) local modPath = string.sub(err, modPathStart + 1, modPathEnd - 1)
modPath = string.gsub(modPath, "\\", "/") modPath = string.gsub(modPath, "\\", "/")
modPath = string.gsub(modPath, ":/", ":\\") modPath = string.gsub(modPath, ":/", ":\\")
EID.font = Font() -- init font object EID.font = Font() -- init font object
EID.font:Load(modPath.."resources/font/default.fnt") -- load a font into the font object EID.font:Load(modPath .. "resources/font/default.fnt") -- load a font into the font object
EID.font:SetMissingCharacter(2) EID.font:SetMissingCharacter(2)
if not EID.font:IsLoaded() then if not EID.font:IsLoaded() then
Isaac.DebugString("EID - ERROR: Could not load font from '"..modPath.."resources/font/default.fnt".."'") Isaac.DebugString("EID - ERROR: Could not load font from '" .. modPath .. "resources/font/default.fnt" .. "'")
end end
--Makes textscale smaller, when using detailed english descriptions --Makes textscale smaller, when using detailed english descriptions
if EIDConfig["Language"]=="en_us_detailed" and EIDConfig["Scale"] > 0.5 then if EIDConfig["Language"] == "en_us_detailed" and EIDConfig["Scale"] > 0.5 then
EIDConfig["Scale"] = 0.5 EIDConfig["Scale"] = 0.5
end end
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
-------------------------Handle Sacrifice Room----------------------------- -------------------------Handle Sacrifice Room-----------------------------
if EIDConfig["DisplaySacrificeInfo"] then if EIDConfig["DisplaySacrificeInfo"] then
function onNewFloor() function onNewFloor()
EID.sacrificeCounter= 1 EID.sacrificeCounter = 1
end end
EID:AddCallback(ModCallbacks.MC_POST_NEW_LEVEL, onNewFloor) EID:AddCallback(ModCallbacks.MC_POST_NEW_LEVEL, onNewFloor)
function onDamage(_,entity,_,flag,source) function onDamage(_, entity, _, flag, source)
if Game():GetRoom():GetType() == RoomType.ROOM_SACRIFICE and source.Type == 0 and flag == DamageFlag.DAMAGE_SPIKES then if Game():GetRoom():GetType() == RoomType.ROOM_SACRIFICE and source.Type == 0 and flag == DamageFlag.DAMAGE_SPIKES then
if EID.sacrificeCounter<12 then if EID.sacrificeCounter < 12 then
EID.sacrificeCounter= EID.sacrificeCounter+1 EID.sacrificeCounter = EID.sacrificeCounter + 1
end end
end end
end end
EID:AddCallback(ModCallbacks.MC_ENTITY_TAKE_DMG, onDamage,EntityType.ENTITY_PLAYER) EID:AddCallback(ModCallbacks.MC_ENTITY_TAKE_DMG, onDamage, EntityType.ENTITY_PLAYER)
end end
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
---------------------------Printing Functions------------------------------ ---------------------------Printing Functions------------------------------
local itemTypes= {"null","passive","active","familiar","trinket"} 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"]
@@ -79,95 +75,130 @@ function printDescription(desc)
local itemType = itemConfig:GetCollectible(desc[1]).Type local itemType = itemConfig:GetCollectible(desc[1]).Type
--Display ItemType / Charge --Display ItemType / Charge
if EIDConfig["ShowItemType"] and (itemType ==3 or itemType== 4) then if EIDConfig["ShowItemType"] and (itemType == 3 or itemType == 4) then
local offsetY = 2*EIDConfig["Scale"] local offsetY = 2 * EIDConfig["Scale"]
if EIDConfig["Scale"]<1 then if EIDConfig["Scale"] < 1 then
offsetY =-1 offsetY = -1
end end
IconSprite:Play(itemTypes[itemType]) IconSprite:Play(itemTypes[itemType])
IconSprite.Scale = Vector(EIDConfig["Scale"],EIDConfig["Scale"]) IconSprite.Scale = Vector(EIDConfig["Scale"], EIDConfig["Scale"])
IconSprite:Update() IconSprite:Update()
IconSprite:Render(Vector(EIDConfig["XPosition"]-3*EIDConfig["Scale"],padding+offsetY), Vector(0,0), Vector(0,0)) IconSprite:Render(
if itemType ==3 then -- Display Charge Vector(EIDConfig["XPosition"] - 3 * EIDConfig["Scale"], padding + offsetY),
Vector(0, 0),
Vector(0, 0)
)
if itemType == 3 then -- Display Charge
IconSprite:Play(itemConfig:GetCollectible(desc[1]).MaxCharges) IconSprite:Play(itemConfig:GetCollectible(desc[1]).MaxCharges)
IconSprite:Update() IconSprite:Update()
IconSprite:Render(Vector(EIDConfig["XPosition"]-3*EIDConfig["Scale"],padding+offsetY), Vector(0,0), Vector(0,0)) IconSprite:Render(
Vector(EIDConfig["XPosition"] - 3 * EIDConfig["Scale"], padding + offsetY),
Vector(0, 0),
Vector(0, 0)
)
end end
if not EIDConfig["ShowItemName"] then if not EIDConfig["ShowItemName"] then
padding = padding+lineHeight*EIDConfig["Scale"] padding = padding + lineHeight * EIDConfig["Scale"]
end end
end end
--Display Itemname --Display Itemname
if EIDConfig["ShowItemName"] then if EIDConfig["ShowItemName"] then
local offset = 0 local offset = 0
if EIDConfig["ShowItemType"]then if itemType==3 then offset = 9 else offset = 6 end end if EIDConfig["ShowItemType"] then
EID:renderString(itemConfig:GetCollectible(desc[1]).Name, Vector(EIDConfig["XPosition"]+offset*EIDConfig["Scale"], padding-4), Vector(EIDConfig["Scale"],EIDConfig["Scale"]), EID:getNameColor(), false) if itemType == 3 then
offset = 9
padding = padding+lineHeight*EIDConfig["Scale"] else
offset = 6
end end
end
EID:renderString(
itemConfig:GetCollectible(desc[1]).Name,
Vector(EIDConfig["XPosition"] + offset * EIDConfig["Scale"], padding - 4),
Vector(EIDConfig["Scale"], EIDConfig["Scale"]),
EID:getNameColor(),
false
)
padding = padding + lineHeight * EIDConfig["Scale"]
end
--Display Transformation --Display Transformation
if not(desc[2]=="0" or desc[2]=="" or desc[2]==nil ) then if not (desc[2] == "0" or desc[2] == "" or desc[2] == nil) then
if EIDConfig["TransformationText"] then if EIDConfig["TransformationText"] then
local transformationText= "" local transformationText = ""
if not(EID:getTransformation(desc[2])=="Custom") then if not (EID:getTransformation(desc[2]) == "Custom") then
transformationText =EID:getTransformation(desc[2]) transformationText = EID:getTransformation(desc[2])
elseif not(transformations[desc[2]]) then --Custom transformationname elseif not (transformations[desc[2]]) then --Custom transformationname
transformationText=desc[2] transformationText = desc[2]
else else
transformationText=EID:getTransformation(desc[2]) transformationText = EID:getTransformation(desc[2])
end end
EID:renderString(transformationText, Vector(EIDConfig["XPosition"]+16*EIDConfig["Scale"], padding-1), Vector(EIDConfig["Scale"],EIDConfig["Scale"]), EID:getTransformationColor(), false) EID:renderString(
transformationText,
Vector(EIDConfig["XPosition"] + 16 * EIDConfig["Scale"], padding - 1),
Vector(EIDConfig["Scale"], EIDConfig["Scale"]),
EID:getTransformationColor(),
false
)
end end
if EIDConfig["TransformationIcons"] and not(EID:getTransformation(desc[2])=="Custom") then if EIDConfig["TransformationIcons"] and not (EID:getTransformation(desc[2]) == "Custom") then
IconSprite:Play("Transformation"..desc[2]) IconSprite:Play("Transformation" .. desc[2])
IconSprite.Scale = Vector(EIDConfig["Scale"],EIDConfig["Scale"]) IconSprite.Scale = Vector(EIDConfig["Scale"], EIDConfig["Scale"])
IconSprite:Update() IconSprite:Update()
IconSprite:Render(Vector(EIDConfig["XPosition"]+5*EIDConfig["Scale"],padding+5*EIDConfig["Scale"]), Vector(0,0), Vector(0,0)) IconSprite:Render(
Vector(EIDConfig["XPosition"] + 5 * EIDConfig["Scale"], padding + 5 * EIDConfig["Scale"]),
Vector(0, 0),
Vector(0, 0)
)
end end
if(EIDConfig["TransformationIcons"] or EIDConfig["TransformationText"] ) then if (EIDConfig["TransformationIcons"] or EIDConfig["TransformationText"]) then
padding = padding+lineHeight*EIDConfig["Scale"] padding = padding + lineHeight * EIDConfig["Scale"]
end end
end end
printBulletPoints(Description,padding) printBulletPoints(Description, padding)
end end
function printTrinketDescription(desc,typ) function printTrinketDescription(desc, typ)
local Description = desc[2] local Description = desc[2]
local padding = posY() local padding = posY()
--Display Itemname --Display Itemname
if EIDConfig["ShowItemName"] then if EIDConfig["ShowItemName"] then
local name= "" local name = ""
if typ=="trinket" then if typ == "trinket" then
name= itemConfig:GetTrinket(desc[1]).Name name = itemConfig:GetTrinket(desc[1]).Name
elseif typ=="card" then elseif typ == "card" then
name= itemConfig:GetCard(desc[1]).Name name = itemConfig:GetCard(desc[1]).Name
elseif typ=="pill" then elseif typ == "pill" then
name= itemConfig:GetPillEffect(desc[1]).Name name = itemConfig:GetPillEffect(desc[1]).Name
elseif typ=="sacrifice" then elseif typ == "sacrifice" then
name= sacrificeDescriptionHeader name = sacrificeDescriptionHeader
elseif typ=="dice" then elseif typ == "dice" then
name= diceDescriptionHeader name = diceDescriptionHeader
elseif typ=="custom" then elseif typ == "custom" then
name= desc[2][1] name = desc[2][1]
Description= desc[2][2] Description = desc[2][2]
end end
EID:renderString(name, Vector(EIDConfig["XPosition"],padding), Vector(EIDConfig["Scale"],EIDConfig["Scale"]), EID:getNameColor(), false) EID:renderString(
name,
Vector(EIDConfig["XPosition"], padding),
Vector(EIDConfig["Scale"], EIDConfig["Scale"]),
EID:getNameColor(),
false
)
padding = padding+lineHeight*EIDConfig["Scale"] padding = padding + lineHeight * EIDConfig["Scale"]
end end
printBulletPoints(Description,padding) printBulletPoints(Description, padding)
end end
function printBulletPoints(description, padding) function printBulletPoints(description, padding)
local textboxWidth=tonumber(EIDConfig["TextboxWidth"]) local textboxWidth = tonumber(EIDConfig["TextboxWidth"])
for line in string.gmatch(description, '([^#]+)') do for line in string.gmatch(description, "([^#]+)") do
local array={} local array = {}
local text = "" local text = ""
for word in string.gmatch(line, '([^ ]+)') do for word in string.gmatch(line, "([^ ]+)") do
if string.len(text)+string.len(word)<=textboxWidth then if string.len(text) + string.len(word) <= textboxWidth then
text = text.." "..word text = text .. " " .. word
else else
table.insert(array, text) table.insert(array, text)
text = word text = word
@@ -180,213 +211,278 @@ function printBulletPoints(description, padding)
local bpIcon = " " -- no bulletpoint local bpIcon = " " -- no bulletpoint
if i == 1 then if i == 1 then
bpIcon = EID:getBulletpointIcon(v) bpIcon = EID:getBulletpointIcon(v)
if string.find(bpIcon,'\007') == nil then if string.find(bpIcon, "\007") == nil then
v = string.sub(v, 3 + #bpIcon) v = string.sub(v, 3 + #bpIcon)
posX = posX - 2 -- Move a bit to the left, to center icons posX = posX - 2 -- Move a bit to the left, to center icons
end end
end end
EID:renderString(bpIcon..EID:replaceMarkupStrings(v), Vector(posX, padding), Vector(EIDConfig["Scale"],EIDConfig["Scale"]), textColor, false) EID:renderString(
padding = padding +lineHeight*EIDConfig["Scale"] bpIcon .. EID:replaceMarkupStrings(v),
Vector(posX, padding),
Vector(EIDConfig["Scale"], EIDConfig["Scale"]),
textColor,
false
)
padding = padding + lineHeight * EIDConfig["Scale"]
end end
end end
end end
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
---------------------------Handle Rendering-------------------------------- ---------------------------Handle Rendering--------------------------------
function HasCurseBlind() function HasCurseBlind()
local num = Game():GetLevel():GetCurses() local num = Game():GetLevel():GetCurses()
local t={} local t = {}
while num>0 do while num > 0 do
rest=num%2 rest = num % 2
t[#t+1]=rest t[#t + 1] = rest
num=(num-rest)/2 num = (num - rest) / 2
end end
return #t>6 and t[7]==1 return #t > 6 and t[7] == 1
end end
function renderQuestionMark() function renderQuestionMark()
IconSprite:Play("CurseOfBlind") IconSprite:Play("CurseOfBlind")
IconSprite.Scale = Vector(EIDConfig["Scale"],EIDConfig["Scale"]) IconSprite.Scale = Vector(EIDConfig["Scale"], EIDConfig["Scale"])
IconSprite:Update() IconSprite:Update()
IconSprite:Render(Vector(EIDConfig["XPosition"]+5*EIDConfig["Scale"],posY()+5*EIDConfig["Scale"]), Vector(0,0), Vector(0,0)) IconSprite:Render(
if Isaac.GetPlayer(0):HasCollectible(CollectibleType.COLLECTIBLE_SCHOOLBAG) then modifiedPosY =EIDConfig["YPosition"] -30 end Vector(EIDConfig["XPosition"] + 5 * EIDConfig["Scale"], posY() + 5 * EIDConfig["Scale"]),
Vector(0, 0),
Vector(0, 0)
)
if Isaac.GetPlayer(0):HasCollectible(CollectibleType.COLLECTIBLE_SCHOOLBAG) then
modifiedPosY = EIDConfig["YPosition"] - 30
end
end end
function renderIndicator(entity) function renderIndicator(entity)
if EIDConfig["Indicator"] == "blink" then if EIDConfig["Indicator"] == "blink" then
local c = 255-math.floor(255*((entity.FrameCount%40)/40)) local c = 255 - math.floor(255 * ((entity.FrameCount % 40) / 40))
entity:SetColor(Color(1,1,1,1,c,c,c),1,1,false,false) entity:SetColor(Color(1, 1, 1, 1, c, c, c), 1, 1, false, false)
entity:Render(Vector(0,0)) entity:Render(Vector(0, 0))
entity:SetColor(Color(1,1,1,1,0,0,0),2,1,false,false) entity:SetColor(Color(1, 1, 1, 1, 0, 0, 0), 2, 1, false, false)
elseif EIDConfig["Indicator"] == "border" then elseif EIDConfig["Indicator"] == "border" then
local c = 255-math.floor(255*((entity.FrameCount%40)/40)) local c = 255 - math.floor(255 * ((entity.FrameCount % 40) / 40))
entity:SetColor(Color(1,1,1,1,c,c,c),1,1,false,false) entity:SetColor(Color(1, 1, 1, 1, c, c, c), 1, 1, false, false)
entity:Render(Vector(0,1)) entity:Render(Vector(0, 1))
entity:Render(Vector(0,-1)) entity:Render(Vector(0, -1))
entity:Render(Vector(1,0)) entity:Render(Vector(1, 0))
entity:Render(Vector(-1,0)) entity:Render(Vector(-1, 0))
entity:SetColor(Color(1,1,1,1,0,0,0),2,1,false,false) entity:SetColor(Color(1, 1, 1, 1, 0, 0, 0), 2, 1, false, false)
entity:Render(Vector(0,0)) entity:Render(Vector(0, 0))
elseif EIDConfig["Indicator"] == "highlight" then elseif EIDConfig["Indicator"] == "highlight" then
entity:SetColor(Color(1,1,1,1,255,255,255),1,1,false,false) entity:SetColor(Color(1, 1, 1, 1, 255, 255, 255), 1, 1, false, false)
entity:Render(Vector(0,1)) entity:Render(Vector(0, 1))
entity:Render(Vector(0,-1)) entity:Render(Vector(0, -1))
entity:Render(Vector(1,0)) entity:Render(Vector(1, 0))
entity:Render(Vector(-1,0)) entity:Render(Vector(-1, 0))
entity:SetColor(Color(1,1,1,1,0,0,0),2,1,false,false) entity:SetColor(Color(1, 1, 1, 1, 0, 0, 0), 2, 1, false, false)
entity:Render(Vector(0,0)) entity:Render(Vector(0, 0))
elseif EIDConfig["Indicator"] == "arrow" then elseif EIDConfig["Indicator"] == "arrow" then
ArrowSprite:Update() ArrowSprite:Update()
local ArrowOffset = Vector(0,-35) local ArrowOffset = Vector(0, -35)
if entity.Variant ==100 and not entity:ToPickup():IsShopItem() then ArrowOffset = Vector(0,-62) end if entity.Variant == 100 and not entity:ToPickup():IsShopItem() then
ArrowSprite:Render(Game():GetRoom():WorldToScreenPosition(entity.Position+ArrowOffset), Vector(0,0), Vector(0,0)) ArrowOffset = Vector(0, -62)
end
ArrowSprite:Render(Game():GetRoom():WorldToScreenPosition(entity.Position + ArrowOffset), Vector(0, 0), Vector(0, 0))
end end
end end
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
---------------------------On Render Function------------------------------ ---------------------------On Render Function------------------------------
local function onRender(t) local function onRender(t)
isDisplayingText= false isDisplayingText = false
local player = Isaac.GetPlayer(0) local player = Isaac.GetPlayer(0)
local closest = nil local closest = nil
local closestDice = nil local closestDice = nil
local dist = 10000 local dist = 10000
if Input.IsButtonTriggered(EIDConfig["HideKey"], 0) then if Input.IsButtonTriggered(EIDConfig["HideKey"], 0) then
hideDescToggle = not hideDescToggle; hideDescToggle = not hideDescToggle
end
if hideDescToggle then
return
end end
if hideDescToggle then return end
for i, entity in ipairs(Isaac.GetRoomEntities()) do for i, entity in ipairs(Isaac.GetRoomEntities()) do
if Game():GetRoom():GetType()==RoomType.ROOM_DICE and entity.Type==1000 and entity.Variant== 76 then closestDice= entity end if Game():GetRoom():GetType() == RoomType.ROOM_DICE and entity.Type == 1000 and entity.Variant == 76 then
closestDice = entity
end
if EID:hasDescription(entity) then if EID:hasDescription(entity) then
local diff = entity.Position:__sub(player.Position); local diff = entity.Position:__sub(player.Position)
if diff:Length() < dist then if diff:Length() < dist then
closest = entity; closest = entity
dist = diff:Length(); dist = diff:Length()
end end
end end
end end
if dist / 40 > tonumber(EIDConfig["MaxDistance"]) or not closest.Type == EntityType.ENTITY_PICKUP then
if dist/40>tonumber(EIDConfig["MaxDistance"]) or not closest.Type == EntityType.ENTITY_PICKUP then if Game():GetRoom():GetType() == RoomType.ROOM_SACRIFICE and EIDConfig["DisplaySacrificeInfo"] then
if Game():GetRoom():GetType()==RoomType.ROOM_SACRIFICE and EIDConfig["DisplaySacrificeInfo"] then printTrinketDescription(sacrificeDescriptions[EID.sacrificeCounter], "sacrifice")
printTrinketDescription(sacrificeDescriptions[EID.sacrificeCounter],"sacrifice")
end end
if Game():GetRoom():GetType()==RoomType.ROOM_DICE and EIDConfig["DisplayDiceInfo"] and type(closestDice) ~= type(nil) then if
printTrinketDescription(diceDescriptions[closestDice.SubType+1],"dice") Game():GetRoom():GetType() == RoomType.ROOM_DICE and EIDConfig["DisplayDiceInfo"] and type(closestDice) ~= type(nil)
then
printTrinketDescription(diceDescriptions[closestDice.SubType + 1], "dice")
renderIndicator(closestDice) renderIndicator(closestDice)
end end
return return
end end
if closest==nil then return end if closest == nil then
return
end
lastDescriptionEntity = closest lastDescriptionEntity = closest
isDisplayingText= true isDisplayingText = true
--Handle Indicators --Handle Indicators
renderIndicator(closest) renderIndicator(closest)
--Handle Entities (specific) --Handle Entities (specific)
if EIDConfig["EnableEntityDescriptions"] and type(closest:GetData()["EID_Description"]) ~= type(nil) then if EIDConfig["EnableEntityDescriptions"] and type(closest:GetData()["EID_Description"]) ~= type(nil) then
printTrinketDescription({closest.Type,closest:GetData()["EID_Description"]},"custom") printTrinketDescription({closest.Type, closest:GetData()["EID_Description"]}, "custom")
return return
end end
--Handle Entities (omni) --Handle Entities (omni)
if EIDConfig["EnableEntityDescriptions"] and __eidEntityDescriptions[closest.Type.."."..closest.Variant.."."..closest.SubType] ~=nil then if
printTrinketDescription({closest.Type,EID:getModDescription(__eidEntityDescriptions,closest.Type.."."..closest.Variant.."."..closest.SubType)},"custom") EIDConfig["EnableEntityDescriptions"] and
__eidEntityDescriptions[closest.Type .. "." .. closest.Variant .. "." .. closest.SubType] ~= nil
then
printTrinketDescription(
{
closest.Type,
EID:getModDescription(__eidEntityDescriptions, closest.Type .. "." .. closest.Variant .. "." .. closest.SubType)
},
"custom"
)
return return
end end
--Handle Trinkets --Handle Trinkets
if closest.Variant == PickupVariant.PICKUP_TRINKET then if closest.Variant == PickupVariant.PICKUP_TRINKET then
if closest.SubType <= 128 then
printTrinketDescription(trinketdescriptions[closest.SubType],"trinket")
elseif EID:getModDescription(__eidTrinketDescriptions,closest.SubType) then
printTrinketDescription({closest.SubType,EID:getModDescription(__eidTrinketDescriptions,closest.SubType)},"trinket")
else
printTrinketDescription({closest.SubType,itemConfig:GetTrinket(closest.SubType).Description})
end
--Handle Collectibles --Handle Collectibles
elseif closest.Variant == PickupVariant.PICKUP_COLLECTIBLE then if closest.SubType <= 128 then
if HasCurseBlind() and EIDConfig["DisableOnCurse"] then renderQuestionMark() return end printTrinketDescription(trinketdescriptions[closest.SubType], "trinket")
if EID:getModDescription(__eidItemDescriptions,closest.SubType) then elseif EID:getModDescription(__eidTrinketDescriptions, closest.SubType) then
local tranformation = "0" printTrinketDescription(
if EID:getModDescription(__eidItemTransformations,closest.SubType) then {closest.SubType, EID:getModDescription(__eidTrinketDescriptions, closest.SubType)},
tranformation = EID:getModDescription(__eidItemTransformations,closest.SubType) "trinket"
)
else
printTrinketDescription({closest.SubType, itemConfig:GetTrinket(closest.SubType).Description})
end end
printDescription({closest.SubType,tranformation,EID:getModDescription(__eidItemDescriptions,closest.SubType)}) elseif closest.Variant == PickupVariant.PICKUP_COLLECTIBLE then
--Handle Cards & Runes
if HasCurseBlind() and EIDConfig["DisableOnCurse"] then
renderQuestionMark()
return
end
if EID:getModDescription(__eidItemDescriptions, closest.SubType) then
local tranformation = "0"
if EID:getModDescription(__eidItemTransformations, closest.SubType) then
tranformation = EID:getModDescription(__eidItemTransformations, closest.SubType)
end
printDescription({closest.SubType, tranformation, EID:getModDescription(__eidItemDescriptions, closest.SubType)})
elseif closest.SubType <= 552 then elseif closest.SubType <= 552 then
if EID:getModDescription(__eidItemTransformations,closest.SubType) then if EID:getModDescription(__eidItemTransformations, closest.SubType) then
printDescription({closest.SubType,EID:getModDescription(__eidItemTransformations,closest.SubType),descriptarray[closest.SubType][3]}) printDescription(
{
closest.SubType,
EID:getModDescription(__eidItemTransformations, closest.SubType),
descriptarray[closest.SubType][3]
}
)
else else
printDescription(descriptarray[closest.SubType]) printDescription(descriptarray[closest.SubType])
end end
else else
printDescription({closest.SubType,"",itemConfig:GetCollectible(closest.SubType).Description}) printDescription({closest.SubType, "", itemConfig:GetCollectible(closest.SubType).Description})
end end
--Handle Cards & Runes
elseif closest.Variant == PickupVariant.PICKUP_TAROTCARD then elseif closest.Variant == PickupVariant.PICKUP_TAROTCARD then
if closest:ToPickup():IsShopItem() and not EIDConfig["DisplayCardInfoShop"] then renderQuestionMark() return end --Handle Pills
if EID:getModDescription(__eidCardDescriptions,closest.SubType) then if closest:ToPickup():IsShopItem() and not EIDConfig["DisplayCardInfoShop"] then
printTrinketDescription({closest.SubType,EID:getModDescription(__eidCardDescriptions,closest.SubType)},"card") renderQuestionMark()
return
end
if EID:getModDescription(__eidCardDescriptions, closest.SubType) then
printTrinketDescription({closest.SubType, EID:getModDescription(__eidCardDescriptions, closest.SubType)}, "card")
elseif closest.SubType <= 54 then elseif closest.SubType <= 54 then
printTrinketDescription(cardDescriptions[closest.SubType],"card") printTrinketDescription(cardDescriptions[closest.SubType], "card")
CardSprite:Play(tostring(closest.SubType)) CardSprite:Play(tostring(closest.SubType))
CardSprite.Scale = Vector(EIDConfig["Scale"],EIDConfig["Scale"]) CardSprite.Scale = Vector(EIDConfig["Scale"], EIDConfig["Scale"])
CardSprite:Update() CardSprite:Update()
local offsetX = 0 local offsetX = 0
if EIDConfig["ShowItemName"] then offsetX = 10 end if EIDConfig["ShowItemName"] then
CardSprite:Render(Vector(EIDConfig["XPosition"]-9*EIDConfig["Scale"],posY()+(12+offsetX)*EIDConfig["Scale"]), Vector(0,0), Vector(0,0)) offsetX = 10
end
CardSprite:Render(
Vector(EIDConfig["XPosition"] - 9 * EIDConfig["Scale"], posY() + (12 + offsetX) * EIDConfig["Scale"]),
Vector(0, 0),
Vector(0, 0)
)
else else
printTrinketDescription({closest.SubType,itemConfig:GetCard(closest.SubType).Description}) printTrinketDescription({closest.SubType, itemConfig:GetCard(closest.SubType).Description})
end end
--Handle Pills
elseif closest.Variant == PickupVariant.PICKUP_PILL then elseif closest.Variant == PickupVariant.PICKUP_PILL then
if closest:ToPickup():IsShopItem() and not EIDConfig["DisplayPillInfoShop"] then renderQuestionMark() return end if closest:ToPickup():IsShopItem() and not EIDConfig["DisplayPillInfoShop"] then
renderQuestionMark()
return
end
local pillColor = closest.SubType local pillColor = closest.SubType
local pool = Game():GetItemPool() local pool = Game():GetItemPool()
local pillEffect = pool:GetPillEffect(pillColor) local pillEffect = pool:GetPillEffect(pillColor)
local identified = pool:IsPillIdentified(pillColor) local identified = pool:IsPillIdentified(pillColor)
if (identified or EIDConfig["ShowUnidentifiedPillDescriptions"]) then if (identified or EIDConfig["ShowUnidentifiedPillDescriptions"]) then
if EID:getModDescription(__eidPillDescriptions,pillEffect) then if EID:getModDescription(__eidPillDescriptions, pillEffect) then
printTrinketDescription({pillEffect,EID:getModDescription(__eidPillDescriptions,pillEffect)},"pill") printTrinketDescription({pillEffect, EID:getModDescription(__eidPillDescriptions, pillEffect)}, "pill")
elseif pillEffect < 47 then elseif pillEffect < 47 then
printTrinketDescription(pillDescriptions[pillEffect+1],"pill") printTrinketDescription(pillDescriptions[pillEffect + 1], "pill")
else else
EID:renderString(EIDConfig["ErrorMessage"], Vector(EIDConfig["XPosition"], posY()), Vector(EIDConfig["Scale"],EIDConfig["Scale"]), EID:getErrorColor(), false) EID:renderString(
EIDConfig["ErrorMessage"],
Vector(EIDConfig["XPosition"], posY()),
Vector(EIDConfig["Scale"], EIDConfig["Scale"]),
EID:getErrorColor(),
false
)
end end
else else
EID:renderString(unidentifiedPillMessage, Vector(EIDConfig["XPosition"], posY()), Vector(EIDConfig["Scale"],EIDConfig["Scale"]), EID:getErrorColor(), false) EID:renderString(
unidentifiedPillMessage,
Vector(EIDConfig["XPosition"], posY()),
Vector(EIDConfig["Scale"], EIDConfig["Scale"]),
EID:getErrorColor(),
false
)
end end
local pillsprite = closest:GetSprite() local pillsprite = closest:GetSprite()
pillsprite.Scale = Vector(EIDConfig["Scale"]*0.75,EIDConfig["Scale"]*0.75) pillsprite.Scale = Vector(EIDConfig["Scale"] * 0.75, EIDConfig["Scale"] * 0.75)
pillsprite:Update() pillsprite:Update()
local offsetX = 0 local offsetX = 0
if EIDConfig["ShowItemName"] and (identified or EIDConfig["ShowUnidentifiedPillDescriptions"]) then offsetX = 10 end if EIDConfig["ShowItemName"] and (identified or EIDConfig["ShowUnidentifiedPillDescriptions"]) then
pillsprite:Render(Vector(EIDConfig["XPosition"]+2*EIDConfig["Scale"],posY()+(11+offsetX)*EIDConfig["Scale"]), Vector(0,0), Vector(0,0)) offsetX = 10
pillsprite.Scale = Vector(1,1) end
pillsprite:Render(
Vector(EIDConfig["XPosition"] + 2 * EIDConfig["Scale"], posY() + (11 + offsetX) * EIDConfig["Scale"]),
Vector(0, 0),
Vector(0, 0)
)
pillsprite.Scale = Vector(1, 1)
end
if player:HasCollectible(CollectibleType.COLLECTIBLE_SCHOOLBAG) then
modifiedPosY = EIDConfig["YPosition"] + 30
end end
if player:HasCollectible(CollectibleType.COLLECTIBLE_SCHOOLBAG) then modifiedPosY =EIDConfig["YPosition"] +30 end
end end
EID:AddCallback(ModCallbacks.MC_POST_RENDER, onRender) EID:AddCallback(ModCallbacks.MC_POST_RENDER, onRender)
if ModConfigMenu then if ModConfigMenu then
local json = require("json") local json = require("json")
-------------------------------- --------------------------------
--------Handle Savadata--------- --------Handle Savadata---------
-------------------------------- --------------------------------
@@ -398,7 +494,9 @@ local json = require("json")
savedEIDConfig["Language"] = EIDConfig["Language"] savedEIDConfig["Language"] = EIDConfig["Language"]
-- Only copy Saved config entries that exist in the save -- Only copy Saved config entries that exist in the save
for key, value in pairs(EIDConfig) do for key, value in pairs(EIDConfig) do
if savedEIDConfig[key]~=nil then EIDConfig[key]=savedEIDConfig[key] end if savedEIDConfig[key] ~= nil then
EIDConfig[key] = savedEIDConfig[key]
end
end end
end end
end end
+144 -78
View File
@@ -1,18 +1,21 @@
if ModConfigMenu then if ModConfigMenu then
function AnIndexOf(t, val)
function AnIndexOf(t,val) for k, v in ipairs(t) do
for k,v in ipairs(t) do if v == val then
if v == val then return k end return k
end
end end
return 1 return 1
end end
ModConfigMenu.AddText("EID", "General", "Change Language in the Config file.") ModConfigMenu.AddText("EID", "General", "Change Language in the Config file.")
ModConfigMenu.AddSpace("EID", "General") ModConfigMenu.AddSpace("EID", "General")
-- Disable on Curse -- Disable on Curse
ModConfigMenu.AddSetting("EID","General", { ModConfigMenu.AddSetting(
"EID",
"General",
{
Type = ModConfigMenuOptionType.BOOLEAN, Type = ModConfigMenuOptionType.BOOLEAN,
CurrentSetting = function() CurrentSetting = function()
return EIDConfig["DisableOnCurse"] return EIDConfig["DisableOnCurse"]
@@ -22,18 +25,22 @@ if ModConfigMenu then
if EIDConfig["DisableOnCurse"] then if EIDConfig["DisableOnCurse"] then
onOff = "False" onOff = "False"
end end
return "Show on \"Curse of Blind\": " .. onOff return 'Show on "Curse of Blind": ' .. onOff
end, end,
OnChange = function(currentBool) OnChange = function(currentBool)
EIDConfig["DisableOnCurse"] = currentBool EIDConfig["DisableOnCurse"] = currentBool
end, end
}) }
)
--indicator --indicator
local indicators= {"arrow","blink","border","highlight","none"} local indicators = {"arrow", "blink", "border", "highlight", "none"}
ModConfigMenu.AddSetting("EID", "General", { ModConfigMenu.AddSetting(
"EID",
"General",
{
Type = ModConfigMenuOptionType.NUMBER, Type = ModConfigMenuOptionType.NUMBER,
CurrentSetting = function() CurrentSetting = function()
return AnIndexOf(indicators,EIDConfig["Indicator"]) return AnIndexOf(indicators, EIDConfig["Indicator"])
end, end,
Minimum = 1, Minimum = 1,
Maximum = 5, Maximum = 5,
@@ -42,12 +49,15 @@ if ModConfigMenu then
end, end,
OnChange = function(currentNum) OnChange = function(currentNum)
EIDConfig["Indicator"] = indicators[currentNum] EIDConfig["Indicator"] = indicators[currentNum]
end
end, }
}) )
--------ShowUnidentifiedPillDescriptions--------- --------ShowUnidentifiedPillDescriptions---------
ModConfigMenu.AddSetting("EID","General", { ModConfigMenu.AddSetting(
"EID",
"General",
{
Type = ModConfigMenuOptionType.BOOLEAN, Type = ModConfigMenuOptionType.BOOLEAN,
CurrentSetting = function() CurrentSetting = function()
return EIDConfig["ShowUnidentifiedPillDescriptions"] return EIDConfig["ShowUnidentifiedPillDescriptions"]
@@ -61,10 +71,14 @@ if ModConfigMenu then
end, end,
OnChange = function(currentBool) OnChange = function(currentBool)
EIDConfig["ShowUnidentifiedPillDescriptions"] = currentBool EIDConfig["ShowUnidentifiedPillDescriptions"] = currentBool
end, end
}) }
)
--------Sacrifice Room--------- --------Sacrifice Room---------
ModConfigMenu.AddSetting("EID","Rooms", { ModConfigMenu.AddSetting(
"EID",
"Rooms",
{
Type = ModConfigMenuOptionType.BOOLEAN, Type = ModConfigMenuOptionType.BOOLEAN,
CurrentSetting = function() CurrentSetting = function()
return EIDConfig["DisplaySacrificeInfo"] return EIDConfig["DisplaySacrificeInfo"]
@@ -78,11 +92,15 @@ if ModConfigMenu then
end, end,
OnChange = function(currentBool) OnChange = function(currentBool)
EIDConfig["DisplaySacrificeInfo"] = currentBool EIDConfig["DisplaySacrificeInfo"] = currentBool
end, end
}) }
)
--------Dice Room--------- --------Dice Room---------
ModConfigMenu.AddSetting("EID","Rooms", { ModConfigMenu.AddSetting(
"EID",
"Rooms",
{
Type = ModConfigMenuOptionType.BOOLEAN, Type = ModConfigMenuOptionType.BOOLEAN,
CurrentSetting = function() CurrentSetting = function()
return EIDConfig["DisplayDiceInfo"] return EIDConfig["DisplayDiceInfo"]
@@ -96,13 +114,16 @@ if ModConfigMenu then
end, end,
OnChange = function(currentBool) OnChange = function(currentBool)
EIDConfig["DisplayDiceInfo"] = currentBool EIDConfig["DisplayDiceInfo"] = currentBool
end, end
}) }
)
------------Collectibles-------------- ------------Collectibles--------------
ModConfigMenu.AddSetting("EID","General", { ModConfigMenu.AddSetting(
"EID",
"General",
{
Type = ModConfigMenuOptionType.BOOLEAN, Type = ModConfigMenuOptionType.BOOLEAN,
CurrentSetting = function() CurrentSetting = function()
return EIDConfig["DisplayItemInfo"] return EIDConfig["DisplayItemInfo"]
@@ -116,11 +137,15 @@ if ModConfigMenu then
end, end,
OnChange = function(currentBool) OnChange = function(currentBool)
EIDConfig["DisplayItemInfo"] = currentBool EIDConfig["DisplayItemInfo"] = currentBool
end, end
}) }
)
------------Trinkets-------------- ------------Trinkets--------------
ModConfigMenu.AddSetting("EID","General", { ModConfigMenu.AddSetting(
"EID",
"General",
{
Type = ModConfigMenuOptionType.BOOLEAN, Type = ModConfigMenuOptionType.BOOLEAN,
CurrentSetting = function() CurrentSetting = function()
return EIDConfig["DisplayTrinketInfo"] return EIDConfig["DisplayTrinketInfo"]
@@ -134,11 +159,15 @@ if ModConfigMenu then
end, end,
OnChange = function(currentBool) OnChange = function(currentBool)
EIDConfig["DisplayTrinketInfo"] = currentBool EIDConfig["DisplayTrinketInfo"] = currentBool
end, end
}) }
)
------------CARDS-------------- ------------CARDS--------------
ModConfigMenu.AddSetting("EID","General", { ModConfigMenu.AddSetting(
"EID",
"General",
{
Type = ModConfigMenuOptionType.BOOLEAN, Type = ModConfigMenuOptionType.BOOLEAN,
CurrentSetting = function() CurrentSetting = function()
return EIDConfig["DisplayCardInfo"] return EIDConfig["DisplayCardInfo"]
@@ -152,11 +181,15 @@ if ModConfigMenu then
end, end,
OnChange = function(currentBool) OnChange = function(currentBool)
EIDConfig["DisplayCardInfo"] = currentBool EIDConfig["DisplayCardInfo"] = currentBool
end, end
}) }
)
------------PILLS-------------- ------------PILLS--------------
ModConfigMenu.AddSetting("EID","General", { ModConfigMenu.AddSetting(
"EID",
"General",
{
Type = ModConfigMenuOptionType.BOOLEAN, Type = ModConfigMenuOptionType.BOOLEAN,
CurrentSetting = function() CurrentSetting = function()
return EIDConfig["DisplayPillInfo"] return EIDConfig["DisplayPillInfo"]
@@ -170,16 +203,18 @@ if ModConfigMenu then
end, end,
OnChange = function(currentBool) OnChange = function(currentBool)
EIDConfig["DisplayPillInfo"] = currentBool EIDConfig["DisplayPillInfo"] = currentBool
end, end
}) }
)
ModConfigMenu.AddSpace("EID", "Rooms") ModConfigMenu.AddSpace("EID", "Rooms")
ModConfigMenu.AddText("EID", "Rooms", "Display Infos in Shops") ModConfigMenu.AddText("EID", "Rooms", "Display Infos in Shops")
------------CARDS-------------- ------------CARDS--------------
ModConfigMenu.AddSetting("EID","Rooms", { ModConfigMenu.AddSetting(
"EID",
"Rooms",
{
Type = ModConfigMenuOptionType.BOOLEAN, Type = ModConfigMenuOptionType.BOOLEAN,
CurrentSetting = function() CurrentSetting = function()
return EIDConfig["DisplayCardInfoShop"] return EIDConfig["DisplayCardInfoShop"]
@@ -193,11 +228,15 @@ if ModConfigMenu then
end, end,
OnChange = function(currentBool) OnChange = function(currentBool)
EIDConfig["DisplayCardInfoShop"] = currentBool EIDConfig["DisplayCardInfoShop"] = currentBool
end, end
}) }
)
------------PILLS-------------- ------------PILLS--------------
ModConfigMenu.AddSetting("EID","Rooms", { ModConfigMenu.AddSetting(
"EID",
"Rooms",
{
Type = ModConfigMenuOptionType.BOOLEAN, Type = ModConfigMenuOptionType.BOOLEAN,
CurrentSetting = function() CurrentSetting = function()
return EIDConfig["DisplayPillInfoShop"] return EIDConfig["DisplayPillInfoShop"]
@@ -211,17 +250,19 @@ if ModConfigMenu then
end, end,
OnChange = function(currentBool) OnChange = function(currentBool)
EIDConfig["DisplayPillInfoShop"] = currentBool EIDConfig["DisplayPillInfoShop"] = currentBool
end, end
}) }
)
-- SCALE -- SCALE
local textScales= {0.5,0.75,1,1.25,1.5,2} local textScales = {0.5, 0.75, 1, 1.25, 1.5, 2}
ModConfigMenu.AddSetting("EID", "Display", { ModConfigMenu.AddSetting(
"EID",
"Display",
{
Type = ModConfigMenuOptionType.NUMBER, Type = ModConfigMenuOptionType.NUMBER,
CurrentSetting = function() CurrentSetting = function()
return AnIndexOf(textScales,EIDConfig["Scale"]) return AnIndexOf(textScales, EIDConfig["Scale"])
end, end,
Minimum = 1, Minimum = 1,
Maximum = 6, Maximum = 6,
@@ -230,40 +271,53 @@ if ModConfigMenu then
end, end,
OnChange = function(currentNum) OnChange = function(currentNum)
EIDConfig["Scale"] = textScales[currentNum] EIDConfig["Scale"] = textScales[currentNum]
end
end, }
}) )
-- maxDistance -- maxDistance
local distances={1,1.5,2,3,4,5,6,7,8,9,10} local distances = {1, 1.5, 2, 3, 4, 5, 6, 7, 8, 9, 10}
ModConfigMenu.AddSetting("EID", "Display", { ModConfigMenu.AddSetting(
"EID",
"Display",
{
Type = ModConfigMenuOptionType.SCROLL, Type = ModConfigMenuOptionType.SCROLL,
CurrentSetting = function() CurrentSetting = function()
return AnIndexOf(distances,EIDConfig["MaxDistance"])-1 return AnIndexOf(distances, EIDConfig["MaxDistance"]) - 1
end, end,
Display = function() Display = function()
return "Display Distance: $scroll" .. AnIndexOf(distances,EIDConfig["MaxDistance"])-1 .." "..EIDConfig["MaxDistance"].." Grids" return "Display Distance: $scroll" ..
AnIndexOf(distances, EIDConfig["MaxDistance"]) - 1 .. " " .. EIDConfig["MaxDistance"] .. " Grids"
end, end,
OnChange = function(currentNum) OnChange = function(currentNum)
EIDConfig["MaxDistance"]= distances[currentNum+1] EIDConfig["MaxDistance"] = distances[currentNum + 1]
end end
}) }
)
-- Transparency -- Transparency
local transparencies={0.1,0.175,0.25,0.3,0.4,0.5,0.6,0.75,0.8,0.9,1} local transparencies = {0.1, 0.175, 0.25, 0.3, 0.4, 0.5, 0.6, 0.75, 0.8, 0.9, 1}
ModConfigMenu.AddSetting("EID", "Display", { ModConfigMenu.AddSetting(
"EID",
"Display",
{
Type = ModConfigMenuOptionType.SCROLL, Type = ModConfigMenuOptionType.SCROLL,
CurrentSetting = function() CurrentSetting = function()
return AnIndexOf(transparencies,EIDConfig["Transparency"])-1 return AnIndexOf(transparencies, EIDConfig["Transparency"]) - 1
end, end,
Display = function() Display = function()
return "Transparency: $scroll" .. AnIndexOf(transparencies,EIDConfig["Transparency"])-1 .." "..EIDConfig["Transparency"] return "Transparency: $scroll" ..
AnIndexOf(transparencies, EIDConfig["Transparency"]) - 1 .. " " .. EIDConfig["Transparency"]
end, end,
OnChange = function(currentNum) OnChange = function(currentNum)
EIDConfig["Transparency"]= transparencies[currentNum+1] EIDConfig["Transparency"] = transparencies[currentNum + 1]
end end
}) }
)
--------ShowItemName--------- --------ShowItemName---------
ModConfigMenu.AddSetting("EID","Display", { ModConfigMenu.AddSetting(
"EID",
"Display",
{
Type = ModConfigMenuOptionType.BOOLEAN, Type = ModConfigMenuOptionType.BOOLEAN,
CurrentSetting = function() CurrentSetting = function()
return EIDConfig["ShowItemName"] return EIDConfig["ShowItemName"]
@@ -277,10 +331,14 @@ if ModConfigMenu then
end, end,
OnChange = function(currentBool) OnChange = function(currentBool)
EIDConfig["ShowItemName"] = currentBool EIDConfig["ShowItemName"] = currentBool
end, end
}) }
)
--------ShowItemType--------- --------ShowItemType---------
ModConfigMenu.AddSetting("EID","Display", { ModConfigMenu.AddSetting(
"EID",
"Display",
{
Type = ModConfigMenuOptionType.BOOLEAN, Type = ModConfigMenuOptionType.BOOLEAN,
CurrentSetting = function() CurrentSetting = function()
return EIDConfig["ShowItemType"] return EIDConfig["ShowItemType"]
@@ -294,11 +352,15 @@ if ModConfigMenu then
end, end,
OnChange = function(currentBool) OnChange = function(currentBool)
EIDConfig["ShowItemType"] = currentBool EIDConfig["ShowItemType"] = currentBool
end, end
}) }
)
-------TRANSFORMATIONS--------- -------TRANSFORMATIONS---------
ModConfigMenu.AddSetting("EID","Display", { ModConfigMenu.AddSetting(
"EID",
"Display",
{
Type = ModConfigMenuOptionType.BOOLEAN, Type = ModConfigMenuOptionType.BOOLEAN,
CurrentSetting = function() CurrentSetting = function()
return EIDConfig["TransformationText"] return EIDConfig["TransformationText"]
@@ -312,9 +374,13 @@ if ModConfigMenu then
end, end,
OnChange = function(currentBool) OnChange = function(currentBool)
EIDConfig["TransformationText"] = currentBool EIDConfig["TransformationText"] = currentBool
end, end
}) }
ModConfigMenu.AddSetting("EID","Display", { )
ModConfigMenu.AddSetting(
"EID",
"Display",
{
Type = ModConfigMenuOptionType.BOOLEAN, Type = ModConfigMenuOptionType.BOOLEAN,
CurrentSetting = function() CurrentSetting = function()
return EIDConfig["TransformationIcons"] return EIDConfig["TransformationIcons"]
@@ -328,7 +394,7 @@ if ModConfigMenu then
end, end,
OnChange = function(currentBool) OnChange = function(currentBool)
EIDConfig["TransformationIcons"] = currentBool EIDConfig["TransformationIcons"] = currentBool
end, end
}) }
)
end end