From 5eb14e474261283c20746351090adb216bdffaed Mon Sep 17 00:00:00 2001 From: Wofsauge Date: Wed, 25 Nov 2020 01:51:02 +0100 Subject: [PATCH] Added dynamic Card and pill markup entries --- descriptions/ab+/DUMMY_TRANSLATIONSET.lua | 2 +- descriptions/ab+/bul.lua | 2 +- descriptions/ab+/en_us.lua | 2 +- descriptions/ab+/en_us_detailed.lua | 2 +- descriptions/ab+/fr.lua | 2 +- descriptions/ab+/pl.lua | 2 +- descriptions/ab+/pt.lua | 2 +- descriptions/ab+/ru.lua | 2 +- descriptions/ab+/spa.lua | 2 +- descriptions/ab+/turkish.lua | 2 +- eid_api.lua | 20 +++- eid_data.lua | 2 + eid_debugging.lua | 4 +- main.lua | 44 ++----- .../{cardfronts.anm2 => eid_cardfronts.anm2} | 112 +++++++++--------- .../{cardfronts.png => eid_cardfronts.png} | Bin 16 files changed, 97 insertions(+), 105 deletions(-) rename resources/gfx/{cardfronts.anm2 => eid_cardfronts.anm2} (62%) rename resources/gfx/{cardfronts.png => eid_cardfronts.png} (100%) diff --git a/descriptions/ab+/DUMMY_TRANSLATIONSET.lua b/descriptions/ab+/DUMMY_TRANSLATIONSET.lua index 612f0921..b9385031 100644 --- a/descriptions/ab+/DUMMY_TRANSLATIONSET.lua +++ b/descriptions/ab+/DUMMY_TRANSLATIONSET.lua @@ -761,7 +761,7 @@ EID.descriptions["DUMMY"].cards={ ---------- Pills ---------- -EID.descriptions["DUMMY"].unidentifiedPill = "- Unidentified Pill" +EID.descriptions["DUMMY"].unidentifiedPill = "Unidentified Pill" EID.descriptions["DUMMY"].pills={ {"1", "Bad Trip", "Spawns a Gas cloud"}, diff --git a/descriptions/ab+/bul.lua b/descriptions/ab+/bul.lua index a490e342..5723d97a 100644 --- a/descriptions/ab+/bul.lua +++ b/descriptions/ab+/bul.lua @@ -766,7 +766,7 @@ EID.descriptions["bul"].cards={ ---------- Pills ---------- -EID.descriptions["bul"].unidentifiedPill = nil--"- Неизвестная пилюля" +EID.descriptions["bul"].unidentifiedPill = nil--"Неизвестная пилюля" EID.descriptions["bul"].pills={ --[[{"0", "Вонючий Газ", " Создает облако ядовитого газа"}, diff --git a/descriptions/ab+/en_us.lua b/descriptions/ab+/en_us.lua index 2dbe81ee..6d9fb5c0 100644 --- a/descriptions/ab+/en_us.lua +++ b/descriptions/ab+/en_us.lua @@ -761,7 +761,7 @@ EID.descriptions["en_us"].cards={ ---------- Pills ---------- -EID.descriptions["en_us"].unidentifiedPill = "- Unidentified Pill" +EID.descriptions["en_us"].unidentifiedPill = "Unidentified Pill" EID.descriptions["en_us"].pills={ {"0", "", "Spawns a Gas cloud"}, diff --git a/descriptions/ab+/en_us_detailed.lua b/descriptions/ab+/en_us_detailed.lua index 25fa126a..c5f10be7 100644 --- a/descriptions/ab+/en_us_detailed.lua +++ b/descriptions/ab+/en_us_detailed.lua @@ -758,7 +758,7 @@ EID.descriptions["en_us_detailed"].cards={ } ---------- Pills ---------- -EID.descriptions["en_us_detailed"].unidentifiedPill = "- Unidentified Pill" +EID.descriptions["en_us_detailed"].unidentifiedPill = "Unidentified Pill" EID.descriptions["en_us_detailed"].pills={ {"0", "", "On use, the player farts, poisoning enemies around him."}, diff --git a/descriptions/ab+/fr.lua b/descriptions/ab+/fr.lua index 50e32445..d415bb35 100644 --- a/descriptions/ab+/fr.lua +++ b/descriptions/ab+/fr.lua @@ -766,7 +766,7 @@ EID.descriptions["fr"].cards={ ---------- Pills ---------- -EID.descriptions["fr"].unidentifiedPill = "- Pilule non identifiée" +EID.descriptions["fr"].unidentifiedPill = "Pilule non identifiée" EID.descriptions["fr"].pills={ {"0", "", "Fait apparaître un nuage de gaz"}, diff --git a/descriptions/ab+/pl.lua b/descriptions/ab+/pl.lua index 96b3d9a7..ea2ecdce 100644 --- a/descriptions/ab+/pl.lua +++ b/descriptions/ab+/pl.lua @@ -761,7 +761,7 @@ EID.descriptions["pl"].cards={ ---------- Pills ---------- -EID.descriptions["pl"].unidentifiedPill = nil--"- Unidentified Pill" +EID.descriptions["pl"].unidentifiedPill = nil--"Unidentified Pill" EID.descriptions["pl"].pills={ --[[ {"1", "Bad Trip", "Spawns a Gas cloud"}, diff --git a/descriptions/ab+/pt.lua b/descriptions/ab+/pt.lua index 28a4330e..8ad7505b 100644 --- a/descriptions/ab+/pt.lua +++ b/descriptions/ab+/pt.lua @@ -763,7 +763,7 @@ EID.descriptions["pt"].cards={ ---------- Pills ---------- -EID.descriptions["pt"].unidentifiedPill = "- Comprimido não identificado" +EID.descriptions["pt"].unidentifiedPill = "Comprimido não identificado" EID.descriptions["pt"].pills={ {"0", "", "Cria uma nuvem de gás"}, diff --git a/descriptions/ab+/ru.lua b/descriptions/ab+/ru.lua index 2374e962..e7349478 100644 --- a/descriptions/ab+/ru.lua +++ b/descriptions/ab+/ru.lua @@ -756,7 +756,7 @@ EID.descriptions["ru"].cards={ ---------- Pills ---------- -EID.descriptions["ru"].unidentifiedPill = "- Неизвестная пилюля" +EID.descriptions["ru"].unidentifiedPill = "Неизвестная пилюля" EID.descriptions["ru"].pills={ {"0", "Вонючий Газ", " Создает облако ядовитого газа"}, diff --git a/descriptions/ab+/spa.lua b/descriptions/ab+/spa.lua index 3c1c1e2e..d4cd8674 100644 --- a/descriptions/ab+/spa.lua +++ b/descriptions/ab+/spa.lua @@ -764,7 +764,7 @@ EID.descriptions["spa"].cards={ ---------- Pills ---------- -EID.descriptions["spa"].unidentifiedPill = "- Píldora sin identificar" +EID.descriptions["spa"].unidentifiedPill = "Píldora sin identificar" EID.descriptions["spa"].pills={ {"0", "", "Genera una nube de gas"}, diff --git a/descriptions/ab+/turkish.lua b/descriptions/ab+/turkish.lua index 36ebeec5..817312c7 100644 --- a/descriptions/ab+/turkish.lua +++ b/descriptions/ab+/turkish.lua @@ -761,7 +761,7 @@ EID.descriptions["turkish"].cards={ ---------- Pills ---------- -EID.descriptions["turkish"].unidentifiedPill = "- Tanımlanamamış Hap" +EID.descriptions["turkish"].unidentifiedPill = "Tanımlanamamış Hap" EID.descriptions["turkish"].pills={ {"1", "Bad Trip", "Spawns a Gas cloud"}, diff --git a/eid_api.lua b/eid_api.lua index 5f00bf8c..c034a022 100644 --- a/eid_api.lua +++ b/eid_api.lua @@ -359,18 +359,32 @@ function EID:getIcon(str) end end --- Tries to read special markup used to generate icons for all Collectibles/Trinkets +-- Tries to read special markup used to generate icons for all Collectibles/Trinkets and the default cards -- Returns an inlineIcon Object or nil if no parsing was possible function EID:createItemIconObject(str) local collID,numReplace = string.gsub(str, "Collectible", "") local item = nil - if numReplace>0 and collID~="" then + if numReplace > 0 and collID ~= "" then item = EID.itemConfig:GetCollectible(tonumber(collID)) end local trinketID,numReplace2 = string.gsub(str, "Trinket", "") - if numReplace2>0 and trinketID~="" then + if numReplace2 > 0 and trinketID ~= "" then item = EID.itemConfig:GetTrinket(tonumber(trinketID)) end + local cardID,numReplace3 = string.gsub(str, "Card", "") + if numReplace3 > 0 and cardID ~= "" and tonumber(cardID) ~= nil then + if tonumber(cardID)>54 then return EID.InlineIcons[str] or EID.InlineIcons["Blank"] end + local spriteDummy = Sprite() + spriteDummy:Load("gfx/eid_cardfronts.anm2", true) + return {cardID,0,8,8,0,0,spriteDummy} + end + local pillID,numReplace4 = string.gsub(str, "Pill", "") + if numReplace4 > 0 and pillID ~= "" and tonumber(pillID) ~= nil then + if tonumber(pillID)>13 then return EID.InlineIcons[str] or EID.InlineIcons["Blank"] end + local spriteDummy = Sprite() + spriteDummy:Load("gfx/ui/ui_cardspills.anm2", true) + return {"PillsSmall",tonumber(pillID)-1,8,8,4,6,spriteDummy} + end if item == nil then return nil end diff --git a/eid_data.lua b/eid_data.lua index 06784edb..b643f637 100644 --- a/eid_data.lua +++ b/eid_data.lua @@ -60,8 +60,10 @@ EID.InlineIcons = { ["Coin"] = {"pickups", 4, 7, 9}, ["Rune"] = {"pickups", 5, 8, 9}, ["Card"] = {"pickups", 6, 11, 11}, + ----- Use Markup "Card"+ ID to render card-front sprites (example: {{Card1}} = 01 - The Fool) ["RedCard"] = {"pickups", 7, 11, 11}, ["Pill"] = {"pickups", 8, 9, 9}, + ----- Use Markup "Pill"+ ID to render pill sprites (example: {{Pill1}} = Blue Pill) ["Battery"] = {"pickups", 9, 8, 9}, ["Collectible"] = {"Collectible", 0, 7, 7}, ----- Use Markup "Collectible"+ ITEMID to render collectible sprites (example: {{Collectible1}} = Sad Onion) diff --git a/eid_debugging.lua b/eid_debugging.lua index 4f4f7f25..a5cc9201 100644 --- a/eid_debugging.lua +++ b/eid_debugging.lua @@ -9,7 +9,7 @@ local charsToDebug = { "emotes: ☆★〠♠♣♥♦♤♧♡♢☀☂♨♪♭♯♂♀", "custom icons: ↑Positive ↓Negative \007bulletpoint !Exclamation ǃWarning !!!3!shortcut ǂHashtag", "legacy icon Markup: \\1:\1Positive \\2:\2Negative \\3:\3Warning \\6:\6 heart \\5:\5 Key \\015:\015 Coin \\8\\189:\8\189 Bomb", - "Markup main: |{{ArrowUp}}|{{ArrowDown}}|{{Warning}}|{{ERROR}}|{{Hashtag}}", + "Markup main: |{{ArrowUp}}|{{ArrowDown}}|{{Warning}}|{{ERROR}}|{{Hashtag}}|{{Collectible1}}|{{Trinket1}}|{{Card1}}|{{Pill1}}|", "Markup numbers: |{{0}}|{{1}}|{{2}}|{{3}}|{{4}}|{{5}}|{{6}}|{{7}}|{{8}}|{{9}}|{{10}}|{{11}}|{{12}}|", "Markup hearts: |{{Heart}}|{{HalfHeart}}|{{EthernalHeart}}|{{EmptyHeart}}|{{BlendedHeart}}|{{BoneHeart}}|{{HalfBoneHeart}}|{{EmptyBoneHeart}}|{{SoulHeart}}|{{HalfSoulHeart}}|{{BlackHeart}}|{{HalfBlackHeart}}|{{GoldenHeart}}|{{CoinHeart}}|{{HalfCoinHeart}}|{{EmptyCoinHeart}}|", "Markup pickups: |{{Key}}|{{GoldenKey}}|{{Bomb}}|{{GoldenBomb}}|{{Coin}}|{{Card}}|{{RedCard}}|{{Collectible}}|{{Pill}}|{{Trinket}}|{{Battery}}|{{Rune}}|{{Slotmachine}}|", @@ -73,6 +73,8 @@ EID:addIcon("TestIcon", "hearts", -1, 9, 9, -1, 0, dummySprite2) local dummySprite3 = Sprite() dummySprite3:Load("gfx/eid_inline_icons.anm2", true) EID.InlineIcons["Test"] = {"pickups", -1, 9, 9, -1, 0, dummySprite3} +-- Add custom card / pill icon +--EID.InlineIcons["Card58"] = {"pickups", -1, 9, 9, -1, 0, dummySprite3} __eidItemDescriptions[2] = "{{Bomb}} Emote {{Key}} Test {{Test}}{{TestIcon}} {{ColorBlackBlink}}description {{SomeInvalidInnerStuff}} cool" -- 5.100.2 = Inner Eye diff --git a/main.lua b/main.lua index 804699a3..940caec1 100644 --- a/main.lua +++ b/main.lua @@ -23,9 +23,6 @@ local ArrowSprite = Sprite() ArrowSprite:Load("gfx/icons.anm2", true) ArrowSprite:Play("Arrow", false) -local CardSprite = Sprite() -CardSprite:Load("gfx/cardfronts.anm2", true) - require("eid_config") require("mod_config_menu") @@ -107,14 +104,18 @@ function EID:printDescription(desc) local iconType = nil if desc.ItemType == 5 and desc.ItemVariant == 100 then iconType = "Collectible" - elseif desc.ItemType == 5 and desc.ItemVariant == 350 then + elseif desc.ItemType == 5 and desc.ItemVariant == 350 then iconType = "Trinket" + elseif desc.ItemType == 5 and desc.ItemVariant == 300 then + iconType = "Card" + elseif desc.ItemType == 5 and desc.ItemVariant == 70 then + iconType = "Pill" end if iconType ~= nil then - offsetX = offsetX + 16 + offsetX = offsetX + 12 EID:renderString( "{{" .. iconType .. desc.ID .. "}}", - Vector(EIDConfig["XPosition"], padding - 4), + Vector(EIDConfig["XPosition"], padding - 5), Vector(EIDConfig["Scale"], EIDConfig["Scale"]), EID:getNameColor() ) @@ -253,7 +254,7 @@ function EID:renderIndicator(entity) if entity.Variant == 100 and not entity:ToPickup():IsShopItem() then ArrowOffset = Vector(0, -62) end - ArrowSprite:Render(Game():GetRoom():WorldToScreenPosition(entity.Position + ArrowOffset), nullVector, nullVector)) + ArrowSprite:Render(Game():GetRoom():WorldToScreenPosition(entity.Position + ArrowOffset), nullVector, nullVector) end end @@ -372,20 +373,6 @@ local function onRender(t) return end EID:printDescription(EID:getDescriptionObj("cards", closest.Type, closest.Variant, closest.SubType)) - if closest.SubType <= 54 then - CardSprite:Play(tostring(closest.SubType)) - 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"]), - nullVector, - nullVector - ) - end elseif closest.Variant == PickupVariant.PICKUP_PILL then if closest:ToPickup():IsShopItem() and not EIDConfig["DisplayPillInfoShop"] then EID:renderQuestionMark() @@ -400,25 +387,12 @@ local function onRender(t) EID:printDescription(EID:getDescriptionObj("pills", closest.Type, closest.Variant, pillEffect + 1)) else EID:renderString( - EID:getDescriptionTable("unidentifiedPill"), + "{{Pill"..pillColor.."}} "..EID:getDescriptionTable("unidentifiedPill"), Vector(EIDConfig["XPosition"], posY()), Vector(EIDConfig["Scale"], EIDConfig["Scale"]), EID:getErrorColor() ) end - local pillsprite = closest:GetSprite() - 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"]), - nullVector, - nullVector - ) - pillsprite.Scale = Vector(1, 1) end if player:HasCollectible(CollectibleType.COLLECTIBLE_SCHOOLBAG) then modifiedPosY = EIDConfig["YPosition"] + 30 diff --git a/resources/gfx/cardfronts.anm2 b/resources/gfx/eid_cardfronts.anm2 similarity index 62% rename from resources/gfx/cardfronts.anm2 rename to resources/gfx/eid_cardfronts.anm2 index f2aaa3e2..6c11fbdd 100644 --- a/resources/gfx/cardfronts.anm2 +++ b/resources/gfx/eid_cardfronts.anm2 @@ -1,8 +1,8 @@ - + - + @@ -17,7 +17,7 @@ - + @@ -29,7 +29,7 @@ - + @@ -41,7 +41,7 @@ - + @@ -53,7 +53,7 @@ - + @@ -65,7 +65,7 @@ - + @@ -77,7 +77,7 @@ - + @@ -89,7 +89,7 @@ - + @@ -101,7 +101,7 @@ - + @@ -113,7 +113,7 @@ - + @@ -125,7 +125,7 @@ - + @@ -137,7 +137,7 @@ - + @@ -149,7 +149,7 @@ - + @@ -161,7 +161,7 @@ - + @@ -173,7 +173,7 @@ - + @@ -185,7 +185,7 @@ - + @@ -197,7 +197,7 @@ - + @@ -209,7 +209,7 @@ - + @@ -221,7 +221,7 @@ - + @@ -233,7 +233,7 @@ - + @@ -245,7 +245,7 @@ - + @@ -257,7 +257,7 @@ - + @@ -269,7 +269,7 @@ - + @@ -281,7 +281,7 @@ - + @@ -293,7 +293,7 @@ - + @@ -305,7 +305,7 @@ - + @@ -317,7 +317,7 @@ - + @@ -329,7 +329,7 @@ - + @@ -341,7 +341,7 @@ - + @@ -353,7 +353,7 @@ - + @@ -365,7 +365,7 @@ - + @@ -377,7 +377,7 @@ - + @@ -389,7 +389,7 @@ - + @@ -401,7 +401,7 @@ - + @@ -413,7 +413,7 @@ - + @@ -425,7 +425,7 @@ - + @@ -437,7 +437,7 @@ - + @@ -449,7 +449,7 @@ - + @@ -461,7 +461,7 @@ - + @@ -473,7 +473,7 @@ - + @@ -485,7 +485,7 @@ - + @@ -497,7 +497,7 @@ - + @@ -509,7 +509,7 @@ - + @@ -521,7 +521,7 @@ - + @@ -533,7 +533,7 @@ - + @@ -545,7 +545,7 @@ - + @@ -557,7 +557,7 @@ - + @@ -569,7 +569,7 @@ - + @@ -581,7 +581,7 @@ - + @@ -593,7 +593,7 @@ - + @@ -605,7 +605,7 @@ - + @@ -617,7 +617,7 @@ - + @@ -629,7 +629,7 @@ - + @@ -641,7 +641,7 @@ - + @@ -653,7 +653,7 @@ - + diff --git a/resources/gfx/cardfronts.png b/resources/gfx/eid_cardfronts.png similarity index 100% rename from resources/gfx/cardfronts.png rename to resources/gfx/eid_cardfronts.png