diff --git a/eid_api.lua b/eid_api.lua index 4aa4bb3c..566da69e 100644 --- a/eid_api.lua +++ b/eid_api.lua @@ -23,28 +23,26 @@ end __eidItemDescriptions[item] = "Most Fitting Description"; --]] - -- Init variables for other mods to hand over Descriptions if they were not yet inited by another mod. if not __eidItemDescriptions then - __eidItemDescriptions = {}; + __eidItemDescriptions = {} end if not __eidTrinketDescriptions then - __eidTrinketDescriptions = {}; + __eidTrinketDescriptions = {} end if not __eidCardDescriptions then - __eidCardDescriptions = {}; + __eidCardDescriptions = {} end if not __eidPillDescriptions then - __eidPillDescriptions = {}; + __eidPillDescriptions = {} end if not __eidItemTransformations then - __eidItemTransformations = {}; + __eidItemTransformations = {} end if not __eidEntityDescriptions then - __eidEntityDescriptions = {}; + __eidEntityDescriptions = {} end - --------------------------------------------------------------------------- -------------------------Handle Custom Enum ----------------------------- @@ -65,7 +63,7 @@ EID.TRANSFORMATION = { ["BOOKWORM"] = 12, ["ADULT"] = 14, ["SPIDERBABY"] = 13, - ["SUPERBUM"] = 11, + ["SUPERBUM"] = 11 } --------------------------------------------------------------------------- @@ -78,7 +76,7 @@ end -- returns the current text position function EID:getTextPosition() - return Vector(EIDConfig["XPosition"],EIDConfig["YPosition"]) + return Vector(EIDConfig["XPosition"], EIDConfig["YPosition"]) end -- returns the entity that is currently described. returns last described entity if currently not displaying text @@ -87,14 +85,14 @@ function EID:getLastDescribedEntity() end function EID:getModDescription(list, id) - return (list) and (list[id]) + return (list) and (list[id]) end --Get the name of the given transformation by its ID function EID:getTransformation(id) - local str="Custom"; - if (tonumber(id) <= #transformations-1) then - return transformations[tonumber(id)+1] + local str = "Custom" + if (tonumber(id) <= #transformations - 1) then + return transformations[tonumber(id) + 1] end return str end @@ -103,13 +101,15 @@ end function EID:hasDescription(entity) local isAllowed = false 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 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_TAROTCARD and EIDConfig["DisplayCardInfo"]) 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 -- Replaces shorthand-representations of a character with the internal reference @@ -126,40 +126,80 @@ function EID:replaceMarkupStrings(text) end -- 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) - for i,v in ipairs(EID.bulletIcons) do - local iconPos = string.find(text,v) + for i, v in ipairs(EID.bulletIcons) do + local iconPos = string.find(text, v) if iconPos == 1 or iconPos == 2 then return v end end - return '\007' + return "\007" end --needs to be called in a render Callback -- args: string, Vector(int, int), Vector(float,float), KColor obj, bool 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 -- Get KColor object of "Entity Name" texts 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 -- Get KColor object of "Description" texts 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 -- Get KColor object of "Transformation" texts 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 -- Get KColor object of "Error" texts 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 - diff --git a/eid_config.lua b/eid_config.lua index e8161b36..9bd1eac6 100644 --- a/eid_config.lua +++ b/eid_config.lua @@ -1,19 +1,17 @@ -EIDConfig={ - +EIDConfig = { -------GENERAL--------- - - -- Change language of the mod. + + -- Change language of the mod. -- Currently Supported: English = "en_us" (Default) , "en_us_detailed" -- French = "fr" SPECIAL THANKS TO Nicolas Delvaux -- Polish = "pl" SPECIAL THANKS TO Rickyy - -- Spanish = "spa" SPECIAL THANKS TO Lidia Arroyo Purroy - -- Portuguese = "pt" SPECIAL THANKS TO Marcelino Cruz - -- Chinese (https://steamcommunity.com/sharedfiles/filedetails/?id=836319872) + -- Spanish = "spa" SPECIAL THANKS TO Lidia Arroyo Purroy + -- Portuguese = "pt" SPECIAL THANKS TO Marcelino Cruz + -- Chinese (https://steamcommunity.com/sharedfiles/filedetails/?id=836319872) -- Italian (https://steamcommunity.com/sharedfiles/filedetails/?id=931392691) -- Russian (https://steamcommunity.com/sharedfiles/filedetails/?id=1552851879) -- If you want to make a translation, please contact me :) ["Language"] = "en_us", - -- Change Width of the info boxes. (In characters) -- Default = 25 ["TextboxWidth"] = 25, @@ -32,25 +30,22 @@ EIDConfig={ -- Set the distance to an item in which informations will be displayed (in Tiles) -- Default = 5 ["MaxDistance"] = 5, - -- Choose between an indicator, that highlights the currently inspected object - -- Options: ["arrow","blink","border","highlight","none"]. + -- Choose between an indicator, that highlights the currently inspected object + -- Options: ["arrow","blink","border","highlight","none"]. -- 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" ["Indicator"] = "none", - -- Set the keybinding to toggle the descriptions -- look into the AB+ documentation for the key names - -- Default = Keyboard.KEY_F2 - ["HideKey"] = Keyboard.KEY_F2 , - + -- Default = Keyboard.KEY_F2 + ["HideKey"] = Keyboard.KEY_F2, -------------CURSE------------- - + -- Display informations when the floor has curse of the blind ( ? - Items) -- Default = true ["DisableOnCurse"] = true, - ----------ITEM NAMES----------- - + -- Toggle Display of Collectible / Card and Pill names -- Default = true ["ShowItemName"] = true, @@ -66,9 +61,8 @@ EIDConfig={ -- Set the RGB color of the Itemname text -- Default = {0.8, 0.3, 0.8} ["ItemNameColor"] = {0.8, 0.3, 0.8}, - -------TRANSFORMATIONS--------- - + -- Toggle Display of Transformation text -- Default = true ["TransformationText"] = true, @@ -77,19 +71,17 @@ EIDConfig={ ["TransformationIcons"] = true, -- Set the RGB color of the Transformation text -- Default = { 0.5, 0.5, 1} - ["TransformationColor"] = { 0.5, 0.5, 1}, - + ["TransformationColor"] = {0.5, 0.5, 1}, ------------CARDS-------------- - + -- Toggle Display of Card / Rune descriptions -- Default = true ["DisplayCardInfo"] = true, -- Toggle Display of Card / Rune descriptions when its a shop item -- Default = false ["DisplayCardInfoShop"] = false, - ------------PILLS-------------- - + -- Toggle Display of Pill descriptions -- Default = true ["DisplayPillInfo"] = true, @@ -97,41 +89,34 @@ EIDConfig={ -- Default = true ["DisplayPillInfoShop"] = true, -- Toggle Display of Pill descriptions that arent known to you yet - -- Default = false + -- Default = false ["ShowUnidentifiedPillDescriptions"] = false, - - --------Sacrifice Room--------- - + -- Toggle Display of next Sacrifice room Payout descriptions -- Default = true ["DisplaySacrificeInfo"] = true, - - --------Dice Room--------- - + -- Toggle Display of Diceroom descriptions -- Default = true ["DisplayDiceInfo"] = true, - - -------------MISC--------------- - + -- Error message displayed when an error occurs -- Default = [Effect not defined] ["ErrorMessage"] = "[Effect not defined]", -- Set the RGB color of the default description text -- Default = { 1, 1, 1} - ["TextColor"] = {1,1,1}, + ["TextColor"] = {1, 1, 1}, -- Set the RGB color of the Error text -- Default = { 1, 0, 0} - ["ErrorColor"] = {1,0.4,0.4}, + ["ErrorColor"] = {1, 0.4, 0.4}, -- Enables or disables custom Descriptions for entities -- Default = true ["EnableEntityDescriptions"] = true - - } +} --END CONFIG-- ----------- ------------ \ No newline at end of file +----------- diff --git a/eid_debugging.lua b/eid_debugging.lua index 7fd0882e..f6a96cd3 100644 --- a/eid_debugging.lua +++ b/eid_debugging.lua @@ -1,21 +1,23 @@ local charsToDebug = { -EID:replaceMarkupStrings("!!! EID DEBUG MODE ACTIVATED !!!"), -- Header -"ABCDEFGHIJKLMNOPQRSTUVWXYZ", -- Caps letters -"abcdefghijklmnopqrstuvwxyz1234567890", -- small letters + numbers -"western: Áá Àà Ââ Āā Ää Ãã Åå Ææ Éé Èè Êê Ēē Ëë Íí Ìì Îî Īī Ïï ", -- -"western 2: Óó Òò Ôô Ōō Öö Õõ Øø Œœ Úú Ùù Ûû Ūū Üü Ŵŵ Ýý Ÿÿ Ŷ", -- -"western 3: Þþ Çç Ðð Ññ ß ¿¡", -- -"cyrillic 1: Аа Бб Вв Гг Дд Ее Ёё Жж Зз Ии Йй Кк Лл Мм Нн Оо", -"cyrillic 2: Пп Рр Сс Тт Уу Фф Хх Цц Чч Шш Щщ Ъъ Ыы Ьь Ээ Юю Яя", -"polish: Ąą Ćć Ęę Łł Ńń Óó Śś Źź Żż", -"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"), -"emotes: ☆★〠♠♣♥♦♤♧♡♢☀☂♨♪♭♯♂♀", + EID:replaceMarkupStrings("!!! EID DEBUG MODE ACTIVATED !!!"), -- Header + "ABCDEFGHIJKLMNOPQRSTUVWXYZ", -- Caps letters + "abcdefghijklmnopqrstuvwxyz1234567890", -- small letters + numbers + "western: Áá Àà Ââ Āā Ää Ãã Åå Ææ Éé Èè Êê Ēē Ëë Íí Ìì Îî Īī Ïï ", -- + "western 2: Óó Òò Ôô Ōō Öö Õõ Øø Œœ Úú Ùù Ûû Ūū Üü Ŵŵ Ýý Ÿÿ Ŷ", -- + "western 3: Þþ Çç Ðð Ññ ß ¿¡", -- + "cyrillic 1: Аа Бб Вв Гг Дд Ее Ёё Жж Зз Ии Йй Кк Лл Мм Нн Оо", + "cyrillic 2: Пп Рр Сс Тт Уу Фф Хх Цц Чч Шш Щщ Ъъ Ыы Ьь Ээ Юю Яя", + "polish: Ąą Ćć Ęę Łł Ńń Óó Śś Źź Żż", + "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" + ), + "emotes: ☆★〠♠♣♥♦♤♧♡♢☀☂♨♪♭♯♂♀" } local function onDebugRender(t) - 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) + 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) end end -EID:AddCallback(ModCallbacks.MC_POST_RENDER, onDebugRender) \ No newline at end of file +EID:AddCallback(ModCallbacks.MC_POST_RENDER, onDebugRender) diff --git a/main.lua b/main.lua index 7587532f..9f360f83 100644 --- a/main.lua +++ b/main.lua @@ -1,25 +1,25 @@ -EID = RegisterMod( "External Item Descriptions" ,1 ); +EID = RegisterMod("External Item Descriptions", 1) local itemConfig = Isaac.GetItemConfig() local lineHeight = 11 -local isDisplayingText= false -local lastDescriptionEntity= nil -local hideDescToggle= false -EID.sacrificeCounter= 1 +local isDisplayingText = false +local lastDescriptionEntity = nil +local hideDescToggle = false +EID.sacrificeCounter = 1 local IconSprite = Sprite() IconSprite:Load("gfx/icons.anm2", true) local ArrowSprite = Sprite() ArrowSprite:Load("gfx/icons.anm2", true) -ArrowSprite:Play("Arrow",false) +ArrowSprite:Play("Arrow", false) local CardSprite = Sprite() CardSprite:Load("gfx/cardfronts.anm2", true) require("eid_config") require("mod_config_menu") -require("descriptions.ab+."..EIDConfig["Language"]) +require("descriptions.ab+." .. EIDConfig["Language"]) require("eid_api") --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 _, modPathStart = string.find(err, "no file '", basePathStart) 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, ":/", ":\\") - 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) 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 --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 end - --------------------------------------------------------------------------- -------------------------Handle Sacrifice Room----------------------------- if EIDConfig["DisplaySacrificeInfo"] then + function onNewFloor() + EID.sacrificeCounter = 1 + end + EID:AddCallback(ModCallbacks.MC_POST_NEW_LEVEL, onNewFloor) - function onNewFloor() - EID.sacrificeCounter= 1 - end - EID:AddCallback(ModCallbacks.MC_POST_NEW_LEVEL, onNewFloor) - - function onDamage(_,entity,_,flag,source) - if Game():GetRoom():GetType() == RoomType.ROOM_SACRIFICE and source.Type == 0 and flag == DamageFlag.DAMAGE_SPIKES then - if EID.sacrificeCounter<12 then - EID.sacrificeCounter= EID.sacrificeCounter+1 - end - end - end - EID:AddCallback(ModCallbacks.MC_ENTITY_TAKE_DMG, onDamage,EntityType.ENTITY_PLAYER) - + function onDamage(_, entity, _, flag, source) + if Game():GetRoom():GetType() == RoomType.ROOM_SACRIFICE and source.Type == 0 and flag == DamageFlag.DAMAGE_SPIKES then + if EID.sacrificeCounter < 12 then + EID.sacrificeCounter = EID.sacrificeCounter + 1 + end + end + end + EID:AddCallback(ModCallbacks.MC_ENTITY_TAKE_DMG, onDamage, EntityType.ENTITY_PLAYER) end --------------------------------------------------------------------------- ---------------------------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 function posY() return modifiedPosY ~= false and modifiedPosY or EIDConfig["YPosition"] @@ -77,97 +73,132 @@ function printDescription(desc) local Description = desc[3] local padding = posY() local itemType = itemConfig:GetCollectible(desc[1]).Type - + --Display ItemType / Charge - if EIDConfig["ShowItemType"] and (itemType ==3 or itemType== 4) then - local offsetY = 2*EIDConfig["Scale"] - if EIDConfig["Scale"]<1 then - offsetY =-1 + if EIDConfig["ShowItemType"] and (itemType == 3 or itemType == 4) then + local offsetY = 2 * EIDConfig["Scale"] + if EIDConfig["Scale"] < 1 then + offsetY = -1 end IconSprite:Play(itemTypes[itemType]) - IconSprite.Scale = Vector(EIDConfig["Scale"],EIDConfig["Scale"]) + IconSprite.Scale = Vector(EIDConfig["Scale"], EIDConfig["Scale"]) IconSprite:Update() - IconSprite:Render(Vector(EIDConfig["XPosition"]-3*EIDConfig["Scale"],padding+offsetY), Vector(0,0), Vector(0,0)) - if itemType ==3 then -- Display Charge + IconSprite:Render( + 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: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 if not EIDConfig["ShowItemName"] then - padding = padding+lineHeight*EIDConfig["Scale"] + padding = padding + lineHeight * EIDConfig["Scale"] end end --Display Itemname if EIDConfig["ShowItemName"] then local offset = 0 - if EIDConfig["ShowItemType"]then if itemType==3 then offset = 9 else offset = 6 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 - if not(desc[2]=="0" or desc[2]=="" or desc[2]==nil ) then - if EIDConfig["TransformationText"] then - local transformationText= "" - if not(EID:getTransformation(desc[2])=="Custom") then - transformationText =EID:getTransformation(desc[2]) - elseif not(transformations[desc[2]]) then --Custom transformationname - transformationText=desc[2] + if EIDConfig["ShowItemType"] then + if itemType == 3 then + offset = 9 else - transformationText=EID:getTransformation(desc[2]) + offset = 6 end - EID:renderString(transformationText, Vector(EIDConfig["XPosition"]+16*EIDConfig["Scale"], padding-1), Vector(EIDConfig["Scale"],EIDConfig["Scale"]), EID:getTransformationColor(), false) end - if EIDConfig["TransformationIcons"] and not(EID:getTransformation(desc[2])=="Custom") then - IconSprite:Play("Transformation"..desc[2]) - IconSprite.Scale = Vector(EIDConfig["Scale"],EIDConfig["Scale"]) + 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 + if not (desc[2] == "0" or desc[2] == "" or desc[2] == nil) then + if EIDConfig["TransformationText"] then + local transformationText = "" + if not (EID:getTransformation(desc[2]) == "Custom") then + transformationText = EID:getTransformation(desc[2]) + elseif not (transformations[desc[2]]) then --Custom transformationname + transformationText = desc[2] + else + transformationText = EID:getTransformation(desc[2]) + end + EID:renderString( + transformationText, + Vector(EIDConfig["XPosition"] + 16 * EIDConfig["Scale"], padding - 1), + Vector(EIDConfig["Scale"], EIDConfig["Scale"]), + EID:getTransformationColor(), + false + ) + end + if EIDConfig["TransformationIcons"] and not (EID:getTransformation(desc[2]) == "Custom") then + IconSprite:Play("Transformation" .. desc[2]) + IconSprite.Scale = Vector(EIDConfig["Scale"], EIDConfig["Scale"]) 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 - if(EIDConfig["TransformationIcons"] or EIDConfig["TransformationText"] ) then - padding = padding+lineHeight*EIDConfig["Scale"] + if (EIDConfig["TransformationIcons"] or EIDConfig["TransformationText"]) then + padding = padding + lineHeight * EIDConfig["Scale"] end end - printBulletPoints(Description,padding) + printBulletPoints(Description, padding) end -function printTrinketDescription(desc,typ) +function printTrinketDescription(desc, typ) local Description = desc[2] local padding = posY() --Display Itemname if EIDConfig["ShowItemName"] then - local name= "" - if typ=="trinket" then - name= itemConfig:GetTrinket(desc[1]).Name - elseif typ=="card" then - name= itemConfig:GetCard(desc[1]).Name - elseif typ=="pill" then - name= itemConfig:GetPillEffect(desc[1]).Name - elseif typ=="sacrifice" then - name= sacrificeDescriptionHeader - elseif typ=="dice" then - name= diceDescriptionHeader - elseif typ=="custom" then - name= desc[2][1] - Description= desc[2][2] + local name = "" + if typ == "trinket" then + name = itemConfig:GetTrinket(desc[1]).Name + elseif typ == "card" then + name = itemConfig:GetCard(desc[1]).Name + elseif typ == "pill" then + name = itemConfig:GetPillEffect(desc[1]).Name + elseif typ == "sacrifice" then + name = sacrificeDescriptionHeader + elseif typ == "dice" then + name = diceDescriptionHeader + elseif typ == "custom" then + name = desc[2][1] + Description = desc[2][2] end - EID:renderString(name, Vector(EIDConfig["XPosition"],padding), Vector(EIDConfig["Scale"],EIDConfig["Scale"]), EID:getNameColor(), false) - - padding = padding+lineHeight*EIDConfig["Scale"] + EID:renderString( + name, + Vector(EIDConfig["XPosition"], padding), + Vector(EIDConfig["Scale"], EIDConfig["Scale"]), + EID:getNameColor(), + false + ) + + padding = padding + lineHeight * EIDConfig["Scale"] end - printBulletPoints(Description,padding) + printBulletPoints(Description, padding) end function printBulletPoints(description, padding) - local textboxWidth=tonumber(EIDConfig["TextboxWidth"]) - for line in string.gmatch(description, '([^#]+)') do - local array={} + local textboxWidth = tonumber(EIDConfig["TextboxWidth"]) + for line in string.gmatch(description, "([^#]+)") do + local array = {} local text = "" - for word in string.gmatch(line, '([^ ]+)') do - if string.len(text)+string.len(word)<=textboxWidth then - text = text.." "..word + for word in string.gmatch(line, "([^ ]+)") do + if string.len(text) + string.len(word) <= textboxWidth then + text = text .. " " .. word else table.insert(array, text) text = word @@ -180,213 +211,278 @@ function printBulletPoints(description, padding) local bpIcon = " " -- no bulletpoint if i == 1 then bpIcon = EID:getBulletpointIcon(v) - if string.find(bpIcon,'\007') == nil then + if string.find(bpIcon, "\007") == nil then v = string.sub(v, 3 + #bpIcon) posX = posX - 2 -- Move a bit to the left, to center icons end end - EID:renderString(bpIcon..EID:replaceMarkupStrings(v), Vector(posX, padding), Vector(EIDConfig["Scale"],EIDConfig["Scale"]), textColor, false) - padding = padding +lineHeight*EIDConfig["Scale"] + EID:renderString( + bpIcon .. EID:replaceMarkupStrings(v), + Vector(posX, padding), + Vector(EIDConfig["Scale"], EIDConfig["Scale"]), + textColor, + false + ) + padding = padding + lineHeight * EIDConfig["Scale"] end end 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 + 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.Scale = Vector(EIDConfig["Scale"],EIDConfig["Scale"]) + IconSprite.Scale = Vector(EIDConfig["Scale"], EIDConfig["Scale"]) IconSprite:Update() - IconSprite:Render(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 + IconSprite:Render( + 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 function renderIndicator(entity) if EIDConfig["Indicator"] == "blink" then - 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:Render(Vector(0,0)) - entity:SetColor(Color(1,1,1,1,0,0,0),2,1,false,false) - + 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:Render(Vector(0, 0)) + entity:SetColor(Color(1, 1, 1, 1, 0, 0, 0), 2, 1, false, false) elseif EIDConfig["Indicator"] == "border" then - 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:Render(Vector(0,1)) - entity:Render(Vector(0,-1)) - 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:Render(Vector(0,0)) - + 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:Render(Vector(0, 1)) + entity:Render(Vector(0, -1)) + 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:Render(Vector(0, 0)) elseif EIDConfig["Indicator"] == "highlight" then - 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(1,0)) - entity:Render(Vector(-1,0)) - entity:SetColor(Color(1,1,1,1,0,0,0),2,1,false,false) - entity:Render(Vector(0,0)) - + 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(1, 0)) + entity:Render(Vector(-1, 0)) + entity:SetColor(Color(1, 1, 1, 1, 0, 0, 0), 2, 1, false, false) + entity:Render(Vector(0, 0)) elseif EIDConfig["Indicator"] == "arrow" then ArrowSprite:Update() - local ArrowOffset = Vector(0,-35) - if entity.Variant ==100 and not entity:ToPickup():IsShopItem() then ArrowOffset = Vector(0,-62) end - ArrowSprite:Render(Game():GetRoom():WorldToScreenPosition(entity.Position+ArrowOffset), Vector(0,0), Vector(0,0)) + local ArrowOffset = Vector(0, -35) + if entity.Variant == 100 and not entity:ToPickup():IsShopItem() then + ArrowOffset = Vector(0, -62) + end + ArrowSprite:Render(Game():GetRoom():WorldToScreenPosition(entity.Position + ArrowOffset), Vector(0, 0), Vector(0, 0)) end end - --------------------------------------------------------------------------- ---------------------------On Render Function------------------------------ local function onRender(t) - isDisplayingText= false + isDisplayingText = false local player = Isaac.GetPlayer(0) local closest = nil local closestDice = nil local dist = 10000 if Input.IsButtonTriggered(EIDConfig["HideKey"], 0) then - hideDescToggle = not hideDescToggle; + hideDescToggle = not hideDescToggle end - if hideDescToggle then return end - + if hideDescToggle then + return + end + 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 - local diff = entity.Position:__sub(player.Position); + local diff = entity.Position:__sub(player.Position) if diff:Length() < dist then - closest = entity; - dist = diff:Length(); - end + closest = entity + dist = diff:Length() + end end - end - - - 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 - printTrinketDescription(sacrificeDescriptions[EID.sacrificeCounter],"sacrifice") + end + + 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 + printTrinketDescription(sacrificeDescriptions[EID.sacrificeCounter], "sacrifice") end - if Game():GetRoom():GetType()==RoomType.ROOM_DICE and EIDConfig["DisplayDiceInfo"] and type(closestDice) ~= type(nil) then - printTrinketDescription(diceDescriptions[closestDice.SubType+1],"dice") + if + Game():GetRoom():GetType() == RoomType.ROOM_DICE and EIDConfig["DisplayDiceInfo"] and type(closestDice) ~= type(nil) + then + printTrinketDescription(diceDescriptions[closestDice.SubType + 1], "dice") renderIndicator(closestDice) end return end - - if closest==nil then return end + + if closest == nil then + return + end lastDescriptionEntity = closest - isDisplayingText= true - + isDisplayingText = true + --Handle Indicators renderIndicator(closest) - + --Handle Entities (specific) 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 end - + --Handle Entities (omni) - if 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") + if + 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 end - - + --Handle Trinkets if closest.Variant == PickupVariant.PICKUP_TRINKET then + --Handle Collectibles 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") + 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}) + printTrinketDescription({closest.SubType, itemConfig:GetTrinket(closest.SubType).Description}) end - --Handle Collectibles elseif closest.Variant == PickupVariant.PICKUP_COLLECTIBLE then - if HasCurseBlind() and EIDConfig["DisableOnCurse"] then renderQuestionMark() return end - if EID:getModDescription(__eidItemDescriptions,closest.SubType) 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)}) + 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 - if EID:getModDescription(__eidItemTransformations,closest.SubType) then - printDescription({closest.SubType,EID:getModDescription(__eidItemTransformations,closest.SubType),descriptarray[closest.SubType][3]}) - else + if EID:getModDescription(__eidItemTransformations, closest.SubType) then + printDescription( + { + closest.SubType, + EID:getModDescription(__eidItemTransformations, closest.SubType), + descriptarray[closest.SubType][3] + } + ) + else printDescription(descriptarray[closest.SubType]) end else - printDescription({closest.SubType,"",itemConfig:GetCollectible(closest.SubType).Description}) + printDescription({closest.SubType, "", itemConfig:GetCollectible(closest.SubType).Description}) end - --Handle Cards & Runes - elseif closest.Variant == PickupVariant.PICKUP_TAROTCARD then - if closest:ToPickup():IsShopItem() and not EIDConfig["DisplayCardInfoShop"] then renderQuestionMark() return end - if EID:getModDescription(__eidCardDescriptions,closest.SubType) then - printTrinketDescription({closest.SubType,EID:getModDescription(__eidCardDescriptions,closest.SubType)},"card") - elseif closest.SubType <= 54 then - printTrinketDescription(cardDescriptions[closest.SubType],"card") + elseif closest.Variant == PickupVariant.PICKUP_TAROTCARD then + --Handle Pills + if closest:ToPickup():IsShopItem() and not EIDConfig["DisplayCardInfoShop"] then + renderQuestionMark() + return + end + if EID:getModDescription(__eidCardDescriptions, closest.SubType) then + printTrinketDescription({closest.SubType, EID:getModDescription(__eidCardDescriptions, closest.SubType)}, "card") + elseif closest.SubType <= 54 then + printTrinketDescription(cardDescriptions[closest.SubType], "card") CardSprite:Play(tostring(closest.SubType)) - CardSprite.Scale = Vector(EIDConfig["Scale"],EIDConfig["Scale"]) + CardSprite.Scale = Vector(EIDConfig["Scale"], EIDConfig["Scale"]) CardSprite:Update() local offsetX = 0 - if EIDConfig["ShowItemName"] then offsetX = 10 end - CardSprite:Render(Vector(EIDConfig["XPosition"]-9*EIDConfig["Scale"],posY()+(12+offsetX)*EIDConfig["Scale"]), Vector(0,0), Vector(0,0)) + if EIDConfig["ShowItemName"] then + offsetX = 10 + end + CardSprite:Render( + Vector(EIDConfig["XPosition"] - 9 * EIDConfig["Scale"], posY() + (12 + offsetX) * EIDConfig["Scale"]), + Vector(0, 0), + Vector(0, 0) + ) else - printTrinketDescription({closest.SubType,itemConfig:GetCard(closest.SubType).Description}) + printTrinketDescription({closest.SubType, itemConfig:GetCard(closest.SubType).Description}) end - --Handle Pills - elseif closest.Variant == PickupVariant.PICKUP_PILL then - if closest:ToPickup():IsShopItem() and not EIDConfig["DisplayPillInfoShop"] then renderQuestionMark() return end - + elseif closest.Variant == PickupVariant.PICKUP_PILL then + if closest:ToPickup():IsShopItem() and not EIDConfig["DisplayPillInfoShop"] then + renderQuestionMark() + return + end + local pillColor = closest.SubType local pool = Game():GetItemPool() local pillEffect = pool:GetPillEffect(pillColor) local identified = pool:IsPillIdentified(pillColor) if (identified or EIDConfig["ShowUnidentifiedPillDescriptions"]) then - if EID:getModDescription(__eidPillDescriptions,pillEffect) then - printTrinketDescription({pillEffect,EID:getModDescription(__eidPillDescriptions,pillEffect)},"pill") - elseif pillEffect < 47 then - printTrinketDescription(pillDescriptions[pillEffect+1],"pill") - else - EID:renderString(EIDConfig["ErrorMessage"], Vector(EIDConfig["XPosition"], posY()), Vector(EIDConfig["Scale"],EIDConfig["Scale"]), EID:getErrorColor(), false) + if EID:getModDescription(__eidPillDescriptions, pillEffect) then + printTrinketDescription({pillEffect, EID:getModDescription(__eidPillDescriptions, pillEffect)}, "pill") + elseif pillEffect < 47 then + printTrinketDescription(pillDescriptions[pillEffect + 1], "pill") + else + EID:renderString( + EIDConfig["ErrorMessage"], + Vector(EIDConfig["XPosition"], posY()), + Vector(EIDConfig["Scale"], EIDConfig["Scale"]), + EID:getErrorColor(), + false + ) end 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 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() local offsetX = 0 - if EIDConfig["ShowItemName"] and (identified or EIDConfig["ShowUnidentifiedPillDescriptions"]) then offsetX = 10 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 + if EIDConfig["ShowItemName"] and (identified or EIDConfig["ShowUnidentifiedPillDescriptions"]) then + offsetX = 10 + 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 EID:AddCallback(ModCallbacks.MC_POST_RENDER, onRender) - - - if ModConfigMenu then -local json = require("json") + local json = require("json") -------------------------------- --------Handle Savadata--------- -------------------------------- @@ -398,7 +494,9 @@ local json = require("json") savedEIDConfig["Language"] = EIDConfig["Language"] -- Only copy Saved config entries that exist in the save 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 @@ -411,4 +509,4 @@ local json = require("json") EID:AddCallback(ModCallbacks.MC_PRE_GAME_EXIT, SaveGame) end ---require("eid_debugging") \ No newline at end of file +--require("eid_debugging") diff --git a/mod_config_menu.lua b/mod_config_menu.lua index 1b148603..c36cd558 100644 --- a/mod_config_menu.lua +++ b/mod_config_menu.lua @@ -1,334 +1,400 @@ if ModConfigMenu then - - function AnIndexOf(t,val) - for k,v in ipairs(t) do - if v == val then return k end + function AnIndexOf(t, val) + for k, v in ipairs(t) do + if v == val then + return k + end end return 1 end - ModConfigMenu.AddText("EID", "General", "Change Language in the Config file.") ModConfigMenu.AddSpace("EID", "General") -- Disable on Curse - ModConfigMenu.AddSetting("EID","General", { - Type = ModConfigMenuOptionType.BOOLEAN, - CurrentSetting = function() - return EIDConfig["DisableOnCurse"] - end, - Display = function() - local onOff = "True" - if EIDConfig["DisableOnCurse"] then - onOff = "False" + ModConfigMenu.AddSetting( + "EID", + "General", + { + Type = ModConfigMenuOptionType.BOOLEAN, + CurrentSetting = function() + return EIDConfig["DisableOnCurse"] + end, + Display = function() + local onOff = "True" + if EIDConfig["DisableOnCurse"] then + onOff = "False" + end + return 'Show on "Curse of Blind": ' .. onOff + end, + OnChange = function(currentBool) + EIDConfig["DisableOnCurse"] = currentBool end - return "Show on \"Curse of Blind\": " .. onOff - end, - OnChange = function(currentBool) - EIDConfig["DisableOnCurse"] = currentBool - end, - }) + } + ) --indicator - local indicators= {"arrow","blink","border","highlight","none"} - ModConfigMenu.AddSetting("EID", "General", { - Type = ModConfigMenuOptionType.NUMBER, - CurrentSetting = function() - return AnIndexOf(indicators,EIDConfig["Indicator"]) - end, - Minimum = 1, - Maximum = 5, - Display = function() - return "Indicator: " .. EIDConfig["Indicator"] - end, - OnChange = function(currentNum) - EIDConfig["Indicator"] = indicators[currentNum] - - end, - }) + local indicators = {"arrow", "blink", "border", "highlight", "none"} + ModConfigMenu.AddSetting( + "EID", + "General", + { + Type = ModConfigMenuOptionType.NUMBER, + CurrentSetting = function() + return AnIndexOf(indicators, EIDConfig["Indicator"]) + end, + Minimum = 1, + Maximum = 5, + Display = function() + return "Indicator: " .. EIDConfig["Indicator"] + end, + OnChange = function(currentNum) + EIDConfig["Indicator"] = indicators[currentNum] + end + } + ) - --------ShowUnidentifiedPillDescriptions--------- - ModConfigMenu.AddSetting("EID","General", { - Type = ModConfigMenuOptionType.BOOLEAN, - CurrentSetting = function() - return EIDConfig["ShowUnidentifiedPillDescriptions"] - end, - Display = function() - local onOff = "False" - if EIDConfig["ShowUnidentifiedPillDescriptions"] then - onOff = "True" + --------ShowUnidentifiedPillDescriptions--------- + ModConfigMenu.AddSetting( + "EID", + "General", + { + Type = ModConfigMenuOptionType.BOOLEAN, + CurrentSetting = function() + return EIDConfig["ShowUnidentifiedPillDescriptions"] + end, + Display = function() + local onOff = "False" + if EIDConfig["ShowUnidentifiedPillDescriptions"] then + onOff = "True" + end + return "Show Unidentified Pilleffects: " .. onOff + end, + OnChange = function(currentBool) + EIDConfig["ShowUnidentifiedPillDescriptions"] = currentBool end - return "Show Unidentified Pilleffects: " .. onOff - end, - OnChange = function(currentBool) - EIDConfig["ShowUnidentifiedPillDescriptions"] = currentBool - end, - }) - --------Sacrifice Room--------- - ModConfigMenu.AddSetting("EID","Rooms", { - Type = ModConfigMenuOptionType.BOOLEAN, - CurrentSetting = function() - return EIDConfig["DisplaySacrificeInfo"] - end, - Display = function() - local onOff = "False" - if EIDConfig["DisplaySacrificeInfo"] then - onOff = "True" + } + ) + --------Sacrifice Room--------- + ModConfigMenu.AddSetting( + "EID", + "Rooms", + { + Type = ModConfigMenuOptionType.BOOLEAN, + CurrentSetting = function() + return EIDConfig["DisplaySacrificeInfo"] + end, + Display = function() + local onOff = "False" + if EIDConfig["DisplaySacrificeInfo"] then + onOff = "True" + end + return "Sacrifice Room Infos: " .. onOff + end, + OnChange = function(currentBool) + EIDConfig["DisplaySacrificeInfo"] = currentBool end - return "Sacrifice Room Infos: " .. onOff - end, - OnChange = function(currentBool) - EIDConfig["DisplaySacrificeInfo"] = currentBool - end, - }) + } + ) - --------Dice Room--------- - ModConfigMenu.AddSetting("EID","Rooms", { - Type = ModConfigMenuOptionType.BOOLEAN, - CurrentSetting = function() - return EIDConfig["DisplayDiceInfo"] - end, - Display = function() - local onOff = "False" - if EIDConfig["DisplayDiceInfo"] then - onOff = "True" + --------Dice Room--------- + ModConfigMenu.AddSetting( + "EID", + "Rooms", + { + Type = ModConfigMenuOptionType.BOOLEAN, + CurrentSetting = function() + return EIDConfig["DisplayDiceInfo"] + end, + Display = function() + local onOff = "False" + if EIDConfig["DisplayDiceInfo"] then + onOff = "True" + end + return "Dice Room Infos: " .. onOff + end, + OnChange = function(currentBool) + EIDConfig["DisplayDiceInfo"] = currentBool end - return "Dice Room Infos: " .. onOff - end, - OnChange = function(currentBool) - EIDConfig["DisplayDiceInfo"] = currentBool - end, - }) + } + ) - - ------------Collectibles-------------- - - ModConfigMenu.AddSetting("EID","General", { - Type = ModConfigMenuOptionType.BOOLEAN, - CurrentSetting = function() - return EIDConfig["DisplayItemInfo"] - end, - Display = function() - local onOff = "False" - if EIDConfig["DisplayItemInfo"] then - onOff = "True" - end - return "Collectible Infos: " .. onOff - end, - OnChange = function(currentBool) - EIDConfig["DisplayItemInfo"] = currentBool - end, - }) - ------------Trinkets-------------- - - ModConfigMenu.AddSetting("EID","General", { - Type = ModConfigMenuOptionType.BOOLEAN, - CurrentSetting = function() - return EIDConfig["DisplayTrinketInfo"] - end, - Display = function() - local onOff = "False" - if EIDConfig["DisplayTrinketInfo"] then - onOff = "True" - end - return "Trinket Infos: " .. onOff - end, - OnChange = function(currentBool) - EIDConfig["DisplayTrinketInfo"] = currentBool - end, - }) - ------------CARDS-------------- - - ModConfigMenu.AddSetting("EID","General", { - Type = ModConfigMenuOptionType.BOOLEAN, - CurrentSetting = function() - return EIDConfig["DisplayCardInfo"] - end, - Display = function() - local onOff = "False" - if EIDConfig["DisplayCardInfo"] then - onOff = "True" - end - return "Card Infos: " .. onOff - end, - OnChange = function(currentBool) - EIDConfig["DisplayCardInfo"] = currentBool - end, - }) + ------------Collectibles-------------- - ------------PILLS-------------- - ModConfigMenu.AddSetting("EID","General", { - Type = ModConfigMenuOptionType.BOOLEAN, - CurrentSetting = function() - return EIDConfig["DisplayPillInfo"] - end, - Display = function() - local onOff = "False" - if EIDConfig["DisplayPillInfo"] then - onOff = "True" + ModConfigMenu.AddSetting( + "EID", + "General", + { + Type = ModConfigMenuOptionType.BOOLEAN, + CurrentSetting = function() + return EIDConfig["DisplayItemInfo"] + end, + Display = function() + local onOff = "False" + if EIDConfig["DisplayItemInfo"] then + onOff = "True" + end + return "Collectible Infos: " .. onOff + end, + OnChange = function(currentBool) + EIDConfig["DisplayItemInfo"] = currentBool end - return "Pill Infos: " .. onOff - end, - OnChange = function(currentBool) - EIDConfig["DisplayPillInfo"] = currentBool - end, - }) - - - + } + ) + ------------Trinkets-------------- + + ModConfigMenu.AddSetting( + "EID", + "General", + { + Type = ModConfigMenuOptionType.BOOLEAN, + CurrentSetting = function() + return EIDConfig["DisplayTrinketInfo"] + end, + Display = function() + local onOff = "False" + if EIDConfig["DisplayTrinketInfo"] then + onOff = "True" + end + return "Trinket Infos: " .. onOff + end, + OnChange = function(currentBool) + EIDConfig["DisplayTrinketInfo"] = currentBool + end + } + ) + ------------CARDS-------------- + + ModConfigMenu.AddSetting( + "EID", + "General", + { + Type = ModConfigMenuOptionType.BOOLEAN, + CurrentSetting = function() + return EIDConfig["DisplayCardInfo"] + end, + Display = function() + local onOff = "False" + if EIDConfig["DisplayCardInfo"] then + onOff = "True" + end + return "Card Infos: " .. onOff + end, + OnChange = function(currentBool) + EIDConfig["DisplayCardInfo"] = currentBool + end + } + ) + + ------------PILLS-------------- + ModConfigMenu.AddSetting( + "EID", + "General", + { + Type = ModConfigMenuOptionType.BOOLEAN, + CurrentSetting = function() + return EIDConfig["DisplayPillInfo"] + end, + Display = function() + local onOff = "False" + if EIDConfig["DisplayPillInfo"] then + onOff = "True" + end + return "Pill Infos: " .. onOff + end, + OnChange = function(currentBool) + EIDConfig["DisplayPillInfo"] = currentBool + end + } + ) + ModConfigMenu.AddSpace("EID", "Rooms") ModConfigMenu.AddText("EID", "Rooms", "Display Infos in Shops") - ------------CARDS-------------- - - ModConfigMenu.AddSetting("EID","Rooms", { - Type = ModConfigMenuOptionType.BOOLEAN, - CurrentSetting = function() - return EIDConfig["DisplayCardInfoShop"] - end, - Display = function() - local onOff = "False" - if EIDConfig["DisplayCardInfoShop"] then - onOff = "True" - end - return "Card Infos: " .. onOff - end, - OnChange = function(currentBool) - EIDConfig["DisplayCardInfoShop"] = currentBool - end, - }) + ------------CARDS-------------- - ------------PILLS-------------- - ModConfigMenu.AddSetting("EID","Rooms", { - Type = ModConfigMenuOptionType.BOOLEAN, - CurrentSetting = function() - return EIDConfig["DisplayPillInfoShop"] - end, - Display = function() - local onOff = "False" - if EIDConfig["DisplayPillInfoShop"] then - onOff = "True" + ModConfigMenu.AddSetting( + "EID", + "Rooms", + { + Type = ModConfigMenuOptionType.BOOLEAN, + CurrentSetting = function() + return EIDConfig["DisplayCardInfoShop"] + end, + Display = function() + local onOff = "False" + if EIDConfig["DisplayCardInfoShop"] then + onOff = "True" + end + return "Card Infos: " .. onOff + end, + OnChange = function(currentBool) + EIDConfig["DisplayCardInfoShop"] = currentBool end - return "Pill Infos: " .. onOff - end, - OnChange = function(currentBool) - EIDConfig["DisplayPillInfoShop"] = currentBool - end, - }) - - - + } + ) + + ------------PILLS-------------- + ModConfigMenu.AddSetting( + "EID", + "Rooms", + { + Type = ModConfigMenuOptionType.BOOLEAN, + CurrentSetting = function() + return EIDConfig["DisplayPillInfoShop"] + end, + Display = function() + local onOff = "False" + if EIDConfig["DisplayPillInfoShop"] then + onOff = "True" + end + return "Pill Infos: " .. onOff + end, + OnChange = function(currentBool) + EIDConfig["DisplayPillInfoShop"] = currentBool + end + } + ) + -- SCALE - local textScales= {0.5,0.75,1,1.25,1.5,2} - ModConfigMenu.AddSetting("EID", "Display", { - Type = ModConfigMenuOptionType.NUMBER, - CurrentSetting = function() - return AnIndexOf(textScales,EIDConfig["Scale"]) - end, - Minimum = 1, - Maximum = 6, - Display = function() - return "Text Size: " .. EIDConfig["Scale"] - end, - OnChange = function(currentNum) - EIDConfig["Scale"] = textScales[currentNum] - - end, - }) + local textScales = {0.5, 0.75, 1, 1.25, 1.5, 2} + ModConfigMenu.AddSetting( + "EID", + "Display", + { + Type = ModConfigMenuOptionType.NUMBER, + CurrentSetting = function() + return AnIndexOf(textScales, EIDConfig["Scale"]) + end, + Minimum = 1, + Maximum = 6, + Display = function() + return "Text Size: " .. EIDConfig["Scale"] + end, + OnChange = function(currentNum) + EIDConfig["Scale"] = textScales[currentNum] + end + } + ) -- maxDistance - local distances={1,1.5,2,3,4,5,6,7,8,9,10} - ModConfigMenu.AddSetting("EID", "Display", { - Type = ModConfigMenuOptionType.SCROLL, - CurrentSetting = function() - return AnIndexOf(distances,EIDConfig["MaxDistance"])-1 - end, - Display = function() - return "Display Distance: $scroll" .. AnIndexOf(distances,EIDConfig["MaxDistance"])-1 .." "..EIDConfig["MaxDistance"].." Grids" - end, - OnChange = function(currentNum) - EIDConfig["MaxDistance"]= distances[currentNum+1] - end - }) + local distances = {1, 1.5, 2, 3, 4, 5, 6, 7, 8, 9, 10} + ModConfigMenu.AddSetting( + "EID", + "Display", + { + Type = ModConfigMenuOptionType.SCROLL, + CurrentSetting = function() + return AnIndexOf(distances, EIDConfig["MaxDistance"]) - 1 + end, + Display = function() + return "Display Distance: $scroll" .. + AnIndexOf(distances, EIDConfig["MaxDistance"]) - 1 .. " " .. EIDConfig["MaxDistance"] .. " Grids" + end, + OnChange = function(currentNum) + EIDConfig["MaxDistance"] = distances[currentNum + 1] + end + } + ) -- Transparency - 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", { - Type = ModConfigMenuOptionType.SCROLL, - CurrentSetting = function() - return AnIndexOf(transparencies,EIDConfig["Transparency"])-1 - end, - Display = function() - return "Transparency: $scroll" .. AnIndexOf(transparencies,EIDConfig["Transparency"])-1 .." "..EIDConfig["Transparency"] - end, - OnChange = function(currentNum) - EIDConfig["Transparency"]= transparencies[currentNum+1] - end - }) - --------ShowItemName--------- - ModConfigMenu.AddSetting("EID","Display", { - Type = ModConfigMenuOptionType.BOOLEAN, - CurrentSetting = function() - return EIDConfig["ShowItemName"] - end, - Display = function() - local onOff = "False" - if EIDConfig["ShowItemName"] then - onOff = "True" + 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", + { + Type = ModConfigMenuOptionType.SCROLL, + CurrentSetting = function() + return AnIndexOf(transparencies, EIDConfig["Transparency"]) - 1 + end, + Display = function() + return "Transparency: $scroll" .. + AnIndexOf(transparencies, EIDConfig["Transparency"]) - 1 .. " " .. EIDConfig["Transparency"] + end, + OnChange = function(currentNum) + EIDConfig["Transparency"] = transparencies[currentNum + 1] end - return "Display Item Name: " .. onOff - end, - OnChange = function(currentBool) - EIDConfig["ShowItemName"] = currentBool - end, - }) - --------ShowItemType--------- - ModConfigMenu.AddSetting("EID","Display", { - Type = ModConfigMenuOptionType.BOOLEAN, - CurrentSetting = function() - return EIDConfig["ShowItemType"] - end, - Display = function() - local onOff = "False" - if EIDConfig["ShowItemType"] then - onOff = "True" + } + ) + --------ShowItemName--------- + ModConfigMenu.AddSetting( + "EID", + "Display", + { + Type = ModConfigMenuOptionType.BOOLEAN, + CurrentSetting = function() + return EIDConfig["ShowItemName"] + end, + Display = function() + local onOff = "False" + if EIDConfig["ShowItemName"] then + onOff = "True" + end + return "Display Item Name: " .. onOff + end, + OnChange = function(currentBool) + EIDConfig["ShowItemName"] = currentBool end - return "Display Item Type: " .. onOff - end, - OnChange = function(currentBool) - EIDConfig["ShowItemType"] = currentBool - end, - }) - -------TRANSFORMATIONS--------- - - ModConfigMenu.AddSetting("EID","Display", { - Type = ModConfigMenuOptionType.BOOLEAN, - CurrentSetting = function() - return EIDConfig["TransformationText"] - end, - Display = function() - local onOff = "False" - if EIDConfig["TransformationText"] then - onOff = "True" + } + ) + --------ShowItemType--------- + ModConfigMenu.AddSetting( + "EID", + "Display", + { + Type = ModConfigMenuOptionType.BOOLEAN, + CurrentSetting = function() + return EIDConfig["ShowItemType"] + end, + Display = function() + local onOff = "False" + if EIDConfig["ShowItemType"] then + onOff = "True" + end + return "Display Item Type: " .. onOff + end, + OnChange = function(currentBool) + EIDConfig["ShowItemType"] = currentBool end - return "Display Transformation Name: " .. onOff - end, - OnChange = function(currentBool) - EIDConfig["TransformationText"] = currentBool - end, - }) - ModConfigMenu.AddSetting("EID","Display", { - Type = ModConfigMenuOptionType.BOOLEAN, - CurrentSetting = function() - return EIDConfig["TransformationIcons"] - end, - Display = function() - local onOff = "False" - if EIDConfig["TransformationIcons"] then - onOff = "True" - end - return "Display Transformation Icon: " .. onOff - end, - OnChange = function(currentBool) - EIDConfig["TransformationIcons"] = currentBool - end, - }) + } + ) + -------TRANSFORMATIONS--------- + ModConfigMenu.AddSetting( + "EID", + "Display", + { + Type = ModConfigMenuOptionType.BOOLEAN, + CurrentSetting = function() + return EIDConfig["TransformationText"] + end, + Display = function() + local onOff = "False" + if EIDConfig["TransformationText"] then + onOff = "True" + end + return "Display Transformation Name: " .. onOff + end, + OnChange = function(currentBool) + EIDConfig["TransformationText"] = currentBool + end + } + ) + ModConfigMenu.AddSetting( + "EID", + "Display", + { + Type = ModConfigMenuOptionType.BOOLEAN, + CurrentSetting = function() + return EIDConfig["TransformationIcons"] + end, + Display = function() + local onOff = "False" + if EIDConfig["TransformationIcons"] then + onOff = "True" + end + return "Display Transformation Icon: " .. onOff + end, + OnChange = function(currentBool) + EIDConfig["TransformationIcons"] = currentBool + end + } + ) end